#help-development
1 messages · Page 1042 of 1
at this point why not just use switch expressions and not pollute interfaces with concrete types, allowing for interfaces exist without concrete types in a first place, making it agnostic to any type it supplies the declarations to
am i wrong?
imo visitors are a code smell
Talking about code smells, this code is teleporting the players to 0,0,0.
And I have no idea why.
AFAIK there should be nothing in there which even can affect the player's position.
text entities don't exist in bedrock right
Hello. this is the 1.19.4 code. it defines custom name visible before the custom name itself. but in https://wiki.vg/Entity_metadata#Entity, it shows a different order. if i want to modify the custom name and custom name visibility, which index should i modify?
im want to use a packet libarary btw if you wonder why im not using the setCustomName method
the order in which they are added to the SynchedEntityData is not the one that matters, but the order in which those DATA_* constants are defined is
if you go to where they get assigned, you'll find
protected static final EntityDataAccessor<Byte> DATA_SHARED_FLAGS_ID = SynchedEntityData.defineId(Entity.class, EntityDataSerializers.BYTE);
private static final EntityDataAccessor<Integer> DATA_AIR_SUPPLY_ID = SynchedEntityData.defineId(Entity.class, EntityDataSerializers.INT);
private static final EntityDataAccessor<Optional<Component>> DATA_CUSTOM_NAME = SynchedEntityData.defineId(Entity.class, EntityDataSerializers.OPTIONAL_COMPONENT);
private static final EntityDataAccessor<Boolean> DATA_CUSTOM_NAME_VISIBLE = SynchedEntityData.defineId(Entity.class, EntityDataSerializers.BOOLEAN);
private static final EntityDataAccessor<Boolean> DATA_SILENT = SynchedEntityData.defineId(Entity.class, EntityDataSerializers.BOOLEAN);
// ...
Is there a better way to not update blocks of a specific type?
I really don't know how else I could do it.
I solved the problem by simplifying the code and spreading logic between two different events.
uhh
is there a way to make hashmaps put the same input twice? i kinda built my whole plugin around this and i cant recode it all
like if i .put() the same key and value in the hashmap that it already has, it just doesnt
the old value will be replaced with the new one
i dont want that
i want both values to be there
and both keys
two seperate entries
check out guava's Multimap
does that work like a sortedmap?
if you want it to
thats not what i meant that just makes 1 key have multiple values
sure, that's what you want
it's basically a wrapper for Map<K, Collection<V>>, for any kind of Map impl and Collection impl you tell it to use
i want jt to act normally like if i have name: data in there i want to be able to add the same exact key and value but as a seperate entry
like this for example
zeradris=emily is alr in the hashmap, but i can add it again so its
zeradris=emily,
zeradris=emily
im making a kill tracker kinda thing
same player could kill the same player multiple tines
yes, you can do that with a multimap
does it act too different to a sortedmap? like am i gonna have to change a lot of things
literally most annoying warning in java
I have no clue what you mean by that
it's literally just a Map<K, Collection<V>>
but, atleast its a warning and not an error
and warning means you can ignore it 😎
you can disable the warning in ide settings i think
in eclipse you can disable any warning
-Xerror in shambles
how would i make it so some players can't see entities glow
✨ packets ✨
naw fr?
i don't want to loop all entities in the player's world every tick and listening for glow packets then cancelling works but it has one flaw
on packet send or something
ive done it with enchantment glint
use packetevents but i used protocollib
i want to make entities not glow if the player sets a setting, however if they choose not to see entities glow and there's already glowing entities then the already glowing entities wont stop glowing
entity glow packet
the same thing happens if they choose to see glowing for entities then they would have to either rejoin or reload the chunk for them to see already glowign entities
how?
idk how youre doing it bro
it's entity metadata packet insn't it?
Hello, so I made a ClickAble Message using TextComponents and I wonder why they wont translate HexColors.
Here is the Code:
List<String> messages = msg.getStringList("tpahere.sent-target-messages");
for (String message : messages) {
TextComponent textComponent = new TextComponent(ColorUtils.format(message.replace("%player%", requester.getName())));
textComponent.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tpaccept " + requester.getName()));
target.spigot().sendMessage(textComponent);
}
Does anyone have like a colorizer for TextComponents where I can use Hex and ChatColor?
I'm assuming you are shoving legacy codes in that new TextComponent?
don't do that, use TextComponent.fromLegacy(ColorUtil...)
Oh thanks
@slender elbow could you help me with guavas multimap?
i dont understand how to make it have a seperate key-value and not just make a key have multiple values
why? there is no practical difference
When you use put(), it adds it to the collection
^
TextComponent textComponent = TextComponent.fromLegacyText(ColorUtils.format(message.replace("%player%", p.getName())));
fromLegacyText is a BaseComponent[] and you can't do clickevent on it
fromLegacy, not fromLegacyText
Name matches Map#put() but like Emily said earlier, it's equivalent to a Map<K, Collection<K>>, so put() is akin to get(K).add(V)
This doesnt exist
oh you're on an old version
You can use the component builder
you can pass that array to a new TextComponent
Yes
Yeah that also works
new ComponentBuilder().append(TextComponent.fromLegacyText("blah")) and doing your actual event handling through that is probably the preferred way though
Are there any cuties here who wants to review code
BaseComponent[] message = new ComponentBuilder()
.append(TextComponent.fromLegacyText("your legacy text stuff"))
.event(new ClickEvent(
ClickEvent.Action.RUN_COMMAND,
"/tpaccept " + requester.getName()
))
.create();
target.spigot().sendMessage(message);
choco is a cutie, idk if he wants to code review tho
i thought we moved away from component arrays
We did. This user is using older API
You're doing to.subtract(from) which are both Locations. That method mutates the Location object
Right. But isn't it a new copy?
Oh 😨
Then how would I, hm, get a meaningless copy which doesn't mutate the original object?
/**
* Gets the location this player moved from
*
* @return Location the player moved from
*/
@NotNull
public Location getFrom() {
return from;
}
/**
* Gets the location this player moved to
*
* @return Location the player moved to
*/
@Nullable
public Location getTo() {
return to;
}
Not copies
😢
You can either .clone() the Locations yourself, or you can turn them into Vectors with toVector()
The latter is probably the preferred option tbh
BaseComponent[] components = new ComponentBuilder()
.append(TextComponent.fromLegacyText(ColorUtils.format(message.replace("%player%", p.getName()))))
.event(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tpaccept " + p.getName()))
.create();
target.spigot().sendMessage(components);
}
Like this?
Thank for the excellent advice. I think I can take it from here.
Yes
Thank you!
Also, your multiply(1) doesn't do anything 😅
normalize() does what you want. Sets the length to 1. Multiplying 1 by 1 will keep it the same
dude
when i .put() same keys it just adds the value to an already existing key
yes, that's literally what you want
you said i could make it so its just a seperate entry
Yeah but in a Multimap the value is a collection
I DONT
dude
stop calling me dude lmao
Right. It's a work in process.
its not the same thing
Dudette.
if it wasnt possible why did you direct me to it
If you make a ListMultimap that is what you want, yes
how not?
you said i could do what i wanted not "practically do the same thing"
how is it different
im using it for something different i need it to register the keys and values seperately
that doesn't tell me anything
like this
Actually got this accepted somehow
sure? a Multimap basically does that, practically it's the same thing
I DONT NEED IT TO BE PRACTICALLY THE SAME I NEED IT TO BE THE SAME
chill the fuck out
you said it was the same not "practically does the same thing"
Because then i would need to explain my whole plugin concept and its not relevant
i have a hashmap that has 5 maximum entries
okay then multimap is not for you, and neither is a java map
and when you add an entry a entry comes out
go figure out your own solution lol
why
Then you want a List of pairs
Zeradris=Emily,Zeradris=Emily
i want a sortedmap of String,String
that can accept 2 of the exact same keys and values
and not overwrite anything
just add to it
Instead of a Map.Entry you can use either a Pair or some other object that holds two strings
You can't easily look those up though
i mean you can get the Collection<Entry<K, V>> from a multimap
and they "are" "separate entries"
wdym
i need to access them and key/value basically everywhere
is there any better way than visitor design pattern to decouple part of your code for generic types
okay, so, get(key), what would that return?
thank you but no stop repeating that
switch expressions doesnt work really with generics
Yep, Emily's correct about that as well
he said it wont be easy to access them idk what that means
it picks one at random :pepelaugh:
doesnt matter to me ngl cause i need to access them by index so ise my own function
That's what I was thinking too lol
and i dont need it
just use a List<Map.Entry<K, V>>
Okay so if you're getting them by index, then a List is fine
yeah im gonna use a list
it won't be sorted unless you explicitly sort it
If you don't want to lookup by name or UUID or anything, List will suffice
a list wont be sorted?
Heck, maybe even a Queue if you want. Depends on what you're doing
SortedList incoming
¯_(ツ)_/¯
by sorted i mean it keeps the original order of entry
That's fine
sorted != ordered
this very much seems like a giant xy issue i cannot lie
lists are ordered and sequential
Array lists keep order
i never said i wanted it to be sorted i said i used a sortedmap
alr im gonna use lists then thanks
i want a sortedmap of String,String
what is that
sounds like you said you wanted it to be sorted
public interface DataVisitor {
void visitBoolean(Data<Boolean> data);
void visitInteger(Data<Integer> data);
void visitRangedInteger(RangedData<Integer> data);
void visitColor(Data<Color> data);
}
right now i have visitor design pattern on an object with .accept() method on Data interface. Is there any better way to decouple part of your implementation into another place?
?xy
sortedmap yeah thats what i needed to replicate
for generics switch expressions do not work, as that would need nasty casting
literally said that
I think pattern matching accounts for generic types now doesn't it?
The real question Is does he even know what he wants
can you just leave me alone 😭😭
🫡

