#help-development
1 messages · Page 1174 of 1
you meant the position in invernetory?
when asking for help you need to clarify the issue properly
@chrome beacon ?
setDefaults I believe
but i didnt use it, u Just did save default config method at the on enable
but then i tried to acces something which i deleted and there was the value
hypixel pit questionmark
maybe i missed something?
so save default config Just saves the config from jar to the folder if its not already there?
i mean it is not bad for starter project
I believe so
Though it's been quite a while since I last used that part of the api
Player#teleport, don't set the values of the location
what about for respawn?
there's a respawn event
i did setrespawnlocation
but it doesn;t work
player.teleport(mark) works
but event.getplayer().setrespawnlocation(mark);
does not work
umm... it reads from the default config
even though i deleted all contents in config
no, set the location in the PlayerSpawnLocationEvent or whatever
alright then
You can just define your own config
instead of using the builtin getConfig
?configs
See this wiki page on how to use custom configuration files: https://www.spigotmc.org/wiki/config-files/
public void onspawn(PlayerSpawnLocationEvent event) {
event.getPlayer().setRespawnLocation(whatever);
}
like this?/
or should i just teleport them
Well, yeah, use the event's setRespawnLocation(), not the player's
event.setSpawnLocation(whatever)
why does the BuildTools download PortableGit even though I have git installed?
Git might not be in your path so it can't find it
it should be, I can use it in my console just fine đ€
is that even the correct spot it should point to?
I think it actually downloads PortableGit for me as well even though I very much have git installed
Lemme rerun BT to double check that. I just assumed it always used PG
Nah seems fine. Didn't download. The PG folder I had in the BT directory was from 2022 so maybe it just always downloaded in an older version. Seems to be using my Git for Windows version now
hm thats weird, I always noticed that it downloads pg even though I have git
never bothered until today, after downloading BuildTools again
which path does it check?
its closed source right?
It looks on your Path. Though I'm not sure why your path is set to Git\cmd. Mine is set to Git\bin
I guess ultimately it doesn't matter. There are git programs in both directories
?stash And no, BuildTools is open source on the stash as well
hm thats what the git installation did đ€
pretty weird, thanks for the help
going to check the code and probably end up changing the path ig
but why there is no information, no where, about for example the reload method, that you have to reload to like, get the config from file to jar, then edit it and save to file again, is it obvious? because i dont get these things and cant learn
Not sure I understand. Are you wanting to add your own reloadConfig() method?
Because all that does is call YamlConfiguration#loadConfig() again
hm it doesnt even check, it simply tries to run and installs PG on any exception:
try
{
runProcess( CWD, "sh", "-c", "exit" );
} catch ( Exception ex )
{
// ...
}
well
this is weird
it doesnt have sh which is indeed in the Git\bin directory but not in Git\cmd
no idea if this might be unintended
no, sorry
i give up
sh -c exit is crazy
Hi, can someone help me? I Have plugin named brewery And i want to sell these items. Is there any way to put these items into ShopGUIplus?
Like Custom items with Custom nbt tags
That sounds like a question you should be asking the ShopGUIPlus developers about
I'm sure they have a support Discord or something to that effect
cc @frozen dust because it's been a few hours
i'm setting up an ssl certificate for a websocket to connect to a website, and i'm getting this error that a tag number over 30 is not supported. i'm honestly not sure what this is referring to. can anyone help?
error: https://paste.md-5.net/ukisomomux.md (my keystore is in the jks format)
usually means corrupted/empty keystore
sorry, what are you trying to do here? the whole convo seems to be cut up into various discussions lol
trying to set their respawn to a certian cord
(trying to set it to the hub at the start but when i die i end up somewhere on top of it)
you'd have to set the respawn location in the PlayerRespawnEvent
though if it is obstructed by something (like the carpet, for example), it may refuse to respawn there
huh, i followed this to generate the keystore https://www.jetbrains.com/help/space/ssl-keystores.html#generate-keystore-file
i'm pretty sure it's not corrupt
did you try open it with kleopatra or something
respawn event, not death event
i just looked at the data via terminal
did you convert from this format to jks?
i did try that before to see if it was the issue and i got the same error
try generating your keystore with keytool instead, which will directly generate the JKS keystore
whatever format you've converted from doesn't seem to be well-supported within the Java Keystore API
i did this too lmao, same error
seemed to work fine for me
didn't use websockets because it'd have required a library but essentially the same deal
ahh it worked, thank you so much!!
i think it's because i didn't do the second -exportcert
uhh, that one was just to test something different from what's in the screenshot, I was going to import it into the trust manager
but if it worked, then all is good
o
then maybe not
i have no clue why it didn't work the first time then, odd
but if it works it works
that cert you're supposed to import wherever you are supposed to accept the websockets so that they can trust your TLS connection
ah, okay
keytool -importcert -file websocket.crt -alias mycert -keystore "$JAVA_HOME/lib/security/cacerts" -storepass whatever for reference
you can also do it programatically but it is easier this way
do it one tick later
also dont set the respawn location, just directly teleport them
but its not even doing my system.out.printin
I have a friend accept command
but I want it to be able to work network wide
so how should I get a uuid from a player network wide
either get all players on every server and find the player and then get uuid
or do I save the name to the friend requests database
or do I lookup the uuid from the name every time using api
don't you already have a cross-server communication thing setup
or was it another person who was doing that
if you don't, you can use plugin messages for that kind of thing
if you want it work even when players are offline then it'll be trickier though
yeah I do but its so fucking annoying
like I dont want to write up a whole
get player packet
and handler
and all this shit
so I just decided to save the player's name to the database when the request is sent
also whats with this 15 more shit I cant even see the error
I noticed when compiling a plugin with 1.21.3, I get this in older versions now. Any way of reflecting for older versions?
java.lang.IncompatibleClassChangeError: Method 'org.bukkit.Sound org.bukkit.Sound.valueOf(java.lang.String)' must be Methodref constant
When you want to target older versions use the api for the oldest version
No exceptions
Otherwise going forward you'll be using so much reflection you might as well just class for name everything kekw
If only the plugin wasn't using 2 year old code. Don't really have time to write it to where it only targets newer versions
useful as some servers are still stuck on 1.21.1
plus figured it out
this works i guess if someone else runs into the issue đ
public static Sound valueOf(String soundName) {
Method method = Sound.class.getMethod("valueOf", String.class);
return (Sound) method.invoke(null, soundName);
}
how can i throw an exploding tnt
on command
world.spawnEntity(Location,EntityType.PRIMED_TNT)
this spawns it
but how can i give it a velocity?
player.getWorld().spawnEntity(player.getLocation(), EntityType.PRIMED_TNT);
i mean this spawns tnt
but how do i set the tnt velocity
like if the player runs the command
a tnt should shoot out
is there a good wiki where I can find all the stuff like event listeners etc in one place?
having trouble finding an equivalent to the fabric wiki
a javadoc is very helpful, but is there a more traditional wiki with steps anywhere?
stuff like how to make a command etc
?wiki
player.launchProjectile(Snowball.class).setVelocity(new Vector(1,1,1));
chat i cant figure out anything like explodingtnt.class
this already return your spawned entity, in this case the tnt
TNTPrimed tnt = (TNTPrimed) player.getWorld().spawn(player.getLocation(), TNTPrimed.class);
tnt.setVelocity(player.getEyeLocation().getDirection().normalize().multiply(4));
so you can easily set it's velocity like you would for any other entity
i see
is there a way to get the velocity of an arrow that a player shoots out from a bow?
Oh Okay thanks for help
what ive been working on
You can make the item names non-italic using the reset color code if you want
I see
Do you know if itâs possible to give the item an enchanted look without giving it a real enchantment?
Like I wanna give it the look but I donât want players to seee the enchant
On newer versions there is a component that does that, on older versions you would give it something that doesn't affect it (e.g. aqua affinity to a sword) and hide it using the hide enchants iten flag
does any1 know how do i make the kb/pvp of my spigot srvr like bedrock plz
try OldCombatMechanics plugin
Thx man appreciate it
lol 1 day ago this plugin was throwing me nullpointers, I better report them the issue
I want to make a Consumer, save it into a file somehow, then load the consumer from the file in my plugin and execute the code in it. How?
How to make people able to import win animations
you should use a format that the animation can be saved in
also wth is a win animation
do you have examples of consumers you would want to save?
Fortnite dances
Mostly just particles
Imagine block schockwave
okay
any code examples?
like ideally for this kind of thing you would have to make your own format or reuse someone elses and then save the data to json or whatever
imagine a one liner that shows particles
That would be pretty limiting
i cant imagine
Load them from blockbench animations
Who are blockbench animations
i made enchanted item for my crate and I no longer have access to the reward menu
Can you imagine code that generates a shockwave from block displays that moves away from the player?
Im pretty sure thats #help-server
well if its one line you can write the parameters in a json file
how is that limiting
I was giving you the simplest example
You canât really serialize code and load it later
Now imagine you wanna make the player ride an ender dragon
Well you can but itâs complicated
I was told you can serialize lambdas?
You need to make some sort of scripting system for your win animations
Hardcoding animations boutta be crazy đ„
... is that the way to serialize code
Code resides in classes and to access a class it has to be loaded into your classpath, so saving and loading classes at runtime is not simple
you dont serailize code you serialize data to replicate the same behavior of the code
Ive heard of a plugin that accepts jar files for abilities
I guess that works?
its what I am trying to suggest
Wb soft dependencies then
create a format that can store any way you can make those animations and then load them from the file when you wanna play it
all pre compiled and loaded into the classloader
Okay that actually makes sense ig
whats the use of having custom animations if you have to hardcode them in
like what is the point of saving a consumer
The idea was for me not to have to hardcode them in
that consumer is just code thats written by you already, no need to save anything
okay then it would be a good idea to start thinking about how you do wanna program the animations then
because serializing consumers to a file sounds like hardcoding to me
How
Blockbench wonât be enough if you want fancy stuff like riding an enderdragon
Youâll need a custom scripting system
sounds like they just want a particle system
Did some one say action config lib
I was giving you a simple example
implement lua
right now noone here knows what your usecase even is
But is there no way to just use some java code instead
Technically yes
Im about to
that defeats the point of serializing it
Backdoors through an animation boutta be crazy đ„¶
How
why serialize code you have already written
You could rely on lambda serialization, tho it seems janky at best
So you can run it in a compiled plugin?
Or do some wacky ASM stuff to inject single classes into the classloader
like whats the point of serializing a lambda thats been hardcoded anyways
the code is already part of the plugin
Whats wrong with serializing lambdas
since you wrote it for the plugin
Whats the point for Skript scripts
âGenerally speaking, the Java documents strongly discourage us from serializing a lambda expression. Thatâs because the lambda expression will generate synthetic constructs. And, these synthetic constructs suffer several potential problems: no corresponding construct in the source code, variation among different Java compiler implementations, and compatibility issues with a different JRE implementation.â
Just fork Skript and hardcode the scripts into the source
for server owners to program server interactions
Do you want the server owners to code their own animations?
Sounds like a lot of fun
but since you wanna serialize actual java code, only you would be writing that code
Because if thatâs the case just have them make an addon plugin?
so then why not just write it into the plugin itself
Cuz im the only one in the world who knows how to write in java
well you would be the only one who writes your plugin I assume
Its not hard to just make a data file of a particle/effect
so who else would benefit from serializing a lambda
Seems they also want stuff like riding entities
they would have to write the lambda themselves and then let it be serialized
so that your plugin can then read it again
You just make a json file that you parse to a class and store it in a registry
Before too long scope creep turns it into libreforge
lmao
Dude how hard is it to get
Could probably make this quite easily
You can parse json file into a class???
Gson adapters
Wait, class, not object right
Gson will even do some internal stuff without adapters
Instance
its the same as a configuration
Fancy
You just parse data into objects that you can use
Gson.toJson(dataClass)
Gson.fromJson(input, DataClass.class)
So I can create an instance of a class and save it into json?
Yeah
you have a specific format for an object, and then json written in that format will be parsed as an instance of that onject in the code
IE
type: DRIP_WATER
count: 5
interval: 2
Doesnt that mean that I can parse a consumer then đ
No
No
no
No
You save variables, not code
you define how to parse it
you can at best have a few types of animations I guess and then pick a function that it will use
And what if I have a class with a consumer field for example
but that means you already prewrote those functions
:D
Okay but I saw one plugin that accepted jars and allowed abilities
How did that work
Thatâs just an addon system
in the same way you can add jars in the plugins folder and they'll be loaded as bukkit plugins
You can easily allow other plugins to register a consumer for your system
IE: addWinEffect(name, Consumer<whatever> action)
Sick
How hard is supporting addons?
i love server owners having to make a full plugin to register 1 effect instead of being able to make it with a data class/file
Libreforge when
Whos that
Shut
you should revive it
Itâs Ecoâs system of data driven content
bring a competitor
it depends on how flexible your effect system is
Idk how good it is tbh, I just know it exists
too flexible and you ultimately want a language for the effects, if it is not as flexible then it's fine to make in some kind of declarative/data-driven way
Thats it, im serializing lambdas
Wait
we will steal mds kangaroo and fly to find you
Lol
I'm on the complete opposite side lol
Javascript is better than java ong
I'd rather use a full-blown programming language rather than pseudo-effect yaml
You can interpret code with it
Cuz as I understand serializing lambdas serializes the compiled code?
serializing lambda sounds like witchcraft
I believe so
i imagine it would also have to serialize the context
which means it might read data from stuff that might not exist anymore
Users are barely able to understand skript
Skript is the better choice when it comes to something like this
at least it is turing complete
I believe in the right tool for the job, for me it really depends what a configuration looks like
Itâs also an abomination
ideally I'd go for python but that isn't easy to just yoink inside a plugin
right now im working ona web editor so users can still quickly create the stuff they need without complex scripts
i was being sarcastic when i said that
and I can save it as complex as I need it to be
Java interpeter, how
Eh, people give it more shit than it deserves
concept-wise it is fine, it has some rough edges in the implementation but what can one expect from a plugin really
They want too far to making it English-like
javaskript when
đ
I like it being intuitive
Okay
New plan
No more serializing lambdas
Ill just hardcode them in
F server owners
just make 100 effects
Ez
or
have some kind of command that gets sent and configured so users can play their own effects from other plugins that do bother to have this customization
Overrated
You know
I'm working on integrating Kotlin scripting
into Bukkit
#general message
No, kotlin script
Yeah but like
Is Kotlin script just java code compiled at runtime
Or I guess
Kotlin code compiled at runtime
Yes
java skirpt
Why ASM
jshell moment
kshell when
Kotlin REPL exists
you dont know what jshell is?!?
Do I look like a programmer to you
A kotlin read evaluate print loop or something
It's a REPL for Java lol
It was added in Java 9. Keep up, Coll
And ur banned
How does that work internally
Magic
I compile it to wasm
@young knoll
Okay but can I use it as a scripting system
sure, it has an api
Damn
Em, please use Java 22 docs. The sidebar makes me upset
it's amazing, what are you talking about
there is a solution to this it's called super ultra wide
That was my nickname in high school :(

I thought you were Canadian, not American
oof
I've lived in the US for 3 months and have an apartment there
Does that count?
sure
meter
I have made a custom placeholderapi placeholder %sakuratags_tag%, but i cant get it to work in essentials chat. I've registered the placeholder via PlaceholderAPI, and it works in chat with /papi parse, but EssentialsChat still displays it as plain text. Any advice appreciated!
pretty sure EssentialsChat doesn't support PAPI
last time I checked they have their own fixed set of placeholders you can use in their config and that's it; it might have changed since then but I doubt it
thank you
international system
Yes itâs not persistent
I have to hide it each time I open the docs
dam
I made an userstyle that hides the thing, do you want it
please anyone with prior experience with jedis pub/sub I have been trying to deal with this absolutely atonishing bug for almost 3 hours
could make an userscript that sets the default state to hidden, but I don't like userscripts
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
ublock moment
I have this in my matches plugin
redisManager.subscribe(new RequestEnabledMapsHandler(), "requestEnabledMaps");
redisManager.subscribe(new RequestLoadedMapsHandler(), "requestLoadedMaps");
redisManager.subscribe(new SetupMatchPlayerHandler(), "setupMatchPlayer");
redisManager.subscribe(new RequestMatchHandler(), "requestMatch");```
and then I get
first of all I don't know why it says RequestEnabledMapsHandler received the message because I sent the message to the setupMatchPlayer channel
second of all this error provides me with absolutely no information
I have no idea what is wrong
but it should be executing this code:
@Override
public void onMessage(String channel, String message) {
JsonObject jsonObject = gson.fromJson(message, JsonObject.class);
if (jsonObject.get("request").getAsString().equals("setupMatchPlayer")) {
handleSetupMatchPlayerPacket(message);
}
}
private void handleSetupMatchPlayerPacket(String message) {
JsonObject jsonObject = gson.fromJson(message, JsonObject.class);
JsonObject dataReceived = jsonObject.get("data").getAsJsonObject();
SetupMatchPlayerPacket packet = new SetupMatchPlayerPacket(dataReceived.get("matchId").getAsInt(),
UUID.fromString(dataReceived.get("player").getAsString()));
Bukkit.getScheduler().runTask(XinCraftMatches.get(), () -> {
XinCraftMatches.getMatchManager().getSpawnLocationHandler()
.awaitingJoin.put(packet.getPlayer(), packet.getMatchId());
JsonObject json = new JsonObject();
json.addProperty("response", "setupMatchPlayer");
JsonObject data = new JsonObject();
data.addProperty("successful", true);
json.add("data", data);
// Publish the response to a Redis channel
XinCraftMatches.get().getRedisManager().publish("successfullySetupMatchPlayer", json.toString());
});
}```
and then sending a json response with value true on successfullySetupMatchPlayer channel
this is code from my lobby
public CompletableFuture<Boolean> setupPlayer(int matchId, UUID player) {
SetupMatchPlayerPacket packet = new SetupMatchPlayerPacket(matchId, player);
CompletableFuture<Boolean> future = new CompletableFuture<>();
// Subscribe to the response channel
JedisPubSub jedisPubSub = new JedisPubSub() {
@Override
public void onMessage(String channel, String message) {
System.out.println("Received message during setupMatchPlayer: " + message);
JsonObject json = gson.fromJson(message, JsonObject.class);
if (json.get("response").getAsString().equals("setupMatchPlayer")) {
JsonObject data = json.get("data").getAsJsonObject();
future.complete(data.get("successful").getAsBoolean());
this.unsubscribe("successfullySetupMatchPlayer");
}
}
};
redisManager.subscribe(jedisPubSub, "successfullySetupMatchPlayer");
// Publish the request
packet.publish(redisManager);
// Handle exceptions
future.exceptionally(e -> {
XinCraftLobby.get().getLogger().severe("Exception during setupPlayer: " + e.getMessage());
return null;
});
return future;
}```
System.out.println("Received message during setupMatchPlayer: " + message); and this doesn't even print
sorry but this is kind of a lot, and we can't really get the context like this, it'd be better if you could isolate the issue to a single code path
I know but like its so difficult because even with all the context I cant figure it out
or even better, creating a MRE but you'd need to understand the bug itself to do that so it is eh, do your best lol
really I am just looking for prior code I can try and compare and see what im doing wrong
I mean, the easiest way is to try reproduce it with a blank plugin that does something way simpler, to see what part of your thing is exactly affecting this
I think I figured it out but it just doesnt make sense
jedis has a time out limit which i assume drops in the middle of reading
I combined all my pub sub classes into one and just used a big if else chain
and it seems to be working fine
from a higher level perspective, it just looks like a data race
however that doesn't tell you much
I set it to 10
seconds
the read time out
the issue was that it was somehow registering pub subs to different channels than what I literally asked it to
that doesn't make sense lol
was it solved tho
may i ask, why do you use jedis instead of java sockets?
half
I mean, why not use jedis
I went from sockets to jedis to netty to web sockets to jedis again
sockets wasnt working properly
couldnt figure out jedis origianlly
netty wasnt connecting properly
sockets work for me just fine
that's really bad, if you start with one thing you should stick with it, otherwise you'll end up just rewriting your code a lot
web sockets couldnt reconnect properly
or the library I used was garbage idk
and now jedis has issues
I mean, jedis is battle-tested software, so the most likely case is that you're using it wrong
I've rewritten this code 5 times and its fucking pissing me off how I cant just get a consistently good approach to cross server communiucation
all solutions must've worked for sure
did you take the time to take the redis university courses before delving into it, or did you just go straight ahead into the code?
I went straight ahead with reading jedis docs
to use jedis you need it is important to understand redis itself, so that won't quite do if you don't have experience with these things
still doesnt change the fact that I would run redisManager.subscribe(onesub, onechannel) and redisManager.subscribe(twosub, twochannel) it would go onesub recieved message from twochannel
I recommend slowing down and taking your time to get it right
the handlers were probably being overriden somehow, doesn't look obvious from your code though
nor have I used jedis to know if this is a normal pattern, I'm sure they got a discord server somewhere so it's probably better if you ask them what they think of your jedis usage
I can recommend redisson, its much easier and better
I love redisson
not related to the issue, but I got to add: if you're trying out some new framework/platform or any decently complex library, you are much better off trying it out in a separate, clean slate project
do you happen to have a code example for pub/sub
yeah I probaly should but usually things work fine
you just create a rtopic
#publish(Object message) to send something
#addListener(Class<T> type, Consumer<T> action) to process messages of certain type that are sent in the topic
issue is that there's many layers of learning when it comes to platforms like redis, you have to understand not only redis but the library that interacts with it in the given language, as well as adapting your design to whatever redis might be, which is just a lot of mental overhead when you're realistically only trying to do the last thing
wow, you can send whole objects?
i mean, i don't mind using json myself
plus you can pretty much send any object with json
why is new NameSpaceKey(String, String) deprecated
look at the note ^^
there is nothign about it being deprecated, but there is some api note
So people don't specify random namespaces
so should i use it
"API Note:
Should never be used by plugins, for internal use only!!"
or @internal
with NamespacedKey.MINECRAFT
Yet for some reason we have NamespacedKey.fromString
Invalidated the entire goal!!
true
I was thinking of fromString instead of the constructor ngl
Use the constructor so you don't have to parse a string lol wat
fromString supremacy
Identifier.combine("namespace", "key")
idk I should use join or whatever
is
meta.getLore() != null
the same as
meta.hasLore()
?
should be
oh
so its different i guess
because it cant be empty
idk
can you make a listener for all events possible?
why should you do that ?
im curious
I always wondered whether the event param could just be of type Event
Classgraph
i i tried that
whaattt
https://github.com/classgraph/classgraph you'll scan all classes that inherited Event class
a
Get current class loader, put it into ClassPath
It's up to bro but doing that is extremely slow
I mean itâs on load up probably so it doesnât really matter
You can't listen to abstract events
As they don't have the handler list
makes sense
Nope
Yep
Is there any docs on NMS packets? Like what packets there are and what they do? Cuz im trying to make a fake player spawn and I can't seem to find the right packets
Perfect, thanks very much :3
is md5 a furry
I'm sorry what
(courtesy of Emilia)
huh xD
EmilyGPT has begun hallucinating
The voices
for 16 more days đ
Hi im making a backpack plugin,
Would a task that runs every minute, which retrieves each playerâs inventory, checks if each item can be placed in the backpack, and, if so, removes the item from the inventory and adds it to the backpack, be very resource-intensive? Specifically, Iâm concerned about whether iterating through every item in every connected playerâs inventory would pose a performance issue.
the world is basically ending after that
Shouldn't be to intensive
If you're worried about performance that is a task that can be split
?workdistro
Probably overkill though
as a player I wouldn't want that to happen tbh
I will take a look anyway thx đ
not me placing blocks and them just randomly disappearing from my hotbar
That a backpack plugin for gens server, so when they break crops / enchant proc etc, the inventory can be full very fast
can File represent a folder?
yes
thanks
so fast
yes
I think
Returns the abstract pathname of this abstract pathname's parent, or null if this pathname does not name a parent directory.
The parent of an abstract pathname consists of the pathname's prefix, if any, and each name in the pathname's name sequence except for the last. If the name sequence is empty then the pathname does not name a parent directory.```
Consider using the NIO API instead if possible
I'm pretty sure it'd be like
if your file path specificed is "file.yml" or "folder/file.yml" in the first case even if they both under the folder "folder" only in the second case will "folder" be returned from getParentFile
Guys, I'm having trouble making a ClientboundPlayerInfoUpdatePacket. This is my code:
private void createNPC(String name, Location location) {
ServerLevel serverLevel = ((CraftWorld) location.getWorld()).getHandle();
MinecraftServer minecraftServer = ((CraftServer) Bukkit.getServer()).getServer();
GameProfile gameProfile = new GameProfile(id, name);
ClientInformation clientInformation = new ClientInformation("de-DE", 0, ChatVisiblity.FULL, false, 0,
HumanoidArm.RIGHT, false, true, ParticleStatus.ALL);
ServerPlayer serverPlayer = new ServerPlayer(minecraftServer, serverLevel, gameProfile, clientInformation);
serverPlayer.setPos(location.getX(), location.getY(), location.getZ());
ServerEntity serverEntity = new ServerEntity(serverLevel, serverPlayer, 0,
false, packet -> {}, Set.of());
this.serverPlayer = serverPlayer;
this.serverEntity = serverEntity;
}
public void spawn() {
ClientboundPlayerInfoUpdatePacket playerInfoUpdatePacket = new ClientboundPlayerInfoUpdatePacket(Action.ADD_PLAYER, serverPlayer); // THIS LINE ERRORS
for (Player player : Bukkit.getOnlinePlayers()) {
((CraftPlayer) player).getHandle().connection.send(packet);
}
}
I'm a bit confused since its not even the sending of the packet that causes an issue, but rather just creating it...
Stacktrace:
https://paste.md-5.net/emududutuy.sql
you're never assigning a connection
you need a dummy connection impl
e.g. ```java
private static final Connection DUMMY_CONNECTION = new Connection(PacketFlow.SERVERBOUND) {};
huh, alright then, I'll try that, thanks
oh wait actually
public class DummyConnection extends ServerGamePacketListenerImpl {
private static final Connection DUMMY_CONNECTION = new Connection(PacketFlow.SERVERBOUND) {};
public DummyConnection(ServerPlayer player, Profile profile) {
super(MinecraftServer.getServer(), DUMMY_CONNECTION, player, CommonListenerCookie.createInitial(profile, false));
}
}
I didn't understand my own code for a sec
just set the serverplayer's connection to that
well now it doesnt error anymore... but the NPC still doesnt show up lmao
i think you need to spawn the player or set the position / send position packet idk
Figured it out, it was actually the order of packets
yeah you need the info packet first
I need to send the InfoUpdate before the AddEntity
because im reading this https://www.spigotmc.org/wiki/config-files/#using-custom-configurations
customConfigFile = new File(getDataFolder(), "custom.yml");
if (!customConfigFile.exists()) {
customConfigFile.getParentFile().mkdirs();
saveResource("custom.yml", false);
} ```
does mkdirs just creates the folder?
yes
is it necesarry before doing "saveResource"?
afaik you dont need to
It will make the directories for you
so can i remove the line above saveresource?
why is File a field
not local
Is there a good way to handle configurable items? I'd use YAML loading/saving but that's honestly shit for customization purposes.
I already have my own registering and stuff, but if there's an even better way lol
yaml is perfect for it
also how to reload this? like get the file from the folder
not for easy customization lol
configs are annoying and so hard đ
you can create a custom serializer if you think the default is ugly
Use sqlite as configuration đż
yea, which is more or less what I did ig w/ json in a cleaner format
most likely you want amount enchants tags and type
nou
and some others i might not think atm
Yea, I implemented the important bits in the first pass of the json item parser. I'll likely support the rest later
@worldly ingot sory for ping, do you know answer to my questions?
This is ew customization wise though lol
ants={minecraft:sharpness=10000}}}```
went w/ this https://paste.md-5.net/edimokobap.json and a custom item parser
much nicer, parser's shit though KEK
you could do this for yml as well
it will look mostly the same
heck, you could even deplatform saving and let the user choose its poison
Yes you can remove it
and what about this?
i need to reload probably
to get data
material: STONE_SWORD
amount: 1
meta:
name: Basic Item
enchantments:
sharpness: 1
lore:
- "This is"
- "example lore"
I mean, yea I could do it in yaml but it makes no real difference parsing wise so I don't think it matters toooooo much lol
At least unless enough people complain, then I can just rewrite it & make a converter lol
load it again
Yea, you kina just load it again
I treat a reload method as both load & reload lol
true
re-load
umm with this line YamlConfiguration.loadConfiguration(file); ?
yeah
i like yml more because users have more experience with it than json
sorry i dont get this code
and those who want json can just use json 
plus json adds up a level of complexity like closing the brackets commas
Yea, fair. We'll see what happens. The JSON format's simple enough to memorize at least
There'll be a wiki anyways đ
also there's sanity checks & shit
how do you deal with cases when there are no values that should be there? for example user removes "material" or types it wrong
check if the key exists or not
oh so thats why "File" instance is public
yeah and what do you do then
give the user a warning and move on
i really like my annotation config system that if a value is null it just uses the default
for json it'll be
JsonObject jsonObject = //
if (jsonObject.has("material")) {
material = Material.valueOf(jsonObject.get("material").getAsString());
} else {
throw new IllegalArgumentException("The material '" + jsonObject.get("material").getAsString() + "' is not a valid material");
}
At least for my stuff, because you can't do shit w/o a valid material
I default amount to 1
int amount = jsonObject.has("amount") ? jsonObject.get("amount").getAsInt() : 1;
yeah but exacly what, just print it?
Depends on the situation
it could be a System.err, System.out, or do what I do and throw an IllegalArgumentException
Use your plugin logger đ
Fuck the plugin logger
xd
sout ftw
Don't gotta pass the logger instance eveywhere
or use a static plugin or logger instance
fuck the logger
sout & ctrl+space+enter ftw
hi, are there any examples of creating your own gui?
?gui
but yea, in my case for verification I have
@Override
public void parseObject(JsonObject object) {
assertField(object, "material");
// Parse the base ItemStack
Material material = (Material) getEnumValue(Material.class, object.get("material").getAsString());
if (!material.isItem()) {
throw new IllegalArgumentException("Material '" + material + "' is not an obtainable item");
}
int amount = 1 = object.has("amount") ? object.get("amount").getAsInt() : 1;
itemStack = new ItemStack(material, amount);
// Rest of code here
note: assertField & getEnumValue are custom util methods lol
Thanks
Sure
albeit that can be cleaned up
private Material getMaterial(JsonObject baseObject) {
assertField(baseObject, "material");
Material material = (Material) getEnumValue(Material.class, baseObject.get("material").getAsString());
if (!material.isItem()) {
throw new IllegalArgumentException("Material '" + material + "' is not an obtainable item");
}
return material;
}
@Override
public void parseObject(JsonObject baseObject) {
Material material = getMaterial(baseObject);
int amount = baseObject.has("amount") ? baseObject.get("amount").getAsInt() : 1;
itemStack = new ItemStack(material, amount);
// Rest of parsing code here
}
the next step is to make something like this đ
it's my favorite way to make configs currently
Yea, probably won't do that
why?
Eh, no reason for me to honestly.
for items they get parsed into an ItemStack, don't need that there
and if I want a specific slot or something, well the parsing code's there. Might as well just add a field & getter
yeah, i guess it's not needed in your case
but i really like annotation config, makes my life so much easier
If I wanted to implement a kit system annotation config would probably still be overkill
but if i use YamlConfiguration.loadConfiguration(customConfigFile) instea of the try catch, then "customCConfig" variable is always just new YamlConfiguration(); and its not edited
what
lirc?
If I remember correctly
what does use = loadConfig mean
thats scoreboard?
đ”âđ«
ill use the try catch for now i dont get all that
i dont get all that how to understand it ..
I don't even remember how to use the yaml API lmao
Been doing too much JSON stuff recently kek
we use toml at work
but I made a nifty little toml -> configurationsection adapter thing
nice
would the health under the players name update automatically?
and since it runs on enable
will it show to players that join?
i think so
unless you use dummy, in that case you'll have to update it manually
If load config returns an instance set ur config instance to it
you can test it using https://www.spigotmc.org/resources/bot-creator.111449/
does that mean i need to add it as a library?
config = yamlconfigurstion.loadconfigurstion(file)
only if you set the same scoreboard to them
who are you replying this to?
the scoreboard doesn't really need packet events to work
unless you're stubborn
how can i just write text
i dont want a score yet
like what if i want it to display
"hello!"
and not
hello: 1
set a score entry to a chat color and register a team to that chat color and use prefix and suffix to edit the text
you still need a score if you use the api
on 1.20.4 you have the option to hide the score entirely which is nice
but it's done via nms
it's not random
is this global or per player?
global
Well it's per scoreboard objective
the only way to make it per player is to assign a scoreboard per player
and copy all the health and such on each scoreboard
so on player join add them, but this would add them to the global scoreboard, how can i make a scoarboard per player?
Team team = board.registerNewTeam("teamname");
oh this
ill make a team under their uuid?
not uuid
chat color
teams used in scoreboard are fictive
no need to use real player uuids
this one is pretty cool tho
i never used it
i'll have to test it to see if it does what i want it to
no i mean like
every player has their own team name
right
if i dont want a global scoreboard
ScoreboardManager manager = Bukkit.getScoreboardManager();
what about this
is that global
or on player join
on join and have it cached
and if you want to change something that player see edit their own scoreboard
chat where is it
did you player setscoreboard board?
Doesn't look like it. You're missing Player#setScoreboard() on the scoreboard you created
hey guys im tryna do custom pdc stuff and i was using @tender shard more persistent data types and had it like this
DataType.asEnumMap(CompStorageType.class, DataType.FLOAT));
but the structure has changed, its now Enum, Class, so
StorageComponent.CompStorageType, StorageDataType
what do i pass in for the DataType?
If it's your own class you'd need to make your own DataType
can you make your own class so you can create instance of it like of Integer class?
Integer integer = 1
for example make my class
MyClass myClass = 5 or "erwme"
yes
the same with string
are there other examples of things that are impossible to make your self?
This is just syntactic sugar, it eventually becomes ânew Integer(8)â or well if so may
new đ
whaat
Well it's not impossible to make
yeah but i mean that its not possivle to do with other clases
but it's not exactly builtin
Maybe in kotlin kmys lol
but in Java, to create an instance of ur class, somewhere youâll find the new keyword being used
Yea, wouldn't you have to fork Java itself for something like that?
often times its hidden behind a static factory method though
Could parse the file yourself and generate the appropriate bytecode
You don't really need to fork java
Like a preprocessor
true
You could write a cheap transpiler also
why every one often uses ints and not for example bytes or shorts when they know that its gonna be small value for sure?
https://github.com/manifold-systems/manifold might have something
Thatâs a good question, I believe weâre just very spoiled.
Because memory is cheap and people donât like casting :p
no reason to use byte or short unless actually needed either lol
idk what you mean i always use boolean[]
If only we had a shortcut for byte and short like we do for float long and double
int i = 1;
short i = 1;
byte i = 1;
same thing, really.
So weâre reinventing how it works under the hood now
short -32,768 to 32,767
byte -128 to 127
int -2147483648 to 2147483647
no real reason to use short or byte
Yeah that doesnât always work
yea so fuck short & byte and use int đ
or BigInteger if you have too
or whatever tf it's called
yuh
no idea
Lots of libraries are cursed lol
Yeah but Iâm saying if they were to add new shorthandâs
true
there is no
lombok's cursed
yeah lombok is also a compiler hack
then when i do that it says i cant do it for abstract classes do i really need to make 4 adapters and then how would i even handle which is which in the enum
I think s would work for short
ffs
Canât use b for byte because Boolean
but it will take less space right?
Doesn't really matter nowadays tbh
If you want to micro-optimize then yea, you pay attention to what you use
okay but it does : )
Not really
This is why optic doesnât program embedded systems
Yes really
you will save like 40 bytes in the entire plugin
Honestly it just sounds like your project is structured wrong
We're not in the NES or PS2 era lol
yeah
nah not even steven
40 bytes is nothing nowadays lol
but also the JVM still inflates them to ints to operate on them
so your efforts are useless
I'm running this stuff on drives with 100s of GB KEK
Something something 32 bit word size
oh, then thats useless
but yes the system needs to know what to store in the pdc
If you deal w networking, or lets say uâre working on micro/embedded systems it can be nice
so you need to write the appropriate adapters
Thatâs why Mojang uses varint
micro-optimizing really only makes sense for C, C++, Assembly. Low level languages
but even then not always
nowadays you don't need to micro-optimize the fuck out of programs lol
10 KB difference in size doesn't make a difference unless you're running on very specific hardware
uint32 bIsTrue : 1; is the way to go
because a boolean is 1 byte
wtf is an unsigned int
but it only stores 1 bit
If you wanted to actually micro-optimize, you wouldn't even be using Java lol
ah i see i was referring to cpp
why do booleans hold 1 byte tho
thats bad design
Because computers like to work either entire bytes
kotlin
^^
If you wanted to be efficient there is bitset
Runs on the JVM
Wow coll said something smart
Choco
has unsigned
I hope you get demoted to the skyblock team
Wow
but anyway evil bit hack is the way to go
I disagree slightly, there are systems that run Java with limited resources and use the serial garbage collector and have to consider this, ofc using Java is a bold move in the first place but yk
Then whenever an update happens I can tell people to direct their whining towards you
Yea, C, C++, or straight up assembly would be better options as it allows better micro-optimizing
but people hate other people so they say Fuck you, use Java
Java didnât get us to the moon!
14kb of ram did
10 KB is nothing
Thatâs still more RAM than an NES
if you think lke that, the bytes add up
Therefor we couldnât use an NES to go to the moon
sure if you attach thousands of dollars worth of other equipment
Last I checked most plugins don't even hit a gig lol
Ya but youâre not thinking about the most edge case of edge cases
my plugin hits 1.7gig after 24 hrs, its a rtp plugin
idk why it does that
joking btw
your code stinks
aight Emily
How is your plugin 1.7 gigabytes
He uses static methods
I thought we were talking about ram
and the whole google java suite is shaded
Are we compiling for 24 hours now?
What about rom!? :(
nah its cached
even ram isn't much of a concern nowadays tbh @young knoll
I canât read, so itâs not useful for me
wom then >:c
not that your micro-optimizations are fixing java's, spigot's, bukkit's, and minecraft's overhead
Is wom a thing
how do you define a bukkit vector using magnitude and direction (pitch & yaw) instead of x,y,z?
What would you ever use that for
how useful!
Canât do a null check because thatâs going to tank my performance đ
i mean you can store.... bytes? and then... dump them?
âWhat if you do 100 null checks per second or a 1000?!?!â
ncps
just del system32 or rm /. Devs won't make null objects then
spark? whats that
i just get the used memory by the jvm and perform some calculations
people always do too much these days
but realistically? There's only so much you can do Java wise before you just straight up don't have anything to optimize, and even then you'll still have a fuck ton of overhead lol
whats overhead (serious)
Minecraft alone takes like a gig of ram lol
ah ic
tbf it doesn't help it's not completely optimized lol
Hello. I am looking into how I could use the Stripe API for detecting when a player purchases a rank from my Stripe link for it. I do not have any use for CraftingStore/plugins similar as I only offer 1 rank, and do not plan on offering other premium services in-game at all. What would be my best bet for detecting a payment on the server-end with the Stripe API?
oh i started a conversation
I always find it funny a lot of people complain that Minecraft is bad and when they try to do their own server impl it runs worse without all the mechanisms the vanilla game has
also, just don't use a gig of ram kek
Have you checked the Stripe docs?
Yea, there's like a million server impls lol
I have. I understand how to make the request and all of that, but I am wondering how I could implement that into my plugin as a single-time Event
i.e;
Stripe payment "detected" by routine checking:
- ONE TIME
StripeCheckoutEventruns
still waiting for Minecraft as an OS đ
how can they be worse without the features?
I don't really understand your problem?
What do you actually need help with
How to make a (spigot/bukkit) event?
Skill
Issue
they simply don't consider a ton of the shortcomings that come with the set of features they implement, whether that be CPU or RAM
No. I know how to make an event, I'm wondering how to exactly get the information from the purchase.
Unless I have it wrong,
- I'll need to use a runnable to scan payments (similar to how CraftingStore does it afaik)
- How can I turn that runnable into an Event that runs only once..? I'm trying to make it as dynamic as possible so that I do not need to change the code in future projects/plugins.
Stripe has webhook apis you can use instead of polling
Also you can just store what events you've processed and not call the events for them?
I suppose I could, but I'm trying to be as lazy as possible. I'll look into the webhook ordeal, missed that part in the Java docs?
I saw it briefly, but I never saw the Java-specific help
I can't attach images, but the Java-specific help has a much better example haha
still no scoreboard
I'm not at all a webhook/HTTP type of guy in any way.. Google isn't helping much. What is the best way for receiving Webhooks to the server?
A webhook is basically just an endpoint. Instead of you checking the data if anythings changed they will send you the data when changed
fancy event/listener basically
Ok, should I use an external API for this or try to make my own?
(Say external API)
Minecraft but it's just webhooks KEK
You can just load Javalin and setup a very basic endpoint to recieve data on
Shouldn't be more than 30 lines or so
You can load it via Spigots library loader if you're on a version above 1.17(.1?)
if not just shade it
1.21. Thank you! I'll be back in 20 Minutes with some mysterious error
Do note it requires an extra port to run on
oh
If you don't want that I do have a project that's still W.I.P to solve that
came up with