#help-development
1 messages · Page 1195 of 1
What if I don't want to update for example
or if it doesn't auto update then what if I want to
the launcher was gonna be for minecraft events where players are usually not the smartest and usually only need to launch once
just a minimal thing
bat file:
or sh for unix systems
curl/wget the prism launcher and then run it's CLI
package me.carillon.foody.food;
import me.carillon.foody.ItemBuilder;
import me.carillon.foody.RecipeBuilder;
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.ShapedRecipe;
public class chicken_sandwich {
ItemStack item = new ItemBuilder(Material.BREAD, 1)
.setDisplayName("Chicken Sandwich")
.setCustomModelData(1)
.build();
ShapedRecipe recipe = new RecipeBuilder("chicken_sandwich", item)
.shape("B", "C", "B")
.setIngredient('B', Material.BREAD)
.setIngredient('C', Material.COOKED_CHICKEN)
.build();
}
this is what my class is looking like
ChickenSandwich pls
i was so confused until i looked at the code
No im placing an order
Lol
One ChickenSandwich please
So a food item stack you can set the nutrition right?
Cool
Now this won’t just work by itself will it?
Yeah you'll need to register that recipe
Can I register the recipe inside the recipe builder I made or in the class?
The build method shouldn't do that
It should only build the object
Same goes for the constructor of an object
It should ideally only create the object
Not register it anywhere
Add a register method to your ChickenSandwich class
Do I need to call this from my main class?
yes
What happens when I have like 20 of these?
Yeah having one class per item probably isn't the best idea
You can have one class called Items
And then register everything there
I just felt like having a really long file would be annoying to find a item if I want to edit something so I thought having multiple classes would be better
Ok maybe I’ll just do one class for all the items then
It's up to you 🤷♂️
if you're looking for a specific item you can always use ctrl + f to search
I have a strange problem. I am writing a plugin for an enchantment for a trident that will attract a victim to the attacking player when the trident hits the victim. I wrote to the mechanic, but ran into a big problem. The problem is that if the players are in survival mode, the enchantment does not work at all. For some reason, it does not attract at all. If both are creative, then it attracts very strongly. If one has creative, and one is survival, then it attracts as it should. But it should attract as it should if both are survival. I do not know what to do and what it depends on
@EventHandler
public void onHit(ProjectileHitEvent e) {
if (e.getEntity() instanceof Trident trident) {
if (e.getHitEntity() instanceof Player victim) {
Player shooter = (Player) trident.getShooter();
if (shooter != null) {
ItemStack item = shooter.getInventory().getItemInMainHand();
if (item.getEnchantments().containsKey(this)) {
double speedMultiplier = 6.0;
Vector direction = shooter.getLocation().toVector().subtract(victim.getLocation().toVector());
if (direction.length() != 0.0) {
Vector velocity = direction.normalize().multiply(speedMultiplier);
victim.setVelocity(velocity);
}
}
}
}
}
}
That’s true
You're checking what the player is holding in the hit event??
The trident will already be thrown if you hit something
@EventHandler
public void onHit(ProjectileHitEvent e) {
if (e.getEntity() instanceof Trident trident) {
if (e.getHitEntity() instanceof Player victim) {
Player shooter = (Player) trident.getShooter();
if (shooter != null) {
if (trident.getEnchantments().containsKey(this)) {
double speedMultiplier = 6.0;
Vector direction = shooter.getLocation().toVector().subtract(victim.getLocation().toVector());
if (direction.length() != 0.0) {
Vector velocity = direction.normalize().multiply(speedMultiplier);
victim.setVelocity(velocity);
}
}
}
}
}
}
this one?
Use codeblock pls 😭😭
?paste even better
?paste
I tried all possible options, it didn't help
I don't know what to do here
if the attacker is in creative, and the victim is in survival, then it works fine. and the delay also works
but if both are in survival, then it doesn't work at all
it doesn't get called, as if velocity is a vector of involuntary movement
It works in creative because they are in flight maybe
And when he is standing on the ground, velocity doesn't work
I don't remember exactly how to do this, but try to make a delay of 1 tick of this code
new BukkitRunnable {
public void run() {
//code
}
}.runTaskLater(Plugin.instance, 1L)
but this also dont work @EventHandler
public void onHit(ProjectileHitEvent e) {
if (e.getEntity() instanceof Trident trident) {
if (e.getHitEntity() instanceof Player victim) {
Player shooter = (Player) trident.getShooter();
if (shooter != null) {
ItemStack item = shooter.getInventory().getItemInMainHand();
if (item.getEnchantments().containsKey(this)) {
double speedMultiplier = 6.0;
Vector direction = shooter.getLocation().toVector().subtract(victim.getLocation().toVector());
if (direction.length() != 0.0) {
new BukkitRunnable() {
@Override
public void run() {
Vector velocity = direction.normalize().multiply(speedMultiplier);
victim.setVelocity(velocity);
}
}.runTaskLater(Plugin.getInstance(), 1L);
}
}
}
}
}
}
this right? I tried to understand you and correct you. Did I correct you?
?tas
dont work..
Yeah I know
Have you tried debugging any values
It won't compile
what does def stand for
default
default is just a keyword, so you can't use it as a variable name
You'll often see either def or defaultValue
oh yeah
yeah and class is clazz lol
Correct
or klass
That's cursed
klass is typically used for KClass
I guess it would be kursed
it's used in a lot of places, including the kotlin stdlib, compiler, KGP and FIR
I'm pretty sure I've seen klass a couple of time in the Java std
damn
I've not looked at JVM impls >:(
Maybe it was that I was looking at
Don't remember it's been a while
Appears to be used in swing as well
oh well doesn't look consistent 🤷♂️
I have a strange problem. I am writing a plugin for an enchantment for a trident that will attract a victim to the attacking player when the trident hits the victim. I wrote to the mechanic, but ran into a big problem. The problem is that if the players are in survival mode, the enchantment does not work at all. For some reason, it does not attract at all. If both are creative, then it attracts very strongly. If one has creative, and one is survival, then it attracts as it should. But it should attract as it should if both are survival. I do not know what to do and what it depends on
@EventHandler
public void onHit(ProjectileHitEvent e) {
if (e.getEntity() instanceof Trident trident) {
if (e.getHitEntity() instanceof Player victim) {
Player shooter = (Player) trident.getShooter();
if (shooter != null) {
ItemStack item = shooter.getInventory().getItemInMainHand();
if (item.getEnchantments().containsKey(this)) {
double speedMultiplier = 6.0;
Vector direction = shooter.getLocation().toVector().subtract(victim.getLocation().toVector());
if (direction.length() != 0.0) {
Vector velocity = direction.normalize().multiply(speedMultiplier);
victim.setVelocity(velocity);
}
}
}
}
}
}
I tried all possible options, it didn't help
I don't know what to do here
if the attacker is in creative, and the victim is in survival, then it works fine. and the delay also works
but if both are in survival, then it doesn't work at all
it doesn't get called, as if velocity is a vector of involuntary movement
It works in creative because they are in flight maybe
And when he is standing on the ground, velocity doesn't work
I don't remember exactly how to do this, but try to make a delay of 1 tick of this code
new BukkitRunnable {
public void run() {
//code
}
}.runTaskLater(Plugin.instance, 1L)
but this also dont work @EventHandler
public void onHit(ProjectileHitEvent e) {
if (e.getEntity() instanceof Trident trident) {
if (e.getHitEntity() instanceof Player victim) {
Player shooter = (Player) trident.getShooter();
if (shooter != null) {
ItemStack item = shooter.getInventory().getItemInMainHand();
if (item.getEnchantments().containsKey(this)) {
double speedMultiplier = 6.0;
Vector direction = shooter.getLocation().toVector().subtract(victim.getLocation().toVector());
if (direction.length() != 0.0) {
new BukkitRunnable() {
@Override
public void run() {
Vector velocity = direction.normalize().multiply(speedMultiplier);
victim.setVelocity(velocity);
}
}.runTaskLater(Plugin.getInstance(), 1L);
}
}
}
}
}
}
Stop pasting the same thing over and over again
why?
I've already told you what the problem is
And you're just flooding the chat for no reason

