#help-development

1 messages · Page 1086 of 1

worthy yarrow
#

I wonder if I should do the generation logic before writing out more data wrappers

pseudo hazel
#

hmm

#

probably, that sounds like the hard part

#

I would atleast write proof of concept so you know its gonna work

worthy yarrow
#

I'm pretty sure I've already got a gridding algo somewhere so the spacing wont be a bitch, still just need to figure how to use island size in a way that makes sense

#

I was thinking maybe like 1,2,3 relating to small, medium, big or something

#

Now that I think about it, I don't even have to worry about generation, I can just use WE for extra configurability / custom islands

#

Also thinking this is gonna be skyblock / rpg core

slender elbow
#

you should do it on the connection as well as the statement

#

you are not doing it on the connection right there

worldly ingot
#

Yeah I believe that's fine

drowsy helm
#

Yeah perfectly fine

pliant kite
#

hi spigot gang, i am trying to find the entity that is holding the leash of a boat in the EntityUnleashEvent but i'm having trouble because boats arent LivingEntities and regular entities dont have a getLeashHolder method. can anyone help me?

sudden stirrup
#

hello, what is the event or listener that detects when a fish bites? I'm trying to make a plugin that activates a bell, if held in the offhand, when a fish bites.

drowsy helm
#

you can always have it in a method from another class but its best practice to keep them all aggregated in one spot

worthy yarrow
#

If your list is long enough, a separate class isn't frowned upon

drowsy helm
#

also a var args methods makes it look a lil cleaner

worthy yarrow
#

Yeah that works

#

It's more so, do you genuienly have enough listeners to warrent registering them in their own class

drowsy helm
#
    /**
    * Register new item handler.
    * @param handlers
    */
    public void registerHandler(AbstractItem... handlers){
        for(AbstractItem handler : handlers){
            this.registerHandler(handler);
        }
    }

then you can just do

 registerHandler(
  new Listener1(this),
  new Listener2(this),
  new Listener3(this),
  new Listener4(this),
  new Listener5(this),
);
#

just a little less boilerplate-y

#

they should have a common manager in that case

#

listeners shouldn't really be depending on eachother, doesn't follow SRP

#

just a class that both depend on, which the shared variables are stored in

#

rather then them accessing eachother

worthy yarrow
#

Manager holds whatever you need it to, then listeners just depend on the manager

drowsy helm
#

that also adds modularity, such that you can swap the listeners out whenever you want without having to rewrite all the dependency code

#

it's more OOP

worthy yarrow
#

The design of the manager just depends on what sort of data you're managing

#

Basically, it's more so a manager of the data not a data class in itself I'd say

#

Data class for example:

#

Manager:

#

The data class is an entire object by itself, the manager is just going to delegate what you're allowed to do with this data

#

Yes

#

The manager class should only ever have on instance

#

(imo) I feel there could be some niche cases otherwise but for the most part

#

Sure!

worthy yarrow
#

@blissful crow would you consider yourself a creative thinker?

#

I need some ideas of how to make a cross between skyblock and rpg play well

#

Think like final fantasy, elden ring, etc

sterile breach
#

In sql I have primary key at first indexation

I dont have to give value when I insert something into the table?

because I am getting an error java.sql.SQLException: No value specified for parameter 1 (its primary key at 1)

worthy yarrow
#

I was thinking mainly the eco as most is afk economy, I wanted to strive for something different, perhaps with a bit of it sprinkled on top but different in some way, things like island values and levels were going to be determined by placed custom blocks, player / member levels, island level, etc

sterile breach
#

String t = "INSERT INTO Accounts (UUID, Name)

maybe I should put key at first

#

euh

#

yes

worthy yarrow
sterile breach
#

mysql

worthy yarrow
#

(sorry delor for clogging the chat haha)

#

No worries lol

#

Basically just spawner driven economy

#

As you can afk them, make the afk farms, sell for money later

#

A lot are automatic nowadays but yeah

#

so you literally just need an account to render the spawners

#

That's why I'm trying to strive for something different

#

Could be like a wow vibe and just make people grind for money and that be the only way to get money kek

echo basalt
#

It kinda depends imo

#

At work I tend to bundle mine by features

#

General listeners go into main but each manager / tracker registers its own cleanup listener

echo basalt
#

Main objective being I can delete a whole folder and I only need to remove like 1 line from main

worthy yarrow
#

Places explored wasn't exactly supposed to be in there sorry, that would count towards like player levels

echo basalt
#

I wouldn't hold a hard ref to the world because memo leaks though

#

Pretty much, that's a viable option

#

It really depends on how your project scales

worthy yarrow
echo basalt
#

player tracking could do with its own class

#

Which tracks player metadata (their island home / role / wtv) and invites

#

I tend to make invites its own dedicated service because uh

#

they can expire and you don't want to load all the island data to reject an invite type deal

worthy yarrow
#

Yeah that makes sense

#

I think I could keep the island home with the island class though, this is more a global location for all members

#

haha no worries

rough drift
#

is RayTraceResult#getHitPosition() in world coordinates or relative coordinates to the hit target

#

thanks, I could just make it relative by subtracting the target's location then

sterile breach
rough drift
rough ibex
#

huge brain

sterile breach
#

I advise you to use raytrace from world object (not player object)

#

and dont forget to set player eyes location (not player location)

slate siren
#

Guys I have a question

#

There is a purple particle effect in Minecraft, what is its name?

#

Shaped like this purple snowflake

echo basalt
#

either enderman or just colored dust

slate siren
#

I recorded it on video

echo basalt
#

either verify or share a gyazo / streamable link

slate siren
#

@echo basalt heree sirr

#

Yep

#

Now, I know there is a ender portal particle effect

#

But it's like something else

echo basalt
#

firework maybe?

#

Looks like a recolored villager-happy

slate siren
#

I don't think so, firework is like red black flame

slate siren
#

Hmm

pliant kite
#

how would i be able to get the leash holder entity from a leashed boat? (using entityunleashevent)

#

i dont think i can cast it as a living entity

echo basalt
#

try witch

#

@slate siren

slate siren
#

With particle

#

Witch

#

Ha

#

What

peak depot
slate siren
#

OKAYY

#

Thank uy

#

Uu

#

Lemme try

twin venture
#

hi , i have a problem with inserting and saving to sql anyone can help?

wooden zodiac
#

hey i am trying to make it work like i want to use my itemmeta and itemStack in my event handler how i do that?

#

ok i got it

#

i had to do getCustomModelData == 125

sterile breach
#

anyone know a good lib/database of banneds words ?

hazy parrot
#

Csv without comma lol

halcyon hemlock
#

what a window licker!

wooden zodiac
#

how to make sure that player is doing right click or if player is doing shift right click in playerinterect entity event?

worthy yarrow
#

I thought there was a getAction method

wooden zodiac
halcyon hemlock
#

you can get action for that, from the event

wooden zodiac
halcyon hemlock
#

get the action + player#isSneaking or something

worthy yarrow
#

Incorrect^

wooden zodiac
#

no getAction

worthy yarrow
#

getAction is in event iirc

paper viper
wooden zodiac
wooden zodiac
paper viper
#

Sould be the same code

wooden zodiac
#

and e.getAction is not available ig

worthy yarrow
wooden zodiac
worthy yarrow
#

It is

wooden zodiac
#

cltr plus space shows no suggestions

paper viper
worthy yarrow
#

what api version

paper viper
#

getAction**()**

wooden zodiac
paper viper
#

you forgot the brackets

wooden zodiac
#

i want to make it work for both 1.20 and 1.21

wooden zodiac
worthy yarrow
#

Oh theres no getAction in interactEntityEvent, there is however a getRightClicked method

