#development
1 messages · Page 54 of 1
fat fingers XD
I don't think he's here anymore, but he definitely doesn't know that the only reason deprecated elements are left in is to prevent legacy projects from breaking.
Or if youre spigot, to mark unstable apis
deprecated just means pending removal, doesnt mean you cant use it but you probably shouldnt
or means d9nt use this use this other one
like with paper and sendMessage deprecated if using string instead of component
not always, sometimes it can mean just to not use the api
well atleast with the bukkit javadocs it says why its deprecated
yeah but it doesnt have to be pending removal or be superseded
deprecation ≠ for removal
^
it can
@Deprecated(forRemoval = true) does tho
yeah, deprecation just means that you shouldnt use the api. sometimes that can be because its going to be removed
there many things that are depsrated and had no altenative
for example in 1.8 to set item durability aka data
Hello guys!
Could anyone tell me how to I can create a Placeholder in my Plugin, for example %job%. It should be a string i declared earlier.
only desperate ways
hook to PAPI
there a full guide on their GIT
really user friendly
u create extension and register
I dont really understand it 😦
i dont really understand how i can rename the placeholder and set the content
its a string
or a value
it resets everytime upon the avable data in the plugin
u dont have to update it
like for example if its from hashmap
so like that? PlaceholderAPI.setPlaceholders(event.player, "placeholder val")
you dont use that to create your own placeholders
and how i can create my own?
you use that
i sent a link to the github docs about it, click that link and follow everything it says
its telling you exactly what you need to know
can you use Thread.sleep() in a spigot plugin in onDisable method
its for waiting unfinished async processes on stop
You might run into scheduler issues cause your sleeping the thread it runs on.
yeah now it sounds bad
it would be nice to have a safe stop command actually
i can give a timeout like a minute and wait for tasks to end
i mean what kind of async tasks can you not cancel safely on shutdown lol
Hello,
I want to add a String into my List, but it always throws a NullPointerException.
final String lower = "§7-------------------------------";
final FileConfiguration cfg = Citizenship.getMain().getConfig();
final String OWNER = "§bOwner: §f";
final String MEMBER = "§bMember: §f";
final String PREFIX = "§8[§bRegion§8] §f";
public static List<String> regions;
public static String chunk;
final Plugin pl = Citizenship.getMain();
final double costs = 250;
final double sell = 200;
@Override
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
Player p = (Player) sender;
chunk = regionMethods.getChunkString(p);
regions = (List<String>) cfg.getList(p.getUniqueId() + ".Regions"); <-- When I am trying to add something into this List, it won't recognize it
regions.add(chunk);
playerManager.getPlayerConfig().set(p.getUniqueId() + ".Regions", regions);
playerManager.savePlayerConfig();
}
Here in context
im guessing that FileConfiguration.getList() returns null if key is not found
the error being there suggests that cfg is null
Ahh yeah ofc, that makes sense. Thank you 🙂
What is the alternative for ChatComponentText in 1.20?
Component
they mention "do smt to this list" hence my comment
Mojang or spigot mapped?
net.kyori.adventure.text.Component
Ugggg. Ok thx
jk idk what that is, Ig smth from minecraft?
If the List does not exist and no default value was specified, this will return an empty List.
Unlike getList
If the List does not exist and no default value was specified, this will return null.
I need help, once in a while my placeholders stop working and i have to redownload them
any idea why?
done
I have used a StringList instead of a List and now it works. But thank you for the help 🙂 👍
how would I go about setting the inventory of a person to another inventory?
aka I have the player's inv object and I wanna set it to another inventory obj
what are you trying to accomplish?
loop over the items and set it on the other one
Don't think you can. I think you can only set contents
might wanna cache the original contents somewhere if you want to keep em
I don't think that would be the main issue. If the server was exited by SIGINT, Thread.sleep would throw an InterruptedException
If the server was exited by SIGINT
It wouldn't be running onDisable then
yeah will use this.
Also, best way to serialize a PlayerInventory object?
yes it does
I think most people use base64. If you are using paper, make sure to use their (de)serialization methods from the ItemStack clash over bukkit's hacky BukkitObjectStream thingy
the server has signal handlers for safe shutdown
👍
is PlayerInventory even serializable?
paper's method calls Bukkit.getUnsafe() method iirc which calls nms method which turns into NBT
which minecraft itself uses to store the inventory
the inventory itself is not serializable and has never been
what's paper's method?
itemstack.serializeasbytes
itemstack being an item of the inventory? so I would have to serialize each item right?
Pretty sure spigot can serialize contents. Doesn't look good though.
define doesn't look good
Just how its looks in a yaml is bad
I meant the items
ig yeah the PlayerInventory itself isn't
oops
doesn't need to look good
also, any ideas why configurate might be having issues with a plugin that isn't even using it? https://paste.helpch.at/pojexaqapi.rb
One of the plugins have configurate, but like, tf?
base64 if you want to store it easily in a string format
paper serializeAsBytes if you want to store it efficiently
ok found out
yeah will probs go with that
i mean even if you want to store it as base64 you're gonna use serializeAsBytes anyway
when in doubt, base64
Don't forget PDC and NBT 😉

