#help-development

1 messages · Page 333 of 1

tardy delta
#

with the Consumer<BukkitTask>

robust light
#

what do you mean? so I should addDefault with Material.valueOf?

tardy delta
#

to convert a string (like "DIRT") to a material, you need Material.valueOf(str)

rotund ravine
#

boils down to the same shit haha

tardy delta
#

looks terrifying

regal scaffold
#

sorry, Is this meant for me?

tardy delta
#

yes

regal scaffold
#

Would it make a difference?

pseudo hazel
#

well it would be managed better

#

so you can think less about how it works and just about what to do with it

tardy delta
#
new BukkitRunnable() {
  void run() {
    // 
    cancel();
  }
}.runTaskX()```
is the same as
```java
Bukkit.getScheduler().runTaskX(plugin, task -> {
  //
  task.cancel();
  return;
}, delay0, delay1);```
#

and it looks a lot cleaner to pass in a lambda

rotund ravine
tardy delta
#

what

#

what is a task

solid thunder
#

what entity for bed explosive/explode?
i use org.bukkit.event.entity.EntityDamageByEntityEvent.getDamager() instanceof org.bukkit.entity.TNTPrimed but get only TNT explode 🥹
i want to know who sleep in bed and explode after that (in the end)?

ivory sleet
#

ugh thats a bit wrong

tall dragon
ivory sleet
#
            future.exceptionally(throwable -> {
                e.setLoginResult(AsyncPlayerPreLoginEvent.Result.KICK_OTHER);
                e.setKickMessage(ChatColor.RED + "Sorry, We were unable to load your user data. Please contact staff with this error message");
                return null;
            });
#

this could run after the event

tardy delta
#

conclure here to save me again

tall dragon
#

thats a good point.

regal scaffold
ivory sleet
#

you could probably just use ::get or ::join with try catch

regal scaffold
#

Calling the main method that controlls the game states from the constructor itself. runnable

tardy delta
#

exceptionally adds a hook right, so join should wait for all of them to complete no?

regal scaffold
#

Hmmm

#

Not gonna lie haven't heard of a hook but I assume you mean wait until players join to begin with the logic

ivory sleet
regal scaffold
#

But wouldn't just state.WAITING cover that technically

ivory sleet
rotund ravine
tardy delta
#

so do all other methods, but isnt the original future stored in the new one as a completion stage?

ivory sleet
#

ye allg, forget those details myself sometimes even

tardy delta
#

so joining the last also blocks all hooks added on the other futures

tall dragon
#

@ivory sleet

    @EventHandler(priority = EventPriority.HIGHEST) // make sure other plugins/events have time to deny
    public void onLogin(AsyncPlayerPreLoginEvent e) {
        if (e.getLoginResult() == AsyncPlayerPreLoginEvent.Result.ALLOWED) {
            // if the join-cache already contains player's profile we just return
            if (this.joinCache.containsKey(e.getUniqueId())) return;

            // blocking
            CompletableFuture<UserProfile> future = this.loadProfile(e.getUniqueId());
            
            future.exceptionally((throwable -> {
                e.setLoginResult(AsyncPlayerPreLoginEvent.Result.KICK_OTHER);
                e.setKickMessage(ChatColor.RED + "Sorry, We were unable to load your user data. Please contact staff with this error message");
                return null;
            }));
            
            try {
                UserProfile profile = future.get();
                this.joinCache.put(profile.getUniqueId(), profile);
            }catch (ExecutionException | InterruptedException ex) {
                ex.printStackTrace();
            }
        }
    }

this should work normally then right?

#

id probably need a null check after my future.get tho

#

if im understanding this right

dry yacht
#

Since it's ? extends T, I'd assume that you're gonna get null on get if exceptionally has been called. But I don't know these fancy APIs.

#

Not sure what the advantages over a simple try-catch are in this case tho.

ivory sleet
tardy delta
#

ugh

#

whenComplete?

tall dragon
#
@EventHandler(priority = EventPriority.HIGHEST) // make sure other plugins/events have time to deny
    public void onLogin(AsyncPlayerPreLoginEvent e) {
        if (e.getLoginResult() == AsyncPlayerPreLoginEvent.Result.ALLOWED) {
            // if the join-cache already contains player's profile we just return
            if (this.joinCache.containsKey(e.getUniqueId())) return;

            // blocking
            CompletableFuture<UserProfile> future = this.loadProfile(e.getUniqueId());
            
            try {
                UserProfile profile = future.get();
                this.joinCache.put(profile.getUniqueId(), profile);
            }catch (ExecutionException | InterruptedException ex) {
                e.setLoginResult(AsyncPlayerPreLoginEvent.Result.KICK_OTHER);
                e.setKickMessage(ChatColor.RED + "Sorry, We were unable to load your user data. Please contact staff with this error message");
            }
        }
    }

riight. so bassically what i had

#

haha

ivory sleet
#

mye

#

well
this.joinCache.put(profile.getUniqueId(), profile);
that should probably go outside

dry yacht
tall dragon
tardy delta
#

what was the problem now actually?

dry yacht
tall dragon
#

i just had a question about the thread being blocked lmfao

#

but u no likey my future code

dry yacht
tall dragon
#

yea that was my question

#

thats good

dry yacht
#

Everything else would be insanity. You could get the server to block badly or have others being prevented from joining by just sending the login packet and then never responding again until the socket times out.

#

No idea why your simple question hasn't been answered right away, but rather your code has been obscured.

tall dragon
#

it had been answered

#

but we continues talking about my future code

#

since i don't know too much about futures

pseudo hazel
#

noone knows the future

dry yacht
dry yacht
# tall dragon what do you mean?

You block anyways, why not just straight up return your value? Why wrap it in another allocated wrapper? What's that good for?

tall dragon
#

uhhh

tardy delta
#

bukkitrunnable uses the scheduler methods internally

ivory sleet
#

^

#

they were designed before lambdas came and everything

tardy delta
tall dragon
tardy delta
#

thats why we still have that ancient Consumer

pseudo hazel
#

oh but now lambda features have made the bukkit runnables old fashioned?

ivory sleet
#

sorta

#

well imperative programming would still favor BukkitRunnable

tardy delta
#

the only reason to use them would be to extend them in my eyes

dry yacht
harsh badge
#

Hey I am using this code:

for (int x = -mX; x <= mX; x++) {
for (int y = -(mY - 1); y <= mY; y++) {
for (int z = -mZ; z <= 3; mZ++) {
Block block = loc.clone().subtract(x, -y, z).getBlock();
block.setType(Material.AIR);
}
}
}

That's the part where I replace the cage with air. It gets stuck at the first air block

This is my error: https://pastebin.com/BRJdQKKx

ivory sleet
#

cuz u can basically invoke the instance method cancel() anywhere yk within the BukkitRunnable

tardy delta
tall dragon
#

it will just know the profile is null and could not be loaded

dry yacht
pseudo hazel
tall dragon
dry yacht
dry yacht
tall dragon
#

ah well it doesnt matter

#

i rlly have to go so cant talk more haha

dry yacht
#

Sure thing, it's your code, your quality.

tall dragon
#

il see what il do maybe il take ur advice idk yet

ivory sleet
#

if u wanna avoid possible dead locks etc, you could use get where u provide a timeout

tall dragon
#

i do have a timeout

tardy delta
#

is join going to cause a deadlock by waiting indefinitly?

#

would make sense ig

ivory sleet
#

not sure actually

dry yacht
#

While that's not how a deadlock is being defined, I'm sure it would block until a value is emitted. If you never emit, you're probably stuck forever, until the socket times out.

tardy delta
#

or until client gives up

dry yacht
#

Same thing, phrased differently.

ivory sleet
#

ye well in this the deadlock would be caused by a process which is holding one resource and is requesting additional resources which are being held by other stuff

#

but anyway, get with a timeout is usually a good practice

regal scaffold
#

Is there a way to use a debugger of some sort to run my plugin and then get a postreport of what methods were called, what order, etc?

#

Like not a breakpoint based debug

#

Or is the best way just sysout all the methods

dry yacht
#

Kinda sounds like you want to run a profiler

tardy delta
#

could use visualvm

#

probably

dry yacht
regal scaffold
#

Well I wanna check that my methods are working correctly kinda find out where the logic is messing up

#

So I assume just sysout

pseudo hazel
#

well yeah, if you cant get breakpoints, using prints is the next best thing

dry yacht
#

You maybe could even make use of hot reloading to not have to reload every time you're adding/deleting/changing souts.

sterile token
#

Some fast question i have, what happen if i call the translate method from BungeeCord in a spigot plugin? Im wondering to know because im programming a multi platform plugin and i need to know if its posible something like that

pseudo hazel
#

it would probably translate the string just like usual

sterile token
#

Because from what i read mc colors and extra (bold, italic, etc) are none platform dependent, so they works both the same for bungee and spigot using the & but i dont wanna write my own parser. Thats the reason i asked if i can use the ChatColor method for translating color in

regal scaffold
#

What's the difference inside a method that has a switch between return and break if it's being ran inside a runnable().

Example:

  new BukkitRunnable() {
            @Override
            public void run() {
                activate();
          }
      }

pubic void activate() {
    switch (etcetc) {

              < -------------- here return, break difference
      }
 }
#

Inside the switch specifically

sterile token
#
  1. return - means that the code below wont be executed and will re executeyour code from the start
regal scaffold
#

And break just gets out of the switch

#

Correct?

pseudo hazel
#

yes

sterile token
#

yes

pseudo hazel
#

thats what they are kinda meant for

regal scaffold
#

Yeah yeah just the runnable confused me a bit

pseudo hazel
#

but I just use newer arrow switches usually

regal scaffold
#

So if I return it'll wait until the runnable to run again

#

If there's nothing under the switch then it doesn't matter either one or

pseudo hazel
#

well yeah

#

but good practise is using break statements to break from a switch

regal scaffold
#

And then return after

pseudo hazel
#

and using returns to returns from teh function

regal scaffold
#

Gotcha

#

I'm having a big issue figuring out what's going on

pseudo hazel
#

but return isnt needed if its teh last line in a void function xD

regal scaffold
#

I'm losing my mind somewhere

#

true

pseudo hazel
#

since it will return anyways

regal scaffold
#

Oh enhanced switches don't need break either

#

At the end of each case

pseudo hazel
#

activate is just a normal function that just called by something thats not your code

#

thats all

regal scaffold
#

Yeah just the way I'm organizing my logic isn't working

#

Trying to draw stuff out

pseudo hazel
#

yes true, thats why i use enhanced ones most times

regal scaffold
#

Steaf you ever made a plugin that has a State in a loop? It would really help seeing something

sterile token
#

return is really used in case of doing "pre statements evaluation", so then in case of that condition not being success, it will check again that if until the condition is sucess and w then ill comtinue executing code of blocks below

regal scaffold
#

Alright alright gotcha, thanks verano

pseudo hazel
#

you mean like a normal video game, but inside a plugin?

#

no

pseudo hazel
#

my minigame just works on events and the vanilla game

regal scaffold
#

Nono

#

Oh

#

I meant a game as a plugin that uses states to do stuff

pseudo hazel
#

well I just meant like a game in the sense that it has a gameloop

sterile token
pseudo hazel
#

like what kinda state

regal scaffold
#

Well, i'm starting to think maybe the way I defined my gamestates themselves are wrong

pseudo hazel
#

can you give a simple example?

regal scaffold
#

I can share what I have but it's confusing at the moment even for me and I wrote the damn thing

pseudo hazel
#

well sure

regal scaffold
#

Let me write something up

sterile token
regal scaffold
#

Will definately do

#

I'm gonna make a thread

sterile token
#

Right

pseudo hazel
regal scaffold
#

GameLogic

pseudo hazel
#

cuz they guard the code from going further

ivory sleet
#

the original future gets stored as a source

tardy delta
#

ugh i forgot what i wanted to say already

ivory sleet
#

think it was if exceptionally() would run on join() or sth?

tardy delta
#

ig

#

that join should block all hooks or smth

ivory sleet
#

well

sterile token
ivory sleet
#

from what I know at least, join() would not invoke exceptionally()

#

but it makes sense sort of

tardy delta
#

ye nvm i forgot what i needed to know

ivory sleet
#

Ye allg

#

Ah yes, so I think exceptionally().join() would invoke the function, but you’re creating a new subchain where the join() invocation is disjoint from the subchain (cuz parent doesnt know about children, tho children know about parent)

sage patio
#

I'm not canceling block break & place event, but my plugin does not allow me to place / break a block even with full permission (op & *)

tardy delta
#

other plugins?

sterile token
sage patio
tardy delta
#

uh oh plugman

sterile token
sage patio
#

i've restarted my server too

sterile token
sage patio
#

yes

sterile token
#

okay

sage patio
#

right lemme check that

sterile token
#

Yeah check that

sage patio
#

maybe all the world is smeltery region? lol

sterile token
# sage patio

Dont use player location because it will cause you issue

#

You should use getClickedBlock() if im not wrong

tardy delta
#

^^

sterile token
sage patio
ivory sleet
#

Mye

sage patio
#

thanks for help

sage patio
sterile token
quaint mantle
#

What annotation should I use in my plugin library to indicate that what the method returns will never be null?

quiet ice
#

I recommend the jetbrains-annotations annotations

sterile token
quiet ice
#

The annotations under the javax package (can't remember the official name) is the other well-known annotation lib but I am not a fan of that one

hazy parrot
#

That method returns will never be null

quiet ice
#

only use contracts in addition to notnull/nullable annots

#

While IJ can parse contracts, eclipse will have a pretty hard time doing so

pseudo hazel
#

yeah but thats eclipse

quiet ice
#

One day I'll write an eclipse plugin to deal with these sort of issues, but in the meantime you'll have to wait or just not only use contracts

final monolith
#

Guys someone remember the class type that only accept certains classes to extends?

i mean... public X Class accepts Class1, Class2
i forget the name xD

desert loom
#

permits?

final monolith
#

i think it is

#

yeah it is

#

thanks!

#

sealed classes

rough drift
#

Why doesn't spigot use ChatComponents in the tab header/footer?

nova tiger
#

I need help. With a plugin to code, that plugin ensures that everyone starts with a pet of their choice. And optionally name a lead if needed. If that pet is dead you will be banned from the server.

chrome beacon
#

What part do you need help with?

tardy delta
#

with how to make plugins probably

rough drift
#

lmao fr

tender shard
#

that idea is more stupid than my tax authority plugin lmao

tardy delta
#

can i get an elephant as pet?

tender shard
#

brb I'll throw myself into the bathtub again

quiet ice
#

Well it's better than my "anarchy economy" (i.e. players can manage their currency and print money themselves) plugin

tardy delta
#

uh oh

quiet ice
#

I have no idea whether it works on large servers but it sure as hell doesn't work on very small servers

tardy delta
#

is it even used on big servers?

quiet ice
#

As of now I haven't bothered open-sourcing it as it does not have an economy API implemented. So the only plugin supporting it is a makeshift auction plugin and that is it.

tardy delta
#

\👀

quiet ice
quiet ice
tender shard
#

Wheres the „blackjack and hookers“ plugin though?

quiet ice
#

I am not that motivated

tender shard
#

Oooh i just got an awesome plugin idea. A back to the future plugin, where you can craft a delorean and than go back into time, gotta fight biff (an enderdragon) and when you go back into the future, biff‘s your bitch

quiet ice
#

I already have too much stuff to do

#

My home-made mavenresolver is haunting my dreams a bit too much

#

I shouldn't have submitted that as the besondere lernleistung for my abitur

regal scaffold
#

If im running stuff inside a runnable how can I pause for x amount of seconds and then resume where I left off

#

Like if I wanted to do a "Starting in 10 seconds"

quiet ice
#

Don't.

regal scaffold
#

Same as command cooldown?

quiet ice
#

You probably want to register a new runnable I guess

tardy delta
#

ig its safe to do Thread.sleep as youre in a worker thread??

quiet ice
#

Can get messy very quickly but there is no other way

quiet ice
#

never use Thread.sleep in any thread you didn't create yourself

#

Otherwise the pool can get exhausted and the server will go haywire

regal scaffold
#

What if I use HashMap<Player,Long> cooldown=new HashMap<>();

quiet ice
#

The same applies to I/O (mostly NI/O) operations

tardy delta
#

spigot uses a cached threadpool anyways so should be fine i thought

regal scaffold
#

And not change the state until 10 seconds have passed

#

Is it that bad of an idea?

quiet ice
regal scaffold
#

Any alternative if I wanna wait 10 seconds before changing a variable?

humble tulip
#

NIO vs IO?

quiet ice
#

network I/O

humble tulip
#

Ah ok

quiet ice
#

A DDoS on the backend server can cause quite teh serious slowdowns

regal scaffold
#

Is that meant for me? I assume not

tardy delta
#

wondering the same thing

quiet ice
#

It's meant to those recommending Thread.sleep

tardy delta
#

ah

humble tulip
#

For cooldowns

quiet ice
#

Map<UUID, Long> is best

regal scaffold
#

I need to pause inside a runnable

tardy delta
#

just scheduling another task within the existing task then?

humble tulip
#

Alternatively, store the expiry time in a map

quiet ice
#

if you want changing variables, use the AtomicObject/AtomicLong/etc family

humble tulip
#

Why do you need to pause?

sterile token
#

What could be the reason of enchantments not being added to itemstacks?

humble tulip
#

You're not adding the enchant to the meta

#

Could be one way

quiet ice
sterile token
humble tulip
#

Are you also changing the name etc?

regal scaffold
#
        switch (state) {
            case WAITING -> {
            }
            case PAUSE -> {
            }
            case IN_PROGRESS -> {
            }
            case BOSS_FIGHT -> {
            }
            case RESETTING -> {
            }
        }

state = PAUSE:
Message sent: Starting in 10 seconds

after 10 seconds
change the state

#

That's what I wanna do

humble tulip
#

Runnables

regal scaffold
#

And that switch is inside a runnable

sterile token
quiet ice
#

You can have runnables inside a runnable

regal scaffold
#

Nono

#

Only current runnable is outside the switch. the switch is inside a runnable

#

Now i'm trying to do what I typed above

tardy delta
#

do a runTaskLater within your game loop?

regal scaffold
#

But that means the current runnable gonna keep running no?

quiet ice
#

You can't pause the execution of your runnable without very cursed hacks, so don't try to pause execution of your runnable.

humble tulip
regal scaffold
#

Not trying to pause it I'm asking for ideas and I think fourteen is right

quiet ice
humble tulip
#

Look at fsmgasm @regal scaffold

tender shard
#

How is it possible that this tomasinhues once appeared outta nowhere and now hes online 24/7 lol

humble tulip
#

It's a state machine good for building minigames

regal scaffold
#

😦

humble tulip
#

Boss fights are basically a minigame

regal scaffold
#

Will give it a look

#

Alex, I can promise you i'm the most online person you'll ever meet

tender shard
regal scaffold
#

When i set my mind onto something, I never stop

humble tulip
#

😦

humble tulip
regal scaffold
#

I can put 20 hours a day into something non stop

#

Yes!!! Worked beautifully

tardy delta
regal scaffold
#

Besides alex, unless you put the hours of work not gonna learn what you want to learn. And I wanna learn this at the moment hehehe

#

Instead of taking me years to get to high level with the effort you can make that a few months. Just gotta make sure you keep healthy

humble tulip
regal scaffold
#

I'll dm you the sc

humble tulip
#

Sure

quiet ice
regal scaffold
#

I started like a week ago or something. And if I compared the first thing I did with what and how i'm doing it now it looks like a month of progress. I can't even look at my code a week ago it was terrible

#

I would prob get banned from the cord

humble tulip
#

I'm sure it's still terrible😂

#

You'll get better tho

regal scaffold
#

😦

#

Is the one I sent you that bad LMAO

humble tulip
#

What did u send?

regal scaffold
#

You asked for the context

tender shard
regal scaffold
#

lmao

#

Take care of mental and physical alex

#

Otherwise that brain isn't gonna last to keep making stuff

humble tulip
#

Ok yeah it's bad😂

regal scaffold
#

😦

#

Come on bro

humble tulip
#

The organisation

regal scaffold
#

Ok yeah Im aware of that

#

Slowly improving tho

#

It's just a lot of reading

humble tulip
#

What is activateDungeon supposed to do?

regal scaffold
#

And reading other peoples projects which are considered good

tender shard
#

Hm actually quite good rn

regal scaffold
#

But everything is working btw

#

Like really well

#

I was just curious on how to do the "wait 10 seconds"

tender shard
#

there should be a blood pressure plugin for MC

humble tulip
#

Here's how it should go

regal scaffold
#

But I'll prob just do runtasklater and change the state there

humble tulip
#

Your game should have a start method

#

Which initializes the game, sets it to joinable etc

tender shard
#

you can get your blood pressure measured using /bp, and if it' higher than 160/100 or lower than 100/60, you gotta call an /ambulance but if it's an american server and you don't have insurance, it bankrupts you

humble tulip
#

Then it should have a nextPhase method that switches the phase OR you can use fsmgasm

humble tulip
regal scaffold
#

fk man fsmgasm is actually so organized

#

But I wanna try without library

#

I'll improve as I do it

tardy delta
#

dunno what its actually used for

quiet ice
#

Recaf uses it for automatic deobfuscation

#

But can be used to sandbox anything. However it's properties make it suitable for more cursed things (such as pausing execution on the main thread)

tardy delta
#

:)

regal scaffold
tardy delta
#

could store it in your player wrrapper thing

regal scaffold
#

The cooldown is for the entire game tho

#

And there can only be 1 cd at a time

quiet ice
#

Well if it is for everyone then it can just be long

regal scaffold
#

That's what I thought. Dope

quiet ice
#

perhaps even Instant if you fancy that

regal scaffold
#

Oh god another word I gotta go read on

#

Oh wait it's a class

#

👀

#

Nah bro that's too deep I need 10 seconds not 1000000000-12-31T23:59:59.999999999Z

tender shard
#

"it's just a heart attack, get over it"

regal scaffold
#

Im gonna send something that's a bit embarrasing

#

But whatever

#
        new BukkitRunnable() {
            @Override
            public void run() {

                if (coolDown != 0)
                    coolDown--;

                if (coolDown == 5) {
                    messagePlayers("You have " + coolDown + " seconds to get ready! Starting level " + currentLevel + "!");
                }
                if (coolDown == 3) {
                    messagePlayers("You have " + coolDown + " seconds to get ready! Starting level " + currentLevel + "!");
                }
                if (coolDown == 2) {
                    messagePlayers("You have " + coolDown + " seconds to get ready! Starting level " + currentLevel + "!");
                }
                if (coolDown == 1) {
                    messagePlayers("You have " + coolDown + " seconds to get ready! Starting level " + currentLevel + "!");
                }
            }
        }.runTaskTimer(plugin, 0,20);
#

There's definitely gotta be a better way to do this

tardy delta
#

switch

hazy parrot
#

Or just if CD < 5

humble tulip
#

Create a Countdown Runnable class

#

So you can use it for all countdowns

regal scaffold
#

Switch same length:
cd < 5 is actually a good idea
Not sure it's worth abstracting for just a 10 second countdown

#

Hmmmm

#

Le tme think if I need it more places

humble tulip
#

Abstract it now so you don't have to later(unless ur lazy like me)

regal scaffold
#

fk it I'll do it

#

brb gotta learn about abstraction

#
private void generateLevel() {
        new BukkitRunnable() {
            @Override
            public void run() {
            }
        }.runTaskTimer(plugin, 10, 10);
    }

I remember you told me or someone to change something about the runnable. Now I need to be able to cancel this task from a different method. i believe that's the reason they told me to change it.

#

Can't remember exactly what they said

#

BukkitTask task = new ExampleTask(this.plugin).runTaskTimer(this.plugin, 20);

#

It was this change, correct?

quiet ice
#

Probably something about lambdas and consumers

regal scaffold
#

Hmmmm

#

Is that the correct way to cancel a tasktimer from a different method? I thought both of those were localized

tardy delta
#

id just let my class implement runnable

#

and give it to the scheduler to run

regal scaffold
#

^

#

Done

#
public enum Level {
    ONE(5),
    TWO(5),
    THREE(5),
    FOUR(5);

    private final int killGoal;

    Level(int killGoal) {
        this.killGoal = killGoal;
    }

    public static int getKillGoal(int level) {
        for (Level l : Level.values()) {
            if (l.ordinal() == level) {
                return l.killGoal;
            }
        }
        return 0;
    }
}

I'm using this enum to convert a level number to the amount of kills needed but enums don't allow you to have a number as a enum name.

How can I convert int ( 1, 2, 3, 4, etc ) to a respective value here

tardy delta
#

so you need to map a killGoal to a Level?

regal scaffold
#

Yep!

#

Exactly that

#

I've done others that are working perfectly before but this one can't cause 2 numbers

tardy delta
#

dont check ordinal but check l.killGoal

regal scaffold
#
public enum MobName {
    MinerZombie(1),
    Samurai(2),
    ToxicZombie(3),
    FrozenInhabitant(4);


    int level = 0;
    MobName(int i) {
        this.level = i;
    }

    public static MobName getMobName(int level) {
        for (MobName mobName : MobName.values()) {
            if (mobName.level == level) {
                return mobName;
            }
        }
        return null;
    }
}
#

But the level is a name

#

Not a number

tardy delta
#

wat

regal scaffold
#

Like

#

ONE(5) means level 1 should have 5 as kill goal

tardy delta
#

so you need String -> int?

regal scaffold
#

Or another way of doing this, yes

#

If there's a better way than havinjg to convert the word one to 1

tardy delta
#

so Level.valueOf(name).getKillGoal()?

regal scaffold
#

Level.valueOf(number).getKillGoal()

tardy delta
#

where "ONE" would return Level.ONE

regal scaffold
lavish hemlock
#

You'd need to store a static HashMap<Integer, Level> in your enum class and initialize it on class load via the static initializer
Then you just iterate over values() and do map.put(number, value) or something like that

tardy delta
#

ig im not understanding the question

tardy delta
#

you need to get a Level from the killGoal and suddenly you say the level is in string form

regal scaffold
#

The level is a int. A number like (1,2,3,4)
each level has a int killGoal\

tardy delta
#

map then yes

regal scaffold
#

Alrighty

tardy delta
#

i hope that enum doesnt have a thousand entries

regal scaffold
#

16 levels max

lavish hemlock
#

If you ask me though

#

You should just store Level.ONE and etc. in your MobName enum constants

tardy delta
#

Level.NINEHUNDRED_NINETY_NINE 💀

regal scaffold
#

I'll always take advice

#

I also have another enum tho

#

I guess I could

#

could've combined them all

#

level, mobname and bossname

lavish hemlock
#

i.e. MINER_ZOMBIE(Level.ONE)

regal scaffold
#

Oh wait no then you're gonna suggest me something else here

lavish hemlock
#

Safer, faster, and more readable

regal scaffold
#

the level means which mob to spawn. not the level of the mob.

Example

currentLevel 1

killGoal -> ONE(5), -> killGoal = 5
mobTospawn -> MinerZombie(1) ->MobToSpawn = MinerZombie

lavish hemlock
#

Oh, I see

regal scaffold
#

Yeah that's why i have the issue with ONE(5) cause "1" isn't the same as "one" obviously lol was just a placeholder

#

So if I do the map on the level should be good

lavish hemlock
#

You should use the SCREAMING_SNAKE_CASE for enum constants though

regal scaffold
#

Well the issue with that lmao

#

Is that the name of the mob actually is the exact name I need to call it in a api func

#

lolol the plot grows

lavish hemlock
#

Yeah so

#

You're pretty much supposed to do:
MINER_ZOMBIE("Miner Zombie", 1)

regal scaffold
#

I thought you could only have 1 value inside the enum

lavish hemlock
#

Nope

#

The way enums work is that they're just classes under the hood

regal scaffold
#

Oh man that would've been handy

lavish hemlock
#

If you look into a compiled enum it's just a class with the enum flag + every constant you've declared

#

Compiled constants look like:

regal scaffold
#

But you see this

lavish hemlock
#
public static final MobName MINER_ZOMBIE = new MobName("Miner Zombie", 1);
regal scaffold
#
    public static MobName getMobName(int level) {
        for (MobName mobName : MobName.values()) {
            if (mobName.level == level) {
                return mobName;
            }
        }
        return null;
    }
#

I don't do MobName.MINER_ZOMBIE

#

I do MobName.getMobName(level)

#

I asked a day or 2 ago if doing it this way was considered terrible practice

lavish hemlock
#

I'd probably do it different, personally, but I don't see too big of an issue with it

#

I just don't like relying on "magic constants"

regal scaffold
#

So just gonna change the level to a map

#

Wait actually

lavish hemlock
#

I don't 100% know the architecture of your plugin so it's hard to offer advice

#

Maybe I'll offer a PR if this is public, lol

regal scaffold
#

lol

#

😦

#

I mean I'll definately learn a lot from it

#

Seeing how more experienced people do the same thing you're trying to do without rewriting the entire plugin is one of the most handy things

lavish hemlock
#

I agree

regal scaffold
#
    public static int getKillGoal(int level) {
        for (Level level1 : Level.values()) {
            if (level1.level == level) {
                return level1.killGoal;
            }
        }
        return 0;
    }
#
    LEVEL_1(1, 10),

    LEVEL_2(2, 15),

    LEVEL_3(3, 20),

    LEVEL_4(4, 25);

#

I think that should work

#

At least the logic does suggest that

delicate obsidian
#

How can I check if a player is nearby a specific entity with a tag? I don't know if its possible with the getNearbyEntities method

tardy delta
#

¯_(ツ)_/¯

pseudo hazel
#

I think you can just use that and then check for each entity if they have the tag

#

and if you found one, return true

dry yacht
# delicate obsidian I'll try that

I'd use the entity-predicate of the nearby entity utility method, as that allows it to perform your query in a more efficient manner than if you filter externally. Something simple like this should do: https://paste.md-5.net/totaduzeti.coffeescript

The ones as arguments mean how far from that location to go into negative and positive axis direction from the location's point, so view them as a "radius" instead of a "diameter" and adjust as needed.

pseudo hazel
#

oh yes thats better, I didnt know the method had a predicate

delicate obsidian
#

yea

#

thanks! 😄

livid dove
#

So dev lads , been mucking about wi9th settings in vulcan. Is there a reason that lunar client gets pinged by vulcan specifically?

tawdry python
#

I'm using the 1.18 API, but since I want to leave the plugin for all versions, I want to be able to use Material.Seeds if I'm using 1.8, but in 1.18 it doesn't have Material.Seeds, what better way to do this?

dry yacht
signal kettle
#

Hello I'v created a class that should extract textures in to folder in plugins but I get

26.01 22:58:19 [Server] WARN java.nio.file.NoSuchFileException: home/minecraft/multicraft/servers/server584001/plugins/woodaddons-v1.0-1.19.jar

What could be wrong?

#

Is that mean that it can't find my textures in plugin jar or it can't find path in plugins directory

regal scaffold
eternal night
#

curl https://repo.simplix.dev/repository/simplixsoft-public/dev/simplix/cirrus/cirrus-spigot/maven-metadata.xml | xq -x '//versioning/latest'

regal scaffold
#

What a savior

eternal night
regal scaffold
#

Windows alt?

eternal night
#

kekw windows

regal scaffold
#

lol

eternal night
#

eh, run it in git bash ?

#

idek

regal scaffold
#

It's alright I'll figrue it out

#

Thanks

eternal night
#

concerning its go I'd presume they have a windows build

#

worst case, just build it yourself 😝

regal scaffold
#

Man either their steps are terrible or I'm an idiot

eternal night
#

the gitbash thing might be hard tbh

#

its a wild land

regal scaffold
#

I found the version

#

But their steps are still terrible

eternal night
#

oh ?

#

I didn't find one on their github

regal scaffold
eternal night
#

oh

#

you are not talking about xq 😂

regal scaffold
#

nono

#

Mb

#

Talking about this guys repo

#

I think they fucked up

#

Their pom is not in the folder

eternal night
regal scaffold
#

I actually cannot figure it out

#

Lovely

eternal night
#

whats the specific issue ?

tender shard
#

Lynx are you drunk or sth

eternal night
#

no

#

o.O

tender shard
#

Oh ok

tender shard
undone axleBOT
#

If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!

tender shard
#

?notworking

undone axleBOT
#

"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.

regal scaffold
#

I was using their guide and before I was using what I thought was the latest version 2.0.0.

I contacted the dev and he told me if I was using version 2.1.0-snapshot or 3.0.0-snapshot and my mind exploded.

I found the 3.0.0-snapshot version but the 2.1.0-snapshot doesn't exist on the repo. Anyways

Added the 3.0.0-snaphot version and now getting this

#

Could not find artifact dev.simplix.cirrus:cirrus-spigot:pom:2.1.0-SNAPSHOT in spigotmc-repo (https://hub.spigotmc.org/nexus/content/repositories/snapshots/)

regal scaffold
wicked remnant
#

did you also add the cirrus-spigot specific api?

#

repo**

tender shard
#

3.0.0-SNAPSHOT

#

Is their latest version

regal scaffold
#

Yes and yes

tender shard
#

Run „mvn clean package -U -X“

regal scaffold
#

Why does it think it's there

tender shard
#

?paste your pom pls

undone axleBOT
regal scaffold
eternal night
#

lol look at you go alex

#

xD

regal scaffold
#
<dependency>  
  <groupId>dev.simplix</groupId>  
  <artifactId>protocolize-api</artifactId>  
  <version>2.1.0</version>  
</dependency>
``` had that added with different versions too but I believe the 3.0.0 includes that anyways or at least it's what IJ says
tender shard
#

