#help-development

1 messages · Page 2169 of 1

misty current
#

use the getAttribute method

#

put as an argument what you want to edit

#

then use setBaseValue

distant basin
#
public class Command implements CommandExecutor {
    @Override
    public boolean onCommand(CommandSender sender, org.bukkit.command.Command command, String label, String[] args) {}

error: Not annotated parameter overrides @NotNull parameter

tardy delta
#

put notnulls in front of the parameters

#

and its just a warning not an error

#

you can ignore it if you want

misty current
#

you can ignore it

distant basin
# tardy delta and its just a warning not an error

if i running server

[06:17:07 ERROR]: Error occurred while enabling XCrasher v1.0-SNAPSHOT (Is it up to date?)
java.lang.NullPointerException: null
        at java.util.Objects.requireNonNull(Objects.java:208) ~[?:?]
        at me.blacksnowdot.xcrasher.XCrasher.onEnable(XCrasher.java:13) ~[xCrasher-1.0-SNAPSHOT.jar:?]
        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[pufferfish-api-1.18.2-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:370) ~[pufferfish-api-1.18.2-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:541) ~[pufferfish-api-1.18.2-R0.1-SNAPSHOT.jar:?]
        at org.bukkit.craftbukkit.v1_18_R2.CraftServer.enablePlugin(CraftServer.java:560) ~[pufferfish-1.18.2.jar:git-Pufferfish-68]
        at org.bukkit.craftbukkit.v1_18_R2.CraftServer.enablePlugins(CraftServer.java:474) ~[pufferfish-1.18.2.jar:git-Pufferfish-68]
        at net.minecraft.server.MinecraftServer.loadWorld0(MinecraftServer.java:666) ~[pufferfish-1.18.2.jar:git-Pufferfish-68]
        at net.minecraft.server.MinecraftServer.loadLevel(MinecraftServer.java:433) ~[pufferfish-1.18.2.jar:git-Pufferfish-68]
        at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:318) ~[pufferfish-1.18.2.jar:git-Pufferfish-68]
        at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1165) ~[pufferfish-1.18.2.jar:git-Pufferfish-68]
        at net.minecraft.server.MinecraftServer.lambda$spin$1(MinecraftServer.java:317) ~[pufferfish-1.18.2.jar:git-Pufferfish-68]
        at java.lang.Thread.run(Thread.java:833) ~[?:?]

show me this error

misty current
#

thats for another reason...

#

whats line 13 of the Crasher class

#

that im guessing is your main class

tardy delta
#

the Crasher class crasher the server

#

makes sense

distant basin
tardy delta
#

register your command

#

in plugin.yml

misty current
#

^

fallow violet
#

^

tardy delta
#

ha ninjad you

misty current
#

and remove the requirenonnull

#

its useless

distant basin
#

um ok

misty current
#

because if you actually register the command that will be useless

tardy delta
#

or put a @SupressWarnings("ConstantConditions")

harsh totem
distant basin
#
        getCommand("crash").setExecutor(new Command());

its ok?

harsh totem
#

Yes

misty current
#

yes and now register the command

#

in plugin.yml

distant basin
#

kk

humble tulip
#

Why do we have to put commands in the plugin.yml?

#

Like it seems stupid

misty current
#

compatibility

humble tulip
#

With?

misty current
#

i don't like it either tho

#

other plugins

humble tulip
#

But you register it by doing JavaPlugin#getCommand

#

So it'll still be /pluginname:command

tardy delta
#

so the server will register them instead of you having to extends Command for all your command classes and forget to put things

misty current
#

i'm not sure of the exact reason

#

but i don't like how it works either

misty current
#

indeed i coded a commandapi that fits my needs

distant basin
#

tnx fixed

humble tulip
#

Because so many people forget to out it in the plugin.yml

crisp steeple
#

petition for a ?objectsrequirenonnull command that links to oracle docs

#

half the people here use it wrong

tardy delta
#

well there are command frameworks that do the stuff for you lol

misty current
humble tulip
#

It'll be so much easier to extend command and have a constructor that requires the command

misty current
#

and when you don't know java

tardy delta
#

no more questioning about why to register the commands

misty current
#

you do everything the ide tells you

humble tulip
misty current
tardy delta
misty current
#

thats not really something the ide tells you

#

rather the VM

misty current
humble tulip
tardy delta
#

i've had exceptions in my ide lol

misty current
#

lol

tardy delta
#

some plugin afaik

misty current
tardy delta
#

ssh

#

dont waste the moment that the ide asks a cold beer

misty current
#

it took more than a week but it works very well

tardy delta
#

acf is fun

#

is it called like that idk actually

misty current
#

i might release it one day

#

but it needs some things added and i am lazy

humble tulip
drowsy pawn
#

can help my

#

Enabled plugin with unregistered PluginClassLoader

tardy delta
#

?

misty current
#

because there was some if else garbage from 6 months ago i wanted to change

#

a small pyramid of doom

hollow glacier
#

Hello, i search an plug-in for restart my Minecraft server when his RAM is 80% of her utilisation, if you know an plug-in to do that please contact me. (mention or private message)

hollow glacier
#

Ok sorry

tardy delta
#

restaring your server every day sounds better

crimson scarab
#
public class ArmourUtil {

    public static boolean isLeather(ItemStack piece) {
        return piece.getType().name().contains("leather");
    }

}

is this fine?

tender shard
#

no

#

enum names are UPPER_CASE

maiden vapor
tender shard
#

just do name().endsWith("_LEATHER")

#

also I'd use a Set<Material> for this

#

erm

#

I meant startsWith

#

yes

#

mb

crimson scarab
#

is startswith case sensitive?

tender shard
#

yes

crimson scarab
#

gotcha

tender shard
#

I'd do it like this


    private static final Set<Material> LEATHER_ARMOR = new HashSet<>();
    
    static {
        for (Material value : Material.values()) {
            if(value.name().startsWith("LEATHER_")) LEATHER_ARMOR.add(value);
        }
    }
    
    public static boolean isLeather(Material material) {
        return LEATHER_ARMOR.contains(material);
    }
tardy delta
#

.

crimson scarab
#

what does assert do?

tender shard
#

it throws an AssertionException when the expression isn't true

#
String myString = "asd";
assert myString.equals("asd") : "This should have never happened!";
tardy delta
#

yesterday someone told that it doesnt do anything

tender shard
#

bullshit

tardy delta
#

or do you have to enable it in the jvm args?

#

--ae or smth

#

i thought so

crimson scarab
eternal oxide
#

assert is for debug. Normally does nothing at runtime

tardy delta
#

ah

tender shard
#

but yeah it's mainly used in unit tests etc

#

in normal plugin code or whatever you would probably never use it

lost matrix
eternal oxide
#

I don't either

ivory sleet
#

Ye used to be the case