based
almost as if the error message said what the issue is
actually a little bit cringer, It happend cause I was using paper-plugin.yml and not plugin.yml lol
how is that cringer lol
that is not what caused the error tho
the error is using paper-plugin.yml but declaring api-version 1.18, that would've never worked since paper plugins have only existed since api-version 1.19
if (Bukkit.getPluginManager().isPluginEnabled("PlaceholderAPI")) {
PlaceholderAPI.registerPlaceholderHook("timerplugin", new TimerPlaceholderHook(this));
}
'registerPlaceholderHook(java.lang.String, me.clip.placeholderapi.PlaceholderHook)' is scheduled for removal in version 2.13.0 it count as error
you should be able to call new TimerPlaceholderHook(this).register()
hello, to make an "avance" gui system I looked https://github.com/Flo0/GUITutorial but I don't really like the system.
So I preferred to do this:
I no longer use button classes (everything is done directly in the menu class itself) the same for click events, everything is defined in the gui class
Is it a good idea ?
Hello, can someone answer my question. When someone create for example a skywars plugin, they have to create 2 different plugins ? a SkywarsLobby that will send players to skywars servers + retrieve database stats and a SkywarsGame plugin which will be the game core ?
"have to" no, they can be kept in the same jar
they can do what ever they want
they dont have too anything
dumb question , he can make u also sperate lobby jar or both with config
that's what i am typing, please dont ping unnecessarily
Ig the invisible mode does not have features of do not disturb 🫥
any ideas why Arrays.copyOf(inv.getContents(), inv.getContents().length) might not be copying properly? for instance, I copy the inventory and save it in ram, and display it in a gui, here's the thing, the guy update every time I remove an item from my inventory??? shouldn't it be a copy instead of the actual inventory?
#clone() does the same
so I am a bit confused
Clone the itemstacks as well
Might be still referencing the same items, no?
My best guess
yeah it was
also, if I set keys in a section (yaml), do I need to also set the section again or will setting the keys in the section obj already be enough?
unsure if I explained it correctly but yeah
setting section.bla.key will create all parents in order to set key.
Best way to know is to fuck around and find out

