#development

1 messages · Page 66 of 1

rich lance
#

but

#

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

craggy gale
#

Take ur time I'm actually going to crash my self- i can mess with that later

rich lance
craggy gale
#

Wait so the signs would be visually representative but not used as the data storage

rich lance
#

No you should save to the chest

craggy gale
#

But how would I set the initial chest?

rich lance
#

well, you detected it correctly

craggy gale
#

Because if I use the current method double chests arent saved it currently

rich lance
#

here

craggy gale
#

Or detected

rich lance
#

oh well you can just use a normal CHEST and check if there's another chest next to it and lock it too

craggy gale
#

Hm. That could work the only risk is

#

If a player had a chest wall

#

And it looks chests that shouldnt be locked

rich lance
#

oh maybe

craggy gale
#

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

worn jasper
#

uhm how would I get the slot of the currently held item? (Item in main hand, get that slot)

sterile hinge
#

PlayerInventory#getHeldItemSlot probably

worn jasper
#

oh yeah ty

craggy gale
#

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);
                    }
                }
            }
        }
    }```
river solstice
#

arrow code goes brrr >>>>>

fading yacht
#

[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?

craggy gale
#

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

dusky harness
# fading yacht [ERROR] Failed to execute goal on project crazycrates-v1_16_R3: Could not resolv...

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

craggy gale
hoary scarab
#

Are you trying to get the sign when placed?

craggy gale
#

the issue is that it doesnt apply to double chests

hoary scarab
#

Ah missread. So you want the sign to contain lock and the name?

craggy gale
#

Ie:
[Lock]
Username of player

#

only the player can open the chest

hoary scarab
#

Ok give me a bit.

hoary scarab
# craggy gale Yes.
@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;
}
proud pebble
#

i think most chest lock plugins check for [lock] then adds the player name to the sign to lock it

hoary scarab
#

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.

craggy gale
#

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

hoary scarab
#

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

craggy gale
#

didnt think about hoppers though

hoary scarab
#

Yeah, hoppers, minecarts, droppers.

Also you will have to check other inventory types; shulkers, barrels, trapped chests, furnace etc...

craggy gale
#

How would i even stop minecart hoppers

hoary scarab
#

Just cancel the transfer event

craggy gale
hoary scarab
#

Yeap

shell moon
#

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 Thonk )

hoary scarab
#

Pluginmessaging, would also have to link with api's of vanishing plugins

shell moon
#

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

hoary scarab
#

Yeap

#

Unless both users have vanish permission then just allow the message to go through

shell moon
#

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 xd

torpid raft
#

alternatively you can use websockets instead of plugin messaging

worn jasper
#

Redis messaging is also an option I suppose

shell moon
#

but i realized that it would be a requirement then like
Requires Redis to work, which idk if people will understand at all

shell moon
#

in any of those cases, i'd still need to:

  1. check if target is online
  2. in the target server, check if target is vanished
  3. reply with a yes/no (vanished or not)
  4. 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 Thonk )

dense drift
shell moon
worn jasper
#

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

shell moon
#

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

river solstice
#

or just host a built-in rest api in the plugin, where you could make a request to check if the player is vanished fingerguns

craggy gale
river solstice
craggy gale
river solstice
#

Sign s = (Sign) event.getClickedBlock().getState();

#

not all clicked blocks are signs

craggy gale
#

would I just put that under the check for if its a sign then?

river solstice
#

you should check using 'if(event.getClickedBlock().getState() instaceof Sign)'

#

thats prob your issue

#

anyways im off to sleep, gl

craggy gale
#

so like this?

        Sign s = (Sign) event.getClickedBlock().getState() instanceof Sign;
river solstice
#

no

craggy gale
#

wdym then? oh

river solstice
#

someone else will help im sure gl

craggy gale
#

thanks @river solstice ur advice let me figure it out

craggy gale
#

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
                                        
}
gilded imp
#

is this chatgpt code

stray hawk
#

why don't you just use the playersSleepingPercentage gamerule?

river solstice
#

the last // Adjust these values ...

void orchid
# craggy gale If anyone can help with this: For some reason it only works when 2 people are ...

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/

river solstice
#

🧌

spiral prairie
flint kernel
#

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

spiral prairie
#

Yeah i believe so

flint kernel
#

i was afraid of that

spiral prairie
#

But im not an expert

#

But circular referencing isn't so good always

spiral prairie
#

Lmao

worn jasper
#

how do you prevent players using entity cheats to change the velocity of a mob in a mob?

worn jasper
#

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?

icy shadow
#

What?

river solstice
#

What?

icy shadow
#

mind your own business

river solstice
#

no u

#

why didnt you come to my stream birsten mistren :((

icy shadow
#

what stream

river solstice
#

streamed spooderman on twitch!!!

icy shadow
#

im sorry i was unaware

river solstice
#

damn not following me to get notifications

craggy gale
worn jasper
# icy shadow What?

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?

river solstice
#

yes

icy shadow
#

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

minor summit
#

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

torpid raft
#

where you patiently wait for the http request to complete async and only then make a new event

worn jasper
worn jasper
dusky harness
#

also don't use AsyncChatEvent if you're going BM's route

torpid raft
#

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

dusky harness
torpid raft
dusky harness
#

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

torpid raft
#

just get faster-than-light internet

#

smh

dusky harness
#

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

worn jasper
dusky harness
#

unless OpenAI puts EU servers

worn jasper
#

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?

worn jasper
# dusky harness plus the AI computation time?

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

dusky harness
worn jasper
dusky harness
dusky harness
dusky harness
# worn jasper wdym?

like

  1. cancel events
  2. flag messages
  3. delete messages (spam the past like 100 messages or smth, or if it's a signed message, then delete that way)
worn jasper
#

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....

dusky harness
dusky harness
worn jasper
worn jasper
worn jasper
worn jasper
dusky harness
dusky harness
worn jasper
dusky harness
#

but no plugin should be using it

#

since async event is in spigot as well

minor summit
#

i mean there are valid reasons to use the sync chat event

worn jasper
minor summit
#

blocking the thread is not one of them

dusky harness
#

maybe I said that too harshly

worn jasper
#

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

uneven needle
minor summit
#

lag

uneven needle
minor summit
#

unlikely

uneven needle
fallen edge
#

lmao

uneven needle
#

My pc exploded when I spawned 10 thousand cows the other time

torpid raft
#

sounds like 9999 is the limit

flat tendon
torpid raft
#

💦

fallen edge
uneven needle
#

He exploded

worn jasper
#

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)

minor summit
#

mad drawing skills

fallen edge
#

yeah i think ill buy this drawing for 90k usd

#

its a masterpiece

worn jasper
hoary scarab
#

Offsets multiplied by direction

worn jasper
sterile hinge
#

like that, v is your direction vector and you just multiply it somehow to get the wanted distance

hoary scarab
#

So you have the offsets you want then just multiply them by the direction the mob is facing.

worn jasper
#

wait there's a direction object? or this the pitch?

hoary scarab
#

Location.getDirection()

dusky harness
#

I don't think that's a method

worn jasper
#

oh was looking at the wrong thing

#

it is

#

lmao

#

it returns a vector

dusky harness
#

Ohh

#

Oh I thought it was on like Entity class

#

Whoops

worn jasper
#

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

sterile hinge
#

no, you most likely want some specific direction vector

dusky harness
#

You can also just use some trig 💪

sterile hinge
#

and after multiplying, you project it onto the position of the entity with some offset

worn jasper
worn jasper
sterile hinge
#

basically just an addition

worn jasper
#

so add the multiplied vector, to the mob's location and that would be the new location?

sterile hinge
#

yes

#

but as I said, you most likely want some additional offset from the entity

worn jasper
#

by entity you mean the mob or the hologram

sterile hinge
#

doesn't matter in this case

graceful juniper
#

Whats more efficient for messages? string#replace or chatcolor#translateAlternateColorCodes?

hazy nimbus
#

as long as you use the nonregex replace method

#

it's fine

#

probably doesn't matter at all

worn jasper
#

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);
astral current
sterile hinge
worn jasper
sterile hinge
#

idk, never worked with DecentHolograms myself

#

what should throw an error?

worn jasper
sterile hinge
#

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

worn jasper
#

hmm fair enough

#

yeah can't figure what's going on with DecentHolograms lmao

river solstice
#

What's going on

worn jasper
worn jasper
sharp cove
#
[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

night ice
shell moon
#

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?

  1. FastAsyncWorldEdit API
  2. Save a copy of the world folder, then unload the world, copy saved one and load again
  3. ASWM (advanced)slimeworldmanager (api?)
  4. 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 ^^
hoary scarab
#

Could go with all packets but you have to keep track of the world. (Blocks, entities etc...)

dusty frost
#

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

flint kernel
#

On a semi-related note, why aren't more compression options added for words

#

zstd, lz4

hoary scarab
#

Ask Mojang

flint kernel
#

very easy, as far as I can tell

sterile hinge
#

But then it’s on them to make sure it‘s compatible and maintain it for years

flint kernel
#

compatible with what

hoary scarab
#

With mojangs world code

flint kernel
#

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

icy shadow
#

the point is its a lot of effort

flint kernel
#

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

flint kernel
#

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)

sterile hinge
#

2022 is recent for the people who have to maintain that stuff

sharp cove
#

Why does the team.setPrefix() not support the md_5 color lib?

#

Now I cant use hex colors for that 😦

sharp cove
#

Its only for bukkit

flint kernel
#

invalidate caches?

sharp cove
#

What do you mean?

flint kernel
#

File -> Invalidate Caches

sharp cove
#

Alright

#

Gonna try that

#

Still the same

flint kernel
#

damn that was a fast restart

sharp cove
#

Fast pc ;p

#

But this is weird

#

It doesn't be supposed to look like this

pulsar ferry
#

I have a pretty fast pc and invalidate cache still takes over 10 minutes lol
Must be a pretty small project

flint kernel
#

... aren't you using maven?

sharp cove
#

For all my minecraft projects

flint kernel
#

then why r u in the artifacts thing

sharp cove
#

Because I am trying to find what the issue is

#

Normally it is looking like this for me

dusky harness
#

And invalidate caches is the last step

#

If all others fail

flint kernel
#

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)

dusky harness
#

That should also reset intellij artifacts

#

Do that and restart intellij or reopen project

pulsar ferry
#

Does the maven tab not have detailed dependencies like gradle does?

dusky harness
#

This will reset all intellij settings on the project tho

flint kernel
pulsar ferry
#

Same

#

On their screenshot it doesn't show, that's why I was asking

flint kernel
#

looks like they're using an older IDEA, maybe that's why

pulsar ferry
sharp cove
#

Now its fixed

#

Don't know why tho?

dusky harness
#

Maybe you did something with intellij artifaxts

pulsar ferry
#

IJ being funky that's why

sharp cove
#

It came out like this

dusky harness
flint kernel
#

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
sharp cove
#

(pom.xml)

flint kernel
#

and when using gradle, sometimes deleting .gradle as well

sharp cove
#

Is there a other way to apply hex color to team.setColor()?

flint kernel
#

I assume ur on spigot, rather than paper, right?

sharp cove
#

Yess

#

Correct

flint kernel
#

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

sharp cove
#

So beside the legacy colors you can't use hex colors?

#

For team.setColor ?

flint kernel
#

that's what it looks like

sharp cove
#

So sad

minor summit
#

team colours are only the named colours

sharp cove
sharp cove
minor summit
#

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

flint kernel
#

maybe in NMS or something that could be changed, but that sounds very fucky

minor summit
#

not really no

sharp cove
#

Is there an alternative to change the color of the name?

#

With hex color*

flint kernel
minor summit
#

no, the vanilla Team class uses the ChatFormatting enum type for color

#

and it's network-serialized as the enum varint or whatever

flint kernel
#

ah

minor summit
flint kernel
#

does the name inherit colours from the prefix part?

#

like, does it bleed across

minor summit
#

as a properly formed Component? no, as a Component with legacy formatting inside the text itself (yuck), "yes"

minor summit
#

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

sharp cove
#

I will stick to the legacy colors🫡

flint kernel
#

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)

hoary scarab
flint kernel
shell moon
#

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")

minor summit
#

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

shell moon
#

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?)

spiral prairie
#

Clients can send their own spoofed packets

#

So make sure to check where the packet is from

#

Or just encrypt it

minor summit
#

just check the sender

shell moon
#

instanceof ProxiedPlayer?

minor summit
#

yeah you'll want to discard it if it's coming from a player

shell moon
#

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)

minor summit
#

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

spiral prairie
shell moon
fading stag
#

Is it possible to edit item crafted by player inventory (2x2) or rafting table (3x3)

river solstice
#

rafting table hm

quartz briar
#

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

dense drift
#

What are you using to find it?

fading stag
gusty bay
#

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!

dense drift
#

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.

gusty bay
#

There are a lot more of these placeholders, but just different identifiers, but the concept is the same

dense drift
#

you probably need to lower the refresh rate on the plugin you use to display the placeholder (e.g. tab list)

gusty bay
#

I use it on signs...

#

But I need it to update very frequently...

dense drift
#

send a video of how it looks rn, idk what you mean by "flicker"

gusty bay
#

Just a minute...

#

Sent it to PM, can't send it here.

gusty bay
#

LOL

shell moon
#

best way to support colored redstone particles since old versions to latest?

worn jasper
#

ParticleLib? idk

shell moon
#

abandoned since 1.19.4 thanks to paper ParticleBuilder

worn jasper
#

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

shell moon
#

I was thinking about that, ParticleBuilder from Paper if available or ParticleBuilder from PartibleLib if available, otherwise, skip Particles

limpid zealot
#

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?

proud pebble
limpid zealot
# proud pebble 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;
        });
proud pebble
#

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

limpid zealot
limpid zealot
# proud pebble also when is this code supposed to be ran? unconnected to on cinnect or on serve...
    @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
limpid zealot
limpid zealot
#

ok i will try with PreLogin now

limpid zealot
#

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 🙂

flint kernel
#

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

icy shadow
#

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

flint kernel
#

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

icy shadow
#

in many ways thats actually more effort

#

plus it's just not great design imo

sharp cove
#

I tried some things with Protocolib

#

But that doesn't work on 1.20.2

dense drift
#

First problem: not using adventure

flint kernel
#

correction: first problem: not using paper

sharp cove
dense drift
#

Adventure is a library for components, something that minecraft has used for a while (not adventure, but components) and also what BungeeChatAPI does

sharp cove
#

Do u have a link?

dense drift
#

yes

sharp cove
dense drift
#

And paper uses it internally since 1.16.something and there's probably a direct way to do what you want

dense drift
sharp cove
#

I think I need to use Protocolib

#

Because Minecraft only supports legacy colors for teams

#

Not for prefixes

#

But for teams

dense drift
#

Plib also uses it / has an addapter for mc components to adventure components, idk exacly

wanton terrace
#

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?

forest jay
#

I dont know how to tho

craggy gale
#

does anyone know if its possible with spigot to add offers to enchantment tabels IE: Add a custom enchantment to the table ?

worn jasper
craggy gale
#

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)

sonic nebula
#

many have done that

craggy gale
#

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

sonic nebula
#

im confused u try to change output right on enchant?

craggy gale
#

if you can show me somthing that does id apperciate it! maybe these old fourm posts nver got it

sonic nebula
#

what ver r u on?

craggy gale
#

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

sonic nebula
#

EnchantItemEvent

craggy gale
#

however it seems impossible to edit the offers the enchantment table gives the player

sonic nebula
#

oh

#

as one of the possible options hmmm

craggy gale
#

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

sonic nebula
#

nah message useles

#

because he wont see it

#

lemme quickly check something

craggy gale
#

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

sonic nebula
#

im 99% sure

#

its a packet

craggy gale
#

wdym

sonic nebula
#

because otherwise people would be able to uno reverse the enchants

#

its on client side

craggy gale
#

adding enchantmnets to an item is client side?

#

why would addEnchantment be a thing?

sonic nebula
#

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 😉

uneven needle
#

I thought?

sonic nebula
#

I went thru docs

#

There is nothing for that

uneven needle
#

No I meant to add the enchantment to the item

#

Since he said that didn't even work

craggy gale
craggy gale
sonic nebula
#

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

craggy gale
craggy gale
flint kernel
#

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)

pulsar ferry
#

Second option is the better relational approach if you're using a relational database
Though you could just use enum names instead of ordinals

flint kernel
#

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

flint kernel
pulsar ferry
#

I definitely recommend going the one-to-many route

flint kernel
#

lemme try to sketch up the schema for that and i'll come back

#

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)

pulsar ferry
flint kernel
#

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

pulsar ferry
#

Yeah that does look better

flint kernel
#

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

grave sky
#

can anyone help me fix this error here** Cannot resolve method 'getRegionManager' in 'WorldGuardPlugin'** im using 1.19.4, 7.0.8

code: https://pastebin.com/DLYN9Wez

grim oasis
#

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

grave sky
#

alr ill check the wiki a bit

iron steeple
#

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

uneven needle
#

does anyone know if it is possible to use Gson#fromJson with a parameterised constructor

modest goblet
#

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
hazy nimbus
#

I mean

#

it literally tells you where the issue is

#

You have three ( on the left, and two ) on the right

modest goblet
#

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

hazy nimbus
modest goblet
#

oh my bad

#

i missed the one on the left

#

my bad

#

its 11pm sobb

#

imma go get some sleep i guess

jade wave
#

And ure welcome lol

modest goblet
#

yeah thanks

#

i forgot

#

lol

jade wave
#

Usually pretty good :>

modest goblet
#

:0

#

thanks

river solstice
river solstice
#

the error literally tells him the same thing lol

#

so should the IDE if he's not using notepad in 2023

dense drift
#

NPP my beloved IDE

shell moon
#

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)

uneven needle
shell moon
rich lance
#

there was a plugin called sentinel

#

which makes citizens NPCs into fighters

#

maybe look at how they did that

uneven needle
#

Yeah citizens sentinel stuff

hoary scarab
#

A lot of packets and ai lol It can get overwhelming.

shell moon
forest jay
#

wrong channel

flat tendon
hasty flume
#

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.

dense drift
#

no it doesn't

#

what is the issue?

hasty flume
#

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

atomic trail
#

Does anyone know if there's a way to sort the commands in the help command using ACF?

hasty flume
# hasty flume When I attempt to open a gui for a player after they have logged out it doesn't ...

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"

dense drift
#

What is the goal here?

#

What are trying to do

hasty flume
dense drift
#

Why are you even using DM for the GUI when it is easier to just use a proper solution, which is a GUI lib?

hasty flume
dense drift
#

What role does DM play here?

#

If you open the conflip menu through DM, just add a [close] before your open command

hasty flume
#

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.

dense drift
#

To me is seems like your plugin is the one that breaks DM's functionality shrug

hasty flume
#

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.

dense drift
#

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

hasty flume
#

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.

hasty flume
#

Open to any suggestions or ideas on what this could be. I've tried various different solutions

hasty flume
#

Starting to believe the issue is a bug with DeluxeMenus are opposed to my code. As it's not respecting the closeInventory(); method

sonic nebula
fast glade
#

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?

sharp cove
#

If that works for that method

#

Will problably not give any lagg

minor summit
#

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

forest jay
#

Or use a timer and quit when the player is connected

dusty frost
#

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

dusky harness
#

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

#

¯_(ツ)_/¯

pulsar ferry
#

Paper only, spigot doesn't because why would they

#

Your pom says otherwise

dusky harness
#

🥲

#

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

fast glade
sharp cove
#

Its a issue when 500 players join in 1 time i think..

#

But its weird that it don't work directly

fast glade
#

Players aren’t fully spawned in yet when the PlayerJoinEvent fires so it seems u can’t do something’s with the player object

sharp cove
#

Then the runnable is a option indeed i think..

river solstice
sharp cove
#

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?

flat tendon
#

It's the way to find out.

sharp cove
#

Its doing this every second

ocean crow
#

Shinto isn't wrong. Only one way to find out.

torpid raft
#

i would wager it's fine

#

but yeah just test it and /timings

icy shadow
#

premature optimisation is the root of all evil

#

but also use a hashmap

#

but also just test and/or profile it first

river solstice
river solstice
river solstice
hoary scarab
#

What the fuck is language for $500

fast glade
#

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)

pulsar ferry
#

In Java 21 you can I believe! Using string templates and template processors ;p
Understood the question wrong, ignore me

fast glade
#

huh? u can already do it in java 17, but im trying to do it using the text componenet from minimessage

royal hedge
#

you could create your own tag resolver ig

fast glade
#

is there a way to get the text of a chat component without the tags?

royal hedge
#

just use the PlainComponentSerializer

ocean raptor
#

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

trim trench
#

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?

jade elm
wintry smelt
#

does anyone know placeholderapi file for ikoth plugin?

merry knoll
proud pebble
#

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

#

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

sharp mural
#

Me can get papi info of offline player?

#

Like %vault_rank% of offline player

lyric gyro
#

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?

river solstice
#

🦅🇺🇸🦅

limpid summit
#
Caused by: java.lang.NoClassDefFoundError: joptsimple/OptionException
Do you want to restart? Press 'Y' and enter for yes:
#

what's the problem?

sterile hinge
#

you're not running the server in its intended way

spice goblet
#

some1 now how can i allow teleport with ender pearls combat +

limpid zealot
#

hi; BungeeCord
does someone have an idea how to check if player is connecting via hostname that is forced host to some server?

minor summit
#

then check the address' host string or something idk

wet pier
#

why there are 4 groups pepehands

river solstice
#

cuz bad regex

wet pier
river solstice
#

helps to visualize

wet pier
#

but my english not good

#

and im new at coding

dusky harness
wet pier
dusky harness
#

Either ignore the groups or use (?:

wet pier
limpid summit
sterile hinge
limpid summit
sterile hinge
#

No, obviously you‘re trying to run a server

sonic nebula
#

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?

pulsar ferry
#

EntityChangeBlockEvent should be fired when a falling block turns into a block

sonic nebula
#

thanks

#

imma see if there a way to check what entity caused the event to execute

sharp cove
#

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;
    }```