yes
its doesnt matter
did you know that when you throw a trident in survival mode, it leaves your inventory
yes
fun fact someone can't be holding a trident if they don't have it
wait really?!?
So why are you checking for it after it's left the inventory
and telling me that it doesn't matter
fuck
sorry man
wait a secnd
okey i have problem
how i can check enchantment on trident
You need to check the item not the entity
can somebody help me compile clan mod into jar?
mod is jar file
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
I have opened and seen the source code
dont blame me, I am a begineer to java and spigot
There is no source code in the zip
The zip contains two versions of the plugin jar as well as instructions on what to use
can block.getLocation() return location with pitch or yaw != 0?
yo guys how do old servers like hypixel n stuff make custom items since PDC didnt exist?
Not that I know of
coldd thanks
can someone help me? i want to add optional nbt item sytax but when i try to add the optional nbt on the item the code is not running.
but im remember if my old code is just working when i add optional nbt but when i see my old code on GitHub just the same i use now.
https://github.com/Phanisment/Item-Caster/blob/main/src/main/java/phanisment/itemcaster/skills/SkillActivator.java
yeah, I've been desperate for more than 4 weeks to fix this 🗿
Your cooldown tag is inside same " of your activator tag
Artifact:[{skill:"Noxious_Poison_Slash", activator: "left_click, cooldown: 10"}]
See the problem?
wait.. i need to check my video
ah, i see
wait
so, what I've been trying to fix this whole week 🗿
You should probably make a command for getting test items
How would I give a player effects when having a specific armor equipped?
Recommend using this ^^
I'd need it to work between servers so there is not always an equip event. The player could join with the armor already equipped
Yeah, Maybe i will make that. but Thanks for helping me!
Join event
Then you'd listen for join and quit
If you really don't want to check the armor every couple of ticks
yeah, ill try that, dont wont massive lags
is there any way to get the block to what is wall sign attached to?
Wouldn’t you wanna use the equip event and join event?
Yeah, I did
Ok nw
https://github.com/ds58/Panilla
how can i compile this? i dont know much about gradlew
Probably need to run BuildTools for each version that it supports.
^ you do
Why the duck do they depend on craftbukkit not spigot
Ur gonna need the --compile CRAFTBUKKIT flag too
Not necessarily
That flag just copies the craftbukkit jar from the work directory.
It already gets installed into the .m2 folder.
It actually still does, but doesn't copy the final jar to the parent dir.
?stash
Also, it looks like that project uses a bunch of NMS, so it's somewhat understandable why they are depending on craftbukkit. (Since it goes all the way back to 1.8)
If compile craftbukkit flag isn't set it doesn't run them
I found it out a few weeks ago because that's how spigot bt was faster than mine
@late sonnet are you the same from this ticket: https://hub.spigotmc.org/jira/browse/SPIGOT-7967
Yeah 
I have once again failed to build that PR
Hey llmdl
new phone who dis 🙂
can you believe I've gone this whole time without joining this discord
Idk how you survive without being in spigot
I just dont use discord for anything outside of Towny so its not too much trouble
also its a good idea to just read the docs
It's full of really great people that you really want to talk to
Elgarl is here sometimes as well
Same error or what?
I'm always here 😉
Speak of the devil
yeah same error @late sonnet
If you can just sling me a jar I'd appreciate it @late sonnet, I don't really know how the allow_greifing rule factors into the issue. I was just hoping for teh proper event to be thrown so that the act of opening doors isn't invisible to protection plugins.
What's townys plan for the hard fork, been as it's such a largely used plugin
I dunno man
Are two different things.. for your ticket the issue is how vanilla just not pass any damager then the explode happen in the BlockExplodeEvent
The gamerule was the original thing for what i make ghe PR for improvements two years ago
that hard fork news right before Christmas, not something I can deal with right now
Fair
A strange day for make mucho work xd
Make warrior deal with it 
my kids have a week of school left, I have a week of IRL work left, got teh in-laws coming next weekend
have to patch a hole I put into my wall while wiring a tablet onto the wall for a home-centric panel
I think the real question is how will Spigot and its developers deal with the hard fork
I'm guessing a load of plugin devs will probably move over once breaking changes start
I had to add paper-api to the towny pom recently and it showed me all the things that Towny uses which is considered deprecated in Towny. About 233 instances. Mostly ChatColor, but also other things which are Strings in Towny but Components in Paper.
We already have some Nice Things™️ that Warrior added giving us Bukkit/Paper/Folia centric things.
Does towny use adventure/minimessage yet? Might be something to look into to give admins more customisability
We do but we currently shade it into Towny
some of the addons rely on Towny's shaded-in version.
In that way we can do spigot and paper and not require admins to get Adventure in some other way
Towny is only developing against 1.19+ now
Oh could def library it in future
yeah idc
While I'm here I should probably proselytize you all about Vault Unlocked https://github.com/TheNewEconomy/VaultUnlocked
and an example plugin https://github.com/LlmDl/iConomyUnlocked
If you have an economy plugin that isn't built against VaultUnlocked you really need to consider it.
I saw that the other week, is it compatible with old vault or does it have breaking stuff
it has teh old vault in it
its just a fork Epic so it should work
I'd imagine they'd avoid breaks to create better adoption rate
So you can do both and it doesn't matter which plugin is asking about vault or vault2
Sounds cool
Vault plugin will talk to you using the vault package, vault2 plugin will talk to you using the vault2 package, you respond to both with your one back end
It is mainly the PRs I never got accepted into VaultAPI, with some other Nice Things™️
Need to convince essx to move to it so more people know about it
They ask you to make changes but never merge
Yes and no I'd say
Pretty dead imo
It's not dead in doesn't work but it doesn't get anything new
|Dead but never really needs any update
I had a pretty good case for an update
I remember I did too, but the PR was refused
Anyways now we have VaultUnlocked and if you're not using it, you should.
I think the last pr merge was choco making the readme not say to use mojank logger
I had some things merged into Vault and VaultAPI semi recently but it was mostly dropping the old abandoned plugin jars from it
But as for making significant changes that need to happen for everyone's sake, not so much
Imagine if that 1.14 bukkit dep was removed
all our IDEs crying out in relief
if it aint broke, dont fix it
it was broken and now its fixed
epic nesting
.
```
code
```
?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() {
}
}```
@blazing ocean can we send the thing
That git commit I don’t have handy
I mean @naive spire made that pr lmao
Kek
look at that huh
Really can’t believe you haven’t been here
The amount of times we’ve had to crack down on people and their crazy nesting behavior
@naive spire ok im in PC now xd
not sure if you can add me.. but check the issue in buildtools looks like a strange java instalation because i run the command with not issues using the JDK provided by microsoft and added to the PATH
why have you sent this twice with no explanation as to whats not working
ok WHAT doesnt work
unfortunately telepathy does not exist in this world
?notworking
"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.
one of us will have to let our guard down and accept a FR
idgi am I and/or Towny a common topic on here something
Hmm i need remember how turn that off xd
glad to see you are still kicking. Haven't seen you in quite a while lol
I opened mine up, send me one
where was this?
Anyone have the 1.17 spigot jar file? in the bukkit website doesn't let me download it
?bt
Where was the last time I seen you? Well would have been here naturally, and then before here would most likely have been when I was still bukkit dev staff
I don't think I've ever been in here
Shows like not
try again
I am pretty sure you have because I distinctly remember talking about towny lol. Who knows I could be wrong XD . Either way nice to see you are still around regardless 🙂
I think the only time I interact with spigot is when I find a stupid bug in the API that is never any fun to fix.
Indeed, believe that was the reason you were here a couple years ago lol
I would be considered a bad omen in the olden days
lol
and I assume you encountered a problem?
well I assume you wouldn't be here otherwise 😉
Thanks for letting us know
you're welcome
You are no longer trying to compile a plugin. I am up to date.
someone can help me in vc?
ok
?img or for pictures
Can't send images? That's because you're not verified! Use !verify to complete verification.
Alternatively, you can upload screenshots to any image hosting site and share the link.
Here's some screenshot utilities that you can use to upload images.
Lightshot: https://prnt.sc
Imgur: https://imgur.com/upload
Flameshot: https://flameshot.org
my VC rates are pretty high do you have a budget
wrong java version for the compiled class
holy, what java are you on? Future version
java.lang.IllegalArgumentException: Unsupported class file major version 25888
brother is on java 2099
I've achieved that before
java levels over 9000?
what are you compiling in maven or gradle?
so not a plugin then
oh
to get the major version that high, means the class file was manipulated either by something like lombok or some other thing. Findbugs I think does the same thing if its outdated or fails scanning.
yeah I kinda fucked up with asm
Seeing as the name of the plugin is MySiteAuthPlugin, I'm going to assume you are doing some asm manipulation
I think enabling preview java features can also give weird versions
basically your ASM is blowing up and creating a bad class
um
Its also paper so this is not really the right place to ask. Test against Spigot and let us know if the error persists
i am downloading intellij
pretty sure it will. But maybe changing IDE's might help as well since we know something is modifying the classes lol
Hey! I'm working on a minigame network. I just setup my BungeeCord proxy and a singular "Lobby" subserver in Spigot 1.8. While in 1.8, logging to the proxy in-game causes this error being spammed in the Lobby: https://paste.md-5.net/luxowiqeji.sql
This doesn't happen in new versions (1.13+) but I really need the servers to use 1.8. How can I fix it?
I have the latest BungeeCord version btw
There a way to tell if your server is running from code? I'm bundling a configuration tool/custom documentation generator into this library that lets the .jar file be run as a standard application (in addition to serving as a plugin), but obviously you won't be able to get Plugin objects that way if you're not running this through a server (would have to get the actual plugin .jar instead)
I suppose Bukkit.getServer() would be null and my IDE is just wrong lmao
You would get compile error, because spigot classes would not be present at runtime
Runtime error*
Why not distribute 2 jars
And make a multimodule project, where common module would have most of the logic
true, now that you mention it
just seemed like a pain tbh LMAO
I've noticed people tend not to download anything more than they absolutely have to
oh well, I can do the documentation generation from within the plugin anyway by just letting someone run a command
Whats the best way to create a lot of items for a GUI? I'm thinking about creating a class to make one (regular way is pretty verbose), and then having a static class to access them? That feels wrong on many levels though. Was just wondering if there's a better way, or perhaps a more accepted way of making a ton of different item stacks?
You need to run your server with Java 8 or find a maintained fork
what, like items that people will mouse over to click on/view information?
yes
you'll need to store the information for those items somewhere
It works thanks
you could do it through config if you'd rather avoid doing it in code, which would also make it easier to tweak and customize on the fly (this is why a lot of modern GUI APIs use some form of markup language, like XAML or FXML)
I'm using InventoryFramework atm
yeah I know nothing about that, sorry, I only use my own library tbh
bad habit from being a C++ developer
lol
oh IF actually looks good at a glance
i'd use this
oops, wrong link
he's got documentation for creating GUIs with XML on the wiki
Ah I see. Thanks. I'll use it if possible. I'm working with customModelData as well so I don't know if it'll be compatible
you might be able to hybridize them, not sure
Maybe you can create a custom widget with this framework and use that to display the model data or something
(I don't know much about that, haven't really done spigot for a while and getting back into it lmao)
certified classic unity moment, can you spot the problem?
i like the part where i followed the instructions below
yeah me too
sup guys, design question: i have an api, engine and bukkit module. the api module defines a BlockInformation interface, which is used in filters which are passed to the engine. for good bukkit related filtering, the BlockInformation has to contain informations like Material and BlockState, which cant be initially given by the interface, since neither the api nor the engine know what bukkit is. i could just go by inheritance and make a BukkitBlockInformation in the bukkit module, but the user of the lib would have to downcast (ugly approach). another would be, that the BlockInformation has properties stored in a map <String, Object>. my last approach would be to have a delegate. does anyone have any other, better, ideas?
Hello, could anyone help me and tell me how the Exact Choice in Recipe Choice class would be constructed if I wanted to do it custom? Just written out in this format: https://imgur.com/a/iTFnwhE . I know its written on https://hub.spigotmc.org/javadocs/spigot/org/bukkit/inventory/RecipeChoice.ExactChoice.html but I dont get it (I am new to programming). All I need is the Exact Choice written in that format
RecipeChoice choice = new RecipeChoice.ExactChoice(ItemStack)
Hmm, I dont think this is what I am looking for. I need to create a new custom RecipeChoice that is the same as ExactChoice but it would also check the amount of each ingredient. (if a recipe requires 5 diamonds to be put in one slot) For that I assumed I need to "copy" the inside of the ExactChoice and modify it. I chose the ExactChoice because I need to check if the NBT of the input item is the same as the ingredient
So is there a way to check if the NBT and amount is correct without using event listeners?
No
Damn, well its time to rewrite the plugin ⚰️
ItemMeta meta = item.getItemMeta();
FoodComponent food = meta.getFood();
food.setNutrition(nutrition);
meta.setFood(food);
item.setItemMeta(meta);
is this how you set the amount of hungry bars that is replenished by food?
I think you need a meta.setFood
i have that there
have you already tried if it works?
yeah and it seems to just be the same as it was "bread"
how much nutrition did you give it?
10
hmm
what is the range on this?
idk
i was assuming 1 - 10
Yeah that looks right
ok it seems to be working 👍
i was initially working under the assumption that it was a range of 0 - 10
thank you guys for your help
Has anything changed between 1.21.1 and 1.21.3 in terms of totems?
Not sure whats changed, but we have an event in our plugin EntityResurrectEvent, and it works perfectly fine on 1.21.1, but fails to work on 1.21.3
Show code
public class EntityResurrectListener implements Listener {
private final LifeStealZ plugin;
public EntityResurrectListener(LifeStealZ plugin) {
this.plugin = plugin;
}
@EventHandler
public void onEntityRessurect(EntityResurrectEvent event) {
if (!(event.getEntity() instanceof Player)) return;
Player player = (Player) event.getEntity();
if (!WhitelistManager.isWorldWhitelisted(player)) return;
if (plugin.getConfig().getBoolean("preventTotems")) event.setCancelled(true);
}
}
Have you done any debugging?
var configuration = new Configuration(new BootstrapServiceRegistryBuilder().applyClassLoader(this.getClass().getClassLoader())()).setProperties(properties);
What do I use to get the length of a piston in BlockPistonExtendEvent#getLength if it's deprecated?
i might love you for the rest of my life
let me guess, librarying hibernate?
yeah
Also the non-deprecated method getBlocks literally uses the deprecated getLength method..
like i searched on stackoverflow for like an hour
asked chatgpt too that mf costs me 20$ a month and cant even help
Yes. the entity ressurent literally isn't invoked on 1.21.3
Are you sure you registered your event?
Put some print statements in there to see what is happening.
Also make sure you are holding the totem when testing.
No dude, it's the same code. on 1.21.1 it works.
and why is BlockPistonRetractEventgetRetractLocation deprecated since 1.8 without any reason as to why, and yet the same rules that the method does still apply in 1.21.4
Have you tried on 1.21.4?
Because in the past a sticky piston could only retract one block, the one directly attached to it
but muh slime blocks
Now it can retract multiple with slime blocks, so it doesn’t really make sense to have a single retract position
so then how do I do get the retract location(s)
since no length is provided (would probably be deprecated too and used by non-deprecated method lmfao)
Loop through all the blocks and offset them by the direction
so basically like the extend does with using the deprecated method?
declaration: package: org.bukkit.event.block, class: BlockPistonRetractEvent
so I got code here and idk what it does and if it should be ported to the same event
What
https://pastes.dev/MO6dPRgOKs so basically I am making a claim system and I need to detect when a block is trying to get pushed out/in into/of a claimed chunk
For each block in the list
The starting position is its current position
The ending position will be block.getRelative(event.getDirection)
but what about slime blocks, there is no length provided by one event
why is this if statement firing everything in the if and the else?
Event fires once for each hand
ooh
but he has a check for action type
right click
its firing twice so check if you are registering the listener twice
if not, print the event, send that

have 1.21.4 server in my plugin, anyone know what this method was replaced with? Method moveTo = navigation.getClass().getMethod("a", double.class, double.class, double.class);"
so i messed with nms, and i now understand i am not ready for nms lol
?mappings
Compare different mappings with this website: https://mappings.dev/
Also it'd probably be easier if you didn't use reflection
You gotta start at some point
whats the material for a bottle of water
its uh potion isnt it?
ahhh
bottle of water
Proof?
plus, they asked for the "Material"
"bottle of water" isn't an Enum
You need to convert the itemstack or whatever, to a potion, then apply PotionType.WATER
declaration: package: org.bukkit.potion, enum: PotionType
You'll find WATER here on the list
That's again not a Material.
Yes. And did they ask for NBT?
Then water is potion type
Okay so you're repeating what I said?
yes
@ebon topaz. By default, I think Potion might fall back to "Bottle of Water" anyways, but it might also be that weird potion called "Uncraftable Potion". Try just:
ItemStack waterBottle = new ItemStack(Material.POTION);
if it works, otherwise you can implicitly set it to be water:
ItemStack potion = new ItemStack(Material.POTION);
PotionMeta potionMeta = (PotionMeta) potion.getItemMeta();
// may want to ensure its not null before this, i dont see why but yeah
potionMeta.setBasePotionData(new PotionData(PotionType.WATER, false, true))
potion.setItemMeta(potionMeta);
thank you
um so question can i turn a itemstack ive made into a material so i can use it in crafting recipes
use ExactChoice to input ItemStacks instead
this isn't how you set the potion data anymore
var potion = new ItemStack(Material.POTION);
var meta = (PotionMeta) potion.getItemMeta();
meta.setBasePotionType(PotionType.WATER);
potion.setItemMeta(meta);
should do
Thank you. I haven’t worked with potions since I made a 1.8 plugin
hi, does anyone know how to solve this problem?
repositories {
mavenCentral()
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
}
dependencies {
compileOnly("net.md-5:bungeecord-api:1.21-R0.1-SNAPSHOT")
}```
Try adding brigaider?
add spigot's repo maybe
oh yeah kek
tbf the bungeecord maven wiki doesn't mention it so it should just work but eh
apparently you need the mojang repo for that one, so add https://libraries.minecraft.net
thanks a lot
Its very outdated
what are some things in spigot that could be implemented using Graphs?
i was trying to play around with faction alliances but then i realized you could just do that with sets
Graphs being?
ah, thought you meant some specific technology since you capitalized it lol
nahh
anything that deals with b-trees is a graph
most common thing would probably be regions, or at least that's how WG does it
Oh I thought it used octrees
faction alliances are also just a type of graph. If you think about it, most things can be interpreted as a graph
you might be right, I haven't slept and it is 8 in the morning lol
:’)
hm im trying to use some other data structures in my plugin but nothign is really needed
Are you referring to a symmetrical binary relation?
I was also wondering how are faction alliances even defined
^^
first naive approach is just when two factions make an alliance, each one of them keeps a set of allied factions assuming each faction has a unique ID
and honestly idk that might be all that's needed
just check against it if faction allied, give like extra HP boost or something
it’s awkward when you need to update the relationship between any two factions, that is if both store such data about the relationship
I mean, the issue with that is that most things at the scale plugins handle can be done with very basic data structures, if you want to learn these data structures you are probably better off just doing some general excercises in leetcode or similar platforms
yea that's wut ive been doing anyways for recruiting and all
leetcode is the grind ;-;
i meann i do think maybe something related to distances between allied faction capitals coud be modeled using graphs if you want to do some fun stuff depending on how far each is
so you are just looking for ways to use them in practice, that's a good thing
leetcode excercises only get you half-way to understanding, applying it into real problems is where one gains comprehesion
that said, graph as a concept is rather broad so anything goes really lol
yea
i dunno
plugin development delves more into concurrency and data management which are important too
the whole single threaded thing
it isn't so much of a way to define data but to visualize it, then there's more specific data structures that handle the implementation part
Tbf, most applications more heavily apply concurrency one or another way, plugin dev is relatively concurrency-free
But yea there’s a lot of data management, but most devs I see just stick with super basic non-normalized schemas
like wut
ive just been using sqlite all this time and it has served me well for this project but might look into trying other databases in the future
is there anywhere a priorityqueue could find use
a lot
lowkey the most useful implementation of graphs in minecraft i can think of is just intuitively, distance related operations
I mean, its when you wanna scale where you choose a better option
true true
Data optimizations is more or less graphed through the use of group and category theory
Like you can see it in a graphing perspective
ic ic
how hard would it be to make custom crops?
Depends on what you want them to do
doesnt have to be exactly this but for example,
rice can only be planted in 1 high water and grows like wheat maybe?
I would add somr crop conditions that are checked when the player olaces them and for growing you can just tick them every tick and have a rng decide if it grows or not
ok so should be too hard to make some custom textures and do some checks to make it place in one block high of water and grow it in plugin every tick with a rng to decide if it grows
whats the rng like for the vanilla crops?
just check what something like this does: https://www.spigotmc.org/resources/farmcraft-1-21-fully-custom-crops.50031/
it's open source
well not the most pretty code base I've seen but it seems to do what it is supposed to do lol
ok im going crazy
how would you implement event handling in a Entity Component system
Bukkit api seems to do much circular referencing in such cases by pointing Player reference to an event
which is not really optimal
idgi
what does that mean
basically you have Entity as a class and every functionality is splitted of into separate parts called Components
something like minecraft does
Entity has bunch of components
"I don't get it"
ah
I mean if you wanted to make an ecs you should be building off of nms not bukkit
Are you asking how to write an event system if you have an ECS?
Yeah. You would ideally start from the ground up lol
Bukkit (and really, vanilla) is hierarchical, so ECS just doesn't work
if i want to pass Entity to an event, i have to do circular reference or pass entity id
nothing is ideal
so how tf can i pass update event for a component but reference entity
without risking of circular reference
What circular reference are you concerned with? I don't understand
you could pass the id and a method to get the entity based off the id if i understand correctly?
you can do that
but you can also pass shadow reference to the event i guess
lets say i have entity component A, i need to dispatch an event when component A changes, but also I need to pass down the entity to that event which has the component. I can do that by dispatching event from component A, but then I need reference to Entity. Due to how you get the component A from Entity, if you pass Entity to the component A, you will get circular reference
the component itself is immutable and doesn't change itself tho no?
Entity -> State Component (Stateful data about trait related things for entity) -> Trait Component (Stateless data)
I mean is there any reason you need an event on property sets
That's just asking for trouble especially if you call state changes
every event happens on property modification if you think about it
is this Ike's secret alt
they're the only ones I've seen trying to integrate an ECS into minecraft's codebase lol
maybe mental delusions of ECS just spread to fast
I mean this is specifically regarding a specific state change though, and exposes to an event the same state change the idea in of itself is cyclical
Listen to a state change to change state to listen to the state change
i can move State Component into entity, but then i lose the ability to hold State data for particular trait outside of the entity
this still just smells like you are calling the event from the component being changed
which would be wrong anyway
^ cyclical in nature
Entity entity = ...
EntityDamageableState state = entity.getState(Damageable.class)
state.setHealth(150); // set the 150 of entity's damageable state and fire EntityHealthStateChangedEvent
state.getTrait().getMaximumHealth(); // 1000
smth like this
mutable components in ECS 
traits are not mutable, states are
Yea but I mean
in this case, you'd call EntityHealthStateChangedEvent before the state.setHealth call
i don't see the problem
Yeah but if he sets the health in there shit explodes as I said cyclical in nature 
that's the problem if i would call this in setHealth call, i would need a reference of Entity in EntityDamageableState to be passed to the constructed event
Good time of day. Tell me how to get a sign when inserting a schematic.
In more detail, I insert a schematic at the command, there is a sign in this schematic (within its limits).
My task is to scan the entire schematic (each block) to get a plate and work with it. I tried to implement this in several ways:
1)
private void processSchematicBlocks(Location loc, Vector3 min, Vector3 max, World world) {
for (int y = max.getBlockY(); y >= min.getBlockY(); y--) {
for (int x = min.getBlockX(); x <= max.getBlockX(); x++) {
for (int z = min.getBlockZ(); z <= max.getBlockZ(); z++) {
Block currentBlock = world.getBlockAt(x, y, z);
if(currentBlock.getType() == Material.OAK_SIGN) {
plugin.getLogger().info("test");
}
private void processSchematicBlocks(Location loc, Vector3 min, Vector3 max, World world) {
for (int y = max.getBlockY(); y >= min.getBlockY(); y--) {
for (int x = min.getBlockX(); x <= max.getBlockX(); x++) {
for (int z = min.getBlockZ(); z <= max.getBlockZ(); z++) {
Block currentBlock = world.getBlockAt(x, y, z);
if(currentBlock.getState() instanceof Sign) {
plugin.getLogger().info("test");
}
Nothing worked, the conditions do not work, because there is no output to the console. And I need to work with the lines on the plate. Please help me)
why do it in the setHealth function
why would state be responsible for calling events about itself changing
just do it out here
2 ways to avoid this
- Do not create code that is naturally cyclical
- Some jank ass booleans
like where is that code located
Personally 1 seems ideal but hey booleans could cut it
wdym, do you mean in setState() method?
@river oracle nerd
Nerd
God damnit my phone
I guess, if this code is in the setState method..
hello kat
like where is that code
Oh hi rad
oh, you meant outside, yeah, i wanted to have single source of truth for events so that's the lowest i could call the event for
may you help me?
do you have to scan every block
signs are tiles, so you could just get all the tiles in the chunk
or if the schematic plugin you're using allows for it, do it from the schematic itself as it should save that information
yeah ig that would be in your manager or whatever you called it
I have just started developing plugins, and so far I do not know any other ways to search for plates in schematics
Do you know java at least a little bit?
It’s gonna be quite hard to make a plugin with minimal java experience
If only a little...
We have a bunch of helpful links, do you want them?
I have a partner, he knows Java better than me, but I contacted him, he did not give me any other information on the method of searching the table in the schematic
Honestly, I won't refuse
Go to #bot-commands and type ?learnjava
well as said, you have two options. Either use the schematic pasting plugin's API (I assume you're using WE for it) and get the tile entities from the schematic, or after pasting, scan the tile entities in the chunk(s) with Chunk#getTileEntities
World's least hostile learn java reccomendation
though this said, is there any reason you can't just edit the schematic itself? Is the sign text dynamic?
But uh I feel like you’re probably working with world edit or something similar which in all honesty doesn’t have great docs also, to try and figure out the spigot api as well as the schem plugins api is just gonna be a huge pain for you
Sorry for the incorrect words, I'm from Russia and I use Google translator
Okay, thanks for the advice, I'll try
Kek I’m feeling nice today
tbh now that I think bout it, you're probably better off just recording where in the schematic the signs should be placed and well, place them after the fact
either way should work, use what sounds the easiest to you
We can give you the logic behind the implementation but you still have to actually implement it which I don’t think you’ll have an awesome time with, however it’s a good learning experience to try and figure stuff out yourself. That being said id still go through some of those java links
I can't edit the schematic, I have a set of schematics that are inserted into the world. Each schematic has a plate with an entity type that will spawn in place of the plate.
I can't write down every coordinate of the plate relative to the schematic, I have 90 of them.
Which plugin are you using that handles schematics?
World edit?
FastAsyncWorldEdit is installed on the server, but the code works through WE
https://worldedit.enginehub.org/en/latest/api/index.html
This is we’s docs, if they work awesome, otherwise search up fawe docs
FAWE is WE API compatible so that shouldn't be an issue
Honestly didn’t think so but wasn’t sure
worked with it before, the docs are a bit, weird explained
Yeah we docs are not great
and very little, but it covers the basics
I have already looked at the documentation, but I could not find the method I needed to search for a specific block within the schematic. And the question is in optimization, considering that I recently began to delve into this topic with the development of plugins, for me now this is one of the priority tasks
You could also join their discord and ask there
Do they have their own Discord? I didn't know, I'll try asking now, thanks
Thank you
Sure!
If I had to guess they’d probably know better than most people here, still we are here to help if you need it
man you just opened my eyes, maybe really this is not the place where you should call events. Maybe you're right, you should call events from outside. These are just too small instances to be called from
Model classes should not be riddled with events, algorithms around them should be
it wouldnt make sense to call Entity health changed from state class that i've mentioned because you could just construct your own state object outside of Entity and it would fire that event, even if the component is not directly hooked to the entity, unless you runtime checked that the entity has that particular state
its bad design
With an ECS you need to make the distinction between "components" and "systems"
Which you call algorithms
The "systems" are responsible for logic, "components" mostly hold data
Systems call the events and manipulate data
For example the "health system" is responsible for handling damage, regenerating health etc while the HealthComponent just tracks the entity's health and max health
well it sounded great to have events at low level changes, allowing to have single root source of event dispatch, but then i got stopped with such issues
they do know better, but they are also damn aggressive with their support lol
I provided an admittedly wrong solution, and wiz didn't like that at all
You’re not wrong lmao
Yeahhhh last time I went there for help they dogged on me for not using paper… almost as if the issue was just that (it wasn’t kek)
often the best way to understand why something is done in a certain way, is by doing it another way and finding out there is some flaw in that approach you initially didnt see
Attribute👍
what more info do you need
Attribute.
editSession.replaceBlocks(region, SingleBlockTypeMask(editSession, BlockTypes.OBSIDIAN), BlockTypes.AIR) is this not the way to replace all obsidian blocks with air in worldedit
looks right to me
did you commit?
it returns an int
and sure isn't doing anything
the region is correct
that was recording purple's stream audio lmao
did you close the edit session properly
that's what I meant by commiting
should i be creating a new one for each region I'm removing
because it is currently shared, probably not a good idea
I am unsure what's the best approach there, I'd imagine you would indeed do that
you could also just call EditSession#commit and see if you can keep using it lol
does WE do chunk batching by default on edit sessions or do you have to call EditSession#setBatchingChunks manually in case it's a big region
me asf:
suspend fun breakObsidianWall(teamIdx: Int) = withContext(GameServer.asyncDispatcher) {
val bound = instance.cachedMap.map.bound(OBSIDIAN_WALL_CARDINAL_NAMES[teamIdx]) ?: instance.exit(Reason.INVALID_MAP)
val region = bound.worldEditRegion()
instance.debugAnnouncer.announce(buildText("Min: ${region.minimumPoint} Max: ${region.maximumPoint}"))
val session = newEditSession()
session.replaceBlocks(region, SingleBlockTypeMask(session, BlockTypes.OBSIDIAN), BlockTypes.AIR)
Operations.complete(session.commit())
session.close()
}
seemed to work
can i use minimessage from adventure api in bungeecord?
i like these announcers
edit session is autocloseable, so you can .use on it
right
Use try with resources 🔫
true
right kotlin
closing automatically commits btw
having more colors than the default 16 ones in chat is still a foreign concept to me
it looks nice with pastel colors
the "the first combat phase" is coloured wrongly
that purple also resembles my favorite color, #c390d4
that's actually #d2b4fa
yeah, it looks blue-y
any nerds here know of an a* pathfinding impl in java or kotlin, not mc just standalone (would love if its mit so i can just steal it)
Can probably build off Pathetic not MIT though
The search part of it isn't too coupled to Spigot
Also what are you making 👀
the solution to todays aoc
🔫

Does it need to be MIT if you're just using it locally?
Or are you uploading to GitHub?
Is there an event for when an individual block explodes? BlockExplodeEvent triggers for a list of blocks, but I need to detect when a block itself explodes without cancelling all the explosions.
Context: Given that you have Chunk A B (next to eachother), B has explosions disabled, but A has them enabled. I want it so when you explode something in B it explodes the blocks in A but on B it does nothing.
yeah, tnt in this case
Respawn Anchors:
I saw that some other plugins are able to do it (I don't know their name though), but idk how it is done
EntityExplodeEvent
if I cancel that the entity doesn't explode at all
I need it to explode but only do damage in A if it was placed on the edge of A and B
remove teh blocks from getBlocks that you don;t want to explode
declaration: package: org.bukkit, enum: ExplosionResult
oh yo that's smart
oh there's no setter for it :c
Yeah clear getBlocks
the block list is modifiable for removal, not addition though
that's great, thanks!
do I need to make a copy of the block list since I am directly removing them in the loop for CME?
You can use removeIf
@EventHandler
public void onBlockExplode(BlockExplodeEvent event) {
event.blockList().removeIf(block -> {
ClaimData claim = this.controller.getClaim(block.getLocation());
return claim != null && !claim.isExplosionsEnabled();
});
}```
so like this
Yeah that should work
thanks 🙂
its on github
Ah okay
??? Wtf does that mean and how does that even work
You can remove Blocks from the returned list and they will not be destroyed, but you can't add new Blocks
Does it check whether any new blocks were added or what
And most importantly: why
Does anybody know why is it deprecated?
Should we just create maps every time it needs to be itinialized, until it reaches the limit
Magic Value
magic value means it could change any moment basically or the values are hard to predict
but like
its still usable
ok
Hey guys, so I’m really bad at math and equations…however, I’m trying to make these equations increase 1% for each job level. Is there anyone that could help me with it? The equations are listed below;
leveling-progression-equation: 10*(joblevel)+(jobleveljoblevel4)
income-progression-equation: baseincome+(baseincome*(joblevel-1)0.01)-((baseincome+(baseincome(joblevel-1)0.01)) ((numjobs-1)*0.05))
experience-progression-equation:
baseexperience-(baseexperience*((numjobs-1) *0.01))
is that some latex shit
experience + (levels * (experience * 0.01))
i think it's this?
wait
this should work no?
sure (I have no clue what you're talking about)
this should give you the experience for each level if it increases by 1%
if level is 0 there is no extra experience given
yup, i'm pretty confident it's like this
Okay, I’ll test it when I’m home. Thank you!
alright, good luck 😄
1% is very little tho
you might wanna increase it
but it also depends on the base experience
Well I’m making experience and income increase by 1% too.
you'll figure out all the variables 😄
i suggest to keep experience static(not changing) and play with the percentage
I have the Minecraft Development plugin installed in my Intellij project, and I have the newest version of corretto-21 installed, but it doesn't know Spigot API. What could the possible issues be?
Make sure Intellij is up to date
it seems to be up to date
How did you import Spigot to your project?
I dont know, I did it a while ago
it works fine on my PC, im on my laptop right now and having the issue. I thought simply installing the Minecraft Development plugin was all I needed to do
The Minecraft Development Plugin is entierly optional
hmm
what does it do?
It has some useful features like helping create Spigot projects easier
but it's not required and you can just setup the pom.xml or build.gradle files yourself
You add it as a dependency in the pom.xml or build.gradle
oh I bet the version im pom.xml is wrong
Depending on if you have a maven or gradle project
Could be
I have 1.21-R0.1-SNAPSHOT
its maven
?maven
Wrong java version for 1.21. Pretty sure you can;t build with 1.8
yeah corretto
okay, how do I do that
You simply replace the old version number with the new one
You can usually find the new versions on the apache maven website
or on maven central
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
```Is that on this last line? ^
yes
3.13.0 would be the latest version
and 3.6.0 for the shade plugin
Also I do recommend changing the Spigot version to 1.21.4
but if you really need to use 1.21.1
okay, where do I find the 1.21-R0.1-SNAPSHOT part for 1.21.4?
Replace 1.21 with 1.21.4
When you've done that click the reload icon in the top right
ok
is it a problem that I have java 1.8 here
<properties>
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
and I'm using corretto-21?
Should work fine but if you want to you can change it to 21
If you're going to make a plugin for 1.21.4 you might as well
No need to miss out on all the new Java features
well, this is my updated pom.xml and I'm still not getting anything
https://paste.md-5.net/etolofabaq.xml
are you sure 1.21.4-R0.1-SNAPSHOT is correct?
yes
what do you mean by "I'm still not getting anything"?
the IDE doesnt know spigot API
I think its the newest, how can I check?
help -> about or something
If you open the project view (where your files are), at the bottom there should be a dependencies section
External Libraries*
Can you expand that and see if Spigot is listed
java.version should be 21, not 1.21
Yeah that too
nope, I just have corretto-21 in there
And you reloaded your pom?
yes, I did have to change java 1.21 to 21 just now tho
try repair ide before nuking all caches
welp I nuked it
just got this Plugin 'Minecraft Development' (version '2024.3-1.8.2') is not compatible with the current version of the IDE, because it requires build 243.16718 or newer but the current build is IU-241.19416.15
I still just have corretto in my external libraries
mm either update intellij or uninstall the minecraft dev plugin
already updated intellij, updating minecraft dev rn
Does Intellij Ultimate update slower than community edition then?
no, they have the same release cycle
My Intellij community edition is at build 243 just like the mcdev plugin expects
Theirs isn't up to date then?
bingo
huh
isn't jetbrains toolbox a wonderful thing
2024.3.1 is latest
that's not latest
Keep updating
I forgot Intellij doesn't do that without toolbox
It updates one version at a time it's up to you to run it multiple times
or grab the installer
Keep an eye out for the update icon in the top right of Intellij
Should be a blue arrow there when ever an update is available
there isnt for me for some reason
They might have moved it 🤷♂️
It was there before the UI change no idea where it is now
yeah this UI is different from what im used to
I just use Toolbox to manage all my IDEs
Keeps them up to date for me and helps me login to all of them
so I don't need to do so for each one
guess I'll get toolbox then
I hate toolbox
in IJ 2024 there's a little dot in the top right on a settings icon i think, dont remember how it was excactly
it is just an updater but it works like shit and takes resources like a maniac
that won't update minor and major versions, just hotfixes
oh fr?
i knew it didnt update major versions but i thought minor versions would be updated
It works fine wdym
I meant what I said
?
okay so I updated to the actual newest version of intellij, still no libraries
Nuke cache again and see if it works better now
ok
ok
Should cause Intellij to auto detect the poms presence
for invalidating caches, do I select any of the optional stuff?
kk
deleting .idea and reinstalling minecraft dev plugin did the trick
thanks for all the help yall
what do i use as like a cuboid
i have a custom block that when placed should place a 3x3 of blocks i specify
but what "wrapper" do i use for the 3x3 to check if its empty for example
?
what
There's no existing wrapper for that
isnt there like a cuboid
i mean i could do
i just want to check if the 3x3 where the player places the custom block is empty
You'd just have to for loop and check isAir
idk how i would do the math tho
thats not my strong point so iwas wondering if t here was an easy way thru
I recommend just opening a creative world and placing down some blocks to visualize it
Should help you figure it out
also if i have pdc on a block then place it, then break it, it will lose that pdc right
im tryna have my printing press still work after being broken and then placed
Might have to attach it after placing
wym
The PDC tag I mean
Same goes for breaking you'll probably need to add it to the item
hm is there a better way
ig i could store the custom class with a location
and check if that location block is broken
That's not persistent
Save it to the PDC
bro the pdc just goes away i dont think it works on blocks
?blockpdc
Learn about CustomBlockData here:
https://www.spigotmc.org/threads/custom-block-data-persistentdatacontainer-for-blocks.512422/
fair scat limitations
And no it doesn't work on all blocks which is what this lib is for ^^
The CustomBlockData lib stores your NBT in the chunk instead of the block for you
So it works on non-tile entities
swear if the block gets pushed by a piston or smth its ggs
It does check for that
na f that
may do it the map location way
That will still break if someone uses a piston
true say
this that bs 🤦♂️
how has the game been out for 18 years and there isnt a good fix
18?!
idk were a guess
?howold rd-132211
Minecraft Alpha rd-132211 is 15 years, 7 months old.
wdym there isnt a good fix
You can just use the lib
hows it done in legacy then g
It will check what you need to for it
(You can’t store NBT in chunks without PDC)
is the library foolproof 100% working no bugs
afaik yes
type beat'
if you find a bug you report it and it gets fixed
Or plugins doing block.setType