sterile breach
worthy yarrow
#

For that last point, preferably this is stored in the items pdc

#

?pdc

slate siren
#

guys

#

I made an effect, imagine a block and there is an effect around the block

#

It saves these in config

#

And when I use the delete blog command, it deletes all the settings for that block from the config.

#

But the effect does not go away, when I hit /reload the effect is deleted.

#

I tried reloading the config but it didn't work. Is there another way?

safe furnace
#

Any good free software for coding plugins, i used intelij but my trial ended.?

astral pilot
#

how do you remove name of an item, i tried setting it to null it did not do anything

astral pilot
safe furnace
#

i used intelij but my trial ended.?

astral pilot
#

pretty sure u used IntelliJ Ultimate

safe furnace
#

Hm, ill try now. should i deinstall ultimate verisoN?

safe furnace
#

Alright, thanks.

pale escarp
#

is it possible to fetch TrialSpawner mob type?
i tried fetching, i was able to get mob spawner's type but not trial spawner's

sterile sapphire
#

probably get asked this alot but where can i download the spigot 1.21 api?

blazing ocean
#

You don't wanna download it, use a build tool such as maven

#

?maven

undone axleBOT
sterile sapphire
#

i mean to put the spigot api into my plugin so i can impliment things instead of wrighting it all out

sterile sapphire
sterile sapphire
blazing ocean
#

The maven repo

sterile sapphire
#

sorry im confusing myself

#

I’m watching a little tutorial to ease my way into making plugin

sterile sapphire
#

How would I do this?

sterile sapphire
#

Can u add me so I can dm it to you?

blazing ocean
#

?img

undone axleBOT
#

Can't send images? That's because you're not verified! Use !verify to complete verification.
Alternatively, you can upload screenshots to any image hosting site and share the link.

Here's some screenshot utilities that you can use to upload images.
Lightshot: https://prnt.sc
Imgur: https://imgur.com/upload
Flameshot: https://flameshot.org

sterile sapphire
#

I did that. Look in the channel. But it hasn’t given me the verified role.

blazing ocean
#

Read the second bit of that message

sterile sapphire
blazing ocean
#

Well, they're declaring a class that implements CommandExecutor of which you need to implement a method as it's abstract

sterile sapphire
twin venture
#

anyone know a good database library?

blazing ocean
sterile sapphire
#

. And is there a place I could install the spigot api???

sterile sapphire
astral pilot
safe furnace
#

Anyone knows how math expansion functions?. I want to use for formatting the playtime in 2 decimals eg. 2.20 hours

safe furnace
#

it says i should use %math_<math expression>% and I made it like this
%math_{time_played}%

#

and didn't work

twin venture
wooden zodiac
#

We dont have any other plugin for custom item I'm just making it for video then i will delete or maybe modify code and publish to the site

thin frost
#

Hey guys, is it possible to develop custom weapons RPG style with stats and boss creatures without modding the client?

thin frost
#

I want to add misc. mini bosses in the world.

paper viper
#

Its not easy to do it but its possible

Sorry i dont have sources which can help you

thin frost
#

Have you done or tried it?

paper viper
#

There are just too many gears which have to perfectly allign with the rest of the gears

So your best bett would be to try to code it yourself

thin frost
#

What gears do you mean?

#

Yes I am planning to code it myself

paper viper
paper viper
thin frost
#

I don't know why you thought that 😮

#

I've "reverse engineered" world of warcrafts item generator for another project of mine and I want to integrate it into my minecraft server.

paper viper
#

Then ig i would start with making an item loader which applys lore and other data to the item

I have put my stats in the nbt

thin frost
#

I plan to add some RPG elements incl. custom mini bosses. But I only want to do this if I can modify items and create custom NPCs without forcing client modding.

#

So what I am asking is: is it possible to do this without editing the client?

paper viper
#

I would say yes but this ofc depends on what exacly you want to implement

thin frost
#

@paper viper where should I start looking into how to do this? How does it work adding new NPCs and sending model data etc. without client modifications?

wooden zodiac
#

how to apply attributes directly to the player?

young knoll
#

Player#getAttribute(x)

hushed spindle
#

is there a way to get all loot tables of a world

#

LootTables has only the vanilla ones but I would also like to access any potential custom ones made by things like terralith

jolly solstice
# thin frost <@430770874929381386> where should I start looking into how to do this? How does...

There is existing NPC libraries / APIs that you can use.
You will however not be able to alter their "model" really, but rather their skin or what type of entity they are I guess.
You could do hacky workarounds with Item / Block Displays, but yeah.

Modifying items is another topic - again, you won't be able to just "add" a new item, but you can change textures of existing items through resource packs while also giving them new "functions" depending on what data you hide in them, however a player can choose to download the resource pack on server connect or not.

drifting bluff
#

how do i set flags of a worldguard region ?

#

with my plugin

jolly solstice
drifting bluff
#

how

jolly solstice
#

Literally the first link

#

It also explains how to work with regions on that website

drifting bluff
jolly solstice
drifting bluff
#

how do i see again? 😭

jolly solstice
#

Are you building your plugins dependencies by yourself (adding each external .jar into your plugin yourself) or are you using a configured build tool that resolves your dependencies?
You would know if you do ...

drifting bluff
#

im adding each external jar like worldguard or fawe or luckperms into my server

#

i use maven

#

i was dumb

jolly solstice
#

Then don't use the explanation for Gradle on that website, but the one for Maven - the pom.xml code is right there on the site.

drifting bluff
#

k

#

i got this

#

region.setFlag(Flags.USE, StateFlag.State.ALLOW);

#

but whats the statefklag

#

or like how do iset the build flag

#

region.setFlag(Flags.BUILD, true); like this

#

?

jolly solstice
#

It literally explains how to use them there

drifting bluff
#

and where do i set the region where i set the flag?

#

got it

#

and why dpes this not work

dawn flower
#

should everything database-related be async?

chrome beacon
#

yes

#

sync during shutdown is probably fine

dawn flower
#

what about stuff that aren't done that often? such as banning / unbanning to avoid concurrency issues (i'm not sure if databases support concurrency)

chrome beacon
#

still

#

You don't want to freeze the entire server when banning someone

dawn flower
#

alr