sonic nebula
#

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

sterile hinge
#

but generally that really looks like something you want to solve differently

dense drift
#

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) shrug

sharp cove
sharp cove
#

Oops..

sharp mural
sharp mural
dense drift
#

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.

atomic trail
#

Does DeluxeMenus have an API for setting up GUIs? Like TriumphGUI basically

pulsar ferry
#

Nope

queen plank
#

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?

dense drift
queen plank
#

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

dense drift
#

yeah that doesnt look like a tree

queen plank
#

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

atomic trail
#

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();
    }
dusky harness
atomic trail
dusky harness
#

copy() would also do that, if it existed

atomic trail
#

Should I do that or just configure the template every time it's used?

atomic trail
dusky harness
#

I personally just have a class for each GUI

#

¯_(ツ)_/¯

#

although I usually dont have a lot of GUIs

atomic trail
#

I only have one GUI for now, which is just showing if a player has something unlocked really

atomic trail
dusky harness
#

oh hey theres matt

atomic trail
#

Perfect timing lol

pulsar ferry
#

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

dusky harness
#

Wait isn't apply kotlin? Or did you add it to builder too

atomic trail
#

Ohhhh smart, didn't know TriumphGui had a builder class

pulsar ferry
#

Different than kotlin's apply

dusky harness
#

