#help-development

1 messages ยท Page 1020 of 1

quaint mantle
#

in this

#
if (busca.fijado.containsKey(k.getUniqueId()) && busca.fijado.get(p.getUniqueId()) == 1) {
                        System.out.println("Se ha detectado un jugador en busca y captura.");
                        main.getEconomy().depositPlayer(k, 100);

                        new BukkitRunnable() {
                            @Override
                            public void run() {
                                busca.iniciarWanted();
                            }
                        }.runTaskLater(main, 160);
                        busca.quitarHash(p);
                    }
summer cape
#

Hello :D, I im trying to get a simple npc to working but its always sayes Caused by: java.lang.ClassNotFoundException: net.minecraft.server.level.ServerPlayer when i try to spawn it. I use 1.20.2 Spigot

short drift
#

It is broken.

#

And that's why it doesn't work.

summer cape
short drift
#

Have you tried reboting your computer?

summer cape
#

๐Ÿ‘€ no i dont restartet my pc yet

short drift
#

The issue is of course that no one can help you with that amount of information.

#

It's like asking "Why doesn't my car start?"

eternal oxide
#

you didn;t build againsdt 1.20.2 is my guess

#

or your server is not 1.20.2

summer cape
#

my server is 1.20.2 the file is called spigot-1.20.2

#

and i got it from the build tool

summer cape
zealous osprey
#

There's really a difference?

#

Does nothing happen when config is null when using ::?

eternal oxide
#

I would expect the lambda to consume the error

short drift
#

Does anyone know how to turn these numbers into ticks?

        { "predicate": { "time": 0.0000000 }, "model": "item/clock" },
        { "predicate": { "time": 0.0023330 }, "model": "item/clock_01" },
        { "predicate": { "time": 0.0046660 }, "model": "item/clock_02" },
        { "predicate": { "time": 0.0070420 }, "model": "item/clock_03" },
tender shard
#
public class Test {

    static class Config {
        boolean isValid() {
            return true;
        }
    }

    public static void main(String[] args) {
        Config config = null;

        try {
            Runnable lambda = () -> config.isValid();
            System.out.println("Lambda 1");
            lambda.run();
            System.out.println("Lambda 2");
        } catch (NullPointerException ignored) {

        }

        try {
            Runnable methodReference = config::isValid;
            System.out.println("Method Reference 1");
            methodReference.run();
            System.out.println("Method Reference 2");
        } catch (NullPointerException ignored) {

        }
    }
}

This will only print "Lambda 1"

eternal oxide
#

yep, lambda blows up with an NPE on teh class instance where a method reference blows up on method access

golden turret
#

i tried to update node, but it looks like something is not letting the updated file in /etc/profile.d to be executed

#

when i do source /etc/profile.d/nodejs.sh the path is added, but then i get 2 versions of node in the $PATH

grim hound
#

where can I find paper's source code?

#

the changes they made to craftbukkit

#

cuz my unholy magic

#

breaks paper

#

but not spigot

#

paper issues brah

eternal oxide
#

?wherami

grim hound
eternal oxide
#

missed an e

golden turret
#

?whereami

alpine urchin
grim hound
alpine urchin
#

ok

grim hound
#

and spread out a lot

alpine urchin
#

maybe re-organize it

#

to then show us

#

ive dealt with a lot of the craftbukkit changes

#

paper did

grim hound
alpine urchin
#

ok

grim hound
#

this overrides these

alpine urchin
#

Generally things to look out for is when you are attempting to find fields by name and find subclasses by name.

grim hound
grim hound
#

the thing that doesn't is when the player joins

worthy yarrow
#

@alpine urchin getting ready eh? haha

alpine urchin
#

yes

grim hound
#

and I suspect this

#

to be the thing causing paper to cry out loud

worthy yarrow
grim hound
#

cuz I change internals

alpine urchin
worthy yarrow
#

I know haha

blazing ocean
#

wait are you actually getting lessons from him

blazing ocean
#

thought it was just a joke smh

grim hound
blazing ocean
#

idk

alpine urchin
#

python lessons

blazing ocean
#

๐Ÿ’€

worthy yarrow
#

Actually asm

grim hound
#

brah

worthy yarrow
#

Even better

#

kek jk

grim hound
#

or did you mean assembly

worthy yarrow
#

More OOP concepts than anything

#

But yeah it's over java haha

#

And some packet lessons as well

worthy yarrow
#

If only there was a hottub ๐Ÿ˜ฆ

short drift
#

They are weird.

frozen tusk
#

could someone help me with coding this lockout plugin

#

but im new to coding this stuff and im trying to add an objective that is obtained when someone gets an advancement

worthy yarrow
#

Are you new to java?

frozen tusk
#

took ap java in school last year

#

so not exactly

worthy yarrow
#

So you're just needing to learn spigot api for the most part?

frozen tusk
#

yeah

#

ive probably put 5 hours into just trial and error on this if u could help me thatd be great

#

this is kind of what ive been messing with

worthy yarrow
#

Reason I'm asking is because you're not going to get like "help" with the plugin, rather just on particular problems, so my suggestion is to take to the jdocs and come back if it's a particular issue

frozen tusk
#

yeah

worthy yarrow
#

It's the

#

?xy

undone axleBOT
frozen tusk
#

this is a particular problem

rough drift
#

It's easy to tear into

worthy yarrow
short drift
frozen tusk
#

im trying to get it to detect when an advancemtent is completed

#

and give the player a point

worthy yarrow
#

?paste more code

undone axleBOT
frozen tusk
#

i think somethings wrong with the return, the method isDone might not be right?

worthy yarrow
#

And any errors

frozen tusk
#

no errors

#

just doesnt work

worthy yarrow
frozen tusk
#

this is with the advancement code taken away

#

just the running code for lockouts that i play with

worthy yarrow
#

well uh

#

what language is that kek

frozen tusk
#

idk ๐Ÿ’€

#

this is the og one i got it from

worthy yarrow
#

Gpt said its lua

frozen tusk
#

oh ok

worthy yarrow
#

mmm

ivory sleet
#

lua

#

Yea its lua

frozen tusk
#

thanks lemme look into lua stuff ill come back if im still having issues

#

unless someone knows lua

worthy yarrow
#

I only know java haha

frozen tusk
#

same

ivory sleet
#

Well I know lua as a language

worthy yarrow
#

^

#

I've heard of it rather

frozen tusk
#

is there like lua wiki or something

ivory sleet
#

Ru trying to learn lua, or whatever library uโ€™re using w lua?

frozen tusk
#

no

#

just trying to get this line of code to work

worthy yarrow
#

I'd just write that plugin yourself then kek

frozen tusk
#

but maybe ur right

worthy yarrow
#

yeahhhh but idk

frozen tusk
#

idk who wrote it originally or anything

worthy yarrow
#

