#help-development
1 messages · Page 403 of 1
That doesn't really narrow it down
If you're trying to do holograms packets aren't needed lol
god going to bed sounds so good rn
Animations.
I just can't get any sleep lately
You can do animations w/o packets lol
I know, I just want to use packets cause theres gonna be alot..
?paste
I kinda get it, but there are just a few things I'm missing.
e.g. I do it as follows:
https://paste.md-5.net/epikugagej.php
https://paste.md-5.net/iqaramayey.php
Ill take a look Thanks
Not packets, but it's how I deal w/ animations multiple armorstands
I want to rip out the hologram stuff & put it into a proper open source library, just haven't gotten around to it
I changed my code to add a msg saying which item you received, but it broke everything. Here's the changes I made to the code with some annotations from what works and what doesn't. Can someone please help bcs I havent a single clue why this isnt working.
https://paste.md-5.net/vibemesuxu.cs
someone remind me real quick, how do I put several BaseComponents together to string a message together?
Sounds like a good idea.
hey im trying to check if a block mined is within a region. is there a better way to go about this? or does this function correctly?
https://cdn.discordapp.com/attachments/1082043869618778272/1082353921961512960/image.png
I'll look into it rn, since I'm waiting for a response to the thread I made lol
use the TextComponent class and its addExtra method.
example:
TextComponent message = new TextComponent("Hello ");
message.setColor(ChatColor.GREEN);
TextComponent name = new TextComponent("Player");
name.setColor(ChatColor.BLUE);
name.setBold(true);
message.addExtra(name);
message.addExtra("!");
player.spigot().sendMessage(message);
gotcha thanks
Or ComponentBuilder
Might delete the thread and re-do it with better examples actually 🤔
if (SpecialItemSystemsConfig.isAnnounceImportantEnchantments() && ItemTagger.getEnchantmentCount(upgradedItem) > 10)
if (!SpecialItemSystemsConfig.getSuccessAnnouncement().contains("$itemName"))
Bukkit.getOnlinePlayers().forEach(player -> player.spigot().sendMessage(
ChatMessageType.CHAT, TextComponent.fromLegacyText(
ChatColorConverter.convert(SpecialItemSystemsConfig.getSuccessAnnouncement()
.replace("$player", ((Player) event.getWhoClicked()).getDisplayName())))));
else {
TextComponent itemName = ShareItem.hoverableItemTextComponent(upgradedItem);
String[] text = SpecialItemSystemsConfig.getSuccessAnnouncement().split("$itemName");
BaseComponent[] baseComponent1 = TextComponent.fromLegacyText(ChatColorConverter.convert(text[0].replace("$player", ((Player) event.getWhoClicked()).getDisplayName())));
BaseComponent[] baseComponent2 = TextComponent.fromLegacyText(ChatColorConverter.convert(text[1].replace("$player", ((Player) event.getWhoClicked()).getDisplayName())));
ComponentBuilder componentBuilder = new ComponentBuilder();
componentBuilder.append(baseComponent1);
componentBuilder.append(itemName);
componentBuilder.append(baseComponent2);
Bukkit.getOnlinePlayers().forEach(player -> player.spigot().sendMessage(ChatMessageType.CHAT, componentBuilder.getCurrentComponent()));
}
aw yeah that's hot, that's hot
.getCurrentComponent?
hi how do I register a Listener for a Class that has a normal Constructor already?
should it be .build or whatever
(registering Events does need a new Listener Object usually)
bump
I have a class, which has a Constructor. But it also implements Listener. The issue is that I cannot construct it as a Listener for my event-registering
getServer().getPluginManager().registerEvents(new Listener(<constructor args>), this);
theres the issue, <constructor args>
wdym
Also why do plugins have a static instance usually e.g. PluginName.getInstance(), doesn't Bukkit.getPluginManager().getPlugin("") accomplish the goal of a singleton instance?
I cannot just create an Object for the Listener
that will mess up things if I'd just create it with nulls
why do u need a Object
What's the problem w/ that though lmao
because Java is an OOP-Based language?
huh
the listener needs to be registered??
so u just place the args there
is $ a special character in regex?
forces people to use Bukkit.getPluginManager().getPlugin kek
ye believe so
any ideas as how to escape that?
there aint no args for Listeners. Registering a Listener for it would require creating an Object
infact it is 100x more unorganized to have extra classes for every Listener
IDE says that's illegal
its not random
i dont think u worded your question correct
private ArmorStandSelection() {
}
public static void registerListener() {
Bukkit.getPluginManager().registerEvents(new ArmorStandSelection(), LoopCityScript.plugin);
}
What about that?
no just no
I sometimes self-register via the constructor
thats so unorganized and ugly
so thats gonna work?
no way your registering a listener in a listener class
I don't see any issue with that as long as I think its way more beautiful and organized
Ehhh
Why do you say that?
public class Example implements Listener {
public Example(Plugin plguin) {
Bukkit.getPluginManager().registerEvents(this, plguin);
}
}
Why do you need that static method? @orchid gazelle
thats ok but DaFeist is not doing that
to hide it so I don't accidently call this empty constructor
Why would you do that? And what harm is it gonna cause?
Sup Jan 👋
Heya optic
its annoying to tab the wrong constructor lol
I have so much to do, currently working on a HologramAPI while waiting for a response for #1082384260754841610 lol
Prefix your listeners with something then @orchid gazelle
private ArmorStandSelection() {
Bukkit.getPluginManager().registerEvents(this, LoopCityScript.plugin);
}
public static void registerListener() {
new ArmorStandSelection();
}
``` better?
Good luck with that. Haven’t used math in ages
Not really
I suck at math, hence me doing a thread lmao
hoping to get a response, though given my current track record, that is unlikely lol
Yea, but this is more than math considering it's not Point A -> Point B, but a full on nav mesh
Ye
I gotta say one thing is definitely annoying me about the Bukkit API. I really want event.cancel(); instead of event.setCancelled(true);
I could do parts of it with Pathfinder goals, but not all of it, plus they'd be messy 😐
@orchid gazelle why?
ugly
It would be best to do a from scratch library which properly takes into account what I'm looking for lol
@orchid gazelle Doesn’t seem very versatile.
some things are just ugly
The reason seems to be that you should be able to "un-cancel" events that have been cancelled. It's not a latch, might be only in some instances.
Ah @dry yacht, I'm actually working on publicizing the hologram API so you'll also be able to help improve it lmao
I have a rank system with every rank having a list of strings aka permissions. Everything works, adding someone to a rank, chat prefixs, permissions showing up in the yml and gui. But when I'm rank (example: admin) I'm not allowed to use those permissions admin is holding. I have never worked with permissions like this before so if someone could please explain?
Your issue is that you're not properly managing instances. Your class should be a singleton that you can pass around and register without any worries. That's what my AutoWirer is for.
I also agree that sometimes you just want an event inside the class with other logic, as it just plays together and pulling it apart would cause nothing but needless dispersion of intertwined logic.
I don't think I'll be able to make the time for that, xD. My backlog of ideas and things I really need to finally get to is too large already.
Well, it'll be os anyways lmao
bruh I forgot to register this command dammit
gonna straight up gonna make the CommandAPI after a bit of this one lol
What for? It does the same thing. That's like those people who add 5 extra method overloads just for ease of use, xD.
you already said it, ease of use
You can use manifold to add extension functions
Another thing that cannot happen to me, haha, I love my wirer.
...
This tutorial will guide you through how to create your own permissions plugin that sets permissions using the new Bukkit permissions API. This tutorial assumes you have a good understanding of the Java language, and general plugin development. This tutorial will only cover the specifics of the Bukkit permissions API. Everything that can have pe...
?slots
You made a system to auto register events??? Lucky mf I cbf to do all that reflection lol
uhm wasnt there some graphic of where each slot is?
is there a general do in order to create a inventory.yml for a trading villager inventory?
No
Events and commands, yes. https://paste.md-5.net/azowoqatag.rb
I don't like having to spend my time and effort on mindless tasks, as the stuff I'm trying to achieve is already hard and time-consuming enough, xD. 90% of plugin classes will be singletons anyways, so I might as well let the computer solve the dependency graph and keep instances to auto-inject later.
} else {
System.out.println("=(");
}
``` best debugging
Those are the raw slots, which basically just offset the inventory slots by the size of the top inventory.
I found the point where it breaks lmao
I usually print swear words, haha
xd
It’s not that much reflection
How is it reflection at all? Maybe we're talking about different registrations.
he is probably iterating over his listeners package, instantiating each one
Oh, I don't do that, as I use proguard for dead code elimination. I need actual uses of classes. I had that system once, but it's needlessly complex.
where is that inventory tutorial from slime again?
You're only "exposing" the manager in further steps anyways, I'd assume, so don't overcomplicate that intermediate step to be pattern conform...
hmm
That's the exact reason why we have the little control we have
also yea, just gonna re-do that thread I made lmao
Minestom is all about control
well it doesnt let me control the internal recipemanager so i gotta make my own 💀
hardcoded
:(
:(
What a beauty.
a CopyOnWriteArraySet copies its internal array on every #add invocation right?
wtf is removing my entry out of the map without removing the entry out of the map???
if its same as list, yes
ugh
should also do same on remvoe
copying its array a 1000 times then
yes usually fourteen
dammit minestom
ahhh yess sure... items.put(0, testBow); items.get(0) is null yes yes
otherwise, you can if u want use a reentrable read write lock
well its working when calling in the same constructor but on the event its null lol
im literally raging right now lmao
@analog thicket
It's not 100% feature complete, but this is the current API as is:
https://github.com/OpticFusion1/HologramAPI
time to copy their code into my version of it 💀
ConcurrentHashMap.newKeySet()
It is, for the most part, a 1:1 port currently lol
if u want a concurrent set impl
I cannot see ANY reason why this should EVER be null
oh i dont, i was just wondering if it really went brr cuz im adding 1000 recipes and it looks like its copying itself a thousand times then
yea
addAll still slower 💀
I mean, what does the name CopyOnWrite suggest to u lol
🥵
Oh, seems like I also left some of the original code in it lmao
anyone know how to create regions with fawe
rare footage of optic in this channel
Nice!
yea, still have to do a lot of work but once I fix the issue of leaving some of the original code in, it would at least be enough to look at @analog thicket
Yeah, i'd definitely take a look 🙂
Watch this simple change break everything lmao
omg reflection error imma shit myself lol
ahh there we go
how do I use #getClass().getMethod() on an Object?
Uhm... object.getClass().getMethod(...)? xD Or do you mean how to invoke the method on an object?
yes and yes
First arg is instance, null for static, remaining args are params
im trying selection.getClass().getMethod(hItem.getExecutorName()); but yeah its the wrong object
getting java.lang.IllegalArgumentException: object is not an instance of declaring class
@analog thicket
With the current API as is
// Basic Hologram
Hologram hologram = new Hologram(location, text);
hologram.setSubtitle(string);
HologramManager manager = (HologramAPI) Bukkit.getPluginManager().getPlugin("HologramAPI").getHologramManager();
manager.addHologram(hologram);
// Animation
AnimationManager handler = hologram.animationHandler();
handler.addAnimationTask(new HoverAnimationTask(plugin, hologram, seconds, player));
hologram.activate();
hologram.deactivate();
Removing from the manager is a bit annoying, but that'll get fixed in the next commit since I plan on making this more friendly for public plugin
Show the call to invoke
ah ye sure my coding is going brr anyways
method.invoke(method);
public void onBowClick() {
player.sendMessage("Clicked UI-Element | Bow");
}```
That looks... off. Can't you post actual code?
java.lang.reflect.Method method;
try {
method = selection.getClass().getMethod(hItem.getExecutorName());
method.invoke(method);
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException | NoSuchMethodException | SecurityException e) {
e.printStackTrace();
}
}
selection is an Object which is this Class
Suspicious call to 'List.contains()' bro
spigot telling you amogus?
Pretty likely that it's off then, as IJ seems like having a good quote of calling these out
method.invoke(selection), if the method has no args, that is
What made you think invoking the method on itself would work, xDD
Great, then that'll work
seems like it does not lol
this is to be threadsafe ig?
they using a varhandle instead of a normal array lookup
What error are you getting?
[22:00:03 WARN]: at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[22:00:03 WARN]: at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
[22:00:03 WARN]: at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[22:00:03 WARN]: at java.base/java.lang.reflect.Method.invoke(Method.java:568)
[22:00:03 WARN]: at LoopCityScript-1.0.0.jar//de.dafeist.loopcityscript.entity.armorstand.ArmorStandSelection.onInteract(ArmorStandSelection.java:77)
...
Are you sure you're using method.invoke(selection) now?
could someone explain me how to add a jar as dependency

but hey at least it works now lol
so I won
are you winning son? YES IM WINNING
Happy to say I made progress today
damn atleast something of my code works
but im doing two streams over a method that gets called 1000 times when a player joins 💀
event.getInventory().remove(Material.NETHERITE_INGOT, 2);
As you can see the 2 is redundant, how can I makeit work?
Thisis in the event playerpickupitem
or should I just add -2 items to the inventory (how would I do this)
is strings[] null if no parameters are given?
In the main method?
Should be an empty array
uh
String numberString = strings.length == 0 ? "1" : strings[0];
causes
ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0
ye cuz the array is empty
isnt the three element (condition ? true : false)
it should give "1" if the arrays empty not strings[0]
ah i read that wrong
thats weird indeed
inline if statements are indeed (condition ? true : false)
Make sure that's actually where the error is from
Nothing wrong with that code
How would I pass in item IDs as args to a command?
Like what's the best way to make sure the Item ID is an actually valid ID rather than not just nonsense?
@eternal oxide would you know?
Like is there an interface or enum thingy I can use to check if the ID is valid
You can use the material enum
It's every material, so it's both blocks and items
anyone know how to create regions with fawe
Does spigot have an access widener, like this?
for plugins?
Yes
I was hoping for bytecode stuff
you will need mixins for that
Is there a way to make the animation of the chest opening, without opening the chest?
If that makes sense
1 sec
Using NMS?
Yep
I'm fairly sure you can find what you're looking for in net.minecraft.world.level.block.ChestBlock
public void playChestAction(Chest chest, boolean open) {
Location location = chest.getLocation();
World world = ((CraftWorld) location.getWorld()).getHandle();
BlockPosition position = new BlockPosition(location.getX(), location.getY(), location.getZ());
TileEntityChest tileChest = (TileEntityChest) world.getTileEntity(position);
world.playBlockAction(position, tileChest.w(), 1, open ? 1 : 0);
}
Found this, altough how the hell do i get the Chest varible?
Is it just the clickedblock
declaration: package: org.bukkit.block, interface: Chest
Aarh thx
This will work exactly the same for enderchest right?
nvm ill just loook it op
look*
Probably use an enderchestblock class
What the heck my google isn't responding and i got kicked from my server, but still have discord available -.-
it does not
RIP
exists however
Well got it working. Nows the question how to close it again -.-
Well changed some stuff, i just have to set the byte to 0
oh im stupid lol
Forgot there was a boolean -.-
I'll head to bed, thanks for the help @clever musk
yes
What's permissionattachment instead of just permission
hey I'm trying to update a 1.16 plugin (unfortunately I am rather stupid and don't know anything about plugin development) could I possibly have some help?
I was told by a friend that the issue is related to an outdated plugin library
although idk if that's true or not
Basically think of it as the holder object for permissions
permission, is just a single permission, but a permissionattachment can hold multiple permissions
or information in regards to such
an analogy would be like Chunk. Chunk is just the holder of the blocks of a given area where as a block is just a single block
Run a timings report
Parts of this code doesn't makes sense
You have while loop, yet instantly changing one of flags
bump
Also having tasktimer instantly canceling
Yeah, but you cancel it instantly
No reason to use tasktimer then
Why is that a listener?
Has no event on the class
Also your loop to play a sound plays them all at the "same time" since they are not being set to take longer depending on the loop value
Why a cancel on the end of a task itself doesn't make sense like goksi said
@quaint mantle you removed the messages but did you find your issue?
miau
Also make sure the "queue" the class was getting from the main class exists.
What's up
🐈
🐱
ze sky
anyone know how to create regions with fawe
Would be helpful to know what plugin it's about and whether it's source is available
the plugin link is https://github.com/HalfQuark/BlastResistanceOverride
This is the error I get when I try to run the plugin on 1.19.3
[22:32:34 INFO]: [BlastResistanceOverride] Enabling BlastResistanceOverride v2.0
[22:32:34 WARN]: java.lang.ClassNotFoundException: me.halfquark.blastresistanceoverride.blockoverride.v1_19_R2BlockOverride
[22:32:34 WARN]: at org.bukkit.plugin.java.PluginClassLoader.loadClass0(PluginClassLoader.java:179)
[22:32:34 WARN]: at org.bukkit.plugin.java.PluginClassLoader.loadClass(PluginClassLoader.java:126)
[22:32:34 WARN]: at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
[22:32:34 WARN]: at java.base/java.lang.Class.forName0(Native Method)
[22:32:34 WARN]: at java.base/java.lang.Class.forName(Class.java:375)
[22:32:34 WARN]: at BlastResistanceOverride2.1.1.jar//me.halfquark.blastresistanceoverride.BlastResistanceOverride.onEnable(BlastResistanceOverride.java:26)
[22:32:34 WARN]: at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264)
[22:32:34 WARN]: at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:371)
[22:32:34 WARN]: at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:544)
[22:32:34 WARN]: at org.bukkit.craftbukkit.v1_19_R2.CraftServer.enablePlugin(CraftServer.java:578)
[22:32:34 WARN]: at org.bukkit.craftbukkit.v1_19_R2.CraftServer.enablePlugins(CraftServer.java:492)
[22:32:34 WARN]: at net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:637)
[22:32:34 WARN]: at net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:436)
[22:32:34 WARN]: at net.minecraft.server.dedicated.DedicatedServer.e(DedicatedServer.java:303)
[22:32:34 WARN]: at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:1103)
[22:32:34 WARN]: at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:318)
[22:32:34 WARN]: at java.base/java.lang.Thread.run(Thread.java:833)
[22:32:34 ERROR]: [BlastResistanceOverride] Startup - Version Not Supported
wait wrong link
okay fixed the link
That CNFE looks really odd to me, would you mind sharing the exact jar you've tried to load, which caused this exception?
I think I may've just fixed the plugin, but I'd have to check ingame
Hello, I am currently trying to get the block state id for packet use:
CraftBlockState blockState = (CraftBlockState) location.getBlock().getState();
int blockId = Block.getId(blockState.getHandle());
However, blockId is always 0, does anyone know why? Thanks.
Why are you using packets
To play the effects for breaking a block
https://wiki.vg/Protocol#World_Event (event 2001)
We have API for this
Unfortunately the name of the enum is a tad misleading (because event purposes change from version to version) but what you're looking for is
world.playEffect(location, Effect.STEP_SOUND, Material.WHATEVER);
Oh, I didn't know this was a thing, thanks
Im just starting to look into packets and using protocollib and I understand how to do simple things like getting player locations and a few things I saw yt videos on but not im trying to play around with breaking animations and im kinda lost. Would anyone be able to point me in the right direction? Not really sure how to work it
Right direction in regards to what?
Just using packets?
https://wiki.vg this site is going to help you and pretty much everyone uses it to reference the protocol and packets. As for protocollib goes they have their own api.
ProtocolManager manager = ProtocolLibrary.getProtocolManager();
manager.addPacketListener(new PacketAdapter(plugin, ListenerPriority.NORMAL, PacketType.Play.Server.BLOCK_BREAK_ANIMATION) {
@Override
public void onPacketSending(PacketEvent e) {
Bukkit.getConsoleSender().sendMessage("Sending Packets");
}
});
Im a little confused because when I was using the location packets and other packets I was able to get messages to send to the player / server by doing the action but I dont think im getting the packets because im not receiving any messages did I do something wrong? .
Hey mates, would anyone know how to set the helmet of an armor stand inside of a mob spawner?
Hi, how can i make load a task when the first only join?, this idea is for a bar that only works with players only and to not work load the server.
I don’t want to check asplayedbefore, but check only if he is the first player to join the server
And none else is there
Check the size of Bukkit.getOnlinePlayers() in the JoinEvent handler
Ok thanks
I guess it should be one, maybe also zero, I forget how the event is called. Try and see, xD
Sometimes yes other times it spits out junk
Why do you need packets for that?
Well dont I need to get the packets so I can delay/change them while someone is mining the block? How would would I know when the player is mining the block if I just had a left click event I wouldnt be able to tell if they are holding left click right? I could be wrong kinda still figuring out all this packet stuff
How to change player hitbox size?
You would need to spawn a fake entity inside of the player
It won't be perfect and a bit laggy
Start by finding where it came from
How to disable reflection logging ?
Reflection isn't logged by default
declaration: package: org.bukkit.event.block, class: BlockDamageEvent
Called everytime when they are breaking the block
And then there is an abort event if they stop as well
He's probably talking about the Java 11 warning about reflective access
and no that can't be muted
It's not that. They removed their screenshot
ah
It looked like they were using some reflection lib or smth
Not enough information to help though
what's up losers, anyone know of a quick way to sort text alphabetically?
Based on first character of a word?
yeah
Have you looked at their documentation
yeh
well not just the first word
like for an hour
I probably have no real shortcut for it but I have a bunch of identical things with 1-20 at the end of them and it sure would be cool if they weren't in an arbitrary order
and on top of that they start with letters which would also be cool to have in alphabetical order
I'm probably screwed aren't I
pretty sure that list.sort already does that
hmm
I can't fuck off yet, god put me on this earth for a reason and I have not as of yet thrown you off a cliff
Looking at the code you could try removing their logger
Though it's probably better to use plain java reflection
considering your transgressions I'll be powerbombing you from the ISS right down to the mariana trench
oh I once again see I was smoking some fine crack cocaine while writing this code
oh well who cares about efficiency for a method that only ever runs once
man I am not awake enough for this one
Hey, is there a way to disable netherite armor's knockback resistance through spigot?
Think you will have to mess with attributes or something similar
As in the item attributes of every netherite armor piece to remove the knockback resistance attribute (if there is one)?
yeah
Alright I'll give that a try, thank you :)
List<EMPackage> rawEmPackages = EMPackage.getEmPackages().values().stream().toList();
List<String> alphabeticalSort = new ArrayList<>();
rawEmPackages.forEach(iteratedPackage -> alphabeticalSort.add(iteratedPackage.getDungeonPackagerConfigFields().getName()));
List<EMPackage> emPackages = new ArrayList<>();
alphabeticalSort.forEach(entry -> rawEmPackages.forEach(iteratedPackage -> {
if (iteratedPackage.getDungeonPackagerConfigFields().getName().equals(entry))
emPackages.add(iteratedPackage);
}));
get yourselves some code that can complete in O(wacky) time
oh wit did I even sort
lol
go to or bnack to bed
no I just need more coffee
no you dont
coffee doesn't replace brain cells
Any ideas on why that supplier is executed, even if logging on that level is not even active? I'm passing down JavaPlugin#getLogger to all of my instances. The messages aren't logged, but the debug print still shows up.
idk maybe it gets the supplied result before checking if it should be used in the first place
The thing is... it actually checks. So isLoggable has to return true, but it still doesn't log the message. That's kinda besides the point of a logger, as I'm literally loosing processing time on building all those messages. There are many FINEST logs, which are all needlessly computed. I'm only using that logger since very recently, as I've been using my custom logger before. Maybe I'm just using it wrong, haha
hmm
logger.setLevel(Level.INFO) did the trick, the suppliers are no longer invoked. Seems like the plugin logger was wrongly configured by default, and the messages didn't come through because the parent logger (Bukkit#getLogger, I guess) was configured to a higher level.
Dude, that literally wasted 3 full seconds of CPU time, I'm glad I found it through the JProfiler, xD
guys, i am just starting and when i created my spigot project, i cant debug the plugin
it has no run configurations
LOL GPT3 knows spigot
Inside the method, we get the player who triggered the event using event.getPlayer() and the armor piece that they are trying to equip using event.getNewItem(). If the armor piece is a diamond helmet, we cancel the event using event.setCancelled(true) and send a message to the player using player.sendMessage().```
Well it has existed before the time limit that the ai has for knowing things
well yes but if i ask it for specific things it usually doesnt know it
Depends on what those specifics are lol
Not sure why it would know your name unless instead you wanted the etymology of your name
But in either case you would still have to tell the ai your name lol
You must not been popular enough before the time the ai has then
fat chance lol
HAH
i asked it about your name
'an error has occured'
so for me it says idk for you it just breaks
tf did you do
hes too powerful
My name derives from norse
i didnt ask it about your name

i asked it about your alias
im fairly sure it couldve spat out what your name comes from but i asked it about what it knew about the alias 'frosthalf'
And yes my alias derives from norse and also there is a game named after me as well
So probably doesnt help much
Frost alf means cold elf in norse
But kind of funny it errors though if you ask it about me
hey, what's the 1.19.3 api version link?
i tried compileOnly 'org.spigotmc:spigot-api:1.19.3-R0.1-SNAPSHOT' and didn't work
Did you add the repo?
u added the repo?
?maven
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
That means that I'm running away every time I'm reading about bloatware
damn.
Good, thanks! How about yourself? :)
Just look at the source
It's trying to be way too much for what it's worth
What command implementation do you use then?
Depends. Aikar created it same person who created paper
My own, xD. It's paper-thin.
May we get a little sneak peak O.o
laffs in using the built in Bukkit commands api 
i mean
Acf is good if you need something like acf. Odds are you probably dont and just need something smaller and light weight that doesnt require much
99% of people dont need a command implementation beyond that
should i build the plugin in maven or gradle?
doesnt matter
i know how to do maven so i do it in that
Whatever your heart desires
u probably just need to add the spigot repo to ur build.gradle if it cant find spigot-api
The link above should give you the repo link for the api
am i late
oh, mb
someone said gradle
i commented one of the repos by accident
Thoughts on this?
f
Surely there's a better way than having to write 3000 lines for commands lol
Judging they are using trademark images for their plugin probably not good
I mean ACF does make it simpler
xd
What do you use frost, lets take a look
i dont like the lack of @Override
I use my own stuff
Can we take a looky
Well it sometimes is if the compiler doesnt know you indeed want to override
If you had to pick one of your gh repos to showcase your command implementation
Which one are you proud of
totally
No thnaks
Extends TabExecutor
meow
hannahs spigot lib best spigot lib (doesnt exist)
So you prefer using that than splitting into classes or using acf frost
Oh yeah you do
I mean
What if you want 50 commands lol
Is it really worth to do 50 classes
Not hard. Just make a new class and add it to the list
yeah
Can't be easier than that
But it depends. Sometimes i might combine 2 or more commands into the same class if they are similar or relatwd
Yeah, I assume subcommands stay in the same class for example
But like acf does look convenient
Even if it's not the best
No all those classes in that repo i linked the majority are sub commands
There is only like 3 commands total
hmmm
idk what to chose
On one hand acf is maintainted and usefull
On the other hand, libraries
Acf is handy if you are not going to know the commands ahead of time
ooooo that's a good point
So like adding commands later on is definately easier cause don't have to change anything
But if you already know the commands might as well just implement it yourself or invoke the thing that has the command
Wont hurt anything for you to try it. It is very extensive
It does seem that way
Even though i havent used it, i watched it get created 
alex uses acf the most here i think
Oh
Good for him
I hope he's doing well
We do miss him around these parts
Chat isn't the same without ?mpdc spam
Welp time to drive home now
You have a 9-5?
No
Oh, I thought you had another job tech related
Oh sheesh
I get paid like $23/hr to just remove and install tires on semi trailers and trucks
Lol
@Subcommand("list server")
@Syntax("[player] [page]")
public static void onServerList(Player player, String[] args) {
if (args.length == 0) {
Residences.listResidences(player);
} else if (args.length == 1) {
if (NumUtil.isInteger(args[0])) {
int page = Integer.parseInt(args[0]);
Residences.listResidences(player, page);
} else {
Residences.listResidences(player, args[0]);
}
} else if (args.length == 2) {
int page = NumUtil.isInteger(args[1]) ? Integer.parseInt(args[1]) : 1;
Residences.listResidences(player, args[0], page);
}
}
I'm trying to figure out
Why would be have those parameters if [page] can only be a integer and there's no more arguments
Oh I just did, cause not giving a page will do all
Weirdly done
Yeah not using acf, back to class separation
you can also do seperate args
no need for String[]
Ok blatantly stealing from alex
o
i just poked his brain for it
he uses a mix of everything im pretty sure
... why lol
akair
ik
yeah idk
why make them ifyou dont use it
why didn't my project create a main plugin class?
you have to make it
oh ok
do you guys know a good docs for plugins?
?jd-s
acf is also designed to be used with chaining as well
v1_19_R2 = 1.19.3
v1_19_R1 = 1.19.2
v1_19_R0 = 1.19.1
??? = 1.19
not always
how do I copy gamerules from one world to another one?
didn't undestand
thats not always how the versioning goes
those are for underlying nms spigot
version strings are such a headache, :(
Hi!
I am trying to work with Player Data files to achieve different Inventories (and all the other stuff stored in the data file) per World. My idea was to store the different player NBT files in NBT form like minecraft does it but in each world and then just load it from the current world. My problem is that I only found loadData() and saveData() which doesn't allow any file paths and always loads the files from the main world....I could move the files in and out of the main world folder but that seems very resource intensive...
(I don't want to use any other plugins but feel like this should be possible as for example the "MyWorlds Separate World Inventories" plugin states they use the same general idea)
Thx in advance
?pdc
is there some gamerule that stops lightning strikes from creating fire?
Yeah I know PersistentDataContainers and thought they might help but it still limits me to one nbt file and I would have to make it huge if I had many worlds or am I missing something
*one per player
how does that limit you to one nbt file?
no, there is however doFireTick
and some way for me to summon one without creating fire?
Swapping out files is not a good idea, if you're not using locks, it's not guaranteed that players load in serialized, synchronous order, I guess. If you lock the files for each player and swap them out (could even only be links, which is not that intensive), you'd still be messing up other processes which expect the vanilla file layout. So while the idea is creative, I don't think it's viable in the real world.
From having a quick look at the implementation, I saw that it's hardwired to the main world's files. There's nothing you can do about it. It basically works like this:
Player#loadData -> CraftServer#getHandle's WorldNBTStorage#load(EntityPlayer) is called, which then responds with the NBTTagCompound. The WorldNBTStorage is likely created the following way: Convertable.createDefault(path).createPlayerStorage().
So you could load that yourself. But on the other hand, it looks like a lot of version dependence and work on your end, which is why I'd just advise to use https://github.com/tr7zw/Item-NBT-API to load the file yourself and manipulate the player as needed. You can use the NBT file of other worlds to save the data, and just need to write on world change.
Add custom NBT tags to Items/Tiles/Entities without NMS! - GitHub - tr7zw/Item-NBT-API: Add custom NBT tags to Items/Tiles/Entities without NMS!
Hey,
I'm trying to use a plugin like ShopGUIPlus to get the prices for items for sale. For example to make a autoseller.
I assume I also need vault to be able to get the economy storage plugin.
One per player as I would set the PersistentTypes into each players data file
How would this implementation work. I'm kinda lost
not sure why you would try using the player data file which isn't designed what you are wanting
the player data file is tied to the main world because the player only has one inventory, that is the vanilla mechanic
Ok that sounds like a solution thanks a lot
if you want something more then vanilla, you are going to have to make use of either PDC which can be per-world or you implement something else like using a DB
Why couldn't you just store the inventory per world in the playerdata file of that world? Sounds reasonable to me
last I recalled player data files are not per-world
No, but you can easily make them be. There's nothing wrong with that
If you move the world, the data moves with it. PDCs are also going to be bound to the world anyways, if you implement them properly
I would never use a DB for that
PDC has nothing to do with player data files
just because you wouldn't use a DB doesn't mean it isn't a valid solution
No, but it also just boils down to NBT compounds. What would be the PDC handle? The world, if you do it right
And to what would I tie the PDC to entites or items I create?
ah I see
No need to feel attacked personally. It's just a bad solution, as you're needlessly dispersing the data. The DB has no notion of ItemStacks at all, what's the point of stuffing an opaque base64 string in there, when there's the whole concept of NBT already existing within minecraft? You could even make use of the vanilla implementation for playerfiles, which provides automatic data fixing. If somebody renames or moves a world on their server, they're gonna expect the inventories to move with that.
no it is not a bad solution
you are obviously terrible at implementing a DB if you think it is one
one of the best inventory plugins that allows you to have virtual inventories uses a DB
BLOBS are a thing in DB's
Wow, great point, xD. Alright, let's leave it at that so you can feel better about it.
Is there an advantage to the API you recommended compared to PDC in my case (as it seems to achieve the same thing) 🤔
No, the PDC does essentially the same thing, it's fine to use that
Maybe the data migration, but that'll be a lot of work to make it version independent
the only downside to using PDC is that your world files are going to bloat
and in terms of backing up inventories you won't be able to do so independent of the world
Personally I would either use a proper DB or go with with binary storage with memory mapping
In both those cases you can easily back up player inventories if need be and it be separate from the world itself since you know worlds are capable of corrupting and all, and who knows maybe you want to reset the map without resetting inventories. But those are things to consider
Would binary storage be using Javas Serialization or what is it 😅 ?
and whats the difference to using PDC then?
PDC is an API and stores the information in the world files
ah so I could store it anywhere and my world files would be smaller
PDCs are NBT and thus already in binary format. I'd just advise to save the data in a separate file within the world folder, I have no idea if PDCs can do that. Otherwise, just use the NBT-API I've sent you. I don't know what other value PDCs would bring to the table.
It's your decision whether you want to bind the data to world folders, just because I would doesn't mean that this is what you want.
Ok I see thx for the help guys 🙂
I might look into DB and stuff later down the line but for now I just want to create something that is at least somewhat scalable
wouldn't consider PDC something scalable. DB's are scalable by default unless you implement your DB terribly
PDC is just something that is convenient to store some data, not something where you take it to the extremes because it was never designed for that lol
Gotta keep in mind that minecraft uses NBT in vanilla state and works just fine with big servers. There's nothing to worry about in terms of scalability or efficiency. Just load it once, work from memory and flush to disk regularly. If you need to also access inventories between subservers of a network, you'd need a DB. Otherwise, it's completely up to you what you go with.
is storing player inventories and some other player data really that extreme? I'm not talking about a massive server here
the more players that play on your server the more data
whether its loaded or not
difference is, one is overall storage, and the other is runtime memory
more players on at any given time, that is more memory needed to keep their stuff loaded, and over time the more unique players you have the more in storage there is going to be
but the runtime memory is dependent however also on how you decide to code it and what you decide to use
but if I use binary storage outside of the world folders it is similar to a small database as it's also not loaded by default or am I wrong?
nothing you create will really beat a proper DB though in terms of scalability. Not even MC was designed vanilla wise to scale otherwise we wouldn't have things like spigot or even paper.
if you could design something to beat a proper DB in scaling wise you also wouldn't be here either
Yeah I got that 😂 but I don't need huge scalability but want to implement something and still think about it and runtime efficiency
Stop using parsers
No he does static abuse so it is the reason
Even better
best bet is to just go with NBT in per player files in a plugin directory separated by world. I wouldn't bother try messing with adding in files into the world directories as this only introduces the possibility of causing problems as the world directories are setup in a particular way and are not designed to really be messed with vanilla or api wise. Besides there is no additional benefit beyond convenience in doing that vs just storing them in the plugin directory as described
That's what I'll do 👍
What did i say
I dont accept that my friend dont use static variable. That is an og recommend from me.
?abuse
Lmao
guess we don't have that anymore
I don't see why a method shouldn't be static by default unless it referenced non constant variables from its class
Rude mate.
Yes well too bad you're still using it by the classname
Its not like you can just call the method and it will point to it
So i dont see the issue
statics introduce problems because instances don't change, so if a method is static, no matter how many new objects of a class you have, that method will always be the same across all those objects and return the exact same result.
Marry with static keyword
but the other problem you have, is anything static never gets GC'ed either
it will always persist throughout runtime
Mate why didnt you block me
Hm interesting
probably best if both stopped now 🙂
Sorry but one more question 😅 how would I write an NBT file I guess I don't need something like an API that uses NMS because I only want to store it locally 🤔
you would use an NBT library
I have this, but it requires you to implement yourself
there is other NBT libraries out there as well just have to look
That's fine
Hey
I'll look into it
How does this line actually work?
new testTask(plugin)).runTaskTimer(plugin, 20L, 20L);
That creates a repeating task every 20 ticks
But what exactly is what's getting repeated
Is it recursive?
Like if what I have is
@Override
public void run() {
if (plugin.getChestManager().getUltraChestsList().isEmpty())
return;
handle();
}
hello, how can i find the number of iron ingot will be drop : if (blockLoc.getType() == Material.IRON_ORE) {
blockLoc.breakNaturally(new ItemStack(Material.DIAMOND_PICKAXE));
blockLoc.getWorld().dropItemNaturally(blockLoc.getLocation().add(0.5D, 0.5D, 0.5D), new ItemStack(Material.IRON_INGOT));
what is handle
event.getItems.iterator()
@Override
public void run() {
if (plugin.getChestManager().getUltraChestsList().isEmpty()) return;
for (UltraChest ultraChest : plugin.getChestManager().getUltraChestsList()) {
if (sellTasks.containsKey(ultraChest)) {
sellTasks.remove(ultraChest);
} else {
sellTasks.put(ultraChest, new SellTask(ultraChest));
}
}
}
changed to this instead of handle
thx how i do it ?
I'm trying to make a clock that just runs in the background and every X amount of time it will do something
And each object has it's own timer
I'm pretty sure return does not cancel execution of the next task
ok disregard I fixed it all lol
I am idiot
block#getDrops will not get you what the block is actually going to drop, only what it can drop
^
BlockDropItemEvent like they said
ItemStack item = event.getItems();
I usually always use a iterator so you can use modify the list in a loop
@bleak comet
thx all for your help
Anyone knows why this is not working?
@EventHandler public void onPlayerJoin(PlayerJoinEvent e) {
Player p = e.getPlayer();
Bukkit.getScheduler().runTaskLater(Main.getInstance(), new Runnable() {
@Override public void run() {
p.setPlayerListName("example");
}
}, 1*20L);
}
its not changing my tablist name
I've tried without the scheduler too . Also listener is registered
1 step at a time
Make a empty event handler method, and use System.out to print anything
@EventHandler
public void onPlayerJoin(PlayerJoinEvent e) {
System.out.println("Event was called");
}
See if that works
it works i've tried before
Don't matter it's a debug
its registered as i said
So what doesn't work is the p#setPlayerListName?
I've no idea thats why i am here
do you even read the first message? its not setting the name
Give us a list of your plugins @quaint mantle
how float work
Then just passing 3 should work fine
kthx
ArrayLists don't have load factors like Maps do. They don't resize the same way
An ArrayList will just add one element to the backing array
So if you really don't want that resize you can give it a size of 4
or just use an array xD
Also an option
timestamps in this case should only be kept as long as current - stamp < delay
so an array would require me to do the shift manually
which im not sure is a good idea
ArrayUtils should make that significantly easier
There's an ArrayUtils.insert() iirc
(or ArrayUtil. I always forget whether or not it's plural)
is it always ever going to be 3?
like for a specific reason?
or just because thats a good number
why do i have no particle class in 1.8.9
Because it was added in 1.9
im suddenly very glad im not backporting my particle system
would you use protocollib then?
That or the particle lib that was around at the time
Its matter if I use persistent data container or NTB? What should I use?
pdc where you can
which is like everywhere
still no built in block pdc
I want to add sandstorms and snowstorms to mc, but Im wondering how someone would even start with that. Also, you know the new powder snow block and the freeze "effect"/particle you get on your screen? Is it possible to add that screen-freeze-thingy when there's a snowstorm.
packets yes without maybe. Particles, darkened sky, maybe a weak darkness and slowless effect
sounds more like something for a mod
Summoning a billion particles doesn't sound very good
Yes but Im not making a mod
no i meant only a few near the player
reduced sight, reduced movement speed, color the sky darker
Hmm alright, but it's for a server
Thanks. I was recently using NBTapi, and just started thinning about. Why use something external if I can use PDC for transferring data in GUIs, items and staff.
So Ill have to summon it for all players in a certain area
yes there would be no way around that
you can just do particles per player and packet those to only them
pdc works perfectly fine for inventory and item stuff
I was just thinking why there are 2 thinks to do practically same staff 😄
?img
Not verified? Upload screenshots here: https://prnt.sc/
oh god
What's the problem?
If I use this line a lot
Bukkit.getScheduler().runTaskLater(plugin, () -> {
plugin.guiManager.openGUI(//GUI STUFF HERE);
}, 1L);
How could I optimize this, or reduce the amount of code?
looks pretty non-optimizable apart from that it violates your abstraction hierarchy, but thats enterprise pov sorta
How would I make it not violate the abstraction?
basically that class is directly depending on ur plugin
to "decouple" that you would do sth like
class PluginScheduler {
Plugin plugin;
PluginScheduler(Plugin plugin) {
this.plugin = plugin;
}
BukkitTask runTask(Runnable runnable) {
return Bukkit.getScheduler().runTask(this.plugin,runnable);
}
}
class Main extends JavaPlugin {
PluginScheduler pluginScheduler = new PluginScheduler(this);
void onEnable() {
var other = new OtherClass(pluginScheduler);
}
}
class OtherClass {
PluginScheduler pluginScheduler;
OtherClass(PluginScheduler pluginScheduler) {
this.pluginScheduler = pluginScheduler;
}
void someMethod() {
this.pluginScheduler.runTask(() -> plugin.guiManager.openGUI(...));
}
}```
as said tho
this is from an enterprise pov
and somewhat, if u're religiously committed to OOP then u might enforce this type of design on urself
so no, you can only add code, not remove it xD
Very nice indeed, thanks conclure
Yeah, all good, however it should be noted, sometimes you end up doing
//in Main
PluginScheduler scheduler(){
return this.pluginScheduler;
}
And then OtherClass still takes ur plugin instance, this is what is called a design compromise and you sacrifice design for usability, its extremely hard to balance between the two
🥰
is it worse than mine
i wrote this one
if (x.toLowerCase().equals("Something") {}
Hye guys I have a question. Is there a way to make potion uncraftable?
it didnt
Okay I don't have that at my host from my server
are you not making a plugin
because host shouldnt matter about iterating over or removing a recipe
I can't find it at my host
Can someone check this math, I'm getting this weird offset on the negative Z axis, do I literally just offset it or am I bad at maths and forgot something?
for (double theta = 0; theta < 2 * Math.PI; theta += step)
{
double x = radius * Math.cos(theta);
double z = radius * Math.sin(theta);
location.getWorld().spawnParticle(particle, location.clone().add(x, height, z), count);
}
Resolved, Location center = location.clone().add(0.5, 0, 0.5); then use Center if you're copy pasting
pardon the choice of particle, it's white on white...
Locale.ROOT for commands 🤔
I believe you're just looking for a plugin or are you developing one? there's this resource already made if you're just looking to remove it: https://www.spigotmc.org/resources/disable-potions-1-19-1-13.66414/updates
Okay but I only want them to be uncraftable but I still want to sell them in my shop
not verified
I have found the achievements of the Minecraft server but not Recepice
Nevermind
Got them
Thanks for the support
hello there, i just wanted to modify player's kb to minemen (limiting the knockback vector by a chosen length) and now the funny thing is, whenever i check on PlayerVelocityEvent, the x & z parameters are 0
I have set brewing to false is that enough?
resolved by doing: Location center = location.clone().add(0.5, 0, 0.5); I forgot the center is not the center of the block, man I need sleep.
intereseting
double d0 = entity.motX;
double d1 = entity.motY;
double d2 = entity.motZ;
boolean flag2 = entity.damageEntity(DamageSource.playerAttack(this), f);
if (flag2) { if (i > 0) {
entity.g((double) (-MathHelper.sin(this.yaw * 3.1415927F / 180.0F) * (float) i * 0.5F), 0.1D, (double) (MathHelper.cos(this.yaw * 3.1415927F / 180.0F) * (float) i * 0.5F));
this.motX *= 0.6D;
this.motZ *= 0.6D;
this.setSprinting(false);
}
if (entity instanceof EntityPlayer && entity.velocityChanged) {
// CraftBukkit start - Add Velocity Event
boolean cancelled = false;
Player player = (Player) entity.getBukkitEntity();
org.bukkit.util.Vector velocity = new Vector( d0, d1, d2 );
PlayerVelocityEvent event = new PlayerVelocityEvent(player, velocity.clone());
world.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) {
cancelled = true;
} else if (!velocity.equals(event.getVelocity())) {
player.setVelocity(event.getVelocity());
}
if (!cancelled) {
( (EntityPlayer) entity ).playerConnection.sendPacket( new PacketPlayOutEntityVelocity( entity ) );
entity.velocityChanged = false;
entity.motX = d0;
entity.motY = d1;
entity.motZ = d2;
}
// CraftBukkit end
}
[... more]
i think i found he issue, bukkit is getting the previous kb of player
nice
or i misunderstood the event
or idk
What do i enter in SDK?
i just downloaded "Minecraft Development"'s new update
and its weird
java development kit
The one you gave?
Download JDK
i already have it downloaded
- its not weird
- don't use maven, gradle >>>>>>>>>> maven
use oracle jdk
isnt it first one
or adoptium, or anything you like
why
based on your server's java version
when i select first one nothing happens
search more, and you'll know
show me the full screenshot of the window
@EventHandler(priority = EventPriority.HIGHEST)
public void onPlayerVelocity(PlayerVelocityEvent event) {
Player player = event.getPlayer();
Vector velocity = event.getVelocity();
velocity.setY(velocity.getY() - 0.00001F);
double length = velocity.length();
System.out.println("velocity = " + velocity);
System.out.println("length = " + length);
event.setVelocity(velocity);
}
ah yes, this code seems to cancel the knockback, ok any suggestions?
select the jdk folder, and click ok
yea, you're right, it might be a bug or anything else
sorry, i can't help from now, use gradle or maven itself, add the repositories and dependencies, plugin.yml and stuff manually
I'm having trouble working out how I can use the key and value from the map to then enable the selected database...
Any ideas?
Bruh
?scheduling
My brain isn't working doing math, I need some help. I want to move an armor stand around a center lock in a circle. I know I must use cos and sin, but my brain isn't braining -.-
Oh and im using packets.
send your code
nvm, used player.getVelocity()
w8
How do I update the minecraft development? Just realized that I'm running an old version.
its really simple, just read that stackoverflow
you should be on the latest version with that gui
ah
really?
that gui came out recently
so no idea how you are on that version with the new gui
If you are going to give answers at least attempt to answer teh question he asked.
ok
will restarting intelij help?
ill send code
I already gave him code
try it, see what happens
how to plot points on a circles radius
Doesn't work
oh gradle is really better in performance
yeah
is it easy to build with gradle?
gradlew build
type in cmd?
maven is the standard for most spigot plugins
why
standard doesnt mean good or the best
and i get extremely annoyed whenever each 10th person decides to just use gradle
Hmm ill take a look
Yeah gimme a few mins
why
gradle isn't better than maven, neither maven better than gradle
thats weird
so they are equal?
can someone explain
so gradle compiles c#??
gradle can compile a lot
@Override
public List<String> onTabComplete(CommandSender sender, Command command, String label, String[] args) {
return null;
}
```why is it still tab completing the command?
so its better?
~but intellij is better than eclipse though~
null = all player names
depends on use case
return an empty list
try returning "" i guess
for plugins?
it is not, i have been using both for a decade and both have its cons and pros
if you know how to use it sure
the tool you can work the best is the best, and not what other say
yeah
oh wait that's good to know, i guess now I don't need to write ```java
for (Player onlinePlayer : Bukkit.getOnlinePlayers()) {
arguments.add(onlinePlayer.getName());
}
thats why intellij is the best, cuz I use it
nope, you do not
i didnt say it was the best for everyone
after 1st build yes
why
too bad it always needs to init for 25 years
why isnt maven faster?
🤔
the difference isnt big enough to care