Oh true

#

Would be also in kt

#

I thibk

pulsar ferry
pulsar ferry
dusky harness
#

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?

pulsar ferry
#

Depends on which you import

#

And also is used for something else

dusky harness
#

Oh

#

What's the one for that then?

#

I don't remember the last one

pulsar ferry
#

let -> transforms it
apply -> modifies this
also -> run after it
run -> transforms this

dusky harness
#

Wait no it is also

#

I think

#

¯_(ツ)_/¯

atomic trail
#

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

pulsar ferry
pulsar ferry
atomic trail
#

That is just an example, but does it make sense?

pulsar ferry
#

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

atomic trail
#

Makes sense, and then store those QuestGuis in a Map<Player, QuestGui> or whatever right? Instead of creating a new one every time

pulsar ferry
#

Creating a new one is fine, if the quest data is easy to retrieve

atomic trail
#

Alright, will do that then, thank you!

#

Ig the builder isn't really neccessary in my case then

pulsar ferry
#

Nope

#

Well it is the right way to make a gui

#

Just not needed to keep it separate instead of making the gui

sharp cove
#

How do servers do this?

#

The background*

sterile hinge
#

I assume that's in combination with some client mod?

sharp cove
#

I don't know exactly

#

But sometimes I see it

dense drift
#