I thought lua was like script language

#

Use that event

frozen tusk
#

yeah i tried that one

#

but its not l,ua

worthy yarrow
#

Write it in java

grim hound
#

the hell

#

does paper have a 7z file

#

in it's source code

#

AND IT'S TITLED SERVER-1.20.4.JAR

ivory sleet
#

yea

#

It should be a java archive file, unless????

worthy yarrow
frozen tusk
#

not much

worthy yarrow
#

Do you know how to handle events

frozen tusk
#

just went through the wiki for a while trying a bunch of stuff

frozen tusk
#

and the other one

worthy yarrow
tardy flame
frozen tusk
#

oo ok i havent tried onAdvancement

#

will do thanks

worthy yarrow
#

onAdvancement is just the method name

#

has no relation to the function

grim hound
#

@ivory sleet

worthy yarrow
#

Except for the name convention

grim hound
#

do you know where I can find the paper implementation of the PlayerList class?

ivory sleet
#

well, I assume you use paperclip or like yk, either fork paper, or use paperweight gradle plugin to get the dependency in ur project

frozen tusk
#

like would it just be for example, Advancement.SNIPER_DUEL

#

?

ivory sleet
#

event.getAdvancement() gives you and Advancement object

#

That thing is Keyed so you can call getKey() on it which yields a NamespacedKey

frozen tusk
#

oh

#

so how do I make sure its the right advancement im calling?

ivory sleet
#

I assume you wanna check which advancement was just done?

frozen tusk
#

well thats step one ig

ivory sleet
#

well I think a simple if statement should do the trick

worthy yarrow
#

We like to do guard clauses here :p

ivory sleet
#

Yea well if the event callback grows then its appropriate to consider keeping indentation levels low

frozen tusk
frozen tusk
#

but idk where to implement the actual advancement

#

sorry btw im super new to lua and bukkit

worthy yarrow
#

snap now I forgot

#

What's the name of the advancement? Can't you get it by string (name)

frozen tusk
#

one i was trying to do was sniper duel

#

in 1.18 its like snipe_skeleton or something but 1.20 its sniper_duel i believe

worthy yarrow
#

There's #getType() but I'm not sure if that'll get you the actual advancement

#

I haven't done really anything with vanilla advancements, just my own quests system

frozen tusk
#

@ivory sleet

#

aw

#

i cant send screenshots

tardy delta
#

?img

undone axleBOT
#

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

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

frozen tusk
#

@ivory sleet

#

getAdvancement isnt workin but

#

.advancement runs

charred blaze
#

is it possible to rotate display entity around some axis?

eternal oxide
#

yes

ivory sleet
frozen tusk
ivory sleet
#

Wait I thought u switched over to a java plugin

frozen tusk
#

no

#

still trying the lua

ivory sleet
#

cuz I have no clue how that plugin handles java to lua interoperability

frozen tusk
#

yeahhhh

#

whatever thanks for helping anyway

ivory sleet
#

Does the plugin dev have any discord or something such that you can contact em?

frozen tusk
#

good idea i could look

grim hound
#

what do I add to access the craftbukkit implementations?

#

from paper

river oracle
#

Ask paper

grim hound
#

can't

river oracle
#

They have forums too

grim hound
#

they banned me

rough drift
#

lmao average paper

river oracle
#

Shouldnt have gotten banned then

quaint mantle
eternal oxide
#

If you are not careful you may end up banned here too

ivory sleet
rough drift
#

switch to Spigot for a better experience trust

grim hound
ivory sleet
#

@grim hound ^^

rough drift
river oracle
grim hound
quaint mantle
short drift
#

The Minecraft community has legendary level of toxicity.

grim hound
eternal oxide
grim hound
rough drift
ivory sleet
#

isnt that on spigot too also a bit? ๐Ÿฅฒ

rough drift
#

paper outright breaks things

#

spigot doesn't do that as much

ivory sleet
#

I presume thats true

river oracle
#

They chose to deviate on stuff long ago

ivory sleet
#

yea true

eternal oxide
#

I've not played vanilla enough to tell the difference

rough drift
#

basically

#

technical & redstone related changes (usually you don't see as much of an impact if you're not using automation)

quaint mantle
rough drift
#

I can't use half of the technical redstone builds

#

Mfw

#

Paper applies insane defaults

#

Mfw

#

Paper feels like releasing untested builds

#

I can go on

#

want me to go on?

quaint mantle
ivory sleet
#

eh I feel like we get ur point ike

eternal oxide
#

hol up I'm still googleing Mfw

rough drift
grim hound
#

well that's interesting

rough drift
grim hound
#

then why do incorrect packets still throw errors?

#

player just sends a fucked up packet

#

the server panicks

#

and you can easily crash it with that

rough drift
#

it's paper, they "fix" "issues" that nobody cares for

quaint mantle
ivory sleet
#

maybe we could at least move this paper debate to general? :^)

grim hound
#

xD

short drift
#

Yes. And I hate Java!

rough drift
#

awie

rough drift
quaint mantle
short drift
#

I was just trying to join the conversation.

ivory sleet
rough drift
ivory sleet
#

man what did Java do to you?

rough drift
#

now help me rewrite the JVM

ivory sleet
#

Its amazing!

quaint mantle
# ivory sleet Its amazing!

i swear to god if now some kotlin maniac comes around and says "no, we don't have these issues here kotlin is way more better you just can't read that shit"

ivory sleet
#

lol

icy beacon
#

hello

#

did somebody say Kotlin

chrome beacon
short drift
#

I would jump at the chance to use C# with Minecraft.

icy beacon
#