Hm okay i don’t understand why it doesnt work, however i can tell you how to fix it. Clone the cirrus repo, then do „mvn install“

eternal night
#

😏

regal scaffold
#

lol

#

The entire thing?

tender shard
#

Yeah in intellij just do File > new project > from VCS > enter the github link, then do „mvn install“

regal scaffold
#

Okay

tender shard
#

And in your plugin‘s pom, use the same version for that dependency that it declares in its own pom

regal scaffold
#

In the pom of the cloned repo

tender shard
#

Yes

regal scaffold
#

It's outdated there

#

2.0.0

tender shard
#

Doesnt matter

regal scaffold
#

Alright

#

Still cloning

tender shard
#

Use 2.0.0 in your pom after „mvn install“ed the cloned repo

#

If that still doesnt work, you should start to insult the dev of that lib in public lol

eternal night
#

yea the repo is just fucked kekw

tender shard
#

Probably, yeah

regal scaffold
#

Building my project rn but last time it built too

#

Was when you tried using it

#

error

#

Not good looks alex after we said it looked interesting lol

tender shard
#

People should not host nexus if they dont understand it >.<

eternal night
#

wtf are they deploying

#

apperantly a built went out two days ago ??

#

their github repository has been dead since december ??

regal scaffold
#

Didn't work btw and he just replied that

