#development
1 messages · Page 17 of 1
so you probably need to get it through the stream
altho i just checked it fast and not really in detail, it could be somewhere
the minecraft plugin i want to modify wants the mp3 files in plugins/CustomDiscs/musicdata/, it cant handle links
let me check it out
thats for you to do, you take it from there then put wherever you want
or just load directly if the plugin has the methods exposed
load directly?
gotta check the plugin
its able to hotload so to speak, no restarting needed for it to detect a mp3 file and use it
but idk if thats what you meant
yes, but the method it uses for that might be exposed
so you could technically just download through the api and load using their method (or your own)
never heard of exposed methods before
something you can access externally
most programs will hide implementation details since if you dont know what you are doing you can break stuff
and "expose" methods as an API so you can interact and use them
so when checking the plugin for exposed methods, what do i look for?
usually they are documented in the github or w.e. you find them
if not you gotta dig in and learn how it works sadly
yeah no
Same question lol
you are semi lucky public void playLocationalAudio(VoicechatServerApi api, Path soundFilePath, Player bukkitPlayer, Block block) {
this is open
under PlayerManager
not sure what voicechatserver api is though
I believe piggy added that at some point. there is some lore behind it, I just can't remember (also wasn't here, just was told)
if i were you, i would just add this plugin as dependency
users with the mod can talk to eachother in groups or proximity if the server has the plugin
then use its methods
honestly you dont need anything else than that class
ah. @dense drift, @brittle thunder #development message
the answer is a long time
almost a year
im there rn
i think this class has all the logic for parsing the file if i am not wrong
the command however, it requires you to input the filename of the file in the folder
which is the CreateCommand java file
thats the easiest part
Damn
no idea how to do that
if you check the method there
it takes a path
in playerManager
that path is the file path for mp3 file
rest of the logic on how the command works is irrelevant
from which line is this
ah i was in the other file
get the path
give it a player and a block
and it should just work
and for soundcloud part
you will have to download it as mp3 save it somewhere
then call this method with its path
whats the other part for do you mean, the "give it a player and a block" thing
sorry im being slow
method takes api, filePath, player and block
ahh
im guessing block is source of the sound
player is who you are playing to
path is the file you are playing
and api is there to pass its reference (aka address)
you should find where the reference to this class is stored though
it creates a thread
every time its initialized so creating a new instance
everytime you play is a bad idea
okay you are hella lucky
thats also exposed
so no need to edit this plugin what so ever
huh
you can make your own and hook up to it no issues
the command wont take links, only the file name
oh?
you will make your own obviously
oh
but you dont need to make a new sound player thing (or understand how this one works)
can you tell i havent made plugins before
what you need to do is this:
take link from player
download mp3 from that link somehow(probably a lib for it)
save the mp3 somewhere
call PlayerManager.instance().playLocationalAudio(VoicechatServerApi api, Path soundFilePath, Player bukkitPlayer, Block block)
and it should just play
public void stopLocationalAudio(Location blockLocation)
this to stop the sound
PlayerManager.instance().stopLocationalAudio(Location blockLocation)
so like this basically
how do I get started with a plugin? like, whats the structure?
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
downloading the file from soundcloud is gonna be your main issue
found a plugin for idea that helps with the boilerplate code
.
ok i got the template
how will it hook into the other plugin though? they're 2 separate jar files, 2 separate projects, how would that work
add it as dependency
in your ide
then add it to your plugin.yml as dependency
so it loads first
im not sure how to do that
working on it
so if i want to depend the original plugin (CustomDiscs) what do I put as the thing to depend?
depend:
- CustomDiscs
like so?
yep thats it