thorny dawn
#
    fun createWorld(world: World?): String {
        val worldDir: File = world.worldFolder
        var worldName = "mbwr_" + Math.random() * 1000
        while (true) {
            Thread.sleep(500)
            if(Bukkit.getWorld(worldName) != null) {
                break;
            } else {
                worldName = "mbwr_" + Math.random() * 1000
            }
        }
        FileUtil.copy(worldDir, File(worldDir.parent, worldName))

        val creator: WorldCreator = WorldCreator(worldName)
        val newWorld: World? = Bukkit.createWorld(creator)
        return worldName;
    }

Getting error:
Only safe (?.) or non-null asserted (!!.) calls are allowed on a nullable receiver of type World?

#

see line 2 on world.worldFolder

naive bolt
#

do i have to fork bungeecord to change the internal messages / languge file

ivory sleet
#

createWorld takes World?

lost matrix
ivory sleet
#

Perhaps File? is also an alternative here

#

Assuming you wanna keep chaining the possibility of absence

lost matrix
#

"on a nullable receiver of type World?"

minor fox
lost matrix
thorny dawn
naive bolt
ivory sleet
#

Yes but since the world parameter itself might point to null

minor fox
#

Nope, just replace the file

ivory sleet
#

You could address it by either asserting, or mapping the null type or flat mapping it

thorny dawn
lost matrix
#

Also this fun is a bit weird because why would you create a world and pass an already created world to it??

lost matrix
ivory sleet
#

Perhaps assert that the world is already non null before passing it into that function kostiskat?

thorny dawn
#

alright wait

left swift
#

How can I use system.getenv in gradle? I mean from where it gets the info

lost matrix
#

I would rather do something like

Bukkit.getWorld()?.let{ createWorld(it) }

