#development
1 messages · Page 66 of 1
simply, you will get the PersistentDataContainer, and then "set" the owner and the users that can access it
then those will be eternally saved to that chest
now every time the chest is interacted with, you dont have to detect any signs or anything
you can just check if the data is there
Take ur time I'm actually going to crash my self- i can mess with that later
Wait so the signs would be visually representative but not used as the data storage
No you should save to the chest
But how would I set the initial chest?
well, you detected it correctly
Because if I use the current method double chests arent saved it currently
here
Or detected
oh well you can just use a normal CHEST and check if there's another chest next to it and lock it too
Hm. That could work the only risk is
If a player had a chest wall
And it looks chests that shouldnt be locked
oh maybe
Maybe to fix the diagnol issue
I can do the math to figure out the blocks BEHIND THE SIGN ONLY
But that wont fix the double sign issue
uhm how would I get the slot of the currently held item? (Item in main hand, get that slot)
PlayerInventory#getHeldItemSlot probably
oh yeah ty
After HOURS of looking thru different methods:
THIS is the best way to detect if a sign is on a chest and stops signs from across a block causing issues!
public void onPlayerInteract(PlayerInteractEvent e) {
Player p = e.getPlayer();
if (!p.isSneaking() && e.getClickedBlock() != null && e.getClickedBlock().getType() == Material.CHEST
&& e.getAction() == Action.RIGHT_CLICK_BLOCK) {
Block chest = e.getClickedBlock();
p.sendMessage("Chest Clicked");
// Check if it's a wall sign and get the attached face
if (chest.getBlockData() instanceof org.bukkit.block.data.type.Chest) {
org.bukkit.block.data.type.Chest chestData = (org.bukkit.block.data.type.Chest) chest.getBlockData();
BlockFace frontDirection = chestData.getFacing();
Block inFront = chest.getRelative(frontDirection);
if (inFront.getType() == Material.OAK_WALL_SIGN) {
WallSign signData = (WallSign) inFront.getBlockData();
// Check if the sign is attached to the chest's face
if (signData.getFacing() == frontDirection) {
Sign sign = (Sign) inFront.getState();
// Check your sign conditions here
// if(sign.getLine(0).equalsIgnoreCase("[Lock]") &&
// !sign.getLine(1).equalsIgnoreCase(p.getName())){
p.sendMessage("test3");
e.setCancelled(true);
}
}
}
}
}```
I would argue 'best' but sure
arrow code goes brrr >>>>>
[ERROR] Failed to execute goal on project crazycrates-v1_16_R3: Could not resolve dependencies for project me.badbones69:crazycrates-v1_16_R3🫙1.10.2: The following artifacts could not be resolved: org.spigotmc:spigot🫙1.16.5-R0.1-SNAPSHOT (absent): Could not find artifact org.spigotmc:spigot🫙1.16.5-R0.1-SNAPSHOT -> [Help 1]
Is there a repository which has 1.16-1.8?
I think its because of how I copied and pasted it that its format got messed up
legit took me hours of digging thru old bukkit 2012 posts to figure out how to do it
The only issue it ahs now is that it cant figure out double chests
The legal (and recommended) way is to run BuildTools for each version needed: https://www.spigotmc.org/wiki/buildtools/
But that can take a while, so in the meantime you can add https://repo.codemc.io/repository/nms/ as a maven repository
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
thx
Anyone know of a way to apply this to double chests?
Are you trying to get the sign when placed?
The code above checks if a sign is on the front of a chest and then if it is and you meet the criteria it opens the chest
the issue is that it doesnt apply to double chests
Ah missread. So you want the sign to contain lock and the name?
Yes.
Ie:
[Lock]
Username of player
only the player can open the chest
Ok give me a bit.
@EventHandler
public void onOpenChest(InventoryOpenEvent event) {
Inventory inventory = event.getInventory();
Player player = (Player) event.getPlayer();
if(!(inventory.getHolder() instanceof Chest) && !(inventory.getHolder() instanceof DoubleChest))
return;
List<Sign> attachedSigns = locateSigns(inventory);
boolean isLocked = false;
boolean foundPlayername = false;
for(Sign sign : attachedSigns) {
List<String> lines = Arrays.asList(sign.getLines());
System.out.println("Sign: "+lines.toString());
if(!lines.toString().contains("[Lock]"))
continue;
isLocked = true;
if(lines.toString().contains(player.getName())) {
foundPlayername = true;
break;
}
}
if(isLocked && !foundPlayername)
event.setCancelled(true);
}
List<BlockFace> faces = Arrays.asList(BlockFace.NORTH, BlockFace.SOUTH, BlockFace.EAST, BlockFace.WEST);
private List<Sign> locateSigns(Inventory inventory) {
InventoryHolder holder = inventory.getHolder();
List<Sign> attachedSigns = new ArrayList<>();
if(holder instanceof Chest chest) {
for(BlockFace face : faces) {
Block relative = chest.getBlock().getRelative(face);
if(relative.getType().name().endsWith("WALL_SIGN"))
attachedSigns.add((Sign) relative.getState());
}
}else if(holder instanceof DoubleChest doublechest) {
Arrays.asList(doublechest.getLeftSide(), doublechest.getRightSide()).forEach(side -> {
for(BlockFace face : faces) {
Block relative = ((Chest) side).getBlock().getRelative(face);
if(relative.getType().name().endsWith("WALL_SIGN"))
attachedSigns.add((Sign) relative.getState());
}
});
}
return attachedSigns;
}
https://i.imgur.com/Hwbwjbf.mp4
Keep in mind you will have to track who placed the locking sign so they can still access the chest and remove the sign.
i think most chest lock plugins check for [lock] then adds the player name to the sign to lock it
Yeah but minecraft added sign editing. So that's obsolete in later versions.
There are a lot of checks that need to be done for a chest locking plugin the code above is just what the user was requesting.
So I actually have the entire plugin finished EXPECT for the double chest issue
@hoary scarab im gona dm you a photo where I think ur code could face and issue
That code on its own will have many issues if unchecked in a chest locking plugin. Anyone can break the sign, explosions etc... items can also be removed via hoppers
Yeah so I actually aleady covered that haha
didnt think about hoppers though
Yeah, hoppers, minecarts, droppers.
Also you will have to check other inventory types; shulkers, barrels, trapped chests, furnace etc...
Well for my plugin itll only handle locking chests
How would i even stop minecart hoppers
Just cancel the transfer event
Is hoppertransferevent a thing? Thats neat
Yeap
How would i make a /msg /r command that work across servers
in a plugin for spigot (whats the best way to make it?)
While supporting vanished players (so people cannot message them, or maybe they should be able too
)
Pluginmessaging, would also have to link with api's of vanishing plugins
what if the player is in other server and is vanished, i'd need to check the vanish api in that server and then send a reply to the sender server

Yeap
Unless both users have vanish permission then just allow the message to go through
mmmm thinking it twice, if someone sees a /msg /r plugin, they will probably ask for /ignore and /unignore commands
which requires saving player data, i guess it won't be a feature then 
alternatively you can use websockets instead of plugin messaging
Redis messaging is also an option I suppose
i was thinking about that too
but i realized that it would be a requirement then like
Requires Redis to work, which idk if people will understand at all

in any of those cases, i'd still need to:
- check if target is online
- in the target server, check if target is vanished
- reply with a yes/no (vanished or not)
- listen the reply and decide what to send to the sender
or am i wrong? what would be the easiest way?
(or maybe just ignore if a player is vanished or not, and send the message anyways
)
Your own priorities over what stupid people understand

you can make it optional, but from what I have worked with redis lately, fell in love with it.
but yeah, your issue is a bit eh, I think another approach you could try is listening to when a player vanishes and send a message to all servers letting them know, then you cache that player in a "vanished" list and voila, if the player the user is trying to send a msg is in that list, dont send it. @shell moon
could be achieved with redis or even plugin messaging, whatever
you would potentially spare a lot of messages/requests
With plugin messaging system mmm, when player leaves the server if it the last player plugin message doesnt work as it need one iirc
I was thinking about the redis thing but that would require them to host their redis which not everyone knows (they'll have to learn), with the plugin messaging thing, if the last player leaves the server then message system stop working as it requires at least one and it wont send the remove order (from vanished list)
I guess i'll go with redis and make a warn if /msg is used but redis is not setup or available stating that its required to use cross server messaging
or just host a built-in rest api in the plugin, where you could make a request to check if the player is vanished 
Can someone help me with this error? the plugin works great! just this error spams the console if a player clicks anything.
My code:
https://pastebin.com/nJWMFAnG
assuming you have control of the servers and such, though this approach might not be ideal for your case
Hey @river solstice you mind checking my issue above if you got a sec?
Sign s = (Sign) event.getClickedBlock().getState();
not all clicked blocks are signs
would I just put that under the check for if its a sign then?
you should check using 'if(event.getClickedBlock().getState() instaceof Sign)'
thats prob your issue
anyways im off to sleep, gl
so like this?
Sign s = (Sign) event.getClickedBlock().getState() instanceof Sign;
no
wdym then? oh
someone else will help im sure gl
thanks @river solstice ur advice let me figure it out
If anyone can help with this:
For some reason it only works when 2 people are sleeping it changes the time. When 1 person should be able to do it if only 2 are on the server
@EventHandler
public void onPlayerBedEnter(PlayerBedEnterEvent event) {
int onlinePlayers = Bukkit.getServer().getOnlinePlayers().size();
int sleepingPlayers = 0;
for (org.bukkit.entity.Player player : Bukkit.getServer().getOnlinePlayers()) {
if (player.isSleeping()) {
sleepingPlayers++;
}
}
// Check if it's currently night
boolean isNight = Bukkit.getWorlds().stream().allMatch(world -> isNight(world));
// Custom logic to reset the time to day if more than 50% of players are
// sleeping
if ((double) sleepingPlayers / onlinePlayers >= 0.5 && isNight) {
Bukkit.getWorlds().forEach(world -> world.setTime(0));
Bukkit.broadcastMessage(
"§f§l[§b§lWeather §8§lClearer§f§l] §fMore than 50% of the server is sleeping, so time is being set to day.");
}
}
private boolean isNight(World world) {
long time = world.getTime();
return time >= 12541 && time <= 23458; // Adjust these values if necessary for your specific world's night time
}
is this chatgpt code
why don't you just use the playersSleepingPercentage gamerule?
I think you need to delay your calculations by a tick, because iirc Player#isSleeping is only updated once the PlayerBedEnterEvent event has successfully been dispatched to all listeners that are listening for PlayerBedEnterEvent event, without being cancelled (assuming the event is cancellable in the first place, otherwise discard the last point). Generally, this concept applies to a lot of events depending on the context & usage. Explore the given link to learn how to use schedulers: https://www.spigotmc.org/wiki/scheduler-programming/
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.

🧌
Just make it work using plugin messaging, but anything more like vanish checking requires redis
Is it fair to say that if I can't create my DB schema without alter table type stuff due to circular references, i'm doing something wrong/violating one of the normal forms?
e.g. a user table which references another table which references the user table
Yeah i believe so
i was afraid of that

Lmao
how do you prevent players using entity cheats to change the velocity of a mob in a mob?
Another question; if I sent an http request on message sent in chat, could I only send the message in chat after I got a response from the request?
What?
What?
mind your own business
what stream
streamed spooderman on twitch!!!
im sorry i was unaware
damn not following me to get notifications
"Kinda", I wrote the code but I was using chatgpt to help figure out why it wasnt working
On message sent in mc chat -> send http request and wait for response -> once response is received = cancel event or not depending on response.
. ^^
This the the problem/question I have, does the PlayerChatEvent (or whatever it is) allow events to be canceled a few ticks (lets say ~100ms) after?
Okay, already go the answer for this, issue is, how would I do it then? Do I NEED to block the thread for this to work?
yes
which in turn means no, because blocking is not very good
what i would do is cancel every event, wait for the response, then re-send a fake message/event that doesnt get cancelled
you could use the AsyncChatEvent and not block the main thread, but like, if the latency is high enough you'll delay the entire chat every time someone sends a message lol
i think BM's solution is good
where you patiently wait for the http request to complete async and only then make a new event
latency would be like 100ms tops
how would I be able to detect if that now fired event was not meant to trigger the request?
also don't use AsyncChatEvent if you're going BM's route
another alternative if the delay becomes long enough to be irksome when sending chat messages is to let it go through immediately, and then modify the client chat afterwards by resending the updated version of chat
it fires after AsyncPlayerChatEvent, meaning that even if you cancel the event, chat plugins using AsyncPlayerChatEvent (ChatChat as an example) will not know that the event was cancelled
would be a bit scuffed but wouldnt feel sluggish, at the cost of potentially showing an unwanted message in chat for a short amount of time
plus the AI computation time?
tbh idk how long it takes
I'm on east coast USA, and when connecting to a luxemburg (since iirc you live there?) server, I get 203ms ping 🥲
so if you include AI computation time, North American servers are gonna have a noticeable chat delay
probably won't affect gameplay, but it'll be noticeable
actually it seems like OpenAI servers are located in the US, so assuming you're going to put your http server in the US (to avoid 200ms+ latency for everyone), latency shouldn't be too high in the US
US ftw
if everything goes right, I will have a server in europe and another in the US. requests will be redirected to the nearest, no idea how but will find out later lmao
either way, it'll have to go to the US, so unless it's for load balancing purposes, I would just have US for now
unless OpenAI puts EU servers
Yeah, it's stuff I will have to check later xD
But just to make sure I understood, if using AsyncChatEvent, I could do this and then cancel it when I got the response?
Also, yes, ~100 everything included depending on location. But this will only happen IF I happen to do "real-time" AI assisted moderation. I will already flag messages on the go and list them, but unsure if anyone would be interested in that tbh...
like, the messages were already sent, and you only get notified after it happens...
idk
Also, yes, ~100 everything included depending on location.
included depending on location?
from the mini tests I have done, AI computation and response is about 60-90ms, so the rest depends on location.
I will already flag messages on the go and list them, but unsure if anyone would be interested in that tbh...
You can have it as options maybe
wdym?
oh ok
Since USA -> Europe is going to be 100-300ms ping, so cancelling events is probably only good for servers already in the US
like
- cancel events
- flag messages
- delete messages (spam the past like 100 messages or smth, or if it's a signed message, then delete that way)
- would mean sending a request on every message and could cause latency in messages
- This can be done in batch since it's not a priority to be checked right away
- This is a very skatchy way of doing it and I would prefer to avoid it since that would also probably mean users can't use their own chat plugins or something like that. In general dislike it. sadly
Like, if it was only post-message analysis (2), doubt anyone would use it tbh.. Like, you as a server owner, would you use it? If the answer is no then yeah....
I meant for those to be user options since they all have their downsides
Also for deleting messages, how come they wouldn't be able to use their own chat plugins? You should be careful of that for #1
probably if there are no staff online
canceling a chat event shouldn't cause any issues no?
Also, I know it was just options, but those options also affect both infrastructure, costs and are well, regarding the third, skatchy af.
Eh I mean, sure, it would make job for staff also easier in theory and would require less staff in general, but would you pay for such service?
can I not cancel the AsyncChatEvent? And even then, how would I add support for those lmao
I mean I don't own a server or anything, so I don't know
But unless I have enough revenue to easily cover the cost, probably not
you'd have to cancel AsyncPlayerChatEvent
but that one can be canceled after a certain time right? Would this also cancel the non async event?
I think non async event goes first, but I'm not sure
but no plugin should be using it
since async event is in spigot as well
i mean there are valid reasons to use the sync chat event
I suppose, yes. Although, I plan to have a free plan, not going to use AI stuff obviously xD, but it will act as a normal chat filter for anyone who wants to use it or have a built-in system if they plan to upgrade. Besides, this will have a global database of words to be filtered (probs using regex) so, updating that list would be easy since it's connected.
true yeah
blocking the thread is not one of them
maybe I said that too harshly
This all is still in the early stages of planning either way, I still have to learn Laravel and Vue before I do anything 💀
Hmm but yeah will have to check this, cause if it's not viable, I will simply not even add it to the website
What if I block the thread
lag
Will my computer explode
unlikely
How likely is it
lmao
My pc exploded when I spawned 10 thousand cows the other time
sounds like 9999 is the limit
Is it really an exploded? Did the firefighter came? omg
💦
I'm sure he came, probably quickly too
any ideas how I would achieve this? I am a bit confused on how to properly execute this. L is a leaderboard hologram, and I have to position them like shown below in the direction the mob is facing (in this case north if up = north)
mad drawing skills
ikr
Offsets multiplied by direction
wut
like that, v is your direction vector and you just multiply it somehow to get the wanted distance
So you have the offsets you want then just multiply them by the direction the mob is facing.
wait there's a direction object? or this the pitch?
Location.getDirection()
I don't think that's a method
same lol
so, you get the direction of the mob's current location (aka direction he's facing), then multiply that vector by 3 (so 3 blocks in front) and set the direction of a new location for the hologram to that?
can you even multiply vector objects? lol
oh there's a method for it
no, you most likely want some specific direction vector
You can also just use some trig 💪
and after multiplying, you project it onto the position of the entity with some offset
hell nha, promised myself I wouldn't touch that thing anymore 💀
wut? wdym with project it onto the position?
basically just an addition
so add the multiplied vector, to the mob's location and that would be the new location?
by entity you mean the mob or the hologram
doesn't matter in this case
Whats more efficient for messages? string#replace or chatcolor#translateAlternateColorCodes?
as long as you use the nonregex replace method
it's fine
probably doesn't matter at all
or just use minimessage and get rid of legacy colors
Uhm so going to repost this here from the DS discord since they take ages to respond, using DecentHolograms API and I am trying to move the hologram around every 5 ticks, but it appears to keep flickering? which I find quite weird. Like it appears for half a second and then vanishes, then comes back after 1s or so...
This is my code:
Bukkit.getScheduler().runTaskTimerAsynchronously(plugin,() -> {
if (entity != null) {
Location loc = entity.getLocation();
DHAPI.moveHologram("bmv_lb_3", loc.clone().add(loc.getDirection().clone().multiply(3)).add(0, 2, 0));
}
}, 5L, 5L);
How can download manually the spigot dependencies and spigot repositories and load in build.gradle in local dir in the same path of project?
compileOnly 'org.spigotmc:spigot-api:1.16.5-R0.1-SNAPSHOT'
maven { url 'https://oss.sonatype.org/content/repositories/snapshots' }
maven { url 'https://hub.spigotmc.org/nexus/content/repositories/snapshots/' }
How can download all in a folder called "libs" and then load in build.gradle(instead of find in cache)
you're accessing the entity's location, which is not thread safe
and that's what's making the hologram flicker? shouldn't that throw an error too?
if it's being access async and it can't, shouldn't that throw an error?
it can, but it's not safe, i.e. you could get some trash data that breaks your code randomly at any time
the problem with race conditions is exactly that you can't just try and see if it works
What's going on
Did you go to harvard art
it's fixed now? After a restart it fixed itself? idfk lmao
ikr, ty
[ERROR] Malformed \uxxxx encoding.
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
Process finished with exit code 1
Cant solve this error..
Someone had this before?
Please @ me
Most prolly some dependency in .m2 has been corrupted… you can either delete the whole .m2 directory or run maven package in debug mode to find the one which got corrupted, if u can’t delete your entire maven packages
https://stackoverflow.com/a/69004125
This is how you can find the corrupted package
I ask this once every some months in case a new options appears:
Best way to restore/regenerate arenas for multiarena minigames like eggwars/bedwars/skywars etc?
- FastAsyncWorldEdit API
- Save a copy of the world folder, then unload the world, copy saved one and load again
- ASWM (advanced)slimeworldmanager (api?)
- Any other good way maybe?
The idea is to not affect performance (too much)
feel free to ping me on reply, share github examples, apis, etc
Thanks in advance for your replies ^^
Could go with all packets but you have to keep track of the world. (Blocks, entities etc...)
Slime Word Manager is probably the best to have a lot of instances running at once
That's my dream scenario for a Dungeons plugin I use, since they're just so damn lightweight and efficient
even with normal worlds, it takes like 500ms to make a new copy of the world in memory and shit
On a semi-related note, why aren't more compression options added for words
zstd, lz4
Ask Mojang
Thank you, I'll try that
I mean, it's possible for Paper etc to add it too
very easy, as far as I can tell
But then it’s on them to make sure it‘s compatible and maintain it for years
compatible with what
With mojangs world code
i mean it wouldn't be compatible with that, as far as making worlds compatible with vanilla (and other server impls not imeplementing that)
that was kinda implied tho, if Paper or whoever was doing it independently of Mojang
the point is its a lot of effort
is it though?
I'm looking at the NMS rn and, assuming i'm understanding it properly, it looks like maybe 10 lines of code, probably a few more if you wanna add the ability to convert existing worlds between compression types
Didn't see that one on my searches
Do wanna add that the diffs/patches there don't reflect the current NMS (guessing that mojang changed that at some point between then and now); all of the abstraction necessary for adding support for additional compressions already exists now
point one- i mentioned that already
point two- i heard that, but I thought it was something from ages ago, not that recent (tho tbf oct 2022 isn't that recent in the grand scheme of things)
2022 is recent for the people who have to maintain that stuff
Why does the team.setPrefix() not support the md_5 color lib?
Now I cant use hex colors for that 😦
Btw, for some reason this project is doing weird.
https://imgur.com/a/CRno3KS
It can be build but I cant use the code anymore
Its only for bukkit
invalidate caches?
What do you mean?
File -> Invalidate Caches
damn that was a fast restart
I have a pretty fast pc and invalidate cache still takes over 10 minutes lol
Must be a pretty small project
... aren't you using maven?
Jep, not that big
then why r u in the artifacts thing
Because I am trying to find what the issue is
Normally it is looking like this for me
Btw intellij now has a more step by step process - File -> Repair IDE
And invalidate caches is the last step
If all others fail
issues like this are usually an issue with the build/dependency system or IDEA's interpretation of the system's state
(or someone screwing up the dependencies in the pom.xml/build.gradle)
Delete .idea folder and a .iml file if it exists
That should also reset intellij artifacts
Do that and restart intellij or reopen project
Does the maven tab not have detailed dependencies like gradle does?
This will reset all intellij settings on the project tho
pretty sure it does, though i haven't used maven in ages
looks like they're using an older IDEA, maybe that's why
What's the build tab output from refreshing maven?
This was the issue
Now its fixed
Don't know why tho?
Maybe you did something with intellij artifaxts
IJ being funky that's why
No nothing, it was just when I added bungeecord dependency and refreshed
It came out like this
You added bungee cord dependency through pom.xml and not jar, right?
sometimes IDEA and Maven/Gradle end up arguing about the state of dependencies
my usual order for resolving that (at least prior to this "Repair IDE" function) was:
- refresh maven/gradle
- invalidate caches
- close IDEA, delete .idea, restart IDEA
(pom.xml)
and when using gradle, sometimes deleting .gradle as well
But now that I can go back to this..😂
Is there a other way to apply hex color to team.setColor()?
I assume ur on spigot, rather than paper, right?
doesn't look like it's possible on spigot (or even paper, actually), unless you can convert hex to the old section formats and use them in the string
that's what it looks like
So sad
team colours are only the named colours
It works for the prefix tho
sure
but that's not what i said
the prefix accepts any json component
the team colour can only be one of the named colours
maybe in NMS or something that could be changed, but that sounds very fucky
not really no
Yeah okay, but thats so sad tho
Is there an alternative to change the color of the name?
With hex color*
i'm guessing it has something to do with how MC orders names/teams in tab or something?
no, the vanilla Team class uses the ChatFormatting enum type for color
and it's network-serialized as the enum varint or whatever
ah
where are you trying to change what's displayed? depending on that there might be one or another alternative solution
On the nametag and tab
as a properly formed Component? no, as a Component with legacy formatting inside the text itself (yuck), "yes"
you can just use Player#setPlayerListName for the tab list
for the name tag what i've seen people do is hide the player's own nametag (team visibility stuff or whatever) and mount a text display entity
with the formatted text
unrelated:
does anyone have any reference material on designing projects, particularly as it concerns mapping DB schemas and your beans / models / entities / pojos / whatever tf else
not talking about ORMs, I mean the actual fields and methods
e.g., expressing relationships: should the object which holds the foreign key in the table have a field (or method) for accessing that foreign key?
and on top of that, as it concerns tables with primary keys which aren't the same as the user-facing identity (e.g. auto-generated guids vs strings)
Good show didn't care for pd but liked med.
this is a problem I have with every project I try to make that involves any level of inter-table linking, and it's making actually producing anything damn near impossible
guys, sending plugin message from spigot to bungeecord is safe or can be faked?
i mean, using a custom outgoing channel like "pluginname:channel" (not "BungeeCord")
you can totally do it
just make sure to cancel the plugin message event on the proxy if you don't want the payload to be sent to the client too
mmmmm what? you mean when reading the message just cancel it the event
so, they can be faked? No way to make sure it is not?
i mean, to be able to use them in plugins
(What exactly means the red part?)
Clients can send their own spoofed packets
So make sure to check where the packet is from
Or just encrypt it
just check the sender
instanceof ProxiedPlayer?
yeah you'll want to discard it if it's coming from a player
ahhh
so if sender is instanceof ProxiedPlayer return
basically if sender is not instanceof Server return
when to cancel?
as soon as the channel check is passed? (i mean when is from my plugin own channel)
you'll basically want to always cancel (just make sure it is your channel, so you don't cancel someone else's messages)
because, if it's coming from the server you don't want to send it to the player, and if it's coming from the player you don't wanna do anything with it on the server either
This was meant as a joke btw


Is it possible to edit item crafted by player inventory (2x2) or rafting table (3x3)
rafting table hm
im tryna click a button with selenium, but i just cant get it to find the element(below).
<button id="button" class="mdc-button mdc-button--raised " aria-label=""> <!--?lit$449762891$--><!--?--> <!--?lit$449762891$--><mwc-ripple class="ripple"></mwc-ripple> <span class="leading-icon"> <slot name="icon"> <!--?lit$449762891$--> </slot> </span> <span class="mdc-button__label"><!--?lit$449762891$--></span> <span class="slot-container "> <slot></slot> </span> <span class="trailing-icon"> <slot name="trailingIcon"> <!--?lit$449762891$--> </slot> </span> </button>
Could anyone please help? Im really really frustrated atm lel
What are you using to find it?
PrepareItemCraftEvent
Thanks
Hello, I've created a complex plugin that creates an animation with custom font images. I am facing an issue tho. I thought that this method:
public String onRequest(OfflinePlayer p, String identifier) {
changes the placeholder indivudually for every player, just like the %player% placeholder. But it changes the placeholder for all of my players, therefore it makes my animation flicker. Does anyone know how to resolve this problem? Thanks!
The method can be used to create player specific placeholders or global placeholders, it depends how the placeholders are parsed (whether the player argument is null or not). But it also depends how you are accessing the data that will be returned, if you for example have a simple List<String> and do a get(index), the value will be the same for all players.
I have it like this:
if(identifier.equals("a1")) {
if(Main.getPlugin().strojcasu.containsKey(p.getName()) && Main.getPlugin().strojcasu.get(p.getName()).containsKey("a1")) {
return Main.getPlugin().strojcasu.get(p.getName()).get("a1");
}
return "䣡";
}```
There are a lot more of these placeholders, but just different identifiers, but the concept is the same
you probably need to lower the refresh rate on the plugin you use to display the placeholder (e.g. tab list)
send a video of how it looks rn, idk what you mean by "flicker"
Main, .getPlugin(), public field access
😩
LOL
best way to support colored redstone particles since old versions to latest?
ParticleLib? idk
abandoned since 1.19.4 thanks to paper ParticleBuilder
Really? POG huge W
good to see devs of libraries just accepting things are better in the latest versions and use them instead
good to see devs not supporting the legacy versions
cough
either way, you could use it for 1.19.4-
and up you use paper's particle builder
I was thinking about that, ParticleBuilder from Paper if available or ParticleBuilder from PartibleLib if available, otherwise, skip Particles

