#help-development
1 messages · Page 1940 of 1
yep
not bad
and i still haven't released 2.0
I am about to reach 100k downlodas with ChestSort in the next days
nice!
it feels really nice to hit triple digits
ty
I have a ton of plugins but as said, all <100k 😄
nice
how did you get so many downloads with, sorry, such a shitty plugin description + no icon? XD
my most is only 732 :(
Well
lifesteal is popular
Multiple vids on yt talk about my plugin as well
and how to install it
one of them has like 60k views
- Its a really popular gamemode
Also i had an icon, tho it was for curse version and its really shitty icon xD
I have now invaded your discord
:O
bruh
what xD
YOUR DISCORD ALSO DOESNT HAVE AN ICON
I KNOW
WHATS WRONG WITH YOU lol
I AM NOT GOOD AT ICONS
but for real, I suggest you to use iconfinder
it's about 2$ per image
thats cheap
I use it all the time for new plugins
but yeah for discord you'll want to get a custom made one
well uh
I can draw a stickman for you and send it as png lmao
the problem is idk what search terms to put xD
o no
why... is it unconcious
yeah that's whats mostly associated with unconcious
I always associate it with this song https://www.youtube.com/watch?v=2aeOBZ7gVPY
"TMBG wishes to make the case that not all of our songs have a single strict interpretation, but "Spiraling Shape" is generally about the fervent embrace and then abandonment of a cultural "bubble." It might be "smart" drugs, it might be virtual whatever, or it could simply be spin art. Steve Light adds his snazzy vibraphone to this swirling cut."
bg
How do I get PotionEffectType.valueOf ... it doesn't exist?
trying to turn a config string potion effect into a legit potion effect... not sure how
declaration: package: org.bukkit.potion, class: PotionEffectType
or getByName
Normally on an enum you get valueOf
it is not an enum
You know what
I should actually rebrand my disc
Because me and one of my friends have a group name we don't use much
and we are planning on making a plugin together
so yeahhh
I have a small question, is it possible to use apache poi on minecraft because I did some research, I found nothing ?
it's just a library, so a plugin could use it technically
A spigot plugin is just a java application. You can use all the libraries you want.
The problem is that when I build my plugins it gives me an error that it can't access the library class.
You need to shade it
Meaning copy it into your jar to create a so called uber jar.
Another way would be to use the plugin.yml to download the dependencies on runtime.
implementation group: 'org.apache.poi', name: 'poi', version: '5.2.0'
gradle?
yes
showing the error MIGHT be helpful
java.lang.NoClassDefFoundError: org/apache/poi/ss/usermodel/Workbook
poi poi poi poi poi poi poi poi
yeah you have to shade it
no idea how it works in gradle, in maven you just have to add the maven-shade-plugin and it magically works
Yeah maven is basically magic
If it’s available on central yeah
What is the initPathFinder function in Mojang mappings?
do you know the "obfuscated" name for it?
Not sure. Maybe
if it's on maven central
i feel like most if not all apache libs are lolz
I'd love spigot to be able to use libs from non-mavne-central repos
oh yeah I didnt check what lib you were talking about
repositories: [] when?
Where were you going with this?
?help
selfrole Add or remove a selfrole from yourself.
cleanup Base command for deleting messages.
embedset Commands for toggling embeds on or off.
info Shows info about CafeBabe.
licenseinfo Get info about Red's licenses.
mydata Commands which interact with the data CafeBabe has about...
set Commands for changing CafeBabe's settings.
uptime Shows CafeBabe's uptime.
findcog Find which cog a command comes from.
names Show previous names and nicknames of a member.
userinfo Show information about a member.
listcases List cases for the specified member.
reason Specify a reason for a modlog case.
permissions Command permission management tools.
trivia Start trivia session on the specified category.
cast it to Map<String,Integer>
thank you sir
np 🙂
mfnalex where did you go with if I knew the obfuscated method name?
because if you know the obfuscated name, you can just check the mappings file to find out the "real" name
e.g. just for example, imagine there's
Entity.x() and, in real names, Entity.getHealth(), you can just look in the mapping file and it will say x -> getHealth
How do I see the mappings file?
it's inside C:\Users<yourname>.m2\repository\org\spigotmc\minecraft-server\1.18.1-R0.1-SNAPSHOT
minecraft-server-1.18.1-R0.1-SNAPSHOT-maps-mojang.txt
bump
looks like this
what json lib?
I'm trying to put apache poi in the plugins.yml file but it doesn't work, is there a special way to put it?
are there any vanilla 1.8.8 server downloads?
because i dont think there are any on minecraft.net anymore
there are many pages that can help you finding remapped names translation
how do i check the world the command is issued in
@glossy venture u should be able to do it through the launcher no?
yeah
yeah
thats the client
theres ab utton that says server
I'm trying to put apache poi in the plugins.yml file but it doesn't work, is there a special way to put it?
idk tbh
is the getItemInHand from the BlockPlaceEvent a clone of the actual item or the real item?
Its the actual ItemStack
yes
libraries:
- org.apache.poi:poi:5.2.0
@clever solar try this?
anyone got an idea how to loop through json entries
^
Gson
yes but h o w
is it possible to change that item amount async?
No... explain
It didn't work
well in that JSON it's a JSONArray, so just for loop the array and get each json
CompletableFuture.runAsync(() -> item.setAmount(10))```
Why are you trying to modify it async
anything in the console when you try to run the server?
safe?
hoow tho
because i will do some codes while getting data from database
java.lang.NoClassDefFoundError: org/apache/poi/ss/usermodel/Workbook
ItemStack is not thread safe no
u cant interact with bukkit async
Something like
public void loop(String jsonStr) {
Gson gson = new GsonBuilder().disableHtmlEscaping().create();
JsonArray jsonAry = gson.fromJson(jsonStr, JsonArray.class);
for (JsonElement element : jsonAry) {
JsonObject jsonElement = element.getAsJsonObject();
String uid = jsonElement.get("uuid").getAsString();
}
}
Bring all the data back into the main thread before using it
but then how do i read it from a file. is the string supposed to be the file lines looped and added?
Yes
Show the file content
HashMap<String, String> map1 = new HashMap<>(200);
HashMap<String, String> map2 = new HashMap<>(200,0.75);
Can someone explain why specifying the load factor causes a error to appear at the <> of the second hashmap?
Doesn’t it have to be a float
Who writes a plain JsonArray into a file?
Anyways. Just read the complete file as a String and then let Gson parse it to a JsonArray
im assuming it would get parsed automatically considering that aint where the error is
Hover over the error and see what it says
^
load factor has to be a float
not the point
Yes
.7 isn't a float
.7f
there you go
y'all impossible
String content = new String(Files.readAllBytes(Paths.get(file.getAbsolutePath()));
u mean?
wait
why tf
it tells me that error when it aint float
why doesnt it tell me that its supposed to be float
Generics 
File jsonFile = ...;
String jsonStr = Files.readString(jsonFile.toPath());
no method like that
Then you are using an old java version
well yeh it is java 8
Why?
prob bc 1.12 was the last version that works well with one map and many players
Java 9 offers InputStream#readAllBytes and many more methods, such a lifesaver
Or was it J10? Probably J10 now that I think about it
is that useful for what I need though
You should use it
I will
Well it allows you to do something like
String s;
try (FileInputStream fis = new FileInputStream(new File("file.txt"))) {
s = new String(fis.readAllBytes(), StandardCharsets.UTF_8);
}
But you can also do Files.lines(path).collect(Collectors.toString("\n"))
that is not needed
u dont need an inputstream for that
u can do it with Files.readAllBytes()
That does the same thing
^
alr ty
is there a way to manipulate the growth rate of specific crops via events or whatever not the random tick speed
Why are people obsessed with code length?
eh im not
Any one can help with packet for spawning npc with second layer skin
The stream one is probably not faster tho
But a bit shorter if that’s what you’re after (:
well shorter looks cleaner :)
small performance boost wouldnt matter much compared to code being clean, am i wrong?
i might be
@AllArgsConstructor
public static class PlayerData {
private final UUID uuid;
private double balance;
private int blocks;
private int pumpkins;
}
public List<PlayerData> loadData(File jsonFile) throws IOException {
List<PlayerData> dataList = new ArrayList<>();
String jsonStr = Files.readString(jsonFile.toPath());
Gson gson = new GsonBuilder().disableHtmlEscaping().create();
JsonArray jsonAry = gson.fromJson(jsonStr, JsonArray.class);
for (JsonElement element : jsonAry) {
JsonObject jsonElement = element.getAsJsonObject();
String uid = jsonElement.get("uuid").getAsString();
double bal = jsonElement.get("balance").getAsDouble();
int blocks = jsonElement.get("blocks").getAsInt();
int pumpkn = jsonElement.get("pumpkins").getAsInt();
PlayerData data = new PlayerData(UUID.fromString(uid), bal, blocks, pumpkn);
dataList.add(data);
}
return dataList;
}
public List<PlayerData> loadDataButCool(File jsonFile) throws IOException {
String jsonStr = Files.readString(jsonFile.toPath());
return new GsonBuilder().disableHtmlEscaping().create().fromJson(jsonStr, new TypeToken<List<PlayerData>>(){}.getType());
}
woah thank you
You should prefer the second method. Let Gson do all the serialization work
ugh
Depends
(custom gson adapter eoukd be better tbh)
But generally speaking clean code is something you strive towards, however that does not imply succinct functions and less lines all the time 😅
Why?
All fields are serializable on default
No need for a custom adapter
Python has brainwashed us
Had an exam in Ruby today. Was a bit disgusted at my one liner that did half the task...
I mean, in a case where you manually reading gson like here
Eh, If you want to do it custom do not bother with gson and do the conversion manually via org.json:json
If he gets the data from a rest API then maybe. But if he also writes the data then less is more.
is it built-in in spigot or smth
Gson also provides a fancy commonly used json api
alr now i gotta learn how to set data to json file
i dont wanna annoy 7smile7 more so ill prob google this
Something something
public <T> void writeData(File file, T data) throws IOException {
Gson gson = new GsonBuilder().disableHtmlEscaping().setPrettyPrinting().create();
String json = gson.toJson(data);
Files.writeString(file.toPath(), json);
}
ugh why do I always get ghost pings in this channel lol
Should you just hold the Gson object statically somewhere
Or like, in your main class
wat
What?
This is what i do:
https://gist.github.com/Flo0/365b41696157e68d6553365cdf122bcd
i like to do it in that way
but how to use that 😂
When you spoon-feed and it's still not enough
Isn’t the builder mutable? In that case a little oopsie but nice
it might be spoon feeding but im not copy pasting it
List<PlayerData> dataList = ...;
File file = ...;
writeData(file, dataList);
oh that makes sense
Spoonfeed a newbie for a day and they'll come back with more questions. Teach them to find their own answers and you'll both be better off: you won't get stuck answering the easy questions and they'll be much more productive than before.
pog
Yes the builder is mutable but Gson is not. Thats the whole point 😄
Whats the oopsie?
i mean
that hopefully wont apply to me
if i feel like im annoying someone too much ill just google it
GB I think you mean to be in #help-server, as this is for plugin development
Oh, my bad
BTW, writing to files is expensive right?
Google your question before asking it:
https://www.google.com/
thx for the link ig
do I save data in a hashmap or something, then set it every 10 minutes or smth
or is that the same
as writing directly
you mean autosaving every 10 minutes instead of saving every time you change a value?
yes
that's generally faster
or more efficient
is there a better wya
way
and btw is it possible to write to files (normal java files) and interacting with gson in async?
there might be, but autosaving every so minutes to me seems like a good enough solution
Yes you can offload filesystem IO to threads other than the servers main thread
You can write async
definitely, and that might make it a bit faster since you are running it asynchronously
how do i cast offlinePlayer to player?
(Player) offlinePlayer
um no
OFFLINE player
Caused by: java.lang.ClassCastException: class org.bukkit.craftbukkit.v1_18_R1.CraftOfflinePlayer cannot be cast to class org.bukkit.entity.Player (org.bukkit.craftbukkit.v1_18_R1.CraftOfflinePlayer and org.bukkit.entity.Player are in unnamed module of loader java.net.URLClassLoader @2e5d6d97)
isnt there a method to do it
You cannot cast an offline player to an online player
like asPlayer or smth
getPlayer
But the player has to be online
you can cast offline players to players
offline player isnt an NMS class
you just have to make sure they're online
Bukkit.getPlayer(offlinePlayer.getUniqueId())?
they're using CraftOfflniePlayer
^
That’s the impl
oh right
OfflinePlayer is an interface
imma try this
is autosaving a file every 10minutes better than just writing directly (every 0,25 second) async?
prob yes
just making sure
i think there is not really another way
There is
autosaving every 10 minutes is good
You cannot have a Player instance if that player isn’t online
you can do that, but i don't think the performance will be impacted too much if you do it synchronously
Player is a subinterface of OfflinePlayer
you could cast an OfflinePlayer to Player
No
but first you have to check if they are online
i.e. if(offlinePlayer.isOnline())
Not if the instance of OfflinePlayer is not an instance or Player as well
.
it has worked for me
Yeah or just use sth like Server::getPlayer and null check that
im going with Fourteenth's idea
also
screw mojang's idea of naming stuff
PacketPlayInChat.a()
i'm pretty sure that's their way of keeping their code kinda secret
but not really
it's obfuscated
you can figure out what methods do and what classes are with enough effort
well its as easy as typing one string into cmd
but the fact that we have to do it in the first place
urgh
yeah
though it kinda makes sense
they don't want people to see their source code and steal it
offline player class
or that
the player instance is the same you'd get as if you grabbed a online player including PDC right?
pdc is permanent so i guess ye
?paste
https://paste.md-5.net/ezovipavop.bash So I am using the mojang mappings but is doesn't find the new class
That’s obfuscated
i too love naming my classes a and my methods a also
sigh
you understand World#setType literally just calls NMS, right?
public static void setBlockInNativeWorld(World world, int x, int y, int z, int blockId, byte data, boolean applyPhysics) {
net.minecraft.server.v1_14_R1.World nmsWorld = ((CraftWorld) world).getHandle();
BlockPosition bp = new BlockPosition(x, y, z);
IBlockData ibd = net.minecraft.server.v1_14_R1.Block.getByCombinedId(blockId + (data << 12));
nmsWorld.setTypeAndData(bp, ibd, applyPhysics ? 3 : 2);
}```
https://paste.md-5.net/ezovipavop.bash So I am using the mojang mappings but is doesn't find the new class
legit, this is EXACTLY what spigot does
isnt World#setType inefficient for more then just a few blocks since it always get the IBlockData or smth from the bukkit.-Material ?
#2 isn't even different from #1
net.minecraft.server.v1_14_R1.World nmsWorld = ((CraftWorld) world).getHandle();
net.minecraft.server.v1_14_R1.Chunk nmsChunk = nmsWorld.getChunkAt(x >> 4, z >> 4);
BlockPosition bp = new BlockPosition(x, y, z);
IBlockData ibd = net.minecraft.server.v1_14_R1.Block.getByCombinedId(blockId + (data << 12));
nmsChunk.setType(bp, ibd, applyPhysics);
}```
that thread is garbage
write directly into the region files and then re send the chunks ;:D
the whole thread is literally just unwrapping the code
i nearly summoned md_5 with talking about scoreboard with packets
I am lost a bit found some example but there are outdated
@weary geyser that method will fk your world
so where is the tile entity handling
or block cleanup
or physics
when the people are trying to optimize their code so hard they end up rewriting bukkit
nvm 💀
for example here watch method is missing on 1.17
DataWatcher watcher = npc.getDataWatcher();
watcher.watch(10, (byte) 127);
the data palette doesn't apply physics
its not missing... just renamed 🙂
if you can make a faster method that is actually correct, feel free to PR spigot to use it
but you wont, because there's no other correct method
and ligthing?
IBlockData ibd = net.minecraft.server.v1_14_R1.Block.getByCombinedId(blockId + (data << 12));
i feel like stuff from Material to IBlockData is the problem in time
you're leaving the world in an inconsistent and broken state
you maybe know to what
yet
1.17 ? what do you search there exactly ?
trying to spawn npc with second layer skin
found this on spigot forum
DataWatcher watcher = npc.getDataWatcher();
watcher.watch(10, (byte) 127);
PacketPlayOutEntityMetadata packet4 = new PacketPlayOutEntityMetadata(npc.getId(), watcher, true);
now trying to do that in mojange mappings
its outdated for 1.17
or not outdated ...
it has changed how the use DataWatcher
you will find in nms. Player/HumanEntity some DataWatcher registrys where exactly those "COSMETIC" stuff is applied
?paste
I mean I am grabing it from ServerPlayer that should be it ?
^^
F
Learning programming while making MC plugins is ❤️
Planning to do an JavaFX app that fires spigot events tomorrow
If you understand rhe basic things.. Thats gold.. A practice when you actually can do useful things and see the results of your efforts
me neither
I still have missing hair
i learnt java while making spigot plugins and i was lacking in my java knowledge for about 5 months
And that was 8 years ago
and i hate little to no programming experience
practicing is the key to success
it's wonderful how i managed to not get bored of not knowing anything
Pretty sure almost every second person here learnt java this way
its easy to not get bored when learning
its when you hit the point of knowing most things does boredom start to become an issue 😛
And laziness
but that is when you go from learning Java to learning the JVM 😉
Like yeah I know how to write it, but I don’t want to D:
I started with java a year ago and, just learning like 2h a week, 0 practice, and when i started on projects, i had no idea what to do. I started practicing like a month ago 2-3h daily, and got much better
And lack of inspiration
agree
nah learning other languages is a pretty good source of not being bored for me
i've learned like 7 other programming languages from pure boredom
Microsoft java
9 if you consider esoteric languages, 10 if you consider the tiny amount of C# i know
Java and C# are very similar
maybe i'll do my game in unity who knows
boredom is awesome :D
C# on steroids or Java on steroids?
But C# does have some nice extras
Erdi you should learn Haskell 🙂
C# is the walmart version of java
C# has LINQ
aight bet
I learned Turing
c# has inner methods
Category theory is just on another dimension
Anyone ever use Turing
Learning programming architecturing and design is also a very big and useful topic
oops reply
Context pls?
It’s a langugae
yay making my eyes bleed is fun :D
learn assembly better
And monoids
Mon what now
functional programming 😳
Monaco?
should we go to #general lol
Hits different (:
I mean you have probably already used a monad
Never heard of that language to be honest
prototype-based programming is pretty cool
source: javascript
javascript is garbage. Thats not even controversial.
Real programmer? not unless you know https://en.wikipedia.org/wiki/Brainfuck
AYYY FELLOW BRAINFUCKER
guys no offense
Now write a java brainfuck compiler
i love javascript
Brainscript
You can literally edit everything after you did anything in javascript. There is nothing that can stop you...
@spiral light it works like charm
yes
TS = better
very pog if i do say so myself
it's literally just javascript with types
waaay better
well yes
static typing ftw
strongly typed langs = waay better IMO
Which makes the language bearable
js doc comment things exist though
i.e.
/**
* @typedef {{name?: string, id?: number}} Options
*/
/** @type {Options} */
const options = {name: "", id: 0};```
should learn Malbolge
and also "use strict" for safer programming
Brainfuck is amazing
++++++++[>++++[>++>+++>+++>+<<<<-]>+>+>->>+[<]<-]>>.>---.+++++++..+++.>>.<-.<.+++.------.--------.>>+.>++.
``` look at this amazing code
yes
Wouldnt call it amazing. Hello world was fun to write/understand but after that its just cumbersome.
Lol
<>[]-+., language best language
vs print(“Hello world”)
Which would you choose
i wrote a brainfuck interpreter in javascript once
well i copied it off of google but same diff
download 500GB of js libs to left pad a string with whitespaces
Heh
npm i *
npm install
More fun to make your own grammar too
Not just use an existing one
Does this do what I think it does
Thank god
Honestly I kinda like using node because it’s easy
Even if it’s you know
me when node js and browser js are almost entirely different languages
Node
node is pog for making scripts without using python
cuz fuck python
i'd much rather write javascript than python
They taught us PHP first, and using crap like xampp was annoying
And then node is just like “yes”
is it possible to de-crit an attack
xampp is just a software to make it easier to install/run web server things
xampp annoying?
I think you’d have to manually reduce the damage
I hate javascript unless its for front end web design
would that stop the particles
nah i use it for back-end stuff
might be both lol
it's pretty easy
Well, compared to node
js is badly designed
I am sure it is, but also easy to introduce vulnerabilities you would be unaware about
JSX?
vanillajs >
I hate front end
+1
front-end is easy
making it look good is the hard part
making it look good is the easiest part
but
centering a div is the hardest part
:pepe:
💀
can github copilot center a div?
fuck github copilot
Pacific daylight time?
persistent data container or smth
You mean a pdc entry on the item
if GPT codex doesn't fuck programmers then eat my words
Anyone have a example of a block populator in 1.18?
Hi
I'm trying to cancel my InventoryClickEvent so if a Player clicks an item he can't take it. But for some reason it's not working with event.setCancelled(true);. Has anyone an idea if I can do something else or why it's not cancelling my event?
is it registered :kekw:
yes
I checked it multiple times and I know exactly that the problem is in that line
can you show all your code
yep
@EventHandler
public void onHeadTake(InventoryClickEvent e) {
if(e.getWhoClicked() instanceof Player) {
e.getWhoClicked().sendMessage("hi");
if(e.getCurrentItem().hasItemMeta()) {
e.getWhoClicked().sendMessage("hi2");
if(e.getCurrentItem().getItemMeta().getDisplayName().equals("§7Head")) {
e.getWhoClicked().sendMessage("hi3");
e.setCancelled(true);
}
}
}
}
it's sending all of the 3 hi messages
but it's not cancelling the event
try and change the event priority
there could be another listener that is setting it to false
still not working
oh
I found out what was wrong
it was a bug
the items were ghost items
I just didn't realise that because I had a scheduler that was removing the items from my inventory and I thought they disappeared because of the scheduler
whatever
thank you!
I have another problem. Well my cursor bugs. If I set the cursor item to something it's only happening when I close the inventory and open it again, same with the removage of coursor items and I can take items when I'm cancelling the InventoryClickEvent, I just can't drop the items or put them somewhere. I'm using paper 1.18.1. Has anyone an idea?
but I want it to change while I'm in the inventory. Without closing and opening it
Are you using the non deprecated method
How do i remove invis armour stand ( hologram ) from my world lol.
Nevermind
fixed
it was real
Hey guys!
I'm pretty new to MC plugin development and I'm trying to update a plugin that I made a year ago, I have an issue with runTask(), as for whatever reason the task doesn't run instantly and it lags the server down, I've done some console logs aswell to find the issue.
Bukkit.getLogger().info("started course....1");
Bukkit.getScheduler().runTask(plugin, new Runnable() {
@Override
public void run() {
Bukkit.getLogger().info("started course....2");``` that's my code
and the second logger only gets executed after roughly 4 seconds
what has changed since 1.16.4 and 1.18.1?
could you show the part where it says .runTaskLater or .runTaskTimer etc
i don't use runTaskLater or .runTaskTimer
show me where the runTask(plugin, new Runnable() { block finishes (not the end of the runnable, the end of runTask)
https://www.spigotmc.org/resources/ghost-player.231/ this is a plugin from 2013 but it might help
you can decompile it to see how it works but its probably broken now, being so old.
currently dealing with this weird error. Maven thinks WorldName doesn't implement the parse method from ConditionHandler, but it does 🤷♂️. Note: these are in two different modules.
I don't see how any of this is delayed
4 seconds did you say?
around
between stage 1 and 3?
and i get server logs that server overloaded
probably time to bin the plugin then 😦 if it's no longer updated
first stage log fine, second log around 4-5 seconds
3rd straight after 2nd
well, it's my own plugin that i consumed a ton of effort into a year ago ;p
and it doesn't seem to like 1.18.1
https://hatebin.com/torqeesyqs This class is ran when a player dies, after it gets triggered the server starts lagging a lot and the corpse is not doing what its supposed to. In my code I'm setting it to have the same overlay the player had, I'm setting it to be in sleeping position and also to have its name tag hidden. Instead it just shows the same display name as the player and stands without the overlay
no sadly that's the team method
but ty
@vague swallow haven't tried and don't know, but what about the spectator mode?
probably worth a re-write then, if you have the time
noo they are not transparent sadly, but ty
give them invisibility potion ;p
still not transparent 😦 just invisible
whats wrong with the teams way
xamyr its probably worth making a post on the forums
yes
Then everyone has to be in the same team but I want to use teams for something else. I don't want everyone to be in the same team
Then use nms packets
How can I do that?
Ty!
uuuuuuugh, why is this happening......
are you using this in your onEnable?
nope
so you're sure the server is fully started up when you attempt to run this task?
100%
thats very odd then
[00:39:43] [Craft Scheduler Thread - 1/INFO]: started course....
[00:39:43] [Craft Scheduler Thread - 1/INFO]: started course....1
[00:39:47] [Server thread/INFO]: started course....2
[00:39:47] [Server thread/INFO]: started course....3```
server might just be lagging?
well, the cause of that lag is when i trigger this runTask
well the first print gets print when the server already sais its lagging
so it must be something before
This dosent cause lag. How does the rest of the code look like?
yes please
This looks like it should be split into at least 4 methods
was about to say that xD
case "[start]":
plugin.completedCourseTracker.remove(player);
plugin.playerCheckpoints.remove(player);
Bukkit.getScheduler().runTaskAsynchronously(plugin, new ParkourStartTask(sign, player, plugin, now));
break;```
ah yes i know ;p made this plugin a year ago
trying to refractor it completely
you might benefit from making it more readable first
but want to get it working at least just as it was a year ago
The PlayerMoveEvent is a really expensive event. You need to be REALLY careful when using it.
I know that, but, unfortunately the playerMoveEvent is not the cause of it
} catch (IndexOutOfBoundsException | NumberFormatException ignored) {
}
just hiding the exception ^^
shhhh, no one sees it ;p
Sry but this is unmaintainable. Not gonna read that
whats it even supposed to do
its a parkour plugin
how can i turn Particle.DustOptions dust = new Particle.DustOptions( Color.fromRGB(255, 16, 6), 1); into a particle variable
no, just tracks player that enters a course when they are above a sign that has [start]
alright, well as 7smile7 said, this is very difficult to read and figure out what could be going wrong i think ur truly best off remaking it on better standards
surely i probably gave all of the effort (roughly 30% haha) to the plugin a year ago cause of being lazy to make methods
yea, in my starter years I did this as well, the result being me not understanding my own code after 2 weeks of not looking at it.
yup, been there many times ;p
and a huge ass if statement ;p
that you have to scroll a mile to the right
well if you want to stop being there, make methods, classes if necessary, and also an important one is to comment alot
hmmm, guys? i just fixed the issue I think ;p
it was something to do with my database actually
gradle moment
Maven user
i know gradle is shit but the error messages 😍
smh we have gradle haters in the house
nobody beats rust error messages tho
imma make a programming language in rust
screw it
its literally called crust
crusty
Nice
you're looking a bit crusty today
transpile rust to C++
Should I make my protection plugin chunk based or block/region based
if(((Ageable) target).isAdult() && ((Ageable) stackee).isAdult()) {
return false;
}
Shouldn't this return false if the target is an adult and the stackee is a baby or vice versa?
(yes I already checked if they were an instanceof Ageable)
forgot !
You can be fancy and use ^ instead of && there ;p
Probably less readable though
Actually, yeah, if you want vice-versa, ^ is the correct operator there
Performs a boolean XOR which evaluates to true if the two values are not equivalent (e.g. true/true = false, false/false = false, true/false = true, false/true = true)
I have it in my code I just forgot to put it in there on discord xD
This is probably what I am looking for
Thanks
I have a question relating to writing custom plugins for a server, what would be the best way to structure the plugin(s)? All the code and features in one plugin, commands in one plugin and features in another plugin (etc)
Separating them will make things a bit easier to maintain
Just have different singular plugins for each feature
But it’s up to you
Alright, thank you
Not actually what I wanted
xD
if(target instanceof Ageable && stackee instanceof Ageable) {
if(((Ageable) target).isAdult() && !((Ageable) stackee).isAdult()) {
return false;
}
}
This code should only return false if the target entity is an adult and the stackee is not an adult
although it seems to be returning false if they are both adults
Which doesn't make sense
Ah, okay, misunderstood the original question then
That code looks like it would work fine. I guess just make sure you've stopped your server and exported the correct code
Most likely. That snippet there looks fine
Ah ended up being that my snippet was incorrect xD
Shoulve been
if(entity instanceof Ageable && nearby instanceof Ageable) {
if(!((Ageable) entity).isAdult() && ((Ageable) nearby).isAdult()) {
continue;
}
if(((Ageable) entity).isAdult() && !((Ageable) nearby).isAdult()) {
continue;
}
}
(I switched it to a for loop inside the event instead of my stack method)
Yeah, you could merge those and use ^ like I mentioned above then,
if (entity.isAdult() ^ nearby.isAdult()) {
continue;
}```
Should accomplish the same as both those if statements

Also, if you're using Java 16,
if (entity instanceof Ageable entityAgeable && nearby instanceof Ageable nearbyAgeable) {
if (entityAgeable.isAdult() ^ nearbyAgeable.isAdult()) {
continue;
}
}```
And you could && those statements together, but that's up to you
Lots of fun features
I'm on 15
I don't remember if it was added in 16 or 15
fr
Can I load classes into runtime with my class loader into runtime and use them in my bukkit plugin?
Sure. You'd be better off creating a new class loader though and making it a child of your plugin's class loader
How can I make it a child of plugin class loader?
it was added on 14
URLClassLoader's super constructor accepts a parent
Yeah I'd figured it was either 15 or 14. I just can't keep track anymore lol. I knew it was some time after 11
Here is a video of my issue: https://gyazo.com/444c2165af251e5d4eeb9f70ca5bb0aa
My problem is that while normally the stacking of spawners works perfectly fine, whenever I place them on a passable block like in the video they bug out and instantly say that there is 2 of the spawner there, and cancel the event. Here is my event code:
Code (Text):
@EventHandler
public void onBlockPlace(BlockPlaceEvent event) throws IOException {
BlockState against = event.getBlockAgainst().getState();
BlockState block = event.getBlock().getState();
if (against instanceof CreatureSpawner && block instanceof CreatureSpawner) {
CreatureSpawner blockSpawner = (CreatureSpawner) block;
CreatureSpawner againstSpawner = (CreatureSpawner) against;
if(againstSpawner.getSpawnedType() == blockSpawner.getSpawnedType()) {
event.setCancelled(true);
Inventory inv = event.getPlayer().getInventory();
ItemStack mainHandItemStack = ((PlayerInventory) inv).getItemInMainHand();
mainHandItemStack.setAmount(mainHandItemStack.getAmount() - 1);
againstSpawner.setMaxSpawnDelay(againstSpawner.getMaxSpawnDelay() / 2);
againstSpawner.setMinSpawnDelay(againstSpawner.getMinSpawnDelay() / 2);
manager.add(against.getLocation(), event.getPlayer());
}
}
}
I think this stems from Spigot thinking the placed block is the same as the block against it
which isn't true
its because the event is cancelled
No I figured it out
The cancelled part is intended
I just checked if the location of the block and the against were the same and it fixed all the problems
although I got a new question
is there an event to track a projectile moving, like an arrow for example?
Projectile events exist ig
I am trying to add a particle trail to an arrow
Is it possible to use java records but downpile to be able to run on java 12
or something like that
Ehm, probably not
Though if you want something similar to records but still want to compile against 8, you can use Lombok's @Data annotation I suppose
Generates a getter/setter for each field in your class
Generally not a fan of Lombok but I guess if you're just using one annotation it's probably fine lol
Hello, Does anyone knows how can I resolve this problem working with NMS?
Btw the 'cannot find symbols' are about NMS pathfinder goals, so are NMS problem too
Version: NMS 1.18 Mojang remapped
On the imports all are okay, the problem is when I compile it
do you use maven and have the remapp plugin also active in pom ?
i think they are named different
Yes, is this ok?
Bootstrap Jar
The main spigot-1.18.jar is now a bootstrap jar which contains all libraries. You cannot directly depend on this jar. You should depend on Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar, or the entire contents of the bundler directory from your server, or use a dependency manager such as Maven or Gradle to handle this automatically.
Please read the release notes for further information: https://www.spigotmc.org/threads/9-years-of-spigotmc-spigot-bungeecord-1-18-1-18-1-release.534760/#post-4305163
^yeah there the example maven config
your probably not using the plugin of md5 to remapp the mappings
this is correct, but you must have installed it via buildtools
yes, I have it
looks like your maven cache has a problem somewhere i guess
refresh/restart your ide
thanks, I'll check
That is a good idea, I'll do it
The error is nothing about SpecialSource
does this error occur only from the import or do you use it in a weird way ?
Also note that certain classes are named differently in the remapped jar
Nope, the imports are fine, but when I compile the project (to get the plugin.jar) the IDE send me that errors
the names are ok
For example, here I dont have errors
But when I compile, I get this
pressing that button (I do that when I compile in Gradle)
you can try this
yeah.... dont know rly but gradle is not maven ?
he is using maven currently
so runnign gradle config will not work since it not uses pom ? or maybe something like that
And how can I do that? Is this with CMD on the same directory where pom.xl is?
It's my first time compiling in maven btw
do you have a build.gradle file? btw you ain't supposed to, if you do
but yes
run in the same directory as the pom
Nope, I just have this files on the directory
Ok! I'll do it
Ok the console send a lot of code lines saying me this:
But I'm not secure about how can I change it
change compiler target and source to at least 1.8
Oh
wait this is for which class
org.apache.maven.plugins in do you set Java 7? 😅
for 1.18.1 ^you can use java 16 or not ?
you can use java 8 for compiling 1.18.1 plugins too
For 1.18.1 Java 17
On a lot of classes :( https://paste.md-5.net/
you forgot to save
Just change the target and source to 17
ops, I did again, but same errors
ook
Fatal error compiling: error: invalid target release: 17 -> [Help 1]
1.8-1.12.2 Java 8
1.13-1.16.5 Java 11
1.17-1.17.1 Java 16 (but 17 should work)
1.18+ Java 17
No always 😅
ok try removing the the compiler plugin configuration, and add these lines to the properties:
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
</properties>
Sometimes programmers don't like older versions (example worldGuard and worldEdit)
That's their problem, but they could always use older versions
but yea, java 17 is great
just that if you use compile it using java 17 then you probably cant use that plugin for 1.17 or earlier
I don't like Java 9+ (reflections ;/)
you ran the command in the wrong directory
what u usin reflections for
oh wait
all in all, it's for everything xD
i think maven doesn't have 17 compiler kek
I joking
wat
i compile towards java 17 with maven
But I can't understand this:
class file has wrong version 60.0, should be 55.0 Please remove or make sure it appears in the correct subdirectory of the classpath.
Is the pom asking me a older version of NMS?
But Java 8 support load libs in runtime
So does newer java
if spigot can load a plugin surely u can load a library
Do you say to change it on the pom?
Change your jdk
ook
hmm, then maybe my jdk is outdated
but it shouldn't? hm
Java 17 supports this as well
but it's more difficult and annoying
Maybe check your folder with repositories and see on spigot
But I think this should work hmm
Not really
Send me source oke?
Solved!
Changing source and targe to 17 (Thanks @hardy swan ) and changing the SDK to 17 on InteliJ (Thanks @chrome beacon )
And thanks all for helping me ❤️
Nice
I've been sitting with a Nullpointer Exception for a while now and I can't seem to fix it.
I don't understand why it's there.
The header or the footer can both or one of them be null.
I'm using "whatToUpdate" for that
Code:
private void update(StringBuilder header, StringBuilder footer, int whatToUpdate) {
// 3 = both
// 2 = header
// 1 = footer
// 0 = none
if(whatToUpdate == 1) {
TabAPI.getInstance().getHeaderFooterManager().setFooter(owner, footer.toString());
} else if (whatToUpdate == 2) {
TabAPI.getInstance().getHeaderFooterManager().setFooter(owner, header.toString());
} else if(whatToUpdate == 3) {
TabAPI.getInstance().getHeaderFooterManager().setHeaderAndFooter(owner, header.toString(), footer.toString());
}
}
I've also been debugging and I just see that "whatToUpdate" is then 1 so it should be correct.
guys i need help
import org.bukkit.Material;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockPlaceEvent;
public class HelloWorld implements Listener {
@EventHandler
public void onBlockPlace(BlockPlaceEvent event) {
Material type = event.getBlock().getType();
if (type == Material.TORCH) {
Player player = event.getPlayer();
player.sendMessage("Hello World");
}
}
}
this is my code
Player is highlighted in red
What's wrong?
it says player is wrong
Import it
cannot resolve symbol player
import player
How?
You should learn java first but ok, with you're ide you can probably click on "Import Class" or something like that
Learn basic java pls
import org.bukkit.entity.Player;
Well
Welp
Not enough then if you don't know how to import something
?learnjava
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
I even need some devs to help me make my mc server
You don't have to ask that question if u know java
Don't tell me ur finding one for free
Ofc no i have 5000$ budget
I'm making my own mc server
Great
how would it be paid
The forums has a great recruitment section
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
By using the inventory click event
event.getCurrentItem().getItemMeta().getDisplayName().equalsIgnoreCase(ColorUtil.color("&4aa" + player.getName())) I highly recommend using the PDC instead of name checking
Wait where is the inventory set?
Where is it set because why don't you just get the inventory clicked and clear that slot
Again, where do you set the inventory variable
Why not just event.getClickedInventory()
how could i add custom armor model to custom item in my plugin?
I know that i can use customModelData but it's only changing item texture i want to change model texture.
Resourcepack
how could i do this?
New Json file for the model
can you show an example code? If you have.
You can't sadly
Even with optifine
Armor models are hardcoded
thanks
Why would you set it the inventory in the constructor? Is it a static inventory everyone can access?
So I assume the issue here is probably when you open an inventory it opens a copy of it not the inventory you're clearing the slot of. So you'd need to clear both the slot in the players opened inventory and the slot in the global inventory
this
I have a small question, can someone tell me how I can put apache poi as a dependency on my plugins.yml file. I have tried this way, but it doesn't work:
- org.apache.poi:poi:5.2.0
Because without this library my plugins doesn't work and causes bugs, like :
java.lang.NoClassDefFoundError: org/apache/poi/ss/usermodel/Workbook
the particles arent directly on the crosshair
i remember there was a fix for this but i forgot what it was
@clever solar you need to shade it to your plugin
Look how to compile lib and shade with maven
nvm i fixed it cuz im a fucking legend
Forget what I said you are trying to use getLibraries()
I'm on gradle, I put the library in
implementation group: 'org.apache.poi', name: 'poi', version: '5.2.0'
but it keeps giving me the error
@clever solar probably u need to shade it in your plugin
Compile it with your jar of plugin if lib is not in central maven repository it wont work by adding it to plugin.yml
it has a maven repository, but even adding it to my plugins.yml doesn't work, unless I'm doing it wrong:
libraries:
- org.apache.poi:poi:5.2.0
@clever solar i never use it with plugin.yml
Just compile it in your plugin jar and shade it like I said up
That should work
Will you have a doc, so I don't do anything wrong?
So many versions