Do you have a vanilla client / no mods?

pulsar ferry
#

That is definitely not vanilla

dense drift
#

Feather client feature

river solstice
#

real

sonic nebula
#

guys

#

i got an error

#

in like 6k lines code

#

debugging doesnt help

#

;/

#

null

sterile hinge
#

just fix it

sonic nebula
#

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

sterile hinge
#

what

#

like, such bugs are typically trivial to fix

sonic nebula
cinder axle
#

Dumb question but, if i compile a plugin with Java 16 does it will work on minecraft 1.20.2

sonic nebula
#

below vers wont work

#

like 1.9 and below

#

is java 8

cinder axle
sonic nebula
#

its complitable since 1.9 i think

#

and above

sonic nebula
#

it doesnt catch it

cinder axle
#

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

sonic nebula
sterile hinge
sonic nebula
#

its around 6k lines in total

#

the self class

#

i just want to cry some where

cinder axle
#

Wich version of Java is the best for chat plugins ?

sterile hinge
#

newest is always best

sonic nebula
#

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

dense drift
#

Did you just start to learn java? No offence

#

you are still using dropItem even if it is null

sonic nebula
#

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

wet pier
#

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();
    }
dense drift
#

sparkle_green use minimessage sparkle_yellow

worn jasper
#

MiniMessage on top