eternal night
#

I mean, idk man

regal scaffold
#

I'm seeing what the dev says lol

#

How can I delete the mvn install and cloned repo alex made me download

eternal night
#

you can yeet it from your local maven repo at ~/.m2/repository/the/group/id/and/sutff

regal scaffold
#

Is just deleting it enough?

eternal night
#

the repo is just a folder

#

yea

sterile token
#

How does luckperms access to spigot server cache? Is there a method for doing something like that

#

Because luckperms has a config option which allow you to get the player data which is cached on the server itself and not in the plugin cache

formal bear
#
[01:44:26 ERROR]: null
org.bukkit.command.CommandException: Unhandled exception executing command 'gui' in plugin bpSurvival v0.2
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:47) ~[purpur-api-1.18.2-R0.1-SNAPSHOT.jar:?]
...
Caused by: java.lang.ArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0
        at pl.botprzemek.bpSurvival.commands.CommandOpenGui.onCommand(CommandOpenGui.java:28) ~[bpSurvival-0.2-all.jar:?]
        at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[purpur-api-1.18.2-R0.1-SNAPSHOT.jar:?]
        ... 21 more```
```    @EventHandler
    public void onInventoryClick(InventoryClickEvent event) {
        Player player = (Player) event.getWhoClicked(); // 28 line
        Gui gui = managerGui.getGuiByTitle(event.getView().getTitle());

        if (gui == null) return;```
sterile token
formal bear
#

Wth? event.getWhoClicked(); is out of bounds

sterile token
#

The error is saying that you are trying to access to argument which doesnt exists on the array

formal bear
#

real life npc 💀

#

How the fuck event.getWhoClicked() is out of bounds XD

hazy parrot
lavish hemlock
#

It states that the error occurs at pl.botprzemek.bpSurvival.commands.CommandOpenGui.onCommand

#

Show that method, not onInventoryClick

#

Verano is probably right that it's due to accessing an argument that doesn't exist

humble tulip
sterile token
sterile token
young knoll
lavish hemlock
#

I think the idea is that like

#

It allows you to use a database so you can have a single source for offline player UUIDs across your network

hazy parrot
lavish hemlock
#

Which is pretty smart imo

hazy parrot
#

bukkit for example

sterile token
#

From what i read that option is for you luckperms looking for player inside the sever cache instead of the plugin cache. So he can add ranks if the player havent already connected while the plugin was put

#

Do i explain?

hazy parrot
#

basically getting offline player and after that their uuid

sterile token
#

As I saw with this option, if I want to give the rank to a player who is not yet connected to the luckperms server I will not be able to, without having this option activated.

hazy parrot
#

because in other way it will use database

sterile token
#

Maybe is what you are saying but im so dumb that i dont understand it

#

Yeah

hazy parrot
#

which will make sense to not work if player haven't joined

sterile token
#

That why i asked how luckperms get that cache, if the spigot server has a method or smth like that

sterile token
#

oh right

#

Also i need a lighweight library for creating bungee and spigot components and also allow their colors/styles get directly translated depending if you are bungee/spigot

lavish hemlock
#

What?

sterile token
#

Have you seen bungee chat api right?

lavish hemlock
#

Ye

sterile token
#

Here I wrote it with the translator, what I need is to know if there is a lightweight library which allows me to create components for bungee and spigot, but which also supports color coding (blue, red, etc) and classic styles (italic, underline).

lavish hemlock
#

Okay well

#

Bungee and Spigot components are not actually too different

#

Spigot's API supports Bungee's Chat API (Player.Spigot)

#

But the main difference is that Spigot supports legacy text

sterile token
#

Yeah i know more or less that, because components well json structures

lavish hemlock
#

New versions, I believe, must translate from legacy text to the new system which uses part of the protocol

quaint mantle
#

anyway to create a duplicate of world and yml file?

#

through commands

young knoll
#

Copy the file and the directory

lavish hemlock
#

Either way

#

Because of that, you should basically only use one or the other

#

The only incompatibility is cross-version, I don't think Bungee's Chat API is supported by all versions

#

The only library I can think of that does something similar is Adventure, but that's definitely not "lightweight"

sterile token
# lavish hemlock Either way

Yeah i know more or less that, because components well are just json structures that are displayed them on the client. But i dont know how i can use the colors using the &

young knoll
#

Isn’t there a fromLegacyText

fickle mortar
#

hello everyone, I'm a little new to minecraft java, and I wanted to know for those of you who have understood for a while if it's possible to make a plugin that makes the block move from POINT A to POINT B and stop at point B.

lavish hemlock
#

Probably

#

I would recommend not using legacy text if you can

sterile token
young knoll
#

I gotta say adventure and minimessage are nice

#

But yeah not lightweight

lavish hemlock
#

I agree

sterile token
#

Yes that is the problem i have now

lavish hemlock
#

teleport the block, or animate it moving?

#

Animating might take a bit more effort since that'd require armour stands afaik

sterile token
#

I asked prices for creating a custom component library lighweight and which support colors using &. And they told me around $60-80 with fully rights of course

young knoll
#

Falling sand

lavish hemlock
#

I could probably do that in a day

fickle mortar
lavish hemlock
#

Still possible

lavish hemlock
next plume
sterile token
#

Because the only issue i see on actual components are colors/styles, because i cannot directly call the method from ChatColor#translateAlternativeBlaBla() because you have 1 for bungee and 1 for spigot

lavish hemlock
#

It seems like what you want is probably just

#

Something to translate color codes to components

hazy parrot
sterile token
young knoll
#

I mean you can definitely do that with the existing apis

lavish hemlock
#

Well still

#

Bungee Chat API works on Spigot

#

Spigot API works on Bungee

sterile token
#

Yes i know that

lavish hemlock
#

So why does the platform matter?

young knoll
#

ChatComponent.fromLegacyText

#

Something like that anyway

sterile token
#

I explain what i refering

#

Let say i have the next component, in this case colors wont be translated if i dont call ChatColor#translateAlternative() from bungee/spigot dpeending the platform

TextComponent component = new TextComponent("&cMy awesome text");
player.sendMessage(component);
#

But that is my issue i need something like a unviersal ChatColor

hazy parrot
#

Translate just replaces & with other weird simbol

#

You can easily recreate that

young knoll
#

?javadocs-bcc

#

!javadocs-bcc

#

Am bad

sterile token
#

?jd-bungee

lavish hemlock
#

§

#

The section sign

young knoll
#

?jd-bcc

lavish hemlock
#

You just do
TextComponent.fromLegacyText("§cMy awesome text");

#

The constructor doesn't convert anyway

sterile token
lavish hemlock
#

Yeah, all it does is convert the legacy text into components

#

And both proxy and player support receiving components afaik

young knoll
#

And you can get the § symbol using translateAlternateColorCodes

fickle mortar
sterile token
young knoll
#

Why does that matter

lavish hemlock
#

I'm pretty sure Bungee supports ChatColor

young knoll
#

It’s part of the bungee api which is on both platforms

sterile token
#

Weird

lavish hemlock
#

Oh and actually yeah

#

There's a ChatColor in both Spigot and Bungee

sterile token
#

Once i imported ChatColor#translateAlternativeBla() from bungee and put the plugin in spigot and caused an exception

#

That is why i opened this dicussion

young knoll
#

Does it have a different fully qualified name on the two platforms?

sterile token
#

Do you know understand what i was asking about?

lavish hemlock
#

This should work just fine tbh

import net.md_5.bungee.api.chat.BaseComponent;
import net.md_5.bungee.api.ChatColor;
import net.md_5.bungee.api.chat.TextComponent;

// ...

public static BaseComponent[] makeComponent(String message) {
    String fixed = ChatColor.translateAlternateColorCodes('&', message);
    return TextComponent.fromLegacyText(fixed);
}
sterile token
remote swallow
#

yeah

sterile token
#

right i wil ltry that

regal scaffold
#

I have an iterator to remove crafting recipes but the problem is I want to remove all beds no matter what their color is. Do I have to just check for each one of the 16 beds?

#
        while (iter.hasNext()) {
            Recipe recipe = iter.next();
            if (recipe.getResult().getType() == Material.RED_BED) {
                iter.remove();
            }
        }
remote swallow
#

you might be able to check the material, if you can check if the toString varient contains BED

lavish hemlock
#

I've still never liked using legacy text over Bungee/Adventure components

#

It just feels like an unnecessary step personally

regal scaffold
#

Smart ebic, thanks

young knoll
#

Is there a tag for beds

remote swallow
#

no idea

#

one moment

lavish hemlock
#

Lemme check

remote swallow
#

there is

lavish hemlock
#

Nvm

remote swallow
#

use ```java
if (Tag.BEDS.contains(Material))

lavish hemlock
#

Thank god they added tags

#

Only took them ages :)

