#help-development
1 messages · Page 1651 of 1
How from PermissionCheckEvent i can get all the permissions of all the bungee plugins?
You would need to index all plugins
do Player variables delete when the player in question disconnects? cuz i have a hashmap which is a player that corresponds to an inventory but the player no longer corresponds to that inventory if the player disconnects
https://gist.github.com/b1e1c5b23449f3d38d1dcb13ba8b1af3 ik the way executed isnt efficent, but why doesnt it cancel fall damage
Idk but at least they have a PermissionRegistry to cache every permission checked
Team timezone = board.registerNewTeam("timezone");
timezone.addEntry(ChatColor.GRAY+ "" );
timezone.setPrefix(ChatColor.GRAY+ TimeZone.getTimeZone("GMT+05:30"));
so i am trying to put time on a scoreboard error in 3 line
im testing it on tuinity btw
No, no variable will automatically become null just like that or deleted
i tried to pass all the plugins and somehow get their permissions
However player objects become broken once their host disconnected
oh, is there a way to make it so it always corresponds to that player whether theyre offline or not?
One way is to use UUID
Why though?
so their inventory doesnt disappear when they dc
It by default is persistent
i made a customentity , i want to check if that customentity exists in the world and if does not , do something
no its a vault inventory
Sounds like you want to leak ram
Hmm you should store the vault inventory
^^
I hate this permissions topic.He is really annoying
Save to a file
yeah
You can just use the configuration api
Saving things in yaml. Not the most efficient storage but will be easier
I think i found a way!
Its really from PermissionCheckEvent
and i print every time when the event is turn on the permission that he check
.
if ! entity.isDead() ?
https://prnt.sc/1qdtblo what means the Z keyword ?
So this is suposted to make a new selection in the config and + 1 when ever its ran - But instead it doesnt + 1 and it removes everything in the config ( like all other options? )
oh i think i get why
because each time i click on paper
its re-doing all that code right ?
SO
its remaking the value as 1
but im not sure
@ivory sleetThank you so much man! apparently when a player is enter to the server the event is goes through on all the permissions of all the bungee plugins and thats the way to get all the permissions
Cheers
how to change config section name without deleting spigot
Wtf
idk where to even begin with that
i said already
idc about how long it is
i just care why it doesnt execute
the length of it is not the main issue...
i know
anyway how are you registering it
getCommand("bigkaboom").setExecutor(new BigKaboom());
Hello. Can i set the GUI-Saize from the player on my server?
AAAaahahaha
?
oh
my
fucking
god
you also check for if the command equals "bigspecific"
lmfao

