#help-development
1 messages · Page 1895 of 1
I don't have a dependency section, where would that be?
Show me your POM
Allright so you want to check the potion type?
<modelVersion>4.0.0</modelVersion>
<groupId>HTTPPost</groupId>
<artifactId>HTTPPost</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>HTTPPost</name>
<build>
<sourceDirectory>src</sourceDirectory>
<resources>
<resource>
<directory>src</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
Yep
This looks like a fun read! Thanks 😉
@EventHandler
private void onDamage(EntityDamageEvent event) {
if (event.getEntity() instanceof Player player && player.getGameMode() == GameMode.ADVENTURE) {
if (event.getCause() == EntityDamageEvent.DamageCause.VOID && player.getWorld() == Bukkit.getWorld("pacman")) player.teleport(new Location(Bukkit.getWorld("pacman"), -254.5, 77.5, 770.5, 180, 0));
event.setCancelled(true);
player.setHealth(20);
}
}``` does anyone know why when i get teleported back up from the void, it infinitely loops?
As in it infinitely teleports the player to the same location?
yes
until i disable the plugin ofc
actually i think it's because when the player takes damage from a teleportation, it's considered "void damage"
i'll just add a check for if the player is below y=0
don't use Y=0
use World.getMinHeight()
(1.18 etc)
oh right
I mean it shouldn't be happening because VOID damage is only from falling into the void
Can't reproduce it
Any damage they take would be fall from a height or from suffocation
As always if you use the logger that would tell you whats actually happening
yeah im still experiencing the problem
[01:24:58 INFO]: [VipPerks] [STDOUT] Restarted
Do anyone know why my plugin logs like that
What are you using to log?
you're using system out println
Bukkit.getLogger().log(new LogRecord(Level.<log type>, "message"));
use this
Or just use the easier methods like; severe info or debug
^
Wow there. If it's not static is it really usable?

Cannot find 'include' in class org.apache.maven.plugins.shade.mojo.ArtifactSet
https://hatebin.com/reoaktpfkt why is it saying this when I try to compile this pom
"main" in this obviously is a reference to the main class' instance :3
That doesn't sound static 
I spent 2 hours making all my class not static no cap
Much better
<includes><include> iirc, read the docs
though you really dont need it at all iuf your depends are scoped correctly
it should look like this
Ah thank you
it's needed when using minimizeJar, because mostly that NMS stuff is only accessed by reflection
It doesn't compile the nms implementation classes, probably because they are unused
so maven would just ignore all the NMS packages when they are not included
Is the server crashing or something lmfao. I tried your code and I get teleported and that's that
try without other plugins
tps is also great
it's the plugin
when i disable it, i get unstuck
I copy pasted your code and jumped in the void and it worked just fine
^
Bro.....why does my multi module project compile like this? when i went to the m2 repository and checked one of the modules, instead of the directory being me.name.plugin it showed just the META-INF folder so when i try to import the seperate module it just doesn't work. Furthermore, in the META-INF/maven folder, it shows a folder to every module with the pom file for each instead of actually compiling it
Defined a method:
public static void log(String level, String message){
Bukkit.getLogger().log(new LogRecord(Level.parse(level.toUpperCase()), message));
}
and used
log("warning", "Restarted")
and it logged
[01:34:42 WARN]: [null] Restarted.
ok
why there is [null]?
you didnt define the author of the log
How can I define it
uh
who knows :)
i dont use logger that much and haven't needed it to say the plugin name
goodness, just use Plugin#getLogger like a normal person
I heard log4j is really good and has never had any issues 
For serializing/unserializaing a java class to a string i can use serializable from java api right?
almost always a bad idea
tf you doing with serializing classes in spigot
Serializable is toxic also
System.out.println >>> 🥵
even better
md5 the situation is the next im doing a way for seding/receibing class object from Redis but it only allow strings
That hy
sout("[PluginName] " + message)
xd
I tried
plugin.getLogger().log(new LogRecord(Level.parse(level.toUpperCase()), message));
but nothing changed
json would be the usual way to do it
Yeah it's not the code you sent causing the problem
Someone recommend its really ugly
dont make a new logrecord, use one of the normal methods
"nag author(s) for using System.out.println() instead of logging!"
you should
Thanks
so what then
You tell me
You can see the code running in the background
The situation is the next, im doing a way for seding/receibing class object from Redis but it only allow strings
Any ideas?
Im against using Json its too ugly
serialized classes arent strings
json is sexy
theyre bytes
Why on earth are you storing entire classes anyhow. JSON would technically be your best bet for that anyways
Allright but what do you recommend i need a way for send/receive object classes as string
GSON
j
s
o
n
Can i serialize/deserialize class object to string?
uson
yes
thats the whole point
is there a performance difference between 1 global async task and 10 others?
It would be much more efficient to just transport the data and making a class with it in the code
better than sending over the serialized class 😐
Y.E.S
The answer, as usual with threading, is always “it depends”
Is it more efficient to run 10 tasks sometimes than 1 task constantly? the answer is always yes 10 > 1
1x10 < 1x∞
I assume it's a good old "is it better to queue a timer or store the time and check it every x seconds" question
guys which one's faster
But it doesnt do it automatically. Like i need to add the values manually via code. It doesnt have method like:
ClassObject sended = Gson.toJson(classname);
ClassObject received = Gson.fromJson(string);
I need something that simplier
That’s what GSON does
its not very complicated
Just use mongo with POJO lmfao
But you need a FileWriter
you just need to know the type when deserialising
only if you want to write it to a file 😐
Lol
toJson() just returns a string
which you can use in any way you want
Right
you dont have to put it in a file lol
Hash it and then send it to Bitcoin miners to crack
its org.gson right?
does cracking hashes generate new "currency" nowadays
?
i dont get why people are so optimistic about crypto these days
I'm watching Jack Glak's video for Minecraft Modding with SpigotMC
nicee
mod ≠ spigot
I love maven
Mod /= plugin
its not maven's fault
1- Its client side
2- Server side
did you add the repo?
My man tripped over his own config and died
serverside mods would like to know your location
you gotta add gson to your project structure
what are you supposed to import in your class
like public class Main extends JavaPlugin
and above you have to import something
This is a learn java moment
im idiot i write gson-parent instead of gson
?lear-
Yeah @calm linden you can't do spigot until you learn at least intermediate java
?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.
oop
Object Oriented Programming
lol
This right?
yes
Oh allright
plugins are technically server mods
and mods can be server side too
for example, i believe hermitcraft servers are fabric but vanilla clients can still join
not really
yes really
plugins are limited to what a vanillla client will accept
mods are limited to what a client with the same mod will accept
Yeah definately it has less functionality but still considered server side mod
A modification is a change to something base. You're adding not modifying
i have a friend which has a good explanation, but she left the discord 🥴
Its difficult to right a simply method for serialize/unserialize a class to json string without using an external library. Like its completly unnecessary for me using Gson only for 2 methods
where is the line between add and change 🤔
Then do it yourself
you could argue cancelling an even is modifying
I'd argue that mod is like a general category, and plugins would be a subcategory
Of course. But you haven't changed anything of the base code. You're just canceling an event passed by an API.
i mean paypal considers plugins modifications too
this is turning into philosophy debating
true
No u
👀
I cannot concentrate seeing you on my second screen ague. Hahaha
:pogchamp:
🍿
? learnjava
Epic learn java moment
plugins > mods cuz forge discord is more toxic than here 😐
Forge discord has lex in it
Man is super toxic sometimes
lex has been known to have a toxic history
to be fair he's at least honest about it
why spigotforge no exist 😢
It does look up magma
you are mixing 2 opposing concepts and communities
and mindsets
i mean spongeforge is a thing but I like spigot 1000000000000000000x more than sponge
you can use mixins in plugins lol?
Is there any way the guardians can attack faster?
I imagine you could emulate it firing or figure out if it has an attribute for fire rate
Wait with Java reflections you can get all fields names from class and their values?
I know that fields names its possible
You can get everything but the kitchen sink
If the class is unloaded you can even modify it at runtime. I'd share code here but md_5 would ban me for causing him blindness
I have an idea for doing my simple serializer
Nope, it doesn't. That's why I asked. I didn't find anything on the forums :c
Maybe NMS make your own machine gun Guardian
I can loop trought the class fields and their values, then append it like: "{" + fieldName + ":" + fieldValue + "}"
I think it can work
I will try
Yes except gson was made by google and actually works
gson is good but i also like other json libs
Im not against using Gson for serialize/unserialize class but it has many thinks
Like it really unnecessary a complete library just for using 2 methods
gson is slow tho but pretty extensive
okay, i am back for assistance. i have watched many of kody simpsons java course videos and i think i can understand a little better now
i want to make a command /opmobs on | off
when using this command, i want it to disable the spawning of mobs with over powered armor when it is on, and normal spawns when it is off
could someone assist me? i am quite new but i know basic java i believe
What do you recommend for me? I need something with only methoda allowing me to serialize/desarialize object to json and them json to object (class)
no just use gson
if you are a beginner, just use gson
honestly no point of using other json libs unless you have a good reason to
I remember when "Don't use GSON, use JSONSimple" was a beginner tip
XD
But yeah. Until you have a compelling reason not to use GSON, use GSON
what do i paste to use maven-shade-plugin
and how do i configure it to shade specific jars
are you using maven or gradle?
if maven
change the scope of gson to compile
maven
But then how i will use it if set to compile?
the buildtools already add the gson to the local repo so you shouldn't need to import the dependency
Cuz i will get NPE when the plugin runs
run buildtools
but
if you are the lates version
change the scope to provided
and add the dependency at plugin.yml
I have builted Spigot 1.8x
are you using spigot-api or spigot?
Spigot-API
how do you get the value of a persistent data container after you assign a value
Gson has a lot of bugs
ty
Cant use it on records :(
can you elaborate on the exact syntax, for example if i was to send a message telling the player that data?
bro what is Gson? I have only heard of JSON?
@young knoll
json lib made by google
qwcsfe
yea I just looked it up... didnt know it existed lol
Send your persistant storage
Like if using a map send it values, etc
What that its used for?
Isnt it used for items?
I never heard about it. Its only on 1.16+?
Items, Entities, Tile Entities, and Chunks
is there any event that fires when I rightclick a seapickle thats already placed with a seapickle in my hand and it increases the sea pickle count?
PlayerInteractEvent should be fired
?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.
Did you send that for me or...?
Oh
Ah no problem, I thought you were sending it as a reply on my message
lol
How can i reduce that code?
why do you need to?
Serializing object to string
thats not a reason
Does it work? Is there a problem with it? What do you mean by reduce?
by reduce i mean to do it in 1 line something like this:
Personally I wouldent
Wy?
Just because you can doesn't mean you should
But please i want to reduce it
No you really don't
Theres no reason to
Its shorter the code

You are also doing two things in that method, so you really cant do it in one line without having no readability
Shorter code =/= better code
We are helping
Allright thanks
by telling you that shortening it isn't going to make things any better
I know
1 line statements can be a bitch and a half to debug
But my eyes fritghen
then break that habit
Worst thing you can do is force everything on 1 line
Ive worked with a dev that did that, literally put huge enums all on one line
Hated working with it
Horrible to debug, horrible to do everything
What happen with readeablity?
Im only going to read it
Hums
But its okay no matter
With pacient i will find the way
lets put it this way, I should be able to glance at your code and understand it
Readability has nothing to do with lines and you probably want to make your code readable for yourself as well, especially when the code base grows xd
Or any dev for that matter
So you agree to it 1 line?
Bruh, I just said the converse
Opposite
to be honest it was a bit confusing how you said it Conclure
It does not matter
You do not want all your code on one line lmao
for very simple things, sure it could be on one line as its readable
What happens a year from now when you have to go back and understand what you did
But that line would not be readable
Well, truth is, one liners can be readable, but they can be arguably be as confusing as readable from time to time
Depends on how long of a line it is
You'll need at least 2 lines for it and 4 is fine anyways
Not like line count matters in any way
But its my way of coding
In my multi module nms project, none of the classes are actually used, and I assume thats why none of them are getting compiled, when I try to decompile the jars, it just shows the META-INF and there's no actual classes in it, I've tried putting includes:
<configuration>
<artifactSet>
<includes>
<include>me.rishabhvenu.aseplugin.nms.*</include>
</includes>
</artifactSet>
</configuration>``` but it doesn't seem to work
The extra byte you’re saving doesn’t matter much
Just let it be
You’ll get used to it
Imagine with C# i dont have methods no more 1 line if they are not necessary
Verano first I’d very much recommend using explanatory variables more, and then extract more functions
And in the long run it will benefit you
Your code should basically explain itself to anyone who reads it
Just by looking at the method someone should understand roughly what you’re doing and why you’re doing it
No if it private code who will read it?
I think you only in your way and you are not being open
well it’s not private code
You will read it
You’re continuously sharing it with us
Later you and current you are essentially two different people
Yeah i read this: And i completly understand
it's been 10+ minutes of this arguing btw
Verano thing is wide lines, long functions are rude and impolite to the reader moreover as said the fact that you’re claiming you’re the sole person who reads and touches the code is objectively incorrect.
Omg
(=
🥲
There’s a decent chance you could take a break for a week or two and come back and in that short time have no clue what you were doing
Allright thanks
Context escapes very quickly
bro
Recommendation for my lib?
that whole line is yellow
What more can i add?
please
Idk why
...
I try to remove that color but intellij doesnt not allow me
lmao?
It’s telling you not to do that
I think its a config problem
Lmao
XD
That’s the IDE suggesting you split that line up I’m pretty sure
nah intellij doesnt do that
its something else
but you should still split line
Its saying "Unchecked cast to T"
Well there’s no way to tell what the issue is with it all on one line
Yeah that’ll do it
I dont know why it say? If code works perfectly
But i will listen you
And change to multi lines that code
i dont know what the context here, but as long as you know that whatever type you will be casting to isnt going to give you a cast exception, you should be fine
Well that 1 line still makes it obvious you’re casting readObject() : ()-> Object to T
And this is just generics in a nutshell
Nothing you can do about except maybe pass a type validator
type validator?
instanceof or smthing?
Basically you pass a Class<T> and then use
Class::isInstance and ::cast
That my Packet
since T gets erased, using instanceof would basically be an instanceof Object check which is like redundant
type erasure 😮💨
This conclure
oh
Now better??
oh lord supress warnings
its probably you leave the warning there
Yeat cuz it whas underlying with yellow and fuck m eye
with the type exception
nah in this case its just the average casting issue with generics where its warning you
Why isnt right if it working?
if the type you are casting to is fine
ah
never mind then
byte[] can be converted to string?
In this case it’s probably fine but not right and working are not mutually exclusive
Something can work and still be wrong and have something happen later that breaks it
Allright recommendation to change my code?
I will use That methods + Redis Pub/Sub
Let me provide an example
How do I get this back to ItemStacks?
Allright thanks i will add it
its library
?
Not on the same line please
in library you dont use try-catch
What the same line?
try-catch != try-resource
forums said casting it but that doesnt work
Caused by: java.lang.ClassCastException: java.util.ArrayList cannot be cast to [Lorg.bukkit.inventory.ItemStack;
Thanks, add it
<t extends Packet> t from(
Class<t> type,
bytes…
){
if (!type.isInstance(in)){
raise SomeException
}
return type.cast(in);
}
verano
Ahh allright
that will get rid of the warning
That would be the correct way
where does in come from?
Ahh allright
?
keylogger?
?

What that
PulseBeat caught on camera in 4K
then ur new to discord?
right click a message and click copy message link
md_5#0001
This bot is an instance of Red, an open source Discord bot created by Twentysix and improved by many.
Red is backed by a passionate community who contributes and creates content for everyone to enjoy. Join us today and help us improve!
(c) Cog Creators
ok
wait i dont remeber the cmd
it was a command that say info about your account
how do you cast item to string and back in a config file? Doing this right now but doesn't work:
config.set("items", items); (items is : ItemStack[])
inventory.setContents((ItemStack[]) config.get("items"));
You should serialize the items for saving
Do it like:
set("items”, Arrays.asList(items))
((List<ItemStack>)getList(“items”)).toArray()
iirc
We prefer List<E> to E[]
oh what
and then yeah the cast List<ItemStack> might be redundant
how did that fix it
Generics
An intermediate/advanced Java topic
but basically type orientation at compile time
Hey didnt need to serialize when using items?
I was told that you need
ItemStack implements ConfigurationSerializable
^
Lol
why is "key" red in this code?
bunp
well it works now danke
Because you don’t have a variable named key
?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.
You probably ought to do sth like:
NamespacedKey key = new NamespacedKey(blah);
in 1,8 ItemStack its not serializable i get NPE when using it
Verano I mean it is
how do i get the data from persistent data containers? ive been stumped for like an hour
Although 1.8 sucks
No im an idiot
I remeber now
I use config seriable because i save a class object to file
That why
bunp x2 combo
By reading the documentation on it
where would that be?
?jd-s
Yo conclure can we get a ?tryitandsee tag
Tho a prerequisite if you want to understand that is an understanding of the basics semantics of Java and object orientation
?tryandsee
Thought that one existed
Hmm
PDC confusion
Someone help me...Im losing my mind..... my multi module pom project for nms abstraction doesn't fucking compile the class files
This is the dist module which imports each version
?tryandsee @vocal cloud
?tas
I've tried manually including them in it as you can see xml <includes> <include>me.rishabhvenu.aseplugin.nms:*</include> <include>me.rishabhvenu.aseplugin.nms.*</include> </includes>
But the jar file ONLY CREATES META INF FOLDER
If you only used gradle Retinal 😅
It deletes the embed @ivory sleet ):
Yeah, it’s too big

rip
how do i speed up the daylight cycle 2x?
if anyone knows how to get data from a pdc in 1.18 please post example code in chat
?pdc
Every time the time event fires, increase time by 2
a
how to use maven shade plugin
@ivory sleet PlayerDeathEvent.setKeepInventory(true); is not working
maven shade plugin anyone
It does
For all those people who find it more convenient to bother you with their question rather than to Google it for themselves.
nvm
it's a joke alexthecoder
smh my head thank you for trying to be helpful regardless of my efforts to annoy

we here are too good for the trolls
how to install maven
?tas
I'd like to be able to track all messages a player receives whether it's a chat message from a player or if a plugin messaged them. Can I do that with any spigot plugins?
Sorry not plugins, I'm looking for an event that gets fired
The only event that fires when a player uses the chat is the AsyncPlayerChatEvent. There is no event fired if a plugin sends a player a message. You would have to listen for chat packets sent to the player.
Do you ugys prefer the paper or spigot api
spigot
(for compatability)
Does anyone know how to make it so that when someone mines a chest the chest contents drop but the chest itsself doesnt
Listen on the BlockBreakEvent, cancel it, get the drops, remove chest from the list, then drop the items manually.
The reason you have to do it this way is because #getDrops() returns a copy of what the block would drop. You used to be able to edit the list directly, but that was a very long time ago.
Im using reflection to modify the UUID of a player and I get this error: java.lang.IllegalArgumentException: Can not set java.util.UUID field net.minecraft.world.entity.Entity.ak to java.util.UUID
The method Im using:
public static void setPrivateField(Class<?> clazz, Object obj, String fieldName, Object val) {
try {
Field field = clazz.getDeclaredField(fieldName);
field.setAccessible(true);
field.set(clazz.cast(obj), val);
} catch (NoSuchFieldException | IllegalAccessException e) {
e.printStackTrace();
}
}
And I call it like this:
Reflection.setPrivateField(Entity.class, player, "ak", uuid);
And the ak variable does exist as a protected UUID
I heard that getOfflinePlayer only works if that player has been on within 30 days. Is this true?
Can we get a use case for what you're trying to do?
I think it depends on how often your server clears it's usercache.json.
What do you mean? Do you want the reason I'm trying to change the UUID value?
I'm scratching my head to see why you're trying to do that. Maybe there's an easier way.
I want to literally make the whole server register me as a different player
For what reason? There are likely better ways to accomplish this as if you change a player's UUID, you could run into some serious issues.
To be honest, mainly for fun
.-.
Not really. I don't use reflection that often, but I do know that a protected object is package private. Perhaps there is a difference you need to consider with reflection.
You may also have better luck if you use the remapped jar. Not sure if you are creating a plugin for 1.17+ though.
Ah rip, yeah I used declared field which should cover the protected part, but what is the remapped jar?
Yeah it is 1.17+
The remapped jar basically deobfuscates NMS.
Instead of using NMS, you can now use the Mojang names.
Ah I see
It might make things clearer when trying to access fields.
I mean, I know that's the field I need to change, I just don't know why it's not working
Is there a way to obtain the UUID of an offline player? I know that there's Bukkit.getOfflinePlayer().getUniqueID(), but my concern is that the player won't be in the cache anymore
mojang api
Thanks! Is this difficult to use?
I'm pretty sure there is, but I can't remember if you have to calculate it yourself or use the mojang api to get it.
first
you need
the field typw
you know which type is it?
Wait nevermind I just realized what I did wrong
well, i think the player will be always in the cache
Oh okay good to know thanks!
wait
you are tying to get the player by name
or by his id?
IIRC, you can just use Bukkit.getOfflinePlayer(String name).getUniqueId() and it will automatically send a request using the mojang api. The method is deprecated since it relies on player names, but I'm pretty sure it's been noted somewhere that there is no real intention of removing it from the api as it has valid usecases.
yeah not sure why they removed it, it's pretty useful
getOfflinePlayers
thanks!
loop
check the names
if one matched
return it
if dont
mojangapi and cache it
that method should be like this
Thank you! I'm trying to get an offline player by their name, with the purpose of getting their UUID. Eg a command of "/money XxXSpigotLoverXxX" will output their money amount regardless of if they're online or not
How would I do this? Just store in a custom config file?
Oh yea, @little elm you were right. The usercache does store the data for a month as it has an expiresOn tag. However, since the method uses the mojang api, it'll just refresh the expiry date once it does expire.
your own cache is prob overkill
Thanks! So essentially, for my purposes, I dont need to worry about it expiring?
Yea, you should be good. As long as you are using the built in methods or make a custom system to make and save requests to the mojang api, but using the api is a lot easier 😉
sorry could you clarify what you mean?
The API is a lot easier?
The Mojang API?
Yea so guys dont change the players UUID LOL
Yea, the spigot api.
Ohhhhh gotcha
What you are currently using.
I warned you. lmao
Got the longest error on the client side
It fill the screen?
Nah not one of those but I never seen the error before
I wonder if I intercept the packet directly through NMS when they join and modify it maybe it'll work 🤔
Hey everyone, I have a bunch of stuff relating to storage and stuff which i can't be bothered explaining, but I need a way to trigger some code when a lever is broken. I already have code to test if it is broken by a player, but I also need to know if it is broken during TNT explosions, creeper, the block behind it is broken and it drops off, etc - is there any way to test for this without writing each and every event out?
?jd
there is a search bar on the javadocs site that can be used to search for events
I doubt there is a catch all event that you can use. You’ll likely have to listen for each event, but if you want to keep your code organized, just put your listeners that pertain to your checks in the same class.
Yeah okay I feared that would be the answer, thanks anyway!
I think you only need blockbreakevent and entityexplodevent
How do I prevent a jukebox from overlapping a song? It does not stop playing every time after I right click @EventHandler public void onRightClickOnJukebox(PlayerInteractEvent e) { if(e.getClickedBlock().getState() instanceof Jukebox jukebox) { jukebox.stopPlaying() jukebox.setPlaying(Material.MUSIC_DISC_11); jukebox.update(); } }
It plays 2 at the same time?
yes
songs are client side
Including jukebox music discs?
yes, and unfortunately not sure if you can fix the overlapping part since the client doesn't report when a song is done
what you could do as a work around, is to grab the details from minecraft wiki in how long each song is
and then have the server kind of wait that time length
Would it be possible to just delete the block entirely so the sound stops and then just place another jukebox?
Anyone know how can I do something every time a player boosts their elytra?
Paper has an event for this PlayerElytraBoostEvent but I want to do it with spigot
generally it should stop if the disc is removed, I would have to do more testing on it since I haven't messed with jukeboxes in forever, but maybe you might have to fool the client into thinking there is no disc in the box for it to stop playing when you want it to. The method you are using should work to stop it, so it could be a bug. What mc version you using?
1.18.1
?jira
probably best to report the API bug if it is indeed not working
Okay, I was maybe thinking that I wasn't doing something right and it could not entirely be a bug or something, I'll just investigate a bit more, thanks though
check for right clicking a firework while gliding
Ahhhhh no way I didn’t think of that, thank you
Try stopplaying and setplaying one or two ticks later
Hi, so I've decided to move a project over from Maven to Gradle to see which I like better but I can't figure out how to copy the jar file to another location.
I tried following along from the Gradle docs but the 'from' and 'build' are greyed out and nothing is happening. Ideas?
Maven is more user friendly then Gradle is
and in terms of the whole Gradle vs Maven thing, unless your project is some massive code base you won't notice a difference between either of them
It compiles a lot faster
so does maven
no
just need to know how to allocate more resources to maven
gradle is A LOT faster
- it is less verbose
you can write 10 lines of gradle which is equivalent of ~50 lines on maven
that just means you don't know how to leverage Maven properly, second I can have maven compile a project in about the same time gradle does it
just because you never seen it, doesn't mean it doesn't do it, most people don't bother learning what maven can actually do or how well it can do things
no, that mean that the maven is verbose lol
you can have it less verbose there is a setting for that
IIRC from what I read, Maven compiles all files regardless of if changes were made whereas Gradle only compiles files that were changed
can even pass arguments to maven from the pom too
this is false, maven can do cache building only compiling what was changed
Can I get the player's all items and amount?
?jd
use the search bar on the javadocs to search for player inventory
or for the player related methods
No results found
hello! i created a fake NPC with nms but i'm having an issue where the gameprofile name displays alongside the team prefix
anyways as for Maven, the reason most people believe it is slow is first they don't bother with messing with settings or even seeing what flags could you send maven compiler. Maven by default is conservative in regards to resources it uses, but you can change this especially if you have a lot of resources to give it. Give maven 2-4GB of ram allocation and it will be decently fast 🙂
org.bukkit.scoreboard.Team team = this.player.getBukkitEntity().getScoreboard().getTeam(this.teamName) == null ? this.player.getBukkitEntity().getScoreboard().registerNewTeam(this.teamName) : this.player.getBukkitEntity().getScoreboard().getTeam(this.teamName);
team.prefix(name);
team.addEntities(this.player.getBukkitEntity());``` that's the code i use to set the team prefix
teamName is a randomstringutils alphabetical string
75 vs 29 (the gradle also have lombok included which will also add like 5-8 lines to maven as well)
You need to get the Player and then .getInventory() is a method I believe
sure, if that is your biggest gripe. Might as well compare ant in there while you are at it even though there is cases where ant is superior.
however, Maven can do anything you want it to
and gradle too
I will try it, thanks
but gradle just do it more concise
especially with kotlin dsl, it looks very readable
not sure what you mean by more concise
also gradle have special plugin that can generate plugin.yml for you
make a maven plugin and it will do it too
yeah you can try to make one, but i didnt found a ready one, but gradle have a few ready ones already, like spigradle
what do you mean try? you can if you want to. Maven isn't going to stop you that is for certain lol
you can, but it will take a while
not really? Not sure what you are basing that on. Have you made a maven plugin before?
its probably fine, intellij is just weird with reading gradle stuff
I don't see the file anywhere tho
^ copied, I mean
You can't hide the name while displaying team prefix and suffix .... You will need to hide the name with an ID that is like this: &1&3&8&0&a&b but instead of & the color code Symbol and max length of 16
anyways so far my point is valid in that unless you have a large code base, performance wise you won't notice a difference between maven or gradle. Just because you don't know how to properly configure maven isn't a factual basis that gradle is better, just you don't know maven very well. So for the most part which you want to use is mainly down to preference for like 80% of the projects
I have yet to come across something that gradle does that maven couldn't do
yeah someone told me to just use an armor stand with custom name like how holograms are
Lol the plugin.yml is also auto generated in maven too ... You just need to know how and this is not that diffcult
Also possible, but the name tag will appear a bit to height in my opinion and also increases entity count the player has to handle with his graphics
How does one properly abstract data saving to work with multiple formats
My brain cannot seem to think of a good way
have to find the commonalities between the formats
once you know what is common then you can abstract and only leave what needs to be implemented
Oof, I’m not sure what’s common between yaml and SQL
SQL uses tables, rows and columns. A table, is essentially like its own file, rows would be similar to sections and columns would be the individual data in those sections
Just create your own database
Lul
I wonder if I can find a good example somewhere
Ideally I’d like to offer yaml, SQLite, MySQL, and maybe json
SQLite and MySQL are very similar since they are both based on the SQL spec
yaml is different in that it isn't designed to be a database more or less a config file
so why not provide a tool to make it easier to edit MySQL or SQLite
There will be admin commands to edit anything important
I just feel some people are used to the yml of essentials
indeed, and it seems you are more concerned of the kids who use your plugin and if that is the case it isn't hard to also include a tool with your plugin
that is either automatically part of the jar or zip file or as a separate download
True
I guess I can just have a system to register serializers for any class I want
Something like HomeSerializerSQLite
I’m sure some other plugin has done this that I can look at for brain power
you can even use yaml as a way to dump data if you want, and then if they want to change it as long as a certain setting is enabled have it load data from a yaml file into the DB
and then have the setting disable after that use
That’s clever
Saving and updating the data I can wrap my brain around
Just not a good way to query it back out
?jd
guys how do you get a 2D or 3D region?
get 2 points and iterate through each point between
ohhh thanks
what are the suspicous call warnings in intellij
like "suspicous call to Map.containsKey()" or something
Maybe wrong key type
Anyone know of an OS plugin with multiple data storage options?
Search for plugins that have SQL ... They mostly support other things too
?paste
https://paste.md-5.net/okuqucoyek.java why this isnt working
What’s an OS plug-in
Open source
Ohh
Luckperms has
Might want to specify if you want code you can look at or code you can copy
Cause licenses
Just look at
can someone check the code that i sent
I'm trying to change the max level of most enchants in the enchantment table to 10. Any idea of how I would go about doing so? Looked for some plugins that already do this but none seem to be working, on 1.18 anyways
you can use unsafe enchant
Use the enchant item event and modify the getEnchantsToAdd map
Thanks 🙂
LibertyBans
although it uses sql databases only. Not sure if this is what you need
It’s a start
yo, i tried doing this
but it doesnt work
anyone knows how i can select a region, and then, when a player gets to that region it does something?
i made a move event here
yeah
that would explain it
so what does that mean?
Try 63 to 65
Is it possible, to canchel the join message? when a player joins in vanish? i programmed the vanish plugin
LuckPerms
null because otherwise it will just print a new line i think
Probably
SimplixStorage
support yaml, toml, json
Tbh wouldn't recommend Simplix all that much
i just found that
I've used it and it's a bit... ehh
never seen it before, but i sent alr anyway
Configurate 
I don’t intend to use it, just learn how to implement it properly
Simplix's code is very messy, wouldn't recommend it for analysis
I want to at least support 1 local and 1 hosted storage option
Jackson also supports json and yaml. And has a ton of serialization features. Why not just use that?
Like SQLite and MySQL
Hibernate XD
Yeah, quite underdeveloped arguably
Write the code once, support any SQL flavour
Look at LuckyPerms (:
paper dev
They do cool stuff altho they do couple data model and data storage a bit too strongly imo
Then json. Use Gson or Jackson to serialize json.
Then eithe save them to files or throw them into a MongoDB
Not everyone wants to learn or use ORM.
ORM is actually somewhat controversial from what I've seen.
Yeah json is my plan
Or support yaml
No, fuck YAML.
Subset.
You can translate json into yaml later too
Just seems hard to abstract this
So I can basically just call save(Object) and it will handle the translation into sql or json or whatever
You need more informations about the identity
No yaml is a superset of json, json can be seen as a subset of yaml
maybe a namespaced key
Yeah coll
Just have an interface above it
of course you could also make a facade which has the cache/data model internal encapsulated
Ah big words :p
Idk how to else describe it lol
A wall and button where that button gives you accessibility and interactivity with both the storage implementation and data model
public interface TypedStorageHandler<T> {
void save(NamespacedKey location, T object);
T load(NamespacedKey location);
}
Or
public interface StorageHandler {
void save(NamespacedKey location, Object object);
Object load(NamespacedKey location);
}
Or for better serialization
public interface TypeAwareStorageHandler<T> {
Class<T> getType();
void save(NamespacedKey location, T object);
T load(NamespacedKey location);
}
I kinda understand why essentials just yeets it all into yml now :p
Actually im gonna do this for my library now...
So you are saying the object itself should have the serialization and deserialization methods?
Ye, I usually do it imperatively with something like void load(id,data) but the third one is probably most solid
I mean...
public interface StorageHandler {
void save(NamespacedKey location, String object);
String load(NamespacedKey location);
}
Could also be fine. But then you are bound to blobs.
Not necessarily
You can create a serializer
which then gets passed to necessary implementations
That was my original idea
Ya
I have one mammoth Jackson instance where every serializer can be registered.
Each object would have 1 serializer per storage type
Idk if you actually need that for sql, maybe…
You can serialize almst anything by default when using Jackson. No need for custom serializers.
I could probably compress that into 1 for SQL and 1 for flat file
hmm yeah
Or stick with sth like a jackson serializer and just encapsulate that (maybe delegate from your serializer)
Your schema
[id, data]
With just one column containing a json String XD
Because that what relational DBs where build for. Kappa
Or perhaps a namespace rather than just homes
Yeah it does seem a bit like abuse of relational databases
In your namespaced key:
namespace:key
Where namespace is the table name and the key is the actual ID
Or namespace is the folder name and key is the file name if we are talking about flat files
Ah that’s clever
Namespace could also be the file name and key could be a subsection
I wouldnt want to read a whole file just to get a sub section
True
I need to bind all this data to a player though
Easy enough in sql, just add another column
playerdata:UUID
what is a good way to store permissions in sql
<UUID>.json
worldmanager:globaldata
for example
UUID, Perm, value?
yeha
but im using a tree structure
each permission is a node which stores its own permission value and if it should allow or disallow its child nodes
and of course its child nodes
I hope you dont intend to access a database every time you make a permission check