jolly solstice
dawn flower
#
    public ModerationManager(DatabaseManager databaseManager, TurboModeration instance) {
        this.databaseManager = databaseManager;
        this.instance = instance;
        this.hasLoaded = false;
        this.punishments = new HashSet<>();
        instance.runAsync(() -> {
            punishments = databaseManager.getPunishments();
            this.refreshPunishments();
            this.hasLoaded = true;
            System.out.println("test");
        });
    }

    public void save(boolean close, boolean async) {
        if (!hasLoaded) {
            instance.getLogger().log(Level.SEVERE, "Tried to save punishments before loading.");
            return;
        }

hasLoaded is always false for some reason (it's printing test)

#

nvm

deft locust
#

My server is always crashing with tps on 20.0 and then when it crashes the command simply stops (thread stopped) and then never comes back and the server simply crashes. How can I see the cause if the latest.log only shows the pending stuff from the thread that stopped?

deft locust
#

my bad

glacial narwhal
#

Hello, is there a way to get the model data of a Block ? (I use the BlockPlaceEvent for any exteriors ways.) 1.21

eternal oxide
#

Blocks have no model data

glacial narwhal
eternal oxide
#

You can get the ItemStack custom model data in the place event, but a Block has none

rough drift
glacial narwhal
glacial narwhal
eternal oxide
#

yes the Item is consumed when the player places it

glacial narwhal
eternal oxide
#

yes

glacial narwhal
#

Okay thanks !

thin frost
#

Any plugins that work like valheims monster attacks on base? how to code this?

grim hound
#

how can I check which block the player is standing on?

#

Cuz this stuff is killing me

#

like why is this so hard

jolly solstice
slender elbow
#

that isn't necessarily accurate

#

you can get air and still be supported by a solid block, e.g. if you're standing on the edge

jolly solstice
grim hound
slender elbow
#

there is an nms method for it

#

I don't remember what it's callrd

grim hound
#

and this gives inaccurate results for whatever bullshit reason

slender elbow
#

something about supporting block or standing block

jolly solstice
grim hound
slender elbow
#

I fail to see how one thing relates to the other

jolly solstice
#

Whatever ... yes there is an NMS method

slender elbow
#

just because someone asks a question means that they can't understand code..?

#

lol

jolly solstice
#

I also can't recall the name right now

grim hound
#

like what the fuq are you on about?

jolly solstice
#

Good, then look into NMS code

#

As Emily already said

jolly solstice
#

Sorry, I usually first assume people have no clue when they ask questions like these on the forums / Discord

#

Especially when given no further information

earnest girder
#

is there any way I could make armorstands' nametags only visible at a short distance? Could I catch the nametag packets being sent and cancel them if the player is too far?

Actually, it would be even better if I could just make the nametags only visible if there is a direct line of sight, meaning they cant be seen through walls

grim hound
slender elbow
#

that is a fair assumption

grim hound
#

are not when I land after jump

#

which is restarded

#

I've been trying to solve this for like 3 days now

jolly solstice
#

As Emily already said - there is no "simple" answer for that specific problem.
I gave the simple answer, because in 90% of the cases, that is enough for simple use-cases.
The only 100% accurate way of telling which block is supporting the player, you need the NMS method for it.

quiet ice
#

I'll go with the nuclear response: If one can't find it it does not exist

slender elbow
#

it does exist because some downstream fork has api for it :^)

#

(or, a pr to add such API)

grim hound
quiet ice
#

"Some downstream fork" would be yatopia

upper hazel
jolly solstice
grim hound
slender elbow
#

ah yeah that's the one

grim hound
#

okay, thanks

jolly solstice
upper hazel
#

all this what

#

drag

#

how many

jolly solstice
#
@Override
public void onDrag(InventoryDragEvent event) {
    event.setCancelled(true);
}
#

You are cancelling all drag events

upper hazel
#

this one

#

how many events exists

jolly solstice
#

what

upper hazel
#

how many inventories events exist to cancel them.

tardy delta
#

check the docs

upper hazel
#

as I recall, there's two drag, click.

#

bruh 💀

#

I thought two or three events at the most.

chrome beacon
#

There are many inventories

upper hazel
#

any idea how to open the anvil without pushing it. i want have backend logic for virtual gui

chrome beacon
dawn flower
#

how do i shorten the message shown the console?

    @EventHandler(priority = EventPriority.HIGHEST)
    public void onLogin(PlayerLoginEvent e) {
        Player player = e.getPlayer();
        ModerationManager manager = MyMainClass.getModerationManager();
        Punishment.PunishmentType banType = Punishment.PunishmentType.BAN;
        Punishment.PunishmentType ipBanType = Punishment.PunishmentType.BAN_IP;

        if (manager.hasPunishment(player, banType)) {
            Punishment punishment = manager.getPunishment(player, banType);
            String text = manager.getPunishmentText(punishment);
            e.setKickMessage(text);
            e.setResult(PlayerLoginEvent.Result.KICK_OTHER);
        } else if (manager.hasPunishment(player, ipBanType)) {
            Punishment punishment = manager.getPunishment(player, ipBanType);
            String text = manager.getPunishmentText(punishment);
            e.setKickMessage(text);
            e.setResult(PlayerLoginEvent.Result.KICK_OTHER);
        }
    }```
tardy delta
#

why so much duplication

#

doubt you can

dawn flower
#

i'm planning on cleaning it up

dawn flower
slender elbow
#

doesn't intellij do that already?

#

ah, it's an Ultimate feature

#

idk of any plugin, maybe

#

have you searched in the plugins marketplace?

earnest girder
#

wtf is up with BlockSpreadEvent? neither getSource() nor getBlock() return what they are supposed to. I am trying to handle mushroom spreading, but both these methods just return air blocks, never a mushroom block, even when mushrooms are spreading.

dawn flower
#
instance.runAsync(() -> {
            punishments = databaseManager.getPunishments();
            this.refreshPunishments();
        });

    public void refreshPunishments() {
        punishments.stream()
                .filter(Punishment::hasEnded)
                .forEach(this::removePunishment);
    }```
in a very specific case, this causes a ConcurrentModificationException
would making refreshPunishments ``public synchronized void``, as well as getPunishments fix it?
#

or would it do nothing since it's async

tawdry echo
#

whats punishments

dawn flower
#

a set

slender elbow
#

the issue is that you are modifying the collection (punishments) while iterating through it (via the stream)

#

consider Collection#removeIf(Predicate)

#

what exactly does removePunishment do anyway

dawn flower
#

it removes the punishment from the set and the db

#
    public void removePunishment(Punishment punishment) {
        instance.runAsync(() -> databaseManager.deletePunishment(punishment.getId()));
        punishments.remove(punishment);
    }```
#

is there something like a concurrent hashset? like the concurrent hashmap

slender elbow
#

concurrency isn't exactly your issue, your issue is that you are modifying the set while iterating it

#

just do removeIf, pass a lambda, and call the db thing inside it as well

#

also, maybe consider doing a bulk removal on the db too

dawn flower
#
punishments.removeIf(punishment -> {
  if (punishment.hasEnded()) {
    databaseManager.deletePunishment(punishment.getId());
    return true;
  }
  return false;
});
```?
slender elbow
#

yeah, or if you go with the bulk db removal option as well, it'd look something like

var stalePunishments = punishments.stream().filter(...).toList();
punishments.removeAll(stalePunishments);
databaseManager.deletePunishments(stalePunishments);
dawn flower
#

alr

#

wait is there a sql statement to bulk delete or will i have to use PreparedStatement#executeBatch

#

should i do it

slender elbow
#

lmao where are you getting that from

#

no

#

oh god HashSet doesn't implement removeAll

#

do that, yeah

dawn flower
#

ok

tardy delta
#

@Language("SQL")

brittle geyser
#

How to create nps with nms?

slender elbow
#

oh yeah the language annotation is a thing

dapper flower
#

I have a ladder, how do I check the block that supports said ladder?

sleek bear
#

Hello

eternal oxide
#

loop getRelative(BLOCKFACE_DOWN) until its no longer a ladder

sleek bear
#

Can someone help me with the BattleLevels plugin?

dapper flower
#

the solid block it is holding it

#

the block that if i break it the ladder explodes too

pseudo hazel
#

wtf how is removeAll hard to do, just make a new empty set xD

sleek bear
#

@vagrant stratus

#

Can someone help me with the BattleLevels plugin?

eternal oxide
#

Ladder data is Directional so Block#getRelative(Ladder#getFacing())

#

may have to invert the facing. tas

vagrant stratus
dapper flower
eternal oxide
#

what?

#

(Ladder) Block#getBlockData()

#

or directional

worthy yarrow
pseudo hazel
worthy yarrow
#

This isn't enough for a proper review

#

like 50 lines lol

pseudo hazel
#

wdym

#

noone says there is a minimum size requirement

worthy yarrow
#

well sure but I'm not really looking for what you'd call a review I just want to know if it makes sense to follow illusion's idea

pseudo hazel
#

why is it a map of invites? for faster lookup?

worthy yarrow
#

mainly, I hate lookups on anything but maps kek

#

It's also what I feel to be more OOP oriented

pseudo hazel
#

the invitee is the one getting the invite?

worthy yarrow
#

Yes

#

UUID of island owner can be derived from any member of said island btw so this is not an issue

pseudo hazel
#

right

#

i mean both uuids are in the invite so it doesnt matter that much anyways

worthy yarrow
#

It just may be confusing as the "owner" may not always be the one inviting

#

I'll be sure to doc it

pseudo hazel
#

wdym

#

the one sending the invite needs to be able to invite people to some island right?

#

like the other way around would be a request

worthy yarrow
#

Right, but in the naming convention this always makes it sound like the owner of the island is the inviter

#

Which is not always true

pseudo hazel
#

right because thats what you named it xD

#

then it should be called inviter

#

and invitee 😛

#

I dont think its that useful to store the invitee in the invite though

worthy yarrow
#

It's easier (imo) to just hold a ref to the island owner since I can already derive this from any member of the island

pseudo hazel
#

as its already in the map

eternal oxide
#

Sender/Receiver

pseudo hazel
#

why not hold a ref to the island

worthy yarrow
#

Hmm

pseudo hazel
#

the invite is made by someone who wants to join an island

worthy yarrow
#

wrong

pseudo hazel
#

anyone co-owning the island I think should be able to accept it

#

the otehr way round I mean

worthy yarrow
#

An invite will always be created by a member of the island

#

(with perms ofc)

pseudo hazel
#

but if you were co owning an island, I might wanna see if your invite someone

#

same thing

#

like justhaving the invite take the island itself might be easier

#

then you can easily get anyone you want

worthy yarrow
#

Yk what's really confusing in this impl kek

#

The fact that I map a uuid to a uuid right?

#

But the keyed uuid and value uuid are always the same

sleek bear
#

alguien me ayuda

pseudo hazel
#

wdym

worthy yarrow
#

And this is because easier lookups through a map than like a set or list kek

sleek bear
#

con el plugin BattleLevels?

pseudo hazel
#

yeah thats what I was saying before

#

thats why I asked if you were using a map for lookup

#

because a list is good enough

#

or just not store the invitee in the invite

worthy yarrow
#

I think the invitee has to be stored in the invite?

pseudo hazel
#

to get an invite's invitee, you would have to get the invite first

#

which would require you to get the invitee's uuid anyways

#

like how do you get a specific invite without a invitee uuid

#

short of looping through all invites

#

which isnt what you want for a map anyways

#

and also shouldnt it be a Map<UUID, List<Invite>>?

#

like what if 2 islands invite you near the same time

worthy yarrow
#

Actually yeah

#

thats a good point

pseudo hazel
#

or a queue I guess

#

depending on your implementation

#

so probably just a collection

worthy yarrow
pseudo hazel
#

I mean whats the point

#

how many people are gonna be a member

#

100?

#

i dont think so

worthy yarrow
#

configurable

#

so tbf

#

It could be kek

pseudo hazel
#

yeah but its not gonna be

worthy yarrow
#

I don't really know a better way to hold this data though

pseudo hazel
#

yeah that was gonna be my next question

#

how else would you store it haha

#

in a list?

#

surely thats a faster lookup

#

🙂

worthy yarrow
#

I mean still the lookups are painful, I have to search by index position with a list

pseudo hazel
#

or just array

#

rawdogging it

#

then its gonna be fast until like 1000 entries

worthy yarrow
#

I feel a set achieves it's purpose, just had an idea though, perhaps mapping members to roles within the island

worthy yarrow
pseudo hazel
#

what kinda roles

worthy yarrow
#

Roles relating to your position on the island

#

Visitor, member, moderator, etc

pseudo hazel
#

that would just make the lookup more annoying depending on how you wanna use it

#

like counting all members of an island at any time will be a pain

#

since now you are looping through like 4 lists instead of 1

#

or well count maybe not

worthy yarrow
#

I'm just gonna stick with a set then

pseudo hazel
#

but you get the point

worthy yarrow
#

I don't really need to get a member from an island tbf, I can workaround this with their roles

pseudo hazel
#

just keep in mind that adding more ways to get your members might make it harder to maintain

worthy yarrow
#

Well that's kind of my point

#

I don't think I'll ever need to get a specific member as it were, just verify what roles they have to permit wtv

dawn flower
#

how do people test ip bans and stuff like that? localhost won't work for that

river oracle
#

And supply fake addresses

#

But IP banning is beyond idiotic

#

There are scenarios where its useful but for minecraft unless you're being botted off 1 IP it's kinda pointless

tardy delta
#

cries in hypixel ip ban

slender elbow
#

in a world of NATs, CGNATs and IPv6, IP bans is pretty pointless

lilac dagger
#

you can't really ban someone's ip

#

they can just change it in most cases

worthy yarrow
#

Hypixel gonna start handing out hwid bans

lilac dagger
#

and banning a range will result in banning an isp or something

#

how would hypixel have access to hardware id?

river oracle
#

Also you have to think about how dynamic ips work what if a person gets a banned ip who isn't cheating

#

You're now punishing an innocent person for something they have no control over

lilac dagger
#

well that's what happens

#

ips aren't static

#

in most places

slender elbow
#

worst case scenario banning an IPv4 will result in a whole load of people being banned given CGNAT for IPv4 are very common since IPv4 is scarce

lilac dagger
#

i remember one day i couldn't join spigot from my phone data

slender elbow
#

although that depends on the ISP

lilac dagger
#

i think it was stopped by cloudflare? not sure

river oracle
river oracle
lilac dagger
#

ip bans aren't worth it

#

if minecraft handled hardware ids to the server that would be great

#

but someone could patch in fake ids and get away with it

river oracle
worthy yarrow
#

How does persistence of player uuids work? I thought this was the "common" way to be banning people

lilac dagger
#

well, premium + ban would be costly in long time

river oracle
lilac dagger
#

me neither

river oracle
#

Used to be easy to get 500 or 600 accounts

lilac dagger
#

you can't possibly afford many mistakes on premium

#

that's for sure

worthy yarrow
#

I've seen people with like 50kb txt files filled with accounts kek

lilac dagger
#

jeez, how do they get so many?

worthy yarrow
#

🤷

#

Maybe just a period of time they've been collecting

chrome beacon
#

You could buy used accounts for pretty cheap

river oracle
chrome beacon
#

not sure if that's still the case post migration

river oracle
#

Probably less

#

Post migration prices are prob higher

lilac dagger
#

i wonder when the accounts that didn't migrate will get the purge

#

would be so nice to get my username

river oracle
#

Maybe the usernames haven't been freed tho

river oracle
lilac dagger
#

nope

#

still here

sterile token
# lilac dagger

haha, happens the same to me lmao. I used to had a premium account which i could not migrate it and i still cant buy one, one of reason is caused because they dont accept Paypal (dont ask why the fuck they dont do) and second, because of exactly that username is still registered

sterile token
eternal oxide
#

lots of places don;t accept Paypal due to a dodgy history

sterile token
eternal oxide
#

underhanded

worthy yarrow
#

sketchy

eternal oxide
#

possibly criminal

sterile token
#

oh okay, so you mean they dont accept it. because of they owner? or because of bad security. I cant catch it

worthy yarrow
#

What is your native language

slender elbow
#

ambiguous, cryptic, deceptive, deviant, dishonest, unreliable, unsafe, untrustworthy

sterile token
sterile token
worthy yarrow
#

Indigno de confianza Is the main point

sterile token
worthy yarrow
#

Google said that translated to untrustworthy so crossing my fingers lol

sterile token
#

yeah i conclude the same that some things from paypal dont really close to me. Starting from the closing of accounts with money and having to do many legals things to get the moeny back. It has is reasons but its weird...

eternal oxide
#

I have a Paypal and have had it for many years. Funds going in and out. One day when I had a decent amount in the account they locked it

slender elbow
#

typical paypal

worthy yarrow
#

I keep 0.19$ in my paypal account... it's not even accepted

eternal oxide
#

I had to jump through so many hoops of faxing photographs of my drivers license and other bits to get teh account unlocked

#

They would also ONLY accept a Fax, no email or anything else

sterile token
worthy yarrow
#

I only ever use paypal as the middle man, don't ever keep any funds in there

slender elbow
#

i have $11 in paypal and that's more than i'd like to have there 💀

sterile token
worthy yarrow
#

This is literally it

#

And like I said, I haven't even accepted it

sterile token
#

also what is too weird from paypal, is that. If you log into your account right? Let say you wanna change your account email due to a steal, you have to best. Because if you do change it fist account is losted, because they dont verify the actual email before the allow to change it

river oracle
#

It's nice to beable to dispute charges easily and still use my bank account if something were to happen

worthy yarrow
#

yupp

#

I hate paypal though

#

Just nice for online shit

sterile token
# worthy yarrow Just nice for online shit

Even thoguth here should be more services like these, but they should work both digitally and physically. Because for the backend issue to implement payment methods through pos terminals (where you pay physically with a card), you have to see which provider they use and figure out how to implement it, not that there is an api.

worthy yarrow
#

I think cashapp does this, but not everywhere has cashapp

sterile token
nova notch
#

And then one software update takes down the whole world again

white root
#

Does anyone know why this listener doesnt seem to work? ```kotlin
@EventHandler
fun onPrepareItemEnchantEvent(event: PrepareItemEnchantEvent) {
if (event.item.type != Material.FIREWORK_ROCKET)
return
println("\nitem is firework")

event.offers[0] = EnchantmentOffer(Enchantment.ARROW_INFINITE, 1, 5)
println("post set offer")

}


I expected this to offer the player the infinity enchantment in the list of enchantments, but nothing appears despite both messages being logged to console:
#

I also tried just iterating over every offer in the event.offers array and setting them all to the same infinity enchantmentOffer, but to no avail

brittle geyser
#

maybe event.offers return copy offers

white root
#

I dont think this is the case, the javadocs for PrepareItemEnchantmentEvent#getOffers() says: ```
Get a list of available EnchantmentOffer for the player. You can modify the values to change the available offers for the player. An offer may be null, if there isn't a enchantment offer at a specific slot. There are 3 slots in the enchantment table available to modify

Returns: list of available enchantment offers

brittle geyser
#

maybe you need update inventory?

#

change offers and log all offers to check is it changed

white root
brittle geyser
#

try to get view and set changed offer array

brittle geyser
white root
# brittle geyser Is it worked?

Give me a moment. Im making a plugin for a survival server for a few friends of mine but the server is still on 1.20.4
Im seeing if the server can be updated to 1.21 before I check if that works, since that doesnt seem to exist in 1.20.4

brittle geyser
#

there is docs only for 1.20.3 and 1.21, not 1.20.4 or 1.20.5

#

I think enchantment view is exist in 1.20.4

wet breach
#

using stuff that isn't within the users control

white root
white root
foggy cave
#

?paste

undone axleBOT
foggy cave
#

Error:
https://paste.md-5.net/eqosibitiz.sql
Where the error is:

    public <E extends Event> void registerEventHandler(Class<E> eventClass, EventHandlerFunction<E> handler) {
        EventListener<E> listener = new EventListener<>(eventClass, handler); // line 30
        plugin.getServer().getPluginManager().registerEvents(listener, plugin);
        eventHandlers.put(eventClass, handler);
    }

EventHandlerFunction:

@FunctionalInterface
public interface EventHandlerFunction<E extends Event> {
    void handle(E event);
}
#

Can someone help, I dont understand this error at all

chrome beacon
foggy cave
#

Oh

#

So what is the alternative

chrome beacon
#

Why do you want to do that

foggy cave
#

This is what I am trying to do

eventAPI.registerEventHandler(PlayerSwapHandItemsEvent.class, event -> {
            if (event.getMainHandItem() == null)
                return;

            if (event.getMainHandItem().equals(craftingAPI.getReinforcedShield())) {
                event.setCancelled(true);
                event.getPlayer().sendMessage(ChatColor.translateAlternateColorCodes('&', "&a&lALERT » &7You cannot hold this item in your other hand!"));
            }
        });
foggy cave
chrome beacon
#

I have an idea what the issue could be

foggy cave
#
@FunctionalInterface
public interface EventHandlerFunction<E extends Event> {
    static HandlerList getHandlerList() {
        return null;
    }

    void handle(E event);
}
#

If I did this would it be fine

chrome beacon
#

no

foggy cave
#

Ok

chrome beacon
#

use registerEvent instead of registerEvents

worthy yarrow
#

olivo how to calm down kek

foggy cave
#

Yeah let me try that

worthy yarrow
#

I want to reach through my monitor and choke the life out of the chargeback guy D:

foggy cave
#

Btw I also have this

    public <E extends Event> EventHandlerFunction<E> getEventHandler(Class<E> eventClass) {
        return (EventHandlerFunction<E>) eventHandlers.get(eventClass);
    }

Its unused atm

wise mesa
#

hi, HumanEntity#getOpenInventory is returning a craft inventory view, even when a furnace or cartography table is open

#

is this correct

foggy cave
wise mesa
#

i thought it would only give a craft inventory view if the player was in a crafting table or had no inventory open

#

wait

#

im stupid

#

my bad

#

this is what I get for just printing objects

#

craft as in craftbukkit 🤦

worthy yarrow
foggy cave
#

Ok I've tried something I'll let u know if its works Olivo

tall dragon
worthy yarrow
#

Hello shurikennen

#

As you know, I am upset

tall dragon
#

yep

worthy yarrow
#

How are we doing today?

tall dragon
#

pretty good. and you?

#

not very good obviously

#

as you are upset

worthy yarrow
#

Unironically am upset yes

#

Time for a shower and loud music I suppose

foggy cave
#

No errors in console, who know if it will work though, let me check

slender elbow
#

you'd need to make an impl for EventExecutor that will call the listener and pass that to the registerEvent method

foggy cave
#

yeah thats what ive tried doing, im testing it rq

#

Yeah I need to redo my implementation it didnt work

acoustic shuttle
#

Is there a way to differentiate between inventories besides name or checking the items like and id or sum?

foggy cave
#

My impl is kinda scuffed

public <E extends Event> void registerEventHandler(Class<E> eventClass, EventHandlerFunction<E> handler) {
        EventExecutor executor = new EventFunctionExecutor<>(eventClass, handler);
        Listener dummyListener = new Listener() {};

        plugin.getServer().getPluginManager().registerEvent(
                eventClass,    
                dummyListener, 
                EventPriority.NORMAL,
                executor,        
                plugin     
        );
    }
foggy cave
#

But - it works 🙂

acoustic shuttle
# ivory sleet I think using equals() on them?

I meant like not furnace/chest/hopper inventories like chest inventories but instead of checking their name is there like a way to set a id or sum? not really important just curious as it could be a little useful though not really needed

ivory sleet
#

Depending on what u do, u may wanna compare them w equals(), or just ==, or maybe InventoryHolders

#

:^)

