#help-development
1 messages ยท Page 4 of 1
so just do sth like this
File file = new File(getDataFolder(), "surnames.txt");
if(!file.exists()) {
saveResource("surnames.txt", false);
}
its the package the main is in
You have the wrong package in the plugin.yml
it looks like saveResource should automatically create a file tho
it does
oh i only need the package? or need to add the main class name as well?
but if you set "replace" to false, and the file already exists, then it prints an error
and you don't want that
main: com.annihilation.core.main.AnnihilationMain
oh thats dumb
This is correct
kinda, yeah
just use what I sent, that should definitely work
yup it worked
thanks
np!
main: com.annihilation.core.main.AnnihilationMain
Still spigot says
[22:40:27 ERROR]: Could not load 'plugins\AnnihilationCore.jar' in folder 'plugins'
org.bukkit.plugin.InvalidPluginException: Cannot find main class `com.annihilation.core.main.AnnihilationMain'
open your .jar with winrar or similar, see if it actually contains the class at the given locationn
also how tf did you manage to write so many classes without running your plugin at least once
what do you think of this implementation
0. Load config and check if autoupadates are allowed
1. Check latest release version at Github
2. If version is higher then current then download it
3. Remove current plugin jar file
4. Put dowloaded plugin to plugins dictionary
5. Schedule Bukkit task after to run 5sec and load downloaded plugin
6. Disable current instance of plugin
I think auto updates are a shitty idea
it does
its not my code
then you are using an old .jar or sth on the server
i m working for a youtuber
nope i rechecked
can't be. If the plugin.yml is correct, and the class is at that location, this error can't possibly be thrown
can you send the .jar here?
Could you say something more?
sure
kinda confidential
Auto updates are shit because imho the admin should alwayw have 100% control exactly over what code is running etc
if at all, you should do a /myplugin update command
good point, and what you think about implementation?
You cannot "reload" your plugin this way
better have a way to disable auto updating
Buuut spigot has an auto update feature bbuiltin
create a folder "update" in "plugins"
put your new version inside there
on next restart, spigot will automatically replace the jar
it does ?
yes
oh didnt know
yep
since when
that's like 10 years old
what a stupid feature
at least 1.8
cool tho
but nonone ever really used it
bruh
it would also work on reload?
does it go by plugin name in plugin.yml
I think so. Someone should dig into craftbukkit
https://bukkit.org/threads/how-to-use-bukkits-update-folder.95294/ it is AT LEAST 10 years old lol
so I would need to create /plugins/update dictionary then load there new version of plugin, that's it?
not gonna do that
i'm already subjecting myself to enough pain today, migrating to discord.py 2.0
basically yeah. and then wait for the admin to restart
funny enough I knew someone that coded an entire custom update directory not knowing there was one built in
nice ๐
or restart urself ๐ ๐
I did the same once lmao
r/madlad
mild oof
but it was like 3 years ago
and the worst thing is, I even knew about the update folder, I just forgot about it because I didnt code for bukkit between 2013 and 2018
done btw
we found the problem - windows ignoring file CaSe but java doesn't ๐
I want to ask a dude how would you make a reload command? Only reload the files or everything (files, dbs connection, etc) ?
depends on what you need
just don't make a reload command 
reloading is just always pain, just restart the server
Why is it not finding the constructor for the NamespacedKey?
"package me.dor7123.mypluginda;
import org.bukkit.NamespacedKey;
import org.bukkit.persistence.PersistentDataContainer;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.persistence.PersistentDataType;
import org.bukkit.plugin.java.JavaPlugin;
public final class MyPluginDA extends JavaPlugin implements Listener {
@Override
public void onEnable() {
System.out.println("Plugin Works!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");
getServer().getPluginManager().registerEvents(this,this);
}
@Override
public void onDisable() {
System.out.println("Plugin is Off");
}
@EventHandler
public void onPlayerRun(PlayerMoveEvent event){
System.out.println("The player is moving");
Player player = event.getPlayer();
PersistentDataContainer p = player.getPersistentDataContainer();
if(player.isSprinting()){
System.out.println("Player is Sprinting");
if(!p.has(new NamespacedKey(this, "agility", PersistentDataType.FLOAT))){
p.set(new NamespacedKey(this, "agility", PersistentDataType.FLOAT, 0));
}
else{
float currentExp = p.get(this, "agility", PersistentDataType.FLOAT);
p.set(new NamespacedKey(this, "agility", PersistentDataType.FLOAT, currentExp+0.01));
System.out.println("current exp is " + currentExp);
}
}
}
}"
Move , 0
To outside an )
only new NameSpacedKey(this, key)
Also create a constant for that namespace instead of creating multiple instances each time
^^
like so?
public void onPlayerRun(PlayerMoveEvent event){
System.out.println("The player is moving");
Player player = event.getPlayer();
PersistentDataContainer p = player.getPersistentDataContainer();
if(player.isSprinting()){
System.out.println("Player is Sprinting");
if(!p.has(new NamespacedKey(this, "agility"))){
p.set(new NamespacedKey(this, "agility", PersistentDataType.FLOAT), 0);
}
else{
float currentExp = p.get(this, "agility");
p.set(new NamespacedKey(this, "agility", PersistentDataType.FLOAT), currentExp+0.01);
System.out.println("current exp is " + currentExp);
}
}
}
}
fixed one
do people even listen
edited it
?jd-s may help too, just search a class
i hope i did not fuck up my arch install from yesterday
Use Debian :)
I got the data container, why won't it check if it has it?
i used some ubuntu derives before
Player player = event.getPlayer();
PersistentDataContainer p = player.getPersistentDataContainer();
if(player.isSprinting()){
System.out.println("Player is Sprinting");
if(!p.has(new NamespacedKey(this, "agility")))
ye ik that exists
i dont know
tryin something new ig
hmm yes i broke it again
just freezes
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
Gson gson = new Gson();
JsonObject jsonObject = gson.fromJson(response.body(), JsonObject.class);
returnString = jsonObject.get("value").toString();
return returnString;
com.google.gson.JsonSyntaxException: Expected a com.google.gson.JsonObject but was com.google.gson.JsonPrimitive
I don't understand what i'm doing wrong
got a json primitive as body?
Yeah
What's the difference between JsonObject and JsonPrimitive
idk
Would anyone like to help me out with an apocalyptic survival plugin? I don't mind if you're new or experienced with dev ๐
{
"head": {
"link": [],
"vars": [
"wikipedia_id"
]
},
"results": {
"distinct": false,
"ordered": true,
"bindings": [
{
"wikipedia_id": {
"type": "typed-literal",
"datatype": "http://www.w3.org/2001/XMLSchema#integer",
"value": "27529"
}
}
]
}
}
My output rn
@cloud crane
Thank you
double currentExp = p.get(this, "agility");
p.set(new NamespacedKey(this, "agility"), PersistentDataType.DOUBLE, currentExp+0.01);
why is the set not working?
I'm trying to increment the data type by 0.01
Copilot recommendations, no idea what does btw
is there an event for when a player left clicks an entity
not exactly damage, because sometimes the entity is invulnerable
Caused by: java.lang.NoClassDefFoundError: com/annihilation/core/zlib/components/scoreboard/sender/ObjectiveSender
Even tho that file does exist
yes
I dont remember the exact name
double currentExp = p.get("agility", PersistentDataType.DOUBLE);
I'm getting this - incompatible types: java.lang.String cannot be converted to org.bukkit.NamespacedKey
Stop spamming be pacient....
probably somethin along the lines PlayerDamageEntityEvent or EntityDamageEntityEvent
I'm not spamming it's a new error
oh ok
"agility" needs to be a NamespacedKey like it is in this msg #help-development message
im guessing
?pdc
bumppppp
how do I get the instance of it if it exists?
shade (and relocate) ur dependencies
the dependency code is in my package
double check the plugin jar with winrar or 7zip? idk
not sure, try reading the forum post on PDCs
anyone use worldguard extra flags?
i havent PDCs myself yet
ok relocating worked
i would like to know if i can run 2 commands when a player enter an area, if so, how can i do it?
What can be happening? intellij doesnt detect a project module
Spanish?
Ye
damn its smarter than me
does some calculation between two vars
id say it takes arguments a and b and then returns something depending on what u have in the functional interface
Lo mismo digo 
Ok
Something like does luckperms calculator right?
f.e. return calculate(1, 2, (a, b) -> a + b)?
not sure about the lamdba, never used a binaryoperator
same
Same
just guessing its functional tbh
tell me the method it has
BinaryCaculator is functional interface which extends BiFunction
ik lmao
BinaryOperator*
tell the method signature
yes
never used copilot
Conclure also do u use maven modules?
happens
Because im having big troubles with it It doesnt a detect a project module
I have done everything lmao
Invalidate cache, restart IDE and OS
๐ฎโ๐จ
i only had problems with maven and modules
reload from disk?
Im going insane rn..
Im trying to send Plugin message from Spigot to BungeeCord and ๐
But it just doesn't end on the other side??
BungeeCord:
https://paste.md-5.net/upibaqakuh.cs
Spigot:
https://paste.md-5.net/filujavata.cs
BPMSEntries are same on both sides:
https://paste.md-5.net/xidimuxifo.java
Usages:
Spigot:
On Boot
BPMS.getInstance().pingBungeeCord();
BungeeCord:
Also on Boot
this.getProxy().getPluginManager().registerListener(this,new BPMS());
BPMS.getInstance().registerChannels(this);
BPMS.getInstance().pingAllServers();
any ideas of what im doing wrong?
How can I op players onJoin? Because if i do it in the event, it doesn't work because the player isn't actually on the server yet
Question is, what happens when the player takes really long to load in
I deop op's when they join, to make an accurate permission check
and setOp(true) doesn't work so ye
doesn't get opped
u could theoretically create new runnable which would op players
and in onJoin u could do Bukkit repeating task with for example 100 tries each of 10ticks
in which u would run that runnable
after u would run it, you would check if player was opped, if so, cancel the event
even if after those 100 tries the player wouldn't get opped -> kick with message
I've got an idea from that, thanks :D
np
bump
Is there an event for when a block's data changes? I want to listen for when a beehive's honey level hits max
I'm trying to use the new PlayerProfile and PlayerTexture api in Bukkit. It seems to work with ItemStacks:
private void initSkullMeta(@NonNull ItemStack playerHeadItemStack, @NonNull Head head) {
final var headSkullMeta = Optional.ofNullable((SkullMeta) playerHeadItemStack.getItemMeta());
headSkullMeta.ifPresentOrElse(meta -> {
meta.setOwningPlayer(Bukkit.getOfflinePlayer(NOTCH_UUID));
meta.setDisplayName(head.getName());
meta.setOwnerProfile(ownerProfileService.createOwnerProfile(head));
playerHeadItemStack.setItemMeta(meta);
}, () -> {
log.warn("Couldn't find player skull meta.");
});
}
I verified with my HeadsInventory plugin that this works without issues.
But for blocks, I'm unable to get the PlayerProfile to stick:
private void setOwnerProfile(@NonNull Block headBlock, PlayerProfile ownerProfile) {
final var headBlockState = headBlock.getState();
if (headBlockState instanceof Skull skullBlock) {
skullBlock.setOwnerProfile(ownerProfile);
}
}
All heads are looking like steve heads. the PlayerProfile here is fetched using the exact same ownerProfileService.createOwnerProfile(head).
How do I set the state back? I didn't see a setState method
Just call update() on it iirc
Ahhh, I've seen that in the past, but I completely forgot about that method
Thanks! I'll check that out!
Is there an event for when a block's data changes? I want to listen for when a beehive's honey level hits max... anyone
Don't create item meta like that
The only case it will be null is if the item is air
And creating a new item meta won't help since it can't have one
Looks like result is air
@EventHandler
public void onStateChange(BlockPhysicsEvent event) {
if(event.getChangedType().equals(Material.BEEHIVE)) {
Beehive oldHive = (Beehive) event.getSourceBlock().getState();
Beehive newHive = (Beehive) event.getBlock().getState();
if(newHive.getHoneyLevel() != oldHive.getHoneyLevel()) {
Bukkit.broadcastMessage("updated");
}
}
}
Why does this error? Saying
Caused by: java.lang.ClassCastException: class org.bukkit.craftbukkit.v1_19_R1.block.CraftBeehive cannot be cast to class org.bukkit.block.data.type.Beehive (org.bukkit.craftbukkit.v1_19_R1.block.CraftBeehive and org.bukkit.block.data.type.Beehive are in unnamed module of loader java.net.URLClassLoader @18769467)
It works! Thanks again!
No more dependency on NBT API anymore, woo!
well you changed it to the wrong one xD
?
I was giving you the import for using state
if you wanna use block data, you'd need the one you had
getSourceBlock and getBlock is the same so that if check is failing
Source is for what triggered the update
In this case the beehive
And getBlock is what got updated
Which also is the Beehive
so..theres no way to find the block before change and after change.
pretty useless event if thats the case.
You could just create the event yourself and add a PR
Well how can I make the event if I can't get the before/after bloc
k
@EventHandler
public void onStateChange(BlockPhysicsEvent event) {
if(event.getChangedType().equals(Material.BEEHIVE)) {
Beehive oldHive = (Beehive) event.getSourceBlock().getBlockData();
new BukkitRunnable() {
public void run () {
Beehive newHive = (Beehive) Bukkit.getServer().getWorld(event.getBlock().getWorld().getName()).getBlockAt(event.getBlock().getLocation()).getBlockData();
if(newHive.getHoneyLevel() != oldHive.getHoneyLevel()) {
Bukkit.broadcastMessage("updated");
}
}
}.runTaskLater(cadiaBees, 20L);
}
}
i even tried a delay
If you want to detect the max why do you need the old honey level?
You just need the new one
any idea..?
PR?
?contribute
You can find information about contributing to Spigot at the following links:
https://www.spigotmc.org/wiki/cla/
https://www.spigotmc.org/wiki/guide-contributing-to-spigot/
https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse/README.md
https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse/CONTRIBUTING.md
whats PR in this?
PR is just short for Pull Request
Idk how this could even be turned into an event
because i cant check the things required to make it one
I meant make the event and add it to spigot
To make it simply find where in NMS its changed and place an event call there
Idk where to even begin
Beehive block would be a good start
on change though..?
You'll have to look around a bit to find that
I don't have access to my pc so I can't help with that
Is there a way to check if a BoundingBox is inside a block?
Box.isInside(Block#getBoundingBox()) or it might is Eclosing
what
how can a boundingbox be inside a block
blocks are supposed to be inside boundingboxes
he menas is the box completely inside the Block I assume
ah in that case just check Block.getBoundingBox().contains(location)
there are many methods
^^ sheep??
do you mean you want to see if any part of a block is inside the ArmorStand?
Is /update folder still supported by Spigot? I've open the the spigot load plugins code and don;t see any usages of /update directory
yes it is still used as far as I know
yes, updating is before loading
because another plugin has been loaded
there should be console output [JW_Music] loaded and [JW_Piano] loaded
what is the update directory even for?
it stores updates for plugin jars
when the server restarts it auto replaces/updates them
never knew that existed
Note: he said restart, not reload
its a bukkit feature that existed for many years ๐
but I does not copy update/JW_Piano to plugins folder for some reason
guyus
using /reload does not work for updating plugins from the update directory
then don't listen and continue to have problems ๐
it will also only update an existing plugin. its not for adding new
not sure which wiki you are listening to, but doubt its the bukkit/spigot one ๐
lol so yeah not even official sources
This guide explains how to install most basic plugins on your server. You must already have a running CraftBukkit server set up and have knowledge of how to use the Minecraft server console. If you do not have a server set up please go to Setting up a server and follow the instructions there. This guide does not cover setting up an SQL database ...
@EventHandler
public void onStateChange(BlockPhysicsEvent event) {
if(event.getChangedType().equals(Material.BEEHIVE)) {
Beehive hive = (Beehive) event.getSourceBlock().getBlockData();
org.bukkit.block.Beehive hiveBlock = (org.bukkit.block.Beehive) event.getSourceBlock().getState();
CustomHive customHive = cadiaBees.hiveManager.getHiveForBlock(hiveBlock.getPersistentDataContainer());
if(customHive == null) return;
if(hive.getHoneyLevel() == hive.getMaximumHoneyLevel()) {
int storedHoney = cadiaBees.hivePDCManager.getStoredHoneyAmt(hiveBlock.getPersistentDataContainer());
int maxHoney = cadiaBees.hiveLevelManager.getHiveLevel(cadiaBees.hivePDCManager.getHiveLevel(hiveBlock.getPersistentDataContainer())).getMaxHoney();
if(storedHoney != maxHoney) {
hive.setHoneyLevel(hive.getMaximumHoneyLevel() - 1);
event.getBlock().setBlockData(hive);
event.getBlock().getState().update(true);
Bukkit.broadcastMessage("Saved you from cringe");
}
}
}
}
Getting a concurrent modification error which kinda makes sense..but idk how to get around it. Basically.. I have custom hives, right. The hive itself has a max internal honey level of 5, but my plugin can go up to 13. So I am trying to make it so if the hive gets to 5 (full) but my plugin's hive isnt ALSO at full, it sets it back to max -1
hexademical numbers get bigger in this way:
0xFF is 255
but 0xF is 15
because when converted to binary code,
0xFF is 10101010
and 0xF is 1010
and when converted to decimals
10101010 is 255
and 1010 is 15?
if(customHive == null) return;
this is unnecessary
it doesn't do anything
yes
wouldnt it be
0xFF is 1111111111
and 0xF is 1111
How so? My function im calling returns null if there isnโt a hive at that location.
Zombie zombie = (Zombie) location.getWorld().spawnEntity(location, EntityType.ZOMBIE);
zombie.getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(hp);
zombie.setHealth(hp);
zombie.getAttribute(Attribute.GENERIC_ATTACK_SPEED).setBaseValue(attackSpeed);
zombie.getAttribute(Attribute.GENERIC_ATTACK_DAMAGE).setBaseValue(damage);
zombie.setCustomName(ChatColor.GREEN + "[" + ChatColor.YELLOW + level + ChatColor.GREEN + "] " + ChatColor.AQUA + "Zombie");
zombie.setCustomNameVisible(true);
}``` what is wrong with this code?
just click on the protocol version you want ๐
yeah mb i confused it with 0xA and 0xAA
well what happens when it's run ๐
wait a sec
@wet breach soooo.. any ideas
Caused by: java.lang.StackOverflowError
that error is so long
can i paste it somewhere?
?paste
You probably caused an infinite loop
You just have an infinite recursive loop
at CakeRPG.jar//me.placek.cakerpg.listeners.RpgMonsterSpawnListener.onEntitySpawn(RpgMonsterSpawnListener.java:21)```
where does the CME happen?
but how to fix it?
code
Are you spawning a mob in the spawn listener
yes
Dont program an infinite recursive loop into your plugin
There's your issue
so where's the loop?
If you spawn an entity, what event do your think is being fired?
https://www.toptal.com/developers/hastebin/ugiwerazil.kotlin Doesnt say, thats from the crash log. It didnt even error it straight up said "aight imma head out"
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
Modification of an arraylist while iterating
im not even doing that tho
well..
maybe its cause im setting data inside of a data change check?
Could also be caused by thread fkery
I dont really know how else I could do this tho
probably should stop using reload
Reload Count: 90
Delay it by one tick. Thats my secret sauce to hack anything in.
lol... yes he should never reload. The warning is there for a reason.
Eh
I update code way too much to restart every time
Would take like 2x the time to get stuff done.
except the plugins you have, don't work right with reload
Iโm not using the other ones for stuff relating to this so idrc
Havenโt had an issue yet
they caused your server to crash and complain about something that is most likely not even an issue
that would make things crash too, but so does using reload enough times, in your crash using it 90 times lmao
my cash
Iโm gonna use it even more just to spite u ๐ฅบ
Jkjk
I donโt use reload on my production server this is just a test server
is there a way to change player fishing speed?
yes
u can change it by using getHook().setApplyLure(number);
u can read more about this event
I wonder if you could bypass 1.19.1 microsoft chat moderation by disabling online mode and using mojang API manually to check if that particular player is premium player.๐ค
Why do we gotta keep catering to the weak minded instead of trying to reinforce them
๐ค
Offline mode servers should disable microsoft friends list
Thus you couldnt report those players
Or just accept that chat moderation is a thing
Hypothetically maybe its possible to fool the client that he's joining offline mode server
Just like anywhere else
Via packet manipulation
Not everyone enjoys living in a censored dystopia.
They probably won't ban you for that
offline mode server is the most overkill way to remove chat reporting
"probably"
on PUBLIC servers fine but private servers?? im gonna say whatever I want
you can just like, write a 10 line plugin
Just write a packet modifier that doesnt send the list of players to report to the client
ez
Thats even easier
or just, hear me out, send everything as a system message
this game has gone downhill since microsoft took over
almost like that is a lot easier
shit
smart
Genius