hazy parrot
#

what is tag

#

first time hear about it

remote swallow
hazy parrot
#

cool lol

remote swallow
#

just like a list type thing of anything Keyed

young knoll
#

Yeah it’s basically a fancy EnumSet

#

Well idk if it’s an enumset under the hood but yeah

lavish hemlock
#

I'm pretty sure you can modify tags so

#

It would likely read from resources

#

But if it stores it in an EnumSet?

young knoll
#

You can modify them with datapacks, Ye

lavish hemlock
#

Well, that's just good practice.

#

EnumSets are optimized for enums, lol

#

Who would've thought

remote swallow
#

john Enum

young knoll
#

Can’t wait until material isn’t an enum

remote swallow
#

same

#

whatever you do, dont crtl+z something with Material back in

lavish hemlock
#

You could probably retain binary compatibility even when changing Material to a class

young knoll
#

That’s the goal atm

#

There is a PR

lavish hemlock
#

Oh sweet

young knoll
#

If they didn’t care about binary compat it would probably have been done a while ago

lavish hemlock
#

Actually, wouldn't that bring Spigot closer to easily allowing mod/plugin bridges?

#

The main issue I've seen mod bridges face is that Material is an enum

young knoll
#

Probably

remote swallow
#

so many changes

lavish hemlock
#

