#help-development
1 messages ยท Page 2065 of 1
dont actually do that ^^
lol
Yeah actually you should probably use a StringBuilder
String.join("", list)
concat would create a StringBuilder per iteration iirc
ye
i see
For arrays: String.join("", Arrays.of(array));
I believe it's Arrays.toList
Arrays.toList and List.of are actually implemented differently
For one, the former is like, as old as the JDK.
List.of is immutable
The second was introduced in... I think Java 16?
Arrays.toList returns a package-private implementation of List that exists as a inner-class of Arrays
Which is fixed-size but not immutable.
btw
Meaning you can use set on it, just not add.
can I use java in place of nodejs/php
List.of returns different implementations depending on the amount of elements.
For instance, 0 = Collections.emptyList() (which is a singleton instance of an implementation called EmptyList)
1 = singletonList I think?
Actually 1 and 2 might be List12, which is specific to List.of
And then everything after that is ListN
Anyway, good night everyone, if the comments for the yaml works, I'm gonna post soon a free* resource for leaderboards that makes 0 or less lag
pog
#multi-threading
#with-no-queue
I have no idea why Microsoft is the way they are
"You can use our mappings... for development."
they steal ur code
to stop "skidders" I suppose lol
which is in itself a pretty feeble reason imo but ye
When I am using mysql in my plugin, should I create a own database with the plugin?
Like when the user uses the plugin, if I should create a database automatically? Sry if that question is stupid, I am new to databases
You should create a table in the user's DB
what else woul you use them for ๐
The point is that like
Ok. I have to types of data to store should I do that in the same tabel or in two different
why the fuck aren't they available for production?
What is the point in that?
Either way I personally think Spigot should just use Yarn mappings for production :p
?
mojmaps so much nicer
:3
Not the package names
Also Mojmap can't be used in production
Because
Microsoft
are fucking assholes
There should be no point to remapping back to Bukkit names on compile :p
how do i get the current thread time or something like that
i'm making cooldowns for my new command
there's no such thing as current thread time
but
you can just use system time
dunno if its a bukkit or java thing tho
it spits out the current time in milli or nanoseconds
just use System::currentTimeMillis or ::nanoTime
Hashmap UUID long. Long is the currentmili of when the user last used it. Simple impl but it works
ye thats what i was looking for
thanks

how do i iterate through commands in the plugin.yml
Plugin::getPluginDescriptionFile
i've seen PluginDescriptionFile#getCommands()
but for some reason that returns a weird map
ye
alright i'll try that
system::currentTimeMillis increments up... right?
ye
oh shit nvm it was working i'm just pepega
lol
can someone explain why sometimes i get
"plugin-version-remapped-obf.jar" instead of
"plugin-version-remapped.jar"
or is "plugin-version-remapped.jar" inside of
""plugin-version.jar""
bruh
its like i just have to spam build until i get remapped.jar
survivalrevival:
description: "Displays the survivalrevival help menu"
usage: /survivalrevival
deathcoordsvisible:
description: "Sets whether or not player death coordinates are displayed."
usage: "Usage: /<command> on|off"
what's the difference between the first and second usage?
analyze the commands with /bukkit:help
How would I get the parent value of a key? For some extra context im storing a players UUID to multiple numbers in a file, im using the configuration.getKeys(true) method to get every instance of there UUID, what I want to know is how I would be able to get every number that there UUID is stored in?
call getKeys(false) instead
which won't do keys-in-keys type thing
You can use the boxed class
it's just a java thing
Set<int> is invalid, but Set<Integer> works
Hmm alr
:)
hey
i want to set a custom color of a glass pane, i know that it's made with setDurability and that 15 is black
Is there any way to bring the 1.16 world generation into a 1.18 server?
I wanna develop my plugin with the newest java version while also making the games playable with 1.16 with old generation but since you cant start a 1.16 server with 1.17 I hoped to just put via backwards onto it with old generation and make it work like that
but there's a way to check which one is dark aqua?
same as wool
public class BigWither extends EntityWither {
public BigWither(Location loc){
super(EntityTypes.aZ, ((CraftWorld) loc.getWorld()).getHandle());
this.b(loc.getX(), loc.getY(), loc.getZ());
this.r(false); // Can Pick up Loot
this.n(true); // Custom Name Visible
this.a(new ChatComponentText(ChatColor.GREEN + "MyEntity")); // Custom Name
}
}
Anyone know why it doesnt like this?
extremely hacky, but make a 1.16 server specific for world generation
oh nice
Dark aqua would be cyan right?
You have a method named x() which returns something, but LivingEntity has a method named x() which returns another type of value
Probably, not everyone considers certain colors the same
Try it and see if you like it
k
yea I wanna use records etc and its really annoying to be stuck on old versions just to support 1.16 for some of my gamemodes
you can also just go into creative and grab the glass and its ID
ยฏ_(ใ)_/ยฏ
welp I'm bored
time to write a tutorial on how to make client-side entities
could you maybe write a tutorial on how to spawn vanilla structures xd
I could really need that ^^
uhh
How do I fix that?