"it depends"™️
™️
like, record patterns, if you have a record Foo<T>(T t), you can't exactly match the type parameter, but the type of the t value
""it depends™️"™️"™️
Ah, yeah, not quite to the degree that I thought
"™️" sure looks like something
literally
™️
so if you have something like record Foo<T>(String idk) it's useless lol
I don't think anyone has that trademark but it's generally associated with Blizzard, not Hypixel
same thing
sadge
that would be awesome to have, i can mitigate this by checking #Data#getValue(), as it determines the generic type, but in that case nasty casting would need to occur
Skin care company 
and visitor design pattern right now eliminates all of those problems
you could replace the generics with a little bit of inheritance
switch (node)
case IntegerData intData -> ...
or w/e
do you have any type identification information besides the generic?
some Type enum or whatever
no
tbh this is not even for the spigot/paper
this is fabric clientside mod
so im working with native minecraft code mostly
That doesn’t really make a difference
ikr
Why didn’t anyone tell me Mojang added even more attributes in 1.21
data oriented design 💪
i found this scoreboard helper on a spigot form but the numbers on the side of the text are negative, any reason why?
the numbers start at 6 and go to 15
Ah, yes. And actually what that does is it determines how close you have to be to take damage, ie. when true is returned. It just happens to be 1, so it seems it's not doing anything. But that's just the starting point. 1 will be slightly too far away, so I will drop it to something like 0.5 - 0.8 more likely.
And I got it working after I did the clone thing.
Which is nice.
Concentration camp MC here we come.
who undestand how work DI can explain smth?
smth being what exactly?
this is how you create a folder right?...
dependency injection
new File(JavaPlugin#getDataFolder, "file-inside.yml")
You can simplify your constructor, new File(Bukkit.getPluginsFolder(), "SkyblockPlugins/Schematic"). But if "SkyblockPlugins" is your plugin, then yes, do what Ebic is suggesting instead
File(directory, path) is the constructor, saves having to do the string concatenation yourself
Yeah, I'm not familiar with that DI/CDI library in specific so yeh
Why do we not have File(...subpaths) so we can have as many directories as we want without having to do the ugly "directory/file.yml" thing
Because at that point you could just make a single string and all that constructor would be doing is concatenating the strings together
Yeah but it looks better and then we also don't need to worry about stuff like File.seperator
/ will replace with the file separator
oh what
Yeah the file constructor handles that
damn
I don't know if I'm supposed to put this here or in #help-server, but how would I build vivecraft with this file structure? I can't find a POM file anywhere.
How do the event listeners know which function to call?
it most likely uses ij or eclipse intergrated build system
Oh it's your own library. I personally prefer the magic subclassing approach over the magic arbitrary constructor invocation and field population, but to each their taste.
well that sucks
File constructor calls Util#normalize(String), https://github.com/openjdk/jdk/blob/master/make/ide/visualstudio/hotspot/src/classes/build/tools/projectcreator/Util.java#L73-L83
everything is local too yay
oh no wait that's the output jar
I give you a small tip: If it isn't a maven or gradle project, it's not a project worth considering.
Except perhaps with Ant, but it really depends on the context and you are extremely unlikely to encounter Ant projects in the wild these days
Were you replying to me?
my plugin doesnt load because it says spigot.yml is missing, but its there
tf is going on
Have u opened the jar to check if is it really there
its there in my ide
why does it got to look so depressing fellow?
i just opened the .jar and its there
yes
Wait tf is spigot.yml
plugin.yml sorry
Isn't that spigot configuration file
Ah! The problem is: the vivecraft devs haven't released a jar file for 1.21/1.20.6, but there are branches for it.
That's why I'm looking for it.
I always wondered why people put build instructions in their readme.
oh amazing
of course they left out the gradle files
those are the files you are meant to exclude
if anything thats a default ij generated gitignore
huh? aren't projects meant to contain a file for gradle to read?
it's not in the repo, but neither is it in the gitignore
the files you should push for gradle are build.gradle(.kts) gradlew gradlew.bat /gradle
.gradle contains cached downloads which shouldnt be pushed and /build contains built binaries that shouldnt be pushed
yeah I just read "gradle" and immediately made assumptions
oh
so a DOM but for projects
because html-like
maven sucks ngl
Do you really need a reason for that?
lmfaoo
gradle >>> because it uses kotlin
how would i make text bold using kyori text component
Component#decorate(TextDecoration)
(component.decorate(BOLD))
k thanks
So what do I do if a build.gradle file is missing?
I think it's because the vivecraft spigot extention is a subproject of vivecraft, which probably has the file.
is it possible to depend on 2 versions of spigot in maven?
my plugin is 1.16+ but some features are only available in 1.19.4+ because of text displays, how would i go about importing both of those api versions? i know about the res
rest*
literally read i said some features are only 1.19 some support 1.16+
i need to import both apis
Why tf would you need that
except you don't need to
It doesn't make sense
1.16 api version
BRO
support*
its not the main feature of the plugin
1.19.4 contains everything 1.16 does and everything from 1.19.4 you use will not work in 1.16
make it a seperate plugin then
Then make multiple impls with multi module project
just help me out with what im asking stop trying to change my plugin
wdym
you can but should not depend on both
lol?
elaborate on the modules thing
have one core plugin and a sperate one with the displays
It doesn't matter how main or not main your feature is it will always require you to use 1.19.4 to use 1.19.4 features
and a shared api
if i use 1.19 api and set the apiversion to 1.16 in plugin.yml will it work with 1.16+?
Noo?
no
It's a 1.19.4 feature
no class def found exceptions
the features that are available in 1.16
Are all available in 1.19
so if i use 1.19 and set the apiversion in 1.16
all features that are also in 1.16 will work fine
with 1.16+
right ?
yes
yeah no
besides everything that changed
rad leave me the fuck alone bro
if you're depending on the 1.19 api you need to use 1.19+
You don't actually
tf did i do to you
thank you
youre not helping rn
You can depend on 1.19 api and as long as you only use 1.8 features it should work afaik
do you not? youre not shading it in, and the server should provide it
no need to be rude x2
Well, bukkit does not get relocated
org.bukkit.world.World is always the same
and i'm just tryna help you, if you're ignoring me and telling me to fuck off that's just rude lol
Just that new methods come
ah yeah, i was thinking of cb
im only ignoring you because youre literally trying to change my plugin
Yep
im asking one thing and youre just telling me to change everything
raydan helped me with what i needed
you literally cannot do what you described 
Sometimes an xy problem occurs, I assume that's what rad saw here
i just did
except that raydan kinda said the same thing as me (i said seperate plugins, he said modulss)
i'm talking about your initial question
Ye, I thought of how nms guys do it
thats where my original question came from because ik it was possible to use different api versions
gradle moment: gradle folder, build.gradle.kts, gradle.properties, gradlew, local.properties and settings.gradle.kts
ffs
having the thought of "nahh it cant be that bad" was a mistake
AH FUCK I FORGOT THAT ONE
propeties and wrappers are optional
what it's true
Anything besides the build.gradle is iirc
yea true
modern day build scripts should just be a python script lol
i always forget there's other stuff in the gradle dir too lol
Fuck no
if you dont push the wrapper ill fight you
bun script
bun is just js?
Thank god I do push the wrapper
But I use groovy gradle so I'll still be fought
yea ofc
yeah i stab you for that
Can someone send me a Method how i can change a Nametag from a Player in a Plugin with a Command
tf is gradle even doing lol
file descriptors, bruh just build my project
i clearly havent been using gradle a lot
i mean, you don't really need to care about the wrapper scripts, they just spin a daemon and proxy commands to it, is all
with 1.20.6, you can hide this right ?
but i forget how to do it, can someone help me 😅
i that's thats something to do with item nbt?
No it’s cs only
not sure tho
its a new tooltip component
declaration: package: org.bukkit.inventory.meta, interface: ItemMeta
in theoris, this should work ?
yeah
yeah that should do it
don't work
did you restart?
private void setNametag(Player player, String newNametag) {
Scoreboard scoreboard = Bukkit.getScoreboardManager().getMainScoreboard();
Team hideTeam = scoreboard.getTeam("hide");
if (hideTeam == null) {
hideTeam = scoreboard.registerNewTeam("hide");
hideTeam.setOption(Team.Option.NAME_TAG_VISIBILITY, Team.OptionStatus.ALWAYS);
}
if (!hideTeam.hasEntry(player.getName())) {
hideTeam.addEntry(player.getName());
}
Team originalTeam = scoreboard.getPlayerTeam(player);
if (originalTeam != null) {
originalTeam.removeEntry(player.getName());
}
player.setPlayerListName(newNametag);
player.setDisplayName(newNametag);
player.setCustomName(newNametag);
player.setCustomNameVisible(true);
hideTeam.addEntry(player.getName());
hideTeam.setPrefix("");
hideTeam.setSuffix("");
}
Can someone tell me why this dont work
private void hidePlayerName(Player player) {
String hideName = plugin.getConfig().getString("Configuration.HideName").replace("%player%", player.getName());
player.setDisplayName(hideName);
player.setCustomName(hideName);
player.setCustomNameVisible(true);
if (plugin.getConfig().getBoolean("Configuration.ChangeTabName")) {
player.setPlayerListName(hideName);
}
if (plugin.getConfig().getBoolean("Configuration.ChangeNameTag")) {
setNametag(player, hideName);
}
}
Hey looking to see if anyone knows what the thing is called above the players heathbar is (showing in pictures) as I’m wanting to put a custom message their
action bar
Actionbar
Player#Spigot().sendMessage
Thank you
anyone can help me make a centerlized system to load , save , edit (cosmetics)?
i finished kits xD
now its time for cosmetics :p
I feel like you should go back to research if you can't finish a system without asking for help
its too much work to do 🙂
allot of questions in my mind
too much work to bother helping you
its just to many ways to do it
and i don't want to waste my time to work on a bad way yk
That's how you learn
how have you still not figured it out? start with a file based smth?
IK
How long does it take for a plugin to show up on bstats?
i did figure kits out
and i finished it
It refreshes every 30 or so minutes from my experience
Because I've been devving this plugin for like a day and it still hasn't showed up on bstats that a server has run it
now its time for cosmetics , which only have 4 fields , name , type , game_mode , price
I have a hashmap that saves player friends which player is key and the value (friends) are a list of strings
and I want to save it in a mysql db
what is the best way to do it?
kinda stuck with using mongodb, I included
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongodb-driver-sync</artifactId>
<version>5.1.1</version>
</dependency>```
but i get a ClassNotFoundException for any class I try to use from it
Anyone know whats wrong?
is this correct way to load them from database?
do you inculde it in ur build?
lets assume i have 10 SKYWARS_WINEFFECT
its included at runtime
how would that work :p
Any idea why my plugin might not be showing up on bStats? As far as I can tell, I've shaded in bstats and initialised the id in the plugin
what am i supposed to include then?
im following mongodbs website verbatim
I included it but maybe I did it wrong? Mongodb website says to just add the maven dependency
how are u building ur project?
i make an artifact
noooo
how is that any different?
lmao
it works
running package compiles with maven
but you have to add it manualy to ur build
using artifacts compiles it with intellijs internal compiler
packaging adds it directly
oh thats hilarious, i had no idea
ty
Is this correct, because my displayName dont gets changed
problem solved tyty
ty as well
?notworking + unnecessary crossposting
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
The display Name dont gets changed
I have a hashmap that saves player friends which player is key and the value (friends) are a list of strings
and I want to save it in a mysql db
what is the best way to do it?
you cant set a players displayname
How
?xy
- you need to use text displays/armour stands if you're trying to set a custom display name
I already have player.setDisplayName(hideName);
ye that wont work
do this
doesn't change the name tag
ah thanks
the name tag is only affected by scoreboard team prefix/colour/suffix
mhhhhhhhhhhhhhhhhh
textdisplays are simpler for 1.19+
yup, love em
hey was wondering how i could edit and add attributes to an armor piece? whenever i use
ItemMeta#addAttributeModifier() to add the max health modifier it removes all other attributes. im applying this to a netherite chestplate but it can be added to any armor piece.
adding any attributes will remove the default attributes, that's vanilla behaviour
you can use Material.getDefaultAttributes or whatever to add them
I have a hashmap that saves player friends which player is key and the value (friends) are a list of strings
and I want to save it in a mysql db
what is the best way to do it?
alright thank you i did not know that existed. i thought i had to add them back manually (which i did) and it wasnt adding them only the first attribute i would add. thanks.
Kotlin hate?
Skill issue
but bStats can work with kotlin though right?
Thats kotlin love and yes it can
|| https://i.gyazo.com/9df01be65a775970587a33f7187b7dc5.png ||
|| https://i.gyazo.com/1ddb177686b5667d88e2778e938855fa.png || for some reason when i kill a player it doesnt give effects, im trying to make it so when you kill a player with a item called the ares hammer it gives you effects but its not working and giving a weird error that i dont understand
?whereami
I need help guys, I am trying to be able to use CraftPlayer, I have tried a lot of things but I'm not being able to import the necessary things
?nms
I saw a guy on youtube that uses maven but when I try to do it in gradle doesnt work, example, he just removed the "-api" and he was able to use the CraftPlayer, I have tried to remove it on my gradle file like this: compileOnly "org.spigotmc:spigot:1.20.1-R0.1-SNAPSHOT" and it simply just doesn't work
Did you run buildtools
I have a hashmap that saves player friends which player is key and the value (friends) are a list of strings
and I want to save it in a mysql db
what is the best way to do it?
going to try that blog that u sent
This is the 1st time im doing this btw, after changing the build.gradle like the blog says it now says: Could not find org.spigotmc:spigot:1.20.1-R0.1-SNAPSHOT
Exactly as you said, just search for a Tutorial on SQL and Java
You haven’t answered the question
Bruh I am not asking how I do it I am just asking what is the best way to do if
Like use json or object
Idk
Yeah, I have
Store the player uuid in a column and the friend uuid in another one
Emmm the friend value is a list
Specifically for that version?
If so the spigot dependency should be in your mavenLocal
On gradle you need to manually specify mavenLocal as a repository iirc
I am doing this on 1.20.1
Uh soo I would manage it with the same table, when a player add a friend insert a new row (player, friend), when you need the player list just use a select WHERE player = ?, just be sure to add a check to avoid to add multiple time the same friend
And you have run buildtools for 1.20.1
[00:27:49 WARN]: Could not submit stats of Folia
java.io.IOException: Server returned HTTP response code: 429 for URL: https://bStats.org/submitData/server-implementation
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1998) ~[?:?]
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1599) ~[?:?]
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:223) ~[?:?]
at com.destroystokyo.paper.Metrics.sendData(Metrics.java:211) ~[folia-1.20.4.jar:?]
at com.destroystokyo.paper.Metrics.submitData(Metrics.java:171) ~[folia-1.20.4.jar:?]
at com.destroystokyo.paper.Metrics.lambda$startSubmitting$0(Metrics.java:99) ~[folia-1.20.4.jar:?]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:572) ~[?:?]
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:358) ~[?:?]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:305) ~[?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144) ~[?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642) ~[?:?]
at java.lang.Thread.run(Thread.java:1583) ~[?:?]
```Getting this error with bStats on my server
Pretty much
Sir this is spigot
yes, after that, I created a folder called libs inside my plugin and copied the craftbukkit jar file to there, then I made this on my dependencies inside gradle: compileOnly files('libs/craftbukkit-1.20.1.jar')
?
Depend on spigot and have mavenLocal as a repository
You don’t need to do anything silly with jars
yea I mean isnt that dependency just a bootstrap jar anyway
Yes
so u wont get all the dependencies on ur classpath
yes
so, what should I do? it generated me this:
and other folders
I already told you
.
spigot is the full server
spigot-api is just the api
repositories {
this.mavenLocal()
}
dependencies {
this.compileOnly 'the classic spigot dep without api classifier'
}
ah ok, I was using mavenCentral
u can layer them, that is declare both :>
yeah I know
Neither are developed by us
like this? ```
repositories {
mavenLocal()
mavenCentral()
maven {
name = "spigotmc-repo"
url = "https://hub.spigotmc.org/nexus/content/repositories/snapshots/"
}
maven {
name = "sonatype"
url = "https://oss.sonatype.org/content/groups/public/"
}
maven {
name = "protocolLib-repo"
url = "https://repo.dmulloy2.net/repository/public/"
}
}
yea thats alright
Thank you for this very new information.
Iirc it checks them in order
Also if you are using the full spigot dependency you don’t need the spigot repo
removing it then
thank you once more
:D
Just another thing, I am not being able to access the class "ServerPlayer", why is that?
nevermind, just found, it is EntityPlayer in Spigot mappings
yea goofy mappings
anyone have a good nms guide somewhere?
?nms
I need a Minecraft plugin where a cactus is located at coordinates ( x=0, y=0, z=0 ). The plugin should prevent the cactus from growing if there are blocks present at the following positions relative to the cactus:
- ( x=1, y=1, z=0 )
- ( x=-1, y=1, z=0 )
- ( x=0, y=1, z=1 )
- ( x=0, y=1, z=-1 )
In other words, the cactus should stop growing if there is a block directly above and on any of the four sides at the specified locations.
Please provide the necessary code to achieve this functionality, including the main class and the plugin configuration file.
package com.shadowcraft.antiautocactusfarm;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockGrowEvent;
import org.bukkit.plugin.java.JavaPlugin;
public class CactusGrowthControlPlugin extends JavaPlugin implements Listener {
@Override
public void onEnable() {
// Register the event listener
Bukkit.getPluginManager().registerEvents(this, this);
}
@Override
public void onDisable() {
// Any necessary cleanup
}
@EventHandler
public void onBlockGrow(BlockGrowEvent event) {
Block block = event.getBlock();
// Check if the block is a cactus
if (block.getType() == Material.CACTUS) {
// Get the location of the block
int x = block.getX();
int y = block.getY();
int z = block.getZ();
// Check blocks at specified locations
boolean shouldCancel = isBlocked(block.getWorld().getBlockAt(x + 1, y + 1, z)) ||
isBlocked(block.getWorld().getBlockAt(x - 1, y + 1, z)) ||
isBlocked(block.getWorld().getBlockAt(x, y + 1, z + 1)) ||
isBlocked(block.getWorld().getBlockAt(x, y + 1, z - 1));
if (shouldCancel) {
event.setCancelled(true);
}
}
}
private boolean isBlocked(Block block) {
return block.getType() != Material.AIR;
}
}
This code doesn't work too
chatgpt is most likely not always going to give working code. it is up to you to know how to code and feed it the proper methods and terms for it to know exactly what you need.
Can you suggest me what methods I should use?
Or atleast the logic behind it?
whats the actual use of the plugin? why do you need a specific cactus at a specific coordinate not to grow? is it a decoration at spawn?
I want to prevent auto cactus farms in my server
yk the cactus farms which use fences, chains or any other blocks so that when a cactus grows it breaks
Then make cactus not sellable, then it would be a useless farm to have. Theres no issue at all with the farm itself.
Well the thing is players collect cactus and smelt them for XP
We disabled village trading in my server so everyone needs XP to use the enchanting table
@EventHandler
public void onCactiGrow(BlockGrowEvent e) {
if (e.getBlock().getType() == Material.CACTUS) {
e.setCancelled(true);
}
}
This completely prevents cactus from growing right?
yea.
We don't want that
then its not gonna happen.
I've seen other servers have this feature
if players are enjoying farming why take it away
Well we do encourage manual farming
not giant auto farms
those are good, means players put a lot of time and effort into building that.
you want someone to do the work for you?
?spoon
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.
Yeah
?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/
Why doesnt it work? forgot the plugin.yml? any errors? mostly up to you
Everything is okay
It just doesn't work
Or should I make it so that it doesn't break at all unless a player does it?
In the grow event, check if the block it’s growing to has a block on any of the 4 sides
Didn't get you
You may need to just remove the + 1 to the Y in your code
Not sure if the block in the event is the source or the target
Let me try
It's still not working
Hey guys
I have a questions and I wanna upload with my code
but the discord text limit 
which site that I can upload the code?
?paste
thank you
I've tried this to detect player afk with worldguard, But is there better efficient way?
hey can someone guide me what to do when a dev blames false stuff on you just because you have a similar named guy in your discord ?
my plugin is kinda direct competition to his plugin so he blames the 1 star bec as troll review planned by me
i asked the guy in my discord with similar name whether he is the reviewer and he said "no". so i doubt the dev is intentionally misguiding the review to made me look bad.
anyone knows why my start up ends with: Listening on /0.0.0.0:25577?
im using bungeecord
why are you concerned with this o.O
he dmed me saying
"Hey, I would appreciate it if you didn't send people to give 1 star reviews to my plugin. I've never given your plugins bad reviews or bad talked them in general and you doing the same is not cool."
tell them it wasn't you then and leave it at that
i did and even made the guy who was in my discord with similar name talk with him
ok so its all settled, you are not obligated to do anything more then that let alone they should be pleased you even did anything at all 🙂
it's kinda hateful statement to my resource, but ig its better to ignore
well its just they have nothing in facts just baseless assumptions
therefore it is immature of another to accuse you of something when they have nothing to show for it. However you shouldn't stoop to their level either
and you shouldn't hold yourself as being obligated to another either if they haven't done anything to warrant such things
ye its always this dev who shows up every 3-4 months just to argue a topic
- previously he joined my support server and tried to dm and promote his plugin in support chat which lead me to ban him
- he is also accusing me i have copied his ideas and i always have to explain him that "i didnt even know he existed"
- now he is doing this stuff
either way, it seems you dealt with it in the mature manner and therefore there is nothing left to do.
you have no obligations to explain yourself to some random on the internet
nor do you have any obligations to do anything about what they are doing
Thank you. ill just ignore him and his accusations
if people want to come ask you that is one thing and if you tell them the truth and they don't believe it, that is on them nothing you can do about that
hence I don't worry about drama XD
ye i just got annoyed because this isnt the first time
sure, but not everyone is going to like you but you don't need them to anyways
as long as you have people that like your stuff and support you, that is all you need
idk why he feels like this he has 5x the sales then me
because people are dumb and feel they are owed something lol
lol
Thanks mate :)
np
?
?tas
Oh wait, aren't there InventoryHolders in 1.14?
Well, it works for chest inventories but doesn't work for other types of inventories. What do you suggest? What about a 1.14 wrapper that compares titles instead of GUI holders?
You shouldn't be using InventoryHolders for custom guis in the first place
And you should never compare titles
Lmao, there's no solution
Storing (very complex) inventories inside a Map doesn't look like a solid solution
it's the only solution
titles and inventory holders are both wrong
I'm creating "animations." I can't compare two inventories that are on different frames.
Yes, I mean, when you do this:
inventory1
inventory2 = inventory1
inventory1.setItem(1, array[3])
inventory2 != inventory1
Well, it will stay the same inventory in this example because of references I think
Oh, I didn't know that. I'll try it now. 🙂
Works, thank you!
thank you buoobuoo 🙂
Well... At least it works for chests
imo using an inventory framework is just the best option
like IF, interfaces and triumph-gui
I'm creating an Inventory framework lmao
why reinvent the wheel
I need a way to create guis from configs
I'm at 98%, I won't stop but thank you ahah 😛
From what I can see it looks like you're at 60%
It works in 1.20, it doesn't in 1.14
I'm actually trying it in older versions, it's for a premium plug-in
I can't create a 1.20 only premium plugin lmao
why not
guess
is there a way we can remove eating animation for specific items?
My main targets are PvP/Roleplay/MCMMO servers
ok
Can you please link me that stat?
ohh I've found it... thank you
supporting 1.16-1.21 covers like 98% of the servers no?
not really
1.8 and 1.12 has quite the amount of people remaining
whether that is a demographic you want to target is a different question
4.1% running 1.8.8 and 3.7% running 1.12.2
I would probably ignore them
yeah
the majority of all servers are on version 1.20+
using 1.8 in 2024 makes zero sense
all the rest only account for like 25-30%
it does make sense, but those who use it properly are not going to be your demographic anyways as they won't be using your plugin or the odds are not in your favor anyhow
I mean all my plugins are still stuck on 1.18 :p
1.8 still makes a good choice in terms of making a custom implementation
Just wanted to check, something regarding the particle enum changes is this correct: REDSTONE -> DUST ITEM_CRACK -> ITEM BLOCK_CRACK -> BLOCK and any ideas regarding what BLOCK_DUST, SPELL_MOB and SPELL_MOB_AMBIENT were changed to?
might as well pick 1.8.8
Just one has to deal with exploits in that version.
I wasn't implying that it should use old protocols
just that it makes a good base for a custom implementation
but minestom
Yeah sure, but I'm hinting that they need to "patch" them or find plugins that patch these.
That are present in 1.8.8.
if its a custom implementation, all that matters is implementing the protocol, everything else isn't really all that relevant
but the reason for using 1.8 is that you have some code to work off that isn't quite easy to just make in a day
that had the exploit
like path finding, world generation etc
log4j?
ye
personally if I was making a custom implementation I would switch to something else other then log4j
or make my own
I never liked log4j
the issue wasn't much of an issue for servers properly setup and protected
SLF4J ♥️
slf4j my beloved
https://github.com/LukynkaCZE/PrettyLog but this is also nice
what's the point of a logging lib if it does not integrate with SLF4J - seriously
🤷
Java logger 🤓 ☝️
What is slf4j for, I think I asked this before but forgot
Abstraction layer for logging frameworks
a logging api. to unite logging implementations
Understandable
There is also JUL (java.util.logging), but we do not talk about that one
Well yes but actually no
they have a custom logger based on slf4j afaik
I personally always used the paper-provided SLF4J logger and if that approach is not available I would frequently just create my own SLF4J logger
oh is that a paper thing lmao
i hate the fact it just took me 10 min to debug this shit
Well spigot's JUL logger forwards for Log4j I believe
Are there any changes in org.bukkit.Material and org.bukkit.inventory.EquipmentSlot for Spigot 1.21 API?
My IDEA can't seem to be able to find them anymore? (Updated just from 1.17 to 1.21)
make sure you're using j21
Clear all caches and restart?
I mean ideally that is the job of maven or gradle
Yeah, I completely forgot about that thing. Haven't dealt with API since 1.18
what
?????????
please phrase a proper question
I try create simple SkinRestore plugin
can you edit textdisplay's text after its creation?
yes
with setText() right?
yes
is there a way to save them over a restart?
like how do i get a text display reference if i know the coords and shit
or what would i do
textdisplay is an entity right? (i havent worked with them)
yes
if so you can probably use its uuid
And I want to know this is hard return custom player skin?
i can save info about them in a file and then load the info in but i cant really access the textdisplay instance like that
save the world?
it's just an entity
dfu it 
what does it do lmao
no fucking clue
mojang's serialisation lib
fix ups data i guess
DataFixerUpper is rather useful
yeah it really is
how so
mojang added codecs for almost everything in the game
the existence of datafixerupper implies the existence of datafixerlower and databreaker
means you can pretty much serialise every single game object there is
Ensures that it does not break across versions
Something that is very well possible with bukkit serialization
wdym serialise
object <-> nbt/json
ahh
no ill just save it like in my own format no?
is that bad?
like {name, text, uuid, etc}
are you saving it to a config
config file or just a save file
for save files or something you can very well use nbt
Is it meant to be edited by a human is what we are asking
yep ^
oh
no but i am supposed to update it everytime a certain data changes
only i change it
then you can just use dfu
then DFU
can you explain dfu?
Paper should expose DFU serialization methods
((CraftTextDisplay) display).getHandle() you should be able to serialise this
does spigot not
Otherwise that
Doesn't seems that to be the case sadly:
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] ****/QuestHive.java:[67,37] cannot find symbol
symbol: method getHoneyLevel()
location: variable beehive of type org.bukkit.block.Beehive
[ERROR] ****/QuestHarvest.java:[47,9] cannot find symbol
symbol: class Material
location: class deadlykill.toons.QuestHarvest
[ERROR] ****/QuestHarvest.java:[63,22] cannot find symbol
symbol: class Material
location: class deadlykill.toons.QuestHarvest
[ERROR] ****/QuestHarvest.java:[65,21] cannot find symbol
symbol: class Material
location: class deadlykill.toons.QuestHarvest
[ERROR] ****/QuestHarvest.java:[65,36] cannot find symbol
symbol: variable Material
location: class deadlykill.toons.QuestHarvest
[ERROR] ****/QuestHarvest.java:[70,28] cannot find symbol
symbol: variable Material
location: class deadlykill.toons.QuestHarvest
so where should i store this
in a .yml file?
nbt
im so confused rn
okay, i'm gonna give you a quick breakdown of DFU
?jd-s actually, you might be right
is it possible to use kyori text component to send players messages
i cannot find entity codecs
hm yeah
dfu isn't documented
gl
https://docs.fabricmc.net/develop/codecs fabric is usually helpful in those moments
so wtf do i do
there's a documented jd iirc
just save it normally in my own format or
how do dfus even work
^
like just saving dfus to a file and then turning it back into data?
with dfu you can save nbt to a file and deserialize it yes
https://github.com/IslandPractice/universes/blob/634c6f3448ba30c009af1bc0948a47cff446c706/src/main/kotlin/net/radstevee/universes/schematic/SchematicManager.kt#L134 take a look at how i'm doing it with my lib
encodeQuick and decodeQuick are extension functions: ```kt
/**
- Encodes to a dynamic ops format.
- Stolen from mcbrawls/codex
*/
fun <A, T> Encoder<A>.encodeQuick(ops: DynamicOps<T>, input: A): T? {
return encodeStart(ops, input).result().orElse(null)
}
/**
- Decodes from a dynamic ops format.
- Stolen from mcbrawls/codex
*/
fun <A, T> Decoder<A>.decodeQuick(ops: DynamicOps<T>, input: T): A? {
return parse(ops, input).result().orElse(null)
}
it's kotlin but you get the gist of it
So I need advise on something stupid
I got stuck with so easy thing I think
well so
PlayerInterectEvent gets called 2 times for main and offhand
for each hand once
now I got case that player is holding item named banana in both hands
I would like to execute code only on one hand
in that case
?interactevent
The PlayerInteractEvent may be called once per hand. If you only want code to be executed once, you can check the result of https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerInteractEvent.html#getHand(), then decide functionality.
For example, only executing code if the main hand was used:
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
if (event.getHand() != EquipmentSlot.HAND) { // * if the hand used is NOT the main hand:
return; // do not progress past this point |
}
// provide functionality
}
stop
take it slow
still explaning
but in case item is only present in offhand I was to be able to still exetute code
but priority would be main if item is in both hands
I got code which rund double
if same item is held in both hands
write a paragraph then
doing my best trying 🙂
so how would I prioritise executing coe only on main hand
you would have to do some sort of delayed runnable which keeps track of each event then executes accordingly
or use some sort of cooldown system
would probs be easier
yeah can literally be 1 tick if need be
yeah grate idea
works like charm
how to load a custom player skin if online mode is false
reflection? nms
where the skin comes from
you have to intercept the Player data packet and replace the skin data and signature
but it has to be a mojang encrypted one, can't just be a random b64 img
Isn't the skin in the player's metadata?
in their gameprofile, yes
oh dang when was that added
Where do we get the skin that the player created?
a while ago lol
mojang api
youe' r smart
mojang api???
is this a reference to my "you'e rnot"
yes it is lol
holy fucking shit
not in offline mode
Hello, is there event to check what item player put into Inventory?
thats how SkinRestorer does it
like pick up, or move from another inventory?
but this plugin add random skin
what are you trying to do
Well, there's a player's skin that he created and you need to display it.
in offline
not random
skins
like i said you can't just apply a random image to a skin, it has to be encoded through mojang's servers
Probably move? If u just take some item from inventory and put in another inventory and when that happens I want to trigger event
you can use something like https://mineskin.org
MineSkin.org allows you to generate skin texture data for Minecraft which is signed by Mojang.
declaration: package: org.bukkit.event.inventory, class: InventoryClickEvent
but there are many edge cases you will have to account for
yeah I try to debug that event but no luck when I put there item it didnt even run the event
that is, you need to use another source to store skins? How can I make the plugin understand that this player skin when he join?
maybe I am missing something
is it registered?
or this is impasoble
you only have to use it once then you can just use the signature and value over again
but it's impossible to convert a png to skin without using mojang servers
if (e.getInventory().getHolder() instanceof Upgrade) {
if (e.getClickedInventory().getHolder() instanceof Upgrade) {
if (e.getSlot() != 20) {
e.setCancelled(true);
} else {
if (!UpgradeTools.contains(e.getCurrentItem().getType())) { //I want to this work as put item event
e.setCancelled(true);
}
}
}
}
yeah