river oracle
foggy cave
#

If I wanted to have some sort of custom durability that I can reduce whenever on items for example without durability, would this be fine to store the durability, if so, how would I go about changing it?
itemMeta.getPersistentDataContainer().set(new NamespacedKey(plugin, "durability"), PersistentDataType.INTEGER, 50);

ivory sleet
#

Not sure how they’re used internally, but myea I mean if u use them for ur own sake u can always cache em

#

Ig its kind of api breaking to do that but eeeeeeeh

foggy cave
wise mesa
#

i would use a persistent data container

river oracle
wise mesa
#

and then calculate the percentage of your custom durability out of the max and apply that to the actual item's max

#

whenever it changes

river oracle
#

doesn't cause issues unless you're implementing human entity Inventory or sum

ivory sleet
#

We were talking about InventoryHolders no?

river oracle
ivory sleet
#

mye

river oracle
wise mesa
#

👍

foggy cave
#

Just wondering if PDC was the way and ig it is

river oracle
#

I mean there is a lot of stuff surrounding inventories in general that need improvements I can just add it to the chopping block

wise mesa
#

yep that's how I did it in my plugin

#

and I believe its the common method

#

unfortunately there's no built in api for it

ivory sleet
river oracle
ivory sleet
#

Ah okay, nice, ill look at that tomorrow, keep the good work up:)

