#help-development
1 messages Β· Page 317 of 1
smh
ah yes, dying at age 16 instead of 80
I was looking at this exact code yesterday lol
no, I meant that you also age slower
do people who got birthday on feb 29th, celebrate on 1st march of 28th feb?
or do they only celebrate every 4 years?
except every 500 years
except every 4th 500th year
questions over questions
day before or after
but before brings bad luck
Well, using a site to do it manually.. Not sure if it is a great solution
Yea, not ideal, but it's better than nothing. NMS isn't well documented in the first place so I'm not surprised by the lack of conversion tools.
and with "isnt well documented", you mean "its not documented at all, and a huge mess" lol
?switchmappings
this might help you ^
It's gotten better. The mappings are one major step.
I mean, it's certainly a lot better than trying every single obfucsated .a() or .b() method and hoping it works.
yeah definitely
however there's one downside
when spigot used their own mappings, there were certain fields that was always the same
e.g. EntityPlayer.connection
so you could use the same code with reflection for 1.16, 1.15, 1.14
now it's either ServerPLayer.a or SefverPlayer.d or Server.f
ofc you can use mojang mappings but then you gotta reobfuscate for every single version
it would be nice if spigot would just use a remapped jar instead of reobfuscating
idk why they dont do it
See, that's why I avoided reflection for the most part. I kept finding that things were changing too much between versions so I switched to abstractions.
yes, ofc that's better
but the best idea would be that the actual spigot.jar would use mojang mappings internally
I thought that's what the spigot-remapped jar was at first.
paper e.g. has a feature in paper-dev or paperweight or however it's called, to do that
But apparently it wasn't.
hm no clue
also fuck mojang
why obfuscate if they release the mappings anyway
that's so pointless. Yes, it saves maybe 7mb of disk space
but who cares about 7mb
Legal licensing I guess?
Mojang could just release the server.jar unobfuscated and everyone would be fine
and then say "here you go, feel free to write plugins, but do not redistribute our own copyrighted code"
everyone would be happy
I mean, the EULA pretty much says that already.
They might as well at some point. They made the brigadier library open source. I don't see why they couldn't just do that with other parts of the game as well.
Brigadier its mess with its tree, literal, and that things
turns out my php.ini was reading from the wrong php.ini file lol
or well, getting overriden by one in a different location
This makes me wonder what the internal reason for not releasing the source would be
It's not like they are trying to prevent piracy you can get both client and server for free π€·π½ββοΈ
look at the diff
It makes me wonder too. I'm sure some license exists that would let them keep ownership of code. It's weird though since Brigadier is under the MIT License.
what about do what ever the fuck you want license
pretty close to WTFPL except its a bit nicer sounding for legal teams
I wonder if the MIT License could be classified as public domain.
i think only CC0 does that
Hmm @wet breach. I added a couple more hikari config settings and was able to reduce the number of leak connection errors. Granted, I don't really understand the full extent of what they do, but it used to spit out multiple errors and now it looks like it's just one.
config.addDataSourceProperty("useServerPrepStmts", true);
config.addDataSourceProperty("useLocalSessionState", true);
config.addDataSourceProperty("rewriteBatchedStatements", true);
config.addDataSourceProperty("cacheResultSetMetadata", true);
config.addDataSourceProperty("cacheServerConfiguration", true);
config.addDataSourceProperty("elideSetAutoCommits", true);
config.addDataSourceProperty("maintainTimeStats", false);
Those are additional. Before it was just
config.addDataSourceProperty("cachePrepStmts", "true");
config.addDataSourceProperty("prepStmtCacheSize", "250");
config.addDataSourceProperty("prepStmtCacheSqlLimit", "2048");
prepare statements isn't just a piece of code in Java, its part of the Driver API
Which seems to be standard.
they tend to be more optimal, and basically setting that option turns all statements into prepared statements
There is metadata in mysql, and basically caching that can help speed up future queries or subsequent ones
SetAutoCommits doesn't do anything unless you configured the DB to not use them or the server. By Default MySQL has it enabled so your setting doesn't do anything
not sure how many prepared statements you have
but I don't think you have 250 of them
How is that measured? Total in code or during runtime?
believe that would be total in code, and the sql one is the runtime
so one is the objects, the other is the actual queries
don't quote me on that lol, would have to look at the source code to verify
Hmm, so that leaves useLocalSessionState and rewriteBatchedStatements. The latter seems obvious enough, but what about the former?
how to get player nickname?
?jd-s
Look for Player class, and then you will have all the player properties, method names, what returns, what arguments they requiere, etc
Hi guys! I have a question related to the Spigot & Bungeecord development. Is there a fix in the works for CVE-2022-1471? I've seen that intellij was reporting that problem :p
the what now
is a vulnerability that allows malicious and arbitrary code execution through yaml files.
are you planning on replacing your yaml files with random ones you get from strangers containing cryptic content?
the fix is to use the SafeConstructor or whatever that is
ultimately it doesn't matter
and the only way for it to get in their if they dont is for a server admin/owner/dev to add it and then its on the end user
No, just wanted to make sure it'll include the fixes for people that might receive server setups and/or copy files from the internet.
it is not the duty of a group like spigot to protect you from yourself
xD yeah, I know, but it might be wise to help people. I wanted to know so I could create a PR for Bungee at least to help :p
it would also be wise for people to not download jars from random people as well
so anyways, I fail to see it being a vulnerability since said vulnerability mainly relies on the end user to perform
yeah I know. All I wanted to know if the developers were working on something for it or not. I wanted to help them
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
yeah, that's the main reason I was asking, it won't be useful to just re-create the work they're already doing π
make a pr that provides the relevant fix
thanks for the info anyway
if its of acceptable quality, odds are it just might get accepted
but yeah this is a vulnerability that really doesn't matter when we have things like reflection in Java
that do like worse things
Does anyone think they can help me with this error:
https://pastebin.com/VidW0nnv
probably the wrong version
its #help-development I presume it as their plugin ? 
is it not ?
oop
no I presume it is not
its kinda both
its a full client but there is a server plugin for added functionality
If I remember
Seems not I can;t see any DL for their API
its on github funnily enough
their website is terrible
yeah
For a full list of mods, visit our mods page. I can;t find a mods page
just the same crappy website
Lunar Client, the most popular all-in-one modpack for Minecraft, offers players a plethora of features from the countless mods, to boosted frames, and much more.
yeah, click that, it shows no mods list
oh right
Its really shity
hahaha
That why always Vanilla >> Every shity 3rd parties
You can use game rule
nah, i want code
π€
You can get the world, then get the game rules and set the ahivement game rule to false
Maybe there is one more efficient
Thanks man, you always supplying other helps i love that actitiue
I need some recomendations what would be the most efficient way for parsing my custom placeholders?
show code
I havent write so far
π
I was thining about using regex but i gived up
about what placeholders are we talking tho?
So far i think something like the next code, will be for simple text placeholders (they wont depend on the player)
Formatter format(String text, Object... args)
Im stuck inside the args part
Common ones like %prefix%, %rank%, %etc%
My goal is to pass something like:
Placeholders placeholders = plugin.getText().getPlaceholders();
String input = "Hello %name%, your age is %age%";
String formatted = placeholders.format(input, "name", "Test", "age", 16);
Im just strugging at the Placeholders#format(String, Object...) cuz i need keep each args, divided by 2
So the pattern is the next: ["var-1-name", "var-1-value", "var-2-name", "var-2-value", etc]
whats difficult about that?
Strugging because regex is not simply
π
and why would you use regex
All plugin use it internally, PlaceholderAPi, nMessage
im in a parsing mood so id just loop through the whole string, look for % signs
constructing a parameterized lang key or smth
Seems easy just match inside grouping symbol than loop through and replace the place holders
What do you mean with that
Sounds easy to say, not easy to apply
creating an object that wraps the string and has functionality to bind placeholders to it
No it's also fairly easy to apply
I need to get around to this smh
what even is a keymap?
Does the Spigot Forum have an API?
I wanted to make an integration with a bot for Discord, to deliver automatic roles to those who buy a premium plugin
Xenforo if im not wrong
Okay i would read about regex matchers
There is no need to use regex for this.
Hi. Is it intented for the bukkit package string minor version to not match the game's minor version? I'm running 1.19.3 but getting v1_19_R2
Yes
Yes
ok so some people said the session ID isn't sent to the server for security reasons (which is good) but i was browsing through mcp and found this in net.minecraft.client.Minecraft
Itβs the profile
oh my silly mind interpreted that as 2 arguments
declaration: package: org.bukkit, interface: Server
Not the token no
The token is just exchanged directly between user connection and api.mojang.com/sessions right? But never keep on sever
uh what
entrySet() only 1 param*
Link me the package for the properties class
also does anyone know how to properly load mcp in intelliJ so that pressing ctrl + P shows the definitions?
mcp? What that tho
MCP is the obfuscation maps for minecraft before mojang made public
JESUS FUCK
just need a way to iterate over the entries
iPhone Iβm done with your auto correct
hmm
Yep found something similar. Now using Bukkit#getVersion
idk its type or methods so i was just basing off what u sent
That should work
Bukkit.getVersion just calls server.getVersion :P
Ah, didnt see that π€£
yes he found that out lol
Is that a thing
.
Oh
Some splitting later, and I've got my major and minor versions working again :)
My bad
Oh ookk, i will base on that
Just example code
dam
might wanna do a better parsing than StringBuilder#indexOf but whatever
.replaceAll 
Oh really thanks fourten i will base on that
Only for regex is that method
replaceAll ir regex
.replace 
You didnt read my whole question, that why its important to read whole chat - not wondering to be rude
meh a properties object is threadsafe
couldve sworn there was some method in String class to do a non-regex replaceAll
this is gonna bug me now
replace replaces all occurrences
oh it is replace
im wondering why people havent made a better version of the String class
immutability ye but whatever
string utils class
wdym people
apache commons ig
idk just developers that thought, damn this impl sucks
sucks that it cant be extended on
I donβt think you can extend or modify the impl of String
one that doesnt need to mess with charsets and internal conversions before it can do anything
itβs final class no?
yeah u cant extend it 
kekw
wondering what would happen if you could actually extend it
string constant pool would probably break
NoCaseString extends String
The 8th constructor argument to PacketPlayOutRespawn in 1.19.2 was boolean keepAllPlayerData, this is in 1.19.3 byte dataToKeep. Is there any resource on what exactly this data is?
I'm assuming its bitflags, though
did you know that String.class.getClassLoader() is null?
is that the case for all java.lang classes
nailed me
Wat
wasnt sure about 'every class'
neither am i and i am in bed too lazy to get out and test
Oh right, forgot about wiki.vg. It lists a totally different number of variables though π€£
why are you in bed
just ate the fried rat
So looking at the source and mini's mappings, I'm guessing its a bitfield, setting it to 0xFF is probably fine, considering it's used to determine what playerdata is kept ( I think)
makes sense given that that class cannot really be loaded by a classloader
I believe there are like 100-ish classes that need to be initialized before anything can happen in the first place.
:o
Plenty of those probably aren't loaded by any classloader
they are just loaded by the system then
well JVM
What would be the best way to override a default crafting recipe? I know that I can loop through the iterator and make my own, but I saw somewhere that there are hidden recipes that then get ignored. I saw that you can do it through NMS, but the examples were out of date and I couldnt find the modern versions. What is the best way to replace the default crafting recipes?
The iterator or the events pertaining to the recipe Crafting events, smelting events etc.
the Bukkit.recipeIterator()
anyone know where the Start.java class is used? in src/minecraft/Start.java (found in MCP)
I was answering you.
then where are the arguments created?
Arguments are passed in the startup command
Start.java is probably Main
I injected into the players netty channels and tried to override PacketPlayOutNamedEntitySpawn to change how a player looks like into an entity and it worked! only 1 issue though
When you join the server or switch the world the player goes invisibile
instead of spawning
but when you change the render distance settings or walk around he'll be visible back
does anybody have an idea what could have happened there
Does anyone know if the playEffect for Step_Sound has like an initial delay or something? For some reason it always spawns the effect with a noticable small delay of a few ticks.
but arguments are passed to Start.java and I want to know where they're coming from
also I recompiled MCP where is the outputted jar
No clue. I haven't touched MCP in donkey's ages because modern tools like Forge and Fabric facilitate client modding
I don't even know what method you're referring to that accepts args. Is it a main method? If so, the args are probably passed to the program via the IDE
do u happen to remember where the output jar goes when you run recompile.bat in MCP?
also does anyone know where this is in the files?
Not quite sure what you're doing, just wanna throw in that it can help to have a copy of the source code available where you can just `grep -rni '<message>' .' in order to find where logs are produced.
i have MCP
if i have a server texture pack, is it possible to know when a player "finishes download/loading" the texture pack? because players get stuck mid air or can be attacked while they cant move at all in that process?
declaration: package: org.bukkit.event.player, class: PlayerResourcePackStatusEvent
is there a community around MCP no one seems to know how to properly recompile the jar and where the output file is
why would you need mcp
what the fuck is MCP that makes me think about Pocket Edition lol. If its some modding thing there is 0 reason not to use Forge or Fabric though
many thanks π
forge thing of mojang mappings
don't people use Yarn for modding?
now they do
well i found the output (MCP_FOLDER\jars\versions\VERSION\VERSION.jar)
but its not recompiling with my changes
where can i find people who know about mcp
why do you even need mcp
how else do u modify NMS for old versions
wanna know somethign really cool
all the docs on this
you modify spigot
client side
why though
spigot isn't a modding api
supported versions too recent i want 1.8.8
yup
you're lucky spigot is nice. I think those tryna support 1.8.8 still is dumb especially with mods
yay time to sudo apt update && sudo apt upgrade
especially if they use
git archive, work in untrusted repositories, or use Git GUI on Windows.
This likely doesn't affect a lot of people in this cord, but it's still good to be up to date just in case
Thanks o/
Last time I updated git was 16 months ago. π€ͺ