Hello
BungeeCord plugin development
I am trying to prevent player from joining the server at all (from Multiplayer list),
i am using event.setCancelled(true); for ServerConnectEvent event,
yet when i try to connect to server, i am getting forever-lasting default MC screen "Logging in..." until i get Read timeout... message
At the time i join the server, this is what console says:
[02:21:31 WARN] [io.netty.util.concurrent.AbstractEventExecutor]: A task raised an exception. Task: net.md_5.bungee.connection.InitialHandler$6$1@24d4d79e
net.md_5.bungee.util.QuietException: A plugin cancelled ServerConnectEvent with no server or disconnect.
any ideas?
if you dont cancel the event do you join normally?
yes i do
i can provide that part of code
most of the code above this (this is very last part) is much simpler than this
final CompletableFuture<String> codeTask = DVAPI.generateCode(DV.generalConf.getInt("code-length"));
codeTask.thenRun(() -> {
String code = codeTask.join();
DV.getDiscordCodes().put(player.getUniqueId(), Pair.of(code, DV.generalConf.getInt("code-timeout")));
connection.sendMessage(
colorize(sendCodeMessage(player, code))
);
//event.setCancelled(true); // I COMMENTED THIS TO NOT CANCEL TO TEST JOINING THEN, AS YOU SAID, IT WORKED
return;
});
is this when you go from full unconnected fron the proxy server to attempting to connect or is it when you are switching servers?
also when is this code supposed to be ran? unconnected to on cinnect or on server switch or both?
if your trying to prevent them from joining the server entirely then you might wanna cancel preloginevent
i am only testing and only wanting exactly what you asked/mentioned -> fully unconnected from the proxy server to attempting to connect
@EventHandler
public void onServerConnect(ServerConnectEvent event) {
// some code
final CompletableFuture<String> codeTask = DVAPI.generateCode(DV.generalConf.getInt("code-length"));
codeTask.thenRun(() -> {
String code = codeTask.join();
DV.getDiscordCodes().put(player.getUniqueId(), Pair.of(code, DV.generalConf.getInt("code-timeout")));
connection.sendMessage(
colorize(sendCodeMessage(player, code))
);
//event.setCancelled(true); // I COMMENTED THIS TO NOT CANCEL TO TEST JOINING THEN, AS YOU SAID, IT WORKED
return;
});
}
// etc
this part is actually working
btw when i joined the server after i removed setCancelled, i actually was greet by the connection.sendMessage (which all works well as i already checked this part, i am just now trying to make it work with this kick-on-join-whole-server implementation)
i first tried with LoginEvent (had no luck)
ok i will try with PreLogin now
i actually used ServerConnectEvent event, and instead of connection.sendMessage (i forgot, i had a note that i wrote so long ago that says to use this only for server switching especially to evade not disconnecting player from the whole network)
so i ended up wit hthis
Server currentServer = event.getPlayer().getServer();
if (currentServer == null) {
connection.disconnect(
colorize(sendCodeMessage(player, code))
);
}
however, thank you so much for help still 🙂
I'm a little confused about something: how does one make use of Guice for injecting your dependencies with something like listeners where they themselves aren't referenced beyond their registration (which itself could occur in the instantiation of the listener)
Same thing for commands
I usually register a multibinder for listeners, then in the main class just get them all, loop over the set and register them all with bukkit
yeah i saw that you did something similar for commands and i've been experimenting with that, it just feels a bit cluttery
I suppose I could always make use of the eager singleton feature and have the listeners automagically register from their own constructors, meaning I could avoid that whole looping element
Anyone that has solved this riddle yet?
https://www.spigotmc.org/threads/hex-color-support-for-nametag-tab.625165/
I tried some things with Protocolib
But that doesn't work on 1.20.2
First problem: not using adventure
correction: first problem: not using paper
Wdym?
Adventure is a library for components, something that minecraft has used for a while (not adventure, but components) and also what BungeeChatAPI does
yes
Btw, this was not meant to me right?
And paper uses it internally since 1.16.something and there's probably a direct way to do what you want
It was
I don't think so
I think I need to use Protocolib
Because Minecraft only supports legacy colors for teams
Not for prefixes
But for teams
Plib also uses it / has an addapter for mc components to adventure components, idk exacly
Hi there! recently started using intellij and i have started building my projects via artifacts to put the build directly inside my test server. however, it doesnt say the version inside the name when i do that, is there any way to fix that?
there is probably a way to do it in your build system's config
I dont know how to tho
does anyone know if its possible with spigot to add offers to enchantment tabels IE: Add a custom enchantment to the table ?
in theory possible with plugins I think
it looks like its NOT possible but one idea i had that is possible when the player does a level 30 enchatnment it has a chance of being added to that enchantment list
however when trying to register the new enchantment i get this issue: : java.lang.IllegalStateException: No longer accepting new enchantments (can only be done by the server implementation)
it is possible
many have done that
All documention ive seen that its only possible to clear the list of the enchantments and add a new one but you cant add one to the existing list
im confused u try to change output right on enchant?
if you can show me somthing that does id apperciate it! maybe these old fourm posts nver got it
what ver r u on?
1.20
My inital goal: Was to add a new enchantment called "Hammer" to pickaxes that would appear in the enchantment table as one of the POSSIBLE options
EnchantItemEvent
however it seems impossible to edit the offers the enchantment table gives the player
that seems impossible sadly
the soultion i came up with was adding it as a random chance when doing a level 30 enchant
@EventHandler
public void onEnchantItem(EnchantItemEvent event) {
int experienceLevel = event.getExpLevelCost();
if (experienceLevel >= 30 && random.nextDouble() <= customEnchantmentChance) {
ItemStack itemToEnchant = event.getItem();
itemToEnchant.addEnchantment(customEnchantment, 1);
event.getEnchanter().sendMessage("You've been granted the Custom Enchantment!");
}
The code above works kinda- event.getEnchanter().sendMessage("You've been granted the Custom Enchantment!");
sends to the player
but no enchantment is added to the item
useles?
The message actually does send to the player when the random chance happens HOWEVER nothing is added to the item
@Override
public String getName() {
return "hammer_enchantment";
}
@Override
public int getMaxLevel() {
return 1;
}
@Override
public EnchantmentTarget getItemTarget() {
return EnchantmentTarget.TOOL;
}
@Override
public boolean canEnchantItem(ItemStack item) {
// Check if the item is a pickaxe
return item.getType() == Material.WOODEN_PICKAXE ||
item.getType() == Material.STONE_PICKAXE ||
item.getType() == Material.IRON_PICKAXE ||
item.getType() == Material.DIAMOND_PICKAXE ||
item.getType() == Material.NETHERITE_PICKAXE;
}
@Override
public boolean conflictsWith(Enchantment arg0) {
// TODO Auto-generated method stub
return false;
}
@Override
public int getStartLevel() {
// TODO Auto-generated method stub
return 1;
}
@Override
public boolean isCursed() {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean isTreasure() {
// TODO Auto-generated method stub
return false;
}
}
This is the enchatnment class
wdym
because otherwise people would be able to uno reverse the enchants
its on client side
iits not
idk spigot api is dog ass
like its good
but many things are poorly made
its an item i think
here a code that can work only in theory
ContainerEnchantTable container = entityPlayer.activeContainer;
SlotEnchantment slot = (SlotEnchantment) container.getSlot(0);
ItemStack item = slot.getItem();
NBTTagList nbtList = new NBTTagList();
NBTTagCompound nbt = new NBTTagCompound();
nbt.set("id", NBTTagString.a("fake_enchantment"));
nbtList.add(nbt);
item.getOrCreateTag().set("ench", nbtList);
because that thing displays an item
change the packett
and send it to the player
but since u r in 1.20 i would suggest instead make ur own cool enchanting menu
i know u guys got no limits now with texturepacks 😉
lol
u can edit it only via packets
if it worked otherwise hacked clients would have option to reveal to the player the whole enchanmtent 😉
Isn't it addUnsafeEnchantment
I thought?
No it’s possible only via packets
I went thru docs
There is nothing for that
And im guessing packets is rather complicated
Even unsafe enchantment did not work
what is unsafe enchant
just use lore
and store in nbt
the data
of ur item
whats so complicated about it
how long do u code
send ur code
quickly
Unsafe enchantment is somthing that was inside bukkit that let you add enchantments beyond the minecraft limits ie: sharpness 10
This code displays the debug message but does not add the enchantment
So, I'm planning on having configurable roles which contain a set of enums for permissions
In the past when I've tried done something similar, I stored the permissions in the role's row as a bitset using a hard-coded ordinal (rather than Enum#ordinal cus of the whole risk for fuckups thing)
The other option I'm considering is a one-to-many setup with each row containing a single enum/permission
Thoughts?
(If it wasn't clear, using SQL- Postgres specifically)
Second option is the better relational approach if you're using a relational database
Though you could just use enum names instead of ordinals
I think postgres has an enum type, will probably end up using that if i went that way
nvm, looking at it, they want me to hard code the values in the DB schema
if i was using the one-to-many table i probably would use the enum name; i'd only use the ordinal for the bitset approach
I definitely recommend going the one-to-many route
lemme try to sketch up the schema for that and i'll come back
https://paste.helpch.at/abibimemaq.sql
is what i'm looking at atm
kinda hate that there's 3 tables just for roles, cus that's gonna mean 9 tables in all (I'll be replicating this structure for another 2 concepts)
The realm role assignments feels a bit odd to me
(if you want to play around with it https://dbdiagram.io/d/654a4d3b7d8bbd6465ad892c)
maybe this, with a composite key on role, inhabitant in the assignments table?
since each role is already unique to a realm, or is meant to be
Yeah that does look better
Now i'm having trouble working out howtf to convert all this into my objects... i'm assuming some joins are involved but fucked if i know how that works... time to investigate
i'm getting the feeling this is the sort of system where i'd want permission changes to be pushed live...
simply because I can't work out how you'd deal with updating permissions in the db after the fact without removing them all and adding the updated ones back
can anyone help me fix this error here** Cannot resolve method 'getRegionManager' in 'WorldGuardPlugin'** im using 1.19.4, 7.0.8
looks like the api has changed from what you're using @grave sky
not 100% sure, but it looks like you need to get a container then the region manager
alr ill check the wiki a bit
Hi, I'm looking for a developer who could fix a plugin for the server. Plugin is made for 'skins' per item and armor. Knowledge should be related to custom-model-data. The issue is that custom armor texture doesn't show up when it's equipped, however it shows up in your inventory ( but doesn't show in armor slots). Skins work with itemsadder. The work will be paid, of course. lmk if someone is interested in dms
so it has nothing o do wih i
does anyone know if it is possible to use Gson#fromJson with a parameterised constructor
Hey, I encountered an issue in my code. The error message is: 'Missing closing parenthesis in server.js.' Can you please check the 'app.use(express.static(path.join(__dirname, 'public'))' line in the server.js file? Thanks!
Full detailed error:
C:\Users\John\Documents\NStW\server.js:12
app.use(express.static(path.join(__dirname, 'public'));
^
SyntaxError: missing ) after argument list
at internalCompileFunction (node:internal/vm:73:18)
at wrapSafe (node:internal/modules/cjs/loader:1178:20)
at Module._compile (node:internal/modules/cjs/loader:1220:27)
at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
at Module.load (node:internal/modules/cjs/loader:1119:32)
at Module._load (node:internal/modules/cjs/loader:960:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:23:47
Node.js v18.17.1
I mean
it literally tells you where the issue is
You have three ( on the left, and two ) on the right
My code:
const express = require('express');
const http = require('http');
const socketIo = require('socket.io');
const path = require('path');
const app = express();
const server = http.createServer(app);
const io = socketIo(server);
app.use(express.static(path.join(__dirname, 'public'));
const players = {};
io.on('connection', (socket) => {
console.log('A player connected.');
socket.on('move', (direction) => {
io.emit('update', players);
});
socket.on('disconnect', () => {
console.log('A player disconnected.');
delete players[socket.id];
io.emit('update', players);
});
});
const PORT = process.env.PORT || 3000;
server.listen(PORT, () => {
console.log(`Server is running on port ${PORT}`);
});
i get it
?? So what's the issue
oh my bad
i missed the one on the left
my bad
its 11pm 
imma go get some sleep i guess
And ure welcome lol
For future use https://jshint.com/
JSHint, a JavaScript Code Quality Tool
Usually pretty good :>
I think you missed one on the right.
what
the error literally tells him the same thing lol
so should the IDE if he's not using notepad in 2023
NPP my beloved IDE
How would you guys make a bot pvp plugin?
(I mean the part where a bot attacks the player, walk, maybe place blocks, crystals, drink pots, etc)
I think citizens has a good NPC ai?
npc AI? any tutorial you know? 
there was a plugin called sentinel
which makes citizens NPCs into fighters
maybe look at how they did that
Yeah citizens sentinel stuff
A lot of packets and ai lol It can get overwhelming.
Yeah i read about it, i'll probably end up using that (but its api, not commands). Wonder if there is a trait that allows placing ender crystals haha
wrong channel
Does DeluxeMenus have an api? I am having issues with GUI menus not being closed when my plugins attemps to run a function resulting in duplication issues.
It's a very strange issue give me a moment and I'll try my best to explain it.
When I attempt to open a gui for a player after they have logged out it doesn't open. (not the issue)
But for some reason it seems to think the gui is open which causes any DeluxeMenus to break and users can remove items out.
This issue only happens if the user has logged out and back in before their coinflip is started by another user.
I've attempted to use a closeInventory(); method but that doesn't close it at all.
I've confirmed with the latest release & latest dev build on 1.20.2 and 1.20.1
Does anyone know if there's a way to sort the commands in the help command using ACF?
Further testing on this has just confused me further.
Using the default DeluxeMenus file and using the basics_menu.yml as my test menu for this.
If the user logs out and back in which is the only way the issue can occur my plugin will report the gui title as "Crafting" however if the user does not log out and back in the issue will not occur in this case it will report the name as "Basics Menu"
The goal is for my GUI to open and run it's tasks. https://paste.helpch.at/iyilufinaz.java This is the relevant class from my current research into the problem.
What's throwing me off is the user has to log out and rejoin for the issue to occur. The problematic player is defined by otherPlayer in the startGame method.
Why are you even using DM for the GUI when it is easier to just use a proper solution, which is a GUI lib?
I'm not. Using a different gui library. The problem is the DM menu staying open when it should've been closed causing user's to be able to remove items from the gui.
What role does DM play here?
If you open the conflip menu through DM, just add a [close] before your open command
I don't do anything through DM. However DM is the only plugin I've found so far that has this issue with my plugin.
To me is seems like your plugin is the one that breaks DM's functionality 
Indeed. Just trying to figure out why.
It's strange as can be. As if the user does not log out and back in. Nothing happens everything functions normally.
The GUIs should not affect each other though, both DM and your GUI lib check if the GUI that the player has opened is one of its own or not
if I use the getInventory().getTitle(); method there is one difference when the issue happens and doesn't happen.
-
If the user has logged out and back in that method will report the title as
Crafting -
If the user has not logged out and back in (stayed logged in the whole time) it will report the title as what is configured in the DeluxeMenu menu file. Which in this case is
Basics Menu
This is with 100% default DeluxeMenus configuration files zero changes.
Open to any suggestions or ideas on what this could be. I've tried various different solutions
Starting to believe the issue is a bug with DeluxeMenus are opposed to my code. As it's not respecting the closeInventory(); method
u dummy
What's the best way to run something after the player fully joins the server, when listening to the PlayerJoinEvent
I’m calling player#showEntity, which doesn’t work.
But This does work: using the scheduler to run a task 1 tick later.
Is this the best way? Will this always work if the server is lagging?
Are there better options?
You can run the task Async?
If that works for that method
Will problably not give any lagg
making anything async there won't really help
Async tasks are still dependent on server tick rate
but also, if the server is lagging there are bigger problems that aren't yours lol
unless they are yours if your plugin is doing something wrong, but scheduling one task won't be that
Not sure if this would ever happen, but if the player is still not connected after a tick, you could have it just schedule another BukkitRunnable until the player is on the server
Or use a timer and quit when the player is connected
Did you include the repository?
ah yup
hmm that looks like it should work, did you reload Maven/IJ?
Restart IJ? Invalidate caches?
try different version?
hmmm
swap to gradle? lmao
What Java version are you using?
I've seen that issue with Paper/spigot dependency on gradle before
So maybe it's related?
Idk if papi uses Java 8
¯_(ツ)_/¯
🥲
Reload maven
Since intellij only searches for the dependency outside its caches once reloaded
17
Java abandoned the 1. Prefix at like Java 11 or smth
Idk
Can’t run the task player#showEntity async
Then still I dont think it matters
Its a issue when 500 players join in 1 time i think..
But its weird that it don't work directly
Players aren’t fully spawned in yet when the PlayerJoinEvent fires so it seems u can’t do something’s with the player object
Then the runnable is a option indeed i think..
Run a task async that runs a sync task 
Will this method make my server laggy?
if (identifier.equalsIgnoreCase(kingdoms.getKingdomName())){
return String.valueOf(kingdoms.getKills());
}
}```
its looping through 8 kingdoms for example
If yes, how to make it simpler?
It's the way to find out.
Its doing this every second
Shinto isn't wrong. Only one way to find out.
premature optimisation is the root of all evil
but also use a hashmap
but also just test and/or profile it first
what the fuck are streams!!!!!
what the fuck is encapsulation!!!!
(though if the list is small then its better to keep loops, else use parallel streams
)
What the fuck is language for $500
so in java u can do
String str = String.format("%-20s", msg);
and it'll basically add white space so ur message fills 20 characters even if the string object "msg" is less than 20 characters
curious if similarly can be done using the adventure api w/ minimessage formatting,
for example if i have an unparsed stringlike "<red>hello world", i want to make it so the string is 20 characters long with whitespace. however "<red>" is counted and i dont want it
i know i can probablyy just add spaces by looping and appending a space character until the length is 20, but wondering if theres a cleaner built in adventure way like string.format. if there's not, how do i get the length of a component after parsing (without manually parsing myself)
In Java 21 you can I believe! Using string templates and template processors ;p
Understood the question wrong, ignore me
huh? u can already do it in java 17, but im trying to do it using the text componenet from minimessage
you could create your own tag resolver ig
is there a way to get the text of a chat component without the tags?
just use the PlainComponentSerializer
is there a way to get a firework's shooter? afaik they don't count as projectiles
ah maybe they do
need to check that
yeah they do, just ignore the question lol
how can i make handcuffs plugin (something like leashing mobs but for player)? i tried spawning a mob, leashing it and teleporting player to it, but its buggy and doesnt let player move nor rotate, is there a better way to do it?
i don't understand why my post from the #1169541795336687616 its removed! I just offer my services..
does anyone know placeholderapi file for ikoth plugin?
spawn mob, leash + mount player on top
latest version?
tho might depend on the minecraft version your trying to run cus idk if theres a version that papi doesnt support thats still being used
tho you probs shouldve asked in #general-plugins or maybe #placeholder-api
its kinda weird how ikoth doesnt declare any depend or soft depends even tho it seems to do compatibility with factions
that just sounds like a bad practice or smth
18:36:38 [INFORMATION] [**************] <-> ServerConnector [lobby1] has connected
18:36:46 [INFORMATION] [**************] <-> ServerConnector [CityBuild] has connected
18:36:46 [INFORMATION] [**************] <-> ServerConnector [CityBuild] has disconnected
Can please help me?
🦅🇺🇸🦅
Caused by: java.lang.NoClassDefFoundError: joptsimple/OptionException
Do you want to restart? Press 'Y' and enter for yes:
what's the problem?
you're not running the server in its intended way
some1 now how can i allow teleport with ender pearls combat +
hi; BungeeCord
does someone have an idea how to check if player is connecting via hostname that is forced host to some server?
not quite but you can get the address the player entered to connect, https://jd.papermc.io/waterfall/1.20/net/md_5/bungee/api/connection/PendingConnection.html#getVirtualHost()
then check the address' host string or something idk
cuz bad regex
how to fix it
so what should i do ?
Either ignore the groups or use (?:
the number is not perfect 
What do you meen?
Well whatever you‘re doing, it‘s wrong
Just built swm server and that's it
No, obviously you‘re trying to run a server
FallingBlocks those are entities
now when they fall
how do i see they hit the ground they get killed?
they get damage?
should i do a repeatting task
an event is fired
also do they support meta data?
EntityChangeBlockEvent should be fired when a falling block turns into a block
Hey, whats a better way to do this?
public Attack getAttack(Kingdoms kingdom) {
if (attacks.stream().filter(attacks -> attacks.getAttacker().equals(kingdom)).findAny().orElse(null) != null)
return attacks.stream().filter(attacks -> attacks.getAttacker().equals(kingdom)).findAny().orElse(null);
if (attacks.stream().filter(attacks -> attacks.getDefender().equals(kingdom)).findAny().orElse(null) != null)
return attacks.stream().filter(attacks -> attacks.getDefender().equals(kingdom)).findAny().orElse(null);
return null;
}```
wtf r u even doing here pal
cant really know what those objects r
how even
u can do somethng lke
public Attack getAttack(Kingdoms kingdom) {
return attacks.stream()
.filter(attack -> attack.getAttacker().equals(kingdom) || attack.getDefender().equals(kingdom))
.findAny()
.orElse(null);
}
just use || operator
make it twice shorter
but it seem u epeat same shi
like 4 ttmes
that's different behavior as the order might now be different
but generally that really looks like something you want to solve differently
You can start with the attacker stream and at the end use orElseGet(Supplier<T>) with the defender stream, and at the very end put an orElse(null) 
Hahaha sorry lazy coding
Thank u
I see now that this wasn't even right
Oops..
.
.
vault only works for online players iirc
whether you can use placeholders for offline players or not depends on how the expansion you are trying to use is made or the api that it uses, in this case vault.
Does DeluxeMenus have an API for setting up GUIs? Like TriumphGUI basically
Nope
I have a tree from nodes like this (very simplified but you get the point):
public class TreeNode<E> {
private final List<TreeNode<E>> children = new ArrayList<>();
public TreeNode<E> addChild(TreeNode<E> node){
children.add(node);
}
public List<TreeNode<E>> getChildren(){
return new ArrayList<>(children);
}
}
I want to visualize this tree but have no clue how to. I want it to display in a grid from left to right with 1 space between each node vertically. My main problem is that a node can have multiple parents. If there were only one parent it would be no problem. I can't find anything good online, does anyone know something helpful or a good thread or smth?
Yes well that doesn't work from what I can tell. Maybe I missed something but a tree can look like this. Which is what makes it hard. Imagine it going from left to right
So it's less of a "tree" really
lol
yeah that doesnt look like a tree
lol
Well imagine a "core trunk" or whatever. And it has branchs that spread out and each branch can have it's own branches. Any branch may have multiple parents, aka they can merge again
Is something like this possible using TriumphGui? Where I use a basic template and just change a few items which depends on the player
public void openBlueprintGui(TycoonPlayer tycoonPlayer) {
Gui blueprintGui = blueprintGuiBase.copy();
}
yeah
just make a method create() instead of having a base variable
But then I create a new GUI every time
copy() would also do that, if it existed
Should I do that or just configure the template every time it's used?
True ig
I personally just have a class for each GUI
¯_(ツ)_/¯
although I usually dont have a lot of GUIs
I only have one GUI for now, which is just showing if a player has something unlocked really
Do you have an example I can see?
uhhh maybe I have an OS one on my github but I dont remember
oh hey theres matt
Perfect timing lol
You could do:
var builder = Gui.gui().title(...).rows(...).apply(gui -> {
gui.setItem(...);
gui...
// etc
});
var gui1 = builder.create();
var gui2 = builder.create();
Creates 2 identical guis but are different instances
Wait isn't apply kotlin? Or did you add it to builder too
Ohhhh smart, didn't know TriumphGui had a builder class
Different than kotlin's apply
It has been a thing since v3.0
If you're not using it you'd probably be getting warnings of it being deprecated
Just make sure you don't pick the wrong one
Meant also function but I don't even remember if that's the right one lol
Also wouldnt kotlin prioritize the method apply instead of the function?
let -> transforms it
apply -> modifies this
also -> run after it
run -> transforms this
Would a builder be correct usage in my case btw Matt? Instead of storing a gui for every player, or should I still do that?
Ig I can still store it after using the builder, just wondering if I should store or create a new gui instance every time it's opened
also is used for adding for adding side effects, for example:
val name = person.name.also {
logger.info("the name is $it")
}
What exactly are you trying to achieve?
It's a gui that has items that depends on if the player has completed specific quests for example. So the player kills a zombie and an item says quest completed - kill 1 zombie instead of quest - kill 1 zombie
That is just an example, but does it make sense?
Probably what I would do is wrapping over the gui, for example:
class QuestBlahBlahGui {
private final Player player;
private final Gui gui;
public QuestBlahBlahGui(final Player player) {
this.player = player;
this.gui = ....;
}
public void open() { gui.open(player); }
}
Then new QuestBlahBlahGui(player).open();
Or something like that
Makes sense, and then store those QuestGuis in a Map<Player, QuestGui> or whatever right? Instead of creating a new one every time
Creating a new one is fine, if the quest data is easy to retrieve
Alright, will do that then, thank you!
Ig the builder isn't really neccessary in my case then
Nope
Well it is the right way to make a gui
Just not needed to keep it separate instead of making the gui
I assume that's in combination with some client mod?
Do you have a vanilla client / no mods?
That is definitely not vanilla
Feather client feature
real
just fix it
i legit cant catch that null
and print what request causes i
it
ill go again back to line 1500
it always points me to that
Dumb question but, if i compile a plugin with Java 16 does it will work on minecraft 1.20.2
yeah
below vers wont work
like 1.9 and below
is java 8
thx (so it's compatible from 1.17 to 1.20.2)
i just need to see what it wants to pullout but i cant
it doesnt catch it
Why update?
The latest versions of Java contain important enhancements to help improve performance, stability and security of the Java applications that run on your machine. Installing the latest Java update ensures that Minecraft continues to run safely and efficiently.
Different Minecraft versions have different requirements of minimum Java version.
From Java Edition 1.12(17w13a) to Java Edition 1.16.5(1.17: 21w18a), Minecraft requires Java 8 (1.8.0) or newer.[3]
From Java Edition 1.17(21w19a) to Java Edition 1.17.1(1.18: 1.18 Pre-release 1), Minecraft requires Java 16 or newer.[4]
Since Java Edition 1.18(1.18 Pre-release 2), Minecraft requires Java 17 or newer.[5]
Minecraft may sometimes crash without being run by a relatively modern version of Java.
Java updates fix lots of problems and bugs and typically cause increases in performance.
For example, the newer garbage collectors can help with lag spikes during high memory usage.[6]
Running a server requires your computer to have Java installed instead of the pre-installed Java. See Tutorials/Setting up a server for more information.
i found this on the wiki
Hmm i guess this is more correct
if you actually want help, share the code and the exception
Wich version of Java is the best for chat plugins ?
newest is always best
newest is always tthe best in any scenario
SirYwell
line 1460
how do i check it for null
like for god sake
how how how
or i check for drop first
if he is the null
ill check for drop firs
Did you just start to learn java? No offence
you are still using dropItem even if it is null
drop cant be null
i dont insert nulls
oh
i realize
now
lmao
nah i meant to change it to drop
drop.toString
***solved
i guess i will never find whats that null
since the maps
are about 6k keys
ill just continue the loop and skip the nulls
too much headache
always lost number of final char = segmentCount, how to fix ?
public static String gradientTranslate(String input, String style, String hex1, String[] hex2) {
int textLength = input.length();
int hexCount = hex2.length + 1;
int segmentCount = hex2.length;
float segmentLength = (float) (textLength - hexCount) / segmentCount;
int segmentCharCount = (int) Math.floor(segmentLength);
int remainingChars = textLength - hexCount - segmentCount * segmentCharCount;
StringBuilder gradientString = new StringBuilder();
if (textLength <= hexCount) {
for (int i = 0; i < textLength; i++) {
String hexColor = (i == 0) ? hex1 : hex2[i - 1];
if (style != null) {
gradientString.append(of(hexColor)).append(style).append(input.charAt(i));
} else {
gradientString.append(of(hexColor)).append(input.charAt(i));
}
}
} else {
int r1 = Integer.parseInt(hex1.substring(1, 3), 16);
int g1 = Integer.parseInt(hex1.substring(3, 5), 16);
int b1 = Integer.parseInt(hex1.substring(5, 7), 16);
int charIndex = 0;
for (String s : hex2) {
int r2 = Integer.parseInt(s.substring(1, 3), 16);
int g2 = Integer.parseInt(s.substring(3, 5), 16);
int b2 = Integer.parseInt(s.substring(5, 7), 16);
if (remainingChars > 0) {
segmentCharCount++;
remainingChars--;
}
for (int j = 0; j < segmentCharCount; j++) {
float ratio = (float) j / segmentCharCount;
int r = (int) (r1 + ratio * (r2 - r1));
int g = (int) (g1 + ratio * (g2 - g1));
int b = (int) (b1 + ratio * (b2 - b1));
String hexColor = String.format("#%02x%02x%02x", r, g, b);
if (style != null) {
gradientString.append(of(hexColor)).append(style).append(input.charAt(charIndex));
} else {
gradientString.append(of(hexColor)).append(input.charAt(charIndex));
}
charIndex++;
}
r1 = r2;
g1 = g2;
b1 = b2;
}
}
return gradientString.toString();
}
use minimessage 
Thanks
I believe its in other clients too
Does anyone know what the f is wrong with 1.20.2 NMS ?
I look at the NMS reference inside of CraftPlayer
they don't exist in EntityPlayer
Same thing with mappings
I'm doing low-level stuff
like changing datas on entityplayer and doing injections
stuff you can't do with spigot api
I'm already doing it for 1.20.1,1.19.4,1.16.5
but 1.20.2 is causing issue
I'm not aware of any major changes in that area
what are you trying to get? and what have you tried?
if your trying to get the entityplayer reference then you would use
((CraftPlayer) player).getHandle()
it should work just fine
unless your trying to get something else which i dont know since your messages arent descriptive enough to figure out
You won't be able to upload images here directly to avoid spam, so please use https://imgur.com/upload or similar service to upload images/screenshots.
wowza

What would be a proper way to make a class loading system on paper for an expansion like system? I know what we have for papi is not exactly perfect, so I'm looking for something better xD
I'd say ServiceLoader might be a good idea, but not sure how well that works with the plugin classloaders
I want to load classes from external jars. These jars contain expansions for a system - think of these expansions like some listeners to custom events I fire from the core.
then the ServiceLoader is pretty good way I guess
not really, I'd say it got even better
spi?
service provider interface
yeah it doesn't look like it would fit my needs
U need services/ file and in mod info tho
Thats too hard
🤨
from what I see you add some config in META-INF/services
yeah
Yea
that's what I meant
no
what is mod info?
only module-info
ah that
because you don't care about anyone who throws your jar on the classpath
Then why doesnt it work
probably an obvious answer but ... if I make a service profier thing for the main class of these expansions, from where users can register listeners and other shit, would this api take care of loading all the other classes?
the classloader takes care of loading classes
I need to play with this, looks cool, thanks guys 🙂
it certainly does
Maybe i fucked smt up but i doubt it cuz im perfect
😇
It didn't work when i had one of em at a time tho 😭
how's vision going?
whats vision?
the faculty or state of being able to see.
alr
apart from like skulls and stuff that needs custom meta its pretty much usable
idk how to design an api that allows for more complex stuff thats also simple tho
also anyone know how to get rid of the deployments cuz im not using gh pages anymore
cant upload pic cuz imgur is down but on here https://github.com/Sparky983/vision-gui
You won't be able to upload images here directly to avoid spam, so please use https://imgur.com/upload or similar service to upload images/screenshots.
Only to kotlin users
i'm working on a plugin for my server which adds Votifier (nuVotifier specifically) support, everything seems be done correctly, the jar is added to my maven project like so:
implementation ("com.github.NuVotifier.NuVotifier:nuvotifier-bukkit:2.6.0")
``` and the plugin.yml includes Votifier/NuVotifier as dependencies
this is the logic for the event that should fire:
```kt
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
fun onPlayerVote(e: VotifierEvent) {
val vote = e.vote as Vote
// Logic
}
the only problem is that whenever i test a vote it says that the plugin received the vote and yet there were no listeners
what am i doing wrong
Against who
Java users
What did they do to him
i would never

aight thx
hey guys is it possible to do custom minecarts?
like have the regular minecarts and then have a retextured minecart, say like a copper minecart? 🤔
with like resource packs and stuff
where can i find the 1.17 + Spigot mappings for obfuscated code ??
MiniMappingViewer
Any reason entities displayed by packets are affected by pistons but nothing else?
✨ client predictions ✨
hey! anyone know how i can override the default bukkit ban msg? right now i have this code:
@EventHandler
public void onPlayerLogin(PlayerLoginEvent event) {
if (event.getResult() == PlayerLoginEvent.Result.KICK_BANNED) {
event.setKickMessage("You are banned from this server.");``` but it just does the default bukkit ban message, how do i make it custom?
have you registered the event?
if you have registered the event, add a message thatll get broadcast to console just before you do your if statement, then you can tell if you actually have registeredd it or not
usually you can use either sysouts, using your plugins Logger, etc
Hello anyone here goo with 1.18 + NMS as trying too update SlimeWorld Manager for Personal use only and am struggling as certains bits have been completeky remove like BiomeStorage and TickListChunk
if you would dlike too see the code for your self please lmk
Well, the obvious question would be: are these two urls (kauriapi & antiproxyapi) actually recognizing the player's connection as a vpn/proxy? Try printing out the responses, and check whether the values (vpn/proxy) is returning as true or false
I use slimepaper since it is already 1.20 or use advanced swm that has 1.18 ig
wdym
like colored wool/glass/etc? if so, then you can either take from like Material name or theres prob some interface extending BlockState (Colorable?)
if not, then assuming you mean in a plugin, no, because the server does not have the resource pack
and because blocks can have multiple colors