river oracle
#

next will probably be Menu Builders its an idea lynx was talking about in DMs, and I thought I'd mock something up

torn shuttle
#

is there any bbcode or html code you can use in spigot posts to make a table?

eternal light
#

Hello good, could someone tell me how I could configure to hide my servers to a port scan because with ip table I can only block all connections even between servers.

river oracle
#

It might end up looking nice in the end

river oracle
#

if you're worried about port scanning take yourself off of 25565

river oracle
#

Builders would allow you to tie them to the world itself and add different data before you actually build it

ivory sleet
#

Ah alright, i think im on the same page then

#

fairs, sounds good then

river oracle
#

so with a merchant menu you could do

MenuType.MERCHANT.builder()
  .ofVillager(someEmptity)
MenuType.MERCHANT.builder()
  .addRecipe(...)
MenuType.FURNACE.builder()
  .atLocation(location)
#

this kinda stuff

#

then after that I have to completely rewrite the internals for creating inventories

#

which is a hugeee pain

ivory sleet
#

lol thats not the first time

river oracle
# ivory sleet lol thats not the first time

I'm thinking of doing it differently then last time though. I want to change the way inventories are thought of. In the end I think an API like.

final InventoryView view = MenuType.CHEST.builder()
  .fromInventory(myInventory)
  .build(player);
