#help-development
1 messages · Page 1539 of 1
that isn't related to the api link or version
that pertains to the api-version field in your plugin.yml
which should be 1.16, not 1.16.1
thanks!
only major.minor
I'm very confused, I've got a discord bot to work, and it runs fine just running it alone, but when I run it through spigot it gives me this error when I try to connect, anyone know if spigot blocks something or overrides it?
java.lang.NoSuchMethodError: 'boolean io.netty.handler.ssl.SslProvider.isAlpnSupported(io.netty.handler.ssl.SslProvider)'
how you run
DISCORD BOT
trough spigot lol?
I just have a separate class which initialises my discord bot class
in the onEnable() method
https://stackoverflow.com/questions/60589689/the-exception-java-lang-nosuchmethoderror-thrown-when-invoking-azure-storage-rel oh apparently it's likely to be a maven dependency conflict
i think i found vulnerability but not sure
spigot or some other plugin on the server is probably shading in or including the classes that you depend on but with a different version
if notchian server uses counter to 100 for window ids
yeah, does spigot use a different version of
to display items
on the client
and resets every 100th chest opened
wouldnt this broke if at the same time 101 players opened a chest
since 1 is occupied by the first player
101 player would see the 1st player's chest contents
am i right?
0 never happens
since 0 window id is for player's inventory
That would only happen if the notichan server has a windowId -> Object datatype
open window packet uses ints
Which, the server might not have and in this case it might just be some validation redundancy layer for either the client or player
and primitive integer as window id
but counter resets every 101th iteration
while packet getting sent
Yes, but it is not a lookup table
97,
98,
99,
100,
1,
2,
and so on.
according to the packets windowid doesn't not pass the 100 mark
the packet windowId is not really interesting for vulnerabilities in a standard environment unless that Id is reused for one purpose or another outside of the protocol
yeahh, spigot uses netty 4.0.0
is there a way to import it using an alias?
(in maven)
It could also be a remnant to an older system that is no longer used in the old form
so you're saying that windowid is really useless just like i was thinking
or, in a java import to specify which version
it has to be
No
i mean container
I would need to look up to be sure, otherwise I am talking bullshit
@noble spire I have no idea what your specific issue is, but perhaps you can remove all contender versions via excludes
first i thought window ids are used for linear array storage for container objects inside server, but it seems it isn't
if there are only 100 possible values, then that is certainly not the case
i think this is just a legacy leftover.
granted, there are some unsafe things like that, like entity ids only being 32 bits
but they are still feasibly safe
something like 100 just wouldn't fly
I'm not great at maven so I don't know how to use excludes, my issue summarised is that I'm using a library that requires a later version of a library, where spigot uses an older version, but the library I'm using tries to use the older version
exclude the old version from the dependency that imports it
how?
i'm sure you can find a tutorial or a guide online
okay, is it maven or java?
i don't remember the jargon off the top of my head
Then you need something like
<!-- World protection plugins to integrate with -->
<dependency>
<groupId>com.github.TownyAdvanced</groupId>
<artifactId>Towny</artifactId>
<version>0.97.0.4</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<!-- We don't want to harm our dependency tree with transistive dependencies-->
<groupId>*</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
</dependency>
maven
once again the TRANSitive dependencies are excluded from the project
just like in real life
I do not want to download RockDB everytime I build my project, okay
an avid trans excluder, a discriminator
Is there any more efficient way of doing this https://paste.md-5.net/hifabineyi.js?
I do not disciminate, I exclude everything equally!
Apache Text (which might have been merged into/split from Apache Commons - I suggest whatever is newer) offers something like that iirc
So I've been working on making a plugin for 1.17, and I've been copying most of the code from another plugin. I've got this line that no longer works in 1.17:
SECTIONPOSITIONCLASS = Class.forName("net.minecraft.server." + SERVER_VERSION + ".SectionPosition");
Any idea what I should replace it with?
First thing that caught my eye is for each loop. Its a bit slower than simple for loop with primitive int since it uses Iterator in the backend, second since you check what string contains multiple times the same, you can cache the booleans instead of rechecking everytime like:
boolean emailStatus = message.contains("%emailStatus%");
boolean discordStatus = message.contains("%discordStatus%");
^ since those are essentially for loop functions which are iterative. And its for the better if you cache those for later use
also i don't seem to know why are you using arraylist for this particular situation, you can just use simple constant static array for this situation, since when static is used the object or the primitive is only initalised once.
private static const String[] contents = new String[] {
" &f&m---------------] Auth [---------------",
"",
" &cDiscord: &f%discordStatus% Message2",
" &cEmail: &f%emailStatus% Message2",
"",
" &f&m--------------------------------------"
}
also you can just do a repeating task every 5-10 minutes
to check the status
instead of checking it every time
its a command
ik, but you can get the results via method which just return fields
but compute the result
in the task
np
copying NMS is a terrible idea
it changes everyttime when update of minecraft rolls out
is there a method to get a Player object from their username as a String?
you mean serialized player object?
Only if they're online
or just Bukkit.getServer().getPlayer()
yup thatll prob work tysm
Bukkit.getPlayer
static Bukkit methods defer to the server instance methods anyway
wait bukkit 1.17 isn't out? https://hub.spigotmc.org/nexus/content/repositories/snapshots/org/bukkit/bukkit/
I'm curious, but have you ever been in a situation that you had to force a thread to sleep ?
bukkit is no longer publicly updated
hasn't been for a few versions
you don't import bukkit
you import spigot
which includes bukkit
?paste
(that's my pom.xml)
yet it still gives me the error
am I importing spigot correctly?
looks fine
restart and clear caches and all that shit
well thread sleeping or named ticking is used in thread pools to stop threads from joining with the main thread
wait
org.bukkit as a jar
shouldn't it be craftbukkit
oh nvm
that's just the API
without NMS
just like Spigot-API
org.bukkit.craftbukkit is nms
Interesting! I didn't know thread pools worked like that
you can't really force another thread to sleep
Can some1 link paper disc?
no?
thread pools consist of individual threads that choose to sleep whenever they don't have anything to execute
sleeping a thread externally is a thing you can do on some older versions of java but has been deprecated for like over a decade
I'm still getting Caused by: java.lang.IllegalArgumentException: Plugin already initialized! when running a command. what i can do?
You can easily google it (heck, even https://github.com/PaperMC/Paper should have a link to it)
don't instantiate your main class twice
there's lots of implementations of thread pools, some pools use while loops instead
Are you calling a new Main() or something like that?
while loops with sleep or blocking instructions in them, yeah
point is the thread sleeps of its own accord
another thread isn't forcing it to sleep
it's private Main main; then in a method main = new Main();
just to get the main class
yeah, no, don't do that
threads are like separate programs on OS but in more smaller package and better resource usage sometimes, it depends.
Hi, I'm having a problem with Spigot. Anyone can help me?
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply.
though not sure if that's the best place
no, I do not think that I will
look, you scared him
also Caused by: java.lang.IllegalStateException: Initial initialization is caused by new Main(); call?
yes
ok.
I recommend you to learn to read stack traces to know it for yourself - it is one of the more useful skills to have
bruh this.multiplayer is null
did you ever initialise multiplayer?
i just made the variable public Main multiplayer;
learn java
Hey quick question: does anyone happen to know how to set an Nbt tag on an itemstack in the versions from 1.16 onwards, and also query it later on? Thanks in advance
use the pdc
isn't it a very basic one ?
I got the recommendation to use NbtTags instead of querying the name of an inventory, so I was interested in this in general, but thanks for the tip.
People are often unable to know who is at fault when reading stacktraces
Example:
[22:21:53 WARN]: java.lang.NullPointerException: Cannot invoke "net.milkbowl.vault.economy.Economy.getBalance(org.bukkit.OfflinePlayer)" because "this.econ" is null
[22:21:53 WARN]: at com.plotsquared.bukkit.util.BukkitEconHandler.getBalance(BukkitEconHandler.java:110)
[22:21:53 WARN]: at com.plotsquared.core.util.EconHandler.getMoney(EconHandler.java:58)
[22:21:53 WARN]: at com.plotsquared.bukkit.util.BukkitEconHandler.getMoney(BukkitEconHandler.java:71)
[22:21:53 WARN]: at com.plotsquared.core.command.Merge.onCommand(Merge.java:197)
[22:21:53 WARN]: at com.plotsquared.core.command.SubCommand.execute(SubCommand.java:57)
some people will think that vault has to be at fault here
ok so I went to test and print the packets out, ABORT_DESTROY_BLOCK packet is generated even when player punches the block. But BlockDamageEvent isn't always cancelled even when I used #setCancelled(boolean) on detecting ABORT_DESTROY_BLOCK packets.
uuuuuh, just go the the first line and check it out? and if I didn't guess wrong it's cause someone forgot to initialize the econ ?
oh wait, is that from the guy who had this problem earlier ?
8 punches with their respective evt#isCancelled
Dont think so, I obtained it from https://github.com/MilkBowl/Vault/issues/853.
🤣 I think someone had the exact same problem a few hours ago
I saw, but in this case it is a bit different
Yep, I'm reading the url you uploaded
I assume it has something to do with bukkit having inconsistent load order, but we can only speculate
are there any ways to overcome such inconsistency?
hey quick question because i cant find much on google about it, how would i set a turtle egg "block?"'s amount of eggs?
((TurtleEgg) location.getBlock().getBlockData()).setEggs(eggCount);
is what i've tried
then you have to set the block data again
yeah but ive been looking at it and cant figure it out thats why im here
^ BlockData is a clone
Block::setBlockData
ohh okay so ill try getting the blockdata, setting the egg amount and then updating the blockdata
mhm
i can test it in a bit,
TurtleEgg egg = (TurtleEgg) location.getBlock().getBlockData();
egg.setEggs(eggCount);
location.getBlock().setBlockData(egg);
is what i have now and should probably work, thanks!
Can you help me with this: org.bukkit.plugin.InvalidPluginException: Unsupported API version 1.16.1... Im using 1.16.5 APIs and LIBs but its still saying that the API is for 1.16.1
1.16
?
api version 1.16
Put it to 1.16
yeep
Not 1.16.something
Also, I'm quite curious why pick 1.16.1 when you're using 1.16.5 ?
i already explained this to you
1.16, not 1.16.1
the api-version does not accept patch versions
then you havent recompiled
You know that's a better way of answering that NNY
im doin' 3rdrecompiling
ok so I found the problem.... double clicking
If i create a maven project, config.yml goes into the resources folder right?
Yes
My plugin wont enable cuz config.yml cant be found
even though it is in my resources folder
Then you are building using Artifacts and not maven
[22:30:18 ERROR]: Error occurred while enabling CubicXpChat v1.0-SNAPSHOT (Is it up to date?)
java.lang.IllegalArgumentException: The embedded resource 'config.yml' cannot be found in plugins\CubicXpChat-1.0-SNAPSHOT.jar
at org.bukkit.plugin.java.JavaPlugin.saveResource(JavaPlugin.java:192) ~[patched_1.16.5.jar:git-Paper-638]
at org.bukkit.plugin.java.JavaPlugin.saveDefaultConfig(JavaPlugin.java:179) ~[patched_1.16.5.jar:git-Paper-638]
at com.nux.cubicxp.Config.<init>(Config.java:12) ~[?:?]
at com.nux.cubicxp.CubicXpChat.onEnable(CubicXpChat.java:13) ~[?:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:263) ~[patched_1.16.5.jar:git-Paper-638]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:380) ~[patched_1.16.5.jar:git-Paper-638]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:483) ~[patched_1.16.5.jar:git-Paper-638]
at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugin(CraftServer.java:501) ~[patched_1.16.5.jar:git-Paper-638]
at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugins(CraftServer.java:415) ~[patched_1.16.5.jar:git-Paper-638]
at net.minecraft.server.v1_16_R3.MinecraftServer.loadWorld(MinecraftServer.java:591) ~[patched_1.16.5.jar:git-Paper-638]
at net.minecraft.server.v1_16_R3.DedicatedServer.init(DedicatedServer.java:281) ~[patched_1.16.5.jar:git-Paper-638]
at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:1065) ~[patched_1.16.5.jar:git-Paper-638]
at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$a$0(MinecraftServer.java:289) ~[patched_1.16.5.jar:git-Paper-638]
at java.lang.Thread.run(Thread.java:831) [?:?]
[22:30:18 INFO]: [CubicXpChat] Disabling CubicXpChat v1.0-SNAPSHOT
it needs to be in src/main/resources
it is there
You need to use the window on the right thats labeled Maven, not the build artifacts on the left
Im clicking on the right window, selecitng lifecycles and doubleclicking package
Me so dumb
Me so dumb
now get your compiled jar from the target folder
Iam getting it
still the same error
Im starting to doubt its smthing else
it could be my code
Open your jar and look inside XD
Then you are either not placing it in the correct folder to start, you are not using the correct jar that was compiled or not uploading it correctly to your server.
Your favourite archive tool should work fine
I'm betting you are getting the jar from teh wrong folder
Are you getting your jar from the target folder ?
yep
Building jar: C:\Users\Kasutaja\Desktop\projects\CubicXpChat\target\CubicXpChat-1.0-SNAPSHOT.jar
this is the folder its getting built in
try to use <includes> in your pom
?paste your pom
Did you validate the file is in your jar ?
run clean and package it again
What was the command for cleaning again?
and like someone said above, decompile your plugin to see what's inside
Huh ? What's wrong with mvn clean
depending on IDE may use a different maven
The pom is inside ???
I always run commands for maven
yea?
not inside where the classes and sht like that is
its in its own specific folder
can you show us teh structure of yoru jar
you never included config
Does CraftBukkit not ship with bungeecord text API?
no
https://hastebin.com/xajazokite.java
Why is that not working here is my class but the setCancelled is not working
do you get the yeahh message?
No
then debug and see how far into your code it is getting
included it, got my plugin working now, but theres another problem, i specified my host as 'localhost' in config, but error tells me:
Caused by: java.net.UnknownHostException: No such host is known (null)
Can I (using the Bukkit/Spigot API) determine if the server is running CraftBukkit (and not Spigot etc.)?
Im creating MySQL database.
?paste your config and the line of code that reads your host
https://paste.md-5.net/cawuginoyo.bash
Line:
host = Config.getHost();
java```
public static String getHost() {
return cx.getConfig().getString("mysql.localhost");
}
look at the path you are fetching
ahh fuck, i shouldve just wrote host right?
mysql.host
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/Server.html#getName() would this return "CraftBukkit", "Spigot", "Paper" etc.?
declaration: package: org.bukkit, interface: Server
or can I let my plugin be Spigot API only and let CraftBukkit disable it as it wouldn't work?
well I just had someone open an issue on gh and they were using CraftBukkit
spigot is a minority
craftbukkit is a super über minority
literally nobody runs craftbukkit servers anymore
build against spigot and you're good for pretty much the entire bukkit ecosystem
there's always one or two
but it's like less than a percent or something
practically nobody
people using paper and its derivatives might have some criticisms if you don't use paper or paperlib but for most plugins that shouldn't be very significant
So basically when someone interacts with any type of armor in their inventory it is suppose to put them on cool-down and when that cool-down is active they can not interact with the item. for example i equip a chest-plate it will put me on a 3 second cool-down meaning i cannot dis-equip the chest-plate until that 3 second cool-down is over. Here my code for it but doesn't work.
https://hastebin.com/sinoxawuyi.typescript
I build everything against spigot-api but exclusively use paper and purpur on my servers
@eternal oxide this problem got fixed but now Im getting this error:
[22:54:22 WARN]: com.mysql.cj.jdbc.exceptions.CommunicationsException: The driver was unable to create a connection due to an inability to establish the client portion of a socket.
[22:54:22 WARN]:
[22:54:22 WARN]: This is usually caused by a limit on the number of sockets imposed by the operating system. This limit is usually configurable.
What could it be? Its pointig to my openConnection method which does this:
public void openConnection() throws SQLException {
if (getConnection() != null && !getConnection().isClosed()) {
return;
}
connection = DriverManager.getConnection("jdbc:mysql://" +
this.host + ":" +
this.port + "/" +
this.database,
this.username,
this.password);
if it's a private plugin, you may want to consider using paper or purpur api
as with them you can write generally more performant code and there are a lot of handy shortcuts that on base spigot can be a headache to pull
yeah my private one goes against paper
airplane afaik is nothing but placebo
I use purpur
yatopia
i looked through the server patches a while ago and I found nothing that wasn't a micro optimization
and airplane uses that replacement for timings which they want money for, no?
i don't remember if it's a full on replacement but yeah they have some sort of a live profiler tool that requires a patreon subscription
somewhat understandable I suppose but still kind of shady
Potatoes are Ageable
are you closing the connection after use?
No Im not closing it in my code
But the tutorial i followed said that its a bad thing to do
to close connection
in onDisable
thx
yes, dont close the connection
used to be potato and potato_item or something
Also:
Caused by: java.net.BindException: Cannot assign requested address: connect
Show teh full error as I bet its complaining that the port is in use
Caused by: java.net.BindException: Cannot assign requested address: connect
connect?
Hey
what port should it be using?
How would i go about keeping sugarcane growing in unloaded chunks
?
Sorry if im interrupting
you wouldn't
if the chunk is unloaded, the sugar cane does not exist
and if it doesn't exist, it cannot grow
one thing you could do is scan the chunk on load for sugarcane, read a stored last-loaded timestamp and compare to current system time, and then simulate growth for each cane
that will however be quite expensive performance wise
You have some other plugin also accessing mysql?
is it Material.AIR when the player is holding nothin
Hey I have a problem. It's about persistent data. I just tried to store a string in a custom header and wrote the following code:
ItemStack item = customSkull("http://textures.minecraft.net/texture/851a72cf4962e5d00ef30294e5db8847ce67565154d7ad436099ff3e9dd29a1c");
ItemMeta itemMeta = item.getItemMeta();
PersistentDataContainer data = itemMeta.getPersistentDataContainer();
data.set(new NamespacedKey(Main.getPlugin(), "key"), PersistentDataType.STRING);
However, data.set(new NamespacedKey(Main.getPlugin(), "key"), PersistentDataType.STRING); is highlighted in red and gives the following error:
Can anyone help me with this by any chance? Thank you in advance
it needs 3 parameters
set(key, type, value)
you have set(key, type)
since PersistentDataType.STRING is a PersistentDataType<String>, the value would in this case be a String
@EventHandler
public void onPlace(BlockPlaceEvent e) {
if (e.getBlockPlaced().getType().equals(Material.SUGAR_CANE)) return;
if (Core.getInstance().caneChunks.contains(e.getBlockPlaced().getChunk())) return;
Core.getInstance().caneChunks.add(e.getBlockPlaced().getChunk());
}
@EventHandler
public void onUnload(ChunkUnloadEvent e) {
if (Core.getInstance().caneChunks.contains(e.getChunk())) {
e.setCancelled(true);
e.getChunk().load(true);
}
}
yeah no you don't want to do it like that
that will cause the chunk to be repeatedly loaded and unloaded
and you can't cancel a chunk unload event anyhow, I don't think
add a plugin ticket to the chunk to force it to stay loaded
How exactly do I have to specify the value?
How? What is a plugin ticket?
however be aware that that will keep the chunk loaded at the maximum load level; entity ticking and everything
it's somewhere under World
check the javadocs
Could this be a spigot issue?
In code i save the world, but when i stop the server and re-load the world the only block data saved was the chunk where the player was, any other chunk did not save even though there where changes.
probably not
data.set(new NamespacedKey(Main.getPlugin(), "key"), PersistentDataType.STRING, "my string");
PDC was 1.14
this is plugin tickets
Oh
pdc is for the other guy
So many people
oh okey Thank you
🤣
thankfully my long experience as a faggot moderator has rendered me capable of partaking in 200 conversations at once
This is why i usually post my questions on the forums
without the aid of modern doodads like replies or any of that shit
Ah forums are trash, the real people are vibing here
i forgot to add mysql. in front of port, now this error dissappeared. But theres one last little one XD:
[23:11:50 WARN]: java.sql.SQLException: Access denied for user ''@'localhost' (using password: NO)
👀👀👀
and I do not have a password
the forums are an eternal record of your incompetence
if i log in to the database
here, your nooby failures will be forgotten in a day
unless you're exceptionally mentally deficient like a certain floofsy in which case it might take a week
Ikr? That was my saying when github backed their data
In the arctic or whatever that place was
you need to give a user access to the db, or its root
your error says you used no user
Yep no errors now, successfully connected to the database, i forgot to define my username variable.
Thanks bro, rly appereciate it.
I'm making a ban plugin. It's not a coding error, it's a question. When the player tries to join the server, he is kicked (because he was banned), but the console shows a message. Is it possible to remove this message?
ticks i believe
okay
oh the failed to log in msg?
should be able to remove it using a plugin
or configuring the paper/spigot/bukkit.yml i think?
uhh
why is there no docs on turning byte to a string
theres only byte[] to string
can you not convert byte to string?
does it work if i convert it to char
i just want to print out the byte
wait i can use sout
You should be able to use a byte directly concatenated with a string
declaration: module: java.base, package: java.lang, class: String
There is a string constructor that takes bytes
Or you can do String.valueOf
so i do bte+"blank str"
it gives me 0
new String(bytes, StandardCharsets.UTF_8)
wait what
Single byte
why is light level 0
Not an array
then why do you want to convert to a string? Its a value
broadcastmsg
A single byte isn't even a string. Nor a char
there is no way to convert a byte to a string because there is no sense in turning a byte to a string
oh i see
XD
Its still a Number not a string
a single byte isn't even enough to represent a single character in a string
Single byte just sad
rip byte
Yeah you can just concatenate it with a string
yea, IDK I read one of the bytes as bit 🤣 my bad
why do you not just read the light level from teh block? If you are getting a byte it sounds like you are using nsm or protocol somehow
No
That’s what it returns
byte light = player.getLocation().getBlock().getLightLevel();
.getLightlvl returns byte
oh it does
fairly silly if you ask me
uhh what did that change
byte doesn't even represent the actual range anyway
so might as well use something sensible like an int
well seeing it from the client is not accurate so i gotta get it from the server
In that case I bet you are testing actual blocks and not AIR blocks.
oh yea
wait what?
They are if you look at the code
solid blocks have a light level of 0
i need to get the air blcoks?
because they are solid and don't let light go through
only blocks that light can travel through have a light level
ohhhhh
the hwat about lightlvlfromSKy
also the same
Use getClickedFace(?) and then getOpposite to get the block next to it
hmm okay
only blocks that light can go through can have a light level
ohh okay
skylight or blocklight, doesn't matter
light is light
it light doesn't go through, it can't have a light level
myes
lemme try it
though I don't think there are any actually solid solid blocks in the game that emit light
glowstone
not solid
redstone
also not solid
that might be one, i'm not sure
glowstone is weird, it's a full block but it's not solid in some sense
same with jack o lanterns
not sure about the new sea lanterns
yea it acts like half blocks
mmm i guess a lit furnace is properly solid
slabs
Wiki says redstone lamps are partially transparent when lit
useful for redstone
i guess at some point the lighting engine or something required light emitting blocks to act non-solid in some sense
probably not the case anymore
wait where is .getClickedFace
.getCLickedBlock.getface
probably?
light levels are from 0 to 15, which is the most a byte can represent, so imo it's good use of the type
a byte can represent up to 255
I'm using PrepareAnvilEvent to get my custom enchantments to work in an anvil, but I can neither obtain the item in the result slot nor get unenchanted items to have enchantments applied to them
i hate that byte is signed
Everything in java is signed iirc
everything except char
which is an unsigned short
who even uses bytes in signed applications
so gay
Mojang does
ah yes
the people I look up to the most when it comes to programming
mojang
the people who decided finding structures by brute force loading and searching each individual chunk one by one was a good approach
good job
of that entity
thx 🤣
i don't think so, no
I linked you the docs for it a while ago
i cant?
uhh yea but
okay lemme check
i don't think the resourcepack supports that but I could be wrong
You can just set it to any vanilla material
Don’t know what happens with CustomModelData
well i have the use the Snowball class
and not an ibject of it
object
but now how do i use the .setItem on it
What does launchprojectile return
ohhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh
🤣
is it possible for plugins to like be able to launch a trident when a player right clicks air using like a sword or an axe
or a grass block
🤷
Sure
that'll be more difficult but not strictly impossible
oh its possible?
hmm maybe changing the item into a trident at the last moment?
how do you do it
no nms pls
the issue is in determining the length of charging
so the drawing animation is still impossible?
the client doesn't send proper packets for when the RMB is pushed down or released
it just repeatedly sends right click packets
rip
so you need to grab the interact events and try to guess whether the player is spam clicking or holding the button down
the packet is sent per tick
the player needs to press it PRECISLY
on every tick
which should be impossible
it's sent like two or three times a second
oh then not per tick
or something
per 6 tick
i don't remember the exact interval and it's subject to latency and shit anyway
now that is annoying :/
nms again sign
is it possible for me to make trident with a special liek Lore
change their texture
with the custom model id property yes you can assign a specific texture to a specific item with a resourcepack
changing the texture of a trident with the default pack
like i want normal vanilla tridnets to have the default texture
and change Some tridents not all of them
yes, assign a non-zero custom model id and create a resourcepack that binds a specific texture to that specific model id
soo i can make a trident have the texture of a sword for example using a plugin
i need resource packs?
yes
till launching tridents
texture didnt change
weird
oh the texture change works on snowballs
but not tridents?
even weirder
Tridents don’t support custom models in projectile form because there’s no support for custom entity models
The only reason snowballs work is because all they do is render an item
Yeah I don’t know why the setItem method is on ThrowableProjectile
Wait fr?
Did they registry-fy that also?
Yes
Oof
Oh I missed something then lol
But the entity has never been modelable
Fair
I think they broke the trident model completely in either 1.14 or 1.15, I remember seeing a lot of people complaining in the BlockBench server about it. I think they fixed it now so you can remodel the item like normal.
wrong channel mb
Is possible detect when player is holding a left click button ?
I know exist the method playerinteractevent and i check if action == left click but how i detect the player is holfing a button
inn cumang paket
Were persistent data containers on items removed in spigot 1.17?
are you using nms ItemStack
🤔
It's 100% still there
maybe you accidentally put 1.7
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.17-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
this is what i put in
wait
i just relised that i am stupid and imported bukkit api in a regular non maven dependacy by accident
My hashmap data gets lost for some reason, when sending a command im putting uuid and boolean in a hashmap, after running the command i have a sysout in asyncplayerchatevent which prints the hashmap, but there it prints absolutely nothing.
Anybody has any idea what could be the case?
?paste your code
Probably using a local variable instead of a field
ahh i see
🤔 if you cant make it static then it's probably in the wrong place
I meant every player needs to have its own boolean]
i have a plugin which listens for ur input
and does something with that input
you havn;t shown us the Map
oh yeah
1 sec
public HashMap<UUID, Boolean> inputListener = new HashMap<UUID, Boolean>();
how is utils instanced?
doesn't matter
there you go
one class has a different map than another
you could make the map static, or have a single utils instance in the main plugin class
which, i hope you have not called Main
either a single instance, or you make the map static so any instance uses the same map
thats what i said!
Ill make the map static
we are so in sync elgar
thats the only static method there
Actually
ill create one instance
actually ill change the map to static
We should get married.
we are making our own optimized fork of 1.8 at this very moment!
Time for a divorce
im getting an error when attacking sometimes
code https://bin.birdflop.com/uguvegobug.csharp
error https://bin.birdflop.com/kipejosema.properties
error in on
toReturn.add(data.pastVictimBoxes.get(ticks + range));
data.pastVictimBoxes.get(ticks + range)
ticks + range is outside the bounds of the list
Is there any easy methods to get color of a string?
ChatColor.getLastColors
is there anwyay i can make it so that only a certain player can hear a sound i'll playy
or do i have to use nms or something with packets
can you not just do player.playSound
no, it plays it at the location
i've tested it, other players can hear it
i want to make it so that only that client can hear it
it just sends a packet to the handler of CraftPlayer
Yes player.playsound is for them only iirc
Code it runs makes 0 sense how it can be sent to multiple players
x,y,z would just be for volume adjusting across distance I assume
hmm
?paste the code that's playing it for everyone
World#playSound will play sound to all players nearby, and Player#playSound will only play the sound to the player iirc.
What do you recommend to learn how to create plugins?
Do you know java?
Learn Java first, then once you have a somewhat good understanding of all the basics, then start learning plugins
yeah
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
tanks you
damn bro, how you gonna tank them?
it is bad? I did not know, I did not know it
lmao
He was just joking
yeah ^
ah , okey
we are world champions, come on Italy
😕
apparently my code is stopping the player from attacking mobs
i didn't setcancel any event
so y
Does anyone know where the code is for when the user does /save-all?
is there away to trace it hmm
i did some experiments
either nms or craftbukkit
and i dont think the plugin code changed
but all of a sudden it stopped allowing me to attack
you are either cancelling a damage or interact event or setting damage to zero
hmm
hmmm
what i did
is skipping out of the dmg event
like when a player dmg a entity
when they are at full health
i stops the code in the event from running
i used return for it hmm
return will do nothing other than stop YOUR code running
well yea
still now i cant attack
My previous statement still stands
i didn;t do any of those :<
Those are the only things that will stop you attacking, other than spawn protection
pretty sure you can still attack mobs in spawn protection though
I sure wish the back end did go back to obfuscation ...
does isSerializable exist?
do you know of a way that i can like make a debug log from attacks in game
like stackTrace the attack
i can break blocks and i can see the left click animation
but cant dmg mobs
Listen to the EntityDamageEntityEvent and print debug messages
For some reason this stops working after a while... The event doesnt even seem to get called
@EventHandler(priority = EventPriority.HIGHEST)
public void onSpawn(ItemSpawnEvent e) {
Item item = e.getEntity();
Bukkit.getScheduler().runTaskAsynchronously(Core.getInstance(), () -> {
for (Collector c : Core.getInstance().collectors) {
if (e.getLocation().getChunk() == c.getChunk()) {
if (c.getFaction() == null) return;
if (!Core.getInstance().drops.contains(item.getItemStack().getType())) return;
c.depositDrop(item.getItemStack().getType(), item.getItemStack().getAmount());
item.remove();
}
}
});
}
how 2 print it
throu the IDE?
Just send messages to the console.
what?
that checks to see if theevent is called?
okie
wait hello?
i can attack entites again
@EventHandler
public void entityDamageEntity(EntityDamageEntityEvent e) {
Bukkit.getLogger().info("some random message");
}
That will print "some random message" to the console if the event is called.
did exactly that
okay now i can attack entites
but
for a while i could attack the iron golem in a village
what is this like
randomly stopping my attacks
nvm fixed
due to me under the affect of weakness
BRUH
btw is it possible to check if the mc day is a full moon
uhh why are my custom commands avaliable only to ops
i dont understand
the list is null
thats not a list
hah?
well yea its not
key: [value]
key:
- value
?
like i did .set() and theres no bracket in the yml

FileConfiguration#set(String, Object)
if you put a string into the second parameter, what do you think it's gonna set it as?
FileConfiguration config;
String path;
String value;
// ... //
config.set(path, Collections.singletonList(value));
@digital plinth
how do i listen for when a player gets money through vault
Vault?
is that like a plugin on spigot's website
they should have an api for it
there is
what the heck is vault
how do i set sleep ticks in 1.17
i see that theres getSleepTicks method but there is no setSleepTicks method
@quaint mantle doesn't look like it supports it, you probably have to check the implementer's project individually
looks like you have to use NMS
PR one
yeah i tried that and there doesnt seem to be any value called sleepTicks
try debugging out the fields then
what do you mean by that?
if you have the NMS classes shouldn't be too difficult to trial and error it too
ook
the wait method is the best to use. It makes everyone one on the server wait
I think you mean Thread.sleep
that too
hello i was wondering how to get the location of a block and if there was a method to delete a block
?jd
look at the Block javadoc
player.getTargetBlockExact() If you want to get the block a player is looking at.
And then to delete the block you can do block.setType(Material.AIR);
@quaint mantle
okay so now i figured out i wasn't using the remapped mojang classifier but when i tried it out this happens
let me see your pom.xml
add this first of all
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
alr thanks
i used buildtools though
is it possible to get blocks by their coordinates? like to get a block then delete it, add 5 to the y of that block, then delete it.. etc I'm trying to set it so if someone breaks an end portal block the portal blocks will disapper
still though
yea i added it
do i like
rebuild the spigot?
i tried doing it a couple of times, cleared my local maven repository, still doesnt work
Location location = new Location(Bukkit.getWorld("world"),1,1,1);
Block block = location.getBlock();
what are you trying to do?
i'm trying to set sleep ticks but there doesnt seem to be a method
sleep ticks for a player?
uhmm
there is no method in HumanEntity it seems, no
but it might be that the sleep ticks are just calculated from the player statistic
Which event should I look into if I want to
- Get the player who threw a splash/lingering potion
- The effects of the potion itself
- All the entities that were affected by this potion.
ProjectileLaunchEvent
PotionSplashEvent
and that
ProjectileLaunch is a bit redundant
i don't think thats an answer to my question
Oh thanks, that has everything I need.
it do
no one answered my question in #help-server 😭
sucks to suck
A fresh **copy** of the affected entity list
Is it possible to somehow remove certain entities from being affected?
eh that can get a bit messy pretty quickly
you could probably cancel the event in monitor priority 🙊 and apply the effects to the chosen entities manually
is there an event where player LEFT click an entity
apparently with weakness you cant deal dmg to entites with your fist
i want the player to be able to deal half a heart even with weakness
i suppose I can calculate the distance between the player head the and entity in question and .damage(1,player)
but is there an easier way?
since i'll have to calculate the hitboxes and stuff
EntityDamageByEntity event is not called
which is bad
PlayerInteractAtEntityEvent or PlayerInteractEntityEvent
nope, that's only called for right click
after digging a bit, that is a bit of a lie...
the map is mutable
your mom is mutable
..
Well, damn I can't do anything if the map is not accessible directly, Not touching reflection
yuck
Idk why they made it private, it doesn't break anything at all.
Perfect opportunity for performance and writing less redundant code
just use /data lol
you compare /data to this? https://github.com/Focusvity/PowerNBT
/data is literally a command to handle NBT
in an impossible-to-read format
??
i also dont know how to use any subcommands other than get
how official
i just like not having to scroll through a block of text
Meh
so, like, a key?
and no, that's the point.
why?
seems like xy
nope that's the point of it
as to not conflict between plugins
"can i have a cheeseburger without the burger"
but you can do NamespacedKey.fromString if you like to disobey authority
@quaint mantle I just found out this method is a thing...
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/entity/PotionSplashEvent.html#setIntensity(org.bukkit.entity.LivingEntity,double)
NamespacedKey.fromString("forge:rf")
?
mohist time!!
wym mohist is awesome it lets me get the best of both worlds!!
would someone be able to help me with using the getPing function
can someone help me with packets? I'm trying to send an EntityMetadata packet to turn a player invisible but I keep running into problems. I tried protocol lib and it literally did nothing. no errors, but no output either. can someone show me an example of how to do it? I found this https://www.spigotmc.org/threads/simulating-potion-effect-glowing-with-protocollib.218828/#post-2246160 (which is for glowing but similar enough) but it didnt do anything when i tried it
does it matter if I am sending packets on the player join event?
should I delay them?
yup, try to add a delay like 1-3 ticks
Hey! I tried using persistantdata in items to build a gui. So you should not be able to move the items then. I have written the following code snippets for this:
https://hastebin.com/akajuqisog.csharp
First I created a variable at the beginning of the class in front of all methods that contains the string I want to store in the item later.
Then I created the ItemStack and gave it a meta directly. Among other things, this also contains the PersistantData.
Then I created a query to check whether the item contains a certain string. If so, the InventoryClickEvent should be cancelled and a new inventory should open. However, the event is not cancelled and the new inventory is not opened. Does anyone know what I could have done wrong in this case? Thanks in advance
registered event?
"GUI?" while saving "GUI"
also PDC's #get method will return null if the key does not exist
Hi, so I have two AsyncPlayerChatEvent, but they both occur at the same time when the RecoverEmailSetup method occurs this code user.getSettingUpEmail().setPhase(SetupPhase.VERIFICATION); the RecoverEmailVerify method runs right after it, but I don't want that. How do I fix that?
Code: https://paste.md-5.net/boqemizasa.cs
Video:
so null check the value please
you can specify an approximate order of event handlers using event priority
how do i do that?

