#help-development
1 messages · Page 387 of 1
If you are you are probably going to have to do it with a child first class loader
Priority, probably
Somebody know why I got this error?
I've set this as both the highest and lowest and it didn't make a difference
Wouldn't relocate like that tbh, using shaded as a parent package is not the intended idea. It should be your root package. You also dropped a package (code, I think) on a relocation.
The event is being cancelled by another plugin completely.
Could you show me what you mean?
So, I'm trying to use that and import all needed stuff but their is some things that don't wanna be imported
Oh, maybe set ignoreCancelled on the annotation?
Ah that's a good idea
This is written for ProtocolLib 5.0.0 and Spigot 1.19.3
I'm using Spigot 1.19.3, but to be honest I didn't knew ProtocolLib 5.0.0 was out, I thought 4.8.0 was the last
4.8.0 doesnt even work for 1.19
Oh, first time trying to use it in this version sorry 😅
ok shade all your dependencies and don;t relocate. You shoudl be treating yoru classLoading as a child
shaded should be your root-package. Like country-code.your-nick.your-plugin-name. This is the only "guaranteed" way that you won't have namespace collisions and mess your versions up again. com.google.code.gson also became com.google.gson in your relocation. If you relocate, the corresponding imports/FQNs will be patched too, so there's no need to shorten anything and thus maybe make it misleading.
^ you could
Which one is better to do?
Oh, we're talking about custom classloaders here, xDD
Still getting the error
Is there a different way to use 5.0.0 ? Cuz I tried replacing 4.8.0 by 5.0.0 but it don't want to
Is this the error we're talking about?
This
How Can I use NMS in my plugin?
<dependency>
<groupId>com.comphenix.protocol</groupId>
<artifactId>ProtocolLib</artifactId>
<version>5.0.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
Oooh snapshot, sorry. Where do you find these information, I couldn't find them myself
PS : I still get an error with ```java
TaskManager.scheduleSyncDelayedTask(() -> {
it wont let me import a thing
Did you set the plugin class loader as your class loader's parent? I think you tried to operate between two separately loaded GSON classes. They may have the same FQN, but are in different "modules", or what it's called. Don't quote me on that, but it would be the easiest to try.
no
Yeah, after thinking about your stacktrace some more... It just looks like a version mismatch indeed, xD
Read the comment above this line
So how would I fix that then?
You don't access your relocated Gson, the FQNs in the stacktrace all start with com.google.gson. You relocate com.google.code.gson.
It work perfectly, I don't know what to say, just thank you 😭
And sorry for all stupid question I could ask really !!
That's what im what dependency is though com.google.code.gson
Omg that fixed
There is no way
Is that error you posted occurring when you try to load something through your classloader?
What was it?
Changing it to com.google.gson for relocation
yes
How the hell did that solve it
Now another error is occurring though
The class you're trying to load shouldn't have these relocations applied
So it should trip up there
Now I'm really curious, mind posting that? xD
https://paste.md-5.net/aqidatafic.pl Now im using 1.8 just because I had a server already made but again this is not a plugin
What is what?
I'm just trying to gather data from a jar
Interesting the error does not occur when you use 1.18 but 1.8 it does
Trying to load a server jar? I just really don't get why there are nms/cb packages when it's not a plugin, xD.
Because I originally had made it into a plugin then decided not too
are you trying to modify at runtime, like mixins?
Now its not suppose to function as a plugin though
SafeConstructor extends BaseConstructor, means that Type 'org/yaml/snakeyaml/constructor/SafeConstructor' (current frame, stack[3]) is not assignable to 'org/yaml/snakeyaml/constructor/BaseConstructor' doesn't make sense to me...
Not modifying anything
🤷♂️
You add snakeyaml as a dependency to your project, so I guess 1.8 expected another version, and you just load the one you (seem to ) shade, instead of the one the jar itself contains
Yea
Try relocating your snakeyaml too, so the class loader is not using yours
1.8 moment strikes again
Yea that worked
If I'd only get a penny every time somebody complained
Any other exception appeared? xDD
Can you send the pom again?
...
That relocation is basically a noop, xDD
Try <shadedPattern>shaded.org.yaml</shadedPattern>
How would i make this animation faster?
new BukkitRunnable() {
int i = 0;
int x = -360;
public void run() {
i++;
if (i < 100) {
armorStandLoc.add(0, 0.025, 0);
} else {
stand.setHeadPose(new EulerAngle(0, Math.toRadians(x) , 0));
x++;
}
stand.teleport(armorStandLoc);
if (i >= 200) {
cancel();
stand.remove();
openCrate.resetOpenStatus(player);
new crateRewards(player);
}
}
}.runTaskTimer(Casino.getInstance(), 0, 1L);
}
```
How can I display a item in chat using the hover event. I can get a hover message made however I cannot get an itemstack to be turned into a base component array
Either increase your step size or - if you need to go faster than the tick rate - you need to go into your own thread.
Arh okay thanks
Just make sure you're not going to block the server from shutting down, xDD.
RIGHT
I frogot about that
Yeeeah maybe ill just increase the step size haha
Or rather make sure that the thread dies if the plugin unloads. Something like
new Thread(() -> {
while (this.running) {
Thread.sleep(x);
}
}).start()
And then set running of your instance to false when the plugin is being disabled.
Yeah i could do that, but its probally better to increase step size relative to server performance
Really depends on what you're trying to do. If you want to play animations above 20 fps, you need to take that route. If just increasing the "delta" per step is enough to solve your problem, that's fine too.
Tbh, without understanding what you're doing and how you do it, that one is a bit too far out for me now, xDD.
Yeah, it should do, I don't need high fps animations.
"oh yeah I'll just tweak a quick thing for a release before bed"
that was nearly 6 hours ago
this is a nightmare
imagine having code that's so messy that it takes 6 hours to tweak something real quick