``` or
```java
final InventoryView view = MenuType.CHEST.from(inventory);

Would be the coolest.

#

If that's actually practical is a different question

quaint mantle
#

How are custom huds typically displayed? Bossbar?

young knoll
#

Action bar

blazing ocean
#

If it's at the top of the screen, bossbar, if it's at the bottom, action bar, if it's in the center, a title

#

You use these since font ascents/shifts aren't relative to screen size

#

To make stuff relative like that, you need shaders

quaint mantle
drowsy helm
#

Minecraft ui scales at a constant so if you dont need screen relative stuff, you should need it

wise mesa
#

is == for material still acceptable or is .equals preferable

river oracle
wise mesa
#

cool

#

hey what's the best way to pass the scheduler around

#

I don't really like passing the scheduler and the plugin around it just feels icky to me

#

and verbose

#

maybe ill make a wrapper that includes the plugin real quick

wise mesa
sweet pike
#

what is the issue with this import order?

young knoll
#

Pretty sure it is meant to be alphabetical

#

Any imports added by a patch should be at the bottom tho, with a CraftBukkit comment

worthy yarrow
floral drum
#

what the fuck

worthy yarrow
#

Haha imagine organizing imports

echo basalt
#

Project at work legit won't compile if imports aren't in a particular order

worthy yarrow
#

what the fuq

slender elbow
#

yes it's called style guides

worthy yarrow
#

For what purpose though

echo basalt
#

Keeping spacing consistent

worthy yarrow
#

And this is literally just for your imports?

echo basalt
#

Imports, spacing

#

everything

worthy yarrow
#

if it's for everything it makes sense, I thought it was specifically to organize your imports or something

viscid carbon
#

i keep posting in the wrong thread -.-

torn shuttle
#

aw sick

#

my favorite

#

an 18 hour work day

#

huge pog

#

but don't worry I took a break to go to the gym for two hours, it was leg day

white root
#

I think this is related to/the cause of my earlier issue

#

Is there some way to force enchantment table offers to appear on items that dont normally get enchantments?