I wonder wtf my stash login is

#

Welp

remote swallow
#

im gonna say its your jira login

lavish hemlock
#

I don't know what my JIRA login is either lmaooo

dusk flicker
#

lmao

#

my jira login autocompletes to the stash but the login doesnt work/i never set it up iirc

lavish hemlock
#

Beautiful

Bitbucket is unable to reset the password for your account because it is managed by a read-only external directory. Please contact your administrator to change your password.

remote swallow
#

someone call md

lavish hemlock
#

Let's see if that works for the Jira

#

Yes

regal scaffold
#

And lastly

remote swallow
#

pepegun sign it

regal scaffold
#

In the same iterator I'm removing recipes. If I wanna replace one for alternative of it. Example
I want to make copper ingots give a different copper block

lavish hemlock
#

You do not have permission to access Bitbucket.

#

Hmm

regal scaffold
#

Do I need to go through the process of creating a new item, namespacedkey, shaped recipe, etc?

#

Or can I do something with the iterator result straight away to just give a different material

lavish hemlock
#

Have I not signed the CLA??

#

I swear I did.

#

?cla

undone axleBOT
remote swallow
#

you can look at src code without an account but need an account + signing cla for pullrequests iirc

tender shard
young knoll
#

I have two accounts somehow

#

Only one has access