and define createWorld as

 fun createWorld(world: World): String {
tardy delta
#

kotlin looks cursed tbh

ivory sleet
#

How dare you

tardy delta
#

👉👈😭

ivory sleet
tender shard
#

but at least every method in kotlin is fun

#

such a funny language

left swift
ivory sleet
#

Lol

tardy delta
#

i've never seen something like ?.let{ createWorld() } in my whole life

ivory sleet
#

Optional::ifPresent tho

thorny dawn
tardy delta
#

optionals kinda suck in java

#

in rust they are chill

ivory sleet
#

It does sure

lost matrix
# tardy delta kotlin looks cursed tbh

It gets really cursed if you add stuff like infix functions.

    init {
        super.effects.add(FlameDamageEffect())
        super.effects.add(IgniteEffect() onlyWhen { ChanceRoll of 0.2 isSuccessful })
    }
ivory sleet
#

But that’s the kotlin equivalent

thorny dawn
#

nevermind im stupid

tardy delta
#

oh no no

ivory sleet
#

Altho kotlin nonnull types can be expressed in terms of nullable types so that’s nice

tardy delta
#

?. in java would be a good thing i guess

ivory sleet
#

We have ?. in Java

#

Using Optional tho

#

It’s basically Optional::map or flatMap or ifPresent

lost matrix
# tardy delta ?. in java would be a good thing i guess

There is a coding style where you only use Optionals inside your service.
And you never unwrap anything. When you get external values you wrap them
and if you send them then you unwrap then again. Internally everything is optional.

crimson scarab
#

is it possible using attribute modifers to increase the max health of the player while an armour piece is worn

lost matrix
tender shard
ivory sleet
#

In kotlin they basically embedded that style into the language

tender shard
#

scnr

tardy delta
#

in rust its just

let optional: Option<u32> = Some(6);
match optional {
  Some(x) => prinln!("it is present")
  None => println!("nawww")
}``` which makes it more fun in my eyes
ivory sleet
#

Ye

quaint mantle
#

package net.minecraft.server.v1_8_R3 does not exist

#

how do I fix dis error?

ivory sleet
#

🌚

lost matrix
tardy delta
#

or just doing

if let Some(x) = optional {
  println!("we got em")
}```
#

long time since i used it lol

quaint mantle
tardy delta
#

its not cuz it works that you should use it

lost matrix
quaint mantle
#

like?

lost matrix
#

Which dependency manager do you use?

quaint mantle
#

maven

#

do u mean this?

tender shard
#

wrong quote

#

I always quote the wrong messsages

#

no idea why

lost matrix
#

Then

  1. Run BuildTools
  2. Add the spigot dependecy but instead of spigot-api you use spigot (artifactId)
    @quaint mantle
quaint mantle
#

<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.8.8-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>

#

ah

tardy delta
#

1.8.8

#

that scares me

quaint mantle
#

sush

lost matrix
#

i

crisp steeple
ivory sleet
#

I mean they’re pretty much equivalent

tardy delta
#

only if java was nullsafe

ivory sleet
#

Optional 🌚

#

@NotNull aPES_LulExplode

tardy delta
#

lmao

#

the combination of @NotNull and Validate.notnull scares me to death

ivory sleet
#

Lol yeah

tender shard
#

@NonNull is basically the same but it automatically adds Validate.notNull or something similar

tardy delta
#

ooh does it

ivory sleet
#

Yeah if you tell IntelliJ to

tender shard
#

but yeah I get it, you all hate the red pepperoni

ivory sleet
#

Or if you use Lombok

tender shard
#

yeah lombok

tardy delta
#

lombok @Cleanup aaaa

#

i thought that was an ij annotation

#

:(

ivory sleet
crisp steeple
tardy delta
#

i'd love that

tender shard
#

returning a void?

tardy delta
#

lmao?

ivory sleet
#

I mean returnable void doesn’t really work in Java sadly idk maybe it works in kotlin with inline functions?

tardy delta
#

i always wondered why you simply couldnt return a void

#

not actually returning it but you know what i mean

tender shard
vocal cloud
#

You can with return;

tardy delta
vocal cloud
#

return; in a void method returns void

crisp steeple
#

and unit is just a singleton object

ivory sleet
#

But it’s really useless tho

tardy delta
#

conclure someone waiting for you

#

#general

crimson scarab
#

is there a better way to do this

        if (meta.getLore() != null) {
            ArrayList<String> lore = (ArrayList<String>) meta.getLore();
        } else {
            ArrayList<String> lore = new ArrayList<String>();
        }
crisp steeple
ivory sleet
#

shrug ye guess its preference

tender shard
tender shard
tardy delta
#

i dont like how it looks

tender shard
#

the only thing where I don't use brackets is for stuff like

if(event.getClickedBlock() == null) return;
tardy delta
#

there was a time i coded like
if ... then....
else ...

crimson scarab
#

can the color tag of leather armour be removed or is it client side

ivory sleet
tender shard
ivory sleet
#

Yep, tho I always add curly brackets to solidify the scopes

lost matrix
#

In kt not anymore because this line would be

val block = event.clickedBlock ?: return

But in java i do

quaint mantle
ivory sleet
#

Sup

lost matrix
tender shard
# lost matrix I even add brackets to safeguard statements.

hm yeah I only do that when I add overly verbose debug stuff lol

        if (event.getClickedInventory() == null) {
            main.debug("Return: getClicked Inv is null");
            return;
        }
        if (!(event.getClickedInventory().getHolder() instanceof GUIHolder)) {
            main.debug("Return: clicked inventory is no GUIHolder");
            return;
        }
        final GUIHolder guiHolder = (GUIHolder) event.getClickedInventory().getHolder();
        if (guiHolder.getContext() != GUIContext.PREVIEW_MENU) {
            main.debug("Return: GUICOntext is not PREVIEW");
            return;
        }
lost matrix
#

Code "should be open for extension, but closed for modification"

tardy delta
tender shard
#

one also shouldnt do that

tardy delta
#

i normally put all my code in my gui class

tender shard
#

normally you shouldnt implement inventoryholder

#

but I didn't know that 4 years ago lol

tardy delta
#

i do it for comparing my inventories

#

so i dont have to store them in a map or smth

tender shard
#

my invholder simply saves some information about the context of the gui that was open so I can check it in the inventoryclickevent

tall dragon
#

wow thats actually really smart

#

ive never thought of doing it that way

quaint mantle
#

alex is here

tender shard
#

yeah but as said one shouldn't implement inventoryholder :/

quaint mantle
#

alex is like a german handyman

tender shard
#

so meanwhile I just add my context as PDC to the clicked item when I create the GUI

#

then I can just do something like

  1. get the clicked item's PDC
  2. does it have a PDC tag of DataType GUIContext?
  3. If yes, I know what to do next lol
dusk flicker
#

mine is similar to that

tender shard
#

if no, it's just a placeholder item or similar

#

I wish I could find a way to store runnables inside a PDC lol

dusk flicker
#

lol

#

just out all code to strings ez

tender shard
#

yes and then compile it lol

#

but tbh one could just create a Map<Long,Runnable> and save the ID on the PDC

granite owl
#

i wish i could write pdc data to inventory interfaces xD

tender shard
granite owl
#

at least that would make them persistent beyond reloads

#

unlike putting them in wrappers

tender shard
#

it's always annoying to have to write cooldown logic everytime so I just put into a library class

dusk flicker
#

yeah

#

I feel like cooldowns are always a bitch

granite owl
#

cooldowns of items?

tender shard
#

of whatever

granite owl
#

multithreads?

tender shard
#

items, commands, ...

granite owl
#

well i manage item cooldowns

#

by putting the material on cooldown

#

xD

#

its client sided mainly

#

but eh

kindred valley
#

how can i get a players permission

tender shard
#

could also be used for events e.g.

private Cooldown attackCooldown = new Cooldown();

and then in EntityDamageByEntityEvent, if the attacker is in cooldown, cancel the event

#

so yeah it can be used for everything

#

it accepts "object" as "cooldown subject"

river oracle
granite owl
#

🤔

tardy delta
#

mine was a little simpler

fallow violet
tender shard
#

there's sth like Player#

#

getEffectivePermissions

dusk flicker
#

Bukkit has the builtin method for checking perms

fallow violet
dusk flicker
#

Adding a full lib for it is the more difficult one

tender shard
#

actually it's part of Permissible, not Player

tender shard
river oracle
tender shard
#

many big servers still use PermissionsEx or similar

tardy delta
#

luckperms api is still a pain too

fallow violet
dusk flicker
#

Are bukkit perms a bit of pain? yeah; but id rather deal with that than add a stupid requirement like luckperms to my resource

fallow violet
#

^

tender shard
fallow violet
#

bro dont

#

no

dusk flicker
#

If you are doing nothing but checking permissions, just use the Permissible methods

tender shard
fallow violet
fallow violet
#
  • deete streams *...
tardy delta
#

?

tardy delta
#

oh

sterile token
ivory sleet
#

@tardy delta

river oracle
#

?paste

undone axleBOT
ivory sleet
#

Id have the snapshots immutable

tall dragon
river oracle
#

anyone familiar with this error when trying to join my server I just added a resource pack requirement to one of my plugins I'm working on
https://paste.md-5.net/itefutugoy.md
This is a client sided error btw

ivory sleet
#

but idk if its an enhancement considering the cons ntl

tender shard
#

right now it returns a long that's based off the precision used

tardy delta
tender shard
#

e.g. if you set the cooldown to use nanoseconds, it returns the remaining nanoseconds

ivory sleet
#

hmm

tender shard
#

if you use seconds, it returns the amount of seconds

#

etc

ivory sleet
#

I can write you a full code review later

tall dragon
#

yh

ivory sleet
#

if you really want to lol

tardy delta
#

its my old plugin but i was thinking how to do it better

coarse shadow
#

for (EntityType entityType : EntityType.values()) {
if (entityType.getEntityClass().isAssignableFrom(Monster.class)) {

why does getEntityClass method return null in here

ivory sleet
#

oh right

tender shard
#

and that has null as class

#

just do if(type == EntityType.UNKNOWN) continue;

#

all other EntityTypes have a class assigned

coarse shadow
#

ah got it thx

#

why there is an entitytype called unknown tho

tall dragon
#

actually @tender shard how would you format time left into a nice string? i have done it and was wondering if there is a better way actually

tender shard
tall dragon
dusk flicker
#

stop

#

paste it please

#

spam

#

?paste

undone axleBOT
tardy delta
#

i used to make such a method

tall dragon
#

chilll

tardy delta
#

sucks

tender shard
# tall dragon https://paste.md-5.net/xusajahopo.java this is how i do it

hm I checked the wrong plugin. In this I only have this

    public String getTimeLeftFromMinutes(double minutes) {
        return getTimeLeftFromSeconds((int) (minutes * 60));
    }

    public String getTimeLeftFromSeconds(int seconds) {
        return String.format("%02d:%02d:%02d", seconds / 3600, (seconds % 3600) / 60, (seconds % 60));
    }

Let me look for the other plugin that does it properly (it says stuff like 2 hours 3 minutes, then when it's less than an hour, it says 50 minutes 23 seconds, etc

#

if only I could remember the plugin name

tall dragon
#

yh thats what mine currently does too

tardy delta
#

lemme save that lol

tender shard
#

?paste

undone axleBOT
tender shard
#

not very nice

#

but also not completely shit

tall dragon
#

ahh i see

#

think il prefer what i did over this though 😄

tender shard
tall dragon
#

ahh yea thats fair

tender shard
#

it was an "advancement speedrun" plugin where people could win prizes like plugins and other stuff by basically being the first one to win certain advancements from some datapack

tall dragon
tardy delta
#

nah the one alex sent

#

looks fancy

tall dragon
#

ah was about to say i could also send you a method to parse the output of formatTimeShort() if you wanted.

tender shard
#

more like a timer how a microwave would show it lol

tardy delta
#

ah..

tender shard
#

or 01:12:17 for one hour, 12 minutes, 17 seconds so yeah perfect for a microwave but not so much if it should look fancy lol

tardy delta
#

this was mine

tall dragon
#

yh and mine would output "1 hour 12 minutes 17 seconds" for that

tardy delta
#

1 hours still

tender shard
#

there should be a lib for this

#

e.g. with an option to show only "1 hour 12 minutes" and only show the seconds when it's less than one hour

tardy delta
#

bruh im so stupid

tall dragon
#

how come

tardy delta
#

i was wondering why my database file wasnt generated but i forgot the datafolder didnt exist

#

i was creating it afterwards

tall dragon
tardy delta
#

uh still

#

saveDefaultConfig does the thing no?

tall dragon
#

uhhh honestly woulnt be able to tell you

#

havent used that in like 5 years

tardy delta
#

bruhh

#

did the same thing

severe folio
#

yeah it calls saveResource

tardy delta
#

😂

#

i just moved it a little higher

#

its still not generated aaaaaaaaaa

#

my file explorer seems to be broken

humble tulip
#

@tall dragon i have a method

#

:)

tall dragon
#

is it better? 🙂

humble tulip
#

It doesn't say 1 hours

#

It'll say 1 hour

tardy delta
#

stuff is kinda broken

humble tulip
#

What is?

tardy delta
tall dragon
humble tulip
#

Fourteenbrush why dont u cache online player data

#

Maybe u do and just return it as a future

#

Can't tell from your ocde tbh

sterile token
#

What its the method when complete?

thorny dawn
#
    fun createWorld(world: World): String {
        val worldDir: File = world.worldFolder
        var worldName = "mbwr_" + Math.random() * 1000
        while (true) {
            Thread.sleep(500)
            if(Bukkit.getWorld(worldName) != null) {
                break;
            } else {
                worldName = "mbwr_" + Math.random() * 1000
            }
        }
        send(worldName)
        Thread.sleep(5000)
        FileUtil.copy(worldDir, File(worldDir.parent, worldName))

        val creator: WorldCreator = WorldCreator(worldName)
        val newWorld: World? = Bukkit.createWorld(creator)
        return worldName;
    }

is this how you properly make a world copying function?

coarse shadow
#

isnt there already a copy world method in bukkit

thorny dawn
#

there is?

tardy delta
#

hmm my database seems to return nothing even when i just inserted it

coarse shadow
#

nah nvm u can copy worldcreator not the world itself

tardy delta
#

why are you blocking the thread?

thorny dawn
#

hm?

sterile token
#

Fourteen what its your whenComplete method?

coarse shadow
#

when i do this it does not add the defaults to the config file

tardy delta
#

i only seem to get 'Got home: null' lol

#

meaning there was no exception

#

dont think thats theres anything wrong with this

sterile token
tardy delta
#

ye

sterile token
#

I want to do something like that for redis

#

Because its really annoying sending and receiving string with redis

distant basin
#
Class<?> Vec3D = Class.forName("net.minecraft.server." + serverVersion + ".Vec3D");
[09:01:07 WARN]: java.lang.ClassNotFoundException: net.minecraft.server.v1_18_R2.Vec3D
sterile token
#

Oh you are using it for multi mc versión right

distant basin
# sterile token Why using relefction for that ?
onstructor<?> vec3DConstructor = Vec3D.getConstructor(double.class, double.class, double.class);
                    Object vec3d = vec3DConstructor.newInstance(
                            d(), d(), d());

                    // PacketPlayOutExplosion with fat arguments
                    Class<?> PacketPlayOutExplosion = Class.forName("net.minecraft.server." + serverVersion + ".PacketPlayOutExplosion");
                    Constructor<?> playOutConstructor = PacketPlayOutExplosion.getConstructor(
                            double.class, double.class, double.class, float.class, List.class, Vec3D);
                    Object explosionPacket = playOutConstructor.newInstance(
                            d(), d(), d(), f(), Collections.emptyList(), vec3d);

                    sendPacket(victim, explosionPacket);
distant basin
sterile token
#

Why are you using reflection?

tender shard
#

1.17+ doesn't have the NMS version in the package name

river oyster
#

I want to modify EntityZombieHusk but It seems like to modify, I have to touch minecraft-server.jar not spigot bukkit(Spigot don't have EntityZombieHusk class).
But I have no idea what minecraft-server.jar is.
How can I modify minecraft-server and build?

tender shard
sterile token
#

I dont know why the heck spigot doesnt use and standard for everything, java versión, package id, etc

ivory sleet
#

Everything?

chrome beacon
#

Or just update dead versions?

lethal python
#

how do you check if an entity right click event didn't also open an inventory

#

i mean

#

playerinteractevent

#

if a playerinteractevent didn't open an inventory like chest or furnace

worldly ingot
#

You can't, really, unless you check if the block clicked is an inventory holder. Though that's only a rough estimate

#

if (block.getState() instanceof InventoryHolder) { }

lethal python
#

how is that rough that sounds precise

tender shard
#

yeah for example a villager can only have one viewer IIRC

lethal python
#

if i check im not shift clicking

worldly ingot
#

There may be situations where right clicking a block doesn't open an inventory

lethal python
#

uhh

tender shard
#

so it could be a right-click villager event but another player also has that inv open so nothing would happen

worldly ingot
#

Then yeah, villagers as well

lethal python
#

i can't think of one

worldly ingot
#

Crafting tables also aren't inventory holders

#

Their UIs are client-sided

lethal python
#

i just mean block

#

o

#

client side

#

can i cancel the event

tender shard
#

or a chest could be obstructed

chrome beacon
#

Cat

worldly ingot
#

I always forget cats obstruct chests lol

tender shard
#

oh yeah lol

#

cats are awesome

sterile token
#

Any of you know a plugin that use redis but with a Packet system for sending and receiving? I have chexked tousans open source plugin with redis and didnt find anything

chrome beacon
#

You could just take a look at a redis tutorial

#

It doesn't have to be a Spigot plugin

worldly ingot
#

I made one a short while ago but it's all proprietary for the company I was working for 😅

#

It's not overly complicated though. So long as your Redis pub/sub messages are prefixed with an integer id, you can map to your packet classes that are registered somewhere (in a Map or whatever)

worldly ingot
#

Map<Integer, Supplier<? extends YourPacketInterface>> and a Map<Class<? extends YourPacketInterface, Integer> and you're set

sterile token
#

Conclure do you have a tuto or its open source?

worldly ingot
#

Or make that Supplier a Function<InputBufferThingWhereYouReadData, YourPacketInterface> if you'd rather that

sterile token
#

Thst what I dont know

ivory sleet
worldly ingot
#

The first thing you write to the message would be the numerical id of the packet

lethal python
#

im doing event.setCancelled(true) on a PlayerInteractEvent where they throw a snowball, but it's not cancelling the snowball throw

ivory sleet
#

(In common module)

thorny dawn
#
    fun createWorld(): String {
        val worldname = "testworld"
        val worldcreator: WorldCreator = WorldCreator(worldname)
        val world: World? = worldcreator.createWorld()!!
        world?.worldBorder?.setCenter(0.0,0.0)
        world?.worldBorder?.size = 100.0
        return worldname;
    }

this isnt creating a world, any ideas?

worldly ingot
#

Then any data that follows it would be the data in the packet

sterile token
#

Chocó

tender shard
#

Chocö

sterile token
#

Its my translator

#

Im spanish

tender shard
#

mine too, i'm german

lethal python
#

hello

tardy delta
kindred valley
#

i cant add dependencies can anybody help me?

tardy delta
#

im sorry i really had to

chrome beacon
kindred valley
#
<dependency>
        <groupId>net.luckperms</groupId>
        <artifactId>api</artifactId>
        <version>5.4</version>
        <scope>provided</scope>
    </dependency>
chrome beacon
#

So maven

kindred valley
#

yes

chrome beacon
#

And what's the problem

tardy delta
#

did you reload your project?

kindred valley
crimson scarab
#

i want to make any negative effects not work on my player can this be done in a single event (potion splashes, tipped arrows)

tender shard
#

lol

lethal python
#

im doing event.setCancelled(true) on a PlayerInteractEvent where they throw a snowball, but it's not cancelling the snowball throw

crimson scarab
#

try projectile launch event @lethal python

tardy delta
#

if you make changes to your pom theres some icon that you have to click for them to take effect

lethal python
granite owl
#

if i use this cb ```java
@Override
public List<String> onTabComplete(CommandSender sender, Command cmd, String commandLabel, String[] args)
{
if (sender instanceof Player)
{
switch (cmd.getName().toLowerCase())
{
case "debugmenu":
return DebugMenuCommand.tabComplete(sender, args);
case "updateitem":
return UpdateItemCommand.tabComplete(sender, args);
}
}

    return Collections.emptyList();
}
kindred valley
granite owl
#

interface*

tardy delta
#

oh thats looks pain

granite owl
#

oh im not actually extending the superclass BukkitCommand

#

in the commands

lethal python
#

guys what items display a "use" animation when you right click them on anything

granite owl
#

i only do that for vanilla commands i override

lethal python
#

snowballs do because you're throwing them

#

and fire charges and flint and steel but they set fire

granite owl
chrome beacon
tardy delta
#

ye java 16

granite owl
#

whats those -> doing xD

tardy delta
#

just the same as switch cases

lethal python
tardy delta
#

i love the new syntax

chrome beacon
granite owl
tardy delta
#

ye

ivory sleet
#

It’s a switch expression

tender shard
lethal python
granite owl
#

kk

ivory sleet
#

Looks like lambdas but they aren’t

chrome beacon
lethal python
#

omgomgomg

#

you can do that

#

thank you so much guys

tender shard
#

you can use it for every LivingEntity but most probably won't show any animation

granite owl
#

kk ty so just a different way to express switch syntax haha

sterile token
granite owl
#

thats where i know these arrows from xD

ivory sleet
#

Yeah I use MessageCenter::send for that

granite owl
#
//Export for Java as .dll && .so
extern "C"
{
    JNIEXPORT jlong JNICALL Java_IniReader_initPtr(JNIEnv* env, jclass cls) { return reinterpret_cast<std::uintptr_t>(new IniReader()); }
    JNIEXPORT void JNICALL Java_IniReader_deletePtr(JNIEnv* env, jclass cls, jlong ptr) { delete (IniReader*)ptr; }
    JNIEXPORT jboolean JNICALL Java_IniReader_openFilePtr(JNIEnv* env, jclass cls, jlong ptr, jstring str) { return ((IniReader*)ptr)->openFile(env->GetStringUTFChars(str, 0)); }
}
#

so the new syntax being abit confusing

tender shard
#

best tutorial ever

granite owl
#

thats in german

sterile token
lethal python
quaint mantle
#

Verano are you italian?

sterile token
#

Im spanish

quaint mantle
#

spanish

#

thats very rare to see

sterile token
#

Specific from Uruguay

tender shard
#

Verano are you italian?

quaint mantle
#

teach us a word in spanish

tardy delta
#

ta madre

sterile token
#

Hola, como estas?

Hi, how are you?

tardy delta
#

vamos

#

padre

sterile token
#

Mom = mamá
Father = papá

tardy delta
#

ah

#

ssh

granite owl
sterile token
#

So for doing a redis packet system I will need a unique id per packet

#

And them how do i set the data from the packet?

#

That burning my brains

tender shard
ivory sleet
#

I turn the string to a byte array

kindred valley
#

why the fuck this happens

quaint mantle
#

we are learning languages on this server

ivory sleet
#

And just make the first read/write to be the id

quaint mantle
#

german, spanish, anything

sterile token
ivory sleet
#

Nah Jedis sucks

twilit roost
ivory sleet
#

Or well correction, it isn’t really that scalable compared to lettuce

crisp steeple
#

uh

ivory sleet
#

Hence why I distance myself from it

sterile token
#

What you use conclure?

granite owl
#

so if i use this java @Override public List<String> onTabComplete(CommandSender sender, Command cmd, String commandLabel, String[] args) { //... } should i ```java
public class main extends JavaPlugin implements Listener, TabCompleter
{
public List<String> onTabComplete(CommandSender sender, Command cmd, String commandLabel, String[] args)
{
//...
}
}

ivory sleet
#

Lettuce

#

Tho redisson is fine also

sterile token
#

Lettuce its a redis driver for Java right?

crisp steeple
#

i think i accidentally deleted a jdk yesterday when freeing up space and now intellij keeps crashing whenever i launch

#

wat to do

granite owl
#

reinstall the JDK?

buoyant viper
#

install a JDK

#

Eclipse Adoptium provides prebuilt OpenJDK binaries from a fully open source set of build scripts and infrastructure. Supported platforms include Linux, macOS, Windows, ARM, Solaris, and AIX.

crisp steeple
#

do i have to go through all the oracle bs

sterile token
#

Also how you can delete a jdk?

crisp steeple
#

ok cool

granite owl
#

breathe copium xD

ivory sleet
#

Lettuce is a redis client written in Java

crisp steeple
#

so i just deleted it

sacred mountain
#

oops

sterile token
ivory sleet
#

Anyway verano these two snippets from my LettuceMessenger.java are probably what you need to look at

sterile token
#

Conclure jedis sucks a lot

tardy delta
buoyant viper
#

my brother in christ im on windows idk

#

closest i got is scoop install -g openjdk-17

tardy delta
#

install apt on windows 😎

sterile token
#

I download jdk from github

#

@sterile token

#

@sterile token

#

Lol

ivory sleet
sterile token
#

Who tag me?

buoyant viper
#

I did.

quaint mantle
tardy delta
#

lol

#

we dont assume genders here

#

actually what am i saying

sterile token
#

@sterile token so using Lettuce its better than Jedis right?

quaint mantle
#

her bio says girl tho

ivory sleet
sterile token
#

Lol why the heck its tagging me self

ivory sleet
#

A ubiquitous answer

granite owl
#

u know what really hurt me? i watched a video where the guy like said "introverts are the only ones who can comprise of the .3% of truely superior developers, and extroverts like steve jobs use them to get filthy rich"... kinda true though i guess

sterile token
#

Conclure thanks I will read about lettuce

buoyant viper
#

true people have made fortunes off of my code

granite owl
#

i mean its not untrue

ivory sleet
tardy delta
#

i mean why is my database not working aaaaaa

granite owl
#

yea iknow but u get the idea

#

like

#

the ones who are truely upper standard dont really ever get to make the money for themselves

sterile token
#

Conclure my idea for my redis packet api is:

  1. Be able to register listeners for listening each packet

  2. Each packet contains any java data type

What do you think?

buoyant viper
granite owl
#

nowadays all u need is unity a 30minutes seminar on coding and some base knowledge in this tree structure thing that ppl use who dont understand basic syntax xD

buoyant viper
#

im like an unpaid intern

crisp steeple
#

does anyone know what do to with this

crisp steeple
#

intellij wont load any projects properly

buoyant viper
crisp steeple
#

aaaa

buoyant viper
#

probably wasnt a jdk issue at all then

kindred valley
#

i cant get netherite materials, its not showing up

granite owl
#

just install the JDK 17 and ur happy

kindred valley
granite owl
#

btw why did the BuildTool force me to use JDK 17 ?

sterile token
lost matrix
buoyant viper
crisp steeple
lost matrix
granite owl
#

i mean i honestly dont care to use the latest JDK, just sometimes oracles is charging money and sometimes they throw their copy after u

sterile token
kindred valley
golden turret
#

how can i check if the bukkitrunnable is already scheduled?

lost matrix
sterile token
#

Also with packets I wasnt talking about mc packets

ivory sleet
#

Especially if you just want to create let’s say an open source library

sterile token
#

Lettuce its free?

ivory sleet
#

Yes

sterile token
#

Allright thanks

tardy delta
#

yes 🥗 is free

ivory sleet
#

Not that I have done any benchmarks but from what I’ve heard both scale really good

sterile token
#

But jedis sucks a lot from what you told me

ivory sleet
#

Yes

lost matrix
#

The base Redisson version has practiacally everything besides some very specific featurs like local caches for certain data structures.

sterile token
#

I always used jedis I wont use it any more

ivory sleet
#

It wasn’t designed to be used concurrently

ivory sleet
sterile token
#

Conclure lettuce contains caching and pub sub

ivory sleet
#

Yes

sterile token
#

Sorry for being annoying I know I fuck a lot

kindred valley
#

wow

lost matrix
ivory sleet
#

Certain stuff you get access w/pro to seems to be way faster

crisp steeple
ivory sleet
#

I can’t tell for sure tho

#

I’ve only used the free one

tardy delta
kindred valley
#

?paste

undone axleBOT
ivory sleet
kindred valley
lost matrix
#

Yes they have remote cache commands where you send a minimal byte structure that executes a command that was called before remotely.
The default stuff is as fast as it gets when just sending redis commands like every other library.

ivory sleet
#

Hmm alright

golden turret
#

how can i check if a BukkitRunnable is scheduled? Im creating one by using new MyRunnableHere and i would like to cancel it, but when i do it without running .runTask it throws me an exception saying the runnable is not scheduled yet

tardy delta
#

BukkitRunnable#isCancelled

lost matrix
ivory sleet
#

>>> BukkitScheduler::isQueued <<<

golden turret
tardy delta
#

heh

golden turret
lost matrix
tardy delta
#

bruh i see what a bs

ivory sleet
golden turret
#

so i cant getTaskId

lost matrix
ivory sleet
#

Oh in that case go with the bool thing

#

Or yeah reconsider the design

golden turret
#

i have a game class

thorny dawn
#

do u guys know how i can delete an entire folder instead of the files in it?

golden turret
#

and there, i have some runnable fields like gameCountdownTask

#

when i initialize a new game object, the task is assigned to my other class

#

so

lost matrix
golden turret
#
private final MyRunnable runnable = new MyRunnable();
#

and then, i have a shutdown method

#

that cancels the runnable

tardy delta
#

i would store a boolean hasStarted

ivory sleet
#

Yeah as smile said, just go with a directory stream recursively and delete any files

golden turret
#

and the start methods makes the runnable to work

#

the start method

lost matrix
#

ugh

thorny dawn
tardy delta
#

do you really need that many runnables?

#

cant you just make one?

#

GameRunnable

golden turret
#

nop

tardy delta
#

or let your game class extend bukkitrunable

lost matrix
# golden turret nop

Yes that would be my suggestion as well.
All those runnables can be just methods that get called by one runnable.

ivory sleet
tardy delta
#

wrong quote hehe

lost matrix
#

I think kt has File#deleteRecursive() or something like that

quaint mantle
#

@tardy delta what plugin destroys all entities/animals/mobs?

golden turret
thorny dawn
golden turret
#

but i just remembered that i have a started boolean

heady spruce
#

KIt Sorting System

sterile token
#

Conclure its amazing you can use object directly while jedis doesnt support it

RedisClient client = RedisClient.create("redis://localhost"); StatefulRedisConnection<String, JsonObject> connection = client.connect(); RedisStringCommands sync = connection.sync();
JonObject json = sync.get("key");

#

Really thanks conclure if you didnt told me about lettuce I would be still using shity jedis

tall dragon
#

cries in jedis usage

tardy delta
#

JonObject

#

johnny johnny

kindred valley
tardy delta
#

BRUHHH

#

forgot to add statement.execute()

#

have been looking at it for an hour now

river oracle
#

Is there any proper way to shift text up and down in an inventory title? I've been using negatively spaced texture pack, but none of the characters shift up and down only left and right.

thorny dawn
#

@lost matrix my bad i had messed up some shit in pom while converting java to kotlin

#

the function shows up in intellisense now

quaint mantle
#

[ERROR] .... [Essentials] There's a good chance you're reloading your server right now. If that's the case, why do you hate yourself? Expect no support from the EssentialsX team when using /reload.
"Why do you hate yourself?"
Lol

#

that was funny of them

buoyant viper
buoyant viper
quaint mantle
tardy delta
#

or /restart but that has to be configured

buoyant viper
quaint mantle
tardy delta
#

reload is fine for testing purposes

buoyant viper
tardy delta
#

instructions unclear, self destructing

kindred valley
quaint mantle
#

Adelemphii wants pasta

tardy delta
#

i want food in general

quaint mantle
#

i actually bought pasta just today

#

also bits of coconut

#

but they arent as juicy and delicious as i expected

buoyant viper
tardy delta
#

give me some juicy coconut

buoyant viper
#

🥥

quaint mantle
buoyant viper
#

maybe maven is detecting bukkit 1.13 bc of vaults possible dependency on it and since its first it could be using that as the bukkit api instead of spigot-api idk

lost matrix
kindred valley
buoyant viper
#

did u hit the maven refresh button

tardy delta
#

ye hit it with da coconut

quaint mantle
#

coconuts arent as delicious as i expected

#

they sound exotic and juicy and stuff

#

but they are plain

tardy delta
#

they are good

kindred valley
quaint mantle
#

they are not good

#

i should have bought the watermelon instead

tardy delta
#

i dont like watermelon

#

too much water and seeds

buoyant viper
quaint mantle
tardy delta
#

lol

lost matrix
# kindred valley y

Just remove the old spigot version from your classpath. Shouldnt be too hard.

quaint mantle
#

should i make some pasta?

#

im not very hungry but its 19:36 already

kindred valley
quaint mantle
#

i hope i dont get banned for that

kindred valley
quaint mantle
#

its just a joke

#

@tardy delta i think im on the road to becoming a master minecraft coder

crimson scarab
#

hey guys this isn't a technical question but i told my brother to think of a armour set so we can fight with custom armours but he ain't coming up with any armour abilites or anything so can you just give me some ideas this is the head it is called dark warden:

quaint mantle
#

i cannot make interface objects
= new Tootoo
but i can make interface variables
Tootoo x;

sterile token
#

Hmn F :(

#

?jd-s OfflinePlayer

undone axleBOT
quaint mantle
#

just learned a bit more about instanceof

sterile token
kindred valley
sterile token
kindred valley
sterile token
#

Happen something similar to me but when using custom vars on proyect

sterile token
#

I used to do 200 kills perday on a non premium server

kindred valley
#

0w0

sterile token
#

Yeah i was really ill in that moment

#

But now i dont usually play mc because i code plugins

#

Its like when you code you dont play much

kindred valley
#

You have to make bedwars no play

sterile token
#

A bedwars plugin?

kindred valley
sterile token
#

Good idea but arent already some on spigot?

quaint mantle
#

Verano

sterile token
#

yeah?

quaint mantle
#

how many grams of pasta would be enough for a meal?

#

Because im not very hungry but i want to eat some food

#

cuz its the evening

#

i dont want to make too much pasta cuz i wont finish it

sterile token
#

I dont really know but it depend if you are alone and how angry you are

kindred valley
#

in any case

quaint mantle
#

that sounds a bit much doesnt it?

sterile token
#

Yeah i usually eat around 200gram if im not really hungry

quaint mantle
#

i think maybe i should prepare only 100 grams

sterile token
crimson terrace
#

damn are you all on diets?

#

just had 2 burgers and I'm still not full

sterile token
sterile token
quaint mantle
#

i can eat only small amounts of food

sterile token
#

I eat 1 burguer from burguer king and im literally full

quaint mantle
#

its not because i want to eat small amounts of food but my body is weak and cannot handle big amounts

crimson terrace
kindred valley
sterile token
#

Yeah atm i dont eat one since 1 month or more

crimson scarab
#

how would i go about making a weapon that bypasses 50% of the armour protection

sterile token
#

Ahh nothing i just catch it

crimson terrace
#

I usually tag the PDC of an itemStack and then it has special properties which I can code into a listener

crimson scarab
sterile token
#

You can use PDC for that

#

So them you can set a custom property to that item

crimson scarab
#

yep i get that

#

but bypassing only a small amount of armour protection

quaint mantle
#

i just realized this is not the general channel

#

i was here talking with people about coconuts and pasta

maiden vapor
muted sand
#

can I register commands / listeners AFTER the on_enable event?

eternal oxide
#

yes

warm saddle
#

hey so i am making a command that saves a players current location to a config file under the key "spawn-location". However when I run the command it says that it has done it however nothing changes in the config. Here is the code for it, any ideas would be great!

public static Plugin main = ParkourTag.getPlugin(ParkourTag.class);

    public static void SetPKTSpawn(Player p, String prefix) {

        Location location = p.getLocation();
        main.getConfig().set("spawn-location", location);

        p.sendMessage(prefix + "Set game spawn to your location!");
    }```
maiden vapor
#

You need to save the config

warm saddle
#

this is in an external command file separate from the main class

#

main.saveConfig();?

maiden vapor
#

Yeah

warm saddle
#

awesome i'll give it a go thank you :)

rough drift
#

I need to run a task async, I thought about doing:

Bukkit.getScheduler().scheduleAsyncRepeatingTask(this, () -> {

}, 0, 20);
```However it's deprecated, I can safely use it no? (It's for I/O, no bukkit api's involved)
eternal oxide
#

look for runtasks

#

there is a whole set of runs under teh scheduler

rough drift
#
Bukkit.getScheduler().runTaskTimerAsynchronously(this, () -> {

}, 0, 20);
```?
heady spruce
#

map doesnt contain itemstacks even i added them

crisp steeple
#

or bukkit runnable

kindred valley
#

hello, im trying to make a commands strings the specified colors by their name but i dont know how to make it by short way

sterile token
#

What do i have first do on the BlobkBreakEvent for a claim plugin?

#

Im really annoyed :(

quiet ice
#

Claiming plugins are pain

#

You have to listen to list 200 different events

fallow violet
eternal oxide
#

First you have to have a method to claim/unclaim areas and a way to check if a block is in an area

sterile token
#

I have a cuboid class for that

eternal oxide
#

then you can simply check contains

sterile token
#

Im first checking if claim exists right?

#

But them im stuck

#

I dont know what to first check

#

Because on break event i need to check lot of things

quiet ice
#

I personally have something like


    private void noteCancelled(@NotNull Player player) {
        long time = System.currentTimeMillis();
        Long lastComplain = lastComplainTime.get(player.getUniqueId());
        if (lastComplain == null || time > (lastComplain + 10_000)) {
            lastComplainTime.put(player.getUniqueId(), time);
            player.sendMessage(Component.text(this.pl.getI18N().get(I18NKey.ACTION_NOT_PERMITTED, player.locale()), NamedTextColor.RED));
        }
    }

    @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
    public void onBlockBreak(BlockBreakEvent e) {
        Block block = e.getBlock();
        /* `>> 4` Has the same effect as `x / 16`; may god hail binary operators.
        *  Interestingly enough, this trick even works for negative values,
        *  which might be the case as `>>` is dependent on the sign extension
        */
        int chunkX = block.getX() >> 4;
        int chunkY = block.getZ() >> 4;
        if (presenceConfig.isHarvestableCrop(block.getType())) {
            if (!data.canHarvest(e.getPlayer().getUniqueId(), block.getWorld().getUID(), chunkX, chunkY)) {
                e.setCancelled(true);
                noteCancelled(e.getPlayer());
            }
        } else {
            if (!data.canBreak(e.getPlayer().getUniqueId(), block.getWorld().getUID(), chunkX, chunkY)) {
                e.setCancelled(true);
                noteCancelled(e.getPlayer());
            } else {
                block.removeMetadata("presence_spongeplacer", pl);
            }
        }
    }
eternal oxide
#

?paste

undone axleBOT
sterile token
#

As you said they are really painfull

quiet ice
#

Well, you are stuck on the fun part it seems

quaint mantle
#

thats what it says

eternal oxide
quiet ice
sterile token
tardy delta
#

i've never worked with bytes 👀

quiet ice
#

Though I wrote this entire plugin with enormous care to make it as fast as I knew how; there are better ways to do it

quiet ice
left swift
#

Hi, I created my library where I have a class that extends from PathfinderMob. When I implement my library in another plugin and I extend that class and use normal spigot/paper methods from Entity class like setNoGravity, setCustomNameVisible etc. I have NoSuchMethodException. Why?

#

(both plugins are on the server, library and my plugin that implements it)

quiet ice
#

probably because your lib uses mojmap but does not reobf the jar that is used by the main plugin

left swift
#

both plugins has this task

    assemble {
        dependsOn(reobfJar)
    }```
sterile token
#

geol

#

But what do i have to first check on break event?

left swift
quiet ice
#

Eh, this is probably a gradle moment

left swift
#

I mean i publish my lib via github packages and idk why I have only -dev files

#

but when run gradle build

#

I have normal one

tardy delta
#

i kinda hate the fact that the default logger does not support placeholders

quiet ice
#

This is literally the exploit

eternal night
tardy delta
#

slf4j

eternal night
#

Why would you be able to call spigot methods on a subclass of an nms class

quiet ice
#

Also, slf4j does support local placeholders

left swift
eternal oxide
tardy delta
#

well ye i mean local like info("test : {}", 1)

eternal night
#

Yes but the API methods are not implemented on the nms classes

#

They are implemented in craftbukkit

quiet ice
#

Well in presence I do following:

  • Get the claim that is at the given location
  • If the claim does not exist, do nothing
  • If the claim exists, get the permission matrix attached to it
  • Get the owner of said claim
  • If the claim does not have a permission matrix, use the owner's permission matrix
  • If the player that is breaking the block is equal to the owner of the claim, query the permission matrix as the owner
  • If the player is trusted by the owner, query the permission matrix as an member
  • If the player is not trusted by the owner and not the owner, query the permission matrix as a stranger
  • If the permission as queried by the above 3 steps is given, do nothing
  • Otherwise cancel the event and (optionally) notify the player of the cancellation
tardy delta
#

verano still working on the claims plugin 🤤

quiet ice
#

Well writing a claiming plugin was the most fun experience I had in bukkit world

sterile token
left swift
quiet ice
#

what is the issue behind that?

eternal night
#

Well depends on what your class does

sterile token
#
public class ClaimListener implements Listener {

  @EventHandler
  public void onBreak(BlockBreakEvent event) {
    Player player = event.getPlayer();
    Block block = event.getBlock();
    Claim claim = this.plugin.getClaims().getClaim(block.getLocation());
    if (claim == null) return;
    if (claim.getOwner().equals(player.getUniqueId())) return;
    player.sendMessage("§cYou cannot build on §f" + claim.getUuid() + " §c claim");
    event.setCancelled(true);
  }

}

// getClaim() mehtod

public Claim getClaim(Location location) { return this.claims.stream().filter(claim -> claim.getCuboid().contains(location)).findFirst().orElse(null); }

// Claims var
Set<Claim> claims

eternal night
#

You said it extends PathfinderMob

#

Which makes no sense unless you are adding a complete new mob

sterile token
#

geol up to now all is okay

quiet ice
#

Your getClaim method has a complexity of O(n), that your issue or what?

eternal night
#

Well you cannot do anything with a subclass of the abstract class that is PathfinderMob

quiet ice
#

Everything else seems quite normal

#

Also, ew... streams

left swift
eternal night
#

So your lib creates an actual new entity

eternal night
#

that extends your lib class

#

which extends PathfinderMob ?

left swift
#

yeah

eternal night
#

Well, if that mob is not based on an existing mob you will have to implement a craftbukkit layer for it too

#

which can obviously extend existing craftbukkit layers

tardy delta
#

where are defaults from a config actually coming from? Are they coming from the file within the jar?

eternal night
#

e.g. CraftLivingEntity

left swift
#

so doing it via lib has no sense?

eternal night
#

Well no you can define your own custom logic that way

sterile token
eternal night
#

I am just saying that, for you to be able to call api methods, you need a proper craftbukkit wrapper around your custom entity class

quiet ice
# sterile token He?

If you have 10 000 000 claims in total it will take 1 000 000 times longer to retrieve the claim than if you had 10 claims.
This is bound to create issues in the long run

#

But you onBreak method is completely sufficent if you do not want to have things like trusting users and such things

left swift
eternal night
#

you did ?

left swift
#

it has armorstand model

#

so i coded methods like pose

eternal night
#

so you are basing stuff off armorstand ?

left swift
#

it is fully new entity type with arrmostand model

eternal night
#

Well yea, then have fun implementing the craftbukkit layer for that

left swift
#

Methods that i coded for armorstands, like small, pose, invisible etc. works, but methods that are in extended class like setNoGravity, custom name etc. doesn't work

eternal night
#

Does your craftbukkit wrapper extend CraftLivingEntity

eternal night
#

or I belive CraftCreature is the one that wraps PathfinderMob

sterile token
#

I dont actually know why you tell that but okay

quiet ice
#

It still takes that much time given that you effectively do

for (Claim claim : claims) {
    if (claim.bleh(blob)) {
         return claim;
    }
}
sterile token
#

Or i dont understand why you are saying that

quiet ice
#

Yeah, the streams API is basically a for loop

sterile token
#

Yeah i know

#

But dont worry

quiet ice
#

Which means that performance-wise this is hell

#

Functionally, it isn't an issue however

sterile token
#

yeah that why

#

I just stuck trying to do the checks

quiet ice
#

to be honest, having chunks not be aligned on a grid makes everything much much harder

sterile token
#

Im not using chucks

#

Because its a block based protection

quiet ice
#

I know