#help-development
1 messages · Page 1036 of 1
?
ig metadata on an entity isnt persistent then?
i wanted to look into that api recently
hmm looks pretty cool
Hi, i'm using Spigot 1.21
I'm trying to create my own craft but if I put recipe.shape(" S ", " P ", " S "); it's simply not working and I don't know why
public void craftBandage()
{
ItemStack bandage = new ItemStack(Material.PAPER, 1);
ItemMeta bandageMeta = bandage.getItemMeta();
bandageMeta.setDisplayName(ChatColor.WHITE + "" + ChatColor.BOLD + "Bandage");
bandage.setItemMeta(bandageMeta);
NamespacedKey bandageKey = new NamespacedKey(plugin, "Bandage");
ShapedRecipe recipe = new ShapedRecipe(bandageKey, bandage);
recipe.shape("SSS", " P ", " S ");
recipe.setIngredient('S', Material.STRING);
recipe.setIngredient('P', Material.PAPER);
Bukkit.addRecipe(recipe);
}
i dont remember but maybe you need specify the "empty" slots too?
I don't think so because "SSS" " P " " S " is working but not " S "
Can i load plugin classes without enabling it?
plugins are loaded automatically but ig you can disable the plugin yourself
?xy
anyone has an idea ? 😭
Is this efficient?
Why is it done
As supposed to something like
TextComponent... textcomponent
I see it in like
List.of()
too
I might be missing something, my knowledge of java is mostly the front end stuff lol not the performance
well if you wanna get into stack operations...
the italics are telling me not to do that
gib plugin idea or else 🔫 🙂
Hi , sorry for bothering you again so now i finished , kits , cosmetics now i want to make a CosmeticUser (uuid , active, bought cosmetics) how would i go by doing that?
just create one?
This is causing an EventException
@EventHandler
public void handleActionEvent(PlayerInteractEvent event) {
if (event.getItem() != null) {
if (event.getAction().equals(Action.RIGHT_CLICK_BLOCK) && event.getItem().getItemMeta().equals(TeleportSword.meta)) {
if(event.getClickedBlock() != null) {
Location location = event.getClickedBlock().getLocation();
location.setX(randomDouble());
location.setY(randomDouble());
location.setZ(randomDouble());
}
}
}
}```
Could not pass event PlayerInteractEvent to untitledSpigotPlugin v1.0-SNAPSHOT
org.bukkit.event.EventException: null
?paste the whole error
whats line 18?
if (event.getItem() != null) {
or maybe this: if (event.getAction().equals(Action.RIGHT_CLICK_BLOCK) && event.getItem().getItemMeta().equals(TeleportSword.meta)) {
I think I forgot to update it
maybe the item in hand is null or air (thus meta returning null)
I think I solved it or the server is lagging
@EventHandler
public void onInteractBandage(PlayerInteractEvent e)
{
Player player = e.getPlayer();
ItemStack item = e.getItem();
if(item != null && item.getType() == Material.PAPER
&& item.hasItemMeta() && Objects.requireNonNull(item.getItemMeta()).hasDisplayName()
&& item.getItemMeta().getDisplayName().equals(ChatColor.WHITE + "" + ChatColor.BOLD + "Bandage"))
{
if(player.hasMetadata("Fracture"))
{
player.removeMetadata("Fracture", plugin);
player.removePotionEffect(PotionEffectType.SLOWNESS);
String guerisonMessage = mc.getString("survie.sante.guerison", replacements);
player.sendMessage(guerisonMessage);
item.setAmount(item.getAmount() - 1);
}
}
}
When I use the item, the amount is not decreasing why?
cuz u dont delete it from the inventory
u just decreasing the amount of the bandage will give it to u
I still don't know how to fix this
is there some sorta data corruption issue with the 1.21 release?
everything is up to date, I’ve recently moved to paper but am using spigot until the new paper release is out. people keep advising me against it as there’s apparently issues with item data randomly breaking. there’s also been a decent amount of people, from what i understand, having issues with crashes
Well, it's a good thing 1.21 isn't the default just yet.
known corruption issues? no, but considering 1.21 isn't deemed stable yet I would handle with care
make backups yada yada
yea yea everything is safe was just curious. I know it’s not completely stable just wasn’t sure if it was really being blown out of proportion or not
I personally haven’t encountered any issues besides the occasional crash
Do you have crash logs?
it was happening due to multiple mobs in trial chamber, in vanilla it works fine but not on spigot but as long as it’s not too overboard it should be fine until it’s more stable
I believe that issue has been fixed.
View the Bukkit, CraftBukkit and Spigot changelog.
Hmm I’ll run buildtools again then, I’ve been on this build since saturday morning
I have a plug-in that I wrote and am currently bringing up to date (into 1.21) from 1.19.2
A few odds and ends left to fix… but one thing I don’t understand is that all the custom heads I access are now showing up as Steve rather than properly skinned. My assumption is that this is something I’ll need to figure out on my own and fix, but I thought to mention it here in case it was a known issue that I wasn’t aware of.
How are you applying the skin?
I would recommend using this tutorial as it uses the API.
https://blog.jeff-media.com/creating-custom-heads-in-spigot-1-18-1/
I’m not at the computer now… was just pondering the issue. I know it’s called by this long code I got from the heads database site (which is not a player guid, I understand that you can do that now in a way I didn’t know of before). I know they are all created when the server starts and stored for later use. If that’s not clear enough I’ll look into it as soon as I’m able to let you know more.
Oh excellent, thanks for the link I’ll be reading up on that asap.
Seriously… very much appreciated, what I have I worked out myself and it’s always felt a bit hack job but I didn’t know any other way.
Thank @tender shard for the tutorial. He's the one who wrote it after all.
goated community member btw
Yeah I’m still using the method I came up with prior to 1.18… this will be a longer job to convert to but lead to much cleaner code.
anyone familiar with sponge/fabric mixins?
is there any point of making Accessor interface if you actually use it for accessing a field inside mixin?
should i just make a concrete mixin class with Accessor annotation to access private field
or should i still create Accessor interface
Yea, I used to use a lot of nms for setting textures. Lasted quite a while, finally breaking in 1.20.5, so that's what got me to switch over.
funny enough its always skulls that are pain in the ass to spawn
paper moment
Thank god, yeah it’s always been one of the crappiest parts of my project to maintain.
wdym? like using the accessor itfc it inside a mixin class of the target class itself?
fabric has a channel for that 
So what I was using before, on the Minecraft-heads website is just called “Value”… if I only have this data stored but now I want to access the Minecraft URL, hmm… I hope it’s not a manual head hunt I’m going to be signed up for
(Fyi… I write code but have no formal education so sometimes I feel a bit backwoodsy and like I don’t know how to do things very smart)
The tutorial covers all of that. You can still use those base64 values.
I know I still do.
How can I create a custom recipe ?
Oh excellent. What a relief I literally use hundreds and they need to not be changed or it would be a huge loss
❤️
Yea thank you @tender shard!
Paper's integration with adventure api is literally godsend
i dont understand spigots stance against adventure
will this do 2 lines or 1
Thanks but this one is not working for me and idk why
Are you including the spaces?
Yep
@tender shard do you like pizza
real
public void craftBandage()
{
ItemStack bandage = new ItemStack(Material.PAPER, 1);
ItemMeta bandageMeta = bandage.getItemMeta();
bandageMeta.setDisplayName(ChatColor.WHITE + "" + ChatColor.BOLD + "Bandage");
bandage.setItemMeta(bandageMeta);
NamespacedKey bandageKey = new NamespacedKey(plugin, "Bandage");
ShapedRecipe recipe = new ShapedRecipe(bandageKey, bandage);
recipe.shape("SSS", " P ", " S ");
recipe.setIngredient('S', Material.STRING);
recipe.setIngredient('P', Material.PAPER);
Bukkit.addRecipe(recipe);
}
This works but when I put " S ", " P ", " S " it's not working
I mean, the code looks fine to me.
If you only call it in the #onEnable() method, then it might be a bug with spigot.
You may want to make a jira report.
Yep I will thanks for your help 🙂
everyone does
does anyone here have experience with spring
do i return a byte array for serving files
I have custom recipes which require specific lore, and functionally this works well.
Is it possible (and if so is there an example of how) to make these custom recipes display properly in the recipe book? (idk if that’s the proper name, book in the survival inventory)
looks like it
if I use gradle to build a project, can I use a jar I have on my pc to build with it?
If you mean as a dependency then the recommended way is to install file it
kinda, you can install gradle on your pc, but mostly you use installed gradle to init gradle wrapper
Lol now it appears in my book but I can't craft the item 😂
I upgraded my spigot to the latest version, I guess this bug will get patch soon
?jira
anyone good with spring? trying to run a spring app inside of a plugin
@SpringBootApplication
@RestController
class PackServer {
@GetMapping("/global")
fun getGlobalPack() = GlobalPack.bytes
companion object {
fun start() {
val app = SpringApplication(PackServer::class.java)
app.setDefaultProperties(mapOf("server.port" to Bukkit.getPort() + 1))
app.run()
}
}
}
Uh Spring inside of a plugin sounds like massive overkill
What are you trying to do
host a resource pack server
Oh yeah that's overkill 💀
44mb jar go brr
If you want the smallest jar write your own web server
Otherwise Javalin is a pretty nice option
not what i'm going for lol
will check it out
just use jwebserver 💀
kotlin support
get excited
it's just this
my messages are disappearing on desktop wtf
Since the goal here is just to serve a file I'd go with my own web server
it's to serve multiple files :D
this happens on all new projects i make
Java has most of the tools already there for you
let intellij finish its thing
Looks like IJ is indexing
its not
are you sure
100%
Invalidate caches and remove the .idea folder
i removed the .idea folder reloaded and then it got like that
So what was it before
try reimporting the module from maven
Also just give it a restart?
when i restart the files flash and disappear
work
recipe book is literally shitty version of REI/NEI/JEI/TMI

You forgot TMI the true og
Too many items
yeah yeah but the problem is from spigot here not minecraft
i still remember downloading TMI from minecraft forums back in 2011 and patching the minecraft.jar manually by removing meta inf
i've started to play in around beta 1,8 but my parents were too poor to buy me a copy, so i've pirated it from some kind of sketchy torrent site and played single player
back in the days minecraft was more depressing and it was pretty cool to play at night since nights were darker
also bedrock fog
I still remember to tiny worlds and render distance
in stdout
i didnt even had a smartphone at those days, smartphones were seen as luxury in my country, and computer was for whole family, so i've booted up minecraft on my 3GB ram winxp machine and played it
times had changed so much since then
Huh I don't remember that being there
our country like progressed so much till then
Probably easy to get rid of
no option to change the log level?
Played pocket edition on the iPad (2?) With 512MB of ram
how is that invalid
config.showJavalinBanner = false
Discord is quite buggy tbh
like ??
Just switching accounts ends up with me in a state of being logged in with both at once
Like seeing servers of one account while logged in with a another
i mean if u are trying to make request, 0.0.0.0 is not valid ip
its only legit for binding
hm yea true ig
i can't wait to set up an extra unproxied domain for the packs
i remember this logo
but there's no way i've played it in like 2009
so i might've been playing and old copy of minecraft back then
without even knowing lol
am i supposed to get the raw byte data back when i visit the url and not the file
i think there was similar logo (probably same) but red
chat gpt says that the last version it was beta 1.7.3 to have that logo
No you want the file
Don't forget the headers
Otherwise the browser won't understand what it's recieving
i just did this
anyone knows in junit if you can like make all tests execute twice with a different env (i basically wanna tests 2 envs without rewriting all tests)
public class ExecutionEnvTest {
private ExecutionEnv env;
@BeforeEach
void setUp() {
env = ExecutionEnv.empty();
}```
ai told me to use a parameterized test and write my own provider
any better ways?
Is it a static file?
Live dangerously, throw it into production with no tests.
If its a paying job, you get paid to fix it too 🙂
wdym
i'm just returning some byte array
the file doesn't exist on disk
anways came up with this
static Stream<Arguments> provideEnvironments() {
return Stream.of(
ExecutionEnv.empty(),
ExecutionEnv.defaulted()
).map(Arguments::of);
}
@ParameterizedTest
@MethodSource("provideEnvironments")
void method1(ExecutionEnv env) {
sadly poor java doesnt have a nameof
all 272 tests still working
damn
Does Bukkit.getPlayer(uuid) work with offline players?
No an offline player isn't online
So they don't have a player object
Only OfflinePlayer
Oh. I thought it would return a player no matter what, because the player class supported it.
oh I found a non-deprecated getOfflinePlayer method
you adding the hash and all of that?
Regular Player objects can be casted to OfflinePlayer, right?
i should be doing it correctly
idk it's an issue for tomorrow me
Yes Player inherits from OfflinePlayer
is there a possibility to change the design or color of the freez effect u get when your under powder snow?
You can change the freezing overlay using a resource pack
can i give a player this effect with out putting them in powder snow?
there's freeze time or cooldown
on the player object
oh thats very nice
idk the method names rn
thanks i will defenatly use that 🙂
If you send a packet to a player who's connected via some proxy (bungee, velocity, gate) it needs to go through that proxy first, but the proxy can intercept THE ACTUAL PACKET. And since what we send is a byte array that's (usually) compressed and merged with other packets, does this mean each packet on the proxy is: decompressed, framed, identified, read and only then modified, and only then recompressed and merged?
so the full encoding process happens twice with an additional decoding
is that right?
or are there some other mechanics at work?
?help
selfrole Add or remove a selfrole from yourself.
cleanup Base command for deleting messages.
embedset Commands for toggling embeds on or off.
info Shows info about CafeBabe.
licenseinfo Get info about Red's licenses.
mydata Commands which interact with the data CafeBabe has about...
set Commands for changing CafeBabe's settings.
uptime Shows CafeBabe's uptime.
findcog Find which cog a command comes from.
names Show previous usernames, global display names, and server...
userinfo Show information about a member.
listcases List cases for the specified member.
reason Specify a reason for a modlog case.
permissions Command permission management tools.
@eternal night could you confirm?
Why do I get a ping 
cuz you knowledgable
could you tell me if this is correct?
https://paste.md-5.net/mololevoyi.js
Does anyone know why this is returning null when the player has no helmet on even tho im checking if that = null already
bro is busy watching da game
Well a proxy can be smart about it, but yea. If it wants to read shit it needs to be a proper man in the middle
which is why e.g. velocity does all its compression and encryption in c
because that can be a heavy task

but doesn't that mean that it needs to do that to every single packet, cuz, you know, you can't really predict what this array of bytes is about unless you properly decode it?
doesn't bungee do that as well?
The very first line you get teh helmet, assume its a valid item, get meta without checking if it exists so of course its blowing up with an NPE
then the proxy wouldn't be a proxy
what is it called in the resoure pack?
I guess makes sense
you don'T have a client connection
the only thing you have is a connection to the proxy so
¯_(ツ)_/¯
https://mcasset.cloud look for something with freezing
Now we can just use a transfer packet instead of a proxy 
well I'm asking cuz I'll be sending like
10 000 * 600
packets
every 400 millis
sounds pretty dumb
it's not
10 000 players

600 particle packets
if you are on 10k players you don't have one proxy
k8s mentioned?
6 * 10^6 packets every 400 millis
C mentioned
that supposedly has 10k active concurrent players
would have the infra to not have them behind a single proxy
that would be absolutely brain dead
^^
how many proxies would you need?
your single point of failure there would be so large I could hit it while upstream updating paper
Minestom is a bit different
you'd still not put all your 3000 players on a single minestome instance
that would also be brain dead
you don't want to scale horizontally
Yeah
instance as of, world instance?
Server
I prefer scaling in a northeast diagonal
yea you said a single instance can handle thousands
no problem
Doesn’t minestom have like
its named powder_snow_outline.png
Very little content
you are sourcing from "FUCK CAR DEPENDENCY!!!!!" that it handles 7k?
Wondering how many that bash server can handle
yea
To be fair they're pretty active
that seems a little biased
for you to judge based of a nickname
And that's a nickname they got recently
0 prove
like, velocity proxy was struggling on the 1k folia test just with network
Just because you can doesn't mean you should
minor spelling error, I win
Pretty sure they were testing bots
they're not using netty
Not actual players network isn't a problem
not the server CPU, the network
and this was tested with bots
Did the bots behave like real players
probably
where did the bots connect from?
from what I got
Because that’s a lot of extra network usage vs standing around
locally?
Probably
"external program"
so yea, w/e
random statement without anything tangible
split your work across multiple proxies
be happy
Oh yeah I legit had 2 edit 4 lines of code and fixed it as soon as you said that it clicked xD
or don't send 600 particles every 400ms 
They're making a particle captcha
correct /\
and all currently active players solve that at the same time?
damn
wait
is this offline mode support??
they disappear if it's longer than that
Probably
ah yes, cuz you can't do that
they said anti bot
I forgot
Ah shit, aand off they go to the block list
okay then fuck off
1 blocked message
Welp

minestom goated
Yes

epic
Aww it doesn’t embed the video
I never understood this
"you haven't bought the game, you get no support"
when the game is owner by a money-hungry mega corporation
that has already made bilions on it
I was able to get into minecraft precisely because it was for free and bought it later on
there was even a confirmed study that pirated games have more people actually buy the game
because they can try it out for free
"Hey we put a lot of our time into a game maintained by mojang, a studio that does need income. Without mojang, our work and community would break apart. You come here and want our help but decide to actively screw over mojang. Why u no support"
you literally ignored every single argument I just said
it's like I'm talking to a wall
maybe the even worse
the wall is conscious and full of itself
"that has already made bilions on it" Okay? Mojang isn't made out of money. That money went places, the game still needs to be profitable.
"money-hungry mega corporation" Yes, microsoft owns mojang but mojang still does most of this themselves. The input from their parent company is limited as fuck.
"there was even a confirmed study that pirated games" Interesting, seems like 0 companies in the gaming industry seem to have read this study? Nor have I.
not to mention that you seem to actively be working on making a server for offline mode players, which is weird, because at that point, shouldn't they already like the game enough to have bought it? Seems like there is 0 intention to have them buy the game.
and it's not like you supporting or not supporting people that only develop certain software will drastically change the amount of sales
what
are you
on
about
me personally? no, probably not. But if the entire server is in consensus to not help people trying to make the life of pirats better, then maybe
citation needed
it was long ago, don't remember, but this is one the websites that popped up https://arstechnica.com/gaming/2017/09/eu-study-finds-piracy-doesnt-hurt-game-sales-may-actually-help/
there was some game that was never possible to be pirated
and it was like a continuation series
and it had the least amount of sales
by a great margin
Yea, good question tbh xD
All good 👍
Thanks 👍
uhhh
different paste lmfao
xD

there we go
Probably best to just try and see
it's pretty good
308 stars in github seem nice tho
one of the fan favourites
LichtHund is also a classic
interfaces-kotlin my beloved
noxcrew everywhere 
why you smhing your head
truly
smh
All I need is a library that lets me use multiple pages and maybe even storage slots.
The one I'm using now feels hella inefficient
time to rewrite the entire ui yay ;-;
Remember when noxcrew was all about maps
noxcrew isn't about maps?

are their "new" things not cool or something
smh my head
gotta love it when you're shaking your head your head
ikr
why did I have to pick the wrong library
that looks so weird
Idk what is their new stuff
Mcci?
yea and mcc
oh no the screenshot mostly shows my own inefficient code
they made some cool events too
the fact that I needed 221 lines for 2 3-row pages is weird
the indents on here
private val inventory = buildChestInterface {
rows = 6
initialTitle = buildText {
append("Spectator Menu")
lightPurple()
bold()
}
withTransform(playersProperty) { pane, view ->
val playersSplit = players.split(9)
repeat(6) { i ->
val playersOnRow = playersSplit[i]
playersOnRow.forEachIndexed { j, eventTeamPlayer ->
pane[i, j] = StaticElement(Drawable.Companion.drawable(getSkull(eventTeamPlayer))) {
GlobalScope.launch {
view.close()
}
view.player.teleport(eventTeamPlayer.player!!)
}
}
}
}
}
took me 150 lines for a paginated 7x3 with buttons lol
at least that one is paginated
damn
good evening, I've spent the day looking for a way to synchronize inventory between 2 servers in real time on a proxy. I've tried every possible way and I've come to the conclusion that it's impossible to sync inventory without making the player go through limbo (it's impossible to sync just via the loading screen). has anyone tried the same thing?
The UI I was talking about (no functionality other than page switching):
I bet that could've been done in less than 100 (while keeping it clean)
yeah probably
i don't have a ss of mine rn but it looks kinda similar
only old ones lol
but it's like 16 000 bytes
nah
I tested it
for the player it's usually an even LESSER CPU usage
Per tick 💀 ?
than going around on a busy large server
yeah, thats ok
to the main thread
Like bandwith stuff
yeah, this is a bit much
since somehow, I found that message packets can be compressed into like 2 bytes (I still have no idea how I got that result)
how
and particle packets are usually like 60 bytes (so still, how the fuq did I get 2 on a message packet)
nvm i need to use strings
Hello guys , i need help with something 🙂
if i use this its kind of working .. but i want it to publish the any class that extends Cosmetic
for example i have SkyWarsKit abstract class it extends Cosmetics , and its implemented in SkyWarsKitImpl
and also i have other cosmetics not only the mentioned above
i have killCosmetic , win Cosmetic i want to make 1 method to update 🙂
if i put Cosmetic in the method i sent it will send this error :
why is channel spelled with one n
nop i don't think so i checked twice
I don't see the method above
anywhere here
Class<? extends Cosmetic>
is it scheduled for later on execution?
show KitInstantCreator L 41
any class that extends Cosmetic
I've never used Redis
ppl that did
ASSEMBLE
(you gotta wait for a bit)
You're implementing your type adapter weirdly
its a bit confusing 😦
.
did you read this?
You wrote the write() method just fine, you should be able to write your read() method basically the same way, just in reverse :p
ok
Basically use the reader object you have, don't pass it to a JsonParser
beginObject(), nextInt(), nextString(), nextString(), etc. etc. etc. endObject()
Actually probably a shit way to write that lol. The JsonReader docs have a good example
public User readUser(JsonReader reader) throws IOException {
String username = null;
int followersCount = -1;
reader.beginObject();
while (reader.hasNext()) {
String name = reader.nextName();
if (name.equals("name")) {
username = reader.nextString();
} else if (name.equals("followers_count")) {
followersCount = reader.nextInt();
} else {
reader.skipValue();
}
}
reader.endObject();
return new User(username, followersCount);
}
Could replace that if/elseif/else block with a switch if you wanted. Up to you. But definitely best to parse with names vs what I'm proposing lol
like so?
Yeah pretty much
Should fix up your NPE
As a matter of personal preference as well, because you're referencing raw string ids, I would probably pull those up into constants and re-use them between your write() and read() methods
why don't you fix it if it bothers you that much?
Does anyone know if their is a better way to do
String[] enchantParts = enchantedItemData.split(":");
String enchantName = enchantParts[0];
int enchantLevel = Integer.parseInt(enchantParts[1]);``` as it works but i get this error ```java.lang.NumberFormatException: For input string:```
Readability, makes it easy to change later, avoids typos
Why don't you stop being so freaking cool
I can't :(
Damn. Tough problem
thanks so much 🙂
testing it rn ..
Hey so i'm using this:
https://paste.md-5.net/zobidejife.cs
To get if the player is in the network (using a spigot plugin)
i think this is a diffrent bug?
The thing is, i've disconnected and when I send the message
The player still is marked as connected
Why does that happen?
the player you are using to request the list is already disconnected, so the PMC never gets sent for an update
Should i get a random player of that server?
yes
Okay, i'll try that
If your Cosmetic class is a constructable type and you're trying to serialize/deserialize it, then yes, you need a no-arg constructor so Gson can create an empty "default" instance of it, then reflectively populate its fields
any player that is not the one disconnecting
yeah i used the same class which is SkyWarsKit now it works ..
i was hoping if i can do only Cosmetic so it can push all kind of Cosmetics..
now i need to make 3 ,4 methods 😦 for each Cosmetic type
Gson will want a type adapter for each type of serializable object, yes
I'm sure you can find a way to generalize it but one way or another, all types that you want to be serializable, Gson has to be aware of it
It can be painful, yeah, but it's definitely one of the best json libraries for Java :p
At least the most type safe and flexible
JSONSimple is really your only alternative and 
naah xD
Basically just a glorified Map<String, Object> with zero type safety
When do we get Hson
And if there is only one player on the server?
like, the one that disconnected
then you can;t ask
is there no way?
not with PMC
you could just wait
for a player to join
your server doesn;t need to know who is on the network if there are no players on that server
Do i make a Set<Player> if Bukkit.getPlayersOnline is null and then when a player joins ask the channel?
I mean, you said not with PMC, is there other way?
just request it when someone joins
yea
sorry, another question...
PMC doesn't work if the server is being disabled, how can i do this?
As i can't ask the server in that method
if the server is being shut down why are you worying about who is on the network?
the players online status shoudl not really be stored in sql
not doing that
in sql i'm just storing numbers not player status
do you mean setCurrent?
that the db
wdym
playerList.size()
Ooh, sorry is not that xd
Global and Current is the timePlayed
nothing to do with players across the proxy
ok
But as I need to use papi I can't make this plugin in a proxy
What the correct way to log a shutdown message?
log?
Well, the issue is that because there's no guaranteed order of operations the logger might be already shut down by the time I try to log the shutdown message for a chat..
I have a chat plugin that I wrote.
The chat plugin has a log file.
I want to log in the chat log "server was shut down".
so log it. your plugin has its own logger
The issue is that, well I tried:
private void registerKuuChat() throws IOException {
System.out.println("CriticalFixes: Loading KuuChat.");
var kuuChat = new KuuChat(this);
// Register onDisable hook from inside the KuuChat class.
Runtime.getRuntime().addShutdownHook(new Thread(kuuChat::onDisable));
pluginManager.registerEvents(kuuChat, this);
}
But by the time the shutdown hook runs it's dead already.
Because I didn't know what else to do.
Well, I can't use onDisable from inside the class.
Otherwise I would.
Yes, that seems to have done the trick. Thank you.
idk why for some reason the data is not being sent to jedis (other servers)
this is in Lobby plugin :
moudle as you can see iam publishing the kit data
and in the game moudle plugin , i do this but it never sent anything it never sent synced
it only send kit storage enabled ..
iam so confused why it does not send any message :
?????
i checked entire console nothing is sent!
still need help ..
Where did you put this code?
I suspected as much, but thanks for the extra info!
I'm losing my mind
for some reason just dropping the item in doesn't update the client but shift clicks or any other modification does!
what da hell
onEnable in game moudle plugin
I feel like I need to add a sendAllDataToRemote in my patch somewhere but like where tf that would be is beyond me atm
i tried to debug it :
Is that a regular anvil?
Bukkit.getScheduler().runTask(this, () -> ((Player) event.getView().getPlayer()).updateInventory());welp this fixed it, but now I need to figure out where tf to send remote data in ContainerAnvil
Console messages and code messages look different
yep, I'm working on adding better Inventory API
death to AnvilInventory 💪
Interesting
Rate the help menu part of my server core so far:
Nice
It generates the listing based on the directory it's in
But should i make it show the whole directory like the ones that aren't being used
or should i like highlight the current one and grey out the rest
i need ideas lol
A dumb-proof system
fr
I find that I have to provide a LOT of user support when i develop for servers, i just decided that I wanted to add more to my core API
this is actually quite a fun part
Why would it always return null?
What is it?
just a hashmap with a pair
I went back to what i made, i tried to use a lib to see if i would get a different result but it was the same.
why are we not using records here
because what you want isn't in the map
i've never used records. i'll look into it. Thank you. been trying to debug this for a minute
So i have to make a new class from what im reading. sorry for stupid questions. still learning java
i understand the problem now , so when ever i create a instance of DataSyncServerSync in (lobby and in game moudle ) it create new instance of it , and it create new map (empty map of kits) ..
Imagine manage files in-game
i mean i could idk if spigot api allows you to modify other plugins
but also,
file editing in game would be like
hell
Of course
I mean you can't modify the jars but you can modify their configs and such
yeah i guess
you technically could modify their jars, but its already loaded into memory so it wouldn't do anything
only problem is that i only have like
1 plugin that's not my own
on my server
lmfao
so theres not much point anyway
But we are developers, we live in the hell
well no i didnt mean to develop it
that would be simple
just imagine being a server owner
and trying to edit a file using like
chat prompts or something
skill issue
I’ve made a yaml editor with GUIs
I really feel like I should've just made a config file
🫠
i mean at least i have a readable-ish code version now
I'm curious as to how that worked
And is it simple to use?
can't be simpler than just editing the file llol
Ah, shish, i really thought that it reads your mind
I have a question
i might make one that like has a similar thing to what i'm doing for my help menus, but instead of actually modifying the text, I just parse it and then allow the user to change fields like toggling booleans and changing text fields with anvils, then i'll just serialize it again
But... My english sucks so much as I think?
where are you from
Pluto ✨
dang
What does it parse?
Booleans are a toggle, everything else can be edited via a chat prompt
personally i'd do it with an anvil
theres a clickable field, with a confirm button lol
don't anvils have the same length as the chat limit?
hmm
I play a lot of modded stuff so
Might be that
I wonder if a book would work
I thought chat got bumped up to 256?
Can’t forcibly open an editable book, only signed ones
Might be possible with some lectern inventory jank tho, never really tried
not even with packets?
surely you can use some interact packet to make the player open one
o
you cant update records?
no
personally i wouldnt recommend using them
just make a normal class
more freedom
Well my issue is i need to store skills and be able to update them as needed
sure, why would a class not work?
i mean if u wanna use records, use a method that creates a new instance of that record which changes one parameter
there is even a name for this pattern just don’t remember the name
thats what im not getting. i need to store each player multiple values and be able to update them as i need. but i cant think of what that would be called
Values of the same type?
Sounds like you want to have a DAO (data access object) to access and store players by uuid, then a DTO (data transfer object) which is a class with the fields of the data u wanna store
I don’t think records is the right choice here I shall say as well ^^
so, store each skill in a field with a value. but java will save that in memory?
my brain kinda just exploded.
that’s fine, mine malfunctions similarly at times
If you only need to save couples of a String and an int for players you could simply make a Map<UUID,Map<String,Integer>>
it’s appropriate to have a Map<UUID,PlayerData> where PlayerData is a proper class
but yea if u want dynamic string-integer pairs then that might be reasonable
But what PlayerData should contain? A Map<String,Integer>?
I mean, I bet there’s more than just a Map<String,Integer> field
and even if that weren’t the case, what if they wanna add another field in the future?
I don't know if he wants to add things or not
yea but well, its often worth trying to write code that requires less refactorization in the future if possible without compromising anything else
i just somehow spotted an unordered bracket logic error first try
aha
now the directory shows a color and highlight
along the right path
You just opened your third eye
i think i have a talent for creating plugins fully fledged without testing and they seem to work first try
yeahhh nested directory highlighting
ok imma go sleep
Good night
is there a better way instead of using getters and setters for every value?
your ide shoudl have a function to create all getters and setters
it does. made all of them but i want to be able to have something like
skilldata.setSkill(skill);
if (skill.equals(skillData.getSkill())) {
skillData.updateXP(15);
}```
I feel like exposing your files in game is a bad idea
or would i be better off doing each if (getSkill().equals("Mining")) { skillData.setMining(xp); } if (getSkill().equals("Woodcutting")) { skillData.setWoodcutting(xp); } if (getSkill().equals("Digging")) { skillData.setDigging(xp); }
Having the same issue i was earlier with it not saving in the fields...
if (skillData.getMining() == 0) {
skillData.setMining(xp);
System.out.println("Data not populated..");
return;
}
skillData.setMining(skillData.getMining() + xp);
sendChat(getPlayer(), String.format("Skill: %s, XP: %s", skillData.getSkill(), skillData.getMining()));```
it always equals 0
so only static saves data?
probably, not sure how your stuff is setup.
why would it be making a new instance everytime its called?
you are creating one
so it makes a new instance everytime i call SkillData skillData = new SkillData(skill);
so how do i fix this problem?
Save your instance somewhere
i have no idea what that means lol
those aren't files.
That's a help menu I made, those are just categories
It has an internal system
got nothing to do with filess
learn java
that is literally the very first thing you learn
like how objects work in general
Yeah, please learn at least OOP if you use its concepts. Then learn java do know how to write the concepts you learned
Ah the MySequel folder made me thing that it was a file fieeer
~~Does anyone know what is this error about https://paste.md-5.net/ikihejimew.rb ?
I use remapped spigot 1.21 and this is the code https://paste.md-5.net/ukivekobed.cs~~
No need anymore, updating the spigot software solved the issue.
Hi I've spent the day looking for a way to synchronize inventory between 2 servers in real time on a proxy. I've tried every possible way and I've come to the conclusion that it's impossible to sync inventory without making the player go through limbo (it's impossible to sync just via the loading screen). has anyone tried the same thing?
why exactly are you trying to sync 2 inventories?
Because I have 2 server, build and minage and I want it to work like a single server.
It’s definitely not impossible
When a player leaves, push to cache, then when the cache updates, apply on the next server
Rather then on player join
ok, but is their a particular reason that the server they transfer to they would need the inventory immediately?
if not, then you could just update their inventory on the server they transfered to at earliest convience instead of trying to do it right away
could even give a notification to player that their inventory is pending update
Yes But it's always better if it's instantaneous (I think there are servers that do this) because you sont have to put the player on hold in limbo.
how do i check if a player can see a specific entity
It's not gonna be perfect, but the best option is to raytrace between the player and the entity
i don't want to check if he's looking at an entity
i want to check if he can see an entity
I know, it means you have to raytrace between the player and the entity for blocking blocka
not sure what you are basing your opinion that its always better
- find some mechanics to handle the FOV
you don't have to put the player in limbo if there is no requirement to have the inventory immediately
how do i spawn a fake entity to a player with nbt? in protocollib
this type of nbt (in this way of writing) {NoAI:1b,Whatever:1b,Idk:1b,etc}
Why do you need this?
i want to make some of my entities client-side so they dont just disappear (they do alot). so i serialized them as nbt
i dont want my server to be one /kill @e away from pretty much dying
😿
why would you give people permissions to this command then
and if your plugins have this major flaw
you could you know, just respawn the entities -.-
i dont give them /kill @e
Accessing PersistentDataContainer for players every hit would cause performance issues? Is it loaded into memory at start?
but im 99% sure im gonna accidently do it at some point
i tried that, it just spawned like 10k of them because of a crash and sometimes they dont respawn for whatever reason
and it isn't easy to debug the code that respawns tem since i have to wait for them to disappear which sometimes could take days
I think the PDC looks up from memory (acording to chat gpt | coundnt find anything about it). But its designed for fast access so that shouldnt be a problem. But accessing it every hit could maybe be something. Can you explain what exactly you are trying to achieve?
again design flaw
^
i tried killing them manually and my code was working, but debugging it to fix the random disappearence could take months
it is easy since multiple people here have successfully used entities in this way
/kill @e?
yeah
anyways, obviously when a server starts it makes little sense to respawn them
that's a good idea
all you have to do is keep track of their locations and store that somewhere. When a chunk loads check if your entity is suppose to be there
if the command is used, just put your entities back in the chunks that are currently loaded
well, how would i check if the entity im looking for is the actual entity
if its a custom entity, you can put custom data on it
and also checking if its custom entity
there could be multiple custom entities in the same chunk
and you want a specific one?
i want both
I'm storing 2 variables per player as I don't want to use DB. I would have to check for it every hit as my plugin logic goes like this.
Anyway I would be better loading it into plugin's memory at join
well, not sure why you would have two entities in the same location
in the same chunk not in the same location
yeah just use a db and load it at join would be best
As I said I don't want to use DB. I will just load data from PDC at every player join.
also possible
then why bother getting help if you are just going to do it in a way that gives you problems
its very counter intuitive you know
how do you get itemstack from the block placed or just the PDC data from the item that was placed (blockplaceevent)
the other ways are either insanely complicated or dont fit my needs
How can I ensure a player connects to the server I give him first and doesn't change servers unless told so? On Bungeecord
i wasnt talking abt your method when i said complicated
well they can't change mid connecting
they could drop the connection though
but then that should start the process over
I mean that when the player connects to the proxhy
the player cannot instruct the proxy to switch servers
unless you fuck up permissions lol
the player doesn't get to choose which server they go to when connecting to the proxy
Yeah I mean plugins
they can only do that after they land on the lobby
To ensure that they connect to my server if told so
or don't give them bungee permissions
I'm doing just that
I'd like to do the same for Velocity
But no support cuz am banned on papermc discord
well not sure what issue you are having or why you are not able to prevent a player from switching to a different server
in both cases, its just events fired on the proxy
Basically: how to make sure the player connects to my server first
what do you mean to your server first
And no server switch occurd
are they not all your servers?
I mean that another plugin
Can always connect to some lobby server
is this your network or something. Not sure why you would need a public plugin to have this overriding feature
I want them to connect to my server and only to that lobby server when I specify it to do so
well that is what the proxy already does....
you can disable the functionality that they go to whatever server they left off of. Doing this, they always connect to the lobby
unless you are letting players directly connect to the mc servers
which you probably shouldn't do that lmao
Proxy -> my plugin tells the verdict -> either (the server he would normally connect to if he is in the db) or (my limbo server, the player does stuff to be added to the db -> connects to the original server)
Oh ServerConnectEvent overriding I guess?
just fyi if you delay the connection too long they just dc
🙃
I was wondering whether that's it
Well if you for some reason don't have control over your plugins and fear some plugin sends a player to a different server without your approval then yes
Why not?
events on the proxy is it
letting people connect directly to an MC server if the server is managed by a proxy means they skip authenti- oh wait 🤡
Ohh
Yeah I would need to use FastLogin
But how would I even allow for direct connections?
by just exposing your mc server port to the public?
So people can connect to a server just by simply knowing the port and address?
No checks whether the connection is coming from the proxy?
if you knew proper administration of a server
this is a non-issue
its not hard with networking to ensure connections come from the proxy lol
but atlas kids are too dumb to know networking though
my tables are in shambles 
ideally you should setup a vpn between the servers if they are on spearate hosts
Yea
since if I recall, the connections between proxy and mc server are not secure
but using a vpn though regardless just makes it easier to ensure you are getting the connections from the proxy host anyways
I am waiting for so long for my delivery to get here that I literally did the entire 1.21 update for my plugin while waiting
so i did what you guys suggested , i no longer use database to store and edit Kits.
and now iam using redis to push the kits when the lobby server start , or when i edit a kit in the lobby server
but its not working .. when i start the game moudle plugin , it create new Intstance of DataSyncServerSync class
which contains the hashmap
and i have a KitComunication but i don't thing its saving it into the map , or does the map reset when i create new instance of the class?
I am so sleepy
and in game moudle onEnable i try to run this for testing :
but it give me empty map ..
is there a way i can do it :
- send kits , cosmetics data from lobby to other servers at once?
if it does not work , i think i will go back to save the kits into database (mysql) .
Do you have the code on GitHub or something?
not really its privite project ..
\
is it possible to :
- in lobby when the server start save the kits , cosmetics into map
- in game server when the server start it load all the kits , cosmetics from the redis map i used and put it in cached map in game moudle .jar
and when i edit the kits , cosmetics in lobby it should push the updates to all game servers
trying to shade mongodb into my plugin
getting error when running ./gradlew shadowJar.
org.gradle.api.GradleException: Could not add file 'E:\Idea Projects\Assignments\2\Saddam\build\classes\java\main\net\furium\saddam\commands\TeamCommand.class' to ZIP 'E:\Idea Projects\Assignments\2\Saddam\build\libs\Saddam-1.0-SNAPSHOT-all.jar'
and Caused by: java.lang.IllegalArgumentException: Unsupported class file major version 65
It says unsupported version even tho I have java 22 and gradle using 21 for mc 1.21
Make sure shadow is up to date
And that gradle is too
Might need a fork of shadow not entierly sure
Yeah
Anyone knows any development library for bungeecord plugin?
Bungeecord API
I mean like library that makes things easier, like helper by lucko if it's bukkit plugin.
Bungeecord plugin I mean, sorry
Idk if there’s much u can abstract
what would be the best way to go about checking if the green and red blocks have blocks connecting them like in this image?
you ask about yellow and red, but show red, gree, and orange
mb the red and green boxes
depends how far you want to search
the green/red blocks can be anywhere
not sure what you mean by anywhere
are you saying if they are separated by 10k blocks you still want to know if they are connected?
no i mean like they might not be in a straight line of each other, but they will be within 30 blocks of eachother just anywhere within the 30x30 area
and what is considered as them being connected?
if the orange block is next to the green/red blocks
2 dimensional? So no up and down?
no not up/down
do diagonals count?
then all you have to do is follow the orange blocks and check the side to see if there is any red or green blocks if not, see if there is any orange blocks, if so, check around that one. It may be wise to cache the locations of these orange blocks in case the path circles so you don't end up in a circular check and all lol
ok thanks
If I were to add a new class to CraftBukkit, where would I add it
hope that this meant "it's on github but it's a private repo" and not "it's not on github because it's private"
Presumably in the CB repo?