If path does not exist it will create else , and yeah , how ever i think u r pretty experienced dev and I would suggest to not use SnakeYaml for data storage, also better use json or SQLite , or for some config and etc u can use other files u r not forced to stick to yaml…
Fun fact, using json, but I am kinda forced to use this library called "SimplixStorage", I am modifying an already existing plugin.
And that library supports both json and yml, so the section also works in json in this case
lol
the concept of "sections" foo.bar.baz like that is not really a yaml thing, that's purely a bukkit config construct
so asking that question and saying "but im using this other library" can backfire hard if you don't know it well
manz destroyed by fax and logistics
yeah tbh the bukkit config construct isnt really user friendly and it makes many things way harder then you cloud do it by your self in general by writing own file writer / reader
real men use .properties for configuration
🤣
not funny -300 citizen score.
Probably simple but why is
return new ClientboundPlayerInfoUpdatePacket(actions, Collections.singletonList(npc.getEntity()));
```Showing an error in the compiler but```java
Collection collection = Collections.singletonList(npc.getEntity());
return new ClientboundPlayerInfoUpdatePacket(actions, collection);
```isn't?
maybe because of the Collection instead of Collection<T>?
So should I cast it on the first one? (Collection<T>) Collections.single
Hi, what is the reason of this error ?
[13:43:36 ERROR]: Task BungeeTask(sched=net.md_5.bungee.scheduler.BungeeScheduler@9573b3b, id=1, owner=fr.stormas82.bungeequeue.Main@6548bb7d, task=fr.stormas82.bungeequeue.Main$1@6b5f8707, delay=1000, period=3000, running=true) encountered an exception
java.util.ConcurrentModificationException: null
at java.util.HashMap$HashIterator.nextNode(HashMap.java:1469) ~[?:1.8.0_362]
at java.util.HashMap$KeyIterator.next(HashMap.java:1493) ~[?:1.8.0_362]
at fr.stormas82.bungeequeue.Main$1.run(Main.java:27) ~[?:?]
at net.md_5.bungee.scheduler.BungeeTask.run(BungeeTask.java:66) ~[Flamecord.jar:git:Travertine-Bootstrap:1.16-R0.4-SNAPSHOT:4d67d99:unknown]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) ~[?:1.8.0_362]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) ~[?:1.8.0_362]
at java.lang.Thread.run(Thread.java:750) [?:1.8.0_362]
here is my code
im trying to make a bungeequeue
getProxy().getScheduler().schedule(this, new Runnable() {
@Override
public void run() {
for (ProxiedPlayer i : queueFaction.keySet()) {
i.sendMessage(new TextComponent("You are: "+queueFaction.get(i)));
if (queueFaction.get(i) <= 1) {
if (i.getServer().getInfo().getName().equalsIgnoreCase("Faction")) {
queueFaction.remove(i);
for (ProxiedPlayer p : queueFaction.keySet()) {
queueFaction.put(p, queueFaction.get(p)-1);
}
}else {
ServerInfo server = ProxyServer.getInstance().getServerInfo("Faction");
i.connect(server);
}
}
}
}
}, 1, 3, TimeUnit.SECONDS);
null
a cause of what is happening?
its nulll
bcs its working well but spamming this error
please do java homework on what is null 😉
which means you're interacting with a map or collection that was edited while your code ran
happens with async tasks
ho ok thx
I'm guessing it may be your queueFaction map
since you're removing values inside of the for loop
yeah is forgot to use async im stupid
hm yeah
add to list
that u remove from
outside of for (p : p.)
still a null error
how ever
List<ProxiedPlayer> queuedPlayers = new ArrayList(queueFaction.keySet());
add that before the loop
and use queuedPlayers instead of queueFaction.keySet()
cloud you explaini hmi why
and not just spoon feed
ok thx i'll try
yeah of course
stormas read this carefully you need it because you stupid
get out
you're not helping nor bringing any important info to this topic
the guy is so bitter
nor even trying to help or giving relevant information
yeah
Tanguygab are you mentally unstable? just spoon feeding maybe volunteer to code for others ?
this guy is trash
Because you're modifying the map while iterating over it (accessing it with the for loop), it throws a ConcurrentModificationException.
To avoid this, you have to save the keyset in a variable that's independent from your map
what does ClientboundPlayerInfoUpdatePacket accept?
just used his words.
Collection (ServerPlayer)
I'm also explaining things
am I mentally unstable because I help others?
it was a question are you?
then that means that everytime I encountered a bug, all the people that tried to help me were mentally unstable as well
yeah, anyways
stormas make sure to write credit to tanguygab
how about you all stop insulting eacho ther? Thanks.
so you create a new list with all the values inside the keyset, and it won't be affected by the changes in the map
and won't throw an error
Nothing wrong with spoonfeeding. If the user doesn't want to learn from the code provided thats on them.
in this case, they did, and that's why I provided info on what I did
nah men he didnt learn java its different
cough
sync/async stuff can be quite tricky, even I have issues with it to this day
and he legit got a clear stacktrace
you got confused as well and thought it was an NPE
i hate beggers what keep them alive are those who give them money instead of a job
didnt say its null pointer expec
i said null
what is null then?
java.util.ConcurrentModificationException: null < hint
yeah, so what's null?
... I've seen people turn down jobs and continue to "beg". Can't fix people.
goober soup
Can you show the error and code again so I don't have to search.
let them starve to death
java.util.ConcurrentModificationException: null < thats the error code
here
but dw Yap, already helped them
Object removed from the list as you're looping through it. Making it null when the loop reaches it.
that's a better explanation than null
🤷
its null
^^^
yeah but what is null
for the guy who would just beg till we recode his code so he can say i did it my self?
eh, anyways, I'm done here
which element can be in his loop?
you would better send him a guide on how to read stacktraces and a link to java for beginners book guide in amazon
maybe he would be able to finish his plugin
that null there is just there was no specific error message
an exception without message will say null
how to avoid concurrentmodificationexception: loop backwards instead of forwards
or just use the iterator and modify with that
tho in this case the loop backwards wouldnt work since they arent removing based on the position of the set
also i understand what this piece of code is doing, keeping track of the player's position in the queue and then if they get transferred remove them from the map and update everyones position
personally id split this up into two loops, have an integer variable that keeps track of how many people were removed from the keyset, then if its above 0 then to do the update of the objects in the map
i was gunna say to have a boolean that acts like a flag if any player was removed from the map but the counter would do the exact same
it would mean your not looping through the map more then twice per run
and using the map's iterator would stop the concurrentmodificationexception
Or... use concurrent objects.
Or remove mutability entirely
ooo java has Queue stuff built in, interesting
java has pretty much all data structure stuff built in lol
mfw it doesn't have a concurrent linked hash map
It makes me so sad 😔
caffeine 😌
it also has no trie implementation afaik
yeah I was just thinking that too
theres probably tons of stuff built into java that i dont know about
+1
funnily, javac has a singly linked list implementation that is used basically everywhere
*immutable
but not lazy :(
I bought a plugin and it has this class inside, is it malware?
https://paste.md-5.net/qosimohido.java
awesome… I love Java now
most likely, yes
It’s writing stuff to plugins’ jar files
So ye
It’s malware
is Player#getStatistic heavy to use for example in Block break event?
I assume it's already cached in memory
In like a map
So I don't think so
Good to hear! 
Anyone knows any better option rather than using parseother in checking other players stats? Decided to create a GUI that shows the data of a said player when tying /playerinfo [playername] and sending the playername from the parseother placeholder but looks like it only checks if the player is online. Looking for ways to make it work even if the player is offline
Wrong channel.
If I check for Packet class... Other methods with parameters that extend packet will be found.
how is that an issue? param == Packet.class will be true if the parameter type is Packet, not subclasses
also what happens if there are two methods with the same parameters lol
if(methodParams[i] instanceof Object);
continue;
which IDE are you using and why doesn't it scream at you?
also, MethodHandles >>>
I mean, the if doesn't do anything
it just always continues
wait you're really using Eclipse? Are you compiling with Eclipse too?
Because that code doesn't even compile
eclipse moment
well your compiler compiles code that isn't valid Java
how is that a good thing lmao
- the first if has an empty body (
;) - something instanceof Object is equal to a null check
- the second if is unreachable
this whole loop does exactly nothing
you do
perhaps the better question is why do you have a ; at the end of an if?
...
also still, getParameterTypes returns an array of nonnull entries
and also still this
and if you want to reimplement method selection, you should take a look at the JLS I guess
uh.. how is this any different than Class::getDeclaredMethod(String name, Class<?>... paramTypes)
hold on, there is a reason
it takes a return type I guess
yeah I think it was that
Because Arrays.equals(Method.getParameterTypes(), parameterTypes) are not equal. One contains Ball and the method contains Object. (Don't ask me why)
no I mean, why is that a problem
it is clearly a miss-use of Class::getDeclaredMethod
for(int i = 0; i < methodParams.length; i++) {
if(methodParams[i] instanceof Object)
continue;
if(!methodParams[i].equals(parameterTypes[i]))
continue methodLoop;
}
this will always fall into the first continue
getParameterTypes returns Class<?>[] where the elements are valid Classes, a valid Class instance is instanceof Object
public void a(Ball b, Object o), public void a(Object o, Ball b), what does getMethodByParameterTypes(<location>, a, null, Ball.class, Ball.class); return?
this still applies
you are misunderstanding what instanceof does
instanceof checks that the live object reference is an instance of the type on the rhs
clearly you don't
because you're using it wrong
a Class object will always be an instanceof Object
then stop doing things wrong lmao
the first step towards accepting help is stop thinking you know better
which is not the same as it being == Object.class, which is likely what you want
println(Object.class instanceof Object)
println("hello" instanceof Object)
println(List.class instanceof Object)
println(new ArrayList<>() instanceof Object)
all of these print true
this will always be true
then the entire loop is completely useless
if all it does on every single iteration is continue; then there is no point in having it altogether
that is not what that code checks for
_ _
clazz instanceof Object is not the same as clazz == Object.class
all and every of the parameter classes will always be instanceof Object, rendering the whole for loop useless as it will only just continue;
a Class object is always an instanceof Object
the type it represents might not be Object itself, now that is what you want to check
i have digivolved
🎉
you describe a == Object.class here, which is totally different from instanceof
getGenericParameterTypes might be helpful
generics like T turn into Object.class if you use getMethod from what I've seen, probabably with other methods and checks you can get the generic type, idk
why aren't you checking for PacketPlayInBoatMove.class or ServerboundPongPacket.class directly?
well, time for a new method for parameterised types
or well to turn your method into that and use Class#getDeclaredMethod for the rest of the methods
👍
How to change the mob inside the mob spawner to something like a undead zombie horse?
does anyone know a way to disable break progress for specific blocks in a world for players, so instead of the blockbreakevent being cancelled the block is just treated like bedrock? I would never even think this to be possible but hypixel seems to do it in their skyblock mines.
if anyone has any idea please ping me
You could give them max mining fatigue when they mine that specific block, disables the block breaking animation
hypixel gives players a high mining fatigue and then does its own calculation to figure out the progress you have towards breaking the block and sends packets to the client to update the block's break progress animation
ofcourse make sure if they break the block normally to cancel it
since on some blocks depending on the tool used it you can still break the block in a somewhat decent time
like efficiency 5 shears on leaves
doubt you need the fatigue, cancel the interact and damage/ progress packets and send your own
theres gotta be a reason why hypixel does mining fatigue, tho they are running 1.7 so it wouldnt suprise me if you dont need mining fatigue anymore for it to work
i bet its about the times where the block breaks too fast client side
so it shows as broken then pops back up
like with shears mining leaves instances
ye, most likely
You do
how do you change the little mob inside the mob spawner?
reason?
CreatureSpawner class most likely
declaration: package: org.bukkit.block, interface: CreatureSpawner
would it be possible to set it to something like Zombie Horse or Skeleton Horse or smth?
it should be fine with any entity afaik
declaration: package: org.bukkit.entity, enum: EntityType
takes these as type
ah cheers!
hey anyone see anything wrong with my PLugin.yml or where it is in my project? Plugin builds fine just get plugin.yml not found when it tries to start
Can send full yml if needed
whats the error you get when you start the server with the plugin installed?
Its plugin.yml not found
the full thing
Player side you’ll get halfway through breaking a block before the break progress is reset to 0
Let me grab pm
pom
Pom
iit doesnt look like theres anything missing, have you tried to recompiling to see if it was just a random occurence for it to not show up?
Anyone else have any ideas?
Because I see nothing wrong
Also idk if this is related but when I put the jar into this website
https://www.ezyzip.com/open-extract-jar-file.html
There is no resource folder or plugin.yml... Is it maybe my build artifacts thing is fucked up?
Ok yeah thats what it is
Build was messed up
So plugin.yml error is gone but the plugin still doesnt show up when I do /plugins and I see no errors in console when I start the server
Here is what I get when I start server
Did I mess up my vault dependency thing?
Is that maybe what it is?
@proud pebble thoughts?
Send your plugin.yml in a paste
Also make sure you aren’t shading vault
@leaden sinew
Is there a way for me to test to see if its being shaded. Tbh not too familiar with that term
That’s not your plugin.yml
Open your jar with 7zip or something and check for vault classes
Yeah you’re shading it
Ah ok
How do I unshade it
I have the vault.jar chilling in my downloads is that the problem maybe?
Idk where it got the net folder from tbh
Try looking up how to make dependencies compile only in Maven, idk how because I use Gradle
It's already correct on the pom, provided does exactly that
Any idea why its getting messed up then
Not sure, how are you building the jar?
That is probably the issue, you should build with maven
Can I do that through Intellij?
yes
just create a maven configuration and run clean package
I dont see anything in the build artifacts section about Maven
One sec sending pic
@proud pebble @pulsar ferry @leaden sinew thoughts?
you dont do it there
Oh??
you should see a box like this on the top right to top middle of intellij
tho i think the icon will be different
also delete both artifacts you dont need them
or go to Run -> edit configurations
click the +, then click maven
then in the Run box put clean package
click apply and then close the window and you should see a green arrow, click it
Ye I have the same thing just with a little M icon
Where does the .jar go though?
When built
M is from maven
i checked and as far as i can see there is no way to stop breaking by cancelling any sort of packet, i looked for ages
i think it is on release or build
oh wow that's fancy, thanks
I dont have either of those folders tho
do mvn package, not build
Ah nvm, lunaiskey told you to use package too
As long you run the configuration and it doesnt fail, you should see a new folder with the jar inside
I'm not quiet sure how to register a command without plugin.yml but I tried something like:
for(String page : getPages()) {
getCommand(page).setExecutor(
new CommandExecutor(){
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
System.out.println(cmd);
System.out.println(args);
return true;
}
}
);
}
Which defenatly wouldn't work, anyone have idea how can i register commands using string list from config?
Fixed this
Had to fix the directory
- Use a command lib
- Use a command lib
- Look how command libs does it. Technically you need to add the command to the commands map, which is a field on, uh, Server I think.
Ok I get another problem now. It builds but the .jar is empty
[WARNING] JAR will be empty - no content was marked for inclusion!
I was thinking maybe there is some issue in this section but I dont really see any problems
<build>
<defaultGoal>clean package</defaultGoal>
<finalName>${project.name}-${project.version}</finalName>
<resources>
<resource>
<directory>src/main/java</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>3.0.0-M5</version>
<configuration>
<tagNameFormat>v@{project.version}</tagNameFormat>
</configuration>
</plugin>
</plugins>
</build>
can you send me example or link so i can understand?
Wait, got it to compile. Needed to change the path in the pom but now it isnt detecting the plugin.yml. Will decompile the .jar and see if its doing smthn funky again
its player action packet
yes
Now I am not sure if this is being cased by weird build thing or if this is being caused by plugin.yml
its this
cancelling it would make it so that its not dig, clientside it probably still breaks
is it client or server bound
hence the fatigue
yeah exactly it still breaks
so it has the same effect as cancelling blockbreakevent
ye we were discussing it above, fatigue is for clientside
yes no difference, i would cancel interact though probably
what i wonder
is applying fatigue on interact enough?
since i feel with fast breaking blocks, between ticks might be too late
I think this is correct??
no it wont
but thats the best ive seen so far
i would probably leave minimg fatigue on tho and just do the custom breaking
and then i get to set custom tool speeds
and i dont think interact can detect stop breaking so id use packets
PlayerAction 0 and 1
plugin.yml needs to be inside resources
the folder
does DogPlugin extend JavaPlugin?
Ok let me try that
Hm thats funky
org.bukkit.plugin.InvalidPluginException: Cannot find main class `machu.dogplugin'
main: machu.dogplugin.MyDog
???
um
what is the package
for MyDog
at the top
is it package machu.dogplugin;
@sullen creek
target
Ye I found that
something to make it easier, https://paste.helpch.at/edoroqihoj.xml
Was not used to that but it is useful
just change the details to your stuff if you couldnt get your pom to work correctly
I think everything is building correctly but for some reason it cant find the main file
When I extract the .jar it shows that the MyDog main file is in there
But I am still getting the error
according to this its trying to get yourt main class at machu.dogplugin
not machu.dogplugin.MyDog
also really you're supposed to do me.machu.dogplugin.MyDog
since that complies with the java naming conventions
Ah ok
dm me a copy of the plugin
Just the .jar?
yep
??????
recheck your plugin.yml is correct
if it is try just restarting intellij and try again
Restarted, plugin.yml is still correct but its still giving same error
is it a build thing then?
it shouldnt modify the yml file
try using the pom.xml i provided #development message
ofcourse change it
i say to try that cus it could be a pom.xml problem and i see some differences from mine to yours but i know that mine definitly gives a valid yaml file
Got it
[ERROR] Failed to execute goal on project dogplugin: Could not resolve dependencies for project machu.dogplugin:dogplugin:jar:1.0-SNAPSHOT: Could not find artifact org.spigotmc:spigot:jar:1.12.2-R0.1-SNAPSHOT in spigotmc-repo (https://hub.spigotmc.org/nexus/content/repositories/snapshots/) -> [Help 1]
<version>1.12.2-R0.1-SNAPSHOT</version>
This line looks like the one id have to change but it looks right to me
Lmk if I messed something up here
One sec I think Ik the problem here
Need to put the .jar for that version of spigot into my dependencies folder (I think)
@proud pebble Ok I did this and still didnt work, thoughts?
What do you need help with?
so basically i was with my friends on our discord server and suddenly we got all kicked out and the server is closed is there posiballity to send a screen shot in here to make it easy
?not-discord
Looking for discord support?
HelpChat is a Minecraft plugin and development support server and is not affiliated with discord in any way.
If you require support from discord, we recommend you to visit their official support website at https://support.discord.com
On this website, you can read their FAQs, or open a support ticket if necessary.
discord server outage, very much nothing we can do
it's ok i forgive you
thank u
sorry guys have a good one bye!
Idk if I downloaded the wrong .jar or something
But I cant get this to work at all
Ok got it to build again
Current pom
Same issue
org.bukkit.plugin.InvalidPluginException: Cannot find main class machu.dogplugin'`
Absolutely no idea why it stil thinks its machu.dogplugin
plugin.yml says machu.dogplugin.MyDog
Ok so this is odd
Even when I delete the plugin.yml all together I still get the same error
So idk what is happening here
Ok so had to change the resources directory in my pom
But now I just get the error
org.bukkit.plugin.InvalidPluginException: Cannot find main class machu.dogplugin.MyDog'`
Which makes like no sense because the MyDog.java file is there in the .jar
what is the actual path to the file
/Users/matt/IdeaProjects/DogPlugin/src/main/java/machu/dogplugin
then the file is not actually located within the java file
Huh?
It is tho
Are you able to send me the jar file in my dms
why does your jar file contain .java files 😵💫
thats a very good question
I am not familiar with Maven building so this is very new to me lmao
how specifically are you creating the jar?
top 10 reasons to not build with maven <3
@icy shadow This
Maven
I was just building the artifacts using Intellij but I was told here not to do that
I have no idea how its making the .jar files or how to not make it do that tbh
Maybe its something with my pom?
It'd be mvn clean package for building the jar
Right now its just package
Will send screenshot in sec
Package creates the jar, install also publishes it to maven local, which most of the times you don't really care for
when i hot swap my plugin it doesn't use the remapped jar from special sources, how do i fix this
restart server
Seems like you are missing the compiler plugin
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.10.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
Adjust the version, source, and target according to what you're using, this snippet is pretty outdated
When was ItemMeta#setCustomModelData method added to Spigot Minecraft?
1.14
thanks
i'm trying to use hotswap and mojang mappings
?paste
Paste Services
When asking for help with a config/menu/code issue please use our paste bin:
(we prefer it over pastebin.com)
• HelpChat Paste - How To Use
/home/minecraft/signal/start_cmd: line 1: 572 Killed /opt/java/17/bin/java -Xmx${SERVER_RAM} -XX:+ParallelRefProcEnabled -XX:MaxGCPauseMillis=200 -XX:+UnlockExperimentalVMOptions -XX:+DisableExplicitGC -XX:+AlwaysPreTouch -XX:G1NewSizePercent=30 -XX:G1MaxNewSizePercent=40 -XX:G1HeapRegionSize=8M -XX:G1ReservePercent=20 -XX:G1HeapWastePercent=5 -XX:G1MixedGCCountTarget=4 -XX:InitiatingHeapOccupancyPercent=15 -XX:G1MixedGCLiveThresholdPercent=90 -XX:G1RSetUpdatingPauseTimePercent=5 -XX:SurvivorRatio=32 -XX:+PerfDisableSharedMem -XX:MaxTenuringThreshold=1 -DIReallyKnowWhatIAmDoingISwear -Djline.terminal=jline.UnsupportedTerminal -jar server.jar
@warm steppe
i bought more ram
?paste
Paste Services
When asking for help with a config/menu/code issue please use our paste bin:
(we prefer it over pastebin.com)
• HelpChat Paste - How To Use
send ur logs
okay ur actually trolling rn
what
im so confused what you want me to do
i sent the error thing
do oyu want me to send intire logs
@warm steppe
you literally didnt send me any errors
is that good
wait
let me start server rq
@warm steppe
its taking like an hour to start up
Server starting, setting up fifo connections and writing server ready.
Downloading mojang_1.19.4.jar
This is not the right channel for that btw
what channel
#minecraft Would be more appropriate
ok can we finish tho
Yeah
quick question, is it efficient to be querying an SQLite database every time onPlaceholderRequest is called?
Defnitely not
@minor summit isn't like mysql generally faster and more efficient than sqlite ?
a) not necessarily b) whether you use mysql or sqlite solves different problems
you should cache the results
lets say i wanted to store a boolean value at a coordinates, would i be better of having multiple nested maps of integer or use a tuple
id assume nested maps would be faster since it wpuldnt have to loop over every value till you find it
since it wouldnt have duplicate single values
for example 1,2,2 and 1,3,4
In short, if you have a small coordinate space and value access speed is a priority, nested maps of integers would be the better choice. If you need flexibility and simplicity, and the size of the coordinate space is not a concern, tuples would be a suitable option.
so, for example, keep a Map<UUID, Statistic> in memory that stores the data of all online players?
hmmm
yeah that could aslo be a good option
Uhhhh
Out of memory error incoming
🥲
I think?
Ya
Think he meant int[] coord = new int[x,y,z];
Not nested.
actually I did mean nested, didn't know the above existed
and good to know that could be a memory issue
coord[99999, 25, 99999] = true 😵
Do you have the states (true, false, absent) or actually only two states per coordinate?
Hey not sure if this is a question for this kinda server but u know how in MC when u hit a mob like a pig or cow it begins running from the player. Is there a way to summon in the entity so that is in a constant state of fleeing or running?
true or false/absent(since they can be expressed as both and it would be assumed as such)
also considered making a byte array to save on space otherwise there would be tons of wasted bits
Well if you only need one bit per coordinate, you can use BitSet
Then it depends on whether you have a fixed bounding box
yep, a single full block
Then you can just linearize the coordinate and use it as index for a BitSet
If it’s sparse, there might be even better solutions, but that is really heavily use case dependent
the usecase of this is deciding on if the block as said coordinate has been modified by a player for figuring out if the block should give xp or not, so preventing just breaking and placing the same block to gain xp
Doesn't the API have a method for that now?
i dont know, im just considering if there isnt already a system for that
In that case a sparse bitset implementation might make sense, depending on the size and how much you care about memory usage
There is MetaData, that you can set with a plugin to a block, can you not use that?
would using a byte[] require less memory then a bitset? i would assume yes but ive never tested it
mind pointing me in the direction of where to find that
that looks pretty useful
tho ig if i wanted to reduce memory usage for my specific usecase then a byte[] or bitset might work better
had a same issue with some plugin i was making, but used this as a quick fix and it works pretty good:
https://github.com/Flo0/PlayerBlockTracker
it works the same way kinda
whats the packet that get sent when the player is initially spawned
Ig the same you use to spawn npcs? So smth like world entity add
just checked its playerinfoupdate for removing and spawning players
and spawnplayer packet for updating whenever coming to visible range
thx for help tho
where is com.mojang.authlib.GameProfile in 1.17+ jars? i cant find it anywhere in the nms jar
nvm found it in authlib.jar
I have a problem with PlaceHolderAPI: Caused by: org.bukkit.plugin.UnknownDependencyException: PlaceHolderAPI
Because it is PlaceholderAPI 🙂
For some reason my HikariCP connections are insane slow which means I messed something up...
both SQLite and MySQL is super slow. and when I reload (I know I shouldn't) server I get [18:30:38 ERROR]: Could not generate table(s) reason: [SQLITE_BUSY] The database file is locked (database is locked)
The SQLite thing, the onDisable() is just source.close(), so shouldn't be an issue? when I connect and load the data it delays the login super slow too.
File file = new File(homes.getDataFolder(), "storage.db");
if(!file.exists()) {
try {
boolean fileCreated = file.createNewFile();
if (!fileCreated) {
throw new IOException("Tried making a new config, but it already exists. It's a non issue, but shouldn't happen regardless.");
}
} catch(IOException e) {
Bukkit.getLogger().severe("Could not generate 'storage.db' reason: " + e.getMessage());
homes.getServer().getPluginManager().disablePlugin(homes);
}
}
HikariConfig config = new HikariConfig();
config.setDriverClassName("org.sqlite.JDBC");
config.setJdbcUrl("jdbc:sqlite:" + file);
config.setMaximumPoolSize(1);
config.setAutoCommit(false);
dataSource = new HikariDataSource(config);
}```
tried setting the pool higher
You don't need hikari for sqlite
I know, but the plugin has a toggle feature between MySQL and sqlite
open source / public
F
rogue unclosed connection at https://github.com/pricelessdev/Homes/blob/master/src/main/java/me/albus/homes/Database/Database.java#L61
should do
try (Connection c = dataSource.getConnection();
Statement s = c.createStatement()) {
// ...
}
dont you also need to commit changes since auto commit is disabled?
could you elaborate Emily, by rouge what do you mean? I should move the statement inside the brackets?
No, she means you need to use try-with-resources when using Hikari, to close the connection after you are done. Like in the code snippet she sent.
It fixed the problem yea 😛

what’s the difference between nbt and pdc? is pdc just more flexible and nbt just pointless?
making a pickaxe customization system and wondering whether to use nbt or pdc
nbt is the native and internal way of minecraft dealing with data, while PDC is a spigot wrapper for NBT with more flexibility and easy to use API. NBT is just hard to use and it can get very messy in cases
Depending on what you need but mostly PDC is enough. You can use NBT if you need a bit more customization for your pickaxe though, or if in certain cases you need your own implementations for the data stored (nested nbt and stuffs?).
(someone may have a better explanation than me)
its nice if u wanna attach data to some minecraft object, as its saved and loaded by the object its attached to
and sometimes its just nice as opposed to implementing ur own storage code
they are the same thing
pdc is just a frontend to nbt in the spigot api
there should be no functional difference
unless you specifically need to edit a “hardcoded” nbt tag
yeah, and you can not have nested tags though
can't*
huh? wdym? like "plugin:cool": { "plugin:thing": 123 }?
yeah, compounds or how are they called
you can do that
yeah


Hey, what's that page?
yeah F
How can I set a different language level for the test module? I get this error with the following configuration
compileTestJava {
sourceCompatibility = "17"
targetCompatibility = "17"
}```
`Cause: invalid source release: 17`
I'm testing some things for a plugin on the test module, through a class with a main method
assuming the project's java toolchain version is < 17?
yeah 
well there's your issue
set the toolchain version to >= 17
the test compile release flag to 17 and the regular compile release flag to <= 17
aight, that worked, thanks em
Is it OSS?
not
:(
@dusty frost to use transaction, did you had to set allowMultiQueries=true? Without that option, it complains about this
START TRANSACTION;
SET @AMOUNT_TO_BUY = ?;
SET @ITEM_ID = ?;
-- the rest of the transaction
java.sql.SQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'SET @AMOUNT_TO_BUY = 4;
SET @ITEM_ID = 'test_item_1';```
I mean, it would make sense to require that, I just want to make sure xD
Oh boy raw sql transactions, you don't have an orm or some other framework to handle that for you? Will make your life so much easier
nah, I got only a few queries anyways
although I might look into that java library, was it ormlite?
I mean, even JDBC has a wrapper for transactions right?
U doing this in java?
i used the prepared statements in postgres, so not sure, but from a cursory google search it looks like yeah you need to turn that on manually to make sure you understand the ramifications of not doing SQl injection on yourself lol
Yeah I think so
That's why I found odd to see it being used raw
Interesting
It's not like the JDBC API changes often, if ever
i also have moved to doing stuff in a web backend and just contacting it with HTTP calls for consolidation and stuff
This ^
nah it is for a mc plugin
All database access being exclusive to microservices 😌
Doesn't that unnecessarily increase db latency tho?
That should not be a problem
i'm still in monolith land 😌
maybe for a bigger project I would consider that, but doing everything on a single 'service' is fine for this use case.
k8s is still beyond the pale for me lol
Hey, I made a PersistentDataType of a MerchantRecipe list and it's working when the results and ingredients for the merchant recipes are ItemStacks. But when I try to use it with a subclass of ItemStack an error is thrown: https://pastebin.com/zxCrjs3L . Here's my MerchantRecipeListDataType class: https://pastebin.com/jBv1qQ0M. Does anybody know how to solve it?
You still need to cache the data locally tho, right?
Depends on the data and where it's used
I use transactions for the stock of a shop, mc plugin as I've said.
Although I still need a local cache. Since mysql blocks rows used in transactions, how would I do the same for a local cache (smth like a Map<Item, Integer>)? Do I just slap a synchronous on the cache 🤣?
It Depends™️

Well the cache would be used when players try to buy an item from the shop that has a limited stock. Sadly I don't know how to process 'requests' for the same item one by one 😦
You could have a lock for the item
Good point
why do you need to process them one by one? 
Well not necessarily one by one, but in the order the players try to purchase an item. E.g. if there's 5 item X left in stock, and player A tries to purchase 4 at the same time with player B which tries to purchase 3, the first one would get his items, but the second won't be able to purchase, unless they change the quantity.
Can you guarantee that the players will be on the same server?
surely you can alter the amount in bulk for however many items a player tries to purchase without doing it one by one, no?
If yes, use some locks, otherwise use transactions
well yeah, ofc, this is an in-game shop
if a player tries to purchase 4 of an item, do you get the 4 requests one after the other individually or as a single request?
A single request, 4 items of the same type
Well if it were to be distributed (for example, Skyblock), you wouldn't be able to guarantee such a thing
cuz like, for a local cache, with compute/merge/computeIfPresent etc you don't even need to do any locking yourself so long as you're using a concurrent map
That sounds nice 
I don't plan to support multiple servers, so that's fine
And I wouldn't mind to ditch transactions, for now at least 🤣
Is there some way to make Gson's fromJson return a default value should parsing not work (Return null)?
Like, I have this rn
try{
// cacheFile is a Path instance
BufferedReader reader = Files.newBufferedReader(cacheFile);
// cachedPlayers is an ArrayList<CachedPlayer>
// and listType is TypeToken<ArrayList<CachedPlayer>>(){}.getType()
cachedPlayers = gson.fromJson(reader, listType);
reader.close();
}catch(IOException ex){
return;
}
// ... do stuff
What I hate here is, that Gson can return null for the cachedPlayers, which makes later stuff a lil more annoying to work with.
Is there a way to tell Gson to return a default should it fail to parse JSON?
Optional#ofNullable and then #orElse maybe?
Isn't Optional crap?
Annoying to use sometimes? yes
Crap? NO
Okay.... Doesn't seem to work
IJ yells at me that it needs a List yet I give it an Object
I just do an if check after doing the fromJson...
that will only be null if the source is completely empty (an empty file/only whitespaces) or it's the null literal json value
don't know in what situations you'd end up with either of those cases unless the user just manually deletes the file contents without deleting the file; the second case is even funnier, typing null as the whole file content
?
why is MaterialData deprecated but ItemStack#setData not deprecated?
in Spigot I mean
Spigot
that's why
aight ig
Hi, does anyone know if Bukkit.getPlayer(uuid) works for players joining via Geyser (bedrock edition)?
As long as you use the uuid provided by geyser and not their bedrock id.
Guys can somebody tell me whats better for minecraft
Typescript or javascript
Im focousing on makeing a minecraft client
That's a very confusing question, TS and JS main difference is for the programmer, TS is a lot nicer to code in
But that being said .. javascript .. for minecraft client? Huh?
@gleaming stone forgot to ping ^
oh
You can make a minecraft client with javascript right?
You can, but not very well and probably much much harder
Why not use Java?
Well if Minecraft was written in Javascript then maybe
Unless you mean launcher instead of client
Can you help me with something?
I mean the client
^^
Depends on the something
No
okay ty
hey, does anybody know how items from the plugin AdvancedEnchancements are identified? I mean, how can I check if an item is from that plugin?
What are you trying to do?
I don't know if there's an api method to, e.g. check if an item is a book, but items have some NBT tags set that you can use.
I am looking for a maintained Inventory library with 1.8-1.20 support. any suggestions?
triumph-gui works in those I think, might want to also check vision, although unsure if it supports all those versions, gotta ask @royal hedge
thanks, I will check out triumph gui
whats Vision tho?
I mean I can't find it
on the works
but yeah, quite promising
but it's paper only
ah, I want it for Spigot
Spigot 💀
wait, so if the library is made on papermc, will it work on spigot server?
No
thats the reason
and spigot plugins work on papermc right?
coz papermc is a fork of spigot
coz im creating the plugins to publish them
And?
and not everyone uses papermc ig
over 80% of servers on 1.20 are using paper
and in all versions, over 70% are on paper or its forks
soo yeah...
Using spigot on newer versions is just pure ignorance
I don't use proprietary plugins
So idk
I, as a developer, liberated myself from supporting legacy versions
I use Java 17 and a modern Paper API
Never been happier
If some people don't want to upgrade to a normal version, they don't get to use the plugin
are those plugins for personal use or for marketing?
Free and open source plugins
Or, plugin, to be exact
No DRM, no obfuscation, no bullshit
whats the equivalent of the AsyncPlayerChatEvent#setFormat method for AsyncChatEvent with components
there is a thing called renderer but i really couldn't figured out that
https://pastes.dev/KXpZmmvR20
The plugin idea:
Randomly every 1-24hrs a players effect changes. These can be any of the buff or debuff effects in minecraft.
You can craft a Chaos Orb that will give you a permanent positive effect which is also random until you die. You can have an unlimited amount of chaos orbs in your inventory at a time. Meaning you can stack these permanent effects. However if you die the item is permanently removed from the game and there is no way to get it back. Meaning if someone kills you they don’t get the Chaos orb either.
The way to craft a chaos orb is like so 4 diamond blocks, 4 netherite ingots, and a splash potion of water. It does not matter how they are placed in the crafting table.
The Material for the Chaos orb is a snowball. Please edit the name of the snowball to display Chaos Orb in Red Bolded text.
If a player dies to another player the player who died has a 50/50 at a negative effect when they respawn which is permanent or losing 1-3 hearts on respawn.
If a player kills another player, the killer gets the same permanent positive effect as the Chaos orb or you gain 1-3 permanent hearts. This should be a 50/50 chance as well.
The Issue:
It appears to be that none of my Events are working at all. Is there any reason for this? I am yet to implement every single feature into the plugin but I mainly added in the important ones. Only thing that works is the ShapedRecipe.
can you paste the code over to https://paste.helpch.at/ ? the one you linked doesn't seem to load
How do you know that the events are not working? Have you tried adding debug messages?
The events don’t execute when they should be prompted to
Wait nvm I think it’s a stupid mistake by me
I have a condition which shouldn’t be there
Try verifying your assumptions, trust me it'd help a lot
yeah ik
i just added in some sout texts to debug to see if the events are being ran or not
yup got it to work basically i had a stupid condition that checked to see if a player had the ChaosOrb in their inv but that wasnt needed and I was using the wrong method to give the player a random effect
tysm for your help 😄
you're welcome :)
what would be the easiest way to make dropped items only appear to some players?
Packets
i need the ppl that can see them to be able to pick them up
Use packets to hide them from other players
u can do that????
Yeah just send the destroy packet
is protocollib used for packets?
Yeah
they seem to re-appear after a few seconds, am i doing something wrong?
final ProtocolManager manager = ProtocolLibrary.getProtocolManager();
final PacketContainer packet = manager.createPacket(PacketType.Play.Server.ENTITY_DESTROY);
packet.getIntLists().write(0, Collections.singletonList(item.getEntityId()));
for (final Player player : players) manager.sendServerPacket(player, packet);
```*fired right after item is spawned*
Listen to the entity spawn packet, and then you can remove it
gotcha