#

I shall never understand people using legacy stuff

sharp cove
#

I believe its in other clients too

sudden sand
#

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

sterile hinge
#

just use paperweight

#

not sure what you're actual problem is though

sudden sand
#

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

sudden sand
sterile hinge
#

I'm not aware of any major changes in that area

proud pebble
#

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

limpid summit
#

:/

#

Can't post Image but I get warned once I try to post my error log

neat pierBOT
river solstice
#

wowza

limpid summit
dense drift
#

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

sterile hinge
#

I'd say ServiceLoader might be a good idea, but not sure how well that works with the plugin classloaders

dense drift
#

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.

sterile hinge
#

then the ServiceLoader is pretty good way I guess

royal hedge
#

spi 😍😍

#

Kinda more annoying with jigsaw but still

sterile hinge
#

not really, I'd say it got even better

dense drift
#

spi?

sterile hinge
#

service provider interface

dense drift
#

yeah it doesn't look like it would fit my needs

royal hedge
#

Thats too hard

sterile hinge
#

what

#

before you had to put it into the manifest

royal hedge
#

What

#

U never did

sterile hinge
#

🤨

dense drift
#

from what I see you add some config in META-INF/services

sterile hinge
#

yeah

royal hedge
#

Yea

sterile hinge
#

that's what I meant