the simple voice chat?
yeah
gotcha
whatever its plugin name is
the original plugin also depends on protocollib to work
so i guess ill also depend on it
thats not your concern
nevermind
right
it takes it as first parameter
then i will rename the original one because i want to use that command
customdisc:
description: The custom discs command.
aliases: cd
you would need to change the code too
no
genius
okay then
yml file done
i am making good progress for being my first plugin
dont you think?
now then
when the player types the command i want to take the link and download the mp3 to the folder, and then call PlayerManager.instance().playLocationalAudio(VoicechatServerApi api, Path soundFilePath, Player bukkitPlayer, Block block)
if you will use this
on a production server
then you probably want to do that on another thread
why and how
it doesnt really matter if its just your friends
its a server with like 20 people
reason being, io operations and downloading etc take time
meaning that server has to wait until its done to keep processing stuff
but i would like for it to be suitable for more than just whitelisted small servers
if you do it on main thread
then itll slow everything down
then you have to do it on another thread
so do i want to create a new thread on plugin startup?
you can use integrated methods for it
runTaskAsyncronously or smt
is the name of it
you get it from Bukkit.getScheduler
You can access the command map and rename the original command so you can add yours if you really want to
they are semi new, reflection is probably too much
im completely new to plugins
be careful with this
you cant do anything to the server
if you are on another thread
99% of the bukkit methods are not thread-safe
my first project was converting my python discord bot to java, friend was basically doing everything for me for days and just quizzing me, but i took over bit by bit and now i do most of it on my own
but that means im basically just familiar with JDA (java discord api)
no clue how plugins work
okay
so i can download on the non-main thread but not put the file in the folder on that thread?
oh file operation is fine
oh
you cant touch bukkit from that thread
ohh
(or bukkit files)
should be fine right?
for what you want to do
it should be fine
just fire a new runnable
with the download and saving logic
callSyncMethod?
once its done return to main thread and play it
i believe
runTaskAsync - to use another thread
runTask to return
using multiple threads in bukkit is simple ish
just make sure you dont edit anything from that thread while you are on it
use it in self contained sense basically
no no no
on command issued?
yes
// Plugin startup logic
System.out.println("end my suffering");
Bukkit.getScheduler().runTaskAsynchronously();
wrong place?
look into schedulers
aha
thats not how you use them
i have one of those for my bot
you cant, this one is a bukkit specific implementation
you can use your own threading solution as well
but this is simpler
and 100% capable of what you want to do
public void onEnable() {
// Plugin startup logic
System.out.println("end my suffering");
BukkitScheduler scheduler = Bukkit.getScheduler();
yes?
not on enable though
it runs the code in runnable in another thread
and you want it to happen when a command happens so
should i make a separate class file for the command?
then I will
keep everything in the same file, don't have any seperation at all
and you need to make a new line everytime you use .

a space? nah, new line
of course
or dont use new line at all
average python user

yeahhh
gimme something to watch, need something on the side monitor while i finish boilerplate code
breaking bad
public
class
MyPlugin
extends
JavaPlugin
{
@Override
public
void
onEnable()
{
this.
getServer().
getLogger().
log("kek")
;
}
my brain broke too much to go any further than that
public class MyPlugin extends JavaPlugin { @Override public void onEnable() { this.getServer().getLogger().log("kek");}
who needs spacing
so im looking at the original plugins command thing
it has a public string getName, getDescription and getSyntax
guessing these are all needed in mine too
its how you set up commands in bukkit
it wants implements and not extends
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;
import org.jetbrains.annotations.NotNull;
public class Command implements CommandExecutor {
@Override
public boolean onCommand(@NotNull CommandSender sender, org.bukkit.command.@NotNull Command command, @NotNull String label, @NotNull String[] args) {
return false;
}
}
it just kinda made all of this for me
yeah thats what you're supposed to do
yeah
oka
could be, its been a while since i did it manually honestly
yeah it'll manually do all of that
i do also want to add a permission and check if the player has the permission before the rest of the command continues
guessing CommandSender sender is the player
and add a permission to the yml
CommandSender is whatever sent the command
ok
so if i want the permission to be dvd.command then
player.hasPermission(dvd.command)
with ""
you're gonna want to check if its a player first
that CommandSender could be a player, could be console, could be a command block, etc
yes
since its a string
this as well
you always are
d;spigot Player#hasPermission(String)
boolean hasPermission(@NotNull String name)```
Gets the value of the specified permission, if set.
If a permission override is not set on this object, the default value of the permission will be returned.
Value of the permission
name - Name of the permission


oka i back
had to use the oval office
there
public class Command implements CommandExecutor {
@Override
public boolean onCommand(@NotNull CommandSender sender, org.bukkit.command.@NotNull Command command, @NotNull String label, @NotNull String[] args) {
if(sender instanceof Player && sender.hasPermission("dvd.command")) {
//stuff
}
return false;
}
}
so far
this will work with luckperms yes?
if i give a player dvd.command thru luckperms then the command will work
so now comes the hard part, soundclouding
"take link from player
download mp3 from that link somehow(probably a lib for it)
save the mp3 somewhere
call PlayerManager.instance().playLocationalAudio(VoicechatServerApi api, Path soundFilePath, Player bukkitPlayer, Block block)"
so first of all i need to have a syntax for the command
./dvd create <url> <lore>
im gonna make it a subcommand instead
fancier
alright so its like 7:45pm
i think im going to continue working on this tomorrow
ty for the assistance @merry knoll much appreciated ❤️
Does this make sense?
private Pattern mcFormattedHex = Pattern.compile("&x([A-Fa-f0-9&]){12}");
public String decolorHex(String s) {
Matcher matcher = mcFormattedHex.matcher(removeColor(s));
ConsoleOutput.log("DEBUG >> Decolorized: "+removeColor(s)+(matcher.find() ? " Matcher Found" : "")
ConsoleOutput.log("DEBUG >> Match: "+matcher.find())
```Output:
> DEBUG >> Decolorized: &x&1&8&f&2&7&d(10) ..... Matcher Found
> DEBUG >> Match: false
Matcher#find is something like Iterator#hasNext 🙂
Exactly. So why is it saying true above but false on the next line.
Also without the loggers it's suppose to be while(matcher.find()) {} but the output in the while doesn't run.
Thinking of something else when you said iterator.hasNext() so just read the bottom of the last message.
Matcher#find mutates the matcher and tries to find the "next" match in the input string (or the first one if no finding has been attempted)
it doesn't return if there is a match, it returns if there is a subsequent match to continue processing the matcher and it "stands" the matcher wherever the potential match is at, if there is no next match, it'll return false
I'll show my code when I get on PC. I do basically the same thing to color the string with hex. Just decoloring it doesn't want to work.
Pattern pattern = compile("hi");
Matcher matcher = pattern.matcher("hi hi hi");
matcher.find(); // true "*hi* hi hi"
matcher.find(); // true "hi *hi* hi"
matcher.find(); // true "hi hi *hi*"
matcher.find(); // false "hi hi hi" no matches left
By calling find in the logging you're mutating the matcher's Internal state
is there any way of changing the outline color of an entity without team packets (or real teams for that regard)?
Yes got that. Read 2 (6 from this message) messages above lol
Not on PC so can't get the whole method.
while matcher.find() or multiple calls of matcher.find() is the same thing
Hey, is it possible to make playtime levels with DeluxeMenus?
if i use javascript type and expression %statistic_hours_played% >=
Wrong channel
🤦 when I asked yesterday, I wasn't using removeColor(s) in the matcher. And when I did test it (the code from my original message), I forgot to test it without the output.
Got it to work now.
I'm having trouble with how I can make chances, like for example how can I make a chance system where every kill it has to always drop something but the rarity of items is different? I've tried googling it but can't find anything :/
use random
^
yes but it only drops those items sometimes like it doesnt always just pick one
i need it to always drop an item but pick the rarity
random is the solution here, then you will set the rarities from it
well I deleted that code but it was someth like if (random.nextint(100) + 1) < 80) {
yes so how do i make it 100% chance to choose something to drop but with differenty rarities
hmm
and for a lot of ranges
just seperate the number
int random = random.nextInt(100)
if(random < 20) // 20% chance
{
// 20% chance code
} else if (random >= 20 && random < 40) // another 20%
{
} else if .. repeat
ah thank you
or even better implementation imho, create an array and fill it with drops
then pick randomly from the array
you can store the same object multiple times to change its %
thank you for the help 😄
["drop1","drop1","drop1","drop1","drop2"]
random pick from this gives you 80% drop 1 20% drop 2
I have this code for a void world chunk generator in my plugin: https://paste.helpch.at/ekovirisah.java. However, I want to support 1.17+ version to be used and some of the methods from 1.18+ does not exist in 1.17. How would I go about doing this?
I assume I need NMS, but ChunkGenerator does not exist in 1.17?
.
for lacking methods, you need to either do reflection
or even better different generators depending on version
var datt = (async () => {
try {
const price = await Fetcher.getItemPrice({
market_hash_name: market_hash_name,
appid: 730
});
return price;
} catch (error) {
}
})();
console.log(datt);```
hi amm anyone can please tell me why this returns me on console Promise <pending>? pretty much clue less
Js?
Basically it's because you're awaiting a response, there's a way to get the response. But I forgot how to do it.
Google await in js
It should give you a decent idea
im not following
a promise is not your result
e.g. datt.then((data) => console.log(data))
when you fetch a data, it promises something will be returned in the future
since it takes time to get it
then() block there tells it what to do with the data once its returned
wela is not aligned correctly
it's 1 over
main: me.ohlqvely.welamc.Main
name: WelaMC-Sabri
version: 1.0
description: CustomCommands
author: OhLqvely
commands:
discord:
description: discordlink
permission: core.discord.use
aliases:
permission-message: Geen permissie!
usage: "Usage: /discord"
wela:
description: wela socials
permission: core.wela.use
aliases:
permission-message: Geen permissie!
usage: "Usage: /wela"
I changed everything just for that
let me test my new thing
otherwise imma copy it
you can test your yaml with a parser online http://yaml-online-parser.appspot.com/
that's what I use
You put the wela command in the permissions block instead of the commands block
var price = await datt.then(result => result);
i wrote down this to get the price it self out of the promise but it is returns to me undefined while on the sync function the price gets printed any suggestion?
mixing await and .then is bad practice, in your example above you'd do console.log(await datt)
^ when you mix await and .then syntax, you get confusing behavior
var price = getSteamItemPrice("AK-47 | Redline (Field-Tested)", 730); //returns undefined
function getSteamItemPrice(hash_name, appid) {
Fetcher.getItemPrice({
market_hash_name: hash_name,
appid: appid,
callback: (err, price) => {
if (err) throw err;
callback(price);
}
});```
Ok I made some arrangement in the mess and i came up with this but I don't understand why the var is still undefined.
I clueless on this
which actions are safe to do on an inventory thread wise?
can you for example edit it on one thread then display it on main? i know it does cloning with setting items and such but not sure on the exact implementation
Because your function never returns anything
how does spigot order listeners with the same priority, are they ordered by insertion order?
probably, don't trust on the order if the priority is the same
Hi, I coded a Scoreboard but for some reason it flickers like crazy. Any ideas how I could fix this? (Scoreboard Class : https://paste.helpch.at/vagekujela.java)
use teams
instead of editing the score itself, set a team to it
then edit the values of the team
thx, I will try that 🙂
you want to edit the prefix - suffix an the name of the team
depending on the string length
How can I get how much tool is damaged at block break event with spigot api
get the itemstack, get the itemmeta, cast it to damageable and then damageable.getDamage()
Hey has anyone used vercel before with a single domain and multiple repos?
I have 3 repos one using domain.com/1 /2 and /3 and the normal way to set it up wasn't working for some reason as in https://drew.tech/posts/vercel-multiple-repos-same-domain so I did a hacky way to make it work but now its causing infinite loops and I am not sure how to fix it or make the proper way work.
How to do micro-frontends on Vercel with a single domain.
Any reason they can't be subdomains? Generally you deploy separate apps as separate subdomains, then you don't need to deal with rewriting and shit
I like it more tbh
Then any reason for not combining them into a single app? Presumably they're in Next, you could just use Next's routing
well some arent nextJS
landing page nextjs
Dashboard nextjs
docs / wiki
articles
web leaderboard
Yeah I mean I dunno man, sounds like a really good usecase for subdomains lol
any better way to store this data?
e907083e-5db6-41fc-9e32-5c4d99a08712:
'1':
reason: test
mod: e907083e-5db6-41fc-9e32-5c4d99a08712```currently using this:```java
Map<UUID, List<Map<Integer, Map<String, UUID>>>>```which is... uh... yea..
make a wrapper
whats that?
wrap the objects that you need to store
into another object
so its actually readable
can u give me an example?
what is this supposed to be exactly
warnings
okay, then
create a warning object
with who it is targeting, reason and who applied
then create a profile object of sorts with a set in it
that stores these warning objects
i love when intellij just doesnt show me the new file menu ❤️
is this right?
public class Warn {
private final UUID player;
private final int id;
private final String reason;
private final UUID mod;
public Warn(UUID player, int id, String reason, UUID mod) {
this.player = player;
this.id = id;
this.reason = reason;
this.moderator = mod;
}
public UUID getPlayer() {
return player;
}
public int getId() {
return id;
}
public String getReason() {
return reason;
}
public UUID getMod() {
return mod;
}
}```
yeah looks good
i would also wrap the player object
and tie it as value
to uuid as hashmap
(or concurrenthashmap if multi threaded)
what-
classic POJO
whats the difference?
public record Warn(int id, String reason, UUID mod) {}```
cause intellij tells me that it can just be a record, but ive never used records before
👀
what would be the difference with using List instead of Set?
set is not ordered
ordering doesnt matter for me, should i just use List?
if it doesnt matter, stick with set
its faster with lookups too
if you want to do .contains etc
especially hashset for ^ operations like these
ah alr then ill definitely use set
good to know for the future cause i usually just use List
also Set doesn't contain any duplicates
and also fun fact: HashSet uses HashMap and iirc the set is just the keys of the map
and hashmaps can't have duplicate keys :)
public record Mute(UUID player, String unit, String reason, long time, UUID mod) {}
public class DataManager {
public static final Set<Mute> mutes = new HashSet<>();
}```how would i get all muted players?
this is what i have rn but i wanna know if there is an easier/better way:
public static Set<UUID> getPlayers() {
final Set<UUID> muted = new HashSet<>();
for (final Mute mute : DataManager.mutes) muted.add(mute.player());
return muted;
}```(inside `Mute` record)
no im saying i have this:
public record Mute(UUID player, String unit, String reason, long time, UUID mod) {
public static Set<UUID> getPlayers() {
final Set<UUID> muted = new HashSet<>();
for (final Mute mute : DataManager.mutes) muted.add(mute.player());
return muted;
}
}```
and i wanna know if there's a better way to get players
I would personally use a stream
And wouldn't have any of it be static
return DataManager.mutes.stream().map(Mute::player).toSet();
Or .toCollection(new::HashSet)
if it isnt static i have to use new Mute(null, null, null, 0, null).getPlayers()
I don't think that function belongs in the Mute class tbh
I don't either
This record represents a singular Mute, what players are you getting?
They are accessing a static Set in DataManager
It was a question for them not their code.
I would take a moment and learn what the static keyword does, and what it's for before you make everything in your code static -- "Because it won't work otherwise"
yea but this just seems a bit excessive: https://srnyx.has.rocks/idea64_bCiPLzTldr.png
Welcome to Java
Also maybe organize it better than one large list
objects:
Account
Mute
PlayerStat
Spawn...
managers:
MuteManager
PlayerStatManager
SpawnManager...
Yeah that’s what I have for non-object managers cause I already have like 15 managers
AbstractManager moment
no. 1.12.2+ only
also #general-plugins for deluxemenus help
Hi everyone, I've got a little issue with my pom.xml could someone help me please.
(Caused by JDA 5.0.0)
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
Re-run the build with -e flag
could you post your pom.xml
Thanks everyone it's fixed !
what was the fix
Maven version compiler was too old
lol
😭
hey guys, can i use a placeholder to return something in a javascript placeholder?
like i want to pick info from another placeholder
and save it in a javascript
So who can give me my EZRankPro tag if there is one?
Hi. I'm looking for a way to override whatever is the responsible of listening to/handling incoming TCP connections in NMS. I basically want to proxy everything. my goal is preventing "connection close" that happens after a "player kick event". any ideas?
netty
public class Spawn {
// Variables
private final String team;
public Location location;
// Constructor
public Spawn(String team, Location location) {
this.team = team;
this.location = location;
}
}``````java
public Map<String, Location> spawns;```is there any difference between these?
well, the object can have methods and state
state?
other variables
you could, for instance, keep track of how many players have spawned there, or something
oh ye
if you literally need nothing more than a mapping of String to Location, then a Map will work fine
but if you ever want anything more, or if you want to work with them together, then you'll want an object
alr, ty
Hey there,
So basically what I am trying to do is when a button is clicked edit an embed.
Now all I want to do is add 1 line to the already existing embed, I have got the message, and then the embed and am able to edit it and update it. But it deletes everything and then just sends the one line i added, anyway to get the current embed data and add it to the new embed?
anyone who knows js that could help?
I have a weird issue, when I'm trying to loop through all entities in the world while the server have 1+ players it's finding them all,
but once the server empty from players it's not finding them all and gives less results, why is it?
The current code:
for (Entity entity : Bukkit.getWorld(CustomPlugin.getInstance().getMainManager().getDataManager().mainWorld).getEntities()) {
if (entity.getType() == EntityType.ARMOR_STAND) {
entity.remove();
}
}
I tried also if(entity instanceof ArmorStand) but same results...
Invite me please if possible
Chunks aren't loaded. Possibly no entities in spawn chunks.
How can i overcome it?
Well you can delete them as the chunks load.
anyone know javascript
var scripts = document.getElementsByTagName('script');
for (let script in scripts){
console.log(script.src);
}
why does this print undefined pls help
try
console.log(script.getAttribute('src'))
or you are trying to print the code?
its fixed its let script of scripts lol
anyway thx so much tho thats cool
getAttribute is elegant
Can I not set a slime's base attributes with this code?
mob.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(type.getHP());
mob.getAttribute(Attribute.GENERIC_ATTACK_DAMAGE).setBaseValue(type.getDmg());
mob.getAttribute(Attribute.GENERIC_MOVEMENT_SPEED).setBaseValue(type.getSpeed());```
It doesn't seem to work at least
I change the attributes after the entity is spawned, though I tried before as well and it didn't work
Also, do slimes deal X amount of damage based on their size?
https://upload.skyslycer.de/idea64_hx6mPHQwru.png This doesnt look right...
triumph gui apparently wants minimessage from oraxen
(gradle says the same)
alr did that and didnt work sadly
That's not weird
it feels weird
Paper uses adventure components be default as well as spongepowered IIRC
in the ide it says it was oraxens component, but on the github it wants papers components
wants
thats whats weird
oraxen i think is a plugin
That's just a relocated dep, how are you importing this dep? @spiral prairie
Is it provided at runtime?
ye i guess so
What are the imports at the top of the file?
Is the gui coming from triumph?
no, thats the issue
i have the imports set to the correct thing
but crazy gradle still somehow mapps it to the oraxen thing
like why
Wdym?
I never messed with chunks and stuff like that so if you can explain a bit and send me reference from docs it will be much appreciated (:
On chunkloadevent retrieve the entities, loop through them to find the armorstands and delete them.
any good java libraries for just creating a simple interactive shell?
like
that has a loop and waits for user input and maps commands to methods
i tried picoli, but that was just running a command everytime your run the jar, not in a feedback loop
yeah thats like the low budget version, but i like it with ansii, auto completion and suggestion, history, fancy colors n stuff
i mean, i could do that but im lazy
jline
confusing
Someone using (Advanced)SlimeWorldManager?
I think i know how to create a new world and how to load a world, but
what if I wanna save changes made in the current world (like when editing a minigame arena), how would I do that?
Thanks in advanced
Question to all the minecraft plugin developers
If I were to make a plugin where I check every block in a 100x100x100 area around the player, will I have to make it async or not? (Plugin that basically just searches for a type of block in an area, to help clean up event areas)
Why make it async or why not make it async?
Do you have any good reading material I can look at to learn about making my plugin multithreaded
just be aware that it's unsafe to access anything world-related asynchronously
anything that is loaded async**
?
you can clone the chunk data
loop over async
without any issues
concurrency issues only occur if you access a mutable variable
yes, but that's something different
a snapshot isn't part of the ticking world anymore
yes, but for the purposes of what they want to do, its quite valid
sure, still something different
i would make it async, but i am willing to bet that there are better ways to handle it
other than looping over all blocks
and for your other question of resources, just read on concurrency and thread safety
limiting yourself to bukkit only resources is not a great idea, resources there are usually either bad or outdated
anyone here use https://surrealdb.com/ ? just heard about it and thinking about using it over mongodb
According to the developers' roadmap, the SurrealDB 1.0 release is planned for release in September, 2022
I doubt
not production ready afaik
they released this month
I think it did release like a week or two ago
ya ^
yeah I know it is realeased
hmmm I need to figure out a better solution for good scaling that doesnt cost a shit load where I can just host it myself
I'm just saying it is too new for many people to use it
damn 😦
I would just stick with postgre honestly
And?
realtime data changes part and its syntax are the main hype points
but again, for a production db i would stick with something tested for now
It looks interesting, but I agree with Aki ^
ya hm
ya
its usage cases are quite limited i feel like
@merry knoll debating to duel database to just test it and see how well it is thoughts?
imho not worth the hassle
again, i would just go with something tested and port after if surreal is stable enough for production
atm I use mongodb / redis
@merry knoll what about https://www.singlestore.com
havent seen it
mongodb is web scale
it's mostly an in-memory caching database lol
the pub/sub is just also a nice addon
yeah but while you are running it with mongo i feel like its quite redundant
and memory caching doesnt exactly scale well
what lol
i mean it has the whole slave - master thing, but its really not ideal
the whole point of caching is so that you can scale well
that's not for scaling, that's for high availability
Q&A discussion discussing the merits of No SQL and relational databases.
for some reason, i got brain-lagged meant the clusters and not the master slave
still, you don't really want to scale the actual redis itself
what i meant is, for most applications one or the other is usually enough unless they are using the pubsub for something a bit more gimmicky
it'd be better to use it as a cache per server instance
i mean they don't serve the same purpose
redis is for caching, mongo is a persistent database
would you say you don't need both redis and postrgres?
or does mongo being nosql mean it's a replacement for redis lol
lmao this is legendary (pretend this is in caps)
we are saying the same thing but i am failing to articulate myself i feel like, a lot of use cases of redis that i see dont exactly need caching
yes i am aware
my point was chances are the use case doesnt really require caching
depends on what you're doing
i've seen django with mongo for persistence and redis for session caching
okay time to stop being lazy and type proper:
yes it 100% depends on the use case, its just that i have seen a lot of people abuse redis as a persistent database since it supports snapshot saving
depending on use case for them i would probably just go with an sql + redis if needed (postgre or any other enterprise solution)
instead of trying to use literally released this month db's that are untested in production
oh, yeah, that's pretty much what I am saying lol
i figured with this statement, you meant "one or the other" as in Redis or a persistent database
and I was like definitely not lol
no its more that 90% of the cases i see just basically abuse redis
while sql is 100% of capable of what they want to achieve
oh huh yeah, i haven't seen anyone abuse Redis I don't think actually lol
maybe I just don't interact with it enough
this is on me, was being lazy with the sentences then i brain farted the master slave to make it worse
Redis is good for fast and large data caching across several servers
Mongo is good for also cross server data storage but faster and for smaller amounts of data
...
Due to spigot's shitty system for (anything tbh) dependencies management, what would be an optimal way to use adventure in a plugin and its api, and allow others to use their own version of adventure? I know people like luck published their own adventure artefacts on maven central and others can use that instead of the official one 😬
I currently use adventure for only one thing, the title of a GUI https://github.com/iGabyTM/arcane-shop/blob/5669c3d3b1deb21eb47ae5a92322fb5050a84d56/api/src/main/java/me/gabytm/minecraft/arcaneshop/api/shop/Shop.java#L20
relocate?
Yeah.. but methods that expect my relocated components for example, won't accept yours 😬
just move it to dev.gaby.dependency.net.kyori or smt
ah, you mean for the api
just make a wrapper
a wrapper?
wrap the component with your own
and take that as parameter
your component depends on the relocated package, whoever is using it depends on the wrapper
I don't think I understand what you mean by that
Do you mean something that will hold the string value and also the component?
depends on how you want them to use it
if its just string values that will get parsed
then no need for component on parameter
but if you want to support components like it was intended, then you gotta wrap that
class YourComponent {
// relocated component here
// builder method
}
Hmm, I see.
dont know the use case but it might be easier to support string input from api
and parse it with minimessage
Yeah, it might be
I will think about how messages will be implemented, maybe it won't be a pain xD
or make your api not a shadowjar
so its just the source and you can use the unrelocated components ig
If you dont relocate libraries it will cause problems
yes but you dont ship the lib
and it wont be run on the server cuz its just the api artifact
If it's not on the classpath then your plugin can't use it.
If it is on the classpath then it will clash if not relocated.
just split your api and plugin with modules and interfaces
So I need, for my project, an import of Caffeine;
Usually I would provide this by shadowing the dependency with my jar
You're saying, just split my api and plugin with modules and interfaces
what i think would work is just having it relocate on the main module (the plugin) for shadow but publish the api artifact without any shadowed
i have it in two of my projects and it seems to work fine
Instead of shadow you should make it transitive
This allows the user to exclude dependencies
And view what dependencies your project is using in the api
target.setFireTicks(60);
When I run this, it sets the target on fire for around a third of a second then stops, does anyone know why?
Same thing happens regardless of how high I make the tick count
Wait nevermind I was in creative mode oops 😭
With?
The api is a part of the plugin, and when adventure is relocated will affect the api classes as well
And if you provide a different api jar, it won't work. You have probably seen APIs for premium plugins that have dummy classes and methods throw some kind of exceptions, that's because at runtime those classes will be replaced by the actual classes
If you want to expose or interact with adventure in the API itself, and the plugin relocates adventure, the API has to provide the shaded & relocated version of adventure
yeah 😦
It is, for all that matters, not adventure, an entirely different class that is not net.kyori.adventure... that just happens to share the simple name
If it was for an API this makes sense
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
if (!(sender instanceof Player)) { return true; }
Player player = (Player) sender;
if (args.length == 0) {
player.sendMessage(ChatColor.translateAlternateColorCodes('&',"&d&lPowers &8» &7You must specify a player to cast lightning on!"));
return true;
}
if (args.length == 1) {
Player target = Bukkit.getPlayer(args[0]);
assert target != null;
World world = (World) player;
world.strikeLightning(target.getLocation());
player.sendMessage(ChatColor.translateAlternateColorCodes('&',"&d&lPowers &8» &7&dYou &7have struck lightning on &d" + target.getName()));
target.sendMessage(ChatColor.translateAlternateColorCodes('&',"&d&lPowers &8» &dYou&7 have been struck by lightning."));
return true;
}
return true;
}```
Does anyone know why it gives an internal error whenever I run the command? It does not give one when running it without arguments, but does when running it with a player argument
I can provide the stacktrace if needed but I have no idea how to read them (i really should learn but i dont know where to start), thanks!
(sorry to anyone who read that earlier i put the wrong file lol)(
do post the stacktrace
yeah can you send the stack trace, they're decent because they should tell you exactly what line they're on etc
Yeah we can help you read it
here you go, thanks
i would like to point out that assert does basically nothing and you will have to check if the player is null
line 24
at dev.hepno.powers.powers.Commands.Lightning.onCommand(Lightning.java:24) ~[Powers-1.0-SNAPSHOT.jar:?]
it tells you here
ah thanks, I assume id do player.getWorld(); instead?
yeah
a player is not a world
thank you, i just did it cause intellij told me to
intellij can be pretty stupid sometimes 
It might actually throw a runtime exception
tries to cast the object into whatever you put in there
so (Player) sender
only works since the sender IS and can be a player
which is not true for a world on a player
ahh makes sense, thank you
Anyone have any idea for how to go about dynamically downloading dependencies that still works with Java 17? I know LuckPerms does it with some sort of jar-in-jar system but I have no clue how that works. I'm trying to download database drivers only if they're needed so my jar size isn't needlessly large and exceeding the spigot upload limits. Please ping me if you reply ty
slimjar
or I recommend using spigot plugin.yml libraries if you're on 1.16+
regrettably I want to keep 1.8 support because people refuse to move on, thanks though, I'll look into that
alr, just wanted to mention it just in case, slimjar is fine though
oh it's yours lol
nope
temp fork
until yugi merges it
unless he fixed it
I think yugi merged it
nvm @tardy cosmos use https://github.com/slimjar/slimjar he merged it
alrighty thanks a bunch
np
you'll have to use maven local though
since his maven repo is down
would it be fine if I published it to my own
uhhhh probably not
it's compatible with CI though
just git clone
worked with github actions at least :))
not sure if I still have the script though since I moved to spigot libraries
nvm I have it
well time to go learn how to translate my mysql queries to postgresql lol
this is what I use
it's quite similar
It was in fact a lot more similar than I thought it would be. Only major difference was how auto incrementing IDs work
Anyone got that picture of the inventory slot numbers for all the different containers handy?
Namely looking for anvil and enchant table rn.
anvil should just be 0-2 left to right
Lovely ty thats where it was
is the sk89q maven down?
why not go in and check
just type on your browser
on phone atm can check in a min
alr
It’s down for years already afaik
Do entities save custom nbt data on server shutdown?
cause i remember seeing somewhere that itemstacks do, but entities and tiles dont
They do not, the bukkit API provides the PersistentDataContainer interface for adding keys that do save across restarts though
it is 1.14.4+ only though afaik
yes
so im stuck using pdc, great...
Could save the data yourself
so im stuck using pdc, great...
Where is the issue?
id rather use nms rather then pdc but for entities its not really possible
whats wrong with pdc?
it is just bukkit's implementation of nbt
except that values are stored under a compound named BukkitPublicValues
what i dont like is that its pluginname:value
thats it
you also cant read/modify original values
yeah because it uses namespaced keys, but that's also a good thing because you know which plugin set which value
Why dont you like that?
"original values"?
is it possible to detect ProxiedPlayer MC version (so basically i just need if it's 1.8 / 1.15 / 1.19)? Bungee plugin
Please tag me / reply with tag to my message whoever answer me
original values = vanilla nbt data
which is why i prefer nms over using pdc
cus you can modify them if you want to, or read them aswell
since currently there is no goat horn itemmeta so reading the goat horn sound type is impossible without nms
I see
For that case, an nbt api would be good
Fot just storing and reading plugin data on entities, pdc is best
Isn't it linked to CustomModelData?
I don't think so
Custom model data is for resource packs
Afaik that's its only purpose
Yeah so is the audio of the horn
Well not really
Or
Ig I see what u mean
But custom model data is for mods/plugins I think
So they made a new tag
🤷 there is data packs that add new audio for horns so the data has to be available somewhere.
yep
currently i just use nms instead of relying on nbtapi
im not just using nbt, im also using other nms stuff for custom mobs
Okay
cus spigot doesnt have api for custom mobs yet
i wonder when that will be added
probably never
idk
I was looking at the source for nms.Block#fromLegacyData since I saw that it was in 1.8 but removed in newer versions and I see this - https://i.imgur.com/ihbhQBa.png
so what is the parameter (data) used for??
was it ever being used?
this is decompiling spigot-1.8.8-R0.1-SNAPSHOT.jar
it's probably overriden
iirc in nms there's 1 class per block type, so that would be for things like coloured wool
wdym
trying to update a plugin from 1.8 NMS to 1.18
private void sendPacket(final Block block, final Location loc, final Player player, final Material material, final byte data) {
final ClientboundBlockUpdatePacket packet = new ClientboundBlockUpdatePacket(((CraftWorld) block.getWorld()).getHandle(), new BlockPos(loc.getX(), loc.getY(), loc.getZ()));
packet.blockState = CraftMagicNumbers.getBlock(material).fromLegacyData(data);
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
}
```this is the full code btw
half updated half non updated
lol
well in later versions you wouldnt need the legacy data
im assuming that the method parameter is left unused just so it doesnt break older plugins?
it's just the material / block
oh
nah it's for subclasses, nms has never cared about compatibility, and isn't supposed to
d;spigot Block#getdata
@Deprecated
byte getData()```
Gets the metadata for this block
Magic value
block specific metadata
so this is useless?
yes
it will always be 0 on 1.13+ afaik
np
thats what the whole conversion was doing behind the scenes
Another question - is there a list of plants that are 2 blocks high?
basically Material.DOUBLE_PLANT but modern :))
can't find anything online
besides looking at all of them
or theres https://minecraft.fandom.com/wiki/Flower
ooh
found it
okay what is LONG_GRASS 🥲
legacy has GRASS and LONG_GRASS
but no GRASS_BLOCK
but newer has GRASS, TALL_GRASS, and GRASS_BLOCK
🤔
I wish there was a conversion chart
or actually there's XMaterial
so apparently an orange tulip used to be... RED_ROSE

might just use XMaterial
seems pretty neat
they were all rose with data values
i expect it uses tags
im having a fun time going down the chain of how minecraft crafting inventories work
Might want to write up your own class as XMaterial is a pretty bloated class.
Yeah no
I've tried adding VaultAPI to my pom.xml, but IntelliJ says "Dependency 'com.github.milkbowl.vault:1.7-3' not found"
A member of staff has requested I move your message to a paste,
Most likely because it contains a config/error/code snippet.
Ahh right pastes, sorry forgot those existed
Yeah I've read that, but the instructions provided don't work
you copied the wrong artifact
I've tried both vault and VaultAPI, vault being whats found on jitpack and VaultAPI on github, neither work
<dependency>
<groupId>com.github.MilkBowl</groupId>
<artifactId>VaultAPI</artifactId>
<version>1.7</version>
<scope>provided</scope>
</dependency>```
This works 100%
Use gradle bruuh
do you have jitpack on your repos
to use github repos directly you need jitpack as your repository
On Maven?
Yeah
Hold on wha
I restarted IntelliJ and now it works fine
No idea why, maybe IntelliJ was just being weird
haha no <3
Someone knows a really easy to understand post (or class) to track positions for a race minigame so you can track (in real time) player positions and ofc prevent them from passing the start/finish line (and counting as lap) with the use of checkpoints or something? 
boundingboxes
just don't look at mk64 or mkwii in that case
nah do, but just fix the bugs they have lol
or don't and let your people discover skips!
🥲
Hey I am trying to move a non existent Entity (NPC / FakePlayer), basically I want to use its PathFinding to let it walk to a specific Location. I know I have to use Packets for that, since the Entity is not actually existing, but I am not sure which Packets I need. Does anyone know what Packet I need to use?
I used this site to check the Packets :https://nms.screamingsandals.org/1.16.5/net/minecraft/world/entity/ai/behavior/index.html
i wouldve assumed that wiki.vg would have the packets required
or atleast some of them atleast
Anyone now how to add Custom Model Data inside a DeluxeMenus ? CustomModelData: <number> didn't work
I am trying to set the contents of a shulker box, and this is what I am using. It isnt working, no errors. ```java
int slot = player.getInventory().firstEmpty();
player.getInventory().addItem(new ItemStack(Material.SHULKER_BOX));
BlockStateMeta im = (BlockStateMeta) player.getInventory().getItem(slot).getItemMeta();
if(im.getBlockState() instanceof ShulkerBox && kit.getItems() != null) {
ShulkerBox shulker = (ShulkerBox) im.getBlockState();
shulker.getInventory().setContents(kit.getItems());
im.getBlockState().update();
}
try putting a print inside the if statement
im.getBlockState().update();
this won't work, that's for updating a live block
and you need to setItemMeta
well I am not even sure what to look for
Packets don't handle pathfinding
Well I need a way to let NPCs move automatically to a specific destination
you'd have to either somehow incorporate Minecraft's pathfinding api into whatever you're doing or create your own pathfinding system afaik
I'm not sure what Citizens does
if you're not using nms entities, then you have to make your own of everything: movement, health management, etc
big oof, any hint how I could easily implement movement?
thats the easy way
Anyone know what could be going on here?
CF Pages is giving me this error https://pastes.dev/8z5B1AaHyG, but it works fine on Netlify. This is my build configuration:
(i didn't create this site myself, it was made by someone else for me)
thanks
Update: It worked when I built the site myself and then uploaded it to CF Pages via wrangler CI

True
I've seen it in some minigames but couldnt find any open source one xd
Really just checkpoints and distance math I imagine
Checkpoints as location you mean?
I'd need to then loop all checkpoints?
Or you mean checkpoint as interactive stuff (pressure plate)
I mean looping itself I don't think is that bad since after all, all it is is comparing some doubles
(xyz)
and the world, so ig a String or UUID, depending on how you want to compare the worlds
loop it self?