my git was 3 versions behind π i was on 3.4.1
may have forgot to add the git repository to my repositories lol
so if no one knows how MCP works how can I change the minecraft client side code? an example of a recompiled 1.8.9 jar would be forge
this has nothing to do with modding, 1.8 is heavily outdated and that just seems like a bad idea
A sane person would use Forge
but forge makes mods i want to change the actual jar
and the forge jar is obfuscated
i have an app called recaf
wait until you realise that mcp stands for mod coder pack
but it only works on non obfuscated jars
yes
Why? What are you changing?
I don't imagine there's much you can't do with Forge that you would need MCP
the difference is my mod would show up in the minecraft launcher
https://skyclient.co/ basically i want to recreate this
but with my own selection of mods
it shows up here
that looks like multimc
except it goes in the mc launcher
Is there a method to do this without having gay shit
Bukkit.getCommandMap().register(pluginName, command);
getCommand('command').setExecutor
- spigot always has a bunch of annoying things like that (ur lucky in this case as EpicEbic said)
- get cancelled for putting down gays
public static void registerCommand(String pluginName, BukkitCommand command) {
not sure how to do that with that tho
getCommand("commandName").setExecutor(new ClassThatExtendsCommandExecutor())
is that trying to shorten it into just registerCommand?
I can see that but how can I get the commandName from a BukkitCommand
Im porting a friends code
how do i stop creepers from exploding?
i mean, i would need them to stop even from doing the explosion animation
so i can't just cancel EntityExplodeEvent
probably some event named like onExplosion or something and then event.cancel();
have you never touched the spigot api
thanks
me?
bruh i just didn't find the event to cancel
chill
that was for yourboykyle
oh alr
i read nms more
so you should know the method name of a listener, does not matter
ok so i used this event but apparently he still does the animation and when it can't explode, he becomes basically obese
creeper becomes thick
im supposed to remember every event's name?
Can I use command.register?
well theres that and theres EntityExplodeEvent
you should have the name of the Command from the constructor, otherwise use getName
this one is even worse, it just cancels the explosion but the creeper still disappears and does damage
And how do I get the executor?
i dont think that u can cancel the creeper animation in normal spigot
if u used NMS probably
i think i may figured out a way
the executor would be the class that extends CommandExecutor
i could make that creepers can't target a player, basically they will never know a player is around them
just though about it at the moment
thanks anyway for the help, appreciate that
Hi, I noticed PlayerOutInfoPacket is no longer a thing in 1.19.3, is there a replacement for this one?
it works lmao
yeah can I get that from a BukkitCommand
check javadocs
Hi guys, please help with caching. Right now the caching works like this: player logged in - user retrieved and cached, player disconnected - removed from cache and updated in database. But I want to make it so that a user can be retrieved even if he is not on the server. I understand how to do this, I just need to check if the user is cached and return it, and if not, get it from the database and cache it, but the problem is different. I get users asynchronously, that is through the scheduler (?), so I have no idea how to implement this.
User result = cached.get(name);
if (result == null) {
/*
fetchUser(name, user -> {
if (user != null) cached.put(name, user);
});
*/
}
return cached.get(name); // <-- I don't think that it's a good idea
}```
Completeable futures
Hello
This is supposed to be split into multiple classes but I'm too lazy to do it
Oh, thank you so much!
how can I create a list for my custom config file?
Example:
CustomConfig.get().addDefault("CoolItem.lore[0]", "Example Lore");
// Exepected Outcome:
// CoolItem:
// lore:
// - 'Example Lore'
set CoolItem.lore to a list
How can I do that?
List<String> veryCoolList = new ArrayList<>();
veryCoolList.add("the imposter");
CustomConfig.get().set("CoolItem.lore", veryCoolList);
you shouldnt really need to use .addDefault
put the config.yml in resources and trigger saveDefaultConfig onEnable
But I'm using a custom config, not the DefaultConfig
I want to take a minute to appreciate that someone installed per world inventories, installed my plugin then left a 1 star review because they forgot they are using per world inventories and think I for some reason added that to my plugin
I rate that rating a 5/5
is it not a FileConfig
and there is still a way to do taht
link pls
saveResource
lmfaooo
?configs
See this wiki page on how to use custom configuration files: https://www.spigotmc.org/wiki/config-files/
boom
Yes it's a FileConfig, but I don't think you can use saveDefaultConfig with custom config files
I've just been having some very inspired reviews
you just make the method manually
look on here, scroll all the way down
saveResource
nty
Thanks again, that helped me a lot! But as far as I understand, I can use CompletableFuture there instead of additional Callback class, right?
yep
i made that callback class before i knew abt completable futures
oh
you can construct a new CompletableFuture and call future.complete if you already have the dat a cached
Ooh, okay, thanks!
This way of declaring my array makes it more readable and how I wanted it in the first place
List<String> lore = Arrays.asList("Cool lore, line 1", "Cool lore line2");
// Output:
// lore:
// - 'Cool lore, line 1'
// - 'Cool lore lin2'
Thatβs fine.
Set<BukkitTask> tasks = Collections.newSetFromMap(new WeakHashMap<>());
this should be safe right?
mye
ty
Is it possible, when prompted to give a path to a yaml file, to specify the whole file?
Example:
String[] mystrs = config.get().getStringList("All file");
// Would return a list of all strings in a list
this makes no sense
getStringList returns a string list from your config
you cannot save it as a single string
nvm
and what does this have to do with a path to a file?
can you show your config file? maybe this helps us understanding in what you're trying to do
well you need to specify a path
Cool_Item:
name: "&9DIamond sword"
lore:
- "&7Diamond sword"
That function would return an array with {"&9DIamond sword", "&7Diamond sword"}
uhm I still don't really understand what you're trying to do
ig get every string entry in yaml config
is anyone can help me
no
yes
01:52:38 [INFO] [/66.181.184.88:25126] <-> InitialHandler has connected
01:52:42 [INFO] [VPN Killer] - AkaMN - Passed Checked
01:52:42 [WARNING] Plugin listener esas.vpnkiller.features took 3,692ms to process event PreLoginEvent(cancelled=false, cancelReasonComponents=null, connection=[AkaMN,/66.181.184.88:25126] <-> InitialHandler)!
01:52:42 [WARNING] Event PreLoginEvent(cancelled=false, cancelReasonComponents=null, connection=[AkaMN,/66.181.184.88:25126] <-> InitialHandler) took 3,693ms to process!
01:52:47 [INFO] [AkaMN] disconnected with: Could not connect to a default or fallback server. Incorrectly configured address/port/firewall? io.netty.channel.ConnectTimeoutException
01:52:47 [INFO] [AkaMN] -> UpstreamBridge has disconnected
ConfigurationSection::getValues where deep=true for the first parameter
Thanks I'll try it
Why on bukkittasks tho
You donβt need it
?
oh
so
I have a bunch of tasks that I'm creating that I want to ensure are cancelled. I don't know how many tasks there will be and I don't want to have to remove the task from the map everytime the task is cancelled (or if it's a delayed task when it's ran)
basically i wanna be able to create and forget abt the tasks
and when im ready to clean them up, just check the set and cancel all
Hey! Can I get pointed towards some resources to understand and develop my own framework to facilitate plug-in dev in the future.
what do you need to know about specifically?
are you looking for knowledge on an API plugin or just something to shade in
I want to understand what a framework is, how it works to facilitate plugin dev, how to include it seemingly into your plugin and that type of stuff
I don't think any plugin frameworks exist, but if you just want to throw a library together I could help you with that
I myself have never made a framework
Well if you donβt mind us typing for a sec
Whatβs the difference between a framework and a library then?
Why do some people call it framework ( custom and private modtly ) and does it work in the same way than a library would then do?
Iβll get to reading. Give me a few
this is in java script, but similar concepts apply
Great, appreciate it
So letβs say, @river oracle . If I wanna make something that assists me in the making of, for example, GUI elements, including acciΓ³n buttons, items, positioning, etc. that would refer to a library no?
firstly you have to kind of know what you want to make, but you can simply make a new maven project than deploy it to a repository service like, reposilite, nexus (both locally hosted)
I have an example on my github
one second
Ok great thatβs perfect first steps
But letβs surround this example in the following as an example
Something that allows
- easier GUI creation
- easier command registration
- easier SQL management
How would one approach that
open a new java project and get cracking. Organize it how you please
Not what I meant
I meant, the process of creating a library, how do you make something that facilitates that type of stuff, for example I saw 1 framework which made adding commands easier by the usage of annotations. I just canβt understand how something I make like that can be implemented inside another project
maven shade / gradle shadow plugin
allow inclusion of other projects uploaded to repository hosting services
that's all that is really going on behind the scenes
if you want to learn how to use Annotations take a look at how to parse them with Reflection
When you add library to another project, you are basically making all that library code appearing inside of that project jar
Just to clarify a library is like very similar to an API right?
If not the same thing
API is just an interface of code
Api has like a much wider spectar
you'd be looking to make a Library though
Now Iβm more interested in understanding
so don't worry about the buzz words
How does a library help simplify stuff
Like, how does one separate the functionality into a library
How Can making a library make is easier adding a commands
all a library did is a massive colleciton of utilities and pieces of code that you can reuse across projects
so instead of copy and pasting you write it once
This means, if I didnβt read incorrectly
That a great high level of abstraction is required
yes libraries require higher levels of abstraction because its for many projects to implement not just one
Ok that helps
So letβs say I wanna simplify the commands things, instead of making the whole method blablsbla
just take a look at what i do
I use my library to make a high level abstraction, add all the checks in there
here is what I do for commands
Reading it right now
note I don't use annotations
I hate annotation command frameworks
why
its personal
I prefer flexability and usually I have my command stuff in yml files for owner to decide most of the shit
Holy shit so many words in that file itβs confusing
Can you show me
An example how you would implement
That, registerSubCommand method
however ACF also allows to do that π
@CommandAlias("@listCOmmand")
public void onListCOmmand(...)
then you can declare what listCOmmand is
i mean I like what I got going no reason for me to learn acf If It ever really offers anything I'm desperate for I will switch
@river oracle Explain something as well, trying to understand how it all connects.
How does simply adding the command to the Map<String, Command> actually do anything at all?
My stuff is like
public class ThingCommand extends Command {
public ThingCommand(){
super(new Label("thing", "thing.admin", new String[]{"things", "thangs"}
}
}
thats my sub commands
its called in the native executor
if you want to see where I convert to Bukkit you need to look at MegumiCommandBridge.java
Holy crap thatβs a lot of stuff I donβt understand
Clearly I got a lot to learn
though as @tender shard if you want a nice command library without hastle just use ACF I'm sure enough people here use it to help you
also ACF has an array of features that could take a while to implement / perfect yourself
I see
if ACF isn't your cup of tea you can always look at Lamp which is another impressive and nice command framework
Alright alright enough of libraries
Now I have another question
Sorry if Iβm asking too much
Gave that a look seems pretty cool itself
Some days ago we were fixing maven stuff here and someone said
βYou do not wanna shade vaultβ
ACF is probably the best command framework
Yes
that is correct
I understand what shade is
true, you really dont want that lol
no reason to shade vault
Vault is a standalone plugin
Do not shade a lib that is standalone
You donβt shade protcollib either for example
What happens if you do shade vault? Nothing unless the server you shade it on installs the plug-in as well?
Think of it this way.
Shade if... When you boot up the server you have no other access to that code. E.g. no server jar, no libraries folder, no plugins folder.
Do not shade if... You have access to the code through the Plugins Folder, Libraries Folder, or Server Jar
Shading libraries you don't need to shade will end up causing Class Not Def Found errors and stuff won't be set up correctly
then you will just get errors about it not being initialized, stuff being null, etc
Ok exactly what I thought
What happens if
2 different plugins
Shade the same lib
that's no problem
nothing happens because they are working off completely different code
Nothing if its same and compatible version
We use relocation for that @regal scaffold
shading basically means you copy/paste the code of what you shade into your own project
It can be
But then shading isnβt meant to not have users install dependencies right?
But there might be some problems with different versions, where you have to relocate
Cause it could cause issues
it usually isn't though since every plugin has their own class path
Just relocate to be safe, plus itβs easy
yes
I'd always relocate. but in modern spigot versions, it should work fine even without relocating
it should work fine, at least
Technically couldnβt I shade a random plugin that I use as dependency and it would work in most cases without needing to install that dependency jar in the plugins folder?
I've never had issues with not relocating my lib
no
you cannot shade "plugins"
is it possible to have a final Inventory in my InventoryHolder implementation? I'm asking because Bukkit.createInventory takes an InventoryHolder...
the server wouldnt load them
you can shade libraries and stuff, but not a complete plugin
Spigot does not support jar-in-jar, unlike Fabric
Gotchaaaa
You can include them as a resource and then unpack it and enable it. But not shade it
And last question for now, Iβve actually learned so much more
no
That would be like forcing a dependency right?
sadge
just make it non-final
oh wait
you can
easily
oh no wait, I'm mistaken
you cant, I guess
Thereβs no need to do what heβs asking
yeah it doesnt matter whether sth's final or not
Why could I be having issues adding https://github.com/ScreamingSandals/SimpleInventories as a dependency
As in maven
Just doesnβt find it
Ignore the provided, itβs set to compile
?di
Guide to dependency injection: https://www.spigotmc.org/wiki/using-dependency-injection/
^for a spigot forum post
Itβs not related to that, itβs on why I wouldnβt be able to find the plug-in on the repo
did you add the repo?
?paste your pom please
it seems like their repositry URL is broken
<repository>
<id>sandals-releases</id>
<name>ScreamingSandals Repository</name>
<url>https://repo.screamingsandals.org/releases</url>
</repository>
you gotta add /releases to the repo url
Alright let me try that
<dependency>
<groupId>org.screamingsandals.simpleinventories</groupId>
<artifactId>SimpleInventories-Core</artifactId>
<version>1.0.6.7</version>
</dependency>
that's the only thing they have in their repo that's named like "simpleinventories"
if you wanna go for version2, this is the latest:
<dependency>
<groupId>org.screamingsandals.simpleinventories</groupId>
<artifactId>core-bukkit</artifactId>
<version>2.0.2-SNAPSHOT</version>
</dependency>
<repository>
<id>sandals</id>
<name>ScreamingSandals Repository</name>
<url>https://repo.screamingsandals.org/snapshots</url>
</repository>
yeah their repos are very weird
Wtf that changed a lot
for version 1.X you need the "releases" repo, for 2.X-SNAPSHOT you need the snapshots repo
I couldnβt find that on their github
it's called investigation
I just opened the repo link from the github and searched through it
Public Maven repository hosted through the Reposilite
here ^
np
reposilite :)
nexus >
you can however also always just clone the current github repo of that plugin/library, and then do mvn install, then you got the latest version in your repo @regal scaffold
I've hosted both, while nexus is definitely more configurable, reposilite is much nicer looking, loads quicker, and takes up much less memory
O.o
I guess a benefit of nexus is that you can host more than just a maven2 repository, but like... who actually does that
Might use that method
true, true, but nexus is the go-to if you want to have roles/permissions and stuff
yep, can agree with that
- clone the repo to some directory
- run "gradlew publishToMavenLocal"
then you got it in your local repo
On windows but thanks
Lol @tender shard
Because Iβm on mobile I actually didnβt even want to download that one
I got lost in my tabs
Still trying to decide which framework is best for gui
Comparing options on mobile is terrible tho
I need the ability to allow users to add items in a specific slot as well as typical other features
I found one but itβs lost in my tabs and no chance of finding it so going through them again
swing
oh wait, you are talking about minecraft ingame guis
lol
sorry
Lmaooo
yeah sorry I'm currently writing a GUI desktop so yeah
which version are you using?
When I do GUIs, I usually just add a "tag" to clickable items using pdc, e.g. "action" -> "nextPage", then in InventoryClickEvent I check for that action adn then do the appropriate stuff
Version of what exactly? The problem I have is most API donβt let me access the slot where I need the user to be able to drop an item and then get what that item is
version of spigot api
nope. I do GUIs the old school way, e.g. here https://github.com/JEFF-Media-GbR/ChestSort/blob/master/src/main/java/de/jeff_media/chestsort/gui/NewUI.java
Thatβs suffering tho
and the config then looks like this https://github.com/JEFF-Media-GbR/ChestSort/blob/master/src/main/resources/gui.yml
yes it is
but I didnt find any GUI framework that I like
Man I just need to find the 1 I saw earlier
That allowed me to have a slot
For the player to add items there and then Iβll just not use the library to get what the item is
have you checked the spigotmc resource list?
Yes those are the ones I checked
ah ok
Pretty sure itβs one of those
I checked it
(out of that list)
Doesnβt allow it
sad
you could pull request it lol
OH DAMN ALMOST 6am, that means I can go take a bath in one minute
I am trying to make an animation of a falling object (small structure composed of multiple blocks) is my best bet to use a schematic and repaste it a bunch?
If you see this
Without api knowledge
It should be possible to interact with the lore property after itβs been created
Technically and very broad
Like letβs say you wanna change that lore later, the api shouldnβt technically matter to access that property, right?
What would you guys say is the most efficient way to store locations so I can find the closest one the fastest?
I have some special blocks saved in cache, and when an item is dropped, I need to find the closest of those blocks within a set distance
Right now Iβm saving those blocks mapped to their chunk, that way I only need to check a few chunks within the distance, but maybe there is a better method?
I thought about using a TreeMap, but how would I compare locations?
u know... u can just.. take a screenshot
I dont really understand this question, sorry
I think they only use discord on the phone and code on an ipad or sth
How many locations are we talking about?
300+ spread all over the world
And do you care about exact location or just block locations (like, doubles, or just ints)!
Thats NOTHING
Just block locations
But I need to find the closest position hundreds of times per tick
You should start to worry if you got a hundred thousand locations. Everything less, do it however you like
No it creates lag
Finding that nearest block
Then you are probably accidentally loading chunks
No I use my own class with just the coordinates
What exactly are you trying to achieve?
Itβs just the algorithm on finding the closest location, because for a 15 block distance you have 9 get calls in the HashMap + x comparisons to find the smallest distance from those within those chunks
So thatβs at least 20 calls per dropped item, which could easily add up to 1000 per tick
What locations do you actually need to find?
You could take a look on how NMS does it
Of some placed special blocks
Eg sheep going to grass blocks
One sec
Check out the MoveToBlockGoal from nms
Do you actually need to recalculate your stuff on every tick?
Wouldnt once per second be enough or sth?
You can btw also do it async using ChunkSnapshots
Ofc you gotta refresh those from time to time, but as said - what do you need it for?
Itβs called whenever an item drops, because I need to cancel the drop if there is such a block nearby
Yeah
Yeah thatβs what I currently have
Map<Chunk, List<Location>>
Itβs way faster than a pure List, but still not as fast as I would like it to be
Btw tiny tip; nested collections are nasty. Rather create a new class called ChunkLocationList that implements Map<Chunk, List<Location>>
Nested generics are always nasty, thats why nasty and nested sound so similar
A TreeMap could drastically reduce the get calls needed, if I found a good way to sort locations
I was thinking about using the distance from the world origin as the comparator
distanceSquared in this case please
I still dont know what your plugin does, so its hard to think of better alternatives :p
There are just special blocks you can place which pick up dropped items
hoppers 
You could just make smaller chunks like 4x4
And multiple chunks point to the same βspecial blockβ
It depends how many special blocks you have and their range
Wouldnβt that make it worse
Because it would take more get calls in the Map
anyone know of a plugin or method to make a server joinable via eaglercraft. its 1.8.8 in the browser and you could maybe use via version?
Does any of you know a registration plugin which when you log in to a website is automatically written to the whritelist then to say use wordpress
Can someone give me an example how to spawn redstone particle? I'm struggling on blockdata
int count = 2;
Color particleColor = Color.BLUE;
float size = 0.3f;
world.spawnParticle(Particle.REDSTONE, location, count, new Particle.DustOptions(particleColor , size));```
thanks
Hello, i'm trying to make a bow which fire two arrows. But the second arrow trigger the events too and so it fire arrow endlessly.
I have try to store data in the arrow and to store the arrow inside an array but it seems it dont work.
@EventHandler
private void onUseBow(ProjectileLaunchEvent event){
if(!(event.getEntity() instanceof Arrow)) return;
if(arrows.contains(event.getEntity())){
arrows.remove(event.getEntity());
return;
}
if(!(event.getEntity().getShooter() instanceof Player)) return;
Player player = (Player) event.getEntity().getShooter();
ItemStack itemStack = player.getInventory().getItemInMainHand();
if(itemStack == null || !itemStack.hasItemMeta() || !itemStack.getItemMeta().getPersistentDataContainer().has(new NamespacedKey(Main.instance, "TYPE_CHROMATIN"), PersistentDataType.STRING) ||
!itemStack.getItemMeta().getPersistentDataContainer().get(new NamespacedKey(Main.instance, "TYPE_CHROMATIN"), PersistentDataType.STRING).equals("BOW")) return;
Bukkit.getScheduler().scheduleSyncDelayedTask(Main.instance, new Runnable() {
@Override
public void run() {
arrows.add(player.launchProjectile(Arrow.class, event.getEntity().getVelocity()));
}
},5L);
}```
Don't store the arrows velocity
That changes
Oh wait
Nvm
I'm on mobile read your code wrong
Oh okay !
An easy way to do it instead of having a collection is to just have a boolean
Called isArrowBeingFired
I found a sort of work arround
If i spawn the arrow as an entity and set the player, velocity, ... later it works
And you solution dont work if two player use the bow at the same time.
Or i would need to use an HashMap to store one boolean for each player
Minecraft is single threaded
Evem if 2 players use the bow at the same time, it's processed at different times
Try my solution
No i mean redstone block's crack particle
Yours doesn't work because projectilelaunch event is called before the arrow is returned to be added to the set
Yeah but first player would use an arrow, boolean is set to false the second use the bow the boolean is set to true it doesnt launch a second arrow
and the first would have the second arrow launch a third arrow
It works because minecraft is single tjreaded
Try my solution
The second arrow is delayed so it still have a 15 tick gap
Yes
That's why you set to true in the runnable
Before you launch the arrow
Then set to false if it's true in projectilelaunch event
You don't even have to set to false in projectile launch event
You can do like
IsArrowBeingFired = true;
launchArrow()
IsArrowBeingFired = false;
yeah i see now
Actually this looks better
Do this
yeah but it wouldnt work anymore if i add more arrows
Sure it would
If you do it like this
Fire as many arrows as you'd like between setting it to true and then to false
If it's true in the listener, don't set it to false just return
Either you do it like that or you use a counter. Anytime it is a 0 fire 2. If its 1 just return and reset counter back to 0.
Dont need anything complex to solve this problem π
Hello. I'm working on updating my plugin for 1.19.3 from 1.19.2, but noticed PacketPlayOutPlayerInfo has been removed. Is there a suitable replacement for this one?
I presume spigot has it under Mojang names now?
The concept of the packet still exists
Thats what I thought too, and I came accross ClientboundPlayerInfoRemovePacket, but it doesn't yield the same result (refreshing the skin)
Yeah that's the remove packet
Oops, ment to paste ClientboundPlayerInfoUpdatePacket
Yep sending those two, but yet I end up with a Steve skin, rather than the set skin (which is visible for other players)
I do believe so, using the constructor (EnumSet arg0, Collection arg1) , the EnumSet containing 1 action: ADD_PLAYER, the Collection containing the EntityPlayer
I've tried the static method createPlayerInitializing as well
Thats what I was hoping yeah. First sending the remove packet followed by the add packet yields a default skin though
Curious if the original Info packet was split out further than just the new remove and info update packets
no
game profile is synced with the ADD_PLAYER action
which is the part that holds the skin
And that is why I'm so hopelessly lost π€£
I set the skin data on the game profile, send a infoRemove, infoUpdate, respawn, experience, position and finally a heldItemSlot packet
Need to update the tab list too
Which is what clients primarily use to obtain information in how to display other players on the client
Is that used for the self player too? As from the perspective of another player things do work
Not entirely sure lol
But worth checking out
Typically that is all you really needed to mess with other then updating game profile
Shouldnt the info update packet also update the tab list? According to wiki.vg anyways
Well could have changed recently. Havent messed with 1.19 series yet
I don't think so actually π€ since the self player doesn't show up on the tab list
Fair
Interesting, looking at the client logs:
Ignoring player info update for unknown player d8a083de-0ed6-4cba-ad50-1c5887365a92
Yet printing the players UUID on the server does yield that UUID
Well try sending a tablist packet with updated info
Interesting it says unkown player lol
Okay uhm, I think I might declare myself stupid
my packet abstractions implement a Packet interface. That interface has a send method implemented in the interface, and an Object getInner to get the actual nms object
as my packet abstractions are just record PacketName(Object inner)
so I had this:
public record ClientboundPlayerInfoUpdatePacket(Object inner) implements Packet {
@Override
public Object getInner() {
return null;
}
}
Spot the problem? π€£
Nice one
Time to add an Objects#requireNonNull in the Packet π
Dont recommend that
Do tell?
record Packet(Object getInner) π¨βπ¦°
An if clause with a warning might be better, even though the error is most likely to be caught in development
hm?
Only use that if it is an api and you are imolementing thus in control to detect nullness. If you use that on something that can be null it will throw an error that is different and not make it obvious that the object is null when you stated to the jvm it cant be null
Lets say i have a strider
Entity strider = ...
how do i give it a sattle?
Need to get a valid instance of an entity that is spawned
Entity strider = Bukkit.getWorld("testw").spawnEntity(toSpawn, EntityType.STRIDER);
is that valid enough?
Not sure if that works. Anyways, it should be a matter of setequipment
There is
The strider is a steerable entity
declaration: package: org.bukkit.entity, interface: Strider
which entity are you importing?
Also instead of using base entity, why not use stryder object
^^ also use the spawn method that takes a consumer
Oh olivo beat me
yea i need the org.bukkit.entity.Strider
declaration: package: org.bukkit, interface: RegionAccessor
You should always use the appropriate entity object. Cast when you need more generic object. Or you can cast up but that is just more work lol
This give the right object and it also allows you to modify the entity before it's spawned
thanks
HashMaps are O(1), it would just require more memory
in the best case they are
Yeah, but thereβs no key I can use to directly get the closest block
Does someone know if there is a swimspeed function for 1.12.2?
Because i cant find it.
So I have so cal get() for all chunks in range, collect all blocks from the value list and then iterate over all of them to find the closest
and how do i put the player onto the strider then?
i teleported after that π
why am i getting the usages annotations?
its intellij, it shows how many times that variable is used in your code
right click them to hide it
nice, thank you π
whats the best way to run code when an object is garbage collected? i know about Object#finalize() but ive seen Java internals use like a Cleaner class or something which seems like it may have to do something with it
well when its about to be collected
?xy
Asking about your attempted solution rather than your actual problem
i need to free some off heap memory when the OffHeapStack gets collected
Guys, help, what can I do about it?
ill just use finalize, prob wont be collected often anyways
so if it works its fine
Does someone know if there is a swimspeed function for 1.12.2?
Because the swimmingspeed functions for newer versoind doesnt exist in 1.12.2
iirc swimming got added in 1.13
Open the javadocs and see why it was deprecated mister
unless you use mods
@glossy venture @remote swallow You have always been able to swim, just not the new swimming way.
well yeah
I am sure heβs just asking about increasing his speed in water
But isnt it possible to change swimming speed in the old version then?
Not in the api i think.
Yes, I have already read it, but I do not know where to find the NamespacedKey list for my case
dont think it is without manually modifying velocity or smth
Alt + left mouse click on getbyname
Hmm yea i will try with velocity, thanks!
multiply the added player movement velocity by your speed muliplier when a player is trying to move ig
what should happen?
though idk if that can be done with just PlayerMoveEvent might have to listen for packets
If you pay for plugin, you probably want to ask plugin dev
It should open the class with the name the statics at top and their namespacedkey
i have this https://www.spigotmc.org/resources/3715/
and the problem is "Databased"
i don't know how to make it
here is more to webpage
ask in this discord https://discord.com/invite/axzSDsDpHn
Object finalization is deprecated and set for removal in the very near future. You should avoid its use and opt for alternatives like Cleaner. See the deprecation notice on https://docs.oracle.com/en/java/javase/19/docs/api/java.base/java/lang/Object.html#finalize() and the deprecation JEP which discusses alternatives (including Cleaner) https://openjdk.org/jeps/421
Nothing happened, but I have already found a topic on the forum about this, thank you
aight thanks
so the Cleaner class is related