i. dont. care, about. the. length. it executed. before.
can u guys help him instead of this brainless argument
so you need to register the "bigspecific" command
you do it
use getCommand("bigkaboom").setExecutor(new BigKaboom(this));
okay, so i got this code (probably messy, that's not the issue tho)
private void breakOrePart(Block startBlock) {
if (isOre(startBlock)) {
startBlock.breakNaturally();
for (BlockFace face : blockFaces) {
Block newBlock = startBlock.getRelative(face);
Block newBlock2 = startBlock.getRelative(face).getRelative(BlockFace.UP);
Block newBlock3 = startBlock.getRelative(face).getRelative(BlockFace.DOWN);
if (isOre(newBlock)) breakOrePart(newBlock);
if (isOre(newBlock2)) breakOrePart(newBlock2);
if (isOre(newBlock3)) breakOrePart(newBlock3);
}
}
}```
it works nearly perfectly, except... it's not dropping any experience... and i couldnt find a way to drop xp.. is there a way?
im not the one laughing
so? whats your point
also that listener will never fire since you never implement listener in that class
its gotta be a joke
guys
help him or shut your disgusting mouth
IDFC ABOUT EFFICENCY
bruh dont argue in a fukin help server
Oh My God
its my plugin and my choice. period.
"distinguishing"
Wtf
no one care that you dont care, i gave u the thing u need to change end of convo 👀
god, where did i got into
Try passing an ItemStack for breaking the block
check the channel name
Pillow have you tried debugging with print statements or something?
ik
oh sorry i mean chanel
anyone know about this
and this is the same issue ( kinda )
So the command isn’t performing at all?
How far did the code go?
wdym? like... the breakNaturally breaks everything... but it doesnt drop experience
No
and with ItemStack, i don't see any way to drop xp
im changing my config section name, ur changing its value
declaration: package: org.bukkit.block, interface: Block
You asked in a public channel, people have the right you give you advice whether you care or not tbh
I disagree
i meant that about the not efficency thing
like ik its not efficent
Good for you, don’t care
either help him with his question or shut your mouth
Toxic
you're just annoying
Does the command execute at all? Add a sysout in the very first line to check pls.
Look who’s talking
As long as it isn’t insults and harassment I see no problem with giving general advice
Breaks the block and spawns items as if a player had digged it with a specific tool
items
i want experience :o
am i just as dumb as almost everyone in here rn?
? anyone know
?
They're just harassing him
i did, it returned nothing
"LMFAO" "LMAO" on someone who's trying to learn isn't helpful
I haven’t read the convo
Exactly
u tryed this?
I agree but that’s not what I was referring to anyways. You don’t have to be toxic and tell people you find annoying to shut their mouth
yes, it doesnt agree with the this
So the command doesnt execute at all? Do you get any exceptions when your plugin gets enabled?
no, all is clear, the command just doesnt execute
the console is clear
and you registered both bigspecific and bigkaboom in your onEnable and plugin.yml?
si
Hello. Can i set the GUI-Saize from the player on my server?
they should learn basic java before learning spigot
this is a shit show
This is a problem with binary outcome.
- Your command executes
- The command isnt registered and you see an exception
ah ok
Elaborate?
Anyways you can always determine the size at creation of an inventory
So this is suposted to make a new selection in the config and + 1 when ever its ran - But instead it doesnt + 1 and it removes everything in the config ( like all other options? )
https://cdn.discordapp.com/attachments/741875863271899136/878633874157109258/unknown.png
oh i think i get why
because each time i click on paper
its re-doing all that code right ?
SO
its remaking the value as 1
but im not sure
okay so... i tried that, still no xp :3
but yk whats not a shiz show? our sponsor nord vpn
imagine playing mc in german
No u can’t
No. Thats client side
Custom client
Not possible. Can I do it with a resource pack?
nope
nope
nope
Why do you want to set this anyways?
but then items will be weird moved
Because of this
So this is suposted to make a new selection in the config and + 1 when ever its ran - But instead it doesnt + 1 and it removes everything in the config ( like all other options? )
https://cdn.discordapp.com/attachments/741875863271899136/878633874157109258/unknown.png
oh i think i get why
because each time i click on paper
its re-doing all that code right ?
SO
its remaking the value as 1
but im not sure
mod or custom client, literally your only two options
yep
Can I make it smaller then?
you can use \n in descriptions
Hm. What version are you on? If nothing works then you have to spawn the experience manually by getting the block type that was broken.
or use shorter descriptions
1.17.1
i want to check if a world has a custom entity that i made , how would i check
newest
Yep
huh?
You need to keep track of your custom entities. They are only loaded if the chunk they are in is also loaded.
So on ChunkLoadEvent -> scan for your custom entity and on ChunkUnloadEvent -> persist your custom entity
i mean... i got the xp amount... but i see no way to drop experience at all
is there a method like dropExperience(amount)?
i am asking how would i scan for my custom entity
PDC
or just an instanceof?
public void spawnExp(final Location location, final int amount) {
final World world = location.getWorld();
world.spawn(location, ExperienceOrb.class, exp -> exp.setExperience(amount));
}
yo i might have found the issue, i just wasnt careful
?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.
thats the issue
god, what a messy way... but if that works :3
do i care? no!
then fuck off
no u
dont ask for help
bro
it's his choice to do it his way if he wants
there is no point in trying to convince him to do otherwise
leave
his choice but he will suffer long term
no one wants you here
no
Can I create a link, that redirects the player to the minecraft settings?
?paste
Or link that sets the gui size
So this is suposted to make a new selection in the config and + 1 when ever its ran - But instead it doesnt + 1 and it removes everything in the config ( like all other options? )
https://cdn.discordapp.com/attachments/741875863271899136/878633874157109258/unknown.png
If he wont learn basic java then he is wasting peoples time by posting here
bro.. its called #help-development
Yes, not basic java help
whatever
idc
not without a mod, no
dont be an ass to people and they wont be an asshat back
And that?
nope
Sad.
bro im like actually the most polite person in my class, and this is what i get lol
https://prnt.sc/1qdtblo what means the Z keyword ? please
https://paste.md-5.net/upoyihugul.java click event
https://paste.md-5.net/xevebifoxu.java chat event
so i want when a player shift clicks an item in an inventory
it changes the config to the next message he sends in chat
shorten the lore to make it fit, and use less spacing or a word wrapping util
Yes. i see. I have to do iz
yeah btw i am sorry for asking these kinda basic q's
I'd think so , yes
were you a mod in sound's world
maybe , why?
What is sounds world?
its a discord server
yes
doesn't work :(
For spigot?
https://paste.md-5.net/upoyihugul.java click event
https://paste.md-5.net/xevebifoxu.java chat event
so i want when a player shift clicks an item in an inventory
it changes the config to the next message he sends in chat
and the item gets renamed too because the item name is based off the config
but the item just becomes "null"
and the config doesnt change
Should work. Try it outside of your code
7smile can u help ?
In a sneak event or something
Nope ill be cooking in a min sry
o
So this is suposted to make a new selection in the config and + 1 when ever its ran - But instead it doesnt + 1 and it removes everything in the config ( like all other options? )
https://cdn.discordapp.com/attachments/741875863271899136/878633874157109258/unknown.png
oh god, my bad, i'm just dumb asfuck
private void breakTreePart(Block startBlock, int exp) {
if (isLog(startBlock)) {
startBlock.breakNaturally();
for (BlockFace face : blockFaces) {
Block newBlock = startBlock.getRelative(face);
Block newBlock2 = startBlock.getRelative(face).getRelative(BlockFace.UP);
Block newBlock3 = startBlock.getRelative(face).getRelative(BlockFace.DOWN);
if (isLog(newBlock)) breakTreePart(newBlock, exp);
if (isLog(newBlock2)) breakTreePart(newBlock2, exp);
if (isLog(newBlock3)) breakTreePart(newBlock3, exp);
}
}
}
private void breakOrePart(Block startBlock, int exp) {
if (isOre(startBlock)) {
startBlock.breakNaturally();
spawnExp(startBlock.getLocation(), ThreadLocalRandom.current().nextInt(100) <= 50 ? exp : 0);
for (BlockFace face : blockFaces) {
Block newBlock = startBlock.getRelative(face);
Block newBlock2 = startBlock.getRelative(face).getRelative(BlockFace.UP);
Block newBlock3 = startBlock.getRelative(face).getRelative(BlockFace.DOWN);
if (isOre(newBlock)) breakOrePart(newBlock, exp);
if (isOre(newBlock2)) breakOrePart(newBlock2, exp);
if (isOre(newBlock3)) breakOrePart(newBlock3, exp);
}
}
}```
i used it in the upper method... i should learn reading lmao
:/
How would I put a player in a swimming animation when they aren't in water?
Player#setSwimming
Tried that. Nothing happens. The API also explicitly states this
I'll try that
wow, my ps5 controller is actually charged... wonderful
okay as it turned out i accidentally set /bigspecific for 2 commands
so it actually needed to be /bigkaboom
lmfao
Hello. Im currently using this code : ```
public double getAudioLRValue(Player p, Location target){
Vector look = p.getLocation().getDirection().normalize();
Location head = p.getLocation().add(0, p.getEyeHeight(), 0);
Vector direction = head.subtract(target).toVector().normalize();
Vector cp = direction.crossProduct(look);
return cp.normalize().getZ();
}
to calculate if the audio should come out of a right or a left speaker for my audioclient. but when i get behind a block it just flips. any way i can fix this code so it unflips the audio automatically if i get behind a block?
and also invalid plugin.yml but that was easy to fix
pls some1 help
?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.
https://paste.md-5.net/upoyihugul.java click event
https://paste.md-5.net/xevebifoxu.java chat event
so i want when a player shift clicks an item in an inventory
it changes the config to the next message he sends in chat
and the item gets renamed too because the item name is based off the config
but the item just becomes "null"
and the config doesnt change
anyone
ooo nuxoria i remember you :D
you need to get the item before you do the scheduler
how? like wdym
right after you check if the event is a shift click, get the item
Is anybody good at trigonometry?
Or decent
https://paste.md-5.net/izotohudiw.cpp
This code here is used to calculate the right yaw and pitch so the player will be looking at the target he is hitting, I dont understand a small part of the code, I'd need help with understanding it.
uh
yeah but like
can u tell me where did i mention the item inside the scheduler
you get the item here ItemMeta meta = event.getCurrentItem().getItemMeta();
oh that
String warp = ChatColor.stripColor(event.getCurrentItem().getItemMeta().getDisplayName());
if(event.isShiftClick()){
ItemStack currentItem = event.getCurrentItem();
ItemMeta currentMeta = currentItem.getItemMeta();
chat.list.add(player.getUniqueId());
player.sendMessage(ChatColor.GREEN + "Send Rename in chat (expires after 10s)");
event.setCancelled(true);
player.closeInventory();
Bukkit.getScheduler().runTaskLater(plugin, () -> {
String message = chat.message.get(player.getUniqueId());
if (!plugin.getConfig().isConfigurationSection("warps." + warp)) {
player.sendMessage(ChatColor.RED + "This warp does not exist / is not a warp.");
}
FileConfiguration config = plugin.getConfig();
RenameConfig.copyConfigSection(config, "warps." + warp, "warps." + message);
currentMeta.setDisplayName(ChatColor.YELLOW + message);
chat.list.remove(player.getUniqueId());
}, 200L);
return;```
is this better
yes
iok

my data folder isnt getting created smh
What is the best way to check if a location is left or right of the players head?
between 2 cords
so i can get values from 1 to -1 so that my audio pans from left to right
Id still need help with that
I cant remember the math but smth like that
u dutch? : D
Ja idk wat ik hier neer moet zetten maar ik ben dood van binnen
same 😳
maar het is echt heel lastig dit man
so i have a Vault class to open a vault inventory and a VaultSaver class that is meant to save the players vault to the config when they close their inventory. the issue is that the event is just completely stopping when it reaches these:
main.getConfig().set(p.getName() + ".VaultContents", vault.vaults.get(p.getUniqueId()).getContents());
main.saveConfig();
p.sendMessage("test");
the player will never receive the message "test" and the config file doesnt change at all so i need help
@crude charm ```
public double getAudioLRValue(Player p, Location target){
Vector look = p.getLocation().getDirection().normalize();
Location head = p.getLocation().add(0, p.getEyeHeight(), 0);
Vector direction = head.subtract(target).toVector().normalize();
Vector cp = direction.crossProduct(look);
return cp.normalize().getZ();
} ```
this is what im currently using**
this is an english chat smh
😂
https://paste.md-5.net/upoyihugul.java click event
https://paste.md-5.net/xevebifoxu.java chat event
so i want when a player shift clicks an item in an inventory
it changes the config to the next message he sends in chat
and the item gets renamed too because the item name is based off the config
but the item just becomes "null"
and the config doesnt change
Didn't we already answer this? Send the new error
but it only works when standing in front of the block. when standing in the back it flips the audio...
bump
dont bump please, im checking for you 🙂
oh ok
okay can you send the entire class please?
no error
because the issue is not coming from that piece of code you send here
this is the entire VaultSaver class https://pastebin.com/j4Rv05yD
do u want the Vault class too
any errors in the console?
nope
did you register the event ?
weird. very weird
indeed
is player metadata saved if the server restarts?
the metadata api does not persist
does is saves anything in the file?
does it persist if the player relogs?
it should
thx
can you add a persistentdatacontainer for custom entities if so how?
@thick tundra i did a little experimentation and i found out its the main.getConfig().set(p.getName() + ".VaultContents", vault.vaults.get(p.getUniqueId()).getContents()); thats causing it to bug out
idk why its causing that tho
wait did you create a new instance of Vault class?
why not having a static map which contains the player uuid and the contents?
probably the contents aren't saved the whay you're doing
should i make the hash map HashMap<UUID, Inventory> vaults = new HashMap<>(); static?
why
to save the items
ok but cant it just save an inventory? 🤔
you can save the contents
Hey guys, I haven't been up to date on MC in a while now and just looked up the MC 1.17 update. I was a bit shocked about it scolding developers using NMS instead of the API when there are so many things the API just doesn't offer a valid way to do. So I just looked through my old code and checked to see what I used NMS for in the past and the 3 simplest things I did in pretty much every plugin was item serialization/deserialization in human-readable form (like when using commands that involve items) and to get the actual Name of an ItemStack that is displayed in the game (as opposed to the name of the Material enum). Does anybody know if there is a non-nms way to do those things?
?paste
i made this for a private vault
https://paste.md-5.net/adonecifoh.java
which prints something like this to the file
I saw that as well, but I figured that was for things like selecting multiple wood types or alternate ingredients.
https://paste.md-5.net/upoyihugul.java click event
https://paste.md-5.net/xevebifoxu.java chat event
so i want when a player shift clicks an item in an inventory
it changes the config to the next message he sends in chat
and the item gets renamed too because the item name is based off the config
but the item just becomes "null"
and the config doesnt change
pls help
Someone pls help this is taking hours
are playerquitevents fired when the server stops with players still on it?
When the server stops PlayerQuit and PlayerKick will be fired. When they leave, only PlayerQuit will be fired.
RKGKJAOUEWFHBAWEUOFBAEFU[ABWEFPY9AUEBF
i thought I already answered that?
So this is suposted to make a new selection in the config and + 1 when ever its ran - But instead it doesnt + 1 and it removes everything in the config ( like all other options? )
https://cdn.discordapp.com/attachments/741875863271899136/878633874157109258/unknown.png
It still
does the same thign
rgnjaongoaehniqweuhew
gawrgharog
so it still shows as null or?
it does
Is there a way to bypass that max charachter in tablist is 16
Is there a way to set a bed less respawn location in PlayerRespawnEvent ?
https://paste.md-5.net/upoyihugul.java click event
https://paste.md-5.net/xevebifoxu.java chat event
so i want when a player shift clicks an item in an inventory
it changes the config to the next message he sends in chat
and the item gets renamed too because the item name is based off the config
but the item just becomes "null"
and the config doesnt change
SOME ONE
PLEAASE
wtf
YamlConfiguration#Set()
i got an idea of persistent data for entities , i need to know how i can scan the loaded chunks to see if the chunks contain my custom entity
wat the hell
.
Hey Guys ive been creating a Backpack command but i dont know how to save the backpack even when the plugin ist restarted can someone help me at this point ?
how do i read an ItemStack[] from a config
is the item itself null, or is the meta null
ItemStack[] content = ((List<ItemStack>) ConfigManager.getDataConfig().get("safe_chests." + key)).toArray(new ItemStack[0]);
bro wtf
wat is input equevelent of System.out.println 🤣
pls tell me idont gotta use byte[]
scanner :/
idk what youre doing
but thers no getline, all th read metheds work wit liek byte[] liek idk they think dis that 1980s or smth
String input = scanner.nextLine()
System.in.getLine brrrr
🤣
item name
it becomes null
when u say any message in chat
iv literlt nevr had 2 use th system shit b4 lol dis mi 1st time outsied spiget
😳
set the display name before the scheduler as well
in the code you showed after your changes you were still doing that in the scheduler
i got an idea of persistent data for entities , i need to know how i can scan the loaded chunks to see if the chunks contain my custom entity
yes, but you're only setting the display name after the 10 seconds
yes
and by then they cant chat anymore so
then what do i do
have everything you need before the scheduler
entities already have persistent data. Just get the entities in a chunk with Chunk#getEntities()
okay
but i dont understand
@lost matrix can you help us
i mean like this
Whats the issue
@lost matrix
if (event.isShiftClick()) {
//item code here, setting the display name too
}
//scheduler here
oh , basically i have a custom entity called world border which is a pig , on enable i spawn the pig but i dont want duplicate entities of this custom entity and im not sure how i am supposed to do that
then dont i just remove the scheduler
nefjoabefubewfuowaebfuefbauoefbauoefbawuefob
no, because in the scheduler you would still have the code you want to run after the 10 seconds, which is this:
Bukkit.getScheduler().runTaskLater(plugin, () -> {
String message = chat.message.get(player.getUniqueId());
if (!plugin.getConfig().isConfigurationSection("warps." + warp)) {
player.sendMessage(ChatColor.RED + "This warp does not exist / is not a warp.");
}
FileConfiguration config = plugin.getConfig();
RenameConfig.copyConfigSection(config, "warps." + warp, "warps." + message);
chat.list.remove(player.getUniqueId());
}, 200L);
excluding the item/setting display name
I would scrap the approach. You should not tinker with configurations while the server is running.
onEnable -> load everything from the configs into proper data structures
onDisable -> save everything from the data structures into files
While the server is running you use your properly constructed objects.
o
but um
the display name will get changed before the player writes wont he
.
Isnt there just a spigot config entry for that?
@lost matrix u there
right, didn't think about that
ajbgfuoabfuebf someone
so then in that case, setting the display name in the scheduler is ok
pls
ok
then why is i
not wokring
why is this taking so longjbriuubgrugregup9bsrugbwrgubhreugnehrgobsguseogsgseugsegsrogbserbgseorbgserobgseorubgsoebgrsuerbgseugserubgsegrser
Just use PlayerFishEvent
i have a custom entity called world border which is a pig , on enable i spawn the pig but i dont want duplicate entities of this custom entity and im not sure how i am supposed to do that.
Olivo do u know a solution
And set time on hook
for what
^^
OH FINALLY SOMEONE
Yes. You are using a weakly consistent approach that relies on String keys.
I would highly recommend you to abstract away the whole configuration stuff and use objects
that get filled when the server starts and saved when the server stops or modifications are applied.
THIS
uh i dont have any clue how to do that
i sent the thing
just do what smile said
alternatively, you could try using bukkit conversations
although smiles approach is better
how do i check for duplicate custom entities
By duplicate, I imagine you mean entities with the same UUID?
Guess you'd iterate through entities, put them in a list or something and check for duplicates
Btw here is a proper example on how to program chat input reactively:
public class ChatInput implements Listener {
private final Map<UUID, Consumer<String>> waitingInputMap = new HashMap<>();
public void requestChatInput(final Player player, final Consumer<String> consumer) {
this.waitingInputMap.put(player.getUniqueId(), consumer);
}
@EventHandler
public void onChat(final AsyncPlayerChatEvent event) {
final String message = event.getMessage();
final Consumer<String> consumer = this.waitingInputMap.remove(event.getPlayer().getUniqueId());
consumer.accept(message);
}
@EventHandler
public void onQuit(final PlayerQuitEvent event) {
this.waitingInputMap.remove(event.getPlayer().getUniqueId());
}
}
Example usage:
player.sendMessage("§ePls input something:");
chatInput.requestChatInput(player, input -> player.sendMessage("§eYou replied: §f" + input));
- Don't detect inventories by name
- Please use variables...
- Show code where you're creating the ClickEvent instance
This
i made a custom entity which is a pig with a customname world border , everytime the plugin enables i spawn the entity but i dont want to spawn it if there is an entity already present in the world
do i just use a for loop?
and to access the um
message
So this is suposted to make a new selection in the config and + 1 when ever its ran - But instead it doesnt + 1 and it removes everything in the config ( like all other options? )
https://cdn.discordapp.com/attachments/741875863271899136/878633874157109258/unknown.png
pls someone help
You dont access the message but delegate a function that is applied to the message as soon as the player writes something into chat.
bruh
but like
whats the point
if i cant get the message
oh wait
but i still want the message as a string
use a getter?
You dont "get" the message right away. You define a Consumer for the message that will later accept the message.
player.sendMessage("§ePls input something:");
chatInput.requestChatInput(player, input -> player.sendMessage("§eYou replied: §f" + input));
ohhh
Inside this consumer you have the massage.
Why are you even using a delayed timer?
for the player to write
your delay shoudl do nothing other than to reset everything if the player hasn;t entered a new name
Your onClick is only a trigger to set a flag.
Letting the chat handler know to watch for the players next chat.
Btw you can also include a timeout in the ChatInput class if you wanted to:
https://paste.md-5.net/rixelecaba.java
Only thing i can think of is a TypeToken from Gson.
i need to serialize / deserialiaze a potion effect
You will want some kind of syncronization on waitingInputMap
But this is not how you implement a PersistentDataType...
this is
Can also be done inside the consumer ^^
it could
Using a map as primitive type...
You want something like byte[] or String as primitive type
They didnt. Serializable is a spigot interface. You can also just serialize objects into a json String with BukkitObjectOutputStreams.
But regardless using a map as primitive key type is not the way to go. Its not even possible,
Try String.class as primitive and make it a PersistentDataType<String, PotionEffect>
Then serialize the PotionEffect as json.
So this is suposted to make a new selection in the config and + 1 when ever its ran - But instead it doesnt + 1 and it removes everything in the config ( like all other options? )
https://cdn.discordapp.com/attachments/741875863271899136/878633874157109258/unknown.png
Do you use the example that implemented a timeout?
no
Then the message cant be null.
why is it sending a nullpointerexception then
Show the npe and the code
Did you remove stuff
why is my tablist not updating? ```java
public static Integer getPing(Player p) {
return ((CraftPlayer)p).getPing();
}
public static void sendTab(Player p, String msg1, String msg2) {
p.setPlayerListHeaderFooter(msg1, msg2);
}
@Override
public void onEnable() {
Bukkit.getScheduler().scheduleSyncRepeatingTask(this, () -> {
Runtime r = Runtime.getRuntime();
long memUsed = (r.totalMemory() - r.freeMemory()) / 1048576; //Converting
score.registerNewTeam("default");
Team team = score.getTeam("default");
try {
if(Bukkit.getOnlinePlayers().size() != 0){
for(Player p : Bukkit.getOnlinePlayers()){
String message = "\n" + format("&aPing: "+ getPing(p)) + "\n" + format("&aOnline &d" + Bukkit.getServer().getOnlinePlayers().size());
if (memUsed > 999) {
sendTab(p, format("&3Outerlifex.minehut.gg"), format("&eMemory used: &c" + memUsed + " GB") + message);
}
else {
sendTab(p, format("&3Outerlifex.minehut.gg"), format("&eMemory used: " + memUsed + " MB") + message);
}
}
}
} catch (Exception e){
e.printStackTrace();
}
}, 10, 10);
}```
?paste
e
Not entirely certain if this question goes here or #help-server , but anyway:
I am trying to read the level data from a local spigot server. Problem is, the block states do not match expectations.
How are you reading it?
if(consumer == null) return;
if(message == null) return;
consumer.accept(message);
@lost matrix this should fix it right
?paste use it
I build a program that basically reads the whole thing from the file and converts it according to the NTB tags. The problem can be recreated by NTBView, for example.
Sorry, NTBExplorer.
NBTExplorer*
Did you wait for the server to save before reading the data
for(Entity mob : Bukkit.getServer().getWorld(overworld).getEntities()){
Bukkit.broadcastMessage("test");
if(mob.getCustomName() == null) return;
if(!mob.getCustomName().contains("World Border")) return;
plugin.i++;
if(plugin.i > 1){
mob.remove();
plugin.i--;
}
}```
it does not remove the custom entities with name World Border , any help?
1
If the entity is no longer loaded, world#getEntities will not include it
what do i do
Yes. Server is currently shut down.
The problem is: From what i know the BlockStates are a bunch of long values that are basically the packed types for the 16x16x16 blocks in the section. This should be 16x16x16x n, where n is the smallest possible integer to satisfy (number of block types in section) <= 2^n. Since there are 28 different block types in this section i would expect (5 x 16 x 16 x 16)/64 = 320 long values. But for some reason BlockStates contains 342 long values. This screws with the rest of the program, because the logic extracts the wrong values from the BlockStates and attempts to access elements that are not in the palette.
So you're talking about the chunk sections not BlockStates?
.-. Nvm
Anyway the 16x16x16 is a chunk section
Yes. This all works perfectly fine with levels created by the minecraft java client, by the way.
I just considered i could try to ignore the first 22 longs and see what happens.
We can't your error doesn't match the code
So Spigot has some extra data?
It looks like it does, but i do not know if it has any significance.
I've never worked directly with the save before
https://paste.md-5.net/ivogizoruf.java
anyone knows why line 13 is Null
@eternal oxide r u there :D
Does the map contain the player
You either didn;t add a consumer or the message is null
Because that code looks like it would fail quite often
Show yoru onClick method
um, so I know I can turn off/on if particles get affected by explosions, but is their any way I can reduce it instead of turning it off?
Are you using Paper by any chance?
No, i am using spigot.
Even if you don't I'd recommend going to their discord they know better when it comes to internals
Also this will trigger on all chat so don;t assume there is a consumer if (consumer != null) consumer.accept(message);
@eternal oxide https://paste.md-5.net/uxuquruqac.java
Ok. I'll just see what happens if i skip the additional data and if that doesn't work try their discord.
Aight
so the check is pointless?
No
alternatively try out mcdevs they definitely know these type of things
Your requestChatInput put the consumer in teh map?
also after line 41 you should return as teh warp is invalid so you shoudl not be creating a consumer
How can I make a itemstack seem enchanted without adding enchants?
the order of registering the events doesnt matter, right
not by the looks of yoru code
add an enchantment and hide it
well how would I hide it
so it does?
is it some itemmeta stuff?
no
ok
only in some cases
then why is the plugin failing
show me your chat class
how can i remove yaw from the player direction vector so theres no height
?paste
nm, you already have
probably, you are seeing an NPE from inside teh Consumer
if (consumer == null || message == null) return
bro thats same thing
add some debug to the consumer code
the message can;t be null, so either the consumer is or the NPE is from inside the consumer
I'm going to guess it is yrou player object and plugin thats null
probably just player
how is the player null bruh
what did yoru debug show?
Removed all the blocks and null checked values annotated as NotNull
Is VSC good for Java coding?
But you are on 1.8 anyways so who knows what kind of fked up bugs lurk inside this ancient piece of software
Meh. You can use it but i would recommend an IDE that is primarily dedicated for Java usage.
Yeah, you need to provide variables to teh Consumer when it runs. If you look at 7smile7 original code he creates a final player
i didnt change his code
personnelly i only use vsc wen its liek smol project in smol languege taht dossent hav a ide
I just looked back and his code is a lot different to yours
WHAT
I COPY PASTED IT WHAT DO U MEAN
Look at what vsc does to you
bruh what the fuck
His code https://paste.md-5.net/rixelecaba.java
Your code https://paste.md-5.net/ivogizoruf.java
😳 noit was dev-c++ in me case
See this line -> this.waitingInputMap.put(playerID, consumer);
he adds the consumer to the map using a local final field
Oh i forgot a null check there actually
Cannot resolve symbol 'RequiredArgsConstructor'
ignore that, remove that silly junk
@EventHandler
public void onChat(final AsyncPlayerChatEvent event) {
final String message = event.getMessage();
final Consumer<String> consumer = this.waitingInputMap.remove(event.getPlayer().getUniqueId());
consumer.accept(message);
}
@EventHandler
public void onChat(final AsyncPlayerChatEvent event) {
final String message = event.getMessage();
Optional.ofNullable(this.waitingInputMap.remove(event.getPlayer().getUniqueId())).ifPresent(consumer -> consumer.accept(message));
}
" private void timeOutMessage(final UUID playerID) {
final Consumer<String> consumer = this.waitingInputMap.remove(playerID);
if (consumer != null) {
consumer.accept(null);
}
}"
is optional
right
i can just delete it
yes you can just null check
lombok good
lombok way too advanced for most in this channel
yeah
yeah a simple null check is good here
remove returns null if key is not in map
Is there a way to enable the pathfinding debug plugin messages?
@Data
public class GalaxyShopAPI {
@Getter
private static GalaxyShopAPI api;
private final Messages messages;
private final ShopManager shopManager;
private final GuiManager manager;
private final EconomyHandler handler;
private final GalaxyShop shop;
{
api = this;
}
}
lombok very good
i flipped public void requestChatInput(final Player player, final int timeout, final Consumer<String> consumer) {
consumer with timeout
That is cleaner. I like having functional interfaces as last argument
yeah so uh
where ?
check if consumer returned by the remove method is null
u alredy have that
private void timeOutMessage(final UUID playerID) {
final Consumer<String> consumer = this.waitingInputMap.remove(playerID);
if (consumer != null) {
consumer.accept(null);
}
}
Yes but also inside the event
@EventHandler
public void onChat(final AsyncPlayerChatEvent event) {
final String message = event.getMessage();
Optional.ofNullable(this.waitingInputMap.remove(event.getPlayer().getUniqueId())).ifPresent(consumer -> consumer.accept(message));
}
u changed it
both work fine
the List#contains internally does a == i guess, right? is there any method that uses .equals()? do i have to define my equals method if its my own class?
List#contains uses .equals()
I assume that is a no
I dont even know what you mean by that to be honest.
There is a internal plugin message channel used by mojang to transmit pathfinding information for entities
A client mod can enable the renderer for that
But by default, those are not being sent by the server in release
Hello
I was trying to remove this, but when doing reload or reload pl, the file resets, I don't know what to do
I assume that there is no way to enable those using the SpigotAPI. You would need to find the appropriate settings in NMS for that.
- Stop the server
- Remove the file
- Start the server
PS: Reloading is unsupported and should never be used as it introduces a metric ton of issues.
aa, thank you very much
If it worked for me
In testing of my own plugin reloading never caused issues. What does it break?
The majority of plugins are not written with reloading in mind.
Looking for someone to help with full-time development for an SMP server. DM me with the price you want and your experience with Minecraft Servers & Development.
Neither is mine but reload seems to not break anything xd
?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/
They fail to release resources properly which results in failure to intialize again
What kind of resources?
all kinds, database handlers, their own instanced singletons.
Ah I see, interesting
Hi
a question, how can I put the Iridium Skyblock plugin in another language?
All my static vars are reset correctly so weird that their singletons aren't
or something so simple as not checking for online players on onEnable. as many plugins woudl need to deal with them upon a reload
Thank you
the someone explain this to me pls
[14:30:06 INFO]: a chunk is being unloaded...
[14:30:06 INFO]: parameter: -8892, -16738, 854fc072-c0f0-4fa1-b3cf-871953c1f84c
[14:30:06 INFO]: current list:
[14:30:06 INFO]: -8892, -16738, 854fc072-c0f0-4fa1-b3cf-871953c1f84c
[14:30:06 INFO]: returning false
public static boolean isUseless(Chunk chunk) {
System.out.println("parameter: " + chunk.getX() + ", " + chunk.getZ() + ", " + chunk.getWorld().getUID());
System.out.println("current list:");
uselessChunks.forEach(pointer -> System.out.println(pointer.x + ", " + pointer.z + ", " + pointer.world));
// if (uselessChunks.isEmpty()) return false;
boolean result = uselessChunks.contains(new ChunkPointer(chunk.getWorld(), chunk.getX(), chunk.getZ()));
System.out.println("returning " + result);
return result;
}
do i have to define the equals method myself? inside my ChunkPointer class
You should always overwrite equals and hashCode if you use your own objects in some data strucutes
is hashCode necessary in my case?
Highly suggested
Especially if you wanna use hashmap or hashset
From what I can guess uselessChunks is a set
its a list, but i think i should use a set
ouch... O(n) contains.
yea i know, but i may need to add a chunk twice
but idr why, ill use a set until i know why
How come?
If you add the same hash twice in a set you'll overwrite the initial instance
If you wanna keep track of how many times each chunk is added you could use a map<obj, integer> to make a histogram
check what's null
show your chat code
If you're gonna diss my library at least @ me
ok, so, how would i make a hash code from two chunk coordinates and a world uuid? something about multiplying primes, but im not sure
public final UUID world;
public final int x;
public final int z;
just that
The only part of RedLib which does this by default is the block data manager
is there any way to replace/delete plugins while the server's running? it takes ages to boot up and i don't want to start and stop it every time
Which goes through SQLite, not MySQL
Objects.hash(Object...)
it tells me i need permission if i try to do it while it's running, despite me messing with ownership
@lost matrix ur thing doesnt work lul
SQLite is much faster and it also is set to not perform synchronous writes
Message shoudl not be null unless it hits the timeout
Hey Guys ive been creating a Backpack command but i dont know how to save the backpack even when the plugin ist restarted can someone help me at this point ?
It also caches aggressively
I have used the block data manager on big servers and it has never been an issue because it's designed around the sync SQL queries
Cannot resolve method 'hash' in 'Object'
just change teh message from null to "timed out"
Objects with an 's'
I would agree that under most circumstances it's a bad idea, but there's basically no way around it for the block data manager since it often needs to be used in events (like cancelling an event if the block has certain persistent data attached)
So you need to synchronously get the data for that block to determine if the event should be cancelled
No don;t do that
then i send my ChunkPointer object?? or each property
each property
I've mitigated the drawbacks of the synchronous SQL queries as much as possible to the point where they have almost no effect on the server performance
Don;t change it from null. In your consumer check for a null message and if it is send teh player a timeout message
o
and then add them up? multiply?
It takes an Object vararg
save it to a file?
ok
like a config?
You can get away with loading chunk data async as the time between loading and the first interaction is assured to be several seconds.
yea a config file
The block data manager is lazy
That's another of the mitigations
It doesn't load any data until it's told to
Loading the data for every chunk when the chunk is loaded would be a bad idea, so instead it only loads it when a plugin tries to access it
And I can assure you it's a non-issue
Ive noticed. I personally would not lazy load anything sync on the main thread.
I would trade memory for CPU time any day
As would I, but asyncing it brings in a slew of new problems
It would be a premature optimization
I'd consider it if the block data manager had ever caused performance issues
But like I said, it never has
And I've used it on servers with hundreds of concurrent players
Disagree. Preventing possible crashes is not a premature optimization.
If it ever caused issues I would address them, but it has never caused issues, and like I said, I've used it on servers with hundreds of concurrent players
So I'm confident in its performance
Its alright i got it.
@eternal oxide Doesn't even send me "Renamed" LOL (because its null 100%)
Oh, and also SQLite doesn't support async
Then work out why its null
Only supports single-threaded access, to async it I would need to switch to MySQL which would remove much of the advantage of SQLite, which is speed
Do you def only have one single instance of ChatInput?
uh
i have one for registering the events
and one in my click class
And i hope you use this exact instance everywhere
Because otherwise you will have two different maps and one wont be accessed by the events
F
uh
uhhhh
i have 2 in my onEnable
because its needed for click event parm
Create only one single instance. Register this instance and also pass it to the other classes.
@EventHandler
public static void onChunkUnload(ChunkUnloadEvent e) {
System.out.println("a chunk is being unloaded...");
if (ChunksHandler.isUseless(e.getChunk())) {
System.out.println("chunk is useless, setting save chunk to false");
e.setSaveChunk(false);
}
}
[15:01:05 INFO]: a chunk is being unloaded...
[15:01:05 INFO]: chunk is useless, setting save chunk to false
[15:01:05 INFO]: a chunk is being unloaded...
[15:01:05 INFO]: chunk is useless, setting save chunk to false
[15:01:05 INFO]: a chunk is being unloaded...
[15:01:05 INFO]: chunk is useless, setting save chunk to false
but it still generates like 300 region files, why?
How Can I Sort Players in tablist
Like admin then mod then ......
cuz they are being sorted through abc ...
I already created an int array of the group weights from higher to lower
and cleared the tablist and began to fill it
but it didn't fill through the ordor that I prepared
Did you set the world's autosave property to false?
I'm pretty sure loaded chunks can still be saved if autosave is set to true
public ChatEvent getChatEvent(){
return chat;
} in one class?
I dont know what that means
Is ChatEvent your Listener class?
yes it is a listener
Then yes. But i would recommend dependency injection instead.
i have dependancy injection
private final Warps plugin;
private final ChatEvent chat;
public ClickEvent(Warps plugin, ChatEvent chat) {
this.plugin = plugin;
this.chat = chat;
}
public ChatEvent getPlugin(){
return chat;
}
Then you dont need a getter like this
if i set autosave to false, do i have to manually do e.setAutoSave(true) for chunks that i do want to save?
bc now its not saving anything at all
Potentially
so i dont need to access it from a
class
like you told me to
right
bro
public void requestChatInput(final Player player, final int timeout, final Consumer<String> consumer) {
final UUID playerID = player.getUniqueId();
this.waitingInputMap.put(playerID, consumer);
i just realized
why in the hell
are we passing player object
just to get it with uniqueID
cant we do final UUID Uuid or something
sure
Show your whole project or the relevant classes pls. With a gist or sth.
o
ok
ill use github
@lost matrix
pls say wth is this "Cannot resolve method 'spawnEntity' in 'World'"
pluginManager.registerEvents(new ChatEvent(plugin), plugin);
pluginManager.registerEvents(new ClickEvent(plugin, new ChatEvent(plugin)), plugin);```
what
Do you see anything wrong in that?
hmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm
fuck me
ChatEvent chatEvent = new ChatEvent(plugin);
Then pass this instance to the other classes.
pluginManager.registerEvents(new ChatEvent(plugin), plugin);
pluginManager.registerEvents(new ClickEvent(plugin, chatEvent), plugin);
o i already did that lol
why other classes
its only in there
Thats still not correct
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa help pls why intellij idea says "Cannot resolve method 'spawnEntity' in 'World'"
pluginManager.registerEvents(chatEvent, plugin);
pluginManager.registerEvents(new ClickEvent(plugin, chatEvent), plugin);
better
Wrong world import
i am using location.getWorld() and right location import
show the import
Show the lines of code pls
^ then you are providing the wrong arguments to the method.
here
What version are you on?
1.17.1
IT WORKS
SS
SS
SS
S
SD'GJONSEJOFBAEWGFANWEKFJABEGFIOAWEKNFAEBGAOWEGNABWOEUGBAEWNGABEGUWEJOGBW
it doesnt work
it seems that it work, nothing is saved, and if i do save-all, only the chunks i want are saved (i think)
but, when shutting down the server, or when re-enabling autosave with save-on, all regions are saved, for some reason, and about 500 region files are created, any idea why?
anyone wanna help me spaghetti code
https://github.com/2Hex/Warps
well your arguments are completely wrong so get rid of those and maybe intellij will show you the correct arguments to fill
Tried dont work
you're trying to create a new instance of an interface
Your code is fine. Nothing wrong with it.
ik but how to fix intellij
i closed
opened
deleted project
and created a new one
Pathetic.
invalidate cache and restart
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/entity/ArmorStand.html ArmorStand is an interface, perhaps it is because of that?
nah I tested his exact code. its fine
wat how
he';s using EntityType
did you invalidate cache?
its just stupid autocomplete
you're trying to make an instance of an interface...
for the third time get rid of the arguments and the correct method will resolve
where did you get that from? Thats not teh code he showed
it is
it is
oh, I only looked at teh screenshot. Not watchign some stupid video
why Inventory gui2 = Bukkit.createInventory(player, 54, ChatColor.GREEN + "Warps: (Page 2)");
gui2.setItem(53, next()); doesnt work
do i need a library other than spigot-api to access MinecraftServer?
Invalidating chache worked
public static ItemStack next(){ ItemStack next = new ItemStack(Material.ARROW); ItemMeta nextMeta = next.getItemMeta(); nextMeta.setDisplayName(ChatColor.DARK_PURPLE + "Next Page"); next.setItemMeta(nextMeta); return next; }
why
Inventory gui2 = Bukkit.createInventory(player, 54, ChatColor.GREEN + "Warps: (Page 2)");
gui2.setItem(53, next()); doesnt work
that is a completely ridiculously vague question
and code blocks
how do you unhook the fishing rod in playerFishEvent?
God what has happened to this chat
delete fishing line probably
how would i do that?
im using PlayerFishEvent, im getting the state of the event, and if the state is IN_GROUND than i will cancel the event
i then want to remove the hook
So i'm using this code
plugin.getChecks().getConfig().getConfigurationSection(category).getKeys(false).forEach(key -> {
if (plugin.getChecks().getConfig().isList(category + "." + key)) {
list.add(key);
};
});
With category in this case being "Movement_checks"
In the file I have
Movement_checks:
fly:
A:
enabled: true
And I got a null error
(ava.lang.NullPointerException: Cannot invoke "org.bukkit.configuration.ConfigurationSection.getKeys(boolean)" because the return value of "org.bukkit.configuration.file.FileConfiguration.getConfigurationSection(String)" is null)
I understand that I get that when it doesn't exist, but it is in the config. I'm probs being stupid so what am I doing wrong?
okay but event.getHook() doesnt have a delete function lol
its an entity
.remove()?
oh shit id guess i just looked over it. Ill try it
Did you obfuscate your class?
It appears that you tried to break ASM, which ended up hurting you
well it work fine for me on spigot 1.17
That is because this is mohist, not spigot
could it be
They will need to perform more rigorous remapping, which (surprise) more or less requires ASM
because it runs on java 8
If your Class borks ASM it crashes
so problem is on there side
No, ASM is a well respected library, if your class is obfuscated, you should step down on your obfuscation
Any reason why ItemFlag.HIDE_ENCHANTS would work for everything except enchanted books?
It is not their job at deobfuscating your Class so it works, which is a process that can be illegal in certain countries
my code is not obfuscated
Then report this bug to md
I only change path of hikaricp mysql api
Or ASM, idk who is at fault
honestly, might be an ASM issue
ASM did release an update a few days ago, could be that you accidentally replicated a bug that was solved then
Avoid Mohist
It has bad practices breaking both Forge and Spigot. It's also a security risk
Enchanted books don't have enchantments in the same way as other items
If you check the enchantments with getEnchantments it will be empty
You have to get its ItemMeta and cast it to EnchantmentStorageMeta
Because they aren't enchantments applied to the item, they're enchantments stored on the item
The difference being that a book with looting will not yield more loot if you beat something to death with it
The enchantment is stored on the book, but has no effect
Bukkit.getWorlds().forEach(world -> Bukkit.getServer().unloadWorld(world, false));
how can i load them again? there is no loadWorld method
Use a WorldCreator
what is that
But you have to make sure you load them with the same generator they were originally loaded with
It creates a world if it doesn't exist, or loads one if it does
The thing that dictates the shape of the world
I. e. if it is flatlands it is a different worldgenerator than when it is a large_biomes world
Plugins can also define world generators
ok, so, i want to disable auto save, generate chunks, prevent them from saving when unloading (unless i need them), and then enabling the autosave again, discarding all those chunks that i dont need. but when re-enabling the auto save, all those chunks were being saved. also when shutting down the server. so, doing Bukkit.getServer().unloadWorld(world, false) allowed me to discard those chunks that i dont want to save
but then to load those worlds again, i need the world creator, like this?
public static void disableAutoSave() {
Bukkit.getWorlds().forEach(world -> world.setAutoSave(false));
}
public static void enableAutoSave() {
Bukkit.getWorlds().forEach(world -> {
WorldCreator worldCreator = new WorldCreator(world.getName());
worldCreator.copy(world);
Bukkit.getServer().unloadWorld(world, false);
World reloadedWorld = worldCreator.createWorld();
reloadedWorld.setAutoSave(true);
});
}
well, it seems that it works, but now im worried about compatibility with other plugins
[18:04:34 INFO]: [Multiverse-Core] World 'world_nether' was unloaded from Multiverse.
[18:04:35 INFO]: [Multiverse-Core] World 'world_the_end' was unloaded from Multiverse.
[18:04:37 INFO]: [Multiverse-Core] World 'test' was unloaded from Multiverse.
[18:04:37 INFO]: [GroupManager] New world detected...
[18:04:37 INFO]: [GroupManager] Creating data for: test
[18:04:37 INFO]: [GroupManager] Don't forget to configure/mirror this world in config.yml.
@lost matrix
what do i do if i want to stop the message from showing to people in @EventHandler
public void onChat(final AsyncPlayerChatEvent event) {
final String message = event.getMessage();
Optional.ofNullable(this.waitingInputMap.remove(event.getPlayer().getUniqueId())).ifPresent(consumer -> consumer.accept(message));
}
will this work @EventHandler
public void onChat(final AsyncPlayerChatEvent event) {
final String message = event.getMessage();
Optional.ofNullable(this.waitingInputMap.remove(event.getPlayer().getUniqueId())).ifPresent(consumer -> consumer.accept(message));
if(this.waitingInputMap.containsKey(event.getPlayer().getUniqueId()))
event.setCancelled(true);
}
That will stop itt from being shown to anyone

