#help-development
1 messages · Page 439 of 1
and getStringList will never be
but you are calling replace twice on it.
It should?
ok lemme try
If not, Hold CTRL and click on the getString and send us whatever it decompiled.
is it better to create each class for entity or make a settings like this
it detects player movements and if player has passenger
as you can see it has alot of PlayerMoveEvent just for passenger detection
Are you repeating yourself a lot?
?
what the fuck is that
can you have a world in a different folder than "/"?
i like the chat is help-development and peoples respond is like this
people who are new to java or creating plugins, they would likely less ask and just stop try make plugins cause of this
I mean
simply google DRY design principle
If you got the same code in multiple classes
abstract it.
@rotund ravine man could u at least bloody explain whats going on here
i might as well go figure it out myself
just a recommendation from someone who started with java recently, if someone tells you something, before asking what it means, google it
bro its not like I haven't been googling the issue for the last 2 hours
which issue do you have?
!= null on strings not working
Are you using Intellij? And is it a maven project?
yes
Well that's because you're using replace
(maybe the issue is not with the ==)
I removed it
bro
like this happens to every string not just that
Could you show your new code
?paste
Does it still give that same message
wdym
how is uniqueId formated?
This one
no, but it doesn't work in gamae
So it's a different issue this time
String displayName = plugin.getConfig().getString("vouchers." + args[1] + ".display");
String material = plugin.getConfig().getString("vouchers." + args[1] + ".material").toUpperCase();
String lore = plugin.getConfig().getString("vouchers." + args[1] + ".lore");
// Voucher meta
ItemStack voucher = new ItemStack(Material.getMaterial(material));
ItemMeta voucherMeta = voucher.getItemMeta();
// More voucher meta
if (displayName != null){
voucherMeta.setDisplayName(ChatColor.translateAlternateColorCodes('&', displayName));
}
A copy as in..?
I forgot to answer, yes
I just found WorldCreator let's yuou modify it
WorldCreator#file()
Hi I'm working on a plugin that's using a Datapack for a custom dimension (Terrain and Structure generation). I already built something that checks if the Datapack in the world server is up to date and if not the Datapack is copied from the plugin jar to the server world. folder. The Problem is that each time this happens, the server needs to restart in order for the Datapack to work. It seems like Datapacks are loaded way before the plugin is. Using the minecraft /reload command doesn't work either because of this Bug: ||https://bugs.mojang.com/browse/MC-187938 || Does anyone know how to avoid this issue or has a better Idea of implementing the included Datapack?
fuck it doesn't exist
but that would create all words in specified directory right?
maybe
public static World createWorld(Player player) {
WorldCreator worldCreator = new WorldCreator(player.getUniqueId().toString());
worldCreator.seed(new Random().nextInt(999999999));
worldCreator.generatorSettings("file:/realms" + player.getUniqueId());
return worldCreator.createWorld();
}```
i'm going against my own principles because fuck why not
worldCreator.seed(new Random().nextInt(999999999));
why? why not do worldCreator.seed(System.currentTimeMillis())
I was more focused on generating the world on a different directory but thanks
ok I am having issues with creating it in a specific directory
?paste
public static World createWorld(Player player) {
WorldCreator worldCreator = new WorldCreator(player.getUniqueId().toString());
worldCreator.seed(System.currentTimeMillis());
worldCreator.generatorSettings("file:/realms/" + player.getUniqueId()); <- this line generates the error
World world = worldCreator.createWorld();
WorldBorder worldBorder = world.getWorldBorder();
worldBorder.setCenter(0, 0);
worldBorder.setSize(600);
return world;
}```
(idk if this is how you create worlds in another directory, it is what I found on google)
That's not valid json
yeah I read the error but don't know how to fix it
is there any other way to do what I need?
ask it
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
ok.
Why isnt the head texture changing?
https://paste.md-5.net/xemigadoda.cs
What version are you on?
1.19.3
hey, what is the event for a player placing a bucket of lava or water?
it does not appear to be handled by the BlockPlaceEvent though.
declaration: package: org.bukkit.event.player, class: PlayerBucketEmptyEvent
okay.
?paste
My tab completer isnt suggesting anything and is giving errors
code: https://paste.md-5.net/yorocazote.cs
So how do i modify the code / what do i replace
idk what you want to achieve
when a player types /mf item //here suggest item names
yeah well if the array has only 2 elements you cant query the third
Is there any command in mythicmobs for banning my custom entity from jumping?
ask them
Whats the best event for my scoreboard to update
idea 2023.1 ultimate having issues?
Are you accidentally using pre-Java 5 java?
I don't know what that (2) means
bro probably has 2 jdk 17 installations on his pc
but fr I don't know
the significant part is 17
java 17
If source version is set to J4 for some ungodly reason it doesn't matter what the target version is.
But I guess you should just try to forcefully cast to Long and forget it
In b4 jetbrains is rolling out their own compiler
if I have an itemstack of 33 stones and I call inventory.removeItem(new ItemStack(Material.STONE, 32)), it will delete the entire itemstack instead of leaving me 1 stone. how do I combat this? I only want 32 of it to be removed
^
perhaps
just quick question how would you prevent a villager be turned into a witch then lightning hit itself
how do i cancel that or protect the villager?
i lost my farmer joe 😦
note: looking for events
Thank you Choco @worldly ingot ❤️
i made that inventory and i cancell InventoryClickEvent when player clicks in the "chest" area but not in his inventory, but 1 player can place items in the chest inventory by clicking shift in his inventory and 2 player can place the item in chest just spamming it.
How to fix it
i want player to be able to click in his inventory
please help me get a material's translated name (e.g. for Material.STONE it would be "Камень" if a player is using Russian)
I've been looking for way too long and the solutions all used NMS
maybe there's a lib or something?
I'm not gonna use nms
Kamień
Modern versions let you get the translation key
Material#getTranslationKey
?wherami
i know lmao
I'm only using paper because otherwise my server takes 2 minutes to boot up
I'm coding for spigot
(against spigot API)
how the fuck do I use a TranslatableComponent
it only translates when sent to a player
what if I want to put it into lore for example
why wouldn't there be a method to translate for a locale
.
you can put a translatable component into lore ? well not on spigot, but in general
like, that would be how you do it
no, I want to translate it first, for example for a player/locale
ofc you can't just put it into lore
the server only has the en_us lang bundled
Jesus fucking christ
you can put a translatable component into an item if you use NMS
the client will render and translate it out
this translatable shit is gonna kill me
do you have an example or a lib link maybe
to what ?/for what
CraftItemStack has the methods to convert between ItemStack and nms item stack
and from there on out, you can just use NMS components as well 
or pressure choco in getting the expansion of bungee component PR merged
im going to find his place of living address
for a translated piece its just {"translate":<key>} if im not mistaken
wait I think I found jefflib shit for this
so like {"translate":"diamond_sword"} or something
nvm 😭
you can test it out using /tellraw in the game
to actually set the json text to the items name, is kinda tricky because you need to use Bukkit.getUnsafe().modifyItemStack() as far as I know
for itemstack?
wait
couldn't find it
maybe in itemfactory
yeah
ItemFactory#createItemStack
The input should match the same input as expected by Minecraft's /give command
do you know what the key is? like in /tellraw @s {"translate":"??"}
for me always just outputs whatever is inside the quotes
it starts with this {display:{Name:'[
🤠
Yeah you could do that
well yeah, the key is whatever translation key you use
Idk if it's really better than NMS
yes, the "translate" component can translate anything from that list
not if sent to the server, atleast not on minestom
makes sense, these are used for client translation
the server just sends the item with teh json data
and then the client translates it
it works
awesome
/tellraw @s {"translate":"item.minecraft.stray_spawn_egg"} outputs Stray Spawn Egg
wow
/give @s acacia_boat{display:{Name:{"translate":"item.minecraft.stray_spawn_egg"}}} 1 this gives me a normal acacia boat, what am I doing wrong?
I found it
/give @s acacia_boat{display:{Name:'{"translate":"item.minecraft.stray_spawn_egg"}'}} 1
thanks to mcstacker.net
the only fucking give generator that supported translatable names
Choco, fyi I'm driving to your house and the only way to make me turn around is to make a PR to make translating shit bearable
new TranslateableComponent()
and how do I translate it for a player then
need components fully integrated into spigot @ choco
he better be
the translateable component is effectively the same as the translate json (since well, it serializes down to it)
u would supply the same translatable key
yeah so what exactly do I do with the component to translate it for a player
@worldly ingot You have an angry mob forming
I'm gonna implement the wither's AI into the nearest microwave to Choco and md_5 in 50 minutes if I don't see a hotfix
https://github.com/winnpixie/wp-smp/blob/main/src/main/java/io/github/winnpixie/wpsmp/commands/impl/HatCommand.java#L47-L52 exhibit A of spigot components but only for sending chat
Yes only chat supports components atm
theyre also for books iirc xd
who uses those
/rules but it opens a book lololol
Hey, I wanted to ask how I can give a player e.g. 5 diamonds
player#getInventory#addItem
oh yeah I have not found a way to do lore with json because you cant in vanilla either xD
but like what lore is there to translate
I know but how is the code correct? I have it like this
p.getInventory().addItem(new ItemStack(Material.WHEAT_SEEDS, 12));
WorldLoadEvent i imagine
Yeah, that's fine. That will work
Although it will give them 12 wheat seeds rather than 5 diamonds ;p
hi Choco :>
wait(); isnt working like how do i use it propperly?
you gonna pr better components, right?
context?
i have a player join event and i want
wait(5 (seconds));
thn it sends something in chat to the player
wait() is for threads.
whats wait from
Thread#wait()
?scheduling
I'm gonna commit blanket if I get another off-by-one error
My tab completer is suggesting for other commands but not for this one why?
https://paste.md-5.net/ezabapuyec.js
NPEs are more pleasant to deal with than this shit
can you show an example of a valid command?
i thimk that if player already have some wheat in inventory its not even gonna stack, and the inventory is full it's not gonna drop or anything
pleaseee
if they already have wheat, additem will stack, but not give extra if the inventory is full/cant take any wheat
oh
what are the players spamming?
i mean
you take the item and you cant place it in chest inventory but if you spam you can do it
but wait
Probably gets treated as an InventoryDragEvent
OOH
yes very likely
if you dont also cancel drag events in those cases it gets tricked
so you also want to cancel that?
you can check which clicktype was used
iirc event.getClickType or something like that
and then ignore anything that isnt simple left click
thanks
i think that still you can double left click and it takes items from chest inventory, but its not separate click type
bruh
oh there is double click
is there no double click?
i used event.getClick().
yeah
but when i use event.getClick() == ClickType. there is double click
ok i think i that will work
DOUBLE_CLICK is a separate click type
yeah
just do if (event.getClick() == ClickType.LEFT)
then return
well I assume not, depending on what you want to do
i mean not cancell
but it can be also right click or something
THERE IS SO MANY CLICK TYPES
yeah if the player uses a single left click you want to continue with teh rest of your code
well then make an or
yes yes
you'll figure it out
Why does this tab completer only suggest for the first three commands?
https://paste.md-5.net/suziniyiso.cs
the last one never works!
can anyone help:
I tried to do a delay for an event but it just sends nothing
public void onPlayerJoin(PlayerJoinEvent e) {
new BukkitRunnable(){
@override
public void run(){
Player p = e.getPlayer()
p.sendMessage("asdasd")
}
}.runTaskLater(plugin, 20 * 4);
}
i dont understand why it doesnt send anything to the player because it does send something to the console wich i included at the same height as the p.sendMessage
it also has no errors
hmm
well first off, for something small like this I would rather user Bukkit.getScheduler().runTaskLater()
and secondly, idk why it does not send the message
does it send a message if you dont put that in the runnable?
well its not actually this small its like over 100 lines
like instantly
Recreate with the code you sent
should i send ntire code of that class?
Sometimes players are not loaded in just after the join event o ntheir own screen.
yeah but this is like 4 seconds later
ye
maybe try even longer
but why would no delay work then?
?paste the entire method
hmm, okay well then it doesnt matter ig
It's not sending because of the Player#hasPlayedBefore() check
why?
Because #hasPlayedBefore() just checks to see if your playerdata in the world folder exists.
Since you have already joined before, your player file already exists.
i made an else{ so if the player HAS played before they get welcome BACK instead of just welcome
and i do get the message if i remove the runnable
what did it print to the console
Ok, I see the separation for the hasPlayedBefore
Couldn't tell at first due to the formatting. :/
However, I don't see any real issue with it's structure.
The only thing that could possibly be screwing up is the location check which would be why you aren't getting your message.
Hello! I am reading a Player-Inventory from some persistant storage I created, but Spigot somehow does not allow me to create it. It tells me that the size is incorrect
java.lang.IllegalArgumentException: Size for custom inventory must be a multiple of 9 between 9 and 54 slots (got 41)
final Inventory inventory = Bukkit.getServer().createInventory(player, dataInput.readInt());
the inventory has to be 9,18, 27, ... slots in size
create a bigger inventory, 45 in this case
Well I directly save the player-inv to the file and read it again
I need that size
well 41 is not a valid size, so idk how you save inventories to a file
are you trying to create a PlayerInventory?
I am backing up player-inventories to load them in as a a failsafe-mechanism
that'd only work with NMS. normal inventories created with createInventory() can only have a multiple of 9 slots
why don't you just use an ItemStack[] ?
im fine with using nms actually if its like not gonna break on every update
you dont assign player inventories with createInventory()
the players inventory always exists on a player
you can just replace its contents using player.getInventory()
omg thats gonna take a shit load of work to get it to run with ItemStack-Arrays
where are you even saving the inventory to? player's PDC?
json
how so? just use a Map<Integer,ItemStack>
can you show an example
got a serializer up already lol
where the integer is the original slot
then you just loop over it and set it back to the player's inv
{"id":"ae326c4b-88fe-3012-8a60-19fb39cae765","inv":"rO0ABXcEAAAAKXNyABpvcmcuYnVra2l0LnV0aWwuaW8uV3JhcHBlcvJQR+zxEm8FAgABTAADbWFw\r\ndAAPTGphdmEvdXRpbC9NYXA7eHBzcgA1Y29tLmdvb2dsZS5jb21tb24uY29sbGVjdC5JbW11dGFi\r\nbGVNYXAkU2VyaWFsaXplZEZvcm0AAAAAAAAAAAIAAkwABGtleXN0ABJMamF2YS9sYW5nL09iamVj\r\ndDtMAAZ2YWx1ZXNxAH4ABHhwdXIAE1tMamF2YS5sYW5nLk9iamVjdDuQzlifEHMpbAIAAHhwAAAA\r\nBHQAAj09dAABdnQABHR5cGV0AARtZXRhdXEAfgAGAAAABHQAHm9yZy5idWtraXQuaW52ZW50b3J5\r\nLkl0ZW1TdGFja3NyABFqYXZhLmxhbmcuSW50ZWdlchLioKT3gYc4AgABSQAFdmFsdWV4cgAQamF2\r\nYS5sYW5nLk51bWJlcoaslR0LlOCLAgAAeHAAAA0JdAATRElBTU9ORF9IT1JTRV9BUk1PUnNxAH4A\r\nAHNxAH4AA3VxAH4ABgAAAARxAH4ACHQACW1ldGEtdHlwZXQADGRpc3BsYXktbmFtZXQACGludGVy\r\nbmFsdXEAfgAGAAAABHQACEl0ZW1NZXRhdAAKVU5TUEVDSUZJQ3QAkHsiZXh0cmEiOlt7ImJvbGQi\r\nOmZhbHNlLCJpdGFsaWMiOmZhbHNlLCJ1bmRlcmxpbmVkIjpmYWxzZSwic3RyaWtldGhyb3VnaCI6\r\nZmFsc2UsIm9iZnVzY2F0ZWQiOmZhbHNlLCJjb2xvciI6ImdyZWVuIiwidGV4dCI6InRlc3RndW4i\r\nfV0sInRleHQiOiIifXQASEg0c0lBQUFBQUFBQS8rTmlZR0JtWUVuTXpjMW5ZR0FRNVdCZ1R5L055\r\nMHZNVFdWZ0wwa3RMZ0Z5R0FBQWZCbjdJZ0FBQUE9PXNxAH4AAHNxAH4AA3VxAH4ABgAAAARxAH4A\r\nCHEAfgAJcQB+AApxAH4AC3VxAH4ABgAAAARxAH4ADXNxAH4ADgAADQlxAH4AEXNxAH4AAHNxAH4A\r\nA3VxAH4ABgAAAARxAH4ACHEAfgAVcQB+ABZxAH4AF3VxAH4ABgAAAARxAH4AGXEAfgAadACQeyJl\r\neHRyYSI6W3siYm9sZCI6ZmFsc2UsIml0YWxpYyI6ZmFsc2UsInVuZGVybGluZWQiOmZhbHNlLCJz\r\ndHJpa2V0aHJvdWdoIjpmYWxzZSwib2JmdXNjYXRlZCI6ZmFsc2UsImNvbG9yIjoiZ3JlZW4iLCJ0\r\nZXh0IjoidGVzdGd1biJ9XSwidGV4dCI6IiJ9dABISDRzSUFBQUFBQUFBLytOaVlHQm1ZRW5NemMx\r\nbllHQVE1V0JnVHkvTnkwdk1UV1ZnTDBrdExnRnlHQUFBZkJuN0lnQUFBQT09cHBwcHBwcHBwcHBw\r\ncHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBwcHBw\r\n"}
``` thats an inventory lol
its b64-encoded
you can easily turn that into an itemstack array
im using BukkitObjectOutputStreams for it
oh i see
Hi, im using https://github.com/Acquized/ItemBuilder/blob/master/ItemBuilder.java , for make items in the gui but if i do
new ItemBuilder(ItemUtils.deserialize(plugin.getConfig().getString("items." + String.valueOf(plugin.getConfig().getInt("Legendary")) + ".itemstack"))).lore("aaa").build()
items with already having lore just don't get added
yeah you see where this is going
https://github.com/JEFF-Media-GbR/JeffLib/blob/master/core/src/main/java/com/jeff_media/jefflib/ItemStackSerializer.java#L207 turns a base64 thing into an ItemStack[]
well its hardcoded to use Inventories in a load of classes, thats gonna take like an hour to fully change lol
ig your are right... i moved the plugin to a local server and i got this error:
at com.google.common.base.Preconditions.checkArgument(Preconditions.java:145) ~[guava-31.1-jre.jar:?]
at org.bukkit.craftbukkit.v1_19_R2.entity.CraftPlayer.teleport(CraftPlayer.java:875) ~[spigot-1.19.3-R0.1-SNAPSHOT.jar:3670-Spigot-454acb7-bd29f41]
at org.bukkit.craftbukkit.v1_19_R2.entity.CraftEntity.teleport(CraftEntity.java:514) ~[spigot-1.19.3-R0.1-SNAPSHOT.jar:3670-Spigot-454acb7-bd29f41]
at me.lostplugins.electragens_v2.core.listeners.SpawnListeners$1.run(SpawnListeners.java:94) ~[?:?]
at org.bukkit.craftbukkit.v1_19_R2.scheduler.CraftTask.run(CraftTask.java:82) ~[spigot-1.19.3-R0.1-SNAPSHOT.jar:3670-Spigot-454acb7-bd29f41]
at org.bukkit.craftbukkit.v1_19_R2.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:415) ~[spigot-1.19.3-R0.1-SNAPSHOT.jar:3670-Spigot-454acb7-bd29f41]
at net.minecraft.server.MinecraftServer.b(MinecraftServer.java:1249) ~[spigot-1.19.3-R0.1-SNAPSHOT.jar:3670-Spigot-454acb7-bd29f41]
at net.minecraft.server.dedicated.DedicatedServer.b(DedicatedServer.java:388) ~[spigot-1.19.3-R0.1-SNAPSHOT.jar:3670-Spigot-454acb7-bd29f41]
at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:1201) ~[spigot-1.19.3-R0.1-SNAPSHOT.jar:3670-Spigot-454acb7-bd29f41]
at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:1017) ~[spigot-1.19.3-R0.1-SNAPSHOT.jar:3670-Spigot-454acb7-bd29f41]
at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:301) ~[spigot-1.19.3-R0.1-SNAPSHOT.jar:3670-Spigot-454acb7-bd29f41]
at java.lang.Thread.run(Thread.java:1589) ~[?:?]
like how do i change that
what's itemUtils.deserialize? why don't you just use Config#getItemStack() ?
its converted to base64 and uses way to saves everything like nbt data
an hour doesnt sound too bad xD but anyways, you can't just paste over a players inventory like you were probably expecting
is base64 the new hot thing or something
getConfig().set(...) and getConfig.getItemStack() does the same, even without needing base64
b64 is based lmao
I guess its more memory efficient
cant argue with that ig
Change how you check the location. How are you storing the location in your config?
im actually gonna call my encoder-class Based64 now LMAO
for my memory increase
its the same, but just different on memory and other aspect, that's not where my problem is, but on the itembuilder that i don't know why doesn't add to the lore new lines
well im just using the bukkit thing idk
config.yml:spawn: ==: org.bukkit.Location world: world x: 88.89112902463155 y: 63.0 z: -98.84846046743206 pitch: 10.566455 yaw: 80.50126setspawn class:```Location location = p.getLocation();
plugin.getConfig().set("spawn", location);
plugin.saveConfig();```
have you asked the developer about the issue? the way you are using it seems like it would work
well did that other server ever save the location? if not then that's the issue
also what line of code is that error on
The whole thing should only serve to ensure that the player should get the item once for the first join
Is there a way to split up my plugin in like modules
so the server owner can decide which parts of the plugin they want
like im more asking about how to device up the jar file and not about teh logic I would need to manage these modules in the "main" plugin
the most obvious route is to split it into smaller plugins but I am wondering if there is a better way to do it
pls @ me when replying
hmm
@Override
public @NotNull int getAirBlocks() {
int airBlocks = 0;
final Location loc1 = getLoc1();
final Location loc2 = getLoc2();
final BoundingBox box = BoundingBox.of(loc1, loc2);
for (int x = (int) box.getMinX(); x <= box.getMaxX(); x++) {
for (int y = (int) box.getMinY(); y <= box.getMaxY(); y++) {
for (int z = (int) box.getMinZ(); z <= box.getMaxZ(); z++) {
Block block = loc1.getWorld().getBlockAt(x, y, z);
if (block.getType() == Material.AIR)
airBlocks++;
}
}
}
return airBlocks;
}``` how would i improve this?
if possible
this will be on an async thread so i ain't too worried but
still
won't that just give the player the items without caring about the slots where the IS is in?
well
not really
if you take the array is always teh same size, being the amount of slots
then you can set the items 1 by 1 for each slot
ohh so its always the right size
if you keep the order ofc
yeah
and empty slots will just be null or air or something
so I do #getContents and #setContents
do I need to do that manually or is it already done with #get/setContents?
aight ty
especially since getContents can contain null for empty stacks, so it will always be the size of the whole inventory regardless
thats nice of the spigot devs lol
yeah this is why OG arrays are good
my GUI-System is really getting messy lol
yikes
I was too lazy to make an actual API for it, so I got like half an API
with an external failsafe lol
my failsafe is actually kinda 5Head
How i can get the message that user write?
Chat message or commands too?
Only chat message
AsyncPlayerChatEvent
AsyncPlayerChatEvent
O thanks
Then event.getMessage()
AsyncPlayerChatEvent#getMessage()
How can i reduce the lag caused by a runTaskTimer?
what do you do in the timer
add and remove players form a scoreboard team
For some reason, this rayTrace is returning null when I'm looking at a Pig. Any help? java RayTraceResult rEntity = p.getLocation().getWorld().rayTraceEntities( p.getLocation(), p.getEyeLocation().getDirection(), 3, entity -> !entity.getName().equals(p.getName()) );
entity.getName()?
Perhaps, I'm trying to make it not just do the player whenever it ray traces
lemme see if I just do entity -> entity != p
Nop,e java RayTraceResult rEntity = p.getLocation().getWorld().rayTraceEntities( p.getLocation(), p.getEyeLocation().getDirection(), 3, entity -> entity != p );
This still returns null
how do you know its coming from the timer
hey there mongodb folks, is creating connection on every query attempt a bad idea? (like hikari datasource.getConnection), so i just create MongoClient everytime i want to save a data or get it (i also cache player's data and save them whenever the quit or server stops) 🔥
Does anyone know how to make a random integer generator within a range
new Random().nextInt(bound)
where bound is your range
or you can use ThreadLocalRandom class
or you can divide the random number by your limit and get the left number
which is number %
int rangedRandom = ThreadLocalRandom.current().nextInt(min, max);
any help??
🔥 🔥
yeah thanks
just one problem with Random.nextInt the bound is exclusive so if i want to include it do i just do bound + 1
nvm, got my answer in the docs
Why does RayTraceEntities not pick up animals or mobs?
just one problem with Random.nextInt the bound is exclusive so if i want to include it do i just do bound + 1
uh yes
because (number % max) is always from 0 to max - 1
How could i optimize this taskTimer ?https://github.com/Gurwi30/DynamicNametags/blob/master/src/main/java/me/gurwi/dynamicnametags/tasks/PlayerNTManagerTask.java
well
reuse variables
also ?workdistro
fuck
?wd
whatever
Witch variables should i reuse?
only command at the front works
BlockPhysicsEvent yeyeyeye
How i can make that the config will save on exact number? idk how to name it
hi guys , someone have any idea?
oh im stupid
thx
but the error is the same
on "Componentecc , the ";"
like this? Component.text("[item]").clickEvent(DisplayItem.open(player));
same problem
lmao
hover over the error
oh so i need to create a command for gui and use it on click event?
ok thx 🙂
oh ok
If a wirher skull is placed on the ground is it "WITHER_SKELETON_SKULL" or "WITHER_SKELETON_WALL_SKULL"?
I get that but my code doesn't detect it
Must be an error on my end then
Hello, you ask how do I make my config.yml file save the comments? with spigot 1.8.8
Use a library or write to the files manually.
I already found the mistake. I had the coords wrong. Absolutely had nothing to do with the skull type XD
Hello, you ask how do I make my config.yml file save the comments? with spigot 1.8.8
First result on Google
someone know ?
know what
the problem?
well we cant know unless you describe whats wrong
Component is not in spigot
if your using adventure components and want to send them to players you need to use papers api
do you know java @lavish cliff
Does the server know which way water/lava is flowing?
ye?
yo dm5
i've been stuck with a problem nobody have seems to be able to answear
i can't grab the result item?
How i can do without paper api?
wich alternative
k thx
Idk might be a bug, open a bug report
could it be the fact you set the item and result
event.setResult(result);
&
inventory.setItem(2, result);
try removing the Inventory#setItem
i tried that too
is there a way to get an enchant by its namespacedkey?
like "crazyname:somethinghere"
oh, tks
hello guys im having issue with custom bungeecord channels
messageController = new SpigotMessageController("premiumcore:main"); getServer().getMessenger().registerIncomingPluginChannel(this,"premiumcore:main",messageController);
SpigotMessageController implements PluginMessageListener
`@Override
public void onPluginMessageReceived(@NotNull String channel, @NotNull Player player,@NotNull byte[] message) {
//Check if this channel is handle by our controller
System.out.println(channel + " == " + this.getChannel());
if (!channel.equalsIgnoreCase(this.channel)) {
return;
}
//Read the subchannel
ByteArrayDataInput in = ByteStreams.newDataInput(message);
String subchannel = in.readUTF();
String[] args = in.readUTF().split(":");
//Execute the action
if (subChannelsActions.containsKey(subchannel)){
subChannelsActions.get(subchannel).run(channel,subchannel,player,args);
}
System.out.println("received from bungee to spigot ("+subchannel+")");
for (String s : args){
System.out.println("<- "+s);
}
}`
the problem is I never got when I receive a plugin message it never even printed to first line being System.out.println(channel + " == " + this.getChannel());
Anyone can help?
Kind of just throwing this here, couldn't immediately find much while doing CTRL+F. Is there a way to make a particle last longer when it has spawned?
Generally searched the <player>.spawnParticle() function overloads, and couldn't quite see a great way of doing it that was obvious
particle animations have a fixed life span
Most unfortunate.
anyone know how to make a /nick command similar to hypixel that changes the players skin?
thx broski
np
Hey, if i try to remove only 1 item from a dispenser inventory it works unless the itemstack has an amount of 2 or 1... why is that the case?
I only remove 1 item and its working with every size but 1 qnd 2 not whyyyy
are you looking to remove 1 from an itemstack?
if so you can get the item meta and set the amount this way (I think)
Amount is not part of meta
Either way there is a remove method that takes the number you want to remove as a parameter
I believe its removeItem
thanks for the correction
hello, is there a bug on the InventoryClickEvent? Because when I pickup an item the type is "PLACE_ALL" (spigot 1.19.4)
maybe? the bug tracker is here https://hub.spigotmc.org/jira/
i want to cancel the action of a player trying to take off its armor, what event detects that?
Several
Mainly the click event but https://www.spigotmc.org/resources/lib-armorequipevent.5478/ should catch anything else
thanks
how to get the updated inventory of a player in a InventoryClickEvent pls?
Just event.getInventory() should be the up to date one
Is it possible to show HEX colors in Inventory titles?
Sure
Yeah it is, I've done it multiple times.
I’m pretty sure they work everywhere
Not teams though like above head names
Hello , its been a while ..
iam having a problem with The Fire Check .. it does not work right .
what happen is that player die .
but my system is diffrent player is not acctully died ..
the second message is when i kill player normally .
if i attack him with a sword that have enchants (Fire Aspect) and he die because of the fire , the code will not work , is there other kind of check i can do?
Any reason you're not using PlayerDeathEvent? o.O
Yeah, wouldn't it make sense to use the PlayerDeathEvent, if player deaths are involved.
make sense *not to use it?
well i just want to make my own death system .
and iam not sure if its bad or not , but iam calling the PlayerDeathEvent , because this system will break other plugins that depend on PlayerDeathEvent .
Good night ..
Is it also possible to show them when updating the title of the inventory using NMS?
Nms? Why?
There's no need to use NMS?
I don't think nms will help you, there's no update title packet
The inventory has to be closed and opened again
Closing and opening is best way, user will only notice a small flicker anyway. It opens and closes pretty quick if you don't use timer for it
Isn't it packetPlayOutOpenWindow
Yes, that's the open inventory packet. It opens an inventory
7smile7 did a demo of inventory name changing (no flicker)
Im getting this error when making my jar. it downloads fine and I use it in my project, but I can't compile!
he won;t be on til later as he's in Germany
?maven
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
Im doing the exact same thing in another project and its working. This is taken directly from that page.
It doesn't say it searched the spigot repo
Probably something to do with the positioning of your content tag
Idk don't use gradle
Have you tried closing the ide and opening it again, that sometimes resolves those kind of issues
yep
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
It's only looking at the last one
That's a good point. You only should have 1 url per maven block
yep that fixed it
repositories {
mavenLocal()
maven {
url = uri('https://hub.spigotmc.org/nexus/content/groups/public/')
}
maven {
url = uri('https://repo.extendedclip.com/content/repositories/placeholderapi/')
}
maven {
url = uri('https://repo.codemc.org/repository/maven-public')
}
maven {
url = uri('https://jitpack.io')
}
maven {
url = uri('https://repo.maven.apache.org/maven2/')
}
}
so confused how it worked in another project
It’s possible you had it in your local repo for that project
The open window packet, if you send the same window id, updates the inventory's name
Though it's a bit of a quirk in the client
I can't imagine it's intentional behaviour
just asking, but the worldborder.getSize() means its radius right?
bit new to java, but how do i make a perm variable?
meaning i can use it globally throughout my entire plugin
I mean if it’s constant it’s probably fine to make it static
Otherwise you may want to consider
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
wym?
If it doesn’t change
yeah it does lol
trynna make an eco
oh wait i did it right i just wasnt calling it right
a useful quirk though
For 1.19.3 what api-version: and <maven.compiler.source> version should I be using?
1.19 for api version, and atleast 17
so
api-version: 17
<maven.compiler.source>17</maven.compiler.source>
?
so api-verison 19
1.19
api-version: 1.19
<maven.compiler.source>17</maven.compiler.source>
yeah
Yep
Thank
The day we finally moved on from java 8 was wonderful
I do hope Mojang at least somewhat keeps up with LTS releases if they can
its like every 3 years, so hopefully
Next lts is 21, 21 dev builds are out
ew did they actually bring it down to 2 years
Seems like it
does anyone actually use maven or gradle to run a test server?
a few people might but imo its not worth it
gradle might have more people than maven because the run-paper plugin
Does anyone know a good tutorial for holograms using nms?
Idk what the advantage of using your build system to run a server is
What is your opinion about the project "Folia"?
me neither, but it gets asked quite often so I wondered whether anyone actually does it
How would you guys realize a block with a name tag on top of it? Just with a armor stand that is invisible?
why do you need NMS for that?
use a TextDisplay
meh
it'll be good for insane player count servers but for normal servers theres no point to it
wouldn't it help with performance because the server doesnt need to keep track of the entity?
How can I use this? Is it just a text that spawns at a specific location?
use 1.19.4 and a text display
i run my servers on 1.8.8
Haha
it's more compatable and stable
what about new features
all the new biomes, deeper caves, new blocks, non ticking entities, updated combat system, revamped nether etc etc
IIRC armorstands marked with "isMarker" or whatever also don't tick
All the blocks all the features... Oh damn
kinda, yeah
Ok
you just spawn it like a normal entity
Sounds fun
there's also BLockDisplay and ItemDisplay
What's IIRC lol
if i recall correctly
So this is the same bit with blocks and items right?
yep
np
is there any shortcut in intellij to "remove everything to the left (or right) of the current cursor"?
uugh what the - can github wikis be edited by everyone, without any confirmation/approval? 😮
they can?
well if you click shift + home then delete or shift + end then delete
idk I just changed the wiki on ACF, I thought I changed it on my fork but apparently I changed it in the actual repo
yeah sure but I'd like to do it in one thing
what page on the wiki
shift + home + delete would work xD
Github love confusing you what page/fork you are actually on
huh
yep, says you edited it
thats not vulnerable at all
minigames are better in modern versions lol
everything's better in modern versions
bUt ThE PvP 😭 😭 😭
1.19.4 just added more stuff that makes more attractive making minigames in modern versions
imagine if hypixel's bedwars quality with 1.19.4 display entities
it's better
it allows you to make weapons with cooldown and even have an animation
its a shitty excuse as well
if you just want to spam click go away and stay in 1.8 or learn php and do bedrock stuff
"1.8 pvp is better because it doesnt require skill nor timing, its about who has the fastest autoclicker. And THAT is what we 1.8 users consider to be skill!!!!11one"
"but i drag click not use an auto clicker"
tldr; 1.8 users like 1.8 pvp because they are not skilled enough for actual pvp
imagine watching yt videos about which mouse is better for either drag click or butterfly click
save your money, dont buy mice and just enjoy modern minecraft
that's my tip 🗿
i wonder if i should start using xyz.epicebic as my package
that means effort
so probably not
Hi everyone, I'm programming a plugin with Dependency Injection in version 1.8. I'm using Google Guice (v4) and the Maven Shade Plugin for building.
This has worked well in the past, but now I keep getting the following error:
com.google.common.util.concurrent.ExecutionError: com.google.common.util.concurrent.ExecutionError: java.lang.ExceptionInInitializerError
I haven't made any code changes in the plugin or modified any versions in the POM, so this error is not quite clear to me.
(Even with a completely empty project, this error now occurs.)
Thanks a lot for your help 😄
show the full stacktrace
Here's the full stacktrtace: https://pastebin.com/hPJRSQKX
new kb is really bad for block clutching and new versions feel a lot slower
paste the complete SimpleGuicePlugin pls
yep, the source code of your main class
I'm going to guess you changed your java version on your server to 14+
let's head to #general
it's still on 1.8.8-RO.1-SNAPSHOT
does that break it? did I just got another reason to hate guice with all my heart?
Java version not spigot version
oh, that could be. Let me check
reflection error
var packet = new PacketContainer(PacketType.Play.Server.PLAYER_INFO);
packet.getPlayerInfoAction().write(0, EnumWrappers.PlayerInfoAction.UPDATE_DISPLAY_NAME);
```Crashes on ProtocolLib `4.7.0` with the error `Field index 0 is out of bounds for length 0`, anyone know why?
Is there a replacement for using for-each loops in Locations? Cause it doesn't support it I guess
question doesn't make much sense
ofc you cannot for-each Locations, they are not Iterable
Well yea, but I want something with the same "expected" result
there is no expected result. You are asking a question which makes no sense
what are you even wanting to loop over on a location
I have a bunch of locations in config file and I want to loop through them
would be helpful if you could show your config
uh they're in "Locations", saved as a HashMap
show ur config
Sec
ok so its a MemorySection
Yes that was the solution, thanks for your help 😄
um thats not a map
what even is that
a HashMap saved in config
nope
first you should do material location and material isnt yaml serializable you should save a string
so HashMap<String, Location>
and .toString the material
okay
hes moved to paper
what would you rather have in your configs
entry: <color:red>Hi!
entry: {"text": "Hi!", "color": red}
hoenstly I feel like this one is a no brainer
what saves stuff like that
top one
components are just json
@tender shard is TextDisplay not a class in the spigot api?
are you in 1.19.4
1.19.3
you dont have text displays then, gotta use armor stands
can i change to 1.19.4?
yeah
like this?
have you ran buildtools for 1.19.4?
latest isnt updated yet
k thx
so there are no bt for 1.19.4?
there is
there are
but you have to specify
you just need to use --rev 1.19.4 not --rev latest
ah ok
and not just call latest
ye
how else is help dev gonna fuction
😄
for the content it shows https://hub.spigotmc.org/javadocs/spigot/org/bukkit/entity/TextDisplay.html#setText(java.lang.String)
declaration: package: org.bukkit.entity, interface: TextDisplay
but I cant call TextDisplay.setText(); for example
do you have a text display entity
like this?
nope
TextDisplay textDisplay = (TextDisplay) Bukkit.getWorld("world").spawnEntity(new Location(Bukkit.getWorld("world"), 0, 100, 0), EntityType.TEXT_DISPLAY);
textDisplay.setText("cool text");
ye true i just figured it out myself
and how can I set the direction in a way that the text is always looking to me?
declaration: package: org.bukkit.entity, interface: TextDisplay
Its an Entity so setRotation
but i have to use a loop for this right?
so that the rotation updates?
if you set the correct type it always looks at you
wdym?
dont remember the method but text displays have a type, billboard, horiztonal and something else iirc
and i can use this so that it looks at me?
declaration: package: org.bukkit.entity, interface: Display
fucin
pc loves to not copy stuff
textDisplay.setBillboard(Display.Billboard.CENTER);
how i can make that the spawn on save dont delete the prefix and comments?
first line of onEnable saveDefaultConfig();
?nocode
It’s hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.
and delete teh options line, it's junk
getConfig().options()...
OOoh
and its will work?
yes
ok i will test it
@Override
public void onEnable() {
Bukkit.broadcastMessage(ChatColor.YELLOW + "Loading config file...");
Hi, I want to broadcast a message when the plugin is loaded. Unfortunately, it doesn't send anything in chat, is it possible to do it?
nothing wrong with that, other than no one is online to see it
it delete it
You'd need to use the reload command to see it
It doesn't show up in the logs, and players are online, if I use /reload
The 1, when i dont use /setspawn and 2 its when i use /setspawn
Hello, I'm programming a ChestShop plugin and I want to get the block behind the sign but it only works on oak sign
thats all fine
?nocode
It’s hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.
But why its delete prefix?
i know that it works when prefix in config is delete
but whats the issue
it can only delete it if you have not saved the default one
I'm going to guess you havn;t deleted teh bad config.yml from your server
Caused by: java.lang.ClassCastException: org.bukkit.material.MaterialData cannot be cast to org.bukkit.material.Sign
``````java
Sign sign = (Sign) e.getBlock().getState().getData();
Block attached = e.getBlock().getRelative(sign.getAttachedFace());
Wrong Sign import
i delete it
isn't materialdata deprecated
yeah
probably
thats all fine
another reason could be you forgot to update the jar on your server
Hi
yo
Hi
?nohello
xd
dam
There is an airdrop plugin spigot
sounds like a #help-server question
got an answer in general too
Oh yea
its work now
thanks
but you know how to gat space between them?
and this comment bellow will be on the top of this spawn?
bukkit serializable to yaml
to users know whats is does?
makes me cry
define the key before hand
You can;t add spaces
What? i dont understand
spaces and comments will be preserved from the original
you have the comment then nothing, add the spawn after the comment
add a spawn: in the default
then it will appear at the spawn
just nothing under it
like this
yeah
If your default config has all the keys when you call .set they will be replaced
if you have a comment on a node you have to add it when you set
how to do that
i dont undersrand because i dont understand English well
getConfig().get(path).setComm...
Oh
or addComment, something like
what path i need?
Inventory#removeItem() problem
"spawn" will be the path
it will be on top of this spawn code?
iirc yeah
why its on red?
it takes a string list
the method takes a List<String> for the last paramater so use List.of("string")
its on red
hover over it
ah, should be able to use Arrays.asList("test") instead
might need to set comments after, but should work
any ideas?_?
If the damager is a player, the damage won't be caused by fire
Jist listen to the playerdeathevent and call player.spigot().respawn();
that's not the soultion i want ..
but thanks
Your code is extremely flawed
I'd recommend listening to EntityDamageEvent instead
And checking instanceof EntityDamageByEntityEvent to get the player
people straight ignoring warnings 💀
i got it working by using EntityDamageEvent
hi guys, how can I change time for runTaskTimer()?
okay 😦
wait I just found out about the new text displays, so are they just the better way of doing holograms compared to armorstands?
You probably can get away with using java 16 instead of 8, depending on what version you're making the plugin for
1.19.2
Yeah definitely can use java 16 then
then you need to update java version in your config
I dont even know if you can use anything other than 16 for 1.19
Update java version in the pom file from 1.8 -> 16 and in the project settings of intellj set language level to 16
Why not use Java 17?
Ok
thanks
where i can find this project settings
if you use Idea: File -> Project Structure
Thanks
Use a number as key and iterate over the keys of the blocks configuration section (config.getConfigurationSection("blocks") and blocks.getKeys(false))
I can show an example but Im unable to access a PC to get one right now
no problem, I can wait. I have a lot of time
Guys tell me pls how i can make minecraft 1.7.10 query plugin for versions 1.6.4 and older?
my code:
public static void main(String[] args) throws Exception {
startServer();
}
public static void startServer() throws Exception {
ServerSocket serverSocket = new ServerSocket(8080);
logger.info("[Query] Starting server on " + serverSocket.getLocalSocketAddress() + ":" + serverSocket.getLocalPort() + " ...");
while (true) {
Socket clientSocket = serverSocket.accept();
OutputStream outputStream = clientSocket.getOutputStream();
PacketProtocol protocol = new PacketProtocol(clientSocket.getOutputStream(), clientSocket.getInputStream());
protocol.read();
protocol.write();
outputStream.flush();
clientSocket.close();
}
}```
public class PacketProtocol {
private StatusQuery statusQuery;
public PacketProtocol(OutputStream out, InputStream inputStream) {
this.statusQuery = new StatusQuery(out, inputStream);
}
public void read() throws IOException {
statusQuery.readVarInt();
statusQuery.readVarInt();
statusQuery.readVarInt();
statusQuery.readString(0);
statusQuery.readShort();
statusQuery.readVarInt();
statusQuery.readVarInt();
}
public void write() throws IOException {
statusQuery.writeVarInt(0x00);
statusQuery.writeString("{ \"version\": { \"name\": \"1.19.3\", \"protocol\": 761 }, \"players\": { \"max\": 100, \"online\": 5, \"sample\": [ { \"name\": \"thinkofdeath\", \"id\": \"4566e69f-c907-48ee-8d71-d7ba5aa00d20\" } ] }, \"description\": { \"text\": \"Hello world\" }, \"favicon\": \"data:image/png;base64,<data>\", \"enforcesSecureChat\": true }", 0);
statusQuery.stream.flush();
}
}
1.6.4???
}else if(args.length == 1){
if(args.)
plugin.reloadConfig();
}
How i can make (idk how to name it), that when the name of args in command is reload, its reload the plugin, but when its the help, its show help commands
oh thanks
you don't need a time machine to travel to the past if you are in this channel 😅
what scoreboard plugin is good?
Slp probably
