#help-development
1 messages · Page 329 of 1
after all a plugin might also add additional blocks to the list on e.g. normal, e.g. some weird "LARGER EXPLOSIONS!!!!!111" plugin or sth lol
if I was verano, I would probably make the priority configurable
some plugins might add blocks to the list
or listen to both lowest and highest
i mean lowest can also make sense, e.g. when people want to add custom drop explosions
so yeah best way would probably to listen to both lowest and highest
well it seems like it's for his own server so i guess it's not that important
I got the following classes:
Drink -> https://paste.jeff-media.com/?d8c55a759453fb94#8ZA3HkDL6N31NwTA754dmLVygY1NskzuoPEjkucsCwMi
DrinkTemplate -> https://paste.jeff-media.com/?704671546823954e#4YbHKzfmo6T9q8YNBt3dRWRhb89Vje9wuwzKPmm3YeQB
Obviously I need a method to turn a DrinkTemplate into a drink. Should I rather create a static method DrinkTemplate.toDrink(), or a constructor in Drink that takes a DrinkTemplate, or a static method Drink.fromTemplate((DrinkTemplate template) ?
all three
why the heck does IntelliJ not have a clone() generator
mfalex
who's that
well show your code
The same you sent before
send your code
did you register the listener?
yes
how did you test whether it gets called?
like, how did you create an explosion?
because as I already said a few times, TNT is not BlockExplodeEvent
ew cloning.
the block explode event gets called when a block, eg chest is blown up
entity explode event to get when a tnt or something blows
Use EntityExplodeEvent
maybe I should adjust the default values a bit lol
I've told him 20 times already
I know
Ok I've found why.
In March 2015, @Thinkofdeath has changed how the event is triggered here : https://hub.spigotmc.org/stash/proj...mits/e387d8dc7752a7f03e6baa1dadaf66ec2e7e3512
BlockExplodeEvent only fires when the explosion has an unknown source.
If the source is known like when a player explodes a TNT, an EntityExplodeEvent is fired.
The Javadoc is not quite clear about that : https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/block/BlockExplodeEvent.html
IIRC only beds and these end crystal thingies call a BlockExplodeEvent
maybe it's indeed the entity event too, idk
all I remember is beds are block explode event, and that I once had some trouble with the end crystals because they worked in some unexpected way
Can anyone help me with something regarding server address? It is crucial to getting my server on server list websites
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
My server is on version 1.0 of Minecraft. I have everything setup correctly in port forwarding and even went as far as to contact the domain registar and they said to get help from Minecraft lol. Anyway, I am supposed to be able to connect using hydricmc.com but when I do so, it says "Connection refused: connect" instead I have to type hydricmc.com:25589 to connect to the server.
1.0?!
btw head to #help-server please
then I'll try to help you there
yes lol, I can explain in more detail, also ok I am going there
ah yes sex
lmk when it releases
ok
So 1.19.3 changed somthing I think where Wardens no longer use EntityTargetLivingEntityEvent, so what event is called when they target a player? (I also tried WardenChangeAngerEvent, which also doesnt work)
is there a way to spawn x particles with random locations in relation to an origin
built in
I switched to EntityTargetEvent which somhow fixed it
hm
well it worked last i checked
lemme check again
ye its working for me
I hate IJ more every day
when I do "for(Bukkit.getWorlds()" ...
why is there no shortcut to turn it into to "for(World world : Bukkit.getWorlds())"
and that would be able to do that?
theres gotta be some way to configure intellisense for that
Idk could probably add config
maybe, but I still wonder why it's not there by default
bc tbh, a for(<someCollection>) will always result in for(T element : myCollection<T>)
why is not builtin
maybe its language level thing?
that doesnt have anything to do with that
the enhanced for has been available since forever
why am I paying over 600€ per year per user for intellij when it cannot even do simple things like that lmao
Paying for your IDE 💀
ok granted it's only 600€ in the first year
after that it goes down to 360€
still, what a shitty thing that they don't even have basic convenience features like this
another reason why I think apple > the rest
people would be outrated if XCode couldnt do that
Is it possible to have maven package 2 different "plugins" and export them separate from the same project?
If I wanna make a world generation inside something else
it looks like you want to use modules but are not doing that
Has to load before everything
But if my plugin has dependencies loading before others will mess with stuff no?
i dont really understand
Yeah ^
There's the load property in plugin.yml right
yeah, STARTUP and POSTWORLD
That means my plugin will load up before other plugins too. What if I depend on a plugun that hasn't loaded yet
@tender shard cntrl + J , type iter, type your collection
So im wondering if the correct way is separating the world generation part of the plugin instead of loading my entire plugin startup
Or will dependencies not have any impact if I load startup instead of postworl
I think ur overcomplicating this just write the plugin yml and let it go
thanks, that's better than nothing. Still annoying that one cannot do it "afterwards", e.g. when you already typed "for(Bukkit.getWorlds()"
i dont get why interfaces only allow public members 🥲
well use abstrct otherwise xD
so that you can override them?
on interfaces?
no i mean use abstract classes instead of interface
why would one not be able to override a package-private method?
that would defy the point of using interfaces, which is that I implement more than one
imho the whole "visibility" thing in java is bullshit, I mean you can always get rid of visibility using reflection anyway
interfaces are intended to be stateless
private fields.... well, that's so pointless given that you can just do getDeclaredField(...), set it accessible, and then change it anyway
what does that have to do with visibility of methods declared in an interface?
🤔 what u mean with this
I'll try to explain what I meant in 10 minutes, I'm going for a nasty smoke lol
Seems like you just want to use abstract classes
no
Bukit.getWorlds().fori or soemthing
you can only ever extend one class
you are using an interface to define methods that will be used to load files/read configs. im not sure what is going to be different between these methods other than a file name, but you need them to be public on the interface so you can override them outside of the interface. you can always implement them and make them private on your implementation
doesnt work when I already typed for(Bukkit.getWorlds()
no, I'm not
the stuff I currently write is an aggregator to collect data, wrapped into YamlCOnfigurations
it doesnt load any files
yeah anyway, I'll try to come up with an example where a private interface method would make sense
did you read the full explanation
not yet, one sec sorry
I've read it and I'm going to give you an example, althoug tbh I need a few minutes to think of an actual use case because frankly, I'm a bit jägermeister'ed
would anyone happen to know if its possible to make the wiki on a github page be saved actually in the repo files, instead of it not being accesable anywhere else
bump?
public interface ExampleInterface {
public default String myExampleMethod() {
if(requiresWhatever()) {
return myInternalThingThatRequiresSomething();
} else {
return theDefaultThing();
}
}
public default String theDefaultThing() {
return "default";
}
protected boolean requiresWhatever();
protected default String myInternalThingThatRequiresSomething() {
return "internal";
}
}
send the full stacktrace pls
ok
We cannot help without the full stacktrace; Please paste it here: https://paste.md-5.net
nice
i was litterly gonna do that so i could paste lol
lmao
here's the whole list of what I got added: ?notworking ?nms ?blockpdc ?morepdc (and a few more, but I forgot about those ones)
switchmappings
the skills part at the bottom is also the same plugin
please also paste the WHOLE source code (so we can see the proper line numbers) of
- Keys.java
- Main.java
this is all that need to be dont
as Main just calls the method
and this is my example
keys:
example:
recipe:
shape: "#-#|%#%|#%#" ## Use what ever you want you can have 3 rows and 3 characters # USE * for empty
ingredients:
- "#|IRON_BLOCK"
- "%|REDSTONE_BLOCK"
- "-|IRON_INGOT"
==: org.bukkit.inventory.ItemStack
type: TRIPWIRE_HOOK
meta:
==: ItemMeta
meta-type: UNSPECIFIC
display-name: §6§lExample Key
lore:
- "§7Unlocks§f: §2Example"
I want it to be knockback when hit by a snowball, but I haven't been able to find a way
what's "it"?
if you want to "knockback" players that are being hit by snowballs, simply get the snowball's velocity in ProjectileHitEvent, normalize that vector, multiply with whatver you want, then add that vector to the player's current velocity
Oh thanks
I can you show an example in 5 minutes or so
Oh ok thank you
@EventHandler
public void onSnowballHit(ProjectileHitEvent event) {
if(!(event.getEntity() instanceof Snowball)) return;
if(!(event.getHitEntity() instanceof Player)) return;
Snowball snowball = (Snowball) event.getEntity();
Player player = (Player) event.getHitEntity();
Vector snowballDirection = snowball.getVelocity().normalize();
player.setVelocity(player.getVelocity().add(snowballDirection.multiply(2)));
}
@dull magnet
this would e.g. make the hit player getting knockbacked a bit
to make it stronger, you would have to adjust the math in the last tine
Ok
?codeblock
You can use the discord code block format to display code or just text in a more pleasing way:
```java
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {
}
}```
Becomes:
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {
}
}```
?paste
how can i make save temporary the position of the player and when he falls into the void automaticaly tp back on the location saved?
is it possible to remove knockback players receive when taking damage?
whether from another player, fire, poison, etc
You would cancel the event and the apply damage manually
that depends. should the location save between server restarts?
I am working on a discord bot(JDA)
so I am trying to add SelectionMenu in a embed. & did this
event.replyEmbeds(builder.build()).addActionRow(menu).queue();
got this from JDA wiki. but IDE saying Cannot resolve method 'addActionRow(SelectionMenu)'
here is my menu
got it.
Huh weird that when I linked it got autoremoved
needs https:// on it

cafebabe doesnt like plain discord links
how to prevent players from taking items from armor stand? i want to make spawn protection for my server
declaration: package: org.bukkit.event.player, class: PlayerArmorStandManipulateEvent
cancel this ?
bro i send the acc like 1years u still didnt respones + ( I resend a lot)
huh?
any way to convert legacy material + damage value to modern material?
declaration: package: org.bukkit, interface: UnsafeValues
Hi guys!, i want to make a plugins for an event that needs player to break a block, the most block they broke will win
But i have a problem with grass, sapplings, and farming item like carrot, potatoes, bamboo, etc.
Any idea for better code? not writing all the unwanted blocks like this picture below.
Like Seeds have Natural Blocks category, Carrot have Food&Drinks category, how to get that category?
you mean the creative categories?
yes
those are client side and you cannot get them
so there is no better code? because i think loop-check every BlockBreakEvent will bad for server...
why not doing ::contains?
ah..
on EnumSet.of(Material.A, Material.B, ...)
i'll do that, thanks!
atleast its not linear then
cry about it
I am because where is that material to registry PR ðŸ˜
hoping materials in the future will still have reference equality
oo? so, any suggestion?
oki, thanks!
they would I presume yea
BlockBreakEvent, how to use event.getBlock().getDestroySpeed()?
is it like how long it takes to break the block?
Nah
world objects have reference equality
not like .equals would hurt tho 
I want this PR too i wonder what the holdup is. Just bresk my plugins alreadyy
what's a popular minecraft world pregeneration plugin that I can recommend to people?
preferably something easy to use
Chunky
alright seems legit, thanks
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
I have Player#getWorld().getName() in PlayerChangeWorldEvent and I'm switching to word world but they don't match for some reason
what are you even doing
Print them @atomic swift
checking if the player changed to world
ok
Does anyone know how to set the speed and transfer amount of a hopper without going into the spigot.yml, in code.
load the spigot.yml and change it
I'm looking to have "upgradeable" hoppers
It would have to be a per block value though
You can use the https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/event/inventory/InventoryMoveItemEvent.html for the transfer amount
declaration: package: org.bukkit.event.inventory, class: InventoryMoveItemEvent
For transfer speed you will probably have to use a scheduling task or nms
?scheduling
So I could just check the amount left in the hopper and move the rest according to my transfer amount. I'm assuming that's how other people do it.
Anyone know if it would be theorhetically possible to make player heads powerable? Or not because they are just transparent blocks
uhh will I not be able to download buildtools with this?
holdup
1.8.0_232 (x86_64) "AdoptOpenJDK" - "AdoptOpenJDK 8" /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/Contents/Home```
?
How to prevent AI from fighting, targetting stuff, anything except moving or at least having gravity
Cause event.setAI(false) just has him floating he can't even reach the floor
Remove the AI goals that do all the targeting
^ anyone?
Which goals specifically do you think. After reading down the entire list I can't seen to figure
I mean you should be able to, it just isn't going to let you build the newest versions since those require later Java versions.
Uhh can you send a screenshot of the list? I don't know them all off the top of my head
yea got it
but how do I change my java version from jdk 16 to this?
Change the JAVA_HOME environment variable so that it points to that instead of the JDK 16 folder
im on mac
Welp I have no idea then. Might just have to Google how to change default Java on Mac.
Scoreboard problems
well im using terminal will that work?
Those aren't the goals, in the NMS entity class you're trying to modify (So if it's a Zombie you're changing, find the NMS Zombie class), there's a ton of goals in there. You'll have to make a custom entity to remove the goals.
Please read the link
Oh god
You really think the only way is to use NMS
Damn
That's no bueno
To remove part of the AI? Yep, you need a custom entity and the only way to do that is extending the NMS entity.
Afaik anyways. What exactly are you trying to not let it do? If it's just targeting, I think there's an EntityTargetEvent or something you can cancel.
Hello I am currently trying to use the PlayerInteractEvent. My current code looks like this: https://gist.github.com/TeddyBear2004/34b7ea7fd60b8799433059658852c808
I currently give the player a slimeball in the offhand so that the RIGHT_CLICK_AIR is executed. However, this is executed more often when held down, whereas LEFT_CLICK_AIR only works once per click. Is there an item that executes multiple LEFT_CLICK_AIR events where you have only clicked once?
What do I get out of checking the hand?
I can assign whether right or left has been clicked on
If the right button is held down, permanent events appear.
While left-clicking only calls the event once.
that's just what the client sends
However, the server can indirectly manipulate what the client sends, so RIGHT_CLICK_AIR is only executed when the player is holding certain things.
And my question is whether there is an item with which this works with left clicks.
Probably not since left clicks are animated and right clicks aren't.
Pretty sure that's why it always fires for left clicks, since that animation happens no matter what they're holding.
Where if they right click with nothing... nothing happens so the server doesn't care.
And the mining distance is probably also only clientside?
Ye
Ok :/
I might be an idiot, but where is the problem in this statement?
"INSERT IGNORE INTO `players_settings` (NAME, UUID, CHAT, SHOWPING, FLY, PM, JOIN, JOINOTHER) VALUES (?, ?, ?, ?, ?, ?, ?, ?)"
That sounds weird.
The table itself exists
with all data izék I put over the statement
[16:44:31 WARN]: java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'JOIN, JOINOTHER) VALUES ('NeonOwlGery', 'bd0e1b9d-ac9b-3251-87f4-649ba1ea3e32...' at line 1 - this is what I get btw
Which is again weird because the simple "players" table uses the same method, and doesn't gets this error, but this one does?
I don't get how they would not be the same. 🤔
Oooooo... Then Imma try other names
Yup. It was that error.
Thanks :D
what even is JAVA_HOME for lol
How to
full enchantment tool
but rename only costs xp 1
How to
ask question
but in full sentence
Hey anyone know how to make the thing when ur in combat u cant walk back to spawn? i fr need that plugin (dont judge my username)
how do I spawn a falling block with packets???
why would you need packets for that?
anyway: clientboutAddEntityPacket or however its called
how?
how do rename the tools, the cost is only xp 1?
I want to spawn like 50505
50 x 50 x 5
the client will die
But shouldnt falling block entity have a blockstate metadata
it doesnt and I dont know how to change the block
I have no idea how to to it
It's part of the object data
I thought they got rid of all of them ;/
i cannot destroy armorstand even with my permission? whats the problem? ``` @EventHandler
public void onPlayerDamageEntityEvent(EntityDamageByEntityEvent event) {
if (!Objects.equals(pluginManager.getSpawnLocation().getWorld(), event.getDamager().getWorld())) return; // if player is on spawn
if (event.getDamager() instanceof Player player) { // if damager is player
if (player.hasPermission("bpsurvival.protection")) return; // if player has permission, dont cancel
event.setCancelled(true); // else cancel the event
}
event.setCancelled(true);
}```
there's still a load of stuff that uses ids I think, especially on bukkit
I mean in nms
wiki.vg totally sucks anyway, they dont even show the actual packet name
hm?
the permission logic is inverted, only admins have it
yep i got multiple events
i have it on every interaction event
if (!Objects.equals(pluginManager.getSpawnLocation().getWorld(), event.getPlayer().getWorld())) return;
if (event.getPlayer().hasPermission("bpsurvival.protection")) return;
event.setCancelled(true);
}```
if players are not on spawn let them destroy stuff
it works on everything except that
the home for java
Player player
@Override
public void onSpawnPacket(EntitySpawnS2CPacket packet) {
super.onSpawnPacket(packet);
this.block = Block.getStateFromRawId(packet.getEntityData());
yes
I'm for so.e reason errors out every time i try it though
i will make some logs and paste it here
That's always going to throw an error 
is using final on player variable necessary?
so if the player is a player then return if not error out
im just curious
obviously... but java works fine without it, so i wonder what's it for
well that's because java doesn't care it's just easier for you to access it
through cmd
cmd only cares about the PATH variable
i forgot to call the log only when the entity is an instance of player XD
I've set JAVA_HOME to "" and still "java" works
like if you remove it from PATH then run set PATH=C thebr e open cmd and enter java the command will most likely be unknown
so it runs
you have to reset PATH
no, obvisously then it wouldnt find java anymore lol
exactly
so my question still stands - what is JAVA_HOME for?
for cmd
then why does it work fine without that var being set?
so how do I find the right id for the block I want
bc you have to reset path after removing it the. it will break
For example gradle binary looks for java home env
I assume other similar apps too
I would have thought gradle just downloads a few more wrappers and brings its own jdk
Probably some kind of convention
but alrighty, seems like it's only needed for the JDK, that explains why using java -jar´ still works fine without it
it doesnt however explain why a normal JRE also sets this variable
very weird lol
I'm not sure, the internal thing it seems it does is there is a list of block states and it just gets by the index (which is the data id you provide)
it does not fire ;O
idk maybe im using wrong event?
I wonder if the blocks in blocks class are registered in the same order with those ids or ill probably have a lot of trouble find the id too
does it still use numeric IDs internally? at least in the Blocks class, there's no mention of any number IDs
I don't think so
I wonder how viaversion translates the id depending on version
yeah that'd be interesting
Is all the NMS stuff sort of new? I remember doing some dev at least 6 years ago and never heard of it before
net.minecraft.server
I know what it is now, I’m asking if it’s sort of new or it was being used 6 years ago
public void onPlayerDamagedEvent(EntityDamageEvent event) {
if (!Objects.equals(pluginManager.getSpawnLocation().getWorld(), event.getEntity().getWorld())) return;
if (event.getEntity() instanceof Player player) {
Bukkit.getLogger().info("TEST 1: " + player.getDisplayName());
if (player.hasPermission("bpsurvival.protection")) return;
Bukkit.getLogger().info("TEST 2: " + player.getDisplayName());
event.setCancelled(true);
}
event.setCancelled(true);
}```
I have this permission, why it does not call the second log?
because you return if you have that permission
you cancel regardless
it should not return the whole method?
it should actually yeah
but that's what "return" is for
its when entity is not player
return true/false is use in commands to Ãndicates if execution success or not
?
tried spawning the falling blocks with packets. a bit cursed.
offset it by 0.5, 0, 0.5
They look like they're lining up to kill me.
if you comment the whole listener out, do you then take damage?
maybe something else blocks it... youre right
is Armor stand an Hanging Entity?
Because i have eventlistener for that
Regardless, im checking for the same thing lol
If player is on spawn,
and if player has permission
Ok maybe i messed up, i have one more event, EntityDamageEvent, but it does not have Damager? or has it
I will just return that ;D idk
Ok it works; Thanks for help! @tender shard @last temple 💜
Great!
I was wondering why EntityDamage dont have getDamager() method, but now i understand that it could be something like fall damage or smh
When player hits an entity it's calling both at the same time 🗿
No problem!
Not really - the EntityDamageByEntityEvent is a subclass of EntityDamageEvent
hi, is there a way to create blocks that dont actually exist? Like blocks that are not actually registered in the chunk or region files. Sort of like modifying the packets of blocks being sent to the player. Temporary blocks of some sort.
sendBlockChange
would that actually replace any blocks in the world?
nope
ok
Appreciate the help!
any suggestions regarding how to design an Invsee command that also contains the target's armor and is still modifiable directly?
Check out angelchest‘s gui
code wise
cuz i have to deal with a bunch of things
like when the target player gets or removes items
is github offline?
works for me
weird
no website works for me lmao
but discord does
and no, its not a DNS issue
wtf
I wanted to add you to angelchest's repo so you can see the gui code
buuuut
idk no website is loading
edge works
chrome doesnt
thursday, my macbook arrives, then I can finally use safari again
is safari also not Chromium based?
lmao
whaty your gh name again
looks fairly nice. but i was not rlly looking for a gui library 
doesn't exist
u need access
oh it's a private
alex trusts everybody
@tender shard lmfao
it does exist
good one
you just cannot see it
haha I remember
WTF 2019?!
damn that's almost 4 years
aperantly
who knew a simple "deathchest" plugin could be so advanced haha
more than 100 friking classes
way more
Main
I never understood the hate about it
idk i never liked calling it that haha
angelchest itself has 126 classes, but it also depends on JeffLib which has another 200 classes or so
well it's the main class
also it's not just "Main" but...
other plugins accessing it would use "AngelCHestPlugin" interface
I just don't like having to type "private final AngelChestPlugin" everytime
how many lines java code
15072 without all the libraries
so kinda inaccurate since e.g. JeffLib was only made for angelchest
so actually the lines of JeffLib should be added
fair
thats pretty insane tho 15k for a plugin like that already
prolly loads of dependency, configurability stuff
always hated that with public plugins
angelchest is literally the only proper death chest plugin
all others are shit
that was the only reason why I made it in the first place
i once made one as well
so angelchest is roughly at 50k lines of java
jeez haha
im making a full on minigame plugin and im only on 10k java lines rn
its probably only 50% done tho
https://github.com/JEFF-Media-GbR/AngelChest it's public now
isnt it premium? xd
yes
Daytime, StackResize etc are paid too and they are also on github
also you'd need com.jeff_media:PluginCompiler to compile it
yeah tbh if someone manages to compile this, then they can use it if they like
it uses so many libs that aren't public, it'd be a pain to compile this
e.g. StepSister
or PluginCompiler
tf is that xD
StepSister is the new version of Daddy
I made that so that AngelChest Plus and Free can share the same source code
it does stuff like this:
if(Daddy.allows(PremiumFeatures.SHOW_GUI)) {
showGui();
}
the PluginCompiler replaces the Daddy calls with "true" for the paid version, and false for the free version, so I got 2 .jars
but
one day, Daddy was stuck in an endless loop
so I renamed it to Stepsister
because we all know that stepsisters tend to get stuck in awkward places
Help stepbro
oh shit, the repo contains the allatori annotations
I gotta make it private again before somebody complains about "copyriiight"
also my commit messages are shit lol. "9.7.3"
very descriptive!
"going to sleep. custom blocks and items somehow work"
if i want to make a plugin bungeecord compatitable, what special measures should I be taking when developing it?
"graveyards fully working, adding potions now"
for example how I would store player data across all servers?
oh they've been added at least a year ago
probably in version x.x.x
pog
well 10.0.0-SNAPSHOT on my pc
but before that gets released, I'll have to upload Drop2InventoryPlus 4.0.0
I wanted to do that today but I was too drunk
a new major version means that a big feature was added
e.g., Graveyards in AngelChest
a new minor version means that there's a new config option or another rather small feature
and a patch just means that sth got fixed
https://github.com/JEFF-Media-GbR/Drop2Inventory-Plus this is probably the plugin I'm most proud of
a major version bump for me means that basically all the code or features kinda changed xD
readme is hella outdated
it's actually a private repo, only made it public for now
I usually just bump it whenever there's a "gamechanging" new feature
I mean, look at chrome. they go from version 238 to 241 within one month lol
best class ever
who you gonna call?
how can I close an inventory of a player? I use p.closeInventory(), but if they shift click they can take the item out. What could I do?
wdym. they cannot shift click when the inventory is closed
I mean like if they shift click an item to close an inventory
good luck trying to compile it
if this is about some gui menu, you would usually cancel the event and then just close the inventory
cancel the InventoryClickEvent before closing it
yes
e.g. StepSister
or the ConfigUpdater
I do, this is the entire code:
if(clickedItem.getType() == Material.BARRIER){
e.setCancelled(true);
p.closeInventory();
}
atleast the entire code to exit
that should work
players sholdnt be able to take any items
They can
or StringTransformation
usually calling player.updateInventory() should fix any client bugs related to this
?
its client related, but when they drag the item in their inventory after, it turns into an actual item
its pretty weird
this is the entire function
@EventHandler
public void onInvClick(InventoryClickEvent e){
if(!e.getInventory().equals(inv)) return;
e.setCancelled(true);
final ItemStack clickedItem = e.getCurrentItem();
if(clickedItem == null || clickedItem.getType().isAir()) return;
Player p = (Player) e.getWhoClicked();
ItemMeta meta = p.getInventory().getItemInMainHand().getItemMeta();
if(clickedItem.getType() == Material.BARRIER){
e.setCancelled(true);
p.closeInventory();
}
}
is he in inventory?
why cancelling twice
creative*Ø
btw normally you wanna cancel EVERY clickevent in your custom GUI, unless you wanna allow taking out items from it
yeah it seems like the problem was being in creative
for GUIs I usually have a listener on LOWEST that cancels everything, then another on NORMAL that does the actual logic
Give each gui item a pdc called "guiitem" on inventorycloseevent clear the inventory from gui items. easy
"BlOcKs Do NoT hAvE pDc"
Do I set pdcs to itemstacks or itemmetas?
meta
itemstacks dont have any PDC, only their meta does -> https://blog.jeff-media.com/persistent-data-container-the-better-alternative-to-nbt-tags/
is it the same as with players?
every Entity has a PDC
you can even do a bit of number juggling to get PDC for blocks
?blockpdc
Learn about CustomBlockData here:
https://www.spigotmc.org/threads/custom-block-data-persistentdatacontainer-for-blocks.512422/
pdc is love
it kinda seems unnecessary to make a pdc for every single value
dont they impact performance on the long run?
no
they are just NBT tags
the PDC is just a NBT tag container called "PublicBukkitValues" on itemmeta
or "BukkitValues" on everything else
If I load my plugin or startup and I'm doing extra world creation, how can I make it happen after the world gets created so you don't get "Cant create additional worlds on startup"
wait until the worlds got loaded. I got this class to check the current server status: https://github.com/JEFF-Media-GbR/JeffLib/blob/master/core/src/main/java/com/jeff_media/jefflib/ServerUtils.java
so would I in theory be able to just make a pdc for like, for example the (original) owner of an item, xp to level up, enchantments, etc.
Hmmm alr
is there a way to check for the highest block in a chunk?
nooo
the PDC is a container for EVERYTHING you wanna store
besides like looping through all the blocks manually.
a PDC is like a Map<String,Object>
in case something like that exists.
e.g. you could store "itemname=asdasd", "owner=mfnalex", "age=27" in the same PDC
Alex your lib looks pretty cool
which one?
Just the lib
which one
JeffLib?
Yes
Learn about CustomBlockData here:
https://www.spigotmc.org/threads/custom-block-data-persistentdatacontainer-for-blocks.512422/
?morepdc
You can create custom persistent data types on your own, or use one of the many libraries available which have implemented those which match your needs. Learn about more persistent data types here: https://www.spigotmc.org/threads/more-persistent-data-types-collections-maps-and-arrays-for-pdc.520677/
and the update checker thing
lol
We've already talked about this remember?
You talk to too many diffrent people
I''ve already been using both of those
You even helped me out
yeah I cannot remember everyone, sorry. I do not even can recognize my friends by their face
I usually recognize people off their voice
I made JeffLib so I dont have to update every plugin that uses NMS
I assume you have other projects on your gh showing implementation
I'll just look around 🙂
that's my newest thingy
Looking at your repos here 116 shesh
it's like the "Minecraft development plugin" for intellij, but in good
I used that I think
Do you have a plugin that uses your jefflib which you did gui and multiworld?
Not really related between eachother just to see implementations
I think all my plugins use JeffLib
but it doesnt have any GUI features
I saw a api for it but yeah doesn't look like it had much
it only has a few utils for GUIs
e.g. turning "row 2 slot 4" into the actual slot number
that'S about it
Yeah prob any actual gui framework has better
yeah I never used any, so no idea
yes
Sheesh
Is it because you don't like what's available or you just organize it better?
Wait so your gui files do tend to be pretty long and somewhat complicated right
Like it's not just me
so many warnings
it heavily uses YAML anchors
Oh you actually make it all configurable...
That's something I've always hated doing tbh
But I guess makes it less repetitive in code afterall
yeah I just use JeffLib's ItemStackUtils.fromConfigurationSection or sth
if you use minimizeJar and wanna use NMS stuff, be sure to read the readme
What is the actual use application of it
Like what can I access from nms that I couldn't normally
1 sec
everything that's listed here
e.g. pathfinding
or getting the TPS
or checking whether the server is currently starting up, running, or shutting down
or using NMS' getRandomBlockPos
bla bla just look at it yourself lol
actually alex. do u know of a way to know whether the server has fully started?
like finished loading all the plugins
yes, JeffLib's ServerUtils class
if this returns ServerLifePhase.RUNNING, then it is running, i.e. all plugins are already loaded etc
btw if it returns "RUNNING" in onEnable, then it means the server is currently reloading
Also I know nms is version dependant heavily
Will I need to change much every time?
well it depends
it wont return running upon startup in onenable?
if you use mojang mappings, the only thing you have to do when a new update gets released is to change the mappings version in your pom.xml
?nms
(unless there's actually any significant changes in mojang's code, but those are kinda rare)
no, it'd return STARTUP then
great
if you wanna support many different MC versions, you'd have to use a multi module setup, check out JeffLib's code and you'll see I have a 1_19_R2, 1_19_R1 package etc
client doesnt matter
Alright so if server is version X then just need to make it for that verison, correct?
exactly
Beautiful
<configuration>
<relocations>
<!-- MorePersistentDataTypes start -->
<relocation>
<pattern>com.jeff_media.morepersistentdatatypes</pattern>
<shadedPattern>me.tomisanhues2.dungeonmaster.morepersistentdatatypes</shadedPattern>
</relocation>
<!-- MorePersistentDataTypes end -->
<relocation>
<pattern>com.jeff_media.jefflib</pattern>
<shadedPattern>me.tomisanhues2.dungeonmaster.jefflib</shadedPattern>
</relocation>
<!-- CustomBlockData start -->
<relocation>
<pattern>com.jeff_media.customblockdata</pattern>
<shadedPattern>me.tomisanhues2.dungeonmaster.customblockdata</shadedPattern>
</relocation>
<!-- CustomBlockData end -->
</relocations>
<filters>
<filter>
<artifact>*:*</artifact>
<excludeDefaults>false</excludeDefaults>
<includes>
<include>com/jeff_media/jefflib/internal/nms/**</include>
</includes>
</filter>
</filters>
</configuration>
hmmmm
and when you use mojang mappings and wanna switch your server from 1.19.3 to 1.20, then you simply have to adjust your pom and replace 1.19.3 with 1.20
I think I like alex's stuff
if you don'T use mojang mappings, you have to check whether "method b()" is still called "b()" or if it's "c()" meanwhile
If I don't use nms don't really need to remove the pom stuff for nms right?
so yeah - use mojang mappings
Like it won't matter
Will do
if you dont't use NMS, you can ignore the <filter> section for jefflib
But is it bad to keep it if I don't use it?
no
Alr perfect
well it'd make your .jar bigger
By how much we talking here
like 100kb
if you do not call JeffLib.enableNMS(), then it would never instantiate the NMSHandler anyway
😦
e.g. DayTime or StackResize
ChestSort?
they are paid but open source
ChestSort is a mess, it was my first plugin
look at StackResize
Oh really
Alright
Will do
Anything specific you want me to look at?
Maybe you proud of something specific 👀
nah lol
the most important feature of StackResize is actually in JeffLib
MaterialUtils.setMaxStackSize or sth
lol
Wait but stack resize has no gui implementation at all
Is the gui implementation on chestsort really that bad?
oh you wanted to look at GUI stuff?
the GUI implementation of chestsort is great
Alright so stackresize for jefflib
Same
Is that one really good?
imho it's pretty straightforward
Fantastic
but ChestSort's GUI is configurable and not so complicated, AngelChest is much more complicated but not yet configurable
I can also show you JukeboxPlus, that one is complicated AND configurable
1 sec
https://github.com/JEFF-Media-GbR/AngelChest here's angelchest
here's JukeboxPlus https://github.com/JEFF-Media-GbR/JukeBoxPlus
Thanks a lot I'll be looking at those for a few hours
np
AngelsChest is massive tho right?
Like compared to chestsort it has way more stuff going on
about 50k lines of java if you include jefflib, yeah
yes, death chest plugins are massive when done right
Alright gonna look at chestsort > angels > jukebox
Wait a second here alex
Your gui implementation feels like you make your own "framework"
Like
You have stuff ready to handle anything
That's so clean
I looked at triumph
I've heard of that, but never took a glance
wAIT NO
oh
Wrong one, cirrus
never heard of that
however I tend to only use libraries made by people that I know
I was actually thinking about using that
But you sugested to not use a lib
So I'm in limbo zone now
e.g. ACF by aikar, I use all the time (command framework, not for GUIs). I would never use any "random" GUI framework, because it might be dead in 2 years
I myself use phoenix616's inventory lib
which is funny since I also have a ton of libraries that others use lol
kk 1 sec
https://github.com/Phoenix616/InventoryGui that is it
that IntelliJ plugin is fancy
however it's quite useless if you wanna make the GUI configurable
Screw confug
admins hate you if the GUI is not configurable
Wait no
That thing is configurable
It's just a preview of the config file
Just like you use in yours
I never got an issue with people complaining about configurability
Like, the preview is of the configuration file
Probably a premium plugin issue I'd guess
yeah geol
Those need to be bulky
Wait alex you gotta admin it don't look that bad
tbh it looks a bit complicated to me
Ah I see
Well I guess that's the reason I stopped working on anything that involves design work.
I mean we're talking 2 different things here tho no?
it looks good but I wouldn't have any benefits in switching to it
there's a gui players should be allowed to change "values " from but not change the actual config of the gui
And then there's customizable gui
Wait alex this might be noob question but
You don't actually export your gui config file with your resource right
I mean you export it, but not for the user to edit it
but yeah , as said, cirrus looks really promising, but I don't see any reason to use it right now. Maybe for my next plugin, but I wouldnt bother changing all my current code just to use it
I did the same for ACF. My "old" plugins like AngelChest, D2I, ChestSort, etc all use only bukkit's command handlers
for newer plugins like StackResize, I switched to ACF
but I'd never think about rewriting my old code just to use ACF
Nah don't think it would ever be worth it
I just always think "if it works, don't change it"
in chestsort?
sure
it could have been included as resource instead of saving that file, sure
If you didn't care about it being editable. would you still use the gui.yml method
or would you hardcode the stuff
hardcoding is always a bad idea
So you would still generate the exact same with gui.yml as a resource
AngelChest 10 is soon to be released which will use a similar system as ChestSort currently does
Always hardcode everything change later when one random guy complains
same for D2i 5.0
Hmmm alrighty
although first I gotta release version 4
lol
Already thinking about 5
I'm gonna use cirrus and jefflib and see how it goes
D2I 4 adds per-player autosmelt, per-player auto-sell and per-player auto-condense
yeah cirrus looks good indeed
You really never saw it before?
tomisan you should pull request Cirrus to my Spigot Plugin Generator 😛
nope
lol
never seen it until 5 minutes ago
You want me to?
here you can PR it ^
you gotta change the pom.xml in maven-archetype-resources, the archetype-metadata.xml, and adjust the README file
the GUI then automatically knows about the changes
https://github.com/JEFF-Media-GbR/spigot-plugin-archetype/blob/master/src/main/resources/archetype-resources/pom.xml
https://github.com/JEFF-Media-GbR/spigot-plugin-archetype/blob/master/src/main/resources/META-INF/maven/archetype-metadata.xml
these are the files you gotta change to add it. And the README
i'm not really familiar with github besides thge basic stuff
We're talking about the pullrequest right
I haven't interacted much with other peoples resources
- fork the repo (just click on "fork")
- In IntelliJ, click on File -> New -> Project from Version Control (then enter your fork's URL)
- change stuff
- go to commit -> commit & push
- On GitHub, click on "Create Pull request" and fill it out
- Done
Ok I think I did it correctly @tender shard
yes looks good
Ummm I do wanna clarify that cirrus has framework for like all different things
please change the description in "archetypr-metadata" to sth like "Cirrus GUI library"
so people know its about GUIs
I only did 1 I was kinda confused
Hi mfalex, i have read what you have told me and i just understand what you were meaning
you can just do another commit, it automatically updates the pull request
Dont you first have to push it? And then yes its added to the PR
Alright that was my first time ever interacting with someone elses project
what's that "if" for in line 73?
Yeah so hear me out
I just noticed that you have the if on the other file
Let me remove
IntelliJ doesn't even let me write in that file with # correclty
yeah I know D:
intellij doesnt undetstanfd this format
it's called VTL (Velocity Templating Language)
thanks!
Thank you for teaching me!
I'll have a smoke, then test & merge it
Looks like the C-preprocessor slapped on XML to me
No IDE supports Maven correctly
well well well
It's very strange if you think about it
VTL:
# if($sth== "true")
<something>asd</something>
#end
PHP:
if($sth == "true") { ?>
<something>asd</something>
<?php } ?>
the one that takes blockData as arguments.
So alex all the way back to the start of this conversation
and can it be used asynchronously?
Your jefflib has the thing to be able to check the state of the server
why would you need that? the packets get queued anyway
Reminds me more of C than PHP
you just toss in a location and blockdata?
how do i use blockdata?
I'm asking the same thing about jefflib
yep, what's the problem with that?
I see the method is ServerUtils.ServerLifePhase
Ummm I don't even know how to ask this
example:
@Override
public void onEnable() {
if(ServerUtils.getLifePhase() == ServerUtils.ServerLifePhase.STARTUP) {
System.out.println("The server is starting rn");
} else if(ServerUtils.getLifePhase() == ServerUtils.ServerLifePhase.RUNNING) {
System.out.println("DO NOT USE /reload !!! IT BREAKS STUFF!!!");
}
But
I can't make it run stuff after startup has been called? Because onenable only called once right
Like I want to use the world gen on startup then wait until i'm allowed to create worlds and create the worlds
ok can somebody help me with this problem i am having right now?
Bukkit.getScheduler().runTaskAsynchronously(ChunkClaimsPlugin.getThisPlugin(), () -> {
try {
Player player = (Player) sender;
World playerWorld = player.getWorld();
Location playerLocation = player.getLocation();
int chunkCoordinateX = playerLocation.getBlockX() / 16;
int chunkCoordinateZ = playerLocation.getBlockZ() / 16;
Chunk playerChunk = playerWorld.getChunkAt(chunkCoordinateX, chunkCoordinateZ);
int highestBlockInChunk = getHighestBlockInChunk(playerChunk);
BlockData blockData = outlineBlock.createBlockData();
for (double i = 0; i < 16; i++) {
player.sendBlockChange(new Location(playerWorld, i, highestBlockInChunk, 0), blockData);
}
for (int i = 0; i < 16; i++) {
player.sendBlockChange(new Location(playerWorld, 0, highestBlockInChunk, i), blockData);
}
for (int i = 0; i < 16; i++) {
player.sendBlockChange(new Location(playerWorld, i, highestBlockInChunk, 15), blockData);
}
for (int i = 0; i < 16; i++) {
player.sendBlockChange(new Location(playerWorld, 15, highestBlockInChunk, i), blockData);
}
} catch (Exception e) {
ChunkClaimsPlugin.logInfo(e.getMessage());
}
});```
basically, just trying to create an outline of blocks in a chunk for a player to see.
Don’t getchunk async
can the rest work async?
i am iterating over the height map of the chunk so i am doing this async.
sendblockchange sure
Only the sendBlockChange part is safe to do async
No
okay.
is there a method to get a list of all PersistentDataContainers?
You can get all the keys sure.
?paste
I don't need the keys of a specefic location, I need a list of all blocks (in this case) containing persistentdata
unlikely
huh?
You can just iterate over all tile entities
I mean, you can get all tilentities
so in the code i pasted, i am trying to make an outline of blocks just above the highest block in a chunk
not actually replacing any blocks in the world or modifying any region files
but it does not seem to work
not even any errors in the console either!
says no one
Designing on the other hand, ewwwwwwwwwwwwwwwwwww
so blockpdc is really just a quick fix for bigger problems :/
Being autistic helps 😄