look at this function signature ๐Ÿ˜

  private suspend inline fun <reified T> downloadAndParse(
    crossinline downloadCallback: suspend BackendAPI.() -> Response<ResponseBody>,
    crossinline inputCallback: suspend (InputStream, String) -> File
  ): Pair<T, File>? = coroutineScope {
blazing ocean
#

i have been summoned

icy beacon
#

it's actually even more fun, this is an old snippet

icy beacon
#

didn't try, don't want to lol

ivory sleet
blazing ocean
# icy beacon didn't try, don't want to lol

chatgpt

public class MyClass {

    public interface DownloadCallback {
        Response<ResponseBody> download(BackendAPI backendAPI) throws Exception;
    }

    public interface InputCallback {
        File process(InputStream inputStream, String string) throws Exception;
    }

    public static class Pair<K, V> {
        private final K key;
        private final V value;

        public Pair(K key, V value) {
            this.key = key;
            this.value = value;
        }

        public K getKey() {
            return key;
        }

        public V getValue() {
            return value;
        }
    }

    public <T> CompletableFuture<Pair<T, File>> downloadAndParse(
        BackendAPI backendAPI, 
        DownloadCallback downloadCallback, 
        InputCallback inputCallback
    ) {
        return CompletableFuture.supplyAsync(() -> {
            try {
                Response<ResponseBody> response = downloadCallback.download(backendAPI);
                InputStream inputStream = response.body().byteStream();
                String contentType = response.headers().get("Content-Type");
                File file = inputCallback.process(inputStream, contentType);
                // Assuming some method parseResponse to convert InputStream to T
                T parsedObject = parseResponse(inputStream);
                return new Pair<>(parsedObject, file);
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
        });
    }

    private <T> T parseResponse(InputStream inputStream) {
        // Implement the logic to parse InputStream to T
        return null;
    }

    // Define BackendAPI class or interface as needed
}
quaint mantle
icy beacon
#

I'm on my phone so I don't have access to the actual code rn but it defo looks simpler lol

grim hound
#

okay

#

I am lost

#

in gradle

remote swallow
#

gradle ez

grim hound
#

here

#

"paperweight" is supposed to be a var but it ain't defined anywhere

#

the hell

floral drum
#

hi nerds

remote swallow
#

paperweight is an extension from the userdev function

remote swallow
#

if you use groovy gradle it wont have intellisense if you use gradle kotlin it will

grim hound
#

uhhhhhh

quaint mantle
grim hound
#

do I remake it?

remote swallow
#

no you can just rename it

#

is ur file build.gradle or build.gradle.kts

grim hound
#

ye

remote swallow
#

reload gradle

#

and make sure ur settings is settings.gradle.kts too

grim hound
remote swallow
#

thats correct just make sure its file name is correct

grim hound
#

gradle sure takes its time on reloads

remote swallow
#

its downloading paper and patching the server

#

or well downloading the dev bundle, extracting it and patching the mc server to give you nms

grim hound
#

oh nice

remote swallow
#

normally a reload wouldnt take more than like 10-15 seconds

grim hound
#

yooo it even deobfuscated the file

#

damn, now that's a hassle

#

this number can't be negative

#

it relies on the fact that at least one player must exist (since they just added him)

#

and I prevent that from happening

#

damn

grim hound
#

I can't even be mad at paper for writing terrible code

#

cuz this is logical

#

damn

grim hound
alpine urchin
#

XD

celest wadi
#

troooop

wet breach
#

@alpine urchin your favorite person is back

celest wadi
#

@wet breach u were one of my favorites too dont forget that

wet breach
#

o.O

#

probably shouldn't tell simple

celest wadi
#

uh oh did i step between something

alpine urchin
#

ma BOY

#

i been lookin for you

#

First day out, how's it feel like

celest wadi
#

lmaoo feels pretty good to be back

#

i like this community

wet breach
celest wadi
#

beef in the spigot discord ๐Ÿ˜ฎ

#

wsg miles

river oracle
#

@celest wadi what possessed you to come back

celest wadi
#

lost my life again

river oracle
#

you could have lived a happy life, yet you came back anyways ๐Ÿฅฒ thank you for your sacrifice

celest wadi
#

yup yup ofc! my duty

river oracle
#

u any good at csgo?

celest wadi
#

uhm no

river oracle
#

oh then let us play together sometime

wet breach
#

this is how you know they are not from russia

river oracle
#

lol fr. I was playing wingman with my friend the other day we played against someone with a russian name. It was over before it started :(

wet breach
#

lol

#

however as much as I want to say a good lot of them have skills unfortunately most turn to cheating just like the chinese players do XD

celest wadi
#

my current project is an injector for cheats

river oracle
#

wow that's great!

celest wadi
river oracle
#

don't these cheat injectors gotta work at like ring 0 kerenel level

#

pretty sure that's when most ACs start nowadays

celest wadi
#

yea well for bigger games this wont work unless i detect AC threads and bypass their methods of detection

#

the man module works for some bigger games

#

i will write a kernel driver in the future, its supposed to be really easy with rust

wet breach
river oracle
#

the one I think of off the top of my head, well 2. Is genshins anticheat and vanguard

#

though I believe vanguard is more infamous

celest wadi
#

yea i thought i heard vanguard was kinda shit

wet breach
#

all anti-cheats suck

#

I never heard of one that was actually good

river oracle
#

well yeah anti cheats are just a horse race pretty much

wet breach
#

the only way an anti-cheat could be good is if it literally hijacks your system and essentially becomes malware

icy beacon
celest wadi
#

bio real

wet breach
icy beacon
celest wadi
#

almost! 3 times

wet breach
#

yeah see, didn't die

icy beacon
#

i was aware that imajin was present (i think someone sent a roblox profile screenie) but i thought they'd never return to the discord server

quiet ice
#

Okay, who's disappearing next?

icy beacon
quiet ice
#

no, that's just the cycle of life

#

Everything needs to be balanced

celest wadi
#

yup

tardy delta
#

cool

young knoll
#

How does one find their life and then lose it again

#

Just curious

tardy delta
#

good to have you back soldier

wet breach
alpine urchin
#

@wet breach thanks for informing me of the arrival

#

of our brethren

wet breach
#

I only assumed

#

seems I was correct

alpine urchin
#

based on what

#

is my question

wet breach
#

nothing in particular just a feeling that you would like to know they were back

alpine urchin
#

sounds like a miracle

celest wadi
#

console output, will reduce to .paste ^: ```
[] Image base: 180000000
[
] Image size: 21000
[] No. of sections: 5
[
] Allocating memory in the target process..
[] Requires base relocation: true
[
] Rebasing..
[+] Allocated 20480 bytes of memory at 230A0FA0000
[*] Copying payload sections..
[-] Section .text @ virtual address 1000
Current rebase addr: 230A0FA1000
Max address: 230A0FA5000
Error: Failed to write to target process memory! Address: 230A0FA1000, last error: 299

blazing ocean
#

sir

#

this is spigotmc

#

not some rust thing

tardy delta
#

win32 scary

celest wadi
#

not when im here

#

or redempt but she gone

blazing ocean
celest wadi
tardy delta
#

what naming conventions?

#

im already happy if i dont have to see LPVOID

celest wadi
#

i think windows just says fuck conventions but for all the rust code im using lower_snake_case

blazing ocean
tardy delta
#

i love it

blazing ocean
tardy delta
#

wait

#

i thought you meant snake case

#

glad you dont have ada case

#

Bit_Set

celest wadi
#

jesus christ

celest wadi
wet breach
#

no

celest wadi
#

something like that

blazing ocean
wet breach
#

its erroring on partial write because you failed to give a pointer to a buffer of the data you intend to write

tardy delta
#

what partial write

celest wadi
#

thats weird because the buffer is being constructed just fine

#

i gotta be passing it wrong somehow

wet breach
#

well the buffer should be the third argument

#

well pointer to the buffer that is

tardy delta
#

299 (0x12B)

Only part of a ReadProcessMemory or WriteProcessMemory request was completed.

wet breach
#

that is what I said

late sonnet
#

some advise....
for a thing like

public enum TypeCat {
  NONE(-1),
  BLACK(1),
  WHITE(2);

  // THE METHODS AND ETC...

  public static TypeCat ofA(int value) {
     return switch(value) {
        case 1: BLACK;
        case 2: WHITE;
        default: NONE;
      }
  }

  public static TypeCat ofB(int value) {
      for (TypeCat tc : values()) {
        if (tc.getValue() == value()) {
          return tc;
        }
      }
      return NONE;
  }
}

what "of" is "better"?

tardy delta
#

for extensibilty, id use b

wet breach
#

but rarely that ever happens

celest wadi
#

2nd is better imo

tardy delta
#

do you know those codes out of your head?

ivory sleet
wet breach
#

actually no, I encountered 299 not that long ago

#

like maybe last year it was

#

forget what it was I was doing ๐Ÿ™‚

tardy delta
#

suffering from win32

wet breach
#

but sometimes I do have this stuff memorized XD

late sonnet
ivory sleet
#

ofB is nice if u consider future enum constants

warm galleon
#

hello, can someone help me with a bug I found in the lootcrate plugin

tardy delta
#

if only we had TryFrom in java

ivory sleet
#

Well Doc and the option of having a static array or int map that runs in a static initializer caching all the values for later lookup?

#

Or is that too much

late sonnet
# ivory sleet Well Doc and the option of having a static array or int map that runs in a stati...
GitHub

Discord4J is a fast, powerful, unopinionated, reactive library to enable quick and easy development of Discord bots for Java, Kotlin, and other JVM languages using the official Discord Bot API. - D...

GitHub

Discord4J is a fast, powerful, unopinionated, reactive library to enable quick and easy development of Discord bots for Java, Kotlin, and other JVM languages using the official Discord Bot API. - D...

tardy delta
#

real man calls valueOf and suffer

ivory sleet
#

Ah alright, but presumably api consumers never have to call the โ€œstatic factoryโ€ method themselves?

alpine urchin
#

did u come here

#

cause u wanted

#

support

#

@celest wadi

celest wadi
#

no lol

late sonnet
ivory sleet
#

hmm, I mean if thatโ€™s strictly gonna be the policy by intention, I think ofA is nicer, as long as its leaning more towards existing back in the implementation layer, riight??

late sonnet
ivory sleet
#

Yea well thats my opinion on it, ofA is nicer and well somewhat faster, if its not gonna be touched by api consumers, else ofB. :)

late sonnet
ivory sleet
#

:^)

vague swallow
#

Can someone tell me why this throws a NullPointerException?:

   ItemMeta meta = item.getItemMeta();
   meta.setUnbreakable(true);```
young knoll
#

?stacktrace

undone axleBOT
vague swallow
#

Well it says that meta is null fsr

young knoll
#

Then the item is air

vague swallow
#

OOOOOH

#

thanks

quaint mantle
#

Bruh

willow girder
#

I'm looking for devs for my MC server, anyone interested? (Coding plugins and scripts) DM me

undone axleBOT
willow girder
celest wadi
#

paid services for development

icy beacon
#

I've finally finished backing up my stuff after like 2 hours

#

It's 2:30 am and I'm about to install fedora

tardy delta
#

:o

wet breach
twin venture
#

Hi there , i need help with world edit & fawe

#

i have both core and bukkit

remote swallow
#

fawe provides world edit

#

and use the correct fawe dep

brittle geyser
#

How correctly manage database connection with Jooq and HikariCP?

#

For example i have this code:

@SneakyThrows
    @Override
    public int execute(@NonNull String sql) {
        return dslContext.execute(sql);
    }
@Override
    public void createConnection() {
        this.dataSource = new HikariDataSource();
        this.dataSource.setJdbcUrl(url);
        this.dataSource.setUsername(settings.username);
        this.dataSource.setPassword(settings.password);
        if (settings.properties != null) {
            settings.properties.forEach(this.dataSource::addDataSourceProperty);
        }
        this.dslContext = DSL.using(this.dataSource, getSQLDialect());
        if (StringUtil.isNotEmpty(tableSQL)) {
            execute(tableSQL);
        }
    }
#

Will DSLContext auto close?

#

Or i need to close connection on plugin disabling?

twin venture
tardy delta
brittle geyser
remote swallow
#

you always set it

#

and you always set the data for it

#

unless create connection is only called once then its fine

brittle geyser
#

not always man

#
protected AbstractDatabase(@NonNull Plugin plugin, @NonNull String url, String tableSQL, @NonNull DatabaseSettings settings) {
        this.plugin = plugin;
        this.url = url;
        this.tableSQL = tableSQL;
        this.settings = settings;
        createConnection();
    }
gentle inlet
#

?paste

undone axleBOT
brittle geyser
#

How to close connection correctly to reload connection?

#

or i can just create new connection if i need to reload it?

icy beacon
#

2:50 am I'll go to bed i think

quaint mantle
#

Damn bro you got same time as me

icy beacon
#

wya?

quaint mantle
#

Exactly 2:50 for me

icy beacon
#

yeah where you at

#

?

twin venture
quaint mantle
icy beacon
twin venture
#

soi they is no maven version that support 1.16.5 < and backwards ?

icy beacon
#

anyhow goodnight

#

i'll configure this thing tomorrow

gentle inlet
#

Hi can anyone help me with my plugin I am coding this is my first kinda big plugin so pls don't judge and don't say How i could tidy it up or put some thing in different classes. So anyway I feel like my test server is getting bad performance with this plugin enabled can anyone see anything obvious that is causing performance issues I think it might have something to do wtih the task scheduling but idk. Thanks

WardenRelics(Mail File): https://paste.md-5.net/rovuxokegi.java
RelicManager: https://paste.md-5.net/qogipeheli.java
Relic Of Travel(An example of one of the relics): https://paste.md-5.net/erayepefac.cs

prisma jolt
#
package me.buster.namethatitem;

import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;

public class NameThatItemPlugin extends JavaPlugin implements Listener {

    @Override
    public void onEnable() {
        getServer().getPluginManager().registerEvents(this, this);
        getLogger().info("NameThatItem has been enabled");
    }

    @Override
    public void onDisable() {
        getLogger().info("NameThatItem has been disabled");
    }

    @EventHandler
    public void onPlayerChat(AsyncPlayerChatEvent event) {
        String message = event.getMessage();
        Player player = event.getPlayer();

        if (message.contains("[item]")) {
            ItemStack item = player.getInventory().getItemInMainHand();
            String itemName = item.getItemMeta().getDisplayName();
            if (itemName == null || itemName.isEmpty()) {
                itemName = item.getType().name();
            }
            message = message.replace("[item]", itemName);
            event.setMessage(message);
        }
    }
}
#

I am trying to make the replaced message have a hovering part to show an items lore

#

Could I get some help please

#

I've gotten lost in a lot of areas

tardy delta
#

what works?

prisma jolt
#

What do you mean?

tardy delta
#

gonna give you a hint, just sending the item name wont do anything, loop over the recipients and do Player::Spigot::sendMessage with a Component of some sort (see ComponentBuilder)

#

dunno if theres a newer approach already

gentle inlet
tardy delta
#

the server will not give you the same ItemStack instance back (CraftItemStack and stuff), just write a wrapper for it

carmine mica
carmine mica
#

they don't support the new 1.20.6 item format

#

then you should be able to use the bungee-chat components

#

should be an example of use on the spigot wiki

torn shuttle
#

I sure have one of the communities of all time

young knoll
#

Damn smart and hot?

dawn flower
torn shuttle
#

haters gonna hate

strange crest
#

how i set the min and max ram in 1.20.6 version

#

'?

#

??

drowsy helm
dawn flower
#

Xms = min, Xmx = max

strange crest
#

yes but i dont have a start sript

#

i have to create one?

drowsy helm
#

every server has a start script

#

how are you running your server?

strange crest
#

click on the java 1.20.6 ion

#

i remember use a script in the 1.20.4 version

#

o mean for the ram

drowsy helm
#

didnt even know you could do that now lol

#

yeah make a script

dawn flower
#

does that mean it uses 0gb ram

#
java -Xms1G -Xmx2G -XX:+UseG1GC -jar server.jar -nogui pause
strange crest
#

programming is so complicated

dawn flower
#

at least it's not like how it used to be...

carmine mica
#

programming

strange crest
#

now i remember

#

we have to create the start script?

dawn flower
#

make this a .bat file if ur on windows

#

idk whats the linux one

strange crest
#

i did it some times now i remember

#

y was opnening my server with the java file

#

1.20.6

#

XD

dawn flower
#

to make it linux just remove the pause

drowsy helm
#

.sh for linux

dawn flower
#

๐Ÿคฏ

#

fr?

drowsy helm
#

idk if ur being sarcastic

dawn flower
#

i am

drowsy helm
dawn flower
#

i meant the start script

#

actually why even use an operating system for a server

#

wait how are you gonna start da server then

dawn flower
#

how would i make a cube shaped particle

#

to cover this guy fully (in particles)

celest wadi
#

@wet breach so the issue was i was writing too much at once, had to write it as a buffer but now im getting an error towards the end of the buffer (998)
https://paste.md-5.net/uyizecafec.cs

[*] Image base: 180000000
[*] Image size: 21000
[+] Allocated 65531 bytes of memory at 1F4337E0000
...
[*] Wrote 4096 bytes.
[*] Wrote 4096 bytes..
Error: Failed to write to target process memory! Address: 1F4337E1000, last error: 998
wet breach
#

need to run program as admin

celest wadi
#

god im so dumb

#

thanks man

wet breach
#

also

#

you need to wrap WriteProcessMemory() with a call to VirtualProtectEx().

#

its not always needed, but helps ensures you don't encounter more issues with it

celest wadi
wet breach
#

nice, I suspect its something simple

celest wadi
#

yup me too

#

gonna push this to the repo so i dont lose my progress in the future, you can take a look at the shellcode function if u want

grim hound
dawn flower
#

then?

grim hound
#

And after you get their max and min points

#

You know

#

Do whatever you like

dawn flower
#

ok

grim hound
#

I also just yesterday completed q particle packet sending optimization

#

Sending time of 600 particle packets

dawn flower
#

ur optimizations

#

are insane

grim hound
#

(Requires PacketEvents)

grim hound
dawn flower
#

what does that do tho

grim hound
dawn flower
#

i mean alixsystem

grim hound
#

Oh

#

Wait a sec amma find the image

grim hound
dawn flower
#

what the flip is that

grim hound
#

This is the old look but it looks fine

grim hound
#

It's an antibot

#

And login system

dawn flower
#

it's antibot but bots can solve most captchas

grim hound
#

For spigot/paper servers

grim hound
#

But nothing I found online bypasses this yet

dawn flower
#

is this a 0 or an 8

grim hound
#

Cuz bots don't use graphicals

grim hound
dawn flower
#

dead srs?

grim hound
#

Txw96

dawn flower
#

i couldn't eveen solve that...

grim hound
dawn flower
#

ah

grim hound
#

Since I have no recent screenshots on my phone

wet breach
grim hound
#

Yeah I meant those

wet breach
#

not that it would be hard

#

all that needs to be done is to take a screenshot and then look at the pixels

grim hound
#

I don't exactly know how to make an unbypassible captcha

wet breach
grim hound
#

And bot attacks are possible because you send a lot of non-expensive bots

wet breach
#

as long as you have enough puzzles and routinely change them out or alter them

grim hound
wet breach
#

you can't really make a bot to automate it

grim hound
#

4x4 maps

#

And select all maps with the image

#

xD

#

Google captcha

grim hound
#

Or maybe I could add more

#

I thought of making the same captcha as github

#

Like "point these two in the same direction"

#

But how am I supposed to generate high-quality, random 3d objects?

#

Not to mention that bypasses for that are probably already present

potent atlas
#

Hi guys, coding another plugin. This is my first time using packets. It is not working at all, I just need a push in the right direction. I've been googling and watching tutorials all day and sadly many are outdated. Does anyone have example code I could look at? I am trying to make chests open silently and without animation if the player is vanished. I can show what I have if anyone's interested, but at this point I could really just use an example snippet. Thanks!

tardy flame
#

You could just cancel event and get the inventory from block

#

No need for packets i guess

potent atlas
#

Yes, I just want the vanished player to be able to edit the chest and at the same time as other players.

#

I heard that doing that without packets dupes items.

tardy flame
#

Yeah the inventory isn't updated

potent atlas
#

By the way I'm using ProtocolLib

#

I have the latest dev build

drowsy helm
#

What have you tried so far and at what point isnt it working?

potent atlas
#

So, I literally copy-pasted a tutorial code into my plugin and even that doesn't work. Absolutely nothing happens when I open/close the chest and nothing shows in console.

#

Would you like to see my code?

#

I double checked that protocol lib and my plugin are indeed enabled and up to date :/ so I think I'm missing something at the beginning of handling protocol lib such as creating the manager incorrectly or something

grim hound
#

There's no reason to be using PL with PE around

potent atlas
#

Alright I'll look into that right now

#

Thank you!

tender shard
wanton comet
#

Does someone have any resource on making npcs in 1.20.4 the most easiest way

#

since the protocol changed in 1.20.2 the old method doesnt work

chrome beacon
#

Just use Citizens

molten hearth
#

does anyone know what the fuck these letters mean

#

surely its not the obfuscated packet names

#

the logger wouldnt do that to us would it ๐Ÿ˜ญ

young knoll
#

Probably

molten hearth
#

SIGH

#

MOJANG WHYYYY

#

(โ•ฏยฐโ–กยฐ)โ•ฏ๏ธต โ”ปโ”โ”ป

remote swallow
#

(๏พ‰เฒฅ็›Šเฒฅ๏ผ‰๏พ‰ๅฝกโ”ปโ”โ”ป

wet breach
molten hearth
#

i mean im just using the obfuscation mappings

wet breach
#

in fact I believe they even have a bot that helps with updated versions

molten hearth
#

they also have a discord

#

but im not following the mc login sequence im trying to implement it

brazen badge
#

So, I need some help with something. I have to create an enum class like EntityType, but the values change based on the files in the folders. How can I do that? Actually, I don't even think it's possible. I'll give you an example: in a folder, there's a file called try.yml and another one called join.yml. The player can create a file in-game, which will then be added to the list. Each enum is the name of the file.

young knoll
#

Donโ€™t use an enum

#

Use a registry

remote swallow
#

discord helper registry when

brazen badge
#

OK, but how do I implement it? Let me explain. I am creating a gui with pages using Foundation, but it requires a T parameter, because pagination is automatic based on how many items make up the gui.

worldly ingot
young knoll
#

Well yeah

worldly ingot
#

Or a Map<String, YourObject>

remote swallow
#

thats not a list

worldly ingot
#

Whichever you need

young knoll
#

Or a set if thereโ€™s no duplicates!!!!111

eternal night
#

Have you considered a Queue?!?!?

worldly ingot
#

What is this? The UK?

young knoll
#

Best I can do is Dequeue

eternal night
remote swallow
#

someone chuck People.get("ebic_dev").kill in a q pls

worldly ingot
#

Real Deque users would know it's a Deque

remote swallow
#

its not a deck is a de-queue

young knoll
#

Ah feck

#

Iโ€™ve been exposed

worldly ingot
#

Actually it's pronounced "deck"

#

The Javadocs actually say so

remote swallow
#

dont care

worldly ingot
#

Which you would know if you're a true Deque user

remote swallow
#

javadocs wrong

#

embrace dequeue

worldly ingot
#

Get it right noob

remote swallow
#

i said javadocs wrong

young knoll
#

For a long time I though queue was pronounced q-wen

thin jasper
#

...

remote swallow
#

wrong channel

worldly ingot
thin jasper
#

no one ever answers

worldly ingot
#

Maybe nobody knows the answer

remote swallow
#

you asked 1 minute ago

worldly ingot
#

Or that lol

thin jasper
thin jasper
remote swallow
#

no one here is paid to answer the questions

young knoll
#

Too lazy to do what, google it?

#

You could also google it

#

Idk why you assume we have the answer but just donโ€™t want to share it

remote swallow
#

are you telling me we dont know every spigot plugin in existance

worldly ingot
#

If it's not a hard question... why can't you figure out the answer yourself? aPES_Think

remote swallow
#

he wants you to slide the hypixel plugin over

#

dead drop usb it

thin jasper
thin jasper
young knoll
#

We mostly know programming stuff

remote swallow
lost matrix
wanton comet
lost matrix
clear elm
#

i wanted to ask why i get a difernet color then the color i gave

        button.setClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/tptoggle"));
        TextComponent text = new TextComponent(" ยง7or type " + ChatColor.of("#2F6EFB") + "/tpaccept " + p.getName());
        ptp.spigot().sendMessage(button, text);```
at the normal .sendMessage() it works
eternal oxide
#

NPC's are annoying as Mojang keep changing the constructor for ServerPlayer

lost matrix
#

Yeah true. But what really bothered me was that i had to spoof the connection for the player info packet -.-

eternal oxide
#

in current version yeah

clear elm
eternal oxide
#

also all the damage stuff seems to have moved. Not bothered looking for it

#

like DamageSource.isBypassArmor() no longer exists

wanton comet
clear elm
young knoll
#

If you are going to be using legacy color codes like that

#

You should use TextComponent.fromLegacyText

clear elm
#

okay ty

young knoll
#

Or just use components properly :p

lost matrix
#

It bothers me that PotionEffect has no static deserialize method -.-

lost matrix
spice burrow
slender elbow
dry forum
#

https://imgur.com/GOw5Az8

https://pastebin.com/zuuRXa4p

so in the picture u can see that the 2 chat bubbles with 1 line of text have the same amount of spacing between them, but when a player types something longer the chat bubbles spacing isnt the same, i want the spacing to be the same between all chat bubbles no matter how long it is and idk how to really fix that ive been stuck for like an hr now

eternal oxide
#

you are probably not counting lines corretly so your multiplier is wrong

dry forum
#

the lines are correct i have smthn broadcasting it and its right

agile plover
#

Hey, I'm trying to cancel the ServerboundContainerClickPacket, the issue is whilst the packet is theoretically being cancelled, it doesn't quite act the way I want it to act. My goal is to make sure that when I click on an item, instead of picking it up, it will go back to the original spot same way as when cancelling the InventoryClickEvent

This is what actually happens when I cancel the ServerboundContainerClickPacket:
https://imgur.com/GO36rGs

If anyone has any suggestions please let me know

young knoll
#

I think you need to update the client manually

#

I would check to see what CraftBukkit does when the event is cancelled

drowsy helm
#

Why do you have to cancel the packet?

#

Cancelling the event has the same effect

agile plover
drowsy helm
#

The packet youโ€™re canceling is only sent to update the server

agile plover
drowsy helm
#

Itll stay the same clientside

#

So youd need to send a packet to the player to set the inventory contents again

wanton comet
drowsy helm
#

You have to create a dummy connection receiver ( I forget the class name)

agile plover
drowsy helm
#

I assume they send a packet back

wanton comet
agile plover
spice burrow
# agile plover Hmm alright that makes sense. I was trying to fix by opening the inventory again...

not sure how well made this is, but it works for my purposes

public class DummyConnectionHandler extends ServerGamePacketListenerImpl {
    public DummyConnectionHandler(MinecraftServer minecraftserver, PacketFlow networkmanager, ServerPlayer entityplayer, CommonListenerCookie commonlistenercookie) {
        super(minecraftserver, new DummyConnection(networkmanager), entityplayer, commonlistenercookie);
    }

    @Override
    public void send(Packet<?> packet) {
        // empty because we don't want to send packets as this is a fake connection
    }
}
#

DummyConnection just extends Connection from NMS (seems redundant now that i think of it)

public class DummyConnection extends Connection {

  public DummyConnection(PacketFlow enumprotocoldirection) {
    super(enumprotocoldirection);
  }
}
drowsy helm
#

Check if the characters are past the overflow threshold then add .5 vertical if they are

#

Sorry was meant to reply to hanalaz

wanton comet
#

np

wanton comet
#

setting the field with reflection?

lost matrix
spice burrow
#
DummyConnectionHandler dummyConnection =
          new DummyConnectionHandler(
              server,
              PacketFlow.CLIENTBOUND,
              guard,
              CommonListenerCookie.createInitial(npcProfile));
#

(guard was my npc)

      ServerPlayer guard =
          new ServerPlayer(server, level, guardProfile, ClientInformation.createDefault());
lost matrix
# wanton comet yes

Then just set the connection of it to a new instance of DummyConnection. Its a public field in ServerPlayer.

wanton comet
young knoll
#

You can also just set the connection to an existing players connection

spice burrow
#

yea... thats to send the packet of the npc once everything has been done with it, heres an example from mine. mind you this is right as I was learning spigot so it might be dodgy

 serverPlayer.connection.send(
          new ClientboundPlayerInfoUpdatePacket(
              ClientboundPlayerInfoUpdatePacket.Action.ADD_PLAYER, guard));
      serverPlayer.connection.send(new ClientboundAddEntityPacket(guard));
lost matrix
#

That might be a decent way to leak memory smileybolb

onyx fjord
#

does removing recipients from asyncmessageevent prevent them from receiving the message?

tardy delta
#

yes

drowsy helm
#

Indeed

tardy delta
#

wait

The set returned is not guaranteed to be mutable and may auto-populate on access

drowsy helm
#

The set returned is not guaranteed to be mutable and may auto-populate on access. Any listener accessing the returned set should be aware that it may reduce performance for a lazy set implementation.

Listeners should be aware that modifying the list may throw UnsupportedOperationException if the event caller provides an unmodifiable set.

slender elbow
#

The set returned is not guaranteed to be mutable and may auto-populate on access. Any listener accessing the returned set should be aware that it may reduce performance for a lazy set implementation.

drowsy helm
#

Aahhh

#

Double jinx

onyx fjord
#

๐Ÿ˜ฆ

#

so do i cancel event and run a new one

#

with players i actually want

drowsy helm
#

Yeah probs the best bet

slender elbow
#

that's only the case for whenever a plugin calls the event anyway, but plugins creating and calling server events is not supported api

onyx fjord
#

ok cuz #removeIf didnt rly work

slender elbow
#

every time the server fires that event, it's mutable

onyx fjord
#

Player#sendMessage triggers an event right

eternal oxide
#

no

wanton comet
#

Should I set it to SERVERBOUND?

inner mulch
#

yes

spice burrow
#

can i see full stack trace? more than likely yes

inner mulch
#

is it bad practice to save an entity reference in another object, even tho i make sure to delete that object once the netity is gone?

drowsy helm
inner mulch
#

im removing it from the map on entity death

#

is that proper?

spice burrow
drowsy helm
wanton comet
#
public static void create(Player player) {
        MinecraftServer server = ((CraftPlayer) player).getHandle().getServer();
        ServerLevel serverLevel = ((CraftWorld) player.getWorld()).getHandle();
        GameProfile profile = new GameProfileCreator("NPC");

        ServerPlayer npc = new ServerPlayer(server, serverLevel, profile, ClientInformation.createDefault());
        npc.setPos(player.getLocation().getX(), player.getLocation().getY(), player.getLocation().getZ());

        DummyConnectionHandler dummyConnection = new DummyConnectionHandler(server, PacketFlow.CLIENTBOUND, npc, CommonListenerCookie.createInitial(profile));
        npc.connection = dummyConnection;

        ServerGamePacketListenerImpl connection = npc.connection;
        connection.send(new ClientboundPlayerInfoUpdatePacket(ClientboundPlayerInfoUpdatePacket.Action.ADD_PLAYER, npc));
        connection.send(new ClientboundAddEntityPacket(npc));

    }
inner mulch
drowsy helm
#

Yeah thats fine gc wise

astral pilot
#

how do you set long values in config.yml

spice burrow
#

and then instead of connection.send do serverPlayer.connection.send

wanton comet
#

so like this?

public static void create(Player player) {
        MinecraftServer server = ((CraftPlayer) player).getHandle().getServer();
        ServerLevel serverLevel = ((CraftWorld) player.getWorld()).getHandle();
        GameProfile profile = new GameProfileCreator("NPC");

        ServerPlayer npc = new ServerPlayer(server, serverLevel, profile, ClientInformation.createDefault());
        npc.setPos(player.getLocation().getX(), player.getLocation().getY(), player.getLocation().getZ());

        DummyConnectionHandler dummyConnection = new DummyConnectionHandler(server, PacketFlow.CLIENTBOUND, npc, CommonListenerCookie.createInitial(profile));
        npc.connection = dummyConnection;

        ServerPlayer serverPlayer = ((CraftPlayer) player).getHandle();
        serverPlayer.connection.send(new ClientboundPlayerInfoUpdatePacket(ClientboundPlayerInfoUpdatePacket.Action.ADD_PLAYER, npc));
        serverPlayer.connection.send(new ClientboundAddEntityPacket(npc));

    }
spice burrow
#

looks correct to me, see if it works!

astral pilot
spice burrow
# wanton comet so like this? ```java public static void create(Player player) { Minecra...
ServerPlayer serverPlayer = craftPlayer.getHandle();
      ServerPlayer guard =
          new ServerPlayer(
              server,
              level,
              new GameProfile(UUID.randomUUID(), "Guard"),
              ClientInformation.createDefault());
      DummyConnectionHandler dummyConnection =
          new DummyConnectionHandler(
              server,
              PacketFlow.CLIENTBOUND,
              guard,
              CommonListenerCookie.createInitial(guardProfile));

      guard.connection = dummyConnection;
      guard.setPos(
          craftPlayer.getLocation().getX(),
          craftPlayer.getLocation().getY(),
          craftPlayer.getLocation().getZ());
      //      player info packet
      serverPlayer.connection.send(
          new ClientboundPlayerInfoUpdatePacket(
              ClientboundPlayerInfoUpdatePacket.Action.ADD_PLAYER, guard));
      serverPlayer.connection.send(new ClientboundAddEntityPacket(guard));

feel free to refer to this if you need to again, but I've gotta get back to what I was workin on. if you need me just ping me and ill respond when i can

wanton comet
wanton comet
agile plover
spice burrow
# wanton comet Thanks for the help, but I get the same error.

my bad, i missed this part.. when setting the server/level try doing this


      // Creating the NPC
      CraftPlayer entityPlayer =
          new CraftPlayer((CraftServer) Bukkit.getServer(), craftPlayer.getHandle());
      MinecraftServer server = ((CraftServer) Bukkit.getServer()).getServer();
      ServerLevel level = ((CraftWorld) entityPlayer.getWorld()).getHandle();

#

let me know what that gives you

echo basalt
#

which one of you did I help with the dummy connection stuff

spice burrow
#

prob me was like a month ago right?

echo basalt
#

maybe

spice burrow
#

why did it seem familiar or somethin ๐Ÿ˜‚

astral pilot
#

is ConfigurationSection#getLong() broken or something?

wet breach
#

no

astral pilot
wet breach
#

well you are trying to get a long

#

wasn't aware you were trying to set it

astral pilot
#

but how do u type in long values in yml

eternal oxide
#

you cn set any value and get it as a long

quaint mantle
eternal oxide
#

if you pass in a long it will be set as a long

#

set("path", 100L)

quaint mantle
#

Or any number above 2^32 bytes

#

I think it was actually less becuse of signs

#

But whatever

#

Hey, I've got a question there

How do I prevent a zombie (or any monster) from getting sun burn damage?

#

There's not DamageCause#SUN_BURN

astral pilot
#

however ConfigurationSection#isLong() returns false

#

whys that

eternal oxide
wanton comet
#

if you have

section:
  severity-level-value: 604800000

you use ConfigurationSection

eternal oxide
#

isLong checks a value

astral pilot
wanton comet
#

to get a value use YamlConfiguration#getLong()

astral pilot
wet breach
astral pilot
#

but it returns false

quaint mantle
#

As forstalf said

#

That's an int

astral pilot
quaint mantle
eternal oxide
#

severity-level-value: !!java.lang.Long 604800000

wet breach
#

or have L at the end

quaint mantle
#

You can, however, cast the integer to long

wet breach
#

^

quaint mantle
#

So you can retrieve any int, as a long value

wet breach
#

but that is only useful if what you need it for needs it to be a long

#

otherwise just fetch it as a int

#

the best thing I do is fetch everything as string, and then cast to the necessary type ๐Ÿ˜‰

carmine mica
#

well you can't cast strings to numbers

quaint mantle
icy beacon
#

Use javascript

wet breach
#

Integer.Valuof(String)

carmine mica
#

that's not casting

wanton comet
# spice burrow let me know what that gives you

same error connection is CLIENTBOUND, but listener is SERVERBOUND https://pastes.dev/JSMUwEsE12

public static void create(Player player) {
        CraftPlayer craftPlayer = (CraftPlayer) player;
        CraftPlayer entityPlayer =
                new CraftPlayer((CraftServer) Bukkit.getServer(), craftPlayer.getHandle());
        MinecraftServer server = ((CraftServer) Bukkit.getServer()).getServer();
        ServerLevel level = ((CraftWorld) entityPlayer.getWorld()).getHandle();
        GameProfile profile = new GameProfileCreator("NPC");

        ServerPlayer npc = new ServerPlayer(server, level, profile, ClientInformation.createDefault());
        npc.setPos(player.getLocation().getX(), player.getLocation().getY(), player.getLocation().getZ());

        DummyConnectionHandler dummyConnection = new DummyConnectionHandler(server, PacketFlow.CLIENTBOUND, npc, CommonListenerCookie.createInitial(profile));
        npc.connection = dummyConnection;

        ServerPlayer serverPlayer = craftPlayer.getHandle();
        serverPlayer.connection.send(new ClientboundPlayerInfoUpdatePacket(ClientboundPlayerInfoUpdatePacket.Action.ADD_PLAYER, npc));
        serverPlayer.connection.send(new ClientboundAddEntityPacket(npc));

    }
icy beacon
carmine mica
#

just check if its a Number and then use Number#longValue

wet breach
#

but I didn't mean literally casting

quaint mantle
#

I will have this screenshot in case frostalf pays ZBLL to delete the screenshot

wet breach
#

I just meant you can transform the string to whatever type you want without needing to know the type specifically

#

since everything in yaml is a string

icy beacon
carmine mica
#

section.getObject("whatever", Number.class) probably will return a number, and then you can get it as whatever type to want with the various methods on it. Assuming yaml handles boxing correctly

blazing ocean
wet breach
astral pilot
carmine mica
#

yeah, I don't think thats valid yaml

#

idk where that is in the yaml spec

#

that's what you do in java number literals to denote a long, but ive never seen that in yaml

astral pilot
#

yea

#

so how do i make getLong() work

eternal oxide
#

work?

#

getLong will return a Long if at all possible

quaint mantle
astral pilot
quaint mantle
#

Just it won't be very efficient

eternal oxide
#

then your path is wrong

quaint mantle
#

^

wet breach
#

it leaves it to implementation

carmine mica
#

what method checks that

astral pilot
eternal oxide
#

your path is wrong

wanton comet
#

can't you just get it as a string from that and parse it to a long?

wet breach
eternal oxide
#

if there is no value at teh specified path it returns 0 as its a primitive

wet breach
#

instead of just saying its correct

quaint mantle
quaint mantle
#

Anyway, why parsing to long when you can simply obtain it as long?

carmine mica
wet breach
quaint mantle
#

Pretty sure snakeyaml stores the Number instance in the yaml data map

wet breach
#

You do know there is two right?

carmine mica
#

the one this discord uses, and that the original question was about

wet breach
#

There is Bukkit/Spigot API which adds some methods of its own

carmine mica
#

yea

wet breach
#

and then you have SnakeYaml

wanton comet
#
severity-level-value: 604800000
String severityString = YourConfig.getString("severity-level-value");
Long severity = Long.parseLong(severityString);

can't you just do this?

wet breach
#

The YAML spec says nothing about how how longs are to be stored

#

or that you can't append an L to the end

#

as I said the spec leaves it to the implementation

carmine mica
#

where is that implementation that handles that L suffix then?

eternal oxide
#

you can just type it in teh config (as I showed earlier) or just use getLong

astral pilot
eternal oxide
#

show your code and your actual config, we will show you your error

carmine mica
# wet breach or that you can't append an L to the end

you can type whatever you want into yaml. You said earlier you could just put an L at the end of a number to make it a long. Which of these implementations actually handle that correctly where that isn't just a string

quaint mantle
wet breach
#

in theory the getLong() method should underneath do a valueOf()

eternal oxide
wanton comet
carmine mica
#

it just checks if the object is an instance of Number and calls longValue on it if it is

quaint mantle
#

Just as I said

carmine mica
#

yeah

wet breach
quaint mantle
#

SnakeYAML stores a map of <string, object> where object is the instance of the value already parsed

wet breach
#

as I said everything in yaml is a string

#

you can call it Object if you want

#

but its a string

carmine mica
#

lol wtf are you talking about

#

Object != String

eternal oxide
#

unless its a key, then 1: breaks it ๐Ÿ˜›

quaint mantle
#

In the SnakeYAML impl, it isn't

wet breach
#

its not reading bytes

#

so it has to be a string first

#

that is just how file reading works

wet breach
#

you either read as binary or you read as string

glad prawn
#

so Map<Object, Object>