#help-development
1 messages ยท Page 266 of 1
Also I know you didn't ask but those == comparisons are going to lead to some annoying bugs down the line
You need to use .equals for object comparison
wc.environment(World.Environment.NORMAL);
wc.type(WorldType.FLAT);
wc.generatorSettings("2;0;1;");
world = wc.createWorld();``` https://pastebin.com/f3JHGbpe why am i getting this error
oh really? thanks for the tip, i will change it!
something is fucked up with the world format but you're not running spigot so i'd say you should probably go ask pufferfish support
yeah i get it
ok thanks
doesnt work with spigot either
It appears to be an issue with something PersonalMines is doing, so you'd probably want to talk to the author. It's producing malformed JSON. So as the error says, they can turn on lenient mode. Or they can fix their JSON.
iits my plugin
Ok well, without seeing the json I couldn't tell you. But it's quite clear.
json for what though
You have malformed json. Turn on lenient mode, or fix your json.
this is the code im just trying to make a world im not using json or anything
Not sure then. Json is being used somewhere internally. Maybe the generator settings? That's a complete guess however. Maybe someone else knows more
alright thanks anyway
Does anyone know how I could code a plugin like lifesteal?
Depends what you're wanting to do, but the first step is getting your ide ready and make sure you know what you're wanting for the plugin.
I have made a project in Intellij
Then you need to work out what you're wanting the plugin to do exactly and make sure you've added the required dependencies into the build file etc..
It has spigot in there. What else would be required?
I am coding a plugin with a few things. One of the things is lifesteal but they loose a random amount of hearts from 1 to 3.
It depends on the features etc... an how the plugin works
You kill someone they lose anywhere between 1 - 3 hearts and you gain those hearts.
You mean PlayerDeathEvent?
ye im a little dum lol
Wait, I meant EntityDeathEvent.
You'd need to work with the EntityDeathEvent and the setDamage and setHealth methods.
So how would I make an EntityDeathEvent?
@EventHandler
public void deathEvent(EntityDeathEvent event) {
// Your code here
}
Make sure the class implements Listener
An that you registry the event in your onEnable method.
Okay now how would you code it to randomly take away 1-3 hearts?
Get the player from the event, use the setdamage method and take the health away
Not health. Permanent hearts.
Same thing, Then you'd probs use something like setMaxHealth to change how much health they have.
Probably just event.getPlayer()
My just use docs
Okay.
Google or stackOverflow might know
?
He's nicely saying look it up
I think he was answering the other guy that why i put a question assign
In general, taking a list and turning it into a single entity is a reduction. You can do it manually by creating a new document and looping your list and somehow serializing them all into one or you can use streams and use the reduce method. It's not mongo specific.
I'm gussing this is your first time using the spigotapi. I recommend using the javadocs. https://hub.spigotmc.org/javadocs/spigot/ People won't code the plugin for you. So you'll need to do some research yourself.
package index
No no i know that is from java, but i dont know how mongo does mongo does it, when using Document#append()
Yes well I am used to c++ so this is a little different.
Hey my guy, javadocs exists
You can use them when you are coding, they tell you everything about a library
It hurts my eyes.
View the method source, I guess.
Im wondering to know if you are being serious or just trolling.... ยฟ?
?
Ok, so just google or dont code bro because javadocs are there for a reason
If you dont wanna use it, its not our reponsability
You want to append a list of documents into a single document. So you can loop your list of documents and repeatedly call #append or you can try to find a more apt method that does the job. I don't know what answer you want.
We can point you in the right direction with the docs, but we won't always spoonfeed you the exact code.
I didn't say it was. I came to a help channel and it has helped me
Yeah, but some types of questions shouldnt be asked and should be auto answered by javadocs
Chill, the point already got made
ok i seee ๐
I have a listener and stuff that does the things using java docs and stuff but how do I use it in the main plugin class?
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
I'm curious, what did you call your plugins main class?
plugin
That's almost just as bad as Main...
?main
^ that definitely applies
Why does setMaxHealth have a line that goes through it?
That means it is deprecated and there is an alternative method to use instead. If you hover over it, the Javadoc should indicate the preferred method to use
Inventory click even you'd be looking for cursor having an item on it
And then make sure it's in the chest gui by making sure it's In top inventory
what if your shiftclicking an item
You can check click type
Shift clock is prob a type
Everything yoh need is in inventory click event though
How can I spawn particles not in a terribly random way using
p.getWorld().spawnParticle(Particle.FLAME, p.getLocation(), 5, 2, 1, 2, 0.);
The area is so wide I can't just get it to be a tiny particle spot
wait so
do you mean you want it to spawn more particles in that area
or for it to be smaller
i dont understand your issue
I wanna concentrate that mess of a particle radius
Into a smaller area in front
Like a "dot" of some sorrt
@vapid grove
I am looking at setMaxHealth and I am not sure where I should be hovering over it.
If your IDE isn't showing you the full javadoc then you can go to your web browser and look at the full javadoc instead
declaration: package: org.bukkit.entity, interface: Damageable
Okay another issue. I have put the plugin in my plugins folder and when I do /pl it says 0 plugins.
Don't you just move jar file in?
Yes but your jar file needs to contain both the code and a plugin.yml file so that Bukkit knows what to do with it.
ahhhhhh now where do I find that yml?
You have to make it...
Oh I found it.
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
how do i create a scheduleSyncRepeatingTask
declaration: package: org.bukkit.scheduler, interface: BukkitScheduler
what exactly are you having an issue with
use the documentation
1+ makes no sense. Other than that, hover your mouse over the red underlines and see what it is telling you
The IDE is not magic. It tells you exactly what the problem is.
and the run is to remove the @Override
?basics
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
bruh ik how to use java
No you don't
Clearly....you don't
I have the yml file how do I put it into the jar file?
If you're not using maven or gradle, then just put it in the project root folder.
I am using maven
Just make the file and make sure it's in the resources section of the project. and it will be in the jar when you build it
Okay.
If you know Java so well, then you know how to hover your fucking mouse over the red squiggles and find what the problem is.
Once you find that problem, come tell us
Then we can help you
No point in trying to flex your skills when you can't even help us help you
Use your ide if you claim to know what the fuck is going on
BRO why does it make me remove the @Override
Why don't you HOVER YOUR MOUSE OVER THE ERROR and figure out what it says instead of just going with the default suggestion
Also just use a lambda
THERE IS NO ERROR
There's no reason not to use a lambda
Does it say you're not overriding the method properly? As in the signature does not match what it should?
Because that is
In fact
Believe it or not
AN ERROR
IK
Where is the recourses section? I am using Intellij Idea
Did you use maven or gradle? If not then you don't have that folder.
Maven
src/resources
Okay.
Found it
mate
scheduleSyncRepeatingTask(plugin, () -> ..., 0, 20);
This one is correct.
if it's in there, then now you check the logs to see why bukkit failed to load it
?paste the full startup log
Okay.
make sure it is plugin.yml, not Plugin.yml
BRO YOU NEED THE RUNNABLE
im gonna go shoot myself
[15:32:41 ERROR]: Could not load 'plugins\1-1.0-SNAPSHOT.jar' in folder 'plugins': uses the space-character (0x20) in its name
good luck
same
oh I see how to fix it I think
He knows java he'll be okay ๐
I did say paste the full startup log. Not a single line
That was the part about the plugin though.
Yes it just means you cannot put a space in your plugin name in the plugin.yml file
Notice you are not overriding runnable. You are making a new runnable. That's not subclassing, it's providing an immediate instance of the runnable class. There is nothing to override. You can move it to a different class and then implement Runnable and voila your override will work. Or you can use it as a functional interface like most people would when an explicit subclass is not required and just provide a lambda.
void someMethod(Runnable r) {
r.run();
}
// ok
someMethod(new Runnable() {
public void run() {
//blablabla
}
});
// better if you don't need the full Runnable
someMethod(() -> { //blablabla })
that's as much as I'm willing to provide you
Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, messageAnnouncements::broadcastAnnouncements,
20L * plugin.getSettingsHandler().getConfigFile().getConfig().getInt("Announcement_Messages.Interval"),
20L * plugin.getSettingsHandler().getConfigFile().getConfig().getInt("Announcement_Messages.Interval")
);
Then there's mine, to add more confusion ๐
hot
He knows java guys he should beable to break it down
Fairrrr
if i set language level to the highest will that break spigot in any way?
like am I allowed to do that or should I keep it at my current language level for intellij
You can set it as high as you want, but you usually want to set it to the minimum version that a server will be running so that you don't use features that aren't available for the user(s)
It depends on what version of mc you're wanting to make your plugin for.
1.19.2
its for my mc server
Language level as in Spigot's api-version annotation or the Java language level?
If you only plan to run your plugin on your own server then you can set the Java language level to whatever version of Java is running on your server
.
oh cool
For a public plugin, you'd decide whatever minimum Java version to support and set it to that. I usually choose the latest LTS
i got 0 clue what version of java version my server uses however
Well, ask. But 17 is the latest LTS so it might be a safe bet I guess.
okay so 15 should be fine then correct?
Likely fine
But you'd need to ask your host
If they're worth their salt, it is probably fine since they're likely running 17 or newer
ive got 0 clue how to check it with shockbyte
but from what i can tell they automatically use the latest version
Ask them
Then wait
Just use j17
The Shockbyte Knowledgebase contains hundreds of tutorials for managing your game servers for Minecraft, Hytale, ARK, Rust and more.
Seems they let you choose your own version.
so choose your own and set it to that.
If you're using 1.19.x Then just stick with Java 17
17 is a safe bet
how do i clear scoreboard slots
oh ok cool
Will 2 bukkitrunnables run back to back without issue like so?
new BukkitRunnable() {
boolean done = false;
@Override
public void run() {
if(done) return;
}
}.runTaskTimer(Main.instance, 0, 20);
new BukkitRunnable() {
boolean done = false;
@Override
public void run() {
if(done) return;
}
}.runTaskTimer(Main.instance, 0, 20);
or will only the top once run than the second one after the first one is complete
also, is the period auto set to 1 even if you say its 0
or does 0 just mean runs every frame or whatever
both at same time
that is the point of a runnable
oh good
oh
1st one will run, then the 2nd one will be queued till the 1st is done
ok noted
does a period of 0 btw just auto equal 1 tick
or do i need to specify it as 1 normally
0 means instantly I think never tried it though
always a minimum of 1 tick
it defaults to 1
Only way to learn
Is the client/server system time unsynchronized?
Is the client/server system time unsynchronized?
How can I fix this spam in console
How to change eseentials'message can create an language file? Edit source code ?
Essentials gives you a way to edit the messages. #help-server This is more of a question for help-server not development
how do I get the slot of the cursor from InventoryDragEvent
Update ur server @regal scaffold
Before the drag or after
after
getCursor()
doesnt that give the itemstack
Sorry i mistake
It does, then you can just check which slot that itemstack is in
Yea I read that but I dont understand it @sterile axle
First thing I checked before I msged here
Place_Some doesnt exact strike as explanitory
I am pretty certain you can assume it is more than one, and less than all.
Some = One places a couple of the items
All = All of the items
One = Only 1 item
Half = Half of the items
my main question is that does some mean that it will run ANY TIME "Some" items are placed
What is a server core ?
incluiding one, half and all
Spigot, Paper, Bukkit etc...
They might be asking about plugins that noob developers call a "core"
For some reason makes them cream
Some of the items from the cursor are moved to the clicked slot (usually up to the max stack size).
So i found an source code for server core, with fonder paper, spigot, waterfall etc... if i compile this, o get a jar server ?
Huh? You just download the one you want to use. Whether that be Spigot, Paper, etc.. You don't need to compile anything
Don't use custom ones. Use already compiled ones
It's best to always avoid custom ones. Because you'll likely not get much support using a custom one.
Because no one knows what exactly is "custom" about it. And depending where you got it from, it could contain malicious code.
sounds malicious
what does the plugin do that requires a custom server jar anyway
probs nothing good. An some janky horrible code
Its a claiming plugin
like land claiming?
why does it need a custom jar
there are VERY few use cases where a plugin needs a custom jar and those plugins do some crazy stuff
Sounds too sketchy, Use a more well known land claiming plugin
Either something made extremely bad and dumb or straight up a virus
its that simple lol
Just delete that plugin and the custom core, An just use more well known an trusted ones
Yeah
Okay thanks
The only valid reason for needing custom jar would be because the server code is modified or the api extended with custom functionality. However, you all are correct that typically plugins do not require this lol
When I use event.getEntity().setMaxHealth(2); it does not work.
send full code
Wait I think it just wanted me to use GENERIC_MAX_HEALTH instead
import org.bukkit.Bukkit;
import org.bukkit.attribute.Attribute;
import org.bukkit.entity.Player;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityDeathEvent;
import org.bukkit.event.entity.PlayerDeathEvent;
public class DeathHandler implements Listener {
public void deathEvent(PlayerDeathEvent event) {
event.getEntity().getAttribute(Attribute.GENERIC_MAX_HEALTH).setBaseValue(2);
}
}
That should work right?
what are you trying to do
?paste
Please use that when sharing code.
Make max health 1 heart when player dies
You just want to make it impossible to die?
No
Max health goes to 1 heart after they die.
So they only have 1 heart to live with
ok
It should work but you forgot the @EventHandler annotation.
OH THANKS
However, it might be better to use an attribute modifier rather than setting the base value (upon which all the other attribute modifiers are then applied.)
How would this be done?
Though that's nitpicky and may not matter for your case
An you need to make sure you register the event in the onEnable method.
and also you don't need to import EntityDeathEvent since you're not using it
There should be an add modifier method rather than the set base value method
Check the docs
But again depending on what else is running, it may not even matter
yes
The @EventHandler is not in the right place.
why is there a random @EventHandler annotation
Where should it be?
and lowcase p
That needs to go on your listener's event handler method.
The method here needs the event handler annotation.
Okay thanks
hello i am trying to make a plugin and ive never made one before ive gotten my plugin to compile i see in the console and plugin list in game but it doesnt seem to do what i think it should can someone look at the code and tell me where i might have gone wrong?
?paste
You need to example what you're wanting to achieve and what it's doing wrong
so basically it should listen for players commands and when someone does for example "/poll "what should i eat for dinner" "mac and cheese" "lasagna" it then broadcasts a message asking what should i eat for dinner with two clickable answers and then after 30 seconds it should give the results broadcasted to the chat
but it just says /poll is not a command
The command needs to be defined in your plugin.yml.
is this line not defining it?
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
if (command.getName().equalsIgnoreCase("poll")) {
That's defining the code for it.
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
It needs to be in the plugin.yml as well
It needs to also be in your plugin.yml
It also should be in your onEnable method. so it can be registered properly.
Just like just having a class extending JavaPlugin doesn't magically allow Bukkit to know about your main class, just having the onCommand handling code doesn't magically allow it to know about your commands.
The plugin.yml is your source of truth
okay thats fair completly new to all this i will see if i can figure this out ๐ thanks
np
I want to take away -2 health from the max health. How would I change the setbasevalue so it does that?
you would get the current base value, subtract 2 from that, and then set the base value to that new value
Yes but how do I get the current base value and put it into the parenthesis after setBaseValue?
I think if you apply yourself a little bit you will be able to get this
There is a method called setBaseValue. Is there an analogous method called getBaseValue?
What can you do then?...
hmmm
one sec
Would you change the setbasevalue to getbasevalue then do -1? That seems wrong.
It goes red when I do that.
Let's see what your code looks like
I misread this. That's wrong. You need to call setBaseValue and getBaseValue all in one.
It's red because that method takes a double rather than an int, but that's not what you want to do regardless
Okay
I'm not gonna write the code for you because there's value in figuring it out yourself
But I'll try to guide you
You'd just call getBaseValue inside of the parenthesis for setBaseValue. It works. getBaseValue returns a double which is precisely what setBaseValue wants as its input
Oh okay
Functions can take in other function calls as their input, no problem
so i have my plugin.yml file and i think i set it to look for the command but it now says this when i run the plugin im not sure i did the yml file properly
java.lang.NullPointerException: Cannot invoke "org.bukkit.command.PluginCommand.setExecutor(org.bukkit.command.CommandExecutor)" because the return value of "chatpoll.chatpoll.ChatPoll.getCommand(String)" is null
at chatpoll.chatpoll.ChatPoll.onEnable(ChatPoll.java:30) ~[ChatPoll2.jar:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[purpur-api-1.19.3-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:372) ~[purpur-api-1.19.3-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:550) ~[purpur-api-1.19.3-R0.1-SNAPSHOT.jar:?]
at org.bukkit.craftbukkit.v1_19_R2.CraftServer.enablePlugin(CraftServer.java:624) ~[purpur-1.19.3.jar:git-Purpur-1876]
at org.bukkit.craftbukkit.v1_19_R2.CraftServer.enablePlugins(CraftServer.java:538) ~[purpur-1.19.3.jar:git-Purpur-1876]
at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:310) ~[purpur-1.19.3.jar:git-Purpur-1876]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1117) ~[purpur-1.19.3.jar:git-Purpur-1876]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:321) ~[purpur-1.19.3.jar:git-Purpur-1876]
at java.lang.Thread.run(Thread.java:1589) ~[?:?]
Register command in plugin yml
?paste
this is my yml file
Thank you for actually helping and explaining. It actually makes it so I can learn and no copy and paste from google.
Your yml is fine. The issue is like 50 of your ChatPoll class.
That method is returning null
line*
sure thing
Yo so uh I'm making a custom AirDrops plugin
How do I edit the stuff inside the chest
?jd
You can't easily, falling blocks can't have tile entities
Long way - set PDC With items and then set on falling block event
Always forget which event that is
?pdc
This is lifesteal. How would I make it so you gain anywhere between 1 and 3 hearts? And the other player loses that same amount https://paste.md-5.net/sohotetira.java
right
Generate a random number between 1 and 3 and use that inside instead of +- 2 as you are now, I guess.
https://www.freecodecamp.org/news/generate-random-numbers-java/
I think #2 there is probably the easiest way to go about it. Just add one so it's impossible to get a 0 and you should end up getting numbers between 1 and 3
Won't that make it so you can also get 4?
Yes just use a bound of 2. That will let it generate any of 0, 1, and 2. But then if you add one each time, it will be generating any of 1, 2, and 3.
Okay that does make sense.
Sorry, use a bound of 3. The bound is exclusive. So a bound of 3 will do 0, 1, and 2. A bound of 2 would be 0 and 1.
I want there to be a chance for it to drop a special item instead of hearts. Would this do it? https://paste.md-5.net/kelaxuboro.java
If you put some code inside the first if block that drops an item, yes
Yes thats what I was doing.
But it's worthy to note that computers can't do true randomness, so it might end up dropping items more often than you might expect. It's only pseudorandom. But it's close enough.
How do you convert a furnace block to a org.bukkit.material.Furnace instance
I tried the getType and getState
i got it
it was getState.getData
weird
How do I make lore for items?
Using ItemMeta.setLore()
It's a list of strings
get the item, get the items meta, then do a setLore() on that meta.
Use Arrays.asList
You might also be able to just use List.of("", ...), or if you have just one line to add, Collections.singletonList("")
Arrays.asList superior to List.of
I just bit my lip somehow
@velvet chasm You do it like this
ItemStack item = new ItemStack(Material.STONE);
ItemMeta meta = item.getItemMeta();
meta.setLore(<The lore>);
item.setItemMeta(meta);
It depends if you need the returned list to be mutable or not. I would not be so quick to say that. List.of gives you an immutable list, and that is often preferred.
Pretty sure you can modify elements in the list returned by Arrays.asList
You canโt add elements to either
i believe set works
But mutation is different than addition of elements
Try mutating an element in List.of vs the other one
Yeah that's what I said
uncomment as necessary and play with it
it's as i originally said
but my point was, Arrays.asList is not necessarily superior. Sometimes we want completely immutability
what
That's weird
invalidate caches ig
doesnt work
wait why did i do =0
thats what 5 hours of sleep gives me
Ah indeed
How do I check if the base value is = to 2?
just use getBaseValue and compare it to 2
What do you think? :p
Not actually sure for this one.
How to you check if something equals something else?
==
Right after getBaseValue. Check if it equals 2 there and then finish the if statement's parenthesis
np
How do you get it to ban the event.getEntity?
I think the Player class has a method called banPlayer
Can I get to that from event.getEntity?
Oh okay
but yes you can, you need to cast the variable
Wait so how do I ban the player?
checking
Okay
guys i'm trying to make a plugin that shows a player head before the chat message
like the head icon on the default online player list
Is that even possible?
Ok, so you have to get the ban list from the server and then add a ban entry.
You can get the ban list by getting the server (i.e. Bukkit#getServer) then using Server#getBanList, passing a ban list type. Probably you want to give that the ban list type of NAME, but you can also choose IP if that suits you.
but i have no idea how to get the head icon via bukkit plugin
Okay I will have a look
i'm just guessing and it seems that packet modification may be required
You may or may not have to kick them after adding them to the ban list too. Not sure if that method will kick them or not. But you'll need to cast the entity to a Player. You already check instanceof, so that's good.
See here for how to get a Player from the Entity. https://bukkit.org/threads/how-to-cast-from-entity-to-player.78731/
but i can't step further
Alright.
Uh. You should be able to do it if you can get the head as some sort of unicode char or something? But I'm not sure. You can get player heads from skullmeta https://www.spigotmc.org/threads/tutorial-get-player-heads-without-lag.396186/
Not sure exactly how to achieve what you want but good luck
Yup. Read that thread I sent. You'll need to change it for your purposes. It boils down to getting the player's skin from mojang's API and then doing something special with that data to encode it into chat.
That's how you'd start.
hey, i want to make a async task in some kind of way. in c# you can just make a async task, but i coudnt find this
Though i know a tread also works async so this works fine
My question is, is this the best way to do it, or am i overcomplicating it
(for now i am making tick tack toe, so no big deal if its not optimal, but i am learning the good ways cus i am planning to make much larger games)
(Players can start a game by some kind of /start command, but i dont want bukkit to wait for the onCommand() return for as long as the game is going, so thats why i though making the /start command only call to the game as an async task)
Use Bukkit's scheduler
maybe i have to start over there
Dont do it that way
Starting new Thread objects just like that in Java is not cheap
declaration: package: org.bukkit.scheduler, interface: BukkitScheduler
awsome, i am going to take a look at that imidiatly
๐
shutting down for the night, good luck
Thanks.
i changed the threads into this now, this works like it should, and this is also the best way you mentioned right?
Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> start_game(player1, player2) );```
https://github.com/PaperMC/Paper/tree/ver/1.8.8
I wanna compile this project (1.8.8 paperSpigot) but ./build.sh tell me always
cat: BuildData/info.json: No such file or directory
cat: BuildData/info.json: No such file or directory
Downloading unmapped vanilla jar...
The MD5 checksum of the downloaded server jar does not match the BuildData hash.```

Let me guess. Banned in Paper?
I don't think so ๐
um.. paper does not support older version now. so eventually i am wandering to get help and come here
?1.8
Too old! (Click the link to get the exact time)
I don't want to develop older version, but unfortunately I need to develop this right now
Why are you even trying to compile it? You can just download a 1.8.8 version of paper?
I am trying to add patch in bukkit for my game server
I am new to modify bukkit and I think I need to compile it first in my situation
1.8.8 is that old. It's pointless trying to patch it. It's that outdated.
Why patch when you can just use a new version
I can understand that people are still using 1.8 tbh
yes i know but i should use 1.8. I have no choice
Some things were just better in 1.8
um
Nothing that can't be added to the newer versions
I don't think so but
Or probably already is in the new versions
Argument against that: everything new could get added to 1.8 too
Easy nms working?
Yes that is fact but some features (glitch also) removed in newer version
Sure, like all the new blocks? The optimizations?
now its basicly required to use maven or gradle to use nms
The new height limit?
Sure
What do you think 1.9+ did, they added new things and just increased the version number. So techincally any version after 1.8.8, they just added new stuff to it
Yeah show me the new height limit lmfao
There were already mods doing that
CubicChunks
Mods not vanilla lmfao
Sure
And I hate older version because there is no blocks, no mobs, no api, no feature(resourcepack, etc..)
I'm talking spigot
but right now I should use 1.8.9
Dude for Vanilla, you can't bring the argument that there is nothing you cannot add in new versions
Thatโs basically minecraft 1.19
there is no other choice to me
Pointless argument
Sure. Its just a theoretical view
There is always a choice.
We're in the spigot discord talking about adding features via spigot and you claimed you can add everything seemingly through spigot
Yeah and doing everything that 1.8 does in 1.19, it is also 1.8 then. Pointless argument
no.. you can't impl some glitch like blockhit/bow boosting in server-side at 1.19
What
No. Modding
I never talked about serverside
because it should be fix
your issue btw is the fact that
cat work/1.8.8/1.8.8.jar
File: work/1.8.8/1.8.8.jar
<?xml version="1.0" encoding="UTF-8"?>
<Error><Code>AccessDenied</Code><Message>Access Denied</Message><RequestId>R2YATF1JNY0RGJ2Z</RequestId><HostId>NCOdWn3BUBHYB7IM6okyN3/PBdsTtIs88u0OnIQJNa6pQ14i1UNEB5DKpCiBa+kQHh8PJCS2Pjs=</Hos
tId></Error>
Yeah but even through modding it's not nearly as good as just having it in vanilla
Yeah and its still possible
My point is just that some things were better in 1.8.
Scarcely
but there are ppl who depend on bugs or glitchs (still I can't understand this ppl)
What is this? sorry for deep question
If you depend on a bug or glitch... You are asking for trouble.
well, the server jar is no longer hosted on the amazon download service
1.8.8 is like 7 years outdated.
yes i know
I have said it many times. I know newer version is worthy and better than 1.8
I know that fact
well
I prefer to develop newer version
you just have to throw the actual jar in there
mkdir -p work/1.8.8; wget https://launcher.mojang.com/v1/objects/5fafba3f58c40dc51b5c3ca72a98f62dfdae1db7/server.jar -O work/1.8.8/1.8.8.jar
sorry for newbie moment, where do i put this?
into your terminal
ah
git bash
ok thx
I get 1.8.8 jar in work directory right now
thx for help!
Error: Unable to access jarfile BuildData/bin/SpecialSource-2.jar
https://hub.spigotmc.org/stash/projects/SPIGOT/repos/builddata/browse/bin
Update to Minecraft 1.19
I think maybe spigot doesn't support 1.8.9 too
garbage version
the fuck is 1.8.9 ๐
that is not a server version
that is only for clients
the last 1.8 trashcan server is 1.8.8

I mean, 1.8.8 compiled fine for me
but probably for the best here
1.8.8 shall remain dead
I will never go down and make 1.8.8 server/contents
hi some one can help me to create storage.yml file?
Well yea 
If I forcibly update my plugin to 1.19.2 from 1.17.1, will the code break? It is a very very simple plugin and should not be version dependent
If your not using nms you don't need to update it
Just use the same jar
And upgrade your server as normal
Hey guys how do i make my config scorlable like here
You can't AFAIK, but just put a spoiler if you don't want it to take up a ton of space
What happens when I try to register a command that was already registerd by another pluggin?
last to register gets control
and how can a user execute the command from the first pluggin?
Can someone help me please?
like how do I add the Code (Text) thingy when I upload a plugin?
[code=YAML]
config here
[/code]
thx man!
I am doing custom recipes is it possible for me the ingredient a custom item?
Is there an easy way to get the depth of water without scanning the blocks until itโs not water
What version minecraft are you on
1.19.2
You can do that with datapacks
Are datapacks similar to plugins at all?
why tf would you run datapacks on a spigot server
Iโd recommend checking out craftenhance
Why nor
I want to do it in my plugin
there are things you cant do with spigot, no?
They handle all the annoying nuances with custom items nbts and duping
that's what nms is for
lol
Is it possible to detect how many of an item is in a pile on the floor?
Itโs possible you just need to do it in a hacky way which leads to tons of errors which craftenhance already handles
Yes
How would I do that then
Cast it as an item entity then you call getitemstack().getamount()
What kind of event would I use?
It depends where you need it?
Well I want it to turn into something when 9 are thrown on the ground
Itempickupitemevent should already have a method that gives you the item entity
I think you want the item spawn event then
Whats that?
Idk the exact name for it google it
Itโs probably exactly that or similar
Yeah
I think player dropping an item might be different I canโt recall
Okay.
It might be playerdropitemevent maybe idk
I don't understand the javadocs. Any advice for understanding how it works?
y'all both are missing half the problems that can arise
wdym
You'll need some kind of scheduler (items can move around y'know)
Yeah you just gotta make sure to drop them into the stack
Or use some sort of ItemMergeEvent
That might work better actually
The event fires in the 1st tick the item is alive, not when it reaches the floor
True
I will use the merge event then
How would I check if the merge event is my custom item?
for example, this was done with a ticker
How do I see if it is the custom item I made?
just use RecipeChoice.ExactChoice. It will then only work for exact matches. However it's only valid for shaped recipes, not for shapeless ones
declaration: package: org.bukkit.inventory, interface: RecipeChoice, class: ExactChoice
How do I spawn a custom ground item on the ground?
Bing your question before asking it:
https://www.bing.com/
already done that
by using the methods provided by the World interface
declaration: package: org.bukkit, interface: World
I am in the event that detects an itemstack of my custom items. Do I add code in that event to spawn the new item on the ground?
if you want to spawn the item during that event, then yes, otherwise no
declaration: package: org.bukkit, interface: World
Does the javadocs say how to put it into the script?
it's not
anyway, the javadocs tell you exactly how the method works
it tells you which class / interface defines it ("World"), the method name ("dropItem") and the parameter types ("Location" and "ItemStack")
Could you please explain to me what its telling me though? Because it says this:
@NotNull
Item dropItem(@NotNull
Location location,
@NotNull
ItemStack item)
Drops an item at the specified Location
Parameters:
location - Location to drop the item
item - ItemStack to drop
Returns:
ItemDrop entity created as a result of this method
Where in that does it tell me how I can use it
it tells you that you can call a method on every "World" object that is called "dropItem" and takes a Location and an ItemStack as parameter
and if you don't know how to call a method, then you should check out this:
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
wow thanks netbeans, very helpful project wizard
I figured out how to do the drop item
How do I get rid of the old items on the ground?
by calling "remove()" on it https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/entity/Entity.html#remove()
declaration: package: org.bukkit.entity, interface: Entity
Okay thanks for all the help
Despawn is something else in the javadocs
Yeah but I think despawn refers to something else
Why does this not turn the souls into a soul block when dropped on the ground? https://paste.md-5.net/alahibosid.java
looks like you're incorrectly checking if the items are what you expect them to be
you're doing
ItemStack == ItemMeta which will always be false because
- completely different class
- you don't compare equality of objects using ==, you do it with .equals()
- you probably shouldn't even be using .equals() to check if they are your special nether stars
hi, what on compiligne ij idea send
what?
import org.bukkit.inventory; (cannnot find symbole) ?
So what should I do
you should use event.getEntity().getItemStack().equals(soul)
generally when using objects instead of primitive types or enums you should use .equals
when using primitive types like ints or booleans you should use ==
and like phin said an ItemStack will never be equal to an ItemMeta because they're different classes
yeah that too
anyway i was wondering if anyone here worked with campfire recipes and how i would be able to access the CampfireRecipe used when a campfire finishes cooking an item
because right now its looking like i manually have to figure out which campfire recipe is used in cooking
The thing still does not work.
ok
there's another difference you should be aware of
.equals() will compare the items as they are exactly, that means if one stack has a different amount than the other it will not be equal
if you want to ignore amounts you should use isSimilar()
evil people would say, identify your custom items using a PDC entry
Good thing I don't know what that is.
pdc truly is a blessing
I am not on paper
arbitrary data storage on a lot of things
spigot has it too
just no official doc ๐
?pdc
there is also alex's tutorial somewhere
but honestly man i dont think you're ready to make a plugin like that where you make a whole new custom crafting system with dropped items and stuff, i mean you could try but i wouldnt set your expectations too high
learn the basics of java first and the process will be much easier
i mean you were comparing an itemstack to itemmeta
i dont think you understand it yet
Yeah Its 2 am
I understand what I messed up.
I just need the remove thing to work and I am done
in which case its a little weird because .remove() should be working
if (event.getEntity().getItemStack().isSimilar(soul)) {
if (event.getEntity().getItemStack().getAmount() == 9) {
event.getEntity().getWorld().dropItem(event.getEntity().getLocation(), soulBlock);
event.getEntity().remove()
It does not get rid of it
and it is spawning the result item?
Yes.
no exceptions?
What does that mean?
like no errors in console
No errors
i mean something very scuffed you could do is teleport the item to below bedrock xd
Using version 1.19.3 - Buildtools are imported and like half of the classes have errors. Anyone know how I find the new names for the classes? https://imgur.com/koluJHs
I am gonna be honest I was about to do it.
You know what I am doing it,.
this is so scuffed lol
afaik .remove() doesn't guarantee the entity's removal, it just sort of tells the game that this entity should be removed
but i dont know what conditions would have to apply for that not to happen
How does it want me to put the location in for .teleport()?
by putting it between the brackets
Like cords?
well it either expects another entity or a location for its destination
a location is an object
simply new Location(x, y, z)
world, x, y, z, if you feel so inclined
So what would I do to make it go under bedrock?
wouldnt make sense in this scenario though
you would enter a location thats under bedrock
I have been on this website
And it doesn't show there is a difference in the names in 1.19.3
(I am updating the code from 1.19.2 - 1.19.3 btw)
Bootstrap Jar
The main spigot-1.18.jar is now a bootstrap jar which contains all libraries. You cannot directly depend on this jar. You should depend on Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar, or the entire contents of the bundler directory from your server, or use a dependency manager such as Maven or Gradle to handle this automatically.
Please read the release notes for further information: https://www.spigotmc.org/threads/9-years-of-spigotmc-spigot-bungeecord-1-18-1-18-1-release.534760/#post-4305163
๐ฟ
Like .teleport(1, -500, 1)?
i dont think teleport likes it when you try to teleport something to unloaded chunks
just use the entity's x and z and a low y
kinda sounds like an xy problem. what do u want to end up with
I want the entity to under bedrock.
in what way
Because .remove isn't working
also does anyone happen to know how to get the CookingRecipe associated with a campfire finishing a cook
yeah but this guy is new at this so maybe he'd take it literally and complain it doesnt work
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
yeah its quite literally a skill issue
what??
i can not import this?
import org.bukkit.inventory.meta.ItemMeta;
import org.bukkit.event.block.Action;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.potion.PotionEffect;
import org.bukkit.inventory;
mmmh
what is the difference betwen import org.bukkit.inventory; and import org.bukkit.event.block.Action;?
the fact that they import something else ?
after experimenting a bit it looks like the only events relevant for campfire recipes are BlockInteractEvent for when you put something on a campfire, and BlockCookEvent which has no knowledge of the CookingRecipes used and neither does the campfire, how can i figure out which recipes are used without manually looping through each campfire recipe and determining the recipes based on that
i make a gui
or do i need to do this the annoying way
Does setWalkSpeed apply just the speed of the player before the speed calculation or the final speed? If I'm making sense here
ru tryna make custom campire recipes or?
yea
i wanna make it so the resulting items change depending on player stats
so regular campfire recipe implementation doesnt work enough
ah yea
Cuz I wanna make it so that even with speed effect, the player speed is still the same as without, but apparently that isnt working
i think blockcookevent is all u got then for campfires
I can't find any threads on spigot about this so I'm asking here
Prob the former
The former seems the most logical atleast no harm in trying and seeing though
setWalkSpeed probably just sets the player's default movement speed, which sprinting would then speed up
Thats indeed how that works sir afaik
so its before the speed effect calculation
Alright alright thanks for the help!
im doing something similar except with sneaking where with a PlayerToggleSprintEvent you could change the player's walking speed to be faster (or sprinting slower) to have both of them match
It keeps going red
but you'd have to look up exactly the speed multiplier for sprinting
its psuedocode
Please
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
My dumbass
Material.air doesn't work
Sl
guy
Sir
go to bed
No learn Java before coding with spigot
also dont code plugins at 2am where your brain is running at -5% capacity
This is the last thing I have to do.
I have got through the rest of the plugin already
I'm top functional at 2am
I just need this to work
yeah but not this guy
Fr
I used to do c#
Gross
Cos I really want it done
C# is nice shut up
but i kinda doubt it because C# is so super similar to java lmao
C# is just offbrand Microsoft Java
I made basic game. It had movement and it had interactables. (unity)
Oh unity isn't c#
that's scripting stuff
That's fake scripting c#
what does it look like
I just did the same thing
Item item = event.getEntity();
item.setItemStack(ItemStack(Material.AIR));
try putting new before the ItemStack air part
i swear man if you think you have enough of a grip on java you really dont
learn first
Then it works ๐
i gotta test
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
what's happening here is that when you do ItemStack(Material.AIR) on its own the IDE thinks you're trying to execute a method with Material.AIR as parameter, except no such methods exist. but you dont really want a method, you want a class instance, so you want to do new ItemStack(Material.AIR)
ItemStack being a class and it has a constructor which takes a Material parameter like here, constructors are ""methods"" classes use to make instances of themselves
a class you can kinda see as the concept of a car but an instance of such a class would be an actual car
the basics i'd say maybe a month
Decently fast
i mean you can learn the basics faster than that but if you want to understand it well it'll take longer, its not just about memorizing
Wow
makes sense
Well yeah I don't think minecraft works in those ways to drop air
another thing you could try is delaying the .disable() method by a tick
also question
why do you specifically use the merge event for this
Because then it runs when the 9 things merge
one way to do it i guess
but yeah try delaying it by a tick
look up bukkit scheduler for this
whats the thing for that
?scheduling
๐ฉ I wanted to do it
bru literally just said it
maybe you should learn java
Thats a great idea I just came up with
How can I prevent spam on PlayerPickupEvent
I wanna send a message once every 3 seconds instead of every tick
Wouldn't that prevent any items from being picked up at all?
Save the unix-timestamp last time you send a msg and then check if next time the event is called if x seconds have passed
Isn't that a bad performance?
Don't you want to send a msg every x seconds when someone tries to pickup an item? Or what do you want to do
Make it so a user can only pickup a specific item every 10 seconds
Got that part sorted
But don't wanna spam the message
So I guess another hasmap would work?
I still think that it'll be better than having a scheduler
is this kind of file structure acceptable? lmao
I'd have the commands and tabcompleters in the same place, but that's my preferance
actually its a good idea to have the tab completers in the commands package and not the helpers package
ye
moved it
have the name of those folders lowercase
You can do tab completion and execution in the same file
You can either implements CommandExecutor, TabCompleter, or be big brain and implements TabExecutor
even better!
If you want to keep them separated, that's up to you. Though most people keep them in the same file because why not
But yeah aside from that, only other critique is just lowercase package names
it actually would be a good idea to keep em together cuz then I have all the command's main stuff in the same file
and I'll lowercase the names in a sec

imagine having such a big tablcomplete method that it needs its own file
Isnt it more of when you know you should make your own command handler?
nah its when remake the entirety of Bukkit but betterโข
or when you make Minecraft 1.20 before mojang
Hello,
I'm trying to code an extension for GemsEconomy and I'm getting an NPE (Caused by: java.lang.NullPointerException: Cannot invoke "me.xanium.gemseconomy.GemsEconomy.getCurrencyManager()" because "this.plugin" is null). I don't know how to fix it as it's apparently coming from the plugin.
Can you please help me out?
Full code: https://pastebin.com/4gX7G9ak
Full error: https://pastebin.com/BmmprjYe
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
public void onClick(InventoryClickEvent event)
what package a i do import? org.bukkit.clickevent?
its on the line of GemsEconomyAPI api = new GemsEconomyAPI(); ig
yeah so it's coming from the plugin?
GemsEconomy
import org.bukkit.event.inventory.InventoryClickEvent;
nope
are you sure youre depending or soft depending on it, cuz it looks like onEnable hasnt been called
guys can someone tell me what does he think about my plugin?
Who?
?
wdym who?
hmm
whats pluginManager.getPlugin() supposed to do
just use dependency injection with your plugin
how did you get my code?
What coding language are you using?
decompiling
java?
id rather use an itembuilder too
and i would just use a enum for those bow constants which are lazily constructed
does the decompiled code keep linebreaks or are those all discarded when compiling
Discarded probably
Actually... Java should be keeping track of line numbers for errors ๐ค
Not sure how much this differes from the src code, but it would be benefitial to extract alot of those tasks to their seperate obj or function atleast
ok I just started coding with java so I am kinda new to it ๐
event.setCanceled(true); send cannot find symbol because i froget a package?
bytecode seems to keep track of linenumbers
which refers to the instructions
so there's no linebreak in this?!
exactly, none
is it legal to decompile someone's plugin?
Dunno, but there is not much you can do about it, except obfuscating it, ig
who cares, most of peoples code is on gh anyways
whats gh?
github
oh
you just werent here