remote swallow
#

did you make 1 jira account and signed the cla

tender shard
#

I got 2 accounts too

remote swallow
#

then another and didnt sign the cla

young knoll
#

I think one uses my email and the other uses a username

lavish hemlock
#

How can I check if I've signed

young knoll
#

Idk

remote swallow
young knoll
#

It’s a shame stash doesn’t separate read and write perms for PRs

#

(That’s the reason you need to sign CLA just to view PRs)

lavish hemlock
remote swallow
#

have you got a jira account?

#

or just spigot

lavish hemlock
#

I've got a JIRA account

remote swallow
#

i dont get why those are seperate

lavish hemlock
#

Logged into it rn lmao

remote swallow
#

lol

lavish hemlock
remote swallow
#

if you cant acess stash prs you havent signed the cla

lavish hemlock
#

One is probably Xenforo and the other is JIRA

remote swallow
#

spijank

lavish hemlock
#

Okay

young knoll
#

Yes spigotmc is xenforo

lavish hemlock
#

Ahh okay I might've avoided signing it due to privacy

young knoll
#

But MD comes to visit you

#

Personally

lavish hemlock
#

THE md_5 AT MY DOOR!?

#

A dream come true

remote swallow
#

he is constantly flying all around the globe

lavish hemlock
#

Is that why he never talks in here