that's a ton of nms
can you send the full class?
use the return type stated on the LivingEntity class
That is the full class
I dont understand this :(
Here's an example of your error
public class Car {
public int getFuelLeft() {
return 0;
}
}
public class BMW extends Car {
@Override // this is optional
public double getFuelLeft() {
return -1.0;
}
}
It will error out because you're trying to override a method that has a different return type (int vs double)
wait thats optional
yes
it always screams at me if its not there
it often screams if you're returning null on a nullable type
huh
hm okay
still hurts my brain
What do I want to return?
I want to spawn a wither
ahhhh whats that
xd
I always expect those commands to work
someone add those
anyways let me look for the forum post
thanks
should be the 2nd post in this thread
So I should use that maven import example?
well afaik you need to build the server locally with the remapped profile
which generates the remapped mojang.jar in your .md2 folder
then if you add that maven import it can read that jar and display it in your IDE
the second part - the plugin below - is a legally required inclusion
something about how your built plugins may not include source code
what are you trying to do anyways? Spawning a wither shouldnt require nms
I want to spawn a THICC wither and I want to show it only to some players
ah yea that probably requires packet manipulation
mhm
well as said my recommendation is to use remapped nms if you have to use nms
there's one more advantage to that actually
not-remapped nms code only works for that exact version
remapped nms code is more stable
ie can be built for different versions with usually minimal alterations
welp imma go sleep now, good luck dude
playerAOEs is a hashmap containing a UUID key and a UUID value, how do i iterate through each key and reference its value through the iterator?
You really shouldn't iterate through a hashmap if you can avoid it. What are you trying to do
ok kinda complex
map.forEach which takes in a BiConsumer
Like I said though, try to avoid doing it often if you can avoid it.
for (var it = map.entrySet().iterator();it.hasNext();) {
var entry = it.next();
}
but yeah the BiConsumer is way more readable
damn thanks
altho negligibly slower, but ye
How do I use that instead of normal nms?
Is it a different import?
yes but just during compile time
you probably wanna look at special source maven plugin or paperwight userdev plugin (maven/gradle)
Or...
for (var entry : map.entrySet()) {
}
Which is a direct equivalent but way more readable
(Also easier to type)
how do i check if player is going to wear armor?
I just got this message when exporting. What does it mean and where do I go to solve it.
It was literally updated 2 weeks ago wot
JAR exporting really isn't great. Though if you insist on using it over a build tool like Maven or Gradle, check to see if the src directory is added to your classpath
Eclipse isn't outdated it's just a lighter tool with more modularity
Click project, Alt + Enter
Java Build Path -> Source. Add the src folder if it's not there
does anyone know a way i can index islands?
i have 5 main regions of the map and i wanna make a color code system for each and possibly even see what region a player is currently in, but cubic regions wont exactly work
MultiRegion
You can use RedLib's MultiRegion to compose one large region out of many cuboids
And there's a method to recalculate it to be as efficient as possible in its use of those cuboids
Do avoid using it if you have a lot of cuboids though, since it's something like O(n^3) to recalculate with n regions
?paste
https://paste.md-5.net/benusudapa.js
lole look what you've both done @vocal cloud
what do you consider a lot of cuboids?
Yeah that's a not using a BiConsumer
๐
Hundreds
how would you do that
something.whatevertakesinabiconsumer((a,b) -> {})
ah ok so like 20 would be a breeze?
i see
now i understand all of that code i read
well anywho
have fun reading my code in the future
when i NEVER use that
Yeah
๐
I'm trying to port a plugin to 1.18.2. I'm getting this error: java.lang.NoClassDefFoundError: org/bukkit/craftbukkit/v1_18_R2/inventory/CraftItemStack at org.vivecraft.VSE.setLocalizedItemName(VSE.java:195) ~[Vivecraft_Spigot_Extensions-remapped-spigot.jar:?]
What, are you porting it from 1.18 to 1.18.2?
You need to update the plugin to use the proper imports on the NMS side
That error is telling you that this class does not exist:
org.bukkit.craftbukkit.v1_18_R2.inventory.CraftItemStack
yeah ik
i know java im just saying is there a known change
my specialsource config may be fucked too
im not sure
hey there.
Iยดm currently trying to update a plugin from 1.17 to 1.18.2
I cant seem to find the sendPacket function.
((CraftPlayer) all).getHandle().b.sendPacket(new ClientboundInitializeBorderPacket(worldBorder));
1.17.1 resulted in all NMS field/method names being reverted to their obfuscated form I believe
pls no ._.
lol
got it working
Have fun :D
But how do I send packets now?
Either use remapped or figure out which method is sendPacket
specialsource still works though innit
Yeah
Okay;
im learning NMS and I found this example on the web, and I changed some stuff.
public class BigWither extends EntityWither {
public BigWither(Location loc){
super(EntityTypes.aZ, ((CraftWorld) loc.getWorld()).getHandle());
this.b(loc.getX(), loc.getY(), loc.getZ());
this.r(false);
this.n(true);
this.a(new ChatComponentText(ChatColor.GREEN + "MyEntity"));
}
}
First, what do I return?
Second, when I call it up, do I do this?
connection.a(new PacketPlayOutSpawnEntity(BigWither));
uhh
you can spawn it directly
if you want a client-size entity
which seems like what you're doing
you can just follow a tutorial
im trying to add items from one item to another. To do this I need to iterate through the map created from event.getCursor().getEnchantments(). How do I do this without knowing the name of the enchants
Use a for loop?
itemstack original = whatever method to get the original.
itemstack updated;
for (every enchantment on the itemstack) {
apply enchant to new itemstack (updated)
}
You could also just clone the ItemStack directly and change what you need. Albiet that would only be beneficial if you don't have to change much.
does anyone know where the JedisConnectionException comes from? i know this aint rlly spigot but maybe someone knows.
it only seems to throw when my connection has been idle for a bit and no trafic has gone through for a bit.
then on the next attemp to do anything it will throw this exception and then work fine again
is there a method to find the distance between two Locations?
Location#distance()
ty ๐
Jedis connections, just like mysql, time out after a while
You can use a jedis pool
How do I set what type of entity I want to send with protocol lib? When I set entity id to 1, it just makes an area effect cloud.
yea, i am using a jedis pool
for thread safety
Read it entirely
and when i add these lines
this.pool.setTestWhileIdle(true);
this.pool.setMinEvictableIdle(Duration.ofMillis(60000));
this.pool.setTimeBetweenEvictionRuns(Duration.ofMillis(30000));
this.pool.setNumTestsPerEvictionRun(-1);
the exception goes away. but after like 30 minutes it just stop performing operations.
Are you testing your jedis connections, and returning them to the pool
i am indeed returning them to the pool.
and im not sure what you mean by testing my jedis connections.
I'm writing a Plugin that will allow me to record Player movements and then play them back.
It will achieve this by saving all of the packets related to the sequence along with the system time that they were sent. It will then play them back in the sequence at the right time using the system time deltas.
I am using ProtocolLib to achieve this.
I will be doing the sending of packets on a different thread with ProtocolLib, which gives me the ability to simply sleep the thread for the duration in between packets.
My question is, is the above description thread safe?
Can I send packets with ProtocolLib on a different thread? Is it okay to sleep intermittently as described?
Protocollib IO is async afaik
isBroken
ping
Etc
at least as far i know this should auto return try(Jedis jedis = server.getPool().getResource()){
Eh that's good enough
Tbh I prefer getting a resource from the pool whenever I use it, than keeping it alive indefinitely
Jedis#isBroken will help
you never return the resource?
how do i test if a block is a bed, and not if it's Material.BLACK_BED | Material.WHITE_BED | Material.ORANGE_BED etc
You could do that one of two ways.
- Create a list of the bed types and compare using #contains()
- Check the last part of the material name.
look on the item
f3+h and then look at the number on the item
What version are you using? There's likely a more abstract alternative
16421
1.8
PotionData I believe is what it was before 1.13
choco you ever work with jedis?
Constantly, yes
i would love you ask you a question then
my connections stops working after it has been idling for like 30 minutes
like i cant publish messages anymore
is there some kind of timeout?
It was Potion, sorry, not PotionData. PotionData is modern.
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/potion/Potion.html#<init>(org.bukkit.potion.PotionType)
new Potion(PotionType.INSTANT_HEALTH).toItemStack(1)
Not sure. Presumably you're using Jedis?
yep
i am
i create it like this
this.pool = new JedisPool(uri);
this.pool.setTestWhileIdle(true);
this.pool.setTestWhileIdle(true);
this.pool.setMinEvictableIdle(Duration.ofMillis(60000));
this.pool.setTimeBetweenEvictionRuns(Duration.ofMillis(30000));
this.pool.setNumTestsPerEvictionRun(-1);
but tbh im not even sure what these things do
before i added these things it would throw a JedisConnectionException after idling for a bit instead of just doing nothin
Yeah connections will auto close after 60 seconds by default so a pool is what you should be using. If you're still having issues, just make sure you're closing your connections to Jedis after using them.
e.g.
try (Jedis jedis = pool.getResource()) {
// Do your Jedis
}```
Then I'm not sure what would boot you off >:/
How can I change the metadata of an outgoing spawn entity packet with protocol lib?
how do i loop through a worldedit selecttion region? I have this code and it only works when the selections are in certain places.something about the order you make the selection in and how i loop through. how can i fix this? im not sure how else to describe it properly
for (int i = sel.getMinimumPoint().getBlockX(); i < sel.getMaximumPoint().getBlockX(); i++) {
for (int j = sel.getMinimumPoint().getBlockY(); j < sel.getMaximumPoint().getBlockY(); j++) {
for (int k = sel.getMinimumPoint().getBlockZ(); k < sel.getMaximumPoint().getBlockZ(); k++) {
//code
}
}
}
Yes there is, TCP socket timeout
Hello!
Does anyone know if theres a way to get structures to spawn in a custom map?
we have a earth map and would like it to have villages, ruined portals etc
welcome to 1.18
use b.a(packet)
Or just use mappings 
mappings bad for gradle
wym
so what do i do to stop that from happening
do i need to send a ping message every X amount of time?
well that is primarily the reason for connection pools. Is to ensure there is always a connection
sending a ping message should allow it to stay open
yea, but i am using a connection pool
because the timeout only applies if no communications occur
but a connection pool should be routinely checking if a connection is alive, if it isn't it needs to refresh it
if it isn't doing that, then it isn't a very good connection pool
I have no idea what you are using
I can only tell you how its suppose to work or why they even exist
hm well right now it has been running for 50 min and its still working. maybe it was a fluke somehow? i have no clue tbh
well it could have been the OS
since the timeout is controlled by that
but if you are having to communicate between 2 systems, then you have to look at both
one side could terminate earlier then expected lol
the default TCP timeout is 30 seconds
yea this client - server shit has me hurting my brain already
maybe its just time to sleep on it
but this is why MC protocol even has a ping packet ๐
and it gets sent like every 10 seconds or so
because at that interval it leaves some latency room
so i might just be best off having a ping packet as well?
if your timeout is 30 seconds for the socket, and it takes 5 seconds for the packet to get to its destination, then you need to actually send a ping no later then 20 seconds
wouldn't hurt if you really need to connection to stay open
well yea, i really need it to stay open haha
at least in that manner if you don't get a response back, you need to re-open a new connection
because something happened with the old one
but shoulnt the pool handle that for me
it is suppose to yes
yep
that is what it is suppose to do
unless it had none in reserve and hit its limit
well at least you have more information then you did previously
yep, thank you for that.
Wut
on my private projects i typically work all day, and then at the end of the day i push it all in one 1k+ additions commit
only reason i see the need for 50 commits in a day is if your fixing bugs on a public plugin
even then.... why so many commits
It's not a bad thing right to have a lot of commits.
Honestly same.
indeed it doesn't, but imagine having a job and all your collogues have to constantly pull every 30 seconds and then deal with merge conflicts
yeah I'd rather push most of my changes (assuming Its tested properly) in a commit unless there are unseen typos, etc
yeah i can understand random typos or maybe removing some debug logs you possibly forgot
But dont write a method and then push to git lmao
Question: How do block AsyncPlayerJoinEvent?
Would you just set the result to a deny result, and then set it to a allowed result once your ready?
Or if im already processing loading data will it automatically just block until i finish doing what i need to?
I am confused with the 1.17 NMS cause it is no longer PlayerConnection connection = craftPlayer.getHandle().playerConnect; and so I have no clue what the new one is. D:
Check the method that return PlayerConnection
b?
you can ctrl + click and view all methods that can return that object
Yes, it's b I think
It will automatically block until you finished loading iirc.
Do you know what the equivalent of PacketPlayOutPlayerInfo.EnumPlayerInfoAction.REMOVE_PLAYER, and PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER is?
What do you mean equivalent?
myeyes
Hello everyone, everything good? Could someone help me send a player to a specific position on another server with BungeeCord? Thanks
For example: send the player to the Lobby server, but in a specific position on that server
Thanks!
send a plugin message to your bungee plugin with the server and coords
^
(and player)
I've already added that but IDE still keeps saying that they are invalid methods.
Thanks, but do you have an example? I know this one from connect, but I couldn't find how to send position
out.writeUTF("Connect");
out.writeUTF("skywars");
p.sendPluginMessage(this, "BungeeCord", out.toByteArray());```
is it possible to change the delay of a bukkitrunnable task inside of it while its running?
Yeah I don't think it's possible.
But there is a workaround, by set your own "time" inside the task.
is there a good way to foreever run code with different delay times?
i tried something like this but it keeps giving thread dumps, not my actual code just anb exmaple i made quickly
while (true)
int delay = 20;
new BukkitRunnable() {
// some code to run
delay = new Random.nextInt() * 100;
}.delay(20);
}```
so doing this again inside of it? .runTaskTimer(BlockAnime.INSTANCE, 10L, 20L);
Create one BukkitRunnable that runs every 1 second
What are you trying to achieve anyway? It looks like an xy problem.
i have a section of blocks that changes every random amount of time, 1 second, 5 seconds 23 seconds etc (1-50 seconds or something) and i want it to forever run
no
๐ค
Bukkit#scheduleSyncDelayedTask
I cannot believe i have been invited to the real discord tester program
And all i have to do is enter my email and password
free robux???! sure, lemme just get my social security number for u
gives thread dump things because server doesnt respond for 15 seconds
a sync task?
what are you trying to do
i have a section of blocks that changes every random amount of time, 1-10 seconds for example, and i want it to forever run
yea, how do i forever loop otherwise?
it was a quick example
This tutorial will guide you in using the scheduler provided by bukkit. It will allow you to defer the execution of code to a later time. This is not the same as registering a Listener, a block of code which is executed in response to an event in the game. Blocks of code may also be scheduled to be executed repeatedly at a fixed interval, with o...
wait were you putting the scheduler in the while loop;
the entire point of the scheduler is to not do that
you'd be spawning an infinite amount of scheduler tasks
That is not possible.
yea its just the closest ive gotton to a solution, it is bad
so how else could i do this
I told you, create a task that run every 1 second, and add conditions inside the task
to do this you would use a scheduler as md5 posted above
add conditions inside? like this part? runTaskTimer(BlockAnime.INSTANCE, 0, 0);
no no your not getting it
you make ascheduler and add logic inside
Bukkit.getScheduler().runTaskTimer(instance, 0L, 20L, () -> {
int timer = 0;
if(timer == 5){
// do something
}
timer++;
});
No problem
timer is getting declared inside the method though
HI, I'm starting to learn java, and I have a problem with a BlockBreakEvent, I've already looked on the forums, and I can't find an understandable answer for me, so I send you my code and my errors
package fr.charpy.openwar;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockEvent;
public class OpenWarList implements Listener {
@EventHandler
public void onBreakBlock(BlockBreakEvent e){
Player p = e.getPlayer();
p.playSound(p.getLocation(), Sound.ORB_PICKUP, 2.0F, 1.0F);
((BlockEvent) p).getBlock();
System.out.println(e);
}
}
and the error :
org.bukkit.event.EventException
...
Caused by: java.lang.ClassCastException: org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer cannot be cast to org.bukkit.event.block.BlockEvent
at fr.charpy.openwar.OpenWarList.onBreakBlock(OpenWarList.java:16) ~[?:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_322]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_322]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_322]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_322]
at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:334) ~[JavaPluginLoader$1.class:1.7.10-40]
... 18 more```
you are trying to cast a player to a block event
that is not going to work in any circumstance
how i can fix that ?
why are you trying to do that in the first place?
when a player break a block i want to play a XP orb sound
it looks like you already did that in the line above
yes i remove ((BlockEvent) p).getBlock();
System.out.println(e); and its work x) im so dumb wtf
yeah im not even sure why that even compiled in the first place
So ive been experiementing with Lombok recently and really love it but
Does anyone know if there is another library similar to it, that allows a @Adder annotation?
What would adder do?
Basically add adder methods for data types like int and long etc
Basically so i wouldnt have to write out basic methods like this, like i would with get and set using Lombok
istg every videos that fakes about robux is literally just "!!HOW TO GET FREE ROBUX!! ๐ต๐ธ๐ต" and then the thumbnail is filled with red texts of "+999999 ๐คฏ๐ฒ"
damn what theme is this? thats a cool background
ummm one moment ill have to find the theme
You can set the background in file -> settings -> Appearance -> Change Background
Thats the theme plugin
oh I use this too
so you just change the background i see
I thought it was a special theme lol
Nah background is just changeable in this area
but transparency is a little buggy
took me a while to find a picture (had to edit it as well) to get it with with the alpha texture
you have to use a different form of alpha, where it doesnt show up on the picture preview
o
do u know how to call modded item with spigot ?
if (((BlockEvent)p).getBlock() == Material.valueOf("IC2_blockRubLeaves")) {
if (p.getGameMode() == GameMode.SURVIVAL) {
p.playSound(p.getLocation(), Sound.ORB_PICKUP, 2.0F, 1.0F);
Hi, i have a problem with my /Freeze command and i don't now what(Think is somthing with event.setCancelled(true);)
Code:
https://paste.md-5.net/owewehowub.java#
Pls tag me
why casting it to BlockEvent?
Use a players UUID instead of name
is that Player.getUUID?
Yes
ok
public void onBreakBlock(BlockBreakEvent e){
``` bcs its a blockbreak event ?
Hello, I try to update a plug-in for my server, but I need to import the nms, after various test, I import the nms whit buildtools remapped (bukkit and craftbukkit), but I have error whit net.minecraft, how can I import it?
and why cant you just use BlockBreakEvent#getBlock?
what is p btw?
bcs i dont know that x)
player
ok but how to call modded item ? is that good ?
it was plyer.getUniqueId
?
I build buildtools whit the โremapped option
(For 1.18.2)
Craftbukkit and bukkit work
Hello Guys, my Plugin will not save the things in my config.
code:
String creator = player.getUniqueId().toString(); String guildname = args[1].toString(); Integer claims = 2; Integer points = 0; Integer level = 0; Guildconfig.get().createSection(guildname); Guildconfig.get().createSection(guildname + ".creator"); Guildconfig.get().addDefault(guildname + ".creator" , player.getUniqueId().toString()); Guildconfig.get().createSection(guildname + ".claims"); Guildconfig.get().addDefault(guildname + ".claims" , claims.toString()); Guildconfig.get().createSection(guildname + ".points"); Guildconfig.get().addDefault(guildname + ".points" , points.toString()); Guildconfig.get().createSection(guildname + ".level"); Guildconfig.get().addDefault(guildname + ".level" , level.toString()); Guildconfig.get().options().copyDefaults(true); Guildconfig.save();
whats in the config:
testguild: creator: {} claims: {} points: {} level: {}
whats wrong?
But net.minecraft no
Hi, i want to create a GUI that show the craft of my new item (Cobblestone compressed Tier 1, Tier 2, Tier 3, Tier 4), i've got the function to get the item's craft and to show it on the GUI but when i choose to see the craft for example of my cobblestone Tier 2 or Tier 3, the GUI show me the craft of my Cobblestone Tier 1 and the same for my Iron Pickaxe Tier 2, Tier 3, Tier 4, the gui show me the craft of my Iron Pickaxe Tier 1.
I think it's the method Bukkit.getRecipesFor that does not take the ItemMeta of my selected Item to find her recipe.
Sorry for my English
have u tried importing org.spigotmc:spigot (not spigot-api, just spigot)
Yes
I send my Pom.xml
One second
?paste
I writing whit phone, it would be a bit difficult for me
https://paste.md-5.net/tuvodoqiku.css this is the things I need (sorry for my bad English)
To convert in 1.18.2
(I never used nms, but I need this plug-in in 1.18.2 for my server, and maybe for pubblic)
i have a function that saves data to a yml file like
blocks:
'1'
'1'
-'1': minecraft:stone
'2'
-'5': minecraft:wood
'2'
'4'
-'2': minecraft:oak_door[facing=west,half=lower,hinge=left,open=false,powered=false]
etc
``` how could i get those values back into a class (BlockData)?
createBlockData(String)
ah just found that, thanks
You can help me? Whit installing correctly nms?
.
.
Anyone an idea since which version the TextComponent was introduced?
1.7
Alright thanks one more question, in order to use it you need to use .spigot(), does it mean that it will only work for spigot or forks of spigot?
yes... which is all server software made in the last 7 years
F everyone ignore me
If anyone has an answer for this that would be poggers ๐
And after I put spigot on Pom.xml whit mojang remapped
Thanks md5!
https://paste.md-5.net/afahofizug.xml this is my dependencies
no one knows whats wrong?
post your buildtools log
Ok, one second
There is literally a bunch of things that could be wrong. the path is incorrect, you didn't save the initial file, your GuildConfig being undefined, do you have any erros?
thats the problem i dont habe errors
it just wont save it
Put your code in github and I will have a look at it
idk what your issue is, the nms jar is clearly there C:\Users\manfr.m2\repository\org\spigotmc\spigot\1.18.2-R0.1-SNAPSHOT\spigot-1.18.2-R0.1-SNAPSHOT-remapped-mojang.jar
whats your maven log
i dont have github but i upload it hear
heres the code
the config looks after creation of the guild so:
test:
creator: {}
test1:
creator: {}
did you run the setup method?
does it create the file or not?
okay
but not sets the value
test:
creator: {}
that whats it says
but without value
the value is String creator = player.getUniqueId().toString();
did you check if the code ever reaches the line where it saves?
what are you trying to achieve with the copyDefaults?
its copying the adddefaults in the config
but it does it not xD
im trying out with a set value
not with a UUID
but why do you not just set the value?
instead of set defaults
I never use the default stuff
how do i do that?
.set(Object, value)
no problem
Is there a page that shows all the nms methods, as letters but with actual docs?
like with the method signature and what the methods do
next problem xD
Map<String, Object> Guildsearch = Guildconfig.get().getValues(true);
if (Guildsearch.containsKey(creator)) {
player.sendMessage("ยงcYou are already in a Guild");
} else if (Guildsearch.containsKey(guildname)) {
player.sendMessage("This Guild already Exists.");
}
here does it not check if the players is in a Guild. so it not checks deeper then the name.
Config looks so:
test:
creator: c705ef9f-0cfe-49ae-aced-d9186a9e6207
test1:
creator: c705ef9f-0cfe-49ae-aced-d9186a9e6207
please put this in a format with ``java
`Map<String, Object> Guildsearch = Guildconfig.get().getValues(true);
if (Guildsearch.containsKey(creator)) {
player.sendMessage("ยงcYou are already in a Guild");
} else if (Guildsearch.containsKey(guildname)) {
player.sendMessage("This Guild already Exists.");
}
here does it not check if the players is in a Guild. so it not checks deeper then the name.
Config looks so:
test:
creator: c705ef9f-0cfe-49ae-aced-d9186a9e6207
test1:
creator: c705ef9f-0cfe-49ae-aced-d9186a9e6207`
you need to check on the path
whats the get of that?
what are you trying to do?
to check if the player is already in a Guild or the guild already exists
yes, it is, but experience comes with time
how does ur config look like
test: creator: c705ef9f-0cfe-49ae-aced-d9186a9e6207 test1: creator: c705ef9f-0cfe-49ae-aced-d9186a9e6207
I recommend you to make your config like this:
loop through your config getKeys()
guilds:
guild1:
members:
- ID1
- ID2
the reason why is so you can fetch all keys from the parent "guilds"
if ur thing is like
really depends on what you are trying to store tbh
okay
Sorry, but the problem are another
i want it so at the end:
Guilds:
Guild1:
Creator:
Members:
Points:
Level:
then check if the value from the key is the creator u want
btw u shouldnt store stuff like that in config
https://paste.md-5.net/tuvodoqiku.css this from 1.16 to 1.18.2
config is meant for configuration not storing player information
Doesnโt exist
use a database instead but that might be too complicated for you so ig keep on with a config
thats the problem xD
I highly recommend you looking into Serialization
its only for friends
maybe that will be better for you
No
dont
never
bad advice
if ur gonna get to that degree just use a database
Anyways
loop through the config getKeys()
getKeys(true)
and check if the value is the player uuid
What do you mean bad advice ?
yea ^^
thats bad advice
What else would you use serialization for?
Anything other than that
Nope
Its for storing objects in string inputs
e.g u wanna store an itemstack in a database
u cant put an itemstack there
it needs to be a VARCHAR
people usually encode it with Base64
that's not what I meant, but okay
like i did here
anyways
@lethal knoll or when you want an entity
stored in a config or database
you can use my library that serializes it
Serializing isnt made for storing data that can be represented as a sequence of chars
if you can represent it that way, use flat files databases, or a database
Well, spigot literally has implementations to serialize it to configuration files
so whether you believe that the use case is not valid , I leave that fight up to you between md5 and you
Youre really wrong
Oh my god
give me one fucking thing that implements ConfigurationSerializable
that can be represented in a String format and retrieved again easily
What do you mean?
I meant what I meant lol
if you dont know how spigot configuration serializing works dont talk about it
I do know how it works ...
Then why are you asking what I meant
@lethal knoll how would you store an entity in the config?
You cant, thats why you need to serialize it somehow
thats because an entity cant be represented in a string format
like a uuid
you should never serialize a uuid, since it can be represented in string format
so what you suggested should never be done
@grim ice why does it not work? did I forget something?
` Set<String> Guildsearch = Guildconfig.get().getKeys(true);
if (Guildsearch.contains(creator)) {
player.sendMessage("ยงcYou are already in a Guild");
} else if (Guildsearch.contains(guildname)) {
player.sendMessage("This Guild already Exists.");`
how does it work?
you have to loop through the keys, then check if the value of the key
is the creator uuid
config looks so:
Guilds:
test:
creator: c705ef9f-0cfe-49ae-aced-d9186a9e6207
claims: 2
points: 0
level: 0
members: {}
for(String sectionName : config.getConfigurationSection("Guilds").getKeys(false)) {
if(config.getString("Guilds." + sectionName + ".creator").equalsIgnoreCase(uuid.toString)) {
// player created a guild before.
}```
whats this doing is looping through the keys of Guilds, then checking if their creator value is the uuid of the creator
sectionName is their guilds name btw
sectionname is the guildname
Yep
thx
@grim ice , to answer your question, I would have created a class Guild that implements serializable
I'm not talking about serializing individual values ...
I would not
thats bad design
Orrrrr
Gson
I would make a factory pattern
That is absolutely not bad design
you can store java classes as Gson json objects considering you create a serializable class (Not a Entity class or similar)
a guild from info passed in
also possible indeed
You should not serialize info that can be stored in string format
Youre missing the whole point of serializing
No I am not, what if for any reason he starts to store more information then string values
I am talking about serializing the Guild class
Which is 100% fine
I know my stuff
I'm far from a beginner
If your wanting to store an entire class you created, i would seriously reccomend storing it as a Gson class (Spigot comes shipped with a gson instance)
You seem to not know it
storing it as yaml is just more work
Think whathever you want, I know what I'm saying
You shouldnt serialize it thats just painful
gson its 2 lines of code and stupidly simple
Oh dear god
Serializing and deserializing classes is piece of cake
it's literally creating properties in your class, and the serialization does the rest for you
Fucking up your design is a piece of cake as well
You shouldnt serialize entities that can be stored in a string format
Okay, think it your way
the whole point of serializing is to turn something that cant be stored in a string into a string
youre turning something that can be made into a string without serializing
into a string
with serializing
thats just dumb
what?
Error
send error
no xD
when you get 500 hours of java under your belt you get the skill to guess errors
do yall not know that?
LOL
for(guildname : Guildconfig.get().getConfigurationSection("Guilds").getKeys(false)) {
he want there a ; but where?
String guildname
not just guildname
String guildname
not just guildname
lol no
so?
thats a foreach var
that first argument is what getKeys() is iterating through
a for loop variable
oh whatever
do String guildName
or sectionName
just have it different from ur other variable
okay thx
i wonder if getKeys works in lambda form i never tried that
Dude
stop it
you clearly dont know the point of serializing
how about this
ill be serializing a string into a string
does that look okay to you
Again, I'm talking about serializing a Guild class
well whichever way your storing it
A GUILD IS LITERALLY JUST A DATA CLASS
HOLY FUCK
anyways
to ez
wheres async
gson works with mongodb as well ๐
DRY
that's a good use case, although most hostings offer mysql instead
its a public API i have so if i ever do add async ide likely add a boolean value for async
or a async method like that ^
oh yeah that makes sense
org.bukkit.command.CommandException: Unhandled exception executing command 'guild' in plugin EmpiresSystemPlugin v1.0.0 at org.bukkit.command.PluginCommand.execute(PluginCommand.java:47) ~[server.jar:3284a-Spigot-3892929-0ab8487] at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:149) ~[server.jar:3284a-Spigot-3892929-0ab8487] at org.bukkit.craftbukkit.v1_17_R1.CraftServer.dispatchCommand(CraftServer.java:790) ~[server.jar:3284a-Spigot-3892929-0ab8487] at net.minecraft.server.network.PlayerConnection.handleCommand(PlayerConnection.java:1931) ~[server.jar:3284a-Spigot-3892929-0ab8487] at net.minecraft.server.network.PlayerConnection.a(PlayerConnection.java:1770) ~[server.jar:3284a-Spigot-3892929-0ab8487] at net.minecraft.server.network.PlayerConnection.a(PlayerConnection.java:1751) ~[server.jar:3284a-Spigot-3892929-0ab8487] at net.minecraft.network.protocol.game.PacketPlayInChat.a(PacketPlayInChat.java:46) ~[server.jar:3284a-Spigot-3892929-0ab8487] at net.minecraft.network.protocol.game.PacketPlayInChat.a(PacketPlayInChat.java:1) ~[server.jar:3284a-Spigot-3892929-0ab8487] at net.minecraft.network.protocol.PlayerConnectionUtils.lambda$0(PlayerConnectionUtils.java:30) ~[server.jar:3284a-Spigot-3892929-0ab8487] at net.minecraft.server.TickTask.run(SourceFile:18) ~[server.jar:3284a-Spigot-3892929-0ab8487] at net.minecraft.util.thread.IAsyncTaskHandler.executeTask(SourceFile:151) ~[server.jar:3284a-Spigot-3892929-0ab8487] at net.minecraft.util.thread.IAsyncTaskHandlerReentrant.executeTask(SourceFile:23) ~[server.jar:3284a-Spigot-3892929-0ab8487] at net.minecraft.util.thread.IAsyncTaskHandler.executeNext(SourceFile:125) ~[server.jar:3284a-Spigot-3892929-0ab8487] at net.minecraft.server.MinecraftServer.bf(MinecraftServer.java:1148) ~[server.jar:3284a-Spigot-3892929-0ab8487] at net.minecraft.server.MinecraftServer.executeNext(MinecraftServer.java:1141) ~[server.jar:3284a-Spigot-3892929-0ab8487] at net.minecraft.util.thread.IAsyncTaskHandler.awaitTasks(SourceFile:134) ~[server.jar:3284a-Spigot-3892929-0ab8487] at net.minecraft.server.MinecraftServer.sleepForTick(MinecraftServer.java:1125) ~[server.jar:3284a-Spigot-3892929-0ab8487] at net.minecraft.server.MinecraftServer.x(MinecraftServer.java:1054) ~[server.jar:3284a-Spigot-3892929-0ab8487] at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:305) ~[server.jar:3284a-Spigot-3892929-0ab8487] at java.lang.Thread.run(Thread.java:833) [?:?] Caused by: java.lang.NullPointerException: Cannot invoke "org.bukkit.configuration.ConfigurationSection.getKeys(boolean)" because the return value of "org.bukkit.configuration.file.FileConfiguration.getConfigurationSection(String)" is null at Commands.Guildcommands.onCommand(Guildcommands.java:70) ~[?:?] at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[server.jar:3284a-Spigot-3892929-0ab8487] ... 19 more
thats the error because its Null
WOAH
AAA PLEASE USE PASTE SITE
okay
not even a codeblock either smh
ur Guilds section does not exist @amber palm
ngl though i should make a togglable async option for that
yep
and is it abstracted
if not then make an interface for it
Libraries and APIs should be abstracted
even though this is a small project but take a look at this:
https://github.com/Dqmino/EntitySerializer/tree/main/src/main/java/me/hex/entityserializer/api
The user only has access to interfaces
he doesnt interact with classes
That class itself isnt abstracted itself
Most of the API runs on Functional Interfaces but the data part is abstracted
ic
you extend a JsonDataClass that stored the File, and another class you call a instance upon managed the actual file saving
basically the API works by handling all the caching for you in a HashMap
and you basically just call a new instance of PluginDataMap whenever you want a new DataMap for something else, this one is just for player data
๐ค
lombok ftw
invalid link
I prefer the non simplified tbh
does that even work in general lmao
thats why i use my own website to store images and files :D
the non simplified makes more sense to me
didnt you know you can just { stuff } lmfao
snipping tool ftw
then why does my IDE tells me that...?
?paste
i want to create an ConfigurationSection with pre-defined default values
now it says nothing. no error and it dont work
ah so it is your constructor
Why not have it like this?
just pass a Supplier btw
and let the user do .get()
Looks a lot better to the naked eye
๐
naked ๐
๐
^
not a Supplier<ConfigurationSection>
the value must be a configuration section
Who In here is a skyblock god dev?
skyblock god?
just ask your question
I dont mean to brag but
i did add support for wildstackers on bento box

I call hacks
Get ban YB better + ratio
sir this is spigotmc not rust (the game) discord
But anyway let me ask my question
So you know how we have the skyblock layout... what if we could add a entertrace to the layout like I'm talking about bridges/walkway/houses and they could change the themes by doing into /permissions island and gonto the theme and pick whatever theme that they want from the section
do you know how to code that
that already exists
Oh wait?
but the player would lose everything on theyre island doing that
Where?
iirc bento box does it
same with iridium
its pretty much a common thing now
players being able to swap island themes
I can't send u pictures here can I send it to you on dms
verifiy your account
No sus shit
and you can send pictures
I don't have a account
also this is more of a #help-server type thing
this is if you are asking for java support
ie help my code doesnt work type thing
They ignore me
https://gyazo.com/e8e3361f96c53b4784d6f81390b729b5 Iโm trying to world protect this
that doesnt provide much info
There's a boarder line between the players island and the entertrace
@sullen marlin sorry for the ping, but i have problem whit build cannot access net.minecraft.server.v1_16_R3.PacketPlayOutPlayerInfo.PlayerInfoData
[INFO] ------------< org.golde.bukkit.corpsereborn:CorposeReborn >-------------
[INFO] Building corpose reborn 3.0 BETA 1
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ CorposeReborn ---
[INFO] Deleting C:\Users\manfr\Desktop\intellij idea\corpose reborn\target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ CorposeReborn ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ CorposeReborn ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 68 source files to C:\Users\manfr\Desktop\intellij idea\corpose reborn\target\classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /C:/Users/manfr/Desktop/intellij idea/corpose reborn/src/main/java/org/golde/bukkit/corpsereborn/nms/nmsclasses/NMSCorpses_v1_18_R2.java:[61,61] cannot access net.minecraft.server.v1_16_R3.PacketPlayOutPlayerInfo.PlayerInfoData
bad class file: C:\Users\manfr\.m2\repository\org\spigotmc\spigot\1.16.5-R0.1-SNAPSHOT\spigot-1.16.5-R0.1-SNAPSHOT.jar(/net/minecraft/server/v1_16_R3/PacketPlayOutPlayerInfo$PlayerInfoData.class)
bad RuntimeInvisibleParameterAnnotations attribute: PlayerInfoData(com.mojang.authlib.GameProfile,int,net.minecraft.server.v1_16_R3.EnumGamemode,net.minecraft.server.v1_16_R3.IChatBaseComponent)
Please remove or make sure it appears in the correct subdirectory of the classpath.
[INFO] 1 error
[INFO] -------------------------------------------------------------```
Did you just ping md_5 for an issue lmfao
it help me
is it possible to kill a player with a custom death message without additionally listening for palyerdeathevent?
first
are spigot plugins compatible with paper?
yes
ok
how can i compile plugin from github (its my plugin am just learning to use github)
when i do it i get this
no .jar file
you need to build it
yes how
by using an IDE?
what argument you using for your build
wdym
Run mvn package
click the green button
i tried
And
it did what i showed also
try clean package?
mvn clean package is what i did
and what is the output of that
what error shows up
```error running 'Core plugin build; Cannot start process, the working directory the actual directory` does not exist
when i press this
can u show ur project structure fields
send your pom
this
where can i find that
do what mike said first
?paste pom
pom is good. But I'm curious what shows up in the build log if you just run
does any1 know why this class could throw an ExceptionInInitializerError?
public class GlobalGson {
private static final GsonBuilder BUILDER = new GsonBuilder()
.registerTypeAdapter(AnnihilationClan.class, ClanJsonAdapter.class)
.registerTypeAdapter(ClanUser.class, ClanUserJsonAdapter.class)
.disableHtmlEscaping();
public static Gson GSON;
static {
GSON = BUILDER.setPrettyPrinting().create();
}
}
ty
I assumed whatever config was in your runs was bad
ohh yeah its wrong directory on it
i didnt know i could change that
i just clicked around now
I want to stop sweet berry bushes from damaging entities but have no idea what method should I use to achieve that. I will be thankful for advices
can anyone help me? i have both of these but it makes an error, imma post the error in a second
'registerEvents(org.bukkit.event.Listener, org.bukkit.plugin.Plugin)' in 'org.bukkit.plugin.PluginManager' cannot be applied to '(com.alanek2012.alanplugin.listeners.PlayerJoinedListener, com.alanek2012.alanplugin.AlanPlugin)'```
does your class implement Listener?
no the PlayerJoinedListener class
oh, i thought i added it, thanks!
probably just EntityDamageEvent
but block is not entity