but i nthat case
how does mojang trust servers to validly report messages??
Couldnt i just like report ppl on my own server sending my own report data
by cryptographic signing
Yes but server would have to interfere somehow
Chat formatting plugins: Write that down, write that down!
has to be some stage where this can get changed/modified it
big tech turning into CCP
mojang knows the players public key
if you report a message claiming it was from player a but the signature is not one generated from player a it doesn't count as a reportable message
i hope paper or spigot implements a patch dedicated to reporting
well in that case i assume the server sends the signed message to mojang for unsigning right
get iris, now you have shaders
it has to GET the message tho
sodium gives so much better performance are you drunk
everything is done on the client
So the client sends a raw string message but also signs a message
and sends a signature
now, I got a question, how do I check if an inventory is an inventory is a player inventory (so the one you get when clicking on the chest in creative, or opening your inventory in survival)
so wouldnt mojang know a player sent a no no message even with system messaging?
(Thats where im getting at here)
just use the action bar for chat EZ
#Inventory.getType() == InventoryType.PLAYER
mojang never gets a message until reported
well that's useful
The fact that Optifine is still straight up overriding bytecode is sad
if the message is a system message it does not contain a signature
and mojang won't consider it
the client won't let you report it either
i see that was my main question i just had to ask a few more to get to it haha
time to make that plugin now
cancel the report packet from the client lmao
just Bukkit.broadcast the chat message content with a monitor level on the chat event
those go straight to mojang
server doesnt middle man
oof
Monitor is not allowed to cancel (shouldn't, it can but shouldn't)
how will you see then
and monitor is + 1 above that
Microsoft cant defeat community moderation
Microsoft is getting weird since they reintroduced snooper, but without an option to disable it anymore
didnt eman to reply haha
chat moderation shouldnt exist thats what the "Block" button is for.
or as I and a couple other ppl here like to call them: Microzoz (Micro dirty)
back in my day we just didnt let strings of text hurt our feelings on the internet
yeah
Basically since in 1.16 minecraft clients collects telemetry forcefully (theres a mod to remove that shit but still)
what happened to "sticks and stones may break my bones but words will never hurt me"
legit grew up on being called the n word in a voice chat
ppl just soft now a days
its sad
ppl dont realize you dont gotta fight
and we keep reinforcing it.
fight or flight response kicks in? You fucking flight it
is there any way to use ACF properly for a command without subcommands
oh ye
I cant use annotations on a constructor and it wants to force me to do super(cmd)
for anyone that cares heres how i fixed my issue
@EventHandler
public void onStateChange(BlockPhysicsEvent event) {
if(event.getChangedType().equals(Material.BEEHIVE)) {
Beehive hive = (Beehive) event.getSourceBlock().getBlockData();
org.bukkit.block.Beehive hiveBlock = (org.bukkit.block.Beehive) event.getSourceBlock().getState();
CustomHive customHive = cadiaBees.hiveManager.getHiveForBlock(hiveBlock.getPersistentDataContainer());
if(customHive == null) return;
if(hive.getHoneyLevel() == hive.getMaximumHoneyLevel()) {
int storedHoney = cadiaBees.hivePDCManager.getStoredHoneyAmt(hiveBlock.getPersistentDataContainer());
int maxHoney = cadiaBees.hiveLevelManager.getHiveLevel(cadiaBees.hivePDCManager.getHiveLevel(hiveBlock.getPersistentDataContainer())).getMaxHoney();
if(storedHoney != maxHoney) {
new BukkitRunnable() {
public void run() {
hive.setHoneyLevel(hive.getMaximumHoneyLevel() - 1);
event.getBlock().setBlockData(hive);
event.getBlock().getState().update(true);
}
}.runTaskLater(cadiaBees, 10L);
}
}
}
}
well extending an abstract class while the class has a constructor your forced to use super()
you cant rly get around that
I would switch to linux, but Nvidia driver support is trash, electron apps run at 15 fps and desktop environments lack such simple things as show desktop (KDE has it, but it doesnt function how i normally use)
unless the constructors empty ofc
then super() is not needed but you should still call it
well if I just do a subcommand without super it doesnt get registered
my mom
you do sub commands by extending a command class?
HelpIslandArgument extends HelpCommand extends Command
?
say I do this to register a command ```java
public class PrefixCommand extends BaseCommand {
public PrefixCommand() {
}
@Subcommand("prefix")
public void onPrefix(CommandSender sender) {
sender.sendMessage("gotcha");
}
}
``` then /prefix doesnt get registered in game
wdym
get manjaro gnome
Also XFCE got ported to GTK3 and now it looks like an alient with touchscreen decorations on top of dragging bar which is shitty
That's not registering a command
Is this your personal library?
That'll be like registering /test prefix
I use custom windows iso and it eats less resources, also is more stable than linux
But i love linux terminal
Custom windows iso ๐ง
Yea, basically stripped out version of windows 10
god yall do some of the most extreme shit in here
Which uses 700 mb of ram at idle and 1% of cpu usage of an I3-6100 CPU
huh this is for a plugin
Im talking about the commands
I was looking at the examples from ACF
uh
yeah its private
but its not a library
Have no idea what ACF is
well thats's a rip
then no its not my library I thought you meant the code I sent lol
also, why is the survival/creative player's inventory CRAFTING rather than PLAYER
tf
I HATE THAT
SO ANNOYING
so then whats even the issue? I honestly thing extending the class like that isnt gonna be doable for this plugin
because calling super() makes a new instance of the extending class
and each sub command would essentially make a new command instance
this was the example they had lol
the issue is I understand how to use subcommands but not base commands
but I think I just add my annotations to the whole class
Hello !
What's the difference between these too tripewire please ?
hrng uhm
^
well im extending BaseCommand not ResidenceBaseCommands
I think I just needed to do java @CommandAlias("prefix") public class PrefixCommand extends BaseCommand {
well then i have no idea how that command lib is used
Ty
ask in theyre disc support bc ive never seen anyone ask for help about this
or on theyre github
What's the question about ACF ? I use it in all my plugins
(aka papermc)
Its due to how players survival inventory have two inventories one for storage and another one 2x2 crafting inventory in which you can craft all sorts of items
or that works
I guess something like ```java
@CommandAlias("prefix")
public class PrefixCommand extends BaseCommand {
public PrefixCommand() {
super("");
}
@Default
public void onPrefix(Player player, String string, @Default("1") int integer) {
//blabla
}
}
is the way to do it
without subcommands
That's it
thats the beauty of it
no lol you can do something way simpler
Creative inventory doesnt provide crafting inventory to work with so type returned is different
I prefer annotations over if statements
just seems over bloated and complicated for no reason
you can use FunctionalInterfaces
sounds complicated
I dont have docs updated for sub commands yet
essentially its just this.registerSubCommand(TheSubCommand.class)
Which has a execute() method for the sub command to execute
600 line command classes with 200 annotations seems eghh
redempts libs for commands is nice too iirc
most libs are command classes
redempts mine and aikars are all command class based, as well as other libs out there
most extend BukkitCommand/Command
annots are nice apart from the inflexibility that comes with them
Yeah in that lib it looks like you need 5 annotations on each sub argument
looks annoying to deal with
tbh
ive been coding for like a year and something now
i never really found a really good for testing
well a year isnt taht much but still, ive never found a good use for testing honestly
yea but its nice to follow some type of structure
dont want your command classes being wildly different
tests have big cons and pros
would say that depends
i just run the code on my server
if it works yay
since well your command classes are the lowest level components of a cmd interface (that delegate to your internal modules)
tbh
so they're bound to be impl based quite hard
i dont know why your abstract class is named like that
ApiCommand?
yeah
AbstractCommand ๐ฆ
i would say its nice for commands to be impl based
it has become an industry standard, talking about TDD, DDD or BDD
But its an ApiCommand 
because otherwise developers deliver shit
plus its not rly abstract cause you dont implement anything
the extension is for auto register rly and to provide methods
eg this.subArgument
no abstraction for it
so i feel AbstractCommand is slightly misleading
its auto register
u dont get it
rn what ur doing, is creating the arguments and the code for when theyre run
in the same scope
i would make it so u register the args in ur constructor
well
but have a listener type of thing to replace that
constructors should generally as in almost always only construct the instance, they should scarcely ever run logic or other things because that usually reduces reusability and flexibility, but over that AbstractBlah is usually a good convention because it tells the developer that you provide a base data structure with a nice derivation api
the constructor doesnt even run this code
presuming you are faithful to the convention ofc
it simply stores the function
hence why functional interfaces are so nice
code isnt ran until you run it
its basically storing a function as a variable 
you dont get what im saying
instead of having the lambds there
instead, having listeners as another methods
youd have to show an example cause it makes no sense what your saying
just sounds like over complication
those lmabdas can be called anywhere
even after the commands registered
yeah
i just used constructor to show an example
imma add an example a sec
doesnt need to be in there, its in there due to my own lazyness
new MyCommandClass().registerSubCommand().registerSubCommand().onPlayerSender().onConsoelSender();
You can chain it liks this if you rly wanted to but
eh
instead of .onPlayerSender() have a method onPlayerSending() outside of your constructor, and same for onConsoleSender() and arguments
otherwise ur constructor will get long, i mean you can just have methods to call in ur constructor but i find it better do it this way ^
onPlayerSender is quite literally an event though
it is onPlayerSending
its executed on player sending
dude
all this just sounds like over complification
i believe what i said is very obvious
i cant understand what you dont get in what i said
Why would i want to have a listener
And said it doesnt need to be in the constructor the class extends ApiCommand
have i ever denied onPlayerSender isnt an event though
you can call these methods everwhere
2Hex is probably proposing you the rule that every line of a function should be at the same level of abstraction, in which extracting a function that you call would be more polite to the reader
oh wait
oh are you just talking about my naming conventions
in reguards to this ^^
cause if not then i dont get one bit
i dont get why ide want to make a listener for these
wasted resources, wasted cpu cycles
Premature Micro optimization hits hard
i didnt even optimize this, its a simple system
you store the function in functional interfaces and call them later
it just stores a function
//better
void doStuff() {
doMoreStuff();
invokePostEvent();
cleanUp();
}
void doStuff() {
try (var scope = scope()) {
Manager manager = executeWithListener();
Task task = scope.fork(() -> awaitResultData());
scope.join();
manager.update(task.resultNow());
}
Eventbus.INSTANCE.post(FetchDataEvent.create());
System.gc();
}
just as an example
the first one is much more polite to the reader
because the reader can if they want to... exit early
System.gc() ๐
ye just had to come up w sth lol
i said previously you can do this with mine too
..
yeah but the constructor example ๐
you can call the set methods wherever whyever
well i said i was lazy lol
its my testing code
mye
the name of the class is quite literally TestArgument 
only thing you can change after the commands registered
is methods like setCommandName ofc
for obvious reasons
well my point was that you'd make the lambda expressions into normal functions and then just call blah::someMethod
(idk if 2hex meant the same thing)
yeah someone can do that too
would need to figure out how to transform my functional interfaces to a method referance but definatly doable but
the Lambda actually provides methods too
for the SubArgument api user
so youd likely need to have a class extending SubArgument, which wouldnt be that nice

there its actually stupidely simply (Dont rip me for static or code style its just an example)
and you have access to all methods
IIRC Damagable has getMaxHealth doesnt it?
not from what i can see
pretty sure attributes exist in 1.15.2
use the Attributes like theone said
Entity#getAttribute
declaration: package: org.bukkit.attribute, enum: Attribute
all list of attributes ^
When you call getAttribute on an entity with that enum, you get this class: https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/attribute/AttributeInstance.html
declaration: package: org.bukkit.attribute, interface: AttributeInstance
also lets say i had a command (/sethealthrows 10)
i would need to multiply args by 20 to make it 10 rows of health, correct?
like so?
((Wither)ent).setMaxHealth(Double.parseDouble(args[0]) * 20);
((Wither)ent).setHealth(((Wither) ent).getAttribute("GENERIC_MAX_HEALTH"));```
Is it possible to assign metadata to armorstands ?
Yes
so how to do that?
oke
?pdc
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/metadata/Metadatable.html
If you're on an old version
declaration: package: org.bukkit.metadata, interface: Metadatable
its throwin an error
cos it wants a double not an attrib
Get the value of the attrubute
how
getValue I'd assume
looks that way
use getDefaultValue if you want the actual base max health
getValue returns its current live value of that entity iirc
Well Intellij has given you a few of the possible causes
haha
yeah i know its the itemmeta but how i fix it?
ItemMeta is null when the item is air
Hi, i need some help with Unicode fonts.
I still don't get it how to create the GUI.
I found there are 2 ways to do it.
1.- Custom Items that look like the inventory background
2.- Text that looks like the inventory background
The first would be to create an item-stack with the material from the resource-pack you replaced, but I don't know if that's possible.
And the second way to do it I don't understand how it works
I hope and someone can give me a small example of how to show the texture on the screen. With or without open inventory
Thank
its not air
why cant i use event#getPlayer in my playerdeathevent
cast it to player
?
use getEntity() it returns the player
Then ItemMeta isn't null
I am getting the item from a file
And?
saving works but getting it doesnt
Entity#getKiller returns a non-null Player if the entity was last killed by a Player
if getKiller == nulll; entity wasnt killed by player so return
and then just getKiller when u need for that event (getKiller shouldnt ever be null for that event)
Is it possible to make custom firework shape?
You can spawn particles in a shape
Just use pdc to detect the custom shape when it explodes
Cancel the vanilla one and spawn your own
You will probably get an awnser faster by using google
i think javadocs might have the max value (morice)
i keep forgetting spigot has 2 damagables
kinda annoying ngl
use instanceof
wait
what version you on
@wind blaze
i can make that code super short if your on newer versions
if (itemMeta instanceof Damagable theDamagable) {
}
use that if your always on 1.19
older java versions that wont work so do note
Java 16 ftw
armorStand.remove(); could I unremove Entity?
right
somebody know if capacity of the var example = new List<>(1000) will be decreasing after removes content?
I mean while init new List<Integer>() java creates Integer[10] under the hood and when I'm adding 400 new objects, Java replace Integer[10] with Integer[400]
What is the closest equivalent of EntityAddToWorldEvent (from the paper fork) in Spigot? And what are the differences?
CreatureSpawnEvent? idr
?jd-s
https://jd.papermc.io/paper/1.15/com/destroystokyo/paper/event/entity/EntityAddToWorldEvent.html oh yeah it even mentions it in the paper documentation, however it might not fire as often or even at the same time? idk
sigh I need the exact equivalent of it in my code otherwise I will have bugs
if u need exact functionality... u might have to use paper..
or try and do tracking using spigots provided events
This is the code that I need to be working the exact same in Spigot. It's nothing too massive but I need the entities to be removed haha
@EventHandler
public void onEntityLoad(EntityAddToWorldEvent event) {
Bukkit.getScheduler().runTaskLater(plugin, () -> {
Entity entity = event.getEntity();
if (entity.getType() != EntityType.ARMOR_STAND) return;
if (dataManager.getActiveArmorStandsSet().contains(entity.getUniqueId())) return;
if (entity.getPersistentDataContainer().has(followerKey, PersistentDataType.STRING)) entity.remove();
}, 1);
}
i mean CreatureSpawnEvent might be able to suit ur needs, idk
might have to look into where the events are called in their respective forks to see just what makes them different
I should be able to use CreatureSpawnEvent and ChunkLoadEvent
but back when I tried this before it didn't work
what about the equivalent of Bukkit.getCurrentTick() ๐
I'll track myself lmao
no, this is spigot (we're well beyond the point of insanity)
I reallly wish Spigot would combine with Paper ๐
Spigot Forums > Paper
Paper Code > Spigot Code
Yeah that's where the problem comes from ๐คฃ
spigot > paper
well the paper patches could simply be accepted into spigot
they could, but then why use paper if spigot has it all
i'm p sure paper was created because spigot wasn't accepting patches fast enough
exactly
but it doesn't have it all, which is the problem
depends on if that returns a copy or the original list id say
original creation reason, no idea- but I can almost guarantee its not alone because patch merging being slow
Paper focuses on multiple things
how would i make a circle in the FAWE api then count the blocks within that radius?
i cant find anything about making a circle with their api
i can find stuff about counting blocks but only in a EditSession
Is there a way to send to lobby all the players when a server close?
?jd-bc
Loop the players and connect them to a lobby when the server closes
Its tested?
have u tested that event?
why would I test it
you're trying to MAKE a plugin to do this correct?
ProxiedPlayer#connect(server) probably from ServerKickEvent and do some checking on the state / kick reason / server info
what do u think to use onDisable to tp all to lobby server?
literally the 17th plugin on spigot does that
even more ig
Lol
@sullen marlin any chance of an EntityAddToWorldEvent being added to Spigot ๐
๐
I am trying so hard to make my plugin work on Spigot but this one thing is the difference in a fair few of mine and my friends plugins that means we are held to Paper for some entity based parts of plugins
You can use paper then
Or backport to your local that event ig
I want to be able to share my plugins on the Spigot Forums
Oh, is for public usage
You can find information about contributing to Spigot at the following links:
https://www.spigotmc.org/wiki/cla/
https://www.spigotmc.org/wiki/guide-contributing-to-spigot/
https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse/README.md
https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse/CONTRIBUTING.md
me guen paper
what would be the easiest way to give reciever of damage a massive knockback
im making an armor enchant called "ragdoll" (self explainitory)
multiply their velocity
has spigot other options to change position of entity then teleportation? I would need to make immediate posiotion change of armorstand then this smooth one like on this video
you could apply gravity with a set valocity maybe
other than that not really
down to NMS code most moveTo methods just use teleportation or the AI controller and make the entity walk
package com.shampaggon.crackshot.events does not exist, I put crackshot addiction (Project Strutture, modules, dependencies add crackshot plugin)
does AI controller is based on teleportation?
could I somehow override armorstand AI controller?
im not sure
I would assume that down to the very very very base code its just small teleportations of .001 that just make it looks like its smoothly walking (I assume)
They dont have a navigator sadly
same with players
hmm but AI controller send some kind of packets to client
certain NMS Entitys have the moveTo methods but throw errors when using theyre controllers
Not if the attatched entity has none BUT
so do I could sends it
what you COULD do
is server side spawn a zombie
and tell the client its a armor stand
with the appropriate data needed to render the blue keys in the air
and then attatch its client sided position to the zombies, and it will make the armor stand look like its moving like a zombie
its a dirty trick a lot of ppl use to spawn in fake players and just use mc's default AI controller
ofc u gotta disable the zombie actions and stuff, but it works
like zombie is moving around but blue keys need to go up
omg
wont work on older versions tho ofc
thats genious
yep your all good for that then
how do i add only age 7 WHEAT?
only issue is idk how to actually control levitation speed
I assume setting the entities base speed will do
You need to cast its block data to a Crop iirc
lemme double check
ah
its changed tooo
Ageable iirc
declaration: package: org.bukkit.block.data, interface: Ageable
double check import
theres a block ageable and entity ageable
if(b.getBlockData() instanceof CraftCrops)
{
CraftCrops c = (CraftCrops) b.getBlockData();
if(c.getMaximumAge() == c.getAge())
return true;
}```
ageable kept throwing errors for me
because you didnt instanceof check
^
ye i did
?paste
CraftCrops is if your about to use NMS
i forgot to add that to the msg i just sent tho
question.. what are the chances of my PR being accepted? I'm not tryna go through all this work for nothing ๐คฃ
most Craft things are just Handles to NMS things
wouldnt it be casting it to b(lock) and not getBlockData or am i weong
nah Ageable is a BlockData type
o
Honestly cant answer that, Id recommend trying to find someone who has made PRs, Choco might be able to assist
whats CraftCrops tho
but you do need to check if BlockData is null before casting too
Most Craft stuff is for NMS
ik
there is infact no, and CraftCrops actually extends the NMS BlockData
?jd-s
but you should rly use Ageable
?jd
is there no doc for CB
its not an api
^
thus no javadocs* there may be some, but not an online version like Spigots/BC
ig
Its mainly just meant to be used as a bridge
just an intermediary :(
im a Genius
Lol
its cause getInteger is static
is there a bilingual way of insert or ignore for both mysql and sqlite?
but they could of just slapped it in the constructor to initialize
is it a property linker or something
just a integer holder for the crops age
in my sql it's just "insert ignore" but in sqlite it is "insert or ignore"
doesnt sqllite replicate mysql statements
i thought so
yeah definatly differentiates
but for some reason i thought the 2 used same syntaxes
postgresql suuucks
sqlite is worse
SQLite will usually accept MySQL syntax
Hey so I noticed that the player death event has the exp dropped which is half of the player's exp when they were alive, is there a safe way of getting how much exp players actually had before dying because I don't want to run into a scenario where some other plugin is already modifying the dropped exp and I end up doubling that amount, which may lead to xp duping exploits
aside from storing that amount and keeping it up-to-date that is
how do i damage an entity like if was attacked by another entity? (i can't use entity.attack(other entity)
pretty sure there's a damage() in there
might be the only other way via the api
or maybe create a damage event?
i already done this but damages without knockback
damage event just triggers other plugins'api, doesn't do anything
if you want the knockback you'll have to emulate that with vectors
no way around it
i knew that but i hoped there was another way to let minecraft handle that without emulating it
thanks anyway!