remote swallow
#

yeah

#

hes only here when hes in his car

next plume
#

The CLA:

young knoll
#

I though he travelled by kangaroo

remote swallow
#

md is secretly a pilot

remote swallow
#

he has to keep it hidden

#

so the spigotians dont steal it

lavish hemlock
#

A'ight time to read this agreement

#

The first legal document I've read

#

Besides homemade licenses

#

I like reading people's hacked-together licenses to find loopholes :)

next plume
#

Read the GPL. It will make your eyes bleed.

lavish hemlock
#

So, fun fact

#

Team CoFH has their own license

#

Not be a jerk**. Seriously, if you're a jerk, you can't use this code. That's part of the agreement.

remote swallow
#

mfao

#

lmfao

young knoll
#

I like the be gay do crime license

lavish hemlock
#

I'm a fan of the Hippocratic License

#

Although it's not as mature as something like MIT

#

(And probably not legally binding)

#

I often just license under MIT to say "I ain't liable for shit and this code is forever free-use, so if you need something fixed do it your damn self"

lavish hemlock
tender shard
sterile token
remote swallow
worldly ingot
#

Alex, your life confuses me lol

sterile token
remote swallow
#

choco was talking to @tender shard

hasty prawn
#

Verano you confuse everyone dont worry

remote swallow
#