I used this code in a PrepareItemEnchantEvent: ```kotlin
//if (event.item.type != Material.FIREWORK_ROCKET)
// return
//println("\nitem is firework")
Arrays.setAll(event.offers) { EnchantmentOffer(Enchantment.ARROW_INFINITE, 1, 1) }

If I put a bow in the enchantment table, all of the enchantment offers populate correctly and show the infinity enchantment
But if I put a firework in there, none of the enchantment offers appear. Is there something else that I need to do here?
quaint mantle
#

is it safe to read data from pdcs asynchronously and if so is there any point or would the performance gains be negligible?

echo basalt
#

Yessir

#

And ktlint

quaint mantle
#

🔥

sterile breach
#

generally when we store last connexion date of a player, we define the date when the player join or when it leave?

hazy parrot
#

Leave I would say

blazing ocean
#

I hate it

echo basalt
#

ctrl + alt + L go brr

blazing ocean
#

I create a new file, 4 warnings

#

And the fact that that top bar thing from it just sometimes bugs out and duplicates and doesn't go away

#

annoying asf

hazy parrot
#

Well you can modify both ktlint and checkstyle to your liking

wooden zodiac
#

why economy and placeholder showing in red even if it compiles plugin?

blazing ocean
#

Try invalidating caches

rough drift
dapper flower
#

Why is there an getAttachedFace on the deprecated org.bukkit.material.Attachable MaterialData however there is no equivalent for the newer BlockData approach org.bukkit.block.data.Attachable?

dreamy jacinth
#

Hey, I'm new to plugin development and I can't seem to figure out how to get the owner of a horse. I found out that a getOwner method exists on the Tameable interface, but I can't figure out how to access that interface. My current code just looks like this:

Entity mount = event.getMount();
        if(mount.getType() == EntityType.HORSE)
        {
            Player owner = mount.
        }
dapper flower
drowsy helm
#

(Or a child class of it)

dreamy jacinth
#

Would this work? org.bukkit.entity.Horse horse = (org.bukkit.entity.Horse)mount;

drowsy helm
#

Yeah just check instanceof beforehand

dreamy jacinth
#

All right thanks

drifting bluff
#

when i tye /broadcast and then a message i get this in chat and not the message


    @Override
    public boolean onCommand(CommandSender commandSender, Command command, String s, String[] args) {
        Player p = (Player) commandSender;
        String msg = "";
        msg = msg + args;
        Bukkit.broadcastMessage(ChatColor.translateAlternateColorCodes('&', msg));
        return true;
    }
}
hazy parrot
#

you cant concat array to string

#

i mean u can, but will get result like that

blazing ocean
#

This is why Lists are better than arrays

drifting bluff
#

better?

hazy parrot
#

that will just take first arg

drifting bluff
#

so i need to get all the values out of the array

drifting bluff
#

good?

drowsy helm
#

That will only take args

drifting bluff
#

works

#

but it works

drowsy helm
#

If msg is empty, sure

#

You’re not using msg anywhere in that

hazy parrot
#

String msg = ""; its empty, he just used it for concatenation

eternal oxide
#

you can;t concat like that with +

#

ah I didn;t read. I see you covered .join

sterile breach
#

with caffeine at cache builder you can give a lambda to avoid the cache getting a value into sql for example when it dosnt have
With caffeine at cache build time, you can set a lambda to prevent the cache from obtaining a value in sql if the value is not present, example

cache.get(playerinfo) if the cache dont have it, if it dont have playerinfo it get it from db, anynone know if it use a completable future or something like this (callback) for that? or all are executed sync?

earnest grail
#

Who knows how to span an item frame. i tried many ways but ended up with errors

#

in 1.8

blazing ocean
#

1.8 💀

dense falcon
#
public class InventoryListener implements Listener {

    private final Main NeoWorldPlugin;

    public InventoryListener(Main main) {
        NeoWorldPlugin = main;
    }

    @EventHandler
    public void onInventoryClick(InventoryClickEvent event) {
        Inventory clickedInv = event.getInventory();
        Player player = (Player) event.getWhoClicked();

        if (clickedInv.getTitle().startsWith("§lInventaire de §b§l"))  { // Command openinv
            Player target = Bukkit.getPlayer(clickedInv.getTitle().replace("§lInventaire de §b§l", "").trim());
            if (target != null) {
                Inventory targetInv = target.getInventory();
                for (int i = 0; i < targetInv.getSize(); i++) {
                    ItemStack item = clickedInv.getItem(i);
                    targetInv.setItem(i, item);
                }
            }
        }
    }

    @EventHandler
    public void onInventoryClose(InventoryCloseEvent event) {
        Inventory closedInventory = event.getInventory();
        Player player = (Player) event.getPlayer();

        if (closedInventory.getTitle().startsWith("§lInventaire de §b§l")) {
            Player target = Bukkit.getPlayer(closedInventory.getTitle().replace("§lInventaire de §b§l", "").trim());
            if (target != null) {
                Inventory targetInventory = target.getInventory();
                for (int i = 0; i < closedInventory.getSize(); i++) {
                    ItemStack item = closedInventory.getItem(i);
                    targetInventory.setItem(i, item);
                }
            }
        }
    }
}
public class Openinv implements CommandExecutor {

    private final Main NeoWorldPlugin;

    public Openinv(Main main) {
        NeoWorldPlugin = main;
    }

    @Override
    public boolean onCommand(CommandSender commandSender, Command command, String s, String[] strings) {
        if (commandSender instanceof Player) {
            Player plr = (Player) commandSender;

            if (strings.length == 0) {
                plr.sendMessage("[" + ChatColor.RED + "NeoWorld" + ChatColor.WHITE + "] "
                        + "Vous devez indiquer le nom du joueur !");
                return false;
            }

            if (Bukkit.getPlayer(strings[0]) == null) {
                plr.sendMessage("[" + ChatColor.RED + "NeoWorld" + ChatColor.WHITE + "] "
                        + "Vous devez indiquer le nom d'un joueur actuellement connecté !");
                return false;
            }

            Player target = Bukkit.getPlayer(strings[0]);
            showInventory(plr, target);
        }
        return false;
    }

    private void showInventory(Player sender, Player target) {
        Inventory inv = Bukkit.createInventory(null, 36, "§lInventaire de §b§l" + target.getDisplayName());
        Inventory invTarget = target.getInventory();
        for (int i = 0; i < invTarget.getSize(); i++) {
            ItemStack item = invTarget.getItem(i);
            inv.setItem(i, item);
        }

        sender.openInventory(inv);
    }
}

I am trying to create a command to open the inventory of a player and update it, but I would like to every time you change something in the UI, it updates the player's inventory. In this case it works but only with the close event.

ivory sleet
tall dragon
sterile breach
ivory sleet
#

Uuuh, i didnt entirely get what u mean, but yea theres an async cache that wraps the values I think w CompletableFuture

sterile breach
#

probably

ivory sleet
#

No I mean I’m saying its definitely a thing

#

But whether it suits u is another question

sterile breach
#

aaah okay

#

good to know

lost matrix
#

I love the AsyncLoadingCache. It absolutely forces you to write proper async code and the read-through cache loading is quite clean.

sterile breach
#

just in LoadingCache so there are not completable future I dedecute?

#

using completable future in event will generate errors?

tawdry shoal
#

hi, is it possible to somehow give the player a freezing effect? which appears when entering loose snow

blazing ocean
#

Player#setFreezeTime or sth like that

tawdry shoal
#

thx

drifting bluff
#

i added the dependencie in the pom.xml and plugin.yml (iu use maven) and it says there is nothing like this, in the code., i want to set the pvp flag in a region with myplugin

blazing ocean
#

You have both in one dependency tag

#

You need to seperate them into their own

#

And you also need to replace VERSION with your target WorldGuard version

drifting bluff
#

doesnt work

chrome beacon
#

Did you reload the pom

drifting bluff
#

how

chrome beacon
#

The reload icon in the top right

drifting bluff
chrome beacon
#

yes

blazing ocean
#

Yes

drifting bluff
#

pressed it, does nothing

#

oh

#

wait

#

i think its working

#

works

#

thx

#

still wierd

chrome beacon
#

You need worldguard core too

drifting bluff
#

where how

chrome beacon
#

Copy that bukkit depend

#

and change it to core

drifting bluff
#

what bukkit depend

blazing ocean
#

The worldguard bukkit dependency

#

Just duplicate it and change bukkit to core

drifting bluff
#

in the pom file

blazing ocean
#

Yea

drifting bluff
blazing ocean
#

Yea

drifting bluff
#

now?

blazing ocean
#

Reload maven again and see if it worked

drifting bluff
#

clicked on reload and noting happens

#

this too?

chrome beacon
#

Could always try invalidating caches

drifting bluff
#

what

#

is this nomral

blazing ocean
#

Yes

#

You can just ignore it I believe

drifting bluff
#

yea if i click reload it doesnt work and it still same in my code

blazing ocean
#

Have you actually imported the classes?

drifting bluff
blazing ocean
#

And you're unable to import the other ones?

drifting bluff
foggy cave
#

Hey guys, how can I fully disable durability on my server, I want nothing to take damage, is there a way to do this?

drifting bluff
#

maybe there is like a tool change durablity event

#

and then cancel

foggy cave
#

Thanks!

drifting bluff
#

np

#

this is on my onEnable function and i got another file and in there i wanna look at the state of the config, how do i do that and why does it doesnt reognice the config thing and if i want to import it it just doesnt show stuff from worldguard

#

and wahts wrong here

#

@chrome beacon

chrome beacon
#

You don't have a variable called world

#

and no getConfig method in your commands class

#

I suggest taking a look at some Java tutorials before starting with Spigot

dawn flower
#

if the text is red in intellij idea, it always means that thing doesn't exist

#

either it's a variable or a method or a class (sometimes you just need to import the class)

drifting bluff
#

how do i set a variable to a world

dawn flower
#

World world = ...

drifting bluff
#

thx

dawn flower
#

np

#

what's the difference between getRealAddress and getAddress in PlayerLoginEvent?

drifting bluff
#

what should i do with the getRegiob

quiet ice
dawn flower
dawn flower
quiet ice
#

getAddress would probably ip-ban the proxy

dawn flower
#

ok

quiet ice
#

But lemme look

drifting bluff
#

*but lemme cook

#

🔥

#

why does it show wrong?

dawn flower
#

setFlag was expecting the generics T and V

drifting bluff
#

but i put the flag and true

quiet ice
#

Ah okay getAddress() is probably the one provided by the proxy - but could be spoofed by a malicious client (however that is performed).
Where as getRealAddress() is the ip address of the proxy

dawn flower
#

which isn't what it's expecting

dawn flower
drifting bluff
#

where

dawn flower
#

just type "Sta" and look if intellij autocompletes for u

#

if there is a State class try State.ALLOW or State.ALLOWED

drifting bluff
dawn flower
#

scroll down

drifting bluff
#

Thnaks

dawn flower
#

oh lmfao

#

i guessed that

#

how possiblei s it to change the address in PlayerLoginEvent

drifting bluff
#

why doesnt it find it? in the main on enable file it works?

dawn flower
#

you need an instance of the main class

#

also this is a crime

#

this is how to name varibales

drifting bluff
dawn flower
#

name it toggle

drifting bluff
#

wait so its not a problem if i got like a toggle variable in two files?

dawn flower
#

yeah

#

and also use some "private" in your variables

#

private String str = "This is private"
this means no other class can access it (or inheritors)
protected means only the classes in the same package can access it (or inheritors)
public means any class can access in

after these keywords you can add final or static or both
final means it can't be changed after getting declared
static means it belongs to the class, not the object

so public static String myStr = "Hello" can be accessed like this MyClass.myStr

if it wasn't static, i'd have to do new MyClass().myStr

tardy delta
#

🥺

dense falcon
#
public class InventoryListener implements Listener {

    private final Main NeoWorldPlugin;

    public InventoryListener(Main main) {
        NeoWorldPlugin = main;
    }

    @EventHandler
    public void onInventoryClose(InventoryCloseEvent event) {
        Inventory closedInventory = event.getInventory();
        Player player = (Player) event.getPlayer();

        if (closedInventory.getTitle().startsWith("§lInventaire de §b§l")) {
            Player target = Bukkit.getPlayer(closedInventory.getTitle().replace("§lInventaire de §b§l", "").trim());
            if (target != null) {
                Inventory targetInventory = target.getInventory();
                for (int i = 0; i < closedInventory.getSize(); i++) {
                    ItemStack item = closedInventory.getItem(i);
                    targetInventory.setItem(i, item);
                }
            }
        }
    }
}
``` Hello, I would like to know how may I do this when I place an item in the inventory created with my command, to summarize I try to make a command that allows to open the inventory of a player and I would like to make sure that when I place an item in this inventory created which represents the inventory of the player, this updates the inventory of the targeted player.
tardy delta
#

