#help-development
1 messages · Page 27 of 1
Im #AntkMCHoster and im more #VPSteam
I find really shity using a web panel to manage mc servers
Hello, I would like to upload the version of spigot 1.19 to my server that is hosted by a page and when uploading the version it gives me an error, how should I do it? Any moderator who can help me or let me contact you by md to explain my event in more detail @worldly ingot
Ban
@ivory sleet please solve this he is being impatient
Sorry for ping my mate
and he got Obsessed with Choco
Lmao i wanna start swearing to that litle child he make me mad
not sure why is asking here and not in the support of the panel...
@worldly ingot I just want a way so I can find the difference between 2 such timestamps in seconds OR miliseconds
Excelente answer
Excelente?
which one of the two would work for that?
Subtract one from the other.
Like... good (?
no, i was Joking with him, because he Wrote it in Spanish
I tríed to write excelent but the corrector changes
no no you dont have the context
Ahhh el español es un bonito idioma.. mas facil es explicarme asi...
but well
Hello, I would like to upload the version of spigot 1.19 to my server that is hosted by a page and when uploading the version it gives me an error, how should I do it? Any moderator who can help me or let me contact you by md to explain my event in more detail
Please van it before I start swearing him
late xd
basically, can I subtract one of these (^) values from another such value and get the difference in miliseconds?
the Dude is Still Going
im sure they are not reading the channel...
are you even reading what people are saying to you
what is wrong with him?
or its a scam
7 messages.. and 6 are the same
Yes
I mean, I'm pretty sure you can convert them to milliseconds with built in methods, but any reason you aren't just using longs?
i'm Just Gonna DM him to tell him to Stop
good luck and dont click url
Dont lsot your time pbt
i've got Plenty of Time now
No one answers me, a useless person told me to go face to face
Dude, you're gonna get Banned
wait what?
They answered you plenty of times?
You never clarified
He Just Spammed
Waiting for Someone to Figure out a Completely Unexplained Problem
dhouting?
Where I am Spanish and I understand little English if it is not a message answered directly to mine I get confused I do not understand practically any English
Sorry for saying this in Spanish but is for him to understand
@quaint mantle usa un traductor
writes better than verano sometimes does tbh
xDD
sorry i mean i'm trying to load BuildTools to load spigot 1.19 on my server but if i load it the server tells me there was a failure
that's a Different Problem
Lmao i was on fire I just wanna swear him
no, Family Friendly Channel
Yeah I know I counted 4 times to 10 because if not I was going to get banned
And what if I'm not going to be doing
BuildTools is a standalone program you use to create the spigot jar. You then take the output jar and upload it to your server. You don't upload it to a server and run it.
If you dont know english its really diff to help
Then you WILL not Understand Anything
My message got deleted
and Come on Dude your Description is in English
If I upload what the file is once prepared, it gives me an error
and That's a Different Error
Which file are you uploading?
Is get bukkit com site ilegal?
i think he's Just Uploading BuildTools
Hahah thinking the same
at this Point
I don't think so, at least not based off what he said.
He could have uploaded one of the jars in the Spigot folder instead of the jar that's generated in the parent directory.
very
Try with the two files which is the executable .jar of BuildTools and then on my computer prepare the file with the cmd for which is the version to have it and try to upload it and there it gives me an error to what is the upload of the file
I stand corrected. Mans is trying to run the BuildTools jar. 💀
how can i save an inventory so when i join the nether e.g. i have items and when i join overwold i have different items!?
💀
?
I am really doing what the support of my page told me
Just serialize the items and save it into a db or flat file
Have you ran BuildTools on your personal computer? Because if you have, you will have a file structure like this. The highlighted file is the one you want to upload.
This was what they told me Hello Manuel! We have several templates when creating servers such as Paper, Forge or similar. Once the server is created, you can upload any version of the server you want, as in your case, Espiga. I have done a little search and at https://www.spigotmc.org/link-forums/spigot-buildtools.88/ you can download the BuildTools and get any version of Spigot which you can then upload to the server using the File Manager. For it to work properly, you will need to refresh this file to server.jar. Another option is to search directly online for the specific version. I hope I have resolved your doubts. Kind regards, Alexander Q.
Cinnamon is Great
I really like it too.
Exactly that file is the one I want to upload
But, have you ran BuildTools already? Or is that what you are having issues with?
I will explain it in more detail
It's what I'm doing
run Buildtools. Build the version you want.
Rename the jar to server.jar and upload it to your host.
I am going to explain myself in better words, what I did was contact the technical support of my page to upload other versions of the server, which I wanted spigot, they answered me by uploading the BuildTools.jar file and that is what I did, once uploaded, I changed the name of the file to server.jar, which was so that the console would detect that it was a version and the console proceeded to execute the version for me, it began to download the content of the version, and once It is loading, an error occurs to me, which tells me that there is something wrong, it has given me an error when loading the content, but once I go to file, after doing everything mentioned above, I get all the spigot installed folders and many more , which is the content of what I have uploaded but it does not let me turn on the server, I have also tried to upload what you mentioned before spigot-1.19 which is already done with the cmd and there it gives me the error
Failed to get multipart form data from request. @kind hatch
Stop Pinging People
you do NOT upload buildtools.jar to your host.
Wrong channel. you need #help-server
That too
If I load the other file it does not let me directly upload it there the problem
It's where I've been sent
I have been told to communicate through this channel, so until a person who sends more than you tells me otherwise, I am not going to change the channel.
So sassy smh smh
We have all told you what you are doing wrong. you will get no more replies in here as this is the WRONG channel. Go to #help-server
Told by who? Because your issue is more of a server issue, not a development issue.
Maybe cause the channel was dead. Offtopic stuff happens all the time when nothing is going on in the channel.
Sign not Editable
thanks
for commands i got some arguments should i use a switch or
if args[0].equals"blabla"
?paste
Optional
https://paste.md-5.net/porebibafo.cpp Why is this not working? Its creating a new world but not "coping" the old one
Oh god. Arrow code.
.
.
.
.
.
.
.
.
.
Your code. Literally looks like an arrow.
Indentation looks like an arrow
yikes
ok and!?
It makes a little harder to read and understand compared to guard clauses.
okay that wiki needs some help lol
Understandably, it is a personal choice and will make little to no difference on performance, readability is a good thing to strive for when writing code.
Case in point: I didn't even read it
Consider using return statements instead of nested ifs, that’ll help clean things up.
I took a second look at that article and said nope Lol
does anyone know how to set custom armor bar values?
public static ItemStack parseItemNBT(String rawNBT){
if(rawNBT == "null") return null;
CompoundTag nbt = null;
try{nbt = TagParser.parseTag(rawNBT);}
catch(CommandSyntaxException ignored){}
net.minecraft.world.item.ItemStack nmsItem = net.minecraft.world.item.ItemStack.of(nbt);
return CraftItemStack.asBukkitCopy(nmsItem);
}
Getting this error even though I have TagParser imported
To answer your question though, it looks like you are just creating a new world and not copying the file contents themselves. Unless your WorldCreator class handles that?
even though its aRrOw cOdE cant you just help me
Packets.
What’s stopping you from cleaning up your code so we are able to understand what is going on?
its not that hard to understand
its still java
ur handling it like another language
tf
meta.setAttributeModifiers(Attribute.GENERIC_ARMOR, 2); anyone know what to put after the 2, I have no idea
Someone made a program in C which looks like a donut and once ran, generates a spinning donut.
Does not mean because it is C it looks like every other C program
Is Meta ItemMeta?
yes
@azure hawk
well im not makin it look like an fucking arrow
your just to angry about my coding style
Chill out dude
I’m absolutely fuming man
I can’t contain it
Firstly, thats a badly coding style. I wouldent even consider it a coding style. You are nesting 7 if statements
(it's called hardcoding)
How would that be hardcoding?
the opposite is softcoding
idk I didn't look at the code
but that sounds like hardcoding to me
this is just about nesting if statements
Isn’t hard/soft coding to do with unconfigurable software features?
The user isn’t willing to clean up their code so I doubt anything thrown at the wall is going to stick.
All I will say about that code is. 1- Should be cleaned up; will make it easier to find errors
2 - make debug statements and see what actually happens
hi guys can anyone help me that doesnt have a problem with how i code! ^^
A potential problem is that your logic for checking argument length is inside a check for argument 0. You should check for argument length first, then check the argument values afterwards.
E.G
if (args.length > 1) {
if (args[0].equalsIgnoreCase("Something")) {
// Do Stuff
}
}
```vs
```java
if (args[0].equalsIgnoreCase("Something")) {
if (args.length > 1) {
// Do Stuff
}
}
You might run into an ArrayOutOfBoundsException if you use the latter approach.
I dont want to have to look through multiple paragraphs to find one thing
the outcome is the same
it just triggers you
wtf
cant you leave me alone with how i code
No, it just makes our job annoying so we don't want to help with that
i just wanted help and now im getting bullied over how i code xd
welcome to programming
I already said what I recommend you do; make some debug statements and see whats actually going on
Nobody’s bullying you. We’re trying to help you and you are acting all defensive.
Completely ignoring any and all advice.
so i'm serialzing adventure components to plain text and that results in: test §x§f§f§0§0§0§0@darkeyedragon§r yeet
but it just shows as white, any clue why? (it should be red)
Can’t do nothing without code 🙂
Okay, 1m i ill open paste md5
I recommend the Paper discord for Adventure questions, have you posted there?
Before I really dig into this I would suggest asking Paper for Adventure Questions
its not related to adventure though... its literally a string at that point
are you running any plugins?
Hi, I want to ask how faction plugin can do the prefix thing only for some users to see?
nothing that deals with chat
Are you on 1.19?
.1
I wonder if the secure chat thing has anything to do with it
hmm. My only idea is that color is stripped from the default chat; like you would have to edit the chat format to include a ChatColor option
hmm its the preview event
Hi im having some issues because Im keeping track of a Set<Claim> where i save there each owner uuid, location, cuboid, etc. But when im doing /ps info its telling that i need to own a claim when i already have a claim
I deleted the other
no im creating my own plugin im in the correct thing
Okay, so what your issue?
Hi, I want to ask how faction plugin can do the prefix thing only for some users to see?
Is it failing at line 40?
prefix on chat right?
no in tab or on the Player Name in the tag
Add some debug logs to your code so you can track logic flow.
You’ll need to use packets.
what line is that message from?
When im passing the user argument works perfect, but when doing without a target player falls
what kind of packet? (raw one or some i can parse with other plugin)
So its falling on line 27
Alright, then track why getClaim fails for online players.
Okay?
because owner uuid from claim and sender uuid are the same
😂
Its really weird i will look more in details
To those who are interested, I de-arrowed the code. https://paste.md-5.net/opuhanilom.cpp
Is it a world command?
Smth of the sorts. It's not mine though.
https://www.spigotmc.org/threads/changing-player-name-tag-colour.222984/ i think with this too?
The maximum worlds check is wrong
@azure hawk ^^^
I'm aware, I just took someone's code and remove the nested if else chains.
Yeah just wanted to let that person know
They wouldn't help us out so I had to do it myself. 😛
when onWorldChange is called, is the player still on the previous world, or is it on the world it changed to already?
The world they changed to.
The world is very lucky to have people like you 😄
Is this a separate question?
What do you mean?
It’s PlayerChange!D!WorldEvent
If it implements cancellable then I’m quite certain it’s before the teleport
Ah, apologies, yeah.
So it’s past
My method is called onWorldChange, but I meant PlayerChangedWorldEvent.
The world is already changed
PlayerChangedWorldEvent#getFrom()
Previous because its probably cancellable
Implying the world they came from.
Maybe you want to listen to player teleport event instead or something
minecraft hasn't respected § since 1.13 i believe
No?
are you sure its being converted to a text component?
It’s not
There's too much information here, and I got confused. So the "player" itself is still on the old world at call-time, right?
Who is tagging me?
well i wouldnt know, cuz spigot only works with strings
Elaborate?
what method are you using?
Hey would he want to change the event?
No, they already changed worlds
Ah, alright.
He is just looking on how the event works.
player.spigot().sendComponent(TextComponent); are u using that method?
Is there any method that is called before the player changes worlds?
Are you using portals? Or is this logic done via teleporations?
PlayerTeleportEvent
They want to intercept when a player attempts to change world. Pre event, not post.
I hadn't considered that, but it would be through either I guess.
no, i'm using the event
@EventHandler
public void onChatMessage(AsyncPlayerChatPreviewEvent event) {
var message = event.getMessage();
var matcher = pattern.matcher(message);
if (!matcher.find()) return;
int startIndex = matcher.start();
int endIndex = matcher.end();
var result = matcher.group(0);
var legacy = LegacyComponentSerializer.;
var start = legacy.deserialize(message.substring(0, startIndex));
var end = legacy.deserialize(message.substring(endIndex));
var mention = Component.text(result).color(TextColor.color(0xff0000));
var finalComponent = start.append(mention).append(end);
event.setMessage(legacy.serialize(finalComponent));
}
Okay weird, never done that
I see, that would work for all forms of changing worlds, then?
why do people keep using var 😭
agree!
cuz lazy
I see, thank you.
its like the 3rd time ive seen it in the past two days
It will come back to bite you
Besides.
yeah imagine using language features
Well if it's done through teleportations, you could call PlayerTeleportEvent#getFrom() and PlayerTeleportEvent#getTo() and then get the world via the Location object it returns.
Who uses var to everything in Java? Even if you're lazy that's gonna hurt the readability of your code.
I spoke with someone a while back about var... If I was doing the code review, I personally wouldn't allow it to go forward if it had var. If it was just a little, i'd change it and allow the PR, but if it were too many, just no.
A language feature existing does not imply it should be used in certain situations.
To compile var take more time, because i need to replace it to the correct type during compile time
😂
yeah cuz plugins take so long to compile
Also, the PlayerTeleportEvent fires before the PlayerChangedWorldEvent.
i mean saying "i use var cuz im lazy" and no real explanation just tells me everything i need to know lol
I’m not going to bother spending more time throwing suggestions at people who don’t listen.
It’s been provided, take it as you wish.
So its better to use variables like this: private/protected/public String/int/long/etc varName;
@gray merlin what do you think about using player teleport event?
also i have no clue what im reading there
since you use var
so i cannot help you
thats literally the only reason tho kek
You’re expected to open their project up in a modern IDE 🤣
right, and it tells me everything i need to know lmfao
#help-development message
frequency said it works for all forms of changing worlds, so portals and /tp, therefore, i'll use it.
What the
not my problem you use eclipse
….?
what
no its the fact we have to use an IDE at all to read it
we simply will not do taht
Also i want to know if annotation processors are always being executed for example Lombok
I was testing something similar like this and here's what I found.
Event Execution Order
EntityPortalEnterEvent
PlayerPortalEvent
PlayerTeleportEvent
PlayerRespawnEvent
PlayerChangedWorldEvent
Because if not intellij will complain about calling getters/setters that doesnt really exists when you not compiling
I encourage you to do a little searching for why you shouldn’t use var, especially in your particular instance. Up to you.
I’m certain there’s a brilliant stack overflow answer outlining some points which are relevant to you.
@EventHandler
public void onChatMessage(AsyncPlayerChatPreviewEvent event) {
String message = event.getMessage(); //THIS IS A STRING
Matcher matcher = pattern.matcher(message); //Probably a Matcher IDK i dont use an IDE
if (!matcher.find()) return;
int startIndex = matcher.start();
int endIndex = matcher.end();
String result = matcher.group(0); //String cuz var is illegal
LegacyComponentSerializer legacy = LegacyComponentSerializer.legacySection(); //LegacyComponentSerializer LegacyComponentSerializer
TextComponent start = legacy.deserialize(message.substring(0, startIndex));//TEXT COMPONENT YAYAYA
TextComponent end = legacy.deserialize(message.substring(endIndex));//TEXT COMPONENT YAYAYA
TextComponent mention = Component.text(result).color(TextColor.color(0xff0000));//TEXT COMPONENT YAYAYA
TextComponent finalComponent = start.append(mention).append(end); //TEXT COMPONENT YAYAYA
event.setMessage(legacy.serialize(finalComponent)); //VOID
}
there you go, happy now?
The problem with var is that on compile time it takes more time because it need to replace the generic value into a specific type
Compile time isn’t the problem - i was working on a plug-in littered with it and it compiled in under 2 seconds, with a few maven plugins as well.
ah yes, i can actually see what these variables are
thats great!
what are you trying to do again
same question hahaa
color text
a bit more specific?
Their color codes appear white in chat.
Hex color codes within chat previews.
oh ok
color @mentions
but the color doesnt appear in chat but is present when debugging
but shows as
let me look at Bukkit
Did you run that through ChatColor#translateAlternateColorCodes()?
shouldnt be a problem
the event should be able to convert that to a chat component
I swear I've seen darkeye somewhere else a few years ago
It can since he has the section symbol printing to chat.
i'm everywhere
Minecraft automatically converts it, but it won't show visually.
yeah i've been around for over a decade for mc stuff
Why does Hopper.getInventory().setContents(ItemStack[]); not work
define doesnt work
Doesn't set the items.
Did you forget to update the blockstate
ShowCode™️
©️
®️
so spigot shit the bed again?
could at least work
Annotation processors tend to have Java agents that can be used as command line arguments in programs. For IDEs, those agents are passed to their startup arguments
So in a way, yes
Instrumentation is very, very useful
Okay, so when i open my IDE and use Lombok, its being executed in background right?
annotationprocessors are black magic, theres like no good documentation on those
@drifting halo can you paste your message here
yes that why i ask
test §x§f§f§0§0§0§0@darkeyedragon§r qfdsfd
Correct. The agent is running in the background and your IDE knows to tell you those methods exist (even when they technically don't exist on the source level)
The annotation processor runs at compile time and actually generates them
APs and instrumentation are extremely complex topics
You need a strong understanding of bytecode
i made an annotation processor a while ago to put all my permissions in a permissions.md file, took me like a week to figure out how tf to even get it working
from annotations
I mean in some situations you're fine to just write a normal program. I did it recently. I automatically document VeinMiner's protocol with annotations, but I just use reflection
I ask because im planing to design my own command framework
So i want to learn about annotation processing
{"extra":[{"text":"test "},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"color":"#FF0000","text":"@darkeyedragon"},{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"text":" qfdsfd"}],"text":""}```
That moment you learn about java streams and the ".map()" function 
Never want to go back to not using them
Would this be correct?
@EventHandler
public void onWorldChangedPre(PlayerTeleportEvent event) {}
@EventHandler
public void onWorldChangedPost(PlayerChangedWorldEvent event) {}```
talked to some other peeps and looks like i need to set it in both events
yea if im being honest idk what the chat preview is for?
it just shows a preview if your chat message above your text box right?
It's really just a good debugging tool. Great for checking color codes without sending a message.
but does the preview get shown to the client?
Yes, if they have them enabled.
apparently not
this is new to me lol, 1.19.1 and all
It's a client setting.
https://paste.md-5.net/zabayusago.cs
With nms shit (server version is 1.8.8
?1.8
Too old! (Click the link to get the exact time)
Literally says it's unsupported.
Caused by: java.lang.UnsupportedOperationException: Unsupported nms version
cmon man i know it sucks but my work server uses it (i work for em)
tell your boss to upgrade then lol
yea i mean what is causing that issue, cause i didnt get that issue before i changed the project package structure
its like a couple of kids think spamming click is better so a lot of the players still stick to that
basically saying "people who use guns, just dont use guns" its not that ez xd
OldCombatMechanics
true
idk why people love em so much
It’s a plug-in 🙂
oh
it didnt throw that before i changed the project structure
It doesn't require skills
what's at that line then?
which one
No need to run 1.8 except for very specific cases, servers which require it would have a team of developers working on the software
?stacktrace
?st
Caused by: java.lang.UnsupportedOperationException: Unsupported nms version
at com.annihilation.core.npclib.api.Util.getNMS(Util.java:34) ~[?:?]
whatever
public static NMS getNMS() {
if (nms == null) {
try {
String version = VersionUtils.getVersion();
String name = "net.techcable.npclib.versions." + version + ".NMS";
// Bukkit.getLogger().info(name);
Class<?> rawClass = Class.forName(name);
Class<? extends NMS> nmsClass = rawClass.asSubclass(NMS.class);
Constructor<? extends NMS> constructor = nmsClass.getConstructor();
return constructor.newInstance();
} catch (ClassNotFoundException ex) {
throw new UnsupportedOperationException("Unsupported nms version", ex);
} catch (InvocationTargetException ex) {
throw Throwables.propagate(ex.getTargetException());
} catch (Exception ex) {
throw Throwables.propagate(ex);
}
}
return nms;
}
@glossy scrollgot it working by setting chatevent too ig the preview stuff is just that, preview, who wouldve thought
Its a system message tho
yeah idk how to deal with that tbh
(You dont!!!)
well not rn i guess
Only way to do it is to have an annoyong “this message was modified” icon
Which is much more intrusive than a system message
mojank moment
Plugin issue when server is started again
what font is on the ?paste site
I’m unsure if inspect element would show it or not. Give it a try 🙂
oh bruhh
how can I make a system that smoothly decreases the entity speed like the minecart?
its different because i changed my browser settings to use monospaced fonts everywhere
oh this is where you might want to use NMS as i dont think there are any events for entity move
also longggg monitor xd
i dont mind about nms
Can we detect when a server has crashed and do something before it closes? this is very stupid to ask, it's probably "no", but yeah...
Set velocity ?
Yes
I think you can use the plugin's onDisable, thats called when the plugin shutsoff
I don’t think so
hello how can i add spaces when typing a line in /znpcs conversation?
I'll add it in just incase then.
That’s a method but very unreliable 😟
Thank you.
Ask the znpc dev
Yea cause when theres an ultra sudden crash it wont be called
Wrong channel as well
how? i don't have his discord ign
savage
They probably have a support link on the plug-in description page
If not send them a PM on the forum
what theres pms in the forunm?
Yeah, I think it’s called conversations or something in xen foro
Next to Akers
Alerts.
whats the $s supposed to mean in the default chat format? "<%1$s> %2$s"
https://paste.md-5.net/gasijaweyi.bash
Cant find some weird ass class, added jna as a dependency but still
DecimalFormat
I just use getHealth()
String.format("%.2f", health) 😎
alr thx
this is probably the cooler way
and might just be what format does under the hood but idk
String.format is slightly slower but it’s pretty negligible
Honestly I prefer it lol jsut easier to type
String.format gave me those LF characters
Stop pinging me if you dont wann help
https://paste.md-5.net/gasijaweyi.bash
Cant find some weird ass class, added jna as a dependency but still
I directed you to someone who answered your question.
Stop being so ignorant.
Hey, I'm having issues with creating a inventory menu, players are able to double click a item and pick it up from the inventory which is not supposed to happen, what even do I need to cancel for that?
Which ones are you currently listening to?
He didnt answer my question he just change the code so you guys dont burn your eyes...
InventoryClickEvent and InventoryDragEvent
You have to cancel the first one
You’re still wrong.
i am cancelling both
That automatticly cancels the second
?
Only cancel the first
That’s wrong advice.
Not InvetoryDragEvent
Stop giving them wrong advice.
Ignore that lol
I can’t remember off the top of my head though if I remember correctly there are 4 or so of them to cancel. It’s quite a mess so I recommend using a GUI library instead
Try search the Java docs for inventory related events and you should find a few which apply to your use case
can i send you a screenshot of all the inventory events and you would tell me which one i have to cancel
Bro if you cancel the click event how will you drag smth out of your inv!?!? Its not important to cancel the second one bc you cant drag it in the first place
I can try help
i really dont want to use gui libs
InventoryClickEvent covers everything. All you need to do is write some proper logic.
Since when was this the case? I have always come across code that cancels multiple events.
i did that but i made the player able to modify their inventory while in the menu
so it only cancels for that inventory
Then you are not cancelling the event when you should
If the one event happens to be the only one required then I apologise for stating otherwise.
I probably shouldn’t be providing advice in an area I have little to no experience in
This is the listener for my personal guis.
Never had any issues
this is what im doing right now
@EventHandler
public void onInventoryClick(InventoryClickEvent e) {
if (e.getClickedInventory() == null) {
return;
}
if (!e.getView().getTitle().equals("test")) {
return;
}
if (e.getRawSlot() > 54) {
return;
}
e.setCancelled(true);
}
@EventHandler
public void onInventoryDrag(InventoryDragEvent e) {
if (!e.getView().getTitle().equals("test")) {
return;
}
for (int i: e.getRawSlots()) {
if (i < 54) {
e.setCancelled(true);
return;
}
}
}
7smiles code always lookin' fancy 
You should not identify guis by name. Inventory implements equals and hashCode. Use a Set<Inventory> to check for custom ones.
Try instead of return e.setcancelled(true)
You are still cancelling the whole Event
Because your event.setcancelled(true) isnt in an if Clause
ok man i will implement that but what am i doing wrong
yep thats the whole point
I dont see anything faulty here (regarding the logic).
It might have to do something with the raw slot. Sysout before the return in there and check if it triggers when double clicking.
PS: What version are you on?
Btw they will be able to put items in the gui this way by shift clicking in their own inventory.
it shows the slot in the players inventory and im on 1.19
im pretty sure that this can also be the cause of why people can shift click items into the gui
The last slot of a 6 row inventory is 53 btw. Not 54
oh yeah sorry
I would honestly scrap the slot check. When in a gui: cancel
How can i run a runnable when a variable is a specific value? I want to broadcast a message after the player has logged in and the resource pack has loaded.
Listen for the appropriate event and then broadcast a message
declaration: package: org.bukkit.event.player, class: PlayerResourcePackStatusEvent
ok
But i don't want it to run if the player reloads the pack
I mean, I could use a database to store their logged in status and message sent status but that sounds like a lot of work
Then use a Set<UUID> and put the players id in when he first loads the pack.
Ah, so using a hashmap
Or does it have to be persistent over restarts
Why would you need a hashmap for that?
nah, doesn't need to be persistant
Just a hashset will do.
👍
is there a way to simply make a custom config file that uses yml
Yes. Several.
Im searching for the article
this is kinda hot https://github.com/Jannyboy11/GuiLib/
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
how can i work with configurable percentages in my plugin
like this
what should i do to get a random material from this by the percentage
Add a double config value.
For the chance itself: Generate a number between 0.0 and 1.0 and check if the
configured number is smaller than the generated value.
You can also gen one between 0.0 and 100.0
like this
For this you iterate through all of them and check the percentage
Like a List<PossibleBlock>
where PossibleBlock has the fields
Material material
double chance
Then iterate through the list and check every element
Then nothing will be selected
that is not how it should be
record PossibleBlock(Material material, double chance) {} 
Then be more precise in your description
i want to set a block
to like random with this chances
they might not add up to 100
Am I mistaken, or is that literally the job of records, to kinda be a class with basically only getters and a constructor with the defined objects?
cause none of the plugins i used force you to
and the block type will be set to at least one of them
and the percentage is the chance
there is no way of it not
try 1 tick later
Can we not serialize Entity?
no
barely anything in the API is meant to be serialised
Only with nbt (nms)
how should i do the percentage chances then
the block type will be set to at least one of them
and the percentage is the chance
Where can I find that in the documentation?
or a proper server API 😛
nms and docs ??
thats not possible
nms is not documented. Its mojangs code net.minecraft.server
Oh, I thought it was some acronym for something of the sorts. My bad.
anyone
Can I find NBT data docs somewhere though?
There is a NBTAPI plugin that you can use if you need to work with nbt
If you want to have accurate chances then this is quite hard to achieve.
You will for sure need a fallback material first.
what are you searching for?
Thanks
He's trying to serialize a mob via it's nbt
oh just call one of the save methods on the entity
I mean, paper-api has that already. if you wanna just use NMS without a third party lib you can just look at the impl there
set chances for block types in config
then like do a command on a block and it's type being changed to one of them (with the chances)
like it should have 5% chance of it being emerald
but 20% stone
but it should be one of them
You can use my WeightedCollection to select elements by weight. Its backed by a TreeMap.
https://gist.github.com/Flo0/ab16b0e9050ceff5959a4a8831055f76
But then you need to calculate the weights from your chances.
List<PossibleBlock> as 7smile7 said
and then use a random i -f that whats you mean
forgive me my bad typing im on a new keyboard
so i will add all of them
and then use poll ?
thanks
Yes. But remember: weight != chance
So calculate that first.
the chance?
Do scoreboard team names have any character limits?
Well if it adds up to 100 then weight is chance.
You can also add a fallback value.
I'd wanna say you can set the replacement item in the consume event ?
the poll might return null ?
but that might be paper-api
No the poll never returns null
so if it doesnt add up to 100 what should i do
you can have
X: 250
Y: 250
Z: 500
Then it will be 25% X 25% Y and 50% Z
But there is no limit to your weights
I would just throw them in and use the collection as it is..
Show some code pls
if you cancel it I doubt setting the item has an effect
maybe smile's does too but he took them out
but the server may not respect those modifications
when you modify it
e.g. cancel a damage event, set the damage. Not like the server now applies that damage
when you cancel the event any changes you make to teh event are cancelled too. The event will do nothing. You have to make all changes yourself
yep
There is only one instance of each player
ok thx
How can i reset the overworld, nether, and end from within a plugin
well
is it possible to like
unload the worlds?
hmm
or what if i create another empty void world
teleport all players there
then delete the overworld nether and end files
wait so
is the overworld, nether, and end seperate from each other in spigot?
hmm ok
sure ill do that
but one more thing
how does one reset a world
how would i delete
just delete the folder?
you can;t unload the primary worlds
oh really
you have to delete them in onLoad, IF Bukkit.getWorlds().isEmpty()
damn that wont work for me
can I do it with multiverse?
You can in onLoad, at startup. not once the server is running
i havent used multiverse at all
worlds stay loaded on a reload
does anyone here know forge? if you do then please ping me tbh i dont know many coding servers so
💀
I do
What version are you on?
1.8.9
now i get flamed
im just tryna use mixins man
mixins work in intellij
but not in mc
mixins on spigot ?
?1.8
Too old! (Click the link to get the exact time)
well my solution is to create another overworld, nether, and end and have those worlds act as the default
and then delete those worlds and create new ones when necessary
ok
can i check if its raining on weather change (without counting snow)?
pretty sure rain and snow is the same to minecraft
just depends on the biomes temperature
ah fine
I have not learned item stacks well yet.
I was wondering how do i make so lets say my itemstack thing is called Food
How do i make so the food is enchanted with Unbreaking 3
Its not food but its a stick
@EventHandler
public void onPlayerJoin(PlayerJoinEvent e) {
Player player = e.getPlayer();
if (player.hasPlayedBefore()) {
ItemStack sword = new ItemStack(Material.STICK);
player.getInventory().addItem(sword);
player.sendMessage(ChatColor.GRAY + "Welcome To " + ChatColor.GOLD + "KnockBackFFA");
}
}
}
Like how do i make so the Stick is enchanted with knockback 2
For example
well add the enchantment to it?
ye
And can i also Change the name to the stick
So its like KnockBackFFA
or something like that
declaration: package: org.bukkit.inventory, class: ItemStack
basically you get a copy of the item meta of the item stack
Thanks friend
can i cast GameRule.RANDOM_TICK_SPEED to int?
uhh no?
oh hold on
casting an enum constant to an int is my fav hobby 🙏
WE DONT TALK ABOUT IT
same tbh
i forgor getGameruleValue
lmao xD
is this how to query MongoDB?
db.getDatabaseClient() gets the com.mongodb.client.MongoDatabase from an abstaction i made
BDoc is a BsonDocument wrapper
I am planning on working on a Staff plugin. I want to be able to do /staff and come into a kind of 'staff mode' where i have items in my inventory to tp to players and punish them. But I don't know how to check if the staff mode is active or not, can someone tell me how i should check that?
multiple ways but i feel as though you should learn java before doing this..
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
use a simple hashmap, can even save it into a yml data file and load it on startup in onEnable or something to save if someone is in staff mode across restarts
i already know java? just asking what the best way is
alright thanks dude
?
you could store the collections as an instance if you like
theres
a few different ways
that way is right
but, theres another right way that makes it take in another bson document was a predicate
one sec
i think thats what im doing right nwo
now
sec
i actually have like a one class file i use to handle mongodb on another project i use
ah its called projection
my bad
I had a few issues with MongoDB searching and isnerting without using them
whats a projection
like a view ?
oh so it only gets the values set in the bson projection parameter
?
oh
no it specifically searches for that value
directly
well
i cant remember
its been a while exactly what i did for the projections
i just wrote it once and forgot about it ngl
🅱️Son
bobuxson
data structure inside the mongodb as im sure the 2 diff email fields was confusing
im actually more confusing myself now
How tf that working with 2 different field name
lmao
Don't use atlast self-host a server
whats the difference between a filter and a projection tho
it's easier for testing
oh ive had no issues i was just trying to access theyre web panel
Use Mongo Compass
will have to google that sorry i cant remember
aight thanks
I dont access the front end often
i only used it for rn just for the example of code snippet
i use POJO classes
so i never have issues with mongo where i need to check data
thats why i was suprised when my filter and projection fields were different
i guess projections take priority
hm
when i search google
its talking abt operators
is there like a query language for mongo
which is abstracted away?
by the java driver
OHH
i remember now
okay so when inserting data
in the past
you had to do some weird string bullshit
it was like
set("$set", theData);
And then you had to transfer over its _id too it was ugly
this just prevents all that
i assume its added lower into the api too, where it may do it without needing to specify the excludeIf in projections
yeah it strips the _id essentially
the filter selects the shit and the projections transfer data?
so you can anonymously get the object by strictly values, and not bound by _id
Yo guyz, I have a question. Does any1 use ORMLite? How to define there a one-to-many relationship? Is it even possible? Or is it a bad idea to use this lib?
yeah its a pain without it, you have to manage the _id yourself without which is weird
ORMLite?
just a simple regex question, but based in java. how would i make it so you it doesnt match the ending : next to the }
gotta make particlesss
Ye. Lib to work w/ SQL, u know
oh never heard of it, i always use something like hikari or something
so burchard is this how i would query one user by uuid?
yep should be right
ayy thanks bro
Does break in nested loops breaks all loops?
Sorry i have no idea how regex works xD
no only the current scope loop
for () {
for () {
return; // only in this for
}
}
other for will iterate
To break a specific I need to use like sectionToBreak:
Nah it's fine nvm
ah i see
so youre converting the data object into json
and then do shit
yee
ignore my new Gson in that code if there is
ik bad practice i was lazy at the time lol
lmao
but yeah, pojo with MongoDB is rly nice
oh shit
thats why i always yell at people use mongo when theyre working with an OOP language
yeah
never need to deal with any complicated stuff if using gson
Hey, I'm working on a kinda overflow inventory but I can't work out how to detect when a item can't fit into the players inventory what's the best way to do this?
check if firstEmpty() <= -1
and
when you addItem
it returns a hashmap
if the hashmap is empty all items were added
hashmap is the map of items not added
I mean, what event would you listen to?
This would be something you do when adding items
if your listening to this yourself youd have to make your own event
i dont think anything for that exists
ill check
In a way I want a PreItemPickupEvent 🥲
Why wont EntityPickupItemEvent work?
if getRemaining > 0 -> inventory is full more than likely
PlayerPickupItemEvent is deprecated, so just check if EntityType is PLAYER for that event
https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/event/entity/EntityPickupItemEvent.html javadoc if you want more info on it
I mean that returns the int doesn't it
yes, of items leftover after the player picks up the item
I wanna find the actual stack
getItem()
^
I'm typing too fast sorry
I don’t think so
I’m pretty sure it returns the exact item stack representation of the item entity
Amount included
maybe, docs arent to specific on it but would make sense for it to do that
But you’ll know the appropriate remaining amount from the event anyway
fucking hell
gpg: skipped "XXXXXXXXXXXXX": No secret key
gpg: signing failed: No secret key
error: gpg failed to sign the data
fatal: failed to write commit object
told you run 
Thats looks like google
HELP
is it?
i googled
nono
IS it google
like oauth?
orrr?
what is it

it looks like a google oauth error lol
or an APK signing error
Or
Github commit error
its likely that
is it that hex?
Didnt you have this issue a few days ago?
i beg
Or was it someone else
github commit error 
Someone had the same issue a few days ago
idk the solution but i think it was alex who helped them
you most likely have a gpg configured that you just don't have
I DO
i use github desktop 
depression
gd 😎
did you configure it ?
gd?
wait kind of new to nms. does something made on spigot will work on paper?
Yes
untill they break it yes
Is there really no way to run the plugin within the IDE, and debug it normally?
It's a huge setback to have to scrape the logs everytime
https://www.spigotmc.org/wiki/intellij-debug-your-plugin/ I think this is the right wiki on a version of it
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
... I was told it was impossible, and because of that, i've been spending way too much time on my bugs...
Well, thank you guys! I'll look at it.
Wait, it's for gradle...? I thought spigot was maven only
It's Paper
A fork of Spigot
You will have to be a bit careful with the methods you use to maintain spigot compat
The wiki that Rack linked is for Spigot
Yeah
assuming you are setting the meta back on the item yes
Cheemsy
Yo, guyz! Has anyone used ebean? Is this a good lib (orm)? Or is it better to use smth else? 🥴
I think Hibernate is the standard
I know I've worked with it, but it weighs.... So, that's why I'm looking for some lightweight ORM...
I'm not being able to install the 1.7.10 version of NBTApi
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>AOSPlayerManager</artifactId>
<version>1.0</version>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>com.github.azbh111</groupId>
<artifactId>craftbukkit-1.7.10</artifactId>
<version>R</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.9.0</version>
</dependency>
<dependency>
<groupId>de.tr7zw</groupId>
<artifactId>item-nbt-api-plugin</artifactId>
<version>1.7.10</version>
<scope>provided</scope>
</dependency>
</dependencies>
<repositories>
<repository>
<id>codemc-repo</id>
<url>https://repo.codemc.org/repository/maven-public/</url>
<layout>default</layout>
</repository>
</repositories>
</project>```
Here's my POM... is something wrong?
What's the problem
.
The nbt api dependency doesn't appear in the maven dependency browser in intellij, and doing it manually doesn't work
Is there something wrong with my POM there?
run package goal
i have
and send the output of terminal
For sure
bruh.... bee UUIDs change every time they exit/enter the hive 😐 are u fr
Really, there's only this. Unresolved dependency: 'de.tr7zw:item-nbt-api-plugin:jar:1.7.10'
Ah, I thought the version was the mc version, but no.
What's the 1.7.10 release of the nbt api?
Idk but update your mc
That's for sure
Fifth person to tell me that. It's a requirement, not a personal choice.
You're going to have to ask the author
Requirement to what
The server i'm developing the plugin for runs on 1.7.10, it's not really up to me.
It mentions that it does
1.7 xD wtf
you better be getting paid like 5 grand to code something on 1.7
lmao