most people here refer to people as their nickname

sterile token
regal scaffold
#

Do SortedSet().iterator().next() loop to the start of the SortedSet?

hazy parrot
#

yap, it will have ascending order

humble tulip
buoyant viper
humble tulip
#

Just made an easy 30$

#

Client wanted a http server to run config defined actions in mc

buoyant viper
#

o?

humble tulip
#

p

quaint mantle
#

how do i get all the chunks a player is loading or are loaded around a player?

#

in simulation distance.

humble tulip
#

Listen to the packets?

humble tulip
#

Protocol lib

#

Well yeah but a plugin can load a chunk

quaint mantle
#

and other players can load chunks too..

humble tulip
#

Exactly

quaint mantle
humble tulip
#

So either you get the chunk load distance and assume that those chunks around a player are loaded OR

#

Listen to when a chunk packet is sent to a player

#

Also check the distance though, if it's outside the server render distance, ignore it

quaint mantle
#

i will just compute it based on player position i guess

humble tulip
#

Why do you need that info?

quaint mantle
#

since i also need a to know when a chunk is no longer in a player's render distance

quaint mantle
# humble tulip Why do you need that info?

i am trying to store data on whether a player has the permission to do modify a chunk (break blocks, place blocks, take items from chests, and maybe killing entities).

#

and i was thinking of loading that ahead of time

#

to make sure that there is no lag

humble tulip
#

Store it in the pdc

quaint mantle
#

in case the player is using an elytra or something

humble tulip
#

Of the chunk

quaint mantle
#

pdc?

humble tulip
#

?pdc

quaint mantle
#

i am using a sqlite database to store this data, i am not storing this in chunk NBT or something like that

humble tulip
#

Or you can use the pdc to store which players jas which permissions

quaint mantle
#

keeping a separate file for the data might be convinient though but I might use this for other projects.

humble tulip
#

Up to you

quaint mantle
#

also, appreciate you telling me all this stuff!

#

so..

#

what is the efficient way of doing this?

#

is there an event that is fired when a player goes into a new chunk?

humble tulip
#

Nah

#

There's playermoveevent

#

You can prevent them frm entering a chunk

quaint mantle
#

does that get triggered whenever a player moves?

#

even when a player is being nudged by another player?

#

or is in a minecart or something like that?

humble tulip
#

?tryandsee

undone axleBOT
humble tulip
#

Not sure

#

Maybe both

quaint mantle
#

yeah i kind of need it whenever the player moves.

humble tulip
#

Are you making a chunk claim thing?

quaint mantle
#

yep.

humble tulip
#

Ah ok

earnest forum
undone ruin
#

quick question. in version < 1.17 the jar archive to enable the libraries is not a simple library but a Main class. How can I execute the Main class to get the libraries?

buoyant viper
#

?nms

undone ruin
sterile token
wet breach
buoyant viper
#

1 movement every second god that wouild suCK

#

its 20 movements a second i think

#

unless theyre idle?

#

then i think the client reduces its sendrate

wet breach
#

If the player is actively moving it will get sent every tick.

#

Otherwise if not moving from the client but moving by other means it is sent every 20ticks

warm light
#

how can I make an inv auto-update for all viewers when one viewer modify it?

chrome beacon
#

Open the same inventory for everyone

vital sandal
#

how can i use this class :l

#

PacketPlayOutEntityHeadRotation

#

no idea how Byte b is constructed

chrome beacon
#

Look at wiki vg or at how Minecraft uses the packet

vital sandal
#

:l no idea

#

tried

chrome beacon
#

that b() method also gives you an idea of what the values are

vital sandal
#

:l

#

could you tell me how to rotate the head with x yaw and b pitch ?

#

still confusing

earnest forum
#

plenty of tutorials on youtube for this type of thing

vital sandal
#

there is but i found nothing about PacketPlayOutEntityHeadRotation

#

they use Teleport for it :l

#

which is not that smooth

sullen marlin
#

Entity#setRotation?

earnest forum
#

its an npc

#

i assume

#

this tutorial uses it

#

i put a timestamp too

vital sandal
earnest forum
#

(byte) (yaw * 256/360)

#

for the second value

vital sandal
#

:l i mean there should be 2 right ?

#

one for yaw and pitch

remote swallow
earnest forum
#

that packet only does yaw

#

pitch is done by the teleport packet

#

its a bit weird but it is what it is

remote swallow
#

make a method to teleport them to the location gradually?

sullen marlin
#

I doubt teleport and head rotation are materially different

vital sandal
#

there is no change occur :l

sullen marlin
#

Maybe it doesn't work for players

quasi flint
#

get handle

#

returns the id?

#

of the entity?

vital sandal
#

it need entity ?

earnest forum
#

entity ID

#

its an int

quasi flint
#

it needs the entity id

#

because with that the client figures out what entity is ment

#

to rotate its head

vital sandal
#

i mean

quasi flint
quasi flint
vital sandal
#

how can i get that id in 1.17.1 ?

quasi flint
#

its a method

#

after getHandle

chrome beacon
vital sandal
chrome beacon
#

You don't need to

#

The constructor already does that

vital sandal
#

so why it doesn't run ?

quasi flint
#

couldnt you just send a teleport packet

#

where u change the yaw and pitch

#

and maybe that works

earnest forum
#

probably the only way

#

not even a packet just use the api to teleport the player

vital sandal
#

rotate != teleport

quasi flint
#

yes it is

#

just plug in the same x y z

#

but different yaw and pitch

earnest forum
#

the teleport method has a pitch and yaw argument

#

exactly

#

just plug in the players current x,y,z and only change yaw and pitch

vital sandal
#

:l you know the difference of teleport and running right ?

quasi flint
earnest forum
#

so you want it to smoothly rotate the player

vital sandal
#

rotate go from 3->4->5 not 3->5

earnest forum
#

?

vital sandal
#

yeh ?

quasi flint
#

well then