player.openInventory(target.getInventory())

dense falcon
dawn flower
#

iirc u need to add a delay before reopening it

#

or it goes crazy

chrome beacon
dense falcon
chrome beacon
#

Keep track of the inventory instance

dense falcon
#
package fr.program.neoworld.Utils;

import org.bukkit.command.Command;
import org.bukkit.command.CommandExecutor;
import org.bukkit.command.CommandSender;

import java.util.Arrays;

public class SimpleCommand extends Command {
    private final CommandExecutor executor;

    public SimpleCommand(String name, String description, CommandExecutor executor, String permision, String... aliases) {
        super(name, description, "", Arrays.asList(aliases));
        this.setPermission(permision);
        this.executor = executor;
    }

    @Override
    public boolean execute(CommandSender commandSender, String s, String[] strings) {
        if (commandSender.hasPermission(this.getPermission())) {
            return executor.onCommand(commandSender, this, s, strings);
        }
        return executor.onCommand(commandSender, this, s, strings);
    }
}
``` Btw, just what can I return if the player has not the permission given to create the command ? 🤔
dawn flower
#

pls set the permission in plugin.yml

dense falcon
#

More useful to have all in one thing: Java.

dawn flower
#

so it doesn't show in tab completions if you don't have the permissions

tardy delta
mortal sigil
#

Hi, anyone wanna be developer on an Minecraft server?

TeamFun is searching for developers if anyone is interested please DM me you will get developer role on my server if you are accepted

dense falcon
#

I need a value.

dawn flower
#

wrong server actually

mortal sigil
#

What’s the good 1?

tardy delta
#

returning false means printing the help message, true doesnt

dawn flower
#

?services

undone axleBOT
dawn flower
#

aint no way i guessed the command

#

im so good at guessing

dense falcon
#

Ah yeah I'm stupid.

#

My bad did not notice the return type, sorry.

tardy delta
#

couldve looked at the docs

#

?jd-s

undone axleBOT
drifting bluff
#

how do i create a config.yml and write useWorldguard: true in it and then read it in another file

tardy delta
#
BukkitWiki

The Configuration API is a set of tools to help developers quickly parse and emit configuration files that are human readable and editable. Despite the name, the API can easily be used to store plugin data in addition to plugin configuration. Presently only YAML configurations can be used. The API however was designed to be extensible and allow ...

dawn flower
copper coyote
#

Hey, im using kotlin reflect to recursively go through all the packages under a certain package, it works when i use a test, but once i load it into a plugin it fails to find any of them, any ideas?

drifting bluff
#

what 😭

tardy delta
#

JavaPlugin::getConfig()

chrome beacon
#

^^

dawn flower
#
@Override
public boolean equals(Object object) {
    if (this == object) return true;
    if (object == null || getClass() != object.getClass()) return false;
    Punishment punishment = (Punishment) object;

    boolean punishmentNoPlayer = punishment.getPlayer() == null;
    boolean thisNoPlayer = this.player == null;
    boolean punishmentNoIp = punishment.getIp() == null;
    boolean thisNoIp = this.ip == null;

    if (punishmentNoPlayer != thisNoPlayer) return false;
    if (punishmentNoIp != thisNoIp) return false;

    return punishment.getPlayer().getUniqueId().equals(this.player) &&
        punishment.getType() == this.type && punishment.getIp().equals(this.ip);
}```
is tehre a better way to do this
copper coyote
# humble tulip Code?
object ReflectionUtils {
    fun getAllClasses(packageName: String): List<KClass<*>> {
        val loader = javaClass.classLoader
        val classes = mutableListOf<KClass<*>>()
        explorePackage(packageName, loader, classes)
        return classes
    }

    private fun explorePackage(packageName: String, loader: ClassLoader, classes: MutableList<KClass<*>>) {
        val resourcePath = packageName.replace(".", "/")
        val resourceStream = loader.getResourceAsStream(resourcePath)

        resourceStream?.let { stream ->
            stream.bufferedReader().use { reader ->
                reader.readLines().forEach { line ->
                    if (line.endsWith(".class")) {
                        try {
                            val className = "$packageName.${line.removeSuffix(".class")}"
                            classes.add(Class.forName(className).kotlin)
                        } catch (e: ClassNotFoundException) {
                            println("Failed to load class: $line")
                        }
                    } else if (!line.contains(".")) {
                        explorePackage("$packageName.$line", loader, classes)
                    }
                }
            }
        }
    }

    fun loadClasses(packageName: String): List<KClass<out Any>> {
        return getAllClasses(packageName)
    }
}
tardy delta
#

dont create extra variables

tardy delta
copper coyote
copper coyote
#

i can use the method on the base command package to get them all

brittle geyser
#

val spigot = "1.20.4-R0.1-SNAPSHOT:remapped-mojang"
What repository has "org.spigotmc:spigot:$spigot" library?

copper coyote
#

in the current case im using it for items

tardy delta
#

i find it a flaw..

remote swallow
drifting bluff
brittle geyser
#

I need without build tools to run github actions

chrome beacon
#

no

#

Get gh actions to run BuildTools

brittle geyser
#

it took too long time

tardy delta
#

why doing all this effort when you can just register all things yourself

#

also makes code more clear

#

but whatever

copper coyote
remote swallow
undone axleBOT
drifting bluff
chrome beacon
#

pass plugin instance through the constructor

#

so you can use it to access the config

drifting bluff
#

how

chrome beacon
#

That guide shows you how

drifting bluff
#

ik but i dont understand

chrome beacon
#

what part are you having troubles with

drifting bluff
#

everything

chrome beacon
#

try to be more specific

drifting bluff
#

like i dont understand anything on the page

chrome beacon
#

Did you read it

dawn flower
#

ip = InetAddress.getByName(args[0]); how do i make this match the ip exactly? so if args[0] is for example 1 it doesn't parse it as 0.0.0.1