royal hedge
#

Not manifest 🙄🙄

#

Now u gotta do there and mod info

sterile hinge
#

no

dense drift
#

what is mod info?

sterile hinge
#

only module-info

dense drift
#

ah that

sterile hinge
#

because you don't care about anyone who throws your jar on the classpath

royal hedge
#

Then why doesnt it work

dense drift
#

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?

sterile hinge
#

the classloader takes care of loading classes

dense drift
#

I need to play with this, looks cool, thanks guys 🙂

minor summit
royal hedge
#

Maybe i fucked smt up but i doubt it cuz im perfect

minor summit
#

😇

royal hedge
#

It didn't work when i had one of em at a time tho 😭

worn jasper
dusky harness
#

whats vision?

pulsar ferry
#

the faculty or state of being able to see.

dusky harness
#

oh

#

i remember that

royal hedge
#

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

neat pierBOT
minor summit
#

Thanks Barry

#

(he's racist)

royal hedge
#

Only to kotlin users

edgy path
#

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

uneven needle
dense drift
#

Java users

uneven needle
#

What did they do to him

royal hedge
dense drift
limpid summit
#

I need some help

limpid summit
#

aight thx

placid sierra
#

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

lyric gyro
#

where can i find the 1.17 + Spigot mappings for obfuscated code ??

pulsar ferry
minor summit
hoary scarab
#

Any reason entities displayed by packets are affected by pistons but nothing else?

minor summit
#

✨ client predictions ✨

hybrid timber
#

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?
uneven needle
proud pebble
#

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

lyric gyro
#

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

void orchid
#

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

limpid summit
sonic nebula
#

get block color

#

such thing exist?

dusky harness
#

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

sonic nebula
#

so i need manually write that shit

#

fuck

#

thanks dkim

#

i knew the api is missing that

#

;c