tbf I'm dead sure the inventory#remove(itemstack) method is just not working here
nah
the item isn't null, I can see that it is identifying it correctly
it's just not removing it
well
Unmatched nbt data probably
Inventory#remove is a bit picky with amounts
it's just a sword
it does equality checks
Is there a way to create fake players with the new game profiles?
durability maybe?
and I didn't modify it in any way, that is sort of the point
no durability change either
Only when using ProtocolLib or NMS
I don't really know how to fix this one ngl
make your own remove method
Yeah just iterate the inv and check every slot with isSimilar ^^
Unless you want to keep track of the amount
or do your own checks if you're hypixel
I might have to do my own checks
mfs out there associate an NBT ID and compare the ID instead of comparing meta
I need to test something, it's just a pain because there's seemingly no unified array for all inventory contents
Was just a world gen problem xD
but apparently makes checks like 5x faster
I have this really weird suspicion
because it's on the same tick I'm teleporting players
across worlds
and I just have this nagging suspicion it's a minecraft bug
nobody:
hypixel:
One of the things we changed within Spigot, was ItemStack and ItemMeta comparisons and accessing. Spigot was comparing NBT Data in a way that was not efficient, and with the sudden rise in SkyBlock popularity, all those items you see in chests, inventories, etc were constantly being compared against each other, especially by things like hoppers, etc, so what did we do to fix it? We added an ID to the NBT compound, then when we first compare items, if they are equal we sync up their IDs and we know for certain that they’re the same, we also track the parent of each NBT Tag, so when something changes within it we change the ID and thus the process begins again, this makes it much faster for us to do just as many comparisons.
I mean seems like it makes sense
Comparison cache, what's wrong with that? xD
It's probably just a hashcode
what in the fuck did I just see
I swear something's wrong I can feel it
this is further compounded by this not being consistent
god this is such a stupidly overkill feature too
I'd regret ever making it if it wasn't so fun
ooh
did I flip current and upgraded
ok it looks like somehow I did
argh I know what happened
I forgot that the upgraded itemstack was using a shallow copy of the original
aight now it's good
speaking of pushing, I'm up to 350kg on my leg press now
the path to 400 is real
pretty sure I was pushing that when I was 15
how much are you pushing today
so basically what you're saying is you don't even lift bro
I go there once in a while, do the same chest & triceps workout and fuck off
one step closer to yeeting you off a cliff
the difference between me n u is that I can write good code and you flex about pushing light
I am pretty sure the real difference is that only one of us is dodging taxes
I saw a guy that looks exactly like you, today
dont remember where tho
impossible, no one can look this good
they couldn't place an offer on my position as a strongman, seems like you really destroyed their budget with your clowning around
well I think I see the immediate issue here, players are out of an instance before it's time to loot
we both know those are styrofoam weights 
that's why they didn't have the budget, do you even know how much 1 ton Styrofoam plates cost?
not to mention it would barely fit in the country, part of the gun show would be happening in spain
ant iq
don't be so down on yourself, I'd say you can reach portuguese room temp in these winter days
you forgot I live in the south
convert it to fahrenheit and it equals your height in cm
aren't you shorter than me?
nope
how tall are you
188
if you think 3cm is nothing then I feel sorry for your wife
go take your schizophrenia meds again, you are seeing things
oh yeah I forgot your wife doesn't exist
we know
yeah I'm helping illusion develop some character
So why are you still here talking about wives? lol
Go to #general or just stop talking 
Either is fine
according to your pfp, is magma the one on the left?
man go clone yourself a couple of times so you can collectively have a few braincells to rub together, (s)he said (s)he was my wife
aight ladiesman
well now I need to delay the dungeon ending by a bit
not sure if that would work, could try it but might have to specify in code where its at
from what I gather it expects it to be in your root jar directory
well the root of your project
Just noticing I've never put permissions into the plugin.yml but always checked for them in commands... I recall testing before I knew about this and everything was working but how bad could it end up
Can anyone explain why my config.yml wont update?
it keeps coming with a broken version of my config..
even tho I removed it
?paste
code and error
no error.
and i have no idea where the error is in the code.
i changed server. that worked...
what is wrong?
Code:
public class RankAddListener implements Listener {
@EventHandler
public void onAsyncPlayerChat(AsyncPlayerChatEvent e) {
Player p = (Player) e.getPlayer();
if ( !(p instanceof Player) ) return;
if (!RanksMenu.addRank.containsKey(p)) return;
e.setCancelled(true);
String msg = e.getMessage();
if (msg.equals("-")) {
RanksMenu.addRank.remove(p);
p.sendMessage(ChatUtils.format("&aZrušil si pridávanie ranku."));
return;
}
String faction = RanksMenu.addRank.get(p);
p.performCommand("f " + faction + " create rank " + msg);
p.sendMessage(ChatUtils.format("&aÚspešne si pridal rank &e" + faction + "&a."));
RanksMenu.addRank.remove(p);
}
}
Error:
easy fix though
just use a scheduler
BukkitScheduler#runTask
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
I want there use same code as on performing command 😄 thats, why I called command.
I will take look on that thanks
https://paste.md-5.net/dafudihulo.java
This would cause lag right?, sorry for the ghost pings i had to rewrite some stuff
You know I wanna try to make a antimalware detector for plugins
what?
Is there a method for converting hex and colors in this channel?
I have a method but i don't think its good
And i lost my one good one 🤨
okay I have no clue where to start on checking for things
How do I use dependencies in my plugin? I'm trying to use snakeyaml
In your pom.xml or gradle.build
Why is this a problem?
Because you didnt specify a variable with the name "ork.snakeyaml.version", did you
yea what that guy said
Just put a version number in there
I just changed it to a number
Converting to what?
hex 2 hex
Just to chatcolor format
Usually you would do something like this:
<properties>
<java.version>17</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<org.snakeyaml.version>1.33</org.snakeyaml.version>
</properties>
Since its &x&1 ect
ah I see thanks!
It's interesting to see people program in vscode
I used to have a good method for converting but i dont anymore
i made 1 recently idk
// Converts &#RRGGBB to &x&R&R&G&G&B&B
private static String toSpigotHex(String text) {
StringBuilder sb = new StringBuilder();
for (var i = 0; i < text.length(); i++) {
var c = text.charAt(i);
if ((c == '\u00A7' || c == '&') && i + 7 < text.length() && text.charAt(i + 1) == '#') {
var hex = text.substring(i + 2, i + 8);
if (hex.matches("[a-fA-F0-9]{6}")) {
sb.append("\u00A7x");
for (int o = 0; o < hex.length(); o++) {
sb.append('\u00A7').append(hex.charAt(o));
}
i += 7;
continue;
}
}
sb.append(c);
}
return sb.toString();
}```
whats the -1 
oh
so funny thing
i did try doing that w Pattern and Matcher stuff
public final Pattern HEX_PATTERN = Pattern.compile("&(#[A-Fa-f0-9]{6})"); happy birthday
but it ultimately just shit on me bc i was too stupid
but yeah ig i couldve just not tried to overcomplicate it and just used Pattern#matches or w/e
I mean all you really have to do is pattern.matcher(string).matches()
yeah the thing is i was trying to use the result of the Matcher
Matchers aren't necessarily cheap but it's better than recompiling the regex is all
and it was not having it
private static String translateHexFormat(String text) {
StringBuilder sb = new StringBuilder();
Matcher matcher = HEX_PATTERN.matcher(text);
while (matcher.find()) {
if (matcher.start() > 0) {
sb.append(text, 0, matcher.start() - 1);
}
sb.append("\u00A7x");
for (int i = matcher.start() + 2; i < matcher.end(); i++) {
sb.append('\u00A7').append(text.charAt(i));
}
text = text.substring(matcher.end());
}
sb.append(text);
return sb.toString();
}``` this is what it was originally, it *almost* worked, but fell apart real fast
hmm
it took me days to realize my issue was i was modifying the original text string without updating Matcher
so i shouldve gone for an approach that either didnt reassign text or update matcher on each iteration (gross)
ive had intellij yell at me enough times for concatenating in a loop that its drilled into my head to use StringBuilder
Good. As it should
Why does it require StringBuilder?
I see intelliJ warn me about it all the time. What's the con about using strings?
String concatenation in a loop isn't very memory efficient so if you can use a string builder you should
How bad is it?
Cause I do it all the time
But my strings in fors are usually small fors, not huge or "infinite" loops
Very, very old answer (and tbh the JVM has probably gotten better since then), but this is generally the reason
https://www.reddit.com/r/java/comments/nk7ch/comment/c39r41h/?utm_source=share&utm_medium=web2x&context=3
Oh I see
So in small loops like fors of 5-10 shouldn't be too big of a issue, just a good practice to start doing
I didn't know it was an issue, sometimes intellij gives warnings for code efficiency that isn't properly a problem.
I'll start using StringBuilder from now on, thank you
the issue is more or less the JIT being unable to optimize that code better
if it was in a loop
especially nested loops
nested loops do not always get unwound, therefore other code bits may not get optimized as well because of it
can someone send me the link for an NMS Mapper
can't find one
😅
and again i lost mine because my favorite's reset
nvm i found one
fr
hey, i am making a plugin that adds new bosses, and one of them is spider boss, and i wanna make it to be 3times bigger than usual spider, how to do that?
with mods
like?
Resource packs should be able to do it
but the hitbox wont be 3x times right?
what is the topical method to create and manage minigame arenas?
Best way people manage commands without making a big mess out of the OnCommand method?
make a single class for it
I can show you an example
Yes please do
getCommand setExeuctor API
That is pretty cool, never thought of it that way
Don't you have to do this to register commands anyways
I didn't want to spend time adding a bunch of commands to plugin.yml
so all those commands are technically subcommands
yeah but instead of making your plugin class the executor you use different classes
But tab completion 😢
I never cared for it and this plugin was made before that
but even if it wasn't I still wouldn't care about it
Yeah I have my TabExecutor class for a single command that is 70 lines long and has a lot of boilerplate checks
since I typically keep my commands pretty easy to use and remember, as well as documented on the resources page I don't care about those that rely on tab completion
I would rather refactor it to make it easy to add any arguments to any sort of command than rewrite some things 10 more times
That's fair
see
although server tutorial needs to be updated to work again which I will do at some point lol
you could make a base command class that implements CommandExecutor with utility methods for that
Yeah that's pretty much what frost used as an example, each argument was its own command essentially
Dang that's pretty documented lol
🙂
i finally got it working!!!!!!!!!!!!!!!!!
can i stop kick message from showing in console?
probably you can by altering server's logger instance
but i dont know how that would work
maybe there's already configuration key for that in one of the server's YAML files?
?pdc
Ty
how can I differentiate the inventory from the top one from the bottom one?
Top and bottom inventories from the view
ok, but how can I cancel clicks only on top inventory?
ok, thanks
Inventory inventory = e.getInventory();
if (inventory.equals(e.getView().getTopInventory())){
e.setCancelled(true);
}```
This doesnt work, somehow
tbh working with raw bukkit inventory api is pain
just use a library
i prefer TriumphGUI but check others too to see which one fits your needs
I just need to cancel clicks for the top inventory
what event are you listening to?
InventoryClickEvent
Don't forget the DragEvent
shouldn't InventoryInteractEvent cover them all
you cannot listen to it iirc
why not?
or there is some other catch, but I recall not being able to use it
it being abstract and not having the HANDLER field
^^
ah
Working with native bukkit command api is more painful
Working with the DFU is more painful
agree
DataFixerUpper is really the worst name mojang has ever created
?paste
im getting this errror:
https://paste.md-5.net/nonanivare.bash
(java.lang.NoClassDefFoundError: net/minecraft/nbt/Tag)
and i cant find anything on how to fix it.
this is my pom.xml
https://paste.md-5.net/axatutuvis.xml
First off, you should be using specialsource version 1.2.4 as it is the latest.
Second, combining a paper dependency with a spigot dependency might be the cause of your issue as the two are getting farther from compatible with each update.
Thirdly, are you sure that you are using the right class name?
well about the 3rd issue, i actually cannot find anywhere where i am using net.minecraft.nbt.Tag im only using CompoundTag
i can try get rid of the paper dependency but is there a good way to do that without breaking all my code?
There's a website called screaming sandals that can help you with NMS naming changes.
https://nms.screamingsandals.org
I don't think there is a class that's just called Tag. I think it's more along the lines of NBTTagCompound
To the second question, are you using paper specific api calls?
acutally yea i dont think im using any paper specific stuff, let me try make backup of my plugin and remove the dependency
i only gotta replace all the uses of components back to normal
Hi
Help plis
You're using the remapped jar correct? You mean back to the obfuscated spigot ones?
no i mean as in paper requires me to use Components for stuff like lore and messages, gotta change all those functions to strings now since spigot uses that
Oh, gotcha.
also this stuff in my commands
I think spigot has those marked that way. Not sure why it's not recognizing it.
isnt spigot @NonNull ?
it uses jetbrains so yeah
yea
nonnull is lombok
idk why but the jetbrains maven dependency got removed with the paper one
so i added it back
i am getting this error a few times:
org.spigotmc:spigot:1.19.3-R0.1-SNAPSHOT/maven-metadata.xmlfailed to transfer from http://0.0.0.0/ during a previous attempt. This failure was cached in the local repository and resolution will not be reattempted until the update interval of maven-default-http-blocker has elapsed or updates are forced. Original error: Could not transfer metadata org.spigotmc:spigot:1.19.3-R0.1-SNAPSHOT/maven-metadata.xml from/to maven-default-http-blocker (http://0.0.0.0/): transfer failed for http://0.0.0.0/org/spigotmc/spigot/1.19.3-R0.1-SNAPSHOT/maven-metadata.xml
also this and a 2 with the remap thing
Don't use http. Use https
Also run BuildTools
again?
oh my bukkit repo was on http
still same errors but it does export
so kinda weird
You mean the overlapping resource?
Is that libs directory in your project?
si
And make sure the package is set correctly in that class
all is correct
Also when i build i get 4 files,
The normal plugin, remapped, remapped-obf, and the original
Does an artifact include the remapped version?
Wtf. I'm trying to delete these two rows from the database since they are duplicates. Why won't it let me? :3
Use the normal plugin
oh alr, does the artifact use that by default?
what do to i have to it work
Send the class you're trying to import
uhh dont think i should, getting an error when i do
content?
What's the error?
it doesnt recognise the remapped classes, as in:
java.lang.NoClassDefFoundError: net/minecraft/nbt/Tag
but when i use the remapped it doesn give me that error anymore
Well that's to be expected. If you aren't using the right dependencies, then your IDE can't make sense of what you're writing.
If that's a valid class path under the remapped jar, then you'll have to depend on that.
so do i just use the remapped version or another way?
Looks like you can't run two queries at once lol
Idk why is that the case
If you absolutely need that class or want to use sane names, then use the remapped jar. Otherwise you'll have to convert your code to use the obfuscated names that spigot uses instead.
That's odd considering it only tries running one.
i really dont like using the default spigot ones, it confuses me too much.
anyways, how can i make that my artifact builds the remapped jar
Just run query manually ig
That's all handled by the compiler. As long as you have the special source plugin setup in the pom, then you just need to run mvn clean package
Probably intellij being goofy
i think it isnt problem with class content, all is correct, but while artifact build it cant find any class in project
Try restarting the IDE. It could just be bugging out.
i have tried it and still dont work
So you didn't put them in the same place as the rest of your classes?
I want to use nms for minecraft 1.19.2 but in my maven dependency it says it can't find org.spigotmc:1.19.2-R0.1-SNAPSHOT.
Here is my dependency ```xml
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot</artifactId>
<version>1.19.2-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
Did you run BuildTools
Did you run BuildTools?
yeah
well if i use this it doesnt build the remapped but it uses the normal one
With which command?
i guess all paths is correct
Wait, are you using the IntelliJ artifacts to build your project?
💀 you're not even using maven
java -jar BuildTools.jar --compile craftbukkit
oh yea thtas smart
You need to build 1.19.2
well yea thats how i learned it from some1, cus thats the only way i know how to change the output directory
IIRC, you don't need to compile craftbukkit, but rather provide the version you want to build.
You need to run
java -jar BuildTools.jar --rev 1.19.2 --remapped
Remapped only if you want to use mojang mappings
?nms
^^ Mojmaps guide
ok, thanks. I'll try that
since if i do that it just replaces the current plugin (so it updates) and then i dont have to close the server
Oh, well maven is different. You'll want to use the panel on the right hand side to do your stuff.
can i change the output directory of the remapped file?
Hey, what is the best way to get all near block of a player ? Like to get all wool in a radius of 10 blocks
For loop
Yes, you can specify it in the pom.
it's the only way ?
Get the players Block as middle and then use 3 nested loops iterating over x, y and z
from -radius to +radius
I'd recommend setting up your build section accordingly.
<build>
<defaultGoal>clean package</defaultGoal>
<directory>../target</directory> <---- This is where you can change the output directory.
<finalName>YourPluginName-${project.version}</finalName>
<resources>
</resources>
<plugins>
</plugins>
</build>
Then use the middle Block and call getRelative(x, y, z) on it
Ok, I tried to loop block around a player and the tps didn't really liked it lol
clean shouldn't be used as a default goal. For testing purposes to get things building right its fine, but once that is figured out it should be removed otherwise you lose out on some compiling speed ups
Yes if you use a radius of 10 thats 10^3 or 1000 Blocks each tick meaning 20_000 Blocks per second per player.
So for 20 players this is 400_000 Blocks per second.
if i put like "d:/whatever" in the directory will that work?
Yes, that should work.
So long as you have permission to write there of course.
How often do you need to check?
Ah gtg
Yeah :/
so if i run this it should automatically work?
i need it to be every second 🥲
I believe so. I use the play button on the right hand side to run the default goal.
ok well it works but it removes everything in the directory and pastes ALL of the different files
I guess you can sort-of temporarily remember recently fetched blocks which reduces lookup times but it won't do too much
Really? I was unaware of this. I just got used to adding clean since it would almost always never work upon a second build.
I'll still have to loop the block in case there is new one
I'd even say the oppose: You should use clean
I had a project where not using clean would double the size of the jar
- the name only changed the default one not the remapped version
Yea, that's what clean does. It removes the contents of the output directory. It's like starting fresh if you have a build that's failing for some odd reason.
wdym ?
was about something else
Ok sorry x)
ahh okay, how would i ONLY build the remapped file into the folder?
Just use the package command.
You can just listen for block changes though and update the cache depending on that
it still builds all the files, and only renames the default one
Oh, are you wanting just the compiled jar file to be moved?
finally i fixed my bugs with node autocompleter 
it was my fault not paper or bukkits
i just handled it improperly
Then you might want to use the maven-jar-plugin instead of changing the output directory.
Also, you'll want to use the normal jar that's not labeled remapped since the specialsource plugin converts it back to the obfuscated names.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.3.0</version>
<configuration>
<outputDirectory>../wherever/you/want</outputDirectory>
</configuration>
</plugin>
how to configure kotlin in intellij idea i did everything and it still says kotlin is not configured
do i change the build thing back to package clean
You can just change it package. You'd want to remove the <directory> tag that you created since the plugin will take care of moving the jar file.
alright
How did you make project
You can just select kotlin preset in intellij
i had everything set up in java
this is... weird?
it makes a folder with all the classes in the outputdirectory instead of the plugin file
How do you expect kotlin to work then?
i clicked convert to kotlin then setup kotlin made sure everything was correct and then it always shows me that kotlin isnt setup
alright thanks @kind hatch it works
i created new project with the same classes and now work lol
yea that happens idk why
it depends what exactly you are doing, but you should always try to setup your build where clean isn't necessary to make it work
h
part of the speed ups that you miss out on is caching, maven is smart enough to know to only re-compile what was changed and not everything
but it just depends what exactly is happening in your build process that would prevent being able to take advantage of such things
How do I spawn an entity using nms
why?
I want to spawn some sort of indicator behind a wall and I want to use a shulker to do this since I can give it the glowing effect but I only want to spawn it for one player
Then you don't spawn them at all, you only sent the packets needed
Sorry, thats what I meant
Not me accidentally deleting half my database entries cause I put in the wrong query. 🥹
Thank god it's a test server.
Sounds like you don't have triggers 
Triggers?
I'd avoid creating an NMS entity myself, as that adds unnecessary coupling. There's CraftWorld#createEntity, which is basically a factory function that accepts a Bukkit entity class. Then, there's Entity#getBukkitEntity, use this wrapper to customize the entity according to your needs. Afterwards, you can just send the PacketPlayOutSpawnEntity followed by a PacketPlayOutEntityMetadata to the player you want to spawn this entity to, instead of adding it to the world.
Anyone know a clean/neat way of requesting tons of user input in java, If i carry on with just using scanner variables etc it's going to end up seriously messy
There must be a better way
Just from taking a quick glance at your code, I don't think that it would lag, no. The only thing that I'm wondering about is that you can actually teleport an armor stand from another thread, but as long as that works... you should be fine, xD.
Do i need to teleport it from another thread tho?
By tons you just mean many prompts, right? Whatever logic you use to create those could just be hidden behind a blocking function, which returns a string and accepts a string as the prompt it displays. Not sure what you mean by the mess it creates.
Well, your animation thread is another thread, relative to the world thread. Usually you'd need to re-synchronize, which would then ruin the idea of running above tick-speed. Does it work, did you run the code yet?
Yep that works
Okay, then there's nothing to worry about! :)
Perfect thanks for the help
likely through libraries such as picocli
why does intellij show kotlin is not setup when i clicked setup kotlin and did everything
Just for looped through a list

Use bulkInsert
Use BulkWrite along with InsertOneModel
oh wait nvm read that wrong
Ok, thank you. Could you tell me how I send a packet to a player in 1.19. I have tried ```java
player.getHandle().connection
But the connection variable doesn't exist
Player p = getThePlayer;
((CraftPlayer)p).getHandle().whatever
Which one is the full-grown wheat the WHEAT or the LEGACY_WHEAT ???
HIIII
and what fnct would I have to use to send a packet
why does intellij show kotlin is not setup when i clicked setup kotlin and did everything
All materials that are prefixed with LEGACY_ are there for compatibility reasons. Use the normal one. (WHEAT)
if it is unobfuscated, Connection.sendPacket
I believe it is obfuscated for me
what version
If you - like me - don't want to rely on libraries to do this, I'm afraid that there's no easy route to be truly version independent. What I'm doing is the following: Find the field of type EntityPlayer in the Player's class, get it on the player, find the PlayerConnection field on the EntityPlayer's class and get it on the entity player instance, find the NetworkManger class on the PlayerConnection, get it on the player connection instance, then invoke the packet sending method on the NetworkManager which looks like _(Packet<?>, PacketSendListener) or _(Packet<?>, GenericFutureListener<?>) or _(Packet<?>, GenericFutureListener<?>[]), depending on your version.
Player p = null;
((CraftPlayer)p).getHandle().b.a((Packet<?>) Yourpackethere);
latest version is this
^
If you're really going to use this approach, you should centralize it and write your own sendPacket(Player, Object) helper method, to have a single point of change when updating. Don't scatter it throughout your project, xDD.
ok, thank you
Hey,
has anyone any idea on how to easily generate a Get-Down map?
That a minigame where you need to just on almost randomly placed blocks about 100 blocks down without dying to fall-damage. Normaly the Map is a cylinder in which the (randomly) placed blocks are.
I thought of using multiple hightmaps and place blocks on different levels. But another question would be how to check if they are in the cylinder.
**Anyone any advice? **
Yeah sounds easy
why does intellij show kotlin is not setup when i clicked setup kotlin and did everything
just pick a few y values, choose random x & z coordinates and then use a circle equation to check if they are in the circle, ie:
x^2 + z^2 <= radius^2
Depends on how you look at it. If you want a distribution that actually feels random, you're going to have to add more logic than just generating 2D points in a given circle. There will be added constraints like the minimum distance between two blocks.
almost randomly, xDD
ah, i was looking at the other randomly
Oh, thats good!
yea, a minimul and maximum distance would be nice but not the most importaint one
how i can fix this please i don't know in game (bedwars 1058) kick me whit this error
internal exception: io.netty.handler.codec,decoderException: the received string lenght is longer than maximum allowed (46>16)
smells like scoreboard issue
smells like you
ah yes, I am an io.netty.handler.codec.DecoderException
why does intellij show kotlin is not setup when i clicked setup kotlin and did everything, i can send you the pom.xml file
Are you requesting help for somebody's plugin in help-development? :-:
yes sry
The thing just is that I have no idea on how the plugin operates internally, so it's going to be hard to help you out. As already pointed out, this sounds like a name has been too long, either in the tab or possibly even in the sidebar scoreboard.
the more i implement my project in decoupled core classes, the more i hate it
THANKS
its very hard to maintain bukkit compatibility with good performance (i mean it works, but it loses couple of cpu cycles because of the conversions of collections and objects)
sry caps
Uhm, I'm not sure that this is how it's supposed to feel, xDD.
Which feature are you trying to make compatible with multiple versions?
my main idea was to decouple core from the bukkit api completely (not even an import of bukkit api)
while creating an implementation of bukkit api plugin in a separate submodule
but i think its useless rn
since i dont develop this plugin on multiple platforms
Sounds like pessimization to me, xDD. Adding a lot of needless CPU work.
why does intellij show kotlin is not setup when i clicked setup kotlin and did everything, i can send you the pom.xml file
decoupling is a good design pattern, but pointless unless you plan on multiple server types
Hello guys
Who can help? Make a plugin on api 1.12.2?
Please
The plugin is light, it is necessary that when the player wears a gold bib, he wears the whole set. Please help
?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/
That would be a required sacrifice though if one would want to not have the entire plugin be licensed under the GPL
What?
Anyone help me with this ide warning? Asking me to declare T type but i have no idea, it's for mongodb
We don't work for others here - especially not for free
just supress it
It won't let me
#getMongo returns a raw collection for some reason, so you have this issue
MongoCollection<T>
Add generics then
The plugin is light, it is necessary that when the player wears a gold bib, he wears the whole set. Please help
I'm surprised the IDE doesn't complain here
We already told you this is the wrong place
😦
(also what's up with russians trying to get us to develop plugins for them? This is the third time this weekend)
Do you by any chance have something to do with the ladder guy from yesterday? lol
what confuses you
for (initializer;condition;step)
So technically for (;true;) is valid and equal to while (true)
My friend and I have my own project, but he died due to an accident... Not having time to finish this plugin
Basically something that is run when entering the loop
Such as initializing the counter variable (that is the most common use)
im sorry to hear that but im sceptical.
Myeah....
And you think we would believe THAT?
seems your new friend isn't done
I am Afghan...
Hi Afghan I'm superman
💀

So that's why you wear your underpants on the outside, oh its all making sense now.
It's because usually we increment by 1 every time we step through the loop fully
its an old technique of C programmers, who think that ++i is faster to compute than i++ because it returns your the current state instead of previous one, thus no storing of previous value is needed, thus faster impl can be made
I did that before I was superman 🙂
but its not true anymore afaik these days
So we established you are a bit special then.
However an increment of 2 is also not all too rare - sometimes you get other loops too
it may be different in JVM though
use gradle
Ant is very old and less and less supported
Iterator it = getIterator();
for (Object o = it.next(); n.hasNext(); o = it.next()) {
}
Is also not too rare
or put the iterator in the initialisation
i prefer:
for (Iterator it = getIterator(); it.hasNext();) {
Object object = it.next();
}
it is not - both compile down to IINC 1
i prefer to not use an iterator :)
ah, it should be it - forgot to rename it
best with iterable objects:
for (Object object : objects) {
}
objects.forEach
Yes but then we don't make use of the step.
who cares 😄
Well if you want to demonstrate what it can do it might be useful to not keep it empty
StreamSupport
.stream(iterable.spliterator(), false)
.collect(Collectors.toList()).forEach
```
i still dont get it why people use streams
i for the filters or anyMatch/noneMatch and a few maps (convertions)
personally for me, they make code hard to read
unless i use parallel streams i see no benefit of using those
?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. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
are you going to write it yourself or do you need someone to do it?
?
Another (at least where I am active in) common usage of for loops is:
for (AbstractInsnNode a = method.instructions.getFirst(); a != null; a = a.getNext()) {
}
?
?
I'm new to this, I wanted to ask if someone could help
!
And I did ?ask so you can ask you're question
you still havent told us what you need help with specifically
Does anyone have an idea on how I can get the distance between me and the player i'm looking at ?
ray trace
math
but they just wanna know how you got it, not the actual answer
I want to write a plugin for privileges, but I don't know where to start 👍
?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.
dunno what "for privileges" means but you can google a tutorial on how to start ig
he meant for perk members
dunno what that means either
1.12.2 ?
in slavic languages privileged means a donator or smth like that
he wants to make features for donators
prefix
If you want to write a plugin for perks/permissions look into how permissions work, how configs work, and how commands work.
Don't forget to learn java first
Knowing the basics is important
Benefit of the doubt. But big doubt
doesnt GPL enforce you to have your plugin open source
You can work around that through absurd amounts of abstraction
quite the way to do it for a simple .distance
considering it's a spigot discord, it isn't clientside
that assumes you know the location of the player you are looking at
me who knows exactly nothing about licenses and always picks gpl3
Right
I always pick MIT or BSD
How else would you get the distance of the player you are looking at
You're right
isnt the point of mit that you can do whatever you want with the project?
but you have the mention the author or smth
5 blocks
Yeah - more or less
It looks more like 6 blocks than 5 blocks to me
RAMBLE!
I don't even think you have to do this
For example pterodactyl is under MIT, dave was like do what the fuck you want, idc, it's mit
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
Perhaps not explicitly, but implicitly the author must still be mentioned somewhere through the copyright notice
(I also find it funny that I'm one of the few plugin devs that has added a command to dump the license of my plugin (in that case it was the GPL - so even more fun) to the chat)
Cleanest way to generate a random string of letters and numbers?
generate a uuid xD
Not spigot
Create a String with a-z,0-9 and randomly select chars from it...
UUID is nto spigot
UUID is java
I was just clarifying I'm not talking about minecraft
Well UUID is even more general. Every proper programming language supports the UUIDv3 model
UUID is Java so for anything
I know
Anyways, how would i spawn a "dropped item" using packets? Cant figure out how to convert an itemstack / material to Entity for the packet parameter
Have a dictionary of common combination of letters and then randomly pick a combination depending on how common the combination is
I think it's called a Markov chain? Idk, would need to look it up
What do you need this for?
Just creating a random id for person in the database
Use a UUID
sounds like uuid is a perfect solution
Just looking for different ways of doing it
kk will do
Yeah, UUID is the proper solution there - and markov chains are definitely not the solution
Oh, alright then 👍
do UUIDs work if the server is running in offline mode?
work?
what happens if the online-mode field in the server.properties file is set to false?
why don't you just try it lol
Well it depends on what UUIDs
Then every player that joins will get a random UUID which is connected to his name
it generates random uuid
for each player username
and stores them inside usercache.json
until it expires
If two players join with the same name they get the same UUID
UUIDs you manage yourself won't matter - but player's UUIDs are selected through the md5 checksum of the player name with some extra characters added as a salt
online the UUID comes from Mojang
why would you salt an uuid?
I dont even think you can join with the same name
wouldnt it just say that that person is already online?
if it tasted bad
Two players can join with the same name, just not at the same time
no idea - mojang does it anyways though
well yeah, to the server it is the same player
I think the salt is Offline player:
you cant join with the same name in the server, even native client would not render correctly since packets would be incorrect
protocolwise nothing forbids it
except perhaps the tablist and scoreboard - but that can be worked around
well client rejects entities with same uuid iirc
doesn't the client only know the EID?
yeah think so
could be
is there any better way to remove duplicate Strings from the collection apart from using set?
sort is closest that i could think of
set is the only efficent way of doing it
problem is that i need to convert set to list after that
i am bored
staying with list can easily get you O(n²) complexity
HashSet?
It's impl of set
how could get these slots?
https://cdn.skunity.com/2021/03/6935_fb4be127ab21d785540efc124ed9a94b.png
or HashMap.
var var10001 = new HashSet<>(list);
list.clear();
list.addAll(var10001);
yea that's what i do currently
set string as the key and array of where the strings are as the value.
im thinking if there's more faster way to do this
since i believe that iteration of set could be kinda slow
Well you might want to ask yourself why you are using a list in the first place
because im forced by the bukkit api 😦
For what?
setting aliases
pft - why care about efficiency there?
You only do it once
congrats - that is basically my code but worse
i think i would use this but with fastutils
i mean for converting to the list.
since it could use System.copy sometimes
commands
Yeh optimizing or worrying about performance there is a waste of time
Yeah like at most you loose 100 µs every time the server starts up

Time you would lose converting to a Set or however you want to process it
solved
Inventory inv = player.getOpenInventory().getTopInventory();```
i have been writing java code for a while, does anyone ever make a new class and file for that class and keep writing code in that file until there is too much code in that file?
then you make even more files to split up the code?
wut?
i keep doing that in java.
everybody does that
that is called refactoring
😄
thing is, i barely ever do that with other programming languages, probably.
joke...
I've got the same set up for mysql on another project and works fine... For some reason it's connecting but showing null and saying it isn't connected? No errors
I embrace monolithic development.
That is there stays there
Welcome to the java world where boiler plates adds up at least one hundred lines of code
try running some sql?
Yeah, I get this error now
try connecting to the database with another application, does it work?
yep
Doesn't make sense at all lol
Does saving the texture properties from a GameProfile make it possible to get a skin without the server accessing the MC textures endpoint?
Anything wrong with this method?
and I just used DI for the classes
So shouldn't be null
The textures property on the GameProfile just contains base64 encoded JSON, which contains the URL to the texture sprite. So no, that doesn't cache the actual image data.
If I was able to store the actual image data, would it even be possible to use that?
Still very, very bad practise. If the columns change, you could mess up heavily.
got that from w3schools cuz i was confused whether you actually need to specify the columns
I don't need to specify columns
you do
Tbh, I haven't ever thought about this. If I had to implement a texture sprite cache, I'd try to intercept HTTP traffic and cache those responses, based on the parameters of the request. Otherwise, you'd probably have to really dig deep into the minecraft server itself.
are you able to connect to the database with another application?
As far as I know, the server doesn't send the skin data to the player, so you would have to edit the client itself, which is a no go
maybe just make it look like another player joined?
then change the player's display username?
What are you trying to achieve? The client itself shouldn't matter to you, does it? It's their IP and their traffic. But yes, you're right, the server itself shouldn't render the sprite anyways. This would just be of interest if you actively tried to render it on a - let's say - map, for example.
just make a call to the mojang api for the skin texture?
The goal is to save the sprite in whatever format and then somehow apply it to a profile without any contact to mojang APIs
But that seems to be quite the challenge
just use a custom texture pack maybe?
Well no, I don't think you'll make API calls if you only change the GameProfile which a later packet is going to serialize to the client. The sprite URL that's in the base64 JSON has to be requested separately too, so if you cache that, your server should be free of extra requests.
I currently save the base64 and insert it into a custom GameProfile, however I won't get around the rate limit regardless if the client sends a request to the API
Which doesn't make sense to me because I have never noticed a rate limit when playing on servers
That's probably because your client and your server are on the same exit node. You cannot compensate for rate limiting on the client side, as the client only accepts the textures URL by design, no way to push actual pixels.
so, i wanted to ask something.
Yes, so how can I for example switch from lobby to lobby on hypixel and load hundreds of skins without the rate limit being reached
cache the skins
does anyone wanna start a collab project of some sort? Any collab project should be fine. I have never really worked on a project with anyone. This might be a good way to learn stuff and also get feedback on how I code. Possibly even try learning things like CI/CD and other real world development stuff?
Could you show me an example of how you're currently running into rate-limiting? Are we talking about server-side or client-side issues?
if anyone's not doing anything right now, perhaps?
I highly doubt there's a single developer out there with no active projects. That's almost a law of nature, xDD.
i have an active project too lol and i just wanted to take a break from it.
This is all more of a hypothetical scenario. I'm making a menu with potentially hundreds of player heads
Shouldn't be an issue, you just need to cache your textures base64 persistently, as a runtime cache won't cut it, if we're talking hundreds. I have written something similar once, where I had not a single issue... Let me search it up real quick.
i am actually going to be doing something like that too probably sometime soon.
how is it that fast?
i guess it has them in memory
Black magic
I basically cache all these texture values in a database and load them all on startup. I sacrifice memory for resolving speed.
I highly doubt that, xDD. This was not trivial.
But you don't cache the sprite values, correct?
you are loading your database in memory?
ij is doing weird
I never though about using the player inventory for the anvil ui , but thats pretty clever
so before it opens it does it like store the players actual inventory somewhere?
i can still steal it tho 
or how does that work
what other GUIs with textboxes do we have?
no problem
the anvil is the only one
Fake updates, otherwise you're gonna screw yourself if you error out
signs are kind of, eh.
signs do not have slots obviously
wait, what about written books?
okay so packet witchcraft then I see
There's no "stealing" it, I'm not the first to write this, xDD.
just joking haha
does the text get sent to the server everytime player types something with written books?
Nope
but it does with anvils?
Books are entirely clientside, they are only sent if you sign the book
Yep, one packet per key down
is there an event for that in the bukkit api?
or if you close it iirc
Yep, that could work too. But most definitely not live, as the chat is also not transmitted live. The only live thing seems to be the anvil.
yes
Would be something along the lines of:
eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNjM3NTVjYmIyNzU3NTgxNmI3ZWE1NTc3NGMzYTdjNmEwYzc5NDVlZDIyYzI0M2NlMTlkNzdmOGNjOWEifX19
Which decodes to:
{"textures":{"SKIN":{"url":"http://textures.minecraft.net/texture/63755cbb27575816b7ea55774c3a7c6a0c7945ed22c243ce19d77f8cc9a"}}}
which makes sense since it has to update the output item for vanilla
But the client could also do that, but thank god they decided to outsource this to the server.
Right, that's what I store persistently atm. What I don't get is how the client loads all those heads when the limit it 600 per 10 min
so, do player head textures get rendered server-side or client-side?
if you say rendered, it means client side
hm.
the server doesnt "render" anything
You don't load 600 heads in 10 minutes, very unlikely. You always paginate them. Maybe the client even caches some skins persistently, no idea, as I've never researched the client side of textures.
do player head textures get requested from mojang api server-side or client-side?
probably server side?
I think the client has to download/cache the textures though somehow
The textures URL by UUID is requested serverside, the actual image data by URL is requested client side.
I just wouldn't waste a single thought about clientside rate-limiting, as it's out of your control anyways. Do the best job on the server and call it a day.
ok.
I guess 600 is more than I thought it would be lol
It is, I don't think you'll ever run into any issues on your client.
Yeah I guess bottom line is cache the texture properties and let the client do its thing
is the texture url different for every UUID and not something that concatenates the UUID in some way?
.
The texture ID is unique, don't try to find any patterns.
As they store every ever uploaded texture, it has nothing to do with UUIDs.
oh.
While we're on it, I noticed a value was an exact match of a signature, what exactly do you need the signature for?
Which is why there are services which allow you to create custom heads. They just upload an image to one of their accounts, generate a new texture ID and hand that out to you.
hm.
you can even use an account you own for that
with either your own, or maybe you have a seperate account
is there no limit to how many skins can be uploaded per account over some amount of time?
I completely forgot what that was for, I think it's some encryption stuff. I would just not set the signature, this is an example of how I rebuild GameProfiles: https://paste.md-5.net/comupebipe.java (It's old code, don't judge it, lol)
Yeah, that's exactly what that one service does by inventivetalent (IIRC)
Maybe there is, but I guess that's abstracted away by webservices who use some kind of round-robin balancer on multiple accounts.
I have read that signature might be necessary to load fake players, but not for heads or vice versa
Have you had any issues with that?
I also wrote my own NPCs, and that worked, so... well... I guess it works, xD
awesome
You just need to try it. But you could also just save the signature value and add it to the property map, that wouldn't hurt and maybe even future-proof your code.
i am bored.
Well I noticed the decoded base64 has the signatureRequired field, so perhaps it makes extra requests if a signature is needed but not found?
Hey there, bored
so, about the thing i asked earlier, does anyone wanna do some kind of collab project?
hey bored, im doge
he bored, im distracted
I don't know if the server would actually do that... Maybe it just serializes the GameProfile regardless and the client has to drop it, no idea. Again, you'd need to try. You could check with something like WireShark, if there's any additional request to mojang.
straighten up lil soldier
Tbh, collabs just don't work out for me, so I'm out on this one.
it might be good for getting some real world development experience.
You're going to be best off with just persisting the GameProfile as a whole, I don't think that the signature is time critical.
so what is fake world development experience
does not necessarily have to be limited to just making a minecraft plugin.
Been a while since I messed with WireShark, so I'm just gonna store the signature too and hope that it's for the better (-:
@Override
public void replacePlaceholder(Hologram hologram, int index) {
HologramLine line = hologram.getLines().get(index);
String text = line.getText();
for (Player player : hologram.getLocation().getWorld().getPlayers()) {
String newText = PlaceholderAPI.setPlaceholders(player, text);
line.setText(newText);
updateTextFor(line, newText, player);
}
}``` would there be a better way? Since this will be executing every like second
i mean working in development teams.
i have sort of just done my own projects.
try making a little 2d game, thats pretty fun
I'd just persist every piece of information you can get your hands on, doesn't matter if you need it or not. This way, you're doing the best you can and don't have to be sorry later on or - in the worst case - even refetch everything.
Couldn't agree more
Now I'm sad about my abandoned heads plugin, :(.
Is it available on Spigot?
wdym?
No, I never released it. The main issue is that minecraft-heads sells it's own plugin to make up for server costs, and they could sue me. I hate depending on the "good will" of others. I'd need to roll my own open source database along side of the plugin, if I want to point it at a source that couldn't get me in trouble.
just some random project to work on perhaps?
maybe a cool minecraft plugin of some sort, a significantly large project?
i dont mean a minecraft server, necessarily.
i just mean a collab programming project of some sort to work on with multiple people.
I'm pretty sure the plugin would do pretty great tho, as it could be a gamechanger for builders. The search/fetch cycle for heads you need would be several orders of magnitude lower than with either their website or even their plugin.
id like to do that too, i only have no idea what
maybe a complicated game or something?
