#help-development

1 messages ยท Page 10 of 1

glossy venture
#

made it unclear

#

didnt get it at first

grim ice
#

perhaps

native talon
#

Something something house of glass something something cast the first stone

grim ice
#

what

sterile token
#

Orbit he must be trolling I can asume because i didnt smoke much wheel

grim ice
#

verano

#

bro

#

im done

glossy venture
#

bet you didnt smoke wheel

ivory sleet
#

Wth am I reading

grim ice
#

conclure

#

finally

#

holy shit

#

please help me

sterile token
#

Isnt wheel?

glossy venture
#

weed

#

lol

sterile token
#

Ohh

grim ice
#

i said that spigot doesnt allow u to have 2 classes extending javaplugin when they reach the heap in the jvm runtime area

ivory sleet
#

Yea due to the diamond problem

grim ice
#

and idk what the heck people are saying ๐Ÿ’€

sterile token
#

I know that but as you said you Where refering more to the JVM

grim ice
#

bro

#

๐Ÿ’€

#

im done

sterile token
#

Conclure

grim ice
#

you asked about spigot

sterile token
grim ice
#

so i used "it"

#

"it" goes to "spigot"

#

lmfao

ivory sleet
#

Yes

ivory sleet
#

It shouldnt even compile to begin with

grim ice
#

conclure im right, right??

ivory sleet
#

Its illegal java

glossy venture
#

ohh nvm

ivory sleet
#

But yes the runtime does catch it also iirc

grim ice
#

ffs finally

sterile token
#

Wait for when 2 classes cannot extend a parent?

glossy venture
#

in spigot

ivory sleet
#

Never

sterile token
#

Oh okkk

grim ice
sterile token
#

I finally catch it

grim ice
#

๐Ÿ’€

glossy venture
#

there should only be one JavaPlugin

ivory sleet
#

Its not a thing in Java, you have multiple inheritance with interfaces

grim ice
#

man

ivory sleet
#

Not for classes

grim ice
#

i lost like a few million brain cells today

sterile token
#

I thought he was talking ik general as he said JVM

#

๐Ÿ˜‚ ๐Ÿ˜‚ ๐Ÿ˜‚

native talon
#

yup

grim ice
#

@ivory sleet and btw

native talon
#

you said learn to java

ivory sleet
#

Oh yeah only one class with the JavaPlugin derivation also

grim ice
#

verano and dor

#

were saying

#

that

native talon
#

like it was a java thing

ivory sleet
#

2Hex is correct

grim ice
#

they are fluent in english and that im the one confused

#

๐Ÿ’€ ๐Ÿ’€

native talon
#

You literally said I should learn java

ivory sleet
#

The classloader explodes

grim ice
#

yes you should learn java because you dont know DI???

#

bro conclure help me i beg

native talon
#

Dafuq is DI

ivory sleet
#

I donโ€™t know if theres much to be said here

glossy venture
#

nice

grim ice
#

then u clearly dont know java?

ivory sleet
#

Learning java is fundamentally integral

slate delta
#

@tardy delta And also, if assign the class to 2 players, when Player1 edit a value, that edit also to Player2 or just player1?

native talon
#

Ok bruh, I don't know Java

ivory sleet
#

Like the terminology and concepts etc

#

Learn it

#

๐Ÿ™‚

chrome beacon
grim ice
#

exactly what i told u to

#

?learnjava

undone axleBOT
chrome beacon
#

?di

undone axleBOT
native talon
#

Dude, do you know a super niche thing in java

glossy venture
native talon
#

you don't know the entire language

grim ice
#

bro

#

di is legit first week thing

#

i dont wanna be toxic but man

#

u know 0 java

native talon
#

No it's not

tardy delta
native talon
#

ok I know 0 Java

#

but aced my into course with it

grim ice
#

ok

native talon
#

imagine how much damage I could do if I" knew "it

grim ice
#

that doesnt matter at all to me

tardy delta
#

what do you mean

grim ice
#

anyone in this chat could tell u clearly dont know java

#

and please stop being stubborn

sterile token
#

Hex calm down mate

grim ice
#

im feeling like i might get muted for arguing more

sterile token
#

Dont be rude

grim ice
#

verano bro imagine 2 people

native talon
#

Stay mad 2hex

grim ice
#

lol ok

#

lose an argument, then just go

#

"stay mad"

native talon
#

won argument

grim ice
#

definitely

#

you know java

#

and im bad at english

ivory sleet
#

Guys both drop it right now

slate delta
ivory sleet
#

This will only escalate

native talon
#

It's a java thing that 2 classes can't inherit from 1 class 2hex

#

that's what you said

crystal palm
#

heyo. i want to cancel item durability damage event if the item's durability is equal to 1 or 2. how can i go about doing this?

tardy delta
ivory sleet
#

dor stop it

#

Literally

native talon
#

?learnjava @grim ice

undone axleBOT
ivory sleet
#

?kick @native talon

undone axleBOT
#

Done. That felt good.

tall dragon
#

๐Ÿ˜ฎ

ivory sleet
#

This feebly useless debate is ended now

tardy delta
#

lol

ivory sleet
#

Dont start it again, move on thanks

tall dragon
#

daddy conclure here to break up the scuffle

tardy delta
grim ice
#

ive been banned once i know what "drop it" means ๐Ÿ’€

grim ice
#

verano im pretty sure he told us to drop it

sterile token
#

We all love you conclure

#

๐Ÿ˜

tardy delta
#

๐Ÿค”

crystal palm
#

yeah i know bad code but im just testing rn

ripe urchin
#

Hey I have this code for transferring all items from a stored inventory to a player's inventory, but it's not giving me a single item. The code is being ran (Added a few sout statements)

        ItemStack[] contents = stored.getContents();
        for (int i = 0; i < contents.length; i++) {
            if (contents[i] != null && player.getItem(i) == null) {
                player.setItem(i, contents[i]);
            } else if (contents[i] != null) {
                player.getHolder().getWorld().dropItem(player.getHolder().getLocation(), contents[i]);
            }
        }
#

would someone be able to see what's not transferring?

crystal palm
#

oops, i forgor to setItemMeta.

tardy delta
ripe urchin
# tardy delta uh clean that by extracting the && part
        ItemStack[] contents = stored.getContents();
        for (int i = 0; i < contents.length; i++) {
            if (contents[i] != null) {
                if (player.getItem(i) == null) {
                    player.setItem(i, contents[i]);
                } else {
                    player.getHolder().getWorld().dropItem(player.getHolder().getLocation(), contents[i]);
                }
            }
        }
tardy delta
#

and do a continue

rain mason
#

does anyone know why setting the BookMeta doesn't work? ```java
ItemStack book = new ItemStack(Material.WRITTEN_BOOK);
BookMeta meta = (BookMeta) book.getItemMeta();

meta.addPage("Foo\nBar");

book.setItemMeta(meta);
plr.openBook(book);```

ripe urchin
tardy delta
#

if contents[i] == null continue

hot wolf
#

Is there a way to store an Object Array in a database? (H2)

ripe urchin
#

it should automatically continue tho?

tardy delta
#

byte array?

ripe urchin
#

but you're saying like this?

        ItemStack[] contents = stored.getContents();
        for (int i = 0; i < contents.length; i++) {
            if (contents[i] == null) {
                continue
            }
            if (player.getItem(i) == null) {
                player.setItem(i, contents[i]);
            } else {
                player.getHolder().getWorld().dropItem(player.getHolder().getLocation(), contents[i]);
            }
        }
hot wolf
#

Nah, I just have about 20-25 Home objects I have to store. Though they're rather small

grim ice
#

print stored.getContents()

tardy delta
#

oh i didnt see array

grim ice
#

as well as player.getContents()

hot wolf
#

thx, I'll try it with that. Because If I try to put in an object array, it won't let me

tardy delta
#

mye dont have my project open with h2 code

hot wolf
#

Well even with the array type...

tardy delta
#

lemme switch anyways cuz this project sucks

hot wolf
#

xD Thx

ripe urchin
#

it just gives an object reference

#

there's no toString for inventories that actuall gives the contents

grim ice
#

went to apologize and i got this

#

lmao

tardy delta
#

i've found a PreparedStatement#setArray(int, sql.Array) but that array thing is an interface and idk if youre supposed to implement it or what

hot wolf
#

Yeah, honestly I'm not even sure what type array is supposed to be. I mean int arr or boolean, yeah sure but array?

tardy delta
#

setObject(int, Object) with an array seems possible too

#

what are you even trying to save?

hot wolf
#

I mean I could make an object in which I store the other objects ig

hot wolf
quaint mantle
#

is it necessary to remove the packet from player when leaving?

tardy delta
#

ah im saving my homes as rows in a table

hot wolf
#

Mine Have to be flexible in size, thats my problem

#

(Flexible amount depending on rank)

tardy delta
#

the name?

#

ah

#

just save multiple records

hot wolf
#

yeah, Ig. I think I'm gonna try the object in a object things first though, because it seems more organized

hot wolf
#

I appreciate the help though.

spring minnow
#

how do i compile my plugin that uses java 8 with a library that is java 16?

chrome beacon
#

Maven can do that

#

Or gradle

quaint mantle
chrome beacon
#

Just set the target java version in your project

spring minnow
#

and its set as java 8, but when i compile it says that it can't "understand" the library because its java 16

chrome beacon
#

Yeah set the java version in your pom or buils.gradle

tardy delta
chrome beacon
#

Then use a modern jdk to compile

spring minnow
#

i'll try

quaint mantle
#

is it necessary to remove the packet from player when leaving?

tardy delta
#

what packet?

spring minnow
quaint mantle
spring minnow
#

by doing this i'm compiling the plugin as java 8 but with java 17 so it can understand the library, but it doesn't recognize Unsafe

#

why

#

its a java class

tardy delta
quaint mantle
#

create a npc

tardy delta
#

ah uh idk

chrome beacon
#

Why not use Citizens?

ripe urchin
# ripe urchin it just gives an object reference

i've changed it so it prints every itemstack individually

        ItemStack[] contents = stored.getContents();
        for (int i = 0; i < contents.length; i++) {
            System.out.println(contents[i]);
            System.out.println(player.getContents()[i]);
            if (contents[i] == null) {
                continue;
            }
            if (player.getItem(i) == null) {
                player.setItem(i, contents[i]);
            } else {
                player.getHolder().getWorld().dropItem(player.getHolder().getLocation(), contents[i]);
            }
        }

and apparently every single itemstack is null

#

i'm setting the PlayerInventory data like this corpse.setMetadata("inventory", new FixedMetadataValue(plugin, player.getInventory())); (in an player death event listener)

and retrieving it like this (PlayerInventory) entity.getMetadata("inventory").get(0).value();

chrome beacon
#

What version are you on

ripe urchin
#

1.18.2

chrome beacon
#

?pdc

chrome beacon
#

Metadata is old api

#

Also don't store the inventory directly like that

ripe urchin
#

what's a better way?

chrome beacon
#

If you try to read the corpse inventory you might endup with the player inventory

#

Which is empty

chrome beacon
ripe urchin
#

i want the location of the items to be stored too so i was thinking of storing the PlayerInventory object to make it easy to reference it

#

that way the restoring of the inventory puts it all in the old place (or drops it if it doesn't fit)

chrome beacon
#

Just store an array

wide oracle
#

how do i get the color of a glass pane in a player's hand

chrome beacon
#

What version

wide oracle
#

1.19

ripe urchin
chrome beacon
#

Yes

slate delta
#

What is the event when cobblestone was generated by water and lava

chrome beacon
slate delta
#

Thanks you

rain mason
#

how would I load a world? I tried java World wrd = Bukkit.getWorld("the_void")which returned null, then I found out that I need to load it, so I changed it to java World wrl = plugin.getServer().createWorld(new WorldCreator("the_void")); plr.teleport(new Location(wrl, 0, 64, 0));; which just creates an empty world instead of loading the already existing folder

crystal palm
#

no, separating the event into another class didnt help

severe turret
#

You should definitely separate the event and the class anyway

crystal palm
#

yeah i know this is bad practice lol

severe turret
#

But I have no idea why it doesn't work

#

maybe a broken event

crystal palm
#

did spigot break? hehe

ripe urchin
severe turret
#

use some json library, create a new file with player uuid serialize the object inside the array

naive bolt
#

java.lang.NullPointerException: Cannot invoke "com.arr4nn.townyteleportunlock.models.UnlockedTowns.getUnlockedTowns()" because the return value of "com.arr4nn.townyteleportunlock.utils.TownsStorageUtil.getPlayerData(org.bukkit.entity.Player)" is null i dont even call the methord and it is angry

ripe urchin
#

the only issue i'm having now is that the event still causes the items to be dropped, even if i'm clearing the inventory of the player before the end of the event

naive bolt
#

i am trying java if(getPlayerData(p) == null){ plugin.getLogger().info("Towns is null"); }

chrome beacon
#

Assuming death event

ripe urchin
severe turret
#

what data are you trying to save, are you using json

#

so you want to create a JSON file with the UUID of the player as name

#

and then write the data into it if they dc or periodically

#

u need some library like gson

#

there u can create new json file and write into it

#

i think if u Google how to serialize object into json

#

u should find a guide

#

so when the player connects again

#

it checks if there is a JSON file with the same name as their uuid

#

and if yes u can set their stuff

vocal cloud
#

Just use SQLite jeez

severe turret
#

if he cannot use files

#

using db would suck

vocal cloud
#

Well SQLite would be better than generating an entirely new file per user

severe turret
#

you have to start somewhere

drowsy pawn
#

can help my

severe turret
#

once he understands that he can swap to SQLite

#

idk

drowsy pawn
severe turret
#

i got recommended to use files first by 7smile7

drowsy pawn
#

no

hot wolf
#

Rq, when I use the SQL WHERE I can just use PreparedStatement#setObject(), to compare uuids right?

chrome beacon
#

No. Look at their code ๐Ÿ™ƒ

severe turret
#

if u r using instanceof

#

you can already do sender instanceof Player player

#

don't have to do that in next line

chrome beacon
#

Might be an old version

#

Won't help with their issue

severe turret
chrome beacon
severe turret
#

besides there's no reason to use j8

#

no reason to have both in ur pc

chrome beacon
#

You might need 8 for old versions

raw sky
#

anyone know why this might be happening?

#

its in nearly every class

chrome beacon
#

Netbeans ๐Ÿ‘€

vocal cloud
#

Just use intellij KEKLEO

raw sky
#

^

chrome beacon
#

Not bought they just took it over since oracle abandoned it iirc

#

??

#

You don't need to pay anything

severe turret
#

you can?

#

you can open two instances of idea

chrome beacon
#

At least use Eclipse

#

Eclipse has what you want

severe turret
#

yes

#

eclipse is way better than netbeans

#

and intellij is thousand times better than eclipse

#

why do you need that?

#

yes

#

same thing

#

you just alt tab

#

don't have to click

#

?

#

how is that weird

#

workspaces are utterly disgusting

#

they're a private company

#

netbeans is funded by gigant

#

eclipse is funded by gigants

#

their ide is still superior

#

yes they do

#

you can use the community version

#

or click

raw sky
#

are you a student somewhere?

severe turret
#

in netbeans

#

and eclipse

#

it's the same thing

raw sky
#

damn was going to say students get all premium jetbrains IDE's for free

severe turret
#

atleast use eclipse...

cursive kite
#

I use eclipse ๐Ÿคทโ€โ™‚๏ธ

severe turret
#

It's nice to know your IDE

#

But really netbeans is so behind compared to eclipse

#

and even more compared to intellij

chrome beacon
#

The only thing I like about Netbeans is their swing ui editor

#

Intellij is better at everything else

quaint mantle
#

nvm resolved

#

well im counting blocks in a editSelection and i need to mask the blocks i want to count

#

basically its sorting the blocks in different sections

slim brook
#

Hello there. I wish create a tournament. I create and store a List of Fight but i don't know how can i launch a Fight and when it's finished (all players in a team was dead) launch another Fight

#

Someone know how can i do that ?

#
        List<Team> coliseumTeams = coliseum.getTeams();
        List<ColiseumGame> fights = coliseum.getFights();
        if (gamemode.equals(ColiseumMode.MG)) {
            for (Player player: coliseum.getPlayers()) {
                player.getInventory().setArmorContents(coliseum.getStuff()[1]);
                player.getInventory().setContents(coliseum.getStuff()[0]);
                player.teleport(coliseum.getSpawnPoints()[0]);
            }
        } else {
            if (gamemode.equals(ColiseumMode.ONE)){
                for (Player player: coliseum.getPlayers()) {
                    List<Player> playerList  = new ArrayList<>();
                    playerList.add(player);
                    coliseumTeams.add(new Team(playerList));
                }
            } else if (gamemode.equals(ColiseumMode.TWO)) {
                for (int i = 0; i < coliseum.getPlayers().size(); i+=2) {
                    List<Player> playerList  = new ArrayList<>();
                    if (coliseum.getPlayers().get(i) != null && coliseum.getPlayers().get(i++) != null) {
                        playerList.add(coliseum.getPlayers().get(i));
                        playerList.add(coliseum.getPlayers().get(i++));
                    } else {
                        playerList.add(coliseum.getPlayers().get(i));
                    }
                    coliseumTeams.add(new Team(playerList));
                }
            }
            for (int i = 0; i < coliseumTeams.size(); i += 2) {
                if (coliseumTeams.get(i) != null && coliseumTeams.get(i++) != null) {
                    fights.add(new ColiseumGame(coliseum,coliseumTeams.get(i).getPlayers(),coliseumTeams.get(i++).getPlayers()));
                } else if (coliseumTeams.get(i) != null) {
                    fights.add(new ColiseumGame(coliseum,coliseumTeams.get(i).getPlayers(),null));
                }
            }

        }

    }```
#

That my code

#

I registred all Fights ^^

#

Maybe can i do that with PlayerDeathEvent ?

ancient plank
#

```

sage oxide
#

Which versions are supported by plugin-annotations?

sage oxide
sterile token
#

Okay

#

Never seen that

#

Will check it

sage oxide
#

I see the initial version was for 1.8, but is it still supported?

sterile token
#

1m please

#

Im checking

chrome beacon
#

I would expect it to still work

#

You just won't have the api-version property

#

Which might be a problem

slate delta
#

@tardy delta Like this ?

sterile token
#

Maybe i can help you

slate delta
#

2 seconds i ping a message for you

#

that

sterile token
#

ok

#

I think is okay

#

Because you want to have diff island types right?

rich citrus
#

hey For my egggun plugin I dont want the eggs to hatch chickens, so im thinking I need a projectilelaunchevent but how do I get the player inside that event, because I want to see if they were holding the eggun or not if(player.getInventory().getItemInMainHand().equals(EGG_GUN)){ if (gunCore.getConfig().getBoolean("EggGun.Enabled") && (player.hasPermission(gunCore.getConfig().getString("EggGun.Permission")) || !gunCore.getConfig().getBoolean("EggGun.Needs-Permission"))){ e.setCancelled(true); player.pro player.launchProjectile(Egg.class);

slate delta
#

yes, and want a file for defaults function exemple: Name, Upgrades, Quests ect and the class exemple NetherIsland have this beacause extended

sterile token
#

Okay steellg

#

So you will have to define commons things in the parent class

slate delta
#

(And i'm beginner in java, i'm a PHP at base)

sterile token
#

Do i explain?

sterile token
#

Allright

#

Was it all?

#

If need something else just ask it

slate delta
sterile token
#

Stell also if you are a begginer i really recommend reading because it will make you get things easier

#

Not saying that you have to learn or that you dont know

slate delta
sterile token
#

I just a recommendation like they said in high school, "if you want to improove you have to study"

sterile token
ripe urchin
#

would someone be able to give a hint to where one would set a pose for a zombie (so i can make it lay flat on the ground)?

ripe urchin
#

yeah just make the zombie lay on its back

echo basalt
#

if you want the sleeping pose just make an npc with a zombie skin

ripe urchin
#

i have no idea how to make an NPC rn

#

is that difficult?

echo basalt
#

it's simple

#

and you can shade it in

sage oxide
# ripe urchin i have no idea how to make an NPC rn

In this episode of the Spigot MC Plugin series, I start a new plugin called Bodied. This plugin makes it so when a player dies, an NPC is spawned using NMS and is made to lay down and have no nametag. In the next parts of this plugin's development, I will show you how to put items in the body once the player dies, and if no one claims it after a...

โ–ถ Play video
ripe urchin
#

i'm not sure if i want to get into that yet

quaint mantle
#

I am trying to recreate some aspects of a game called Hypixel Skyblock, such as Strength, Defense, Intelligence, and am wondering how I can set those attributes to a player

#

like player.setAttribute("strength", 50); or something like that

vast raven
#

How to slow a Projectile?

#

.setVelocity(...)

eternal oxide
#

setVelocity

vast raven
#

Do I need to multiply the direction?

eternal oxide
#

teh current vector of the projectile

#

reduced

vast raven
eternal oxide
#

and reduce it

#

yes Multiply by a fraction

vast raven
vast raven
eternal oxide
#

0.9 etc

#

projectile.setVelocity(projectile.getVelocity().multiply(0.9))

vast raven
#

Like -0.2?

vast raven
quaint mantle
#

what's the best way to make a /daily command?

eternal oxide
#

would make teh projectile travel at 90% of its current speed

vast raven
#

Set the speed at 20%

eternal oxide
#

20% is not stop

vast raven
#

Yeah I know

eternal oxide
#

Then multiply it by 0.2

vast raven
eternal oxide
#

of course it won't

vast raven
#

Didn't see your code

eternal oxide
#

you have to multiply by over 1.0 to speed it up

vast raven
#

It's the direction of the projectile not the shooter's one

#

so yeah it's correct

#

forgive me, thanks btw

wet breach
quaint mantle
#

and another question

#

how would i format that into like 5m 15s left

wet breach
#

there is 1000milliseconds in a second

quaint mantle
#

yeah

#

couldn't i just use

vocal cloud
#

Lot's of division statements

quaint mantle
#

Duration?

wet breach
#

you can just use math or make use of Java's Date api stuff

quaint mantle
#
public static String timeLeft(int timeoutSeconds)
{
    int days = (int) (timeoutSeconds / 86400);
    int hours = (int) (timeoutSeconds / 3600) % 24;
    int minutes = (int) (timeoutSeconds / 60) % 60;
    int seconds = timeoutSeconds % 60;
    return (days > 0 ? " " + days + " day" + (days != 1 ? "s" : "") : "") + (hours > 0 ? " " + hours + " hour" + (hours != 1 ? "s" : "") : "")
            + (minutes > 0 ? " " + minutes + " minute" + (minutes != 1 ? "s" : "") : "") + (seconds > 0 ? " " + seconds + " second" + (seconds != 1 ? "s" : "") : "");
}
#

ig that'll work

vocal cloud
quaint mantle
#

ty

vocal cloud
#

It should hasn't be tested too much

polar brook
#

has anyone a idea why the event is double triggert? ```java
@EventHandler
public void onClick(InventoryClickEvent event) {
if (!event.getView().getTitle().equalsIgnoreCase(chestShop.getShopTitle())) {
return;
}

    if (event.getView().getTopInventory().getSize() != 27) {
        return;
    }
    if (event.getRawSlot() > 26) {
        return;
    }
    if (event.getRawSlot() == 20) {
        return;
    }

    event.setCancelled(true);
    if (event.getRawSlot() == 21) {
        System.out.println(1);

        ShopConfig.setAnkaufen(chestShop.getAnvilGui().getPlayerBlockMap().get(event.getWhoClicked()), !chestShop.getShopConfig().isBuying(chestShop.getAnvilGui().getPlayerBlockMap().get(event.getWhoClicked())));
        event.getView().getTopInventory().setItem(21, getBuyItem(chestShop.getAnvilGui().getPlayerBlockMap().get(event.getWhoClicked())));

        event.getWhoClicked().sendMessage(chestShop.getPrefix() + "Test");
    }
    if (event.getRawSlot() == 24) {

        event.getWhoClicked().closeInventory();
        chestShop.getAnvilGui().inputPrice((Player) event.getWhoClicked());
    }
}```
carmine nacelle
#

Anyone have a genius idea of how to loop through this?

hive-rewards:
  - type: gold_nugget
    name: '&6Golden Nugget'
    amount: 1
    chance: 25
    lore:
      - '&eA golden nugget... how original.'
  - type: gold_nugget
    name: '&6Golden Nugget 2'
    amount: 1
    chance: 25
    lore:
      - '&eA golden nugget... how original.'
#

it doesn't count as a normal configurationsection

wet breach
#

don't make the types a list

carmine nacelle
#

what should I make them?

wet breach
#

just a config section

carmine nacelle
#

I was told not to use an ID as a key

#

yeah I was told not to do that

#

cause then you have to go through and change things manually

wet breach
#

what do you mean change things manually?

carmine nacelle
#

like if I have 1,2,3,4 as the root

#

and I want to add a different 2

#

I also gotta rename 3 and 4

wet breach
#

you can use the types as the keys

#

not sure why that wouldn't work

#

then you put everything under the types that belongs to that type

carmine nacelle
#

What if I want like.. multiple gold_nuggets though

wet breach
#

then make 1,2,3,4 under the types

carmine nacelle
#

different lore, displayname etc

wet breach
#

I will show you how I did it with servertutorial

carmine nacelle
#

ok

wet breach
#

feel free to look through the other classes

#

mine actually moves the id numbers around though ๐Ÿ™‚

#

so if you delete a tutorial, it will go through and renumber them

carmine nacelle
#

hol up you're onto something there..

kind hatch
#

Mans got a spelling error in his first method. Smh.

carmine nacelle
#

is that in this file?

kind hatch
carmine nacelle
#

For the renaming, couldnt you just like check.. if this int != last int + 1, this int = last int + 1

#

or something

kind hatch
waxen plinth
#

cashe

#

Also my god

wet breach
waxen plinth
#

This is not pretty code

waxen plinth
#

No

#

You want to see beautiful code?

#

This is beautiful code

#

It doesn't get any better than this

wet breach
#

lol

carmine nacelle
#

How does the file renumbering work.. ๐Ÿค”

wet breach
#

Well regardless my code works and that is all that is needed ๐Ÿ˜›

carmine nacelle
#

cause u cant modify the list while looping over it

rain mason
#

anyone knows why the Inventory automatically clloses? ```java
@EventHandler(priority = EventPriority.HIGHEST)
public void onPlayerUse(PlayerInteractEvent e) {
Player p = e.getPlayer();
World w = p.getWorld();

if (w != null && w.getName().equalsIgnoreCase("the_void")) {
    e.setCancelled(true);

    Inventory inv = Bukkit.getServer().createInventory(null, 36, "Cool Hub");
    p.openInventory(inv);
}

}```

carmine nacelle
#

cause ur inside a portal

rain mason
#

does it actually turn off inside of a gateway

vestal musk
#

Is it in a portal or in the end void?

rain mason
wet breach
quaint mantle
#

how would i wait like 1 tick in a while loop

#

Thread.sleep?

vestal musk
#

Because in the end portal its right it close but in the void its not. If u are in the void then maybe the world names isnt the_void

eternal oxide
#

you don;t seel in a while

#

you don't while loop on the main thread ever

carmine nacelle
#

never sleep threads

rain mason
carmine nacelle
#

wait

rain mason
#

it doesnt have to do anything with the end

carmine nacelle
#

wouldnt the world be called <worldname>_the_void

#

or am i dumb

rain mason
#

nah don't need to

#

you can name the worlds however you want

vestal musk
#

True

carmine nacelle
rain mason
vestal musk
rain mason
#

is there a way to still have that end_gateway cool thingy on my screen tho

wet breach
carmine nacelle
#

scheduler delayed task?

wet breach
#

scheduler doesn't use threads automatically

#

two different things

quaint mantle
wet breach
#

scheduler if you want to wait a single tick

#

put your code in the scheduler

#

or you can make your own thread that just waits 50ms since that is approximately 1 tick

#

assuming server isn't lagging etc

quaint mantle
#

so add the runnable in while loop? Or put the while loop inside the runnable?

eternal oxide
#

what is your while loop waiting for?

wet breach
#

depends what you are doing, might not need the while loop not sure

quaint mantle
eternal oxide
#

and?

quaint mantle
#

well im doing while it's alive im teleporting it

wet breach
#

odds are you probably only need a repeating delayed task

quaint mantle
#

and i need to wait 1 tick or the server will crash

eternal oxide
#

oh god no

#

run a TaskTimer and teleport it on a schedule

wet breach
#

or teleport it only when a player gets 10 blocks away everytime

#

thus no scheduler needed

quaint mantle
wet breach
#

player movements are part of the events

eternal oxide
#

yes, however you'd then be having to track player movement in teh MoveEvent and calculating distance

wet breach
#

you just need to check the distance everytime the player moves to see if its 10 or greater

#

if so, move the pet

quaint mantle
#

wouldn't that be more laggier?

wet breach
#

no

quaint mantle
#

for movement event

#

ah

wet breach
#

the event fires whether you decide to do something or not

eternal oxide
#

if you just run a TaskTimer every 40 ticks or so, teleport the Pet. Its not a really heavy task as it calls the moveTo in NMS

wet breach
#

either method works just fine ๐Ÿ™‚

quaint mantle
#

okay so the movement event doesn't lag? im jsut doubling checking because if not ik how to do other things now

wet breach
#

well, it all depends on your code

quaint mantle
#

yeah ig

eternal oxide
#

Yep, don;t use any while loops. Just check distance if you go the distance route

eternal oxide
#

and only when the player has moved a full block, not every event

quaint mantle
#

ye

rain mason
#

yippee I can keep the end gateway stuff

placid fog
#

how do i hceck for age of wheat?

glass mauve
#

you mean growth percentage?

placid fog
#

yes

glass mauve
quaint mantle
#

this shouldn't lag the server correct?

#
    @EventHandler
    public void onPlayerMovement(PlayerMoveEvent e) {
        if(e.getFrom().getX() != e.getTo().getX() || e.getFrom().getZ() != e.getTo().getZ()) {
            Bukkit.broadcastMessage(e.getPlayer().getLocation().toString());
        }
    }```
placid fog
eternal oxide
#

getBlockX and getBlockZ

quaint mantle
#

it seems to be working great

glass mauve
wet breach
quaint mantle
#

first

dry forum
#

i added a library jar to my libraries in intellij and i can use the api perfectly fine all the imports work fine but when i try to compile the plugin i get an error saying the package doesnt exist... but it does

dry forum
#

i cant it has no maven

glass mauve
#

how do you compile?

dry forum
#

maven

glass mauve
#

then add library to your pom.xml

dry forum
#

the library doesnt have a maven

dry forum
#

its saying unzip isnt a command do i need to install something

eternal oxide
#

no

#

what lib are you trying to use?

dry forum
#

my own one

eternal oxide
#

then you built it?

noble lantern
#

Jitpaaaack

dry forum
#

yes?

#

its not open source

eternal oxide
#

then all you need to do it mvn install in that projects directory

dry forum
#

intellij cant use mvn

noble lantern
#

^

IIRC i got it working one time on a private repo

#

yes it can

eternal oxide
#

install puts it in your own local .m2 repository

dry forum
#

mvn : The term 'mvn' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

noble lantern
#

theres a M button

glass mauve
#

you need to install maven or inside intellij

noble lantern
#

^^

#

IntelliJ provides maven inside itself

dry forum
#

yeah thats all i need

noble lantern
#

but if you wanna use it in cmd.exe you actually need to install maven on your device

dry forum
#

i dont see any M button

noble lantern
#

uhmm

#

sec

eternal oxide
#

right of screen

noble lantern
#

i need to open ide

dry forum
#

oh mb got it

dry forum
eternal oxide
#

you run mvn install on your library project

noble lantern
#

oh shit

#

thats smart

#

idk why im not doing that

#

im an idiot i build my jar and move it to a /libs folder in my project im working on and install-file it kek

dry forum
#

still doesnt work same error after installing, is there some kind of repository or smthn i need to add?

eternal oxide
#

you have toi then add it to your dependencies in the project you want to use it in

#

remove the manually added jar

dry forum
#

ah works now thanks

balmy valve
#

Heyo just out of curiosity is it possible to make a mob that is only visible to a certain player?

noble lantern
#

run that on all the players except the one you want to hide it from would be the simplest way

#

wait

#

wrong method

#

one moment

#

sorry

balmy valve
#

all good

noble lantern
#

i cant seem to find the non deprecated method ๐Ÿค” i just saw it the other day

eternal oxide
#

That method will likely still work. Its just draft API

noble lantern
#

Ah okay, weird i never noticed it was marked deprecated before

fleet comet
#

?paste

undone axleBOT
balmy valve
#

ty Buchard37!

fleet comet
noble lantern
#

very interesting way of telling what items are what using CMD

I would be concerend using it cause if another plugin makes and item with the same CMD set then your method will fire, which it shouldnt because theyre 2 seperate items, i reccomend using PDC for this (Hoping you are on 1.14+)

eternal oxide
#

^ also your code will only work for a single player

fleet comet
#

what exactly is pdt? also why only on singleplayer?

noble lantern
#

?pdt this is pdt

#

uh

eternal oxide
#

?pdc

noble lantern
#

oops

#

idk why i said pdt sorry

#

its pdc

#

PersistantDataContainer

fleet comet
#

ill work on using that

eternal oxide
#

You set bedNotSet when ANY player triggers it. from that point every player has it enabled as its a class level field

fleet comet
#

oh yeah

#

i should just remove that var

eternal oxide
#

Don;t bother with the bool. Just test (player.getBedSpawnLocation() == null) when you need

fleet comet
#

also do you guys know why it doesnt work?

noble lantern
#

What exactly doesnt work on it

#

i was confused on that part

fleet comet
#

when i click the bed the cancel event thing doesnt work and it does nothing

noble lantern
#

Honestly seems like an issue with the underlying class, or the events arent registered

eternal oxide
#

don;t check the slot that was clicked, check the item

noble lantern
eternal oxide
#

if you flag the items PDC you can check the PDC on click

tall dragon
fleet comet
#

for now my method works though

fleet comet
noble lantern
#

once you remove the boolean value

eternal oxide
#

you use event.setCancelled(true); three times, but your code only has a single exit point., you can delete two of those.

noble lantern
#

and do what edgar said, youll be okay i think

fleet comet
#

but i will remove it

noble lantern
fleet comet
#

yeah ill try that

eternal oxide
#

lastly, do not call event.getWhoClicked().closeInventory(); inside the InventoryClickEvent

fleet comet
#

where should i call it?

noble lantern
#

Also as an appeal thing

May look nice to schedule to close inventory, then send your message, then schedule again later to teleport the player

noble lantern
eternal oxide
#

^

#

in the task, close inventory, send player message, teleport

fleet comet
#

okay

#

do you guys understand whats happening tho

noble lantern
#

Yes, with those fixes it will work

fleet comet
#

okay

eternal oxide
#

You haven't actually told us what isn't working, so we just told you whats broken

fleet comet
noble lantern
#

i beileve the issue was teleport() not calling/working

eternal oxide
#

Then yes, all the fixes above

fleet comet
noble lantern
#

did you check console for an exception

#

if one generates the event will return out instead of running the rest of the code

fleet comet
#

no exception

eternal oxide
#

once you get it workign, you need to add a drag event listener too, and cancel it

noble lantern
#

oh yeh drag clicking in invs

eternal oxide
#

you cancel a click event, but players cna still drag items around your inventory

fleet comet
noble lantern
#

because the glass isnt firing the un-scheduled teleport() and closeInventory()

fleet comet
#

oh

noble lantern
#

it ignored slot == 1 and just cancels the inventory click

carmine nacelle
#

Will a yml still load if theres a comment on the same line?

#

(after the stuff you want loaded)

noble lantern
#

youd need to show an example

#

theres 2 ways it can go

carmine nacelle
#
load-this-line: 'test' #comment
noble lantern
#

if you do

#

"test" #comment

#

i think youll be okay

carmine nacelle
#

yea ok cool

unborn kiln
#

what are some cool things you can do with the spigot build tools?

eternal oxide
#

build spigot

slate delta
#

@sterile token How can save my data from my class, and restore when player reconnect and reopen the island?

river oracle
#

Uhm mojang remapping

#

Uhhhh that's about it

unborn kiln
#

dang

eternal oxide
#

yeah I'm loving the mappings

unborn kiln
#

wait, whats mojang remapping?

river oracle
#

The fact you asked that makes me think this man's downloaded an illegally distributed copy of spigot and is only just now realizing you have malware

eternal oxide
#

Not played with NMS until 1.19 and been doing plugins since 1.4? ish

unborn kiln
#

I build my spigot

quaint mantle
#

any reason why spawners are only pigs? Its not a permission issue. after this codeblock i set the itemmeta ofc ๐Ÿ™‚

noble lantern
eternal oxide
#

Both are supported in Bukkits Configuration

dry forum
#

is jitpack free for private repositories im confused because some sites say it isnt some say it is

sterile token
#

wHo taGEEd Me

#

?

eternal oxide
#

there is a search top of Discord you can find who mentioned you

sterile token
#

Where?

eternal oxide
#

the box marked Search

sterile token
#

ohh thanks

#

I will try to see

sterile token
eternal oxide
#

UUIDs are supported

sterile token
#

Do you remember that someone tell to me use Bukkit#OfflinePlayer() by passing a UUID#fromString(args[0]) for example?

#

I dont think its okay doing that because i tested and i get some exceptions

eternal oxide
#

No, but you can yes

sterile token
#

From what i have tested it doesnt apply doing that

eternal oxide
#

only if you typed the UUID string incorrectly

quaint mantle
#

how do u add custom data to items

#

such as +50 strength

eternal oxide
#

attributes

quaint mantle
#

and apply that information to a player

sterile token
#

I just know his/her name

quaint mantle
#

or im blind

#

care to share?

quaint mantle
#

lets say a sword gives + 10 speed, how do i get that to a storage spot thats easily accessible by using anplayers uuid from any class file?

eternal oxide
quaint mantle
#

it takes attributes as paramaters

#

can those be custom strings?

eternal oxide
#

No, thats an Enum

quaint mantle
#

how would i map the word โ€œspeedโ€ to the number 10, just asking for specific so i can understand better

eternal oxide
#

I've no idea what you are asking

quaint mantle
#

so i want items to have certain stats on them that buff things like speed, damage, and other custom stats i will use

#

and basically i cant figure out how to get the stats from the item and armor, and transfer it onto the player profile

#

thats the big picture here

#

if you have ever played Hypixel Skyblock, then this is exactly like their stats system. (using theirs as a model which i will change later)

#

@eternal oxide u understand?

#

sorry for pinging u again after safeanin i didnt see

#

๐Ÿ˜“

eternal oxide
#
ItemStack boots = new ItemStack(Material.LEATHER_BOOTS);
ItemMeta meta = boots.getItemMeta();
        
meta.addAttributeModifier(Attribute.GENERIC_MOVEMENT_SPEED, new AttributeModifier(UUID.randomUUID(), "Speed_boots", 5, Operation.ADD_NUMBER, EquipmentSlot.FEET));
boots.setItemMeta(meta);```
#

Thats speed boots that add 5 to your speed

#

If worn in the FEET slot

#

This is basic java

sterile token
eternal oxide
#

Bukkit.getOfflinePlayer(name)

quaint mantle
#

what if i want a custom stat? like intelligence, for example? how would i do that? as it has nothing to do with vanilla minecraft

sterile token
eternal oxide
#

Inteligence is not a Minecraft thing

quaint mantle
eternal oxide
#

If you are adding custom abilities/skills/stats then use the items PDC

sterile token
#

elegar consued isnt to get knocked?

quaint mantle
#

never heard of it

eternal oxide
#

?pdc

quaint mantle
#

also thanks uve been a HUGE help โค๏ธ

eternal oxide
#

You would have to manage writing the lore on items

quaint mantle
#

i spent like 1.5h on this xd thanks

little panther
#

Hello, im working on a feature where you can teleport in the direction you are looking and is using vectors and so on. Is there anyone who knows why it makes me tp like 2000 blocks up in the air when i tp to a block infront of me?

eternal oxide
#

eyeloc.toVector().normalize().add(...

#

if you are calculating distances alwasy normalize vectors so they are Unit vectors and not location representations

little panther
#

didnt fix it, not i just end up in the middle of nowhere

#

and still far up in the air

eternal oxide
#

oh I see what you are doing.

#

yeah don;t normalize that part

#

What is your Abilities.Dranwen.Teleport.distance value?

eternal oxide
#

Why are you altering the Y on travelVector?

little panther
#

because if the person is looking upwards they should still go up

eternal oxide
#

SO? theres no reason to alter the Y

#

they will go in whatever direction they are facing

little panther
#

maybe, im kinda new to coding and used some inspo so some of this i have no idea what im doing ๐Ÿ˜„

#

so i can just use the original vector, the "travelvector"

#

or should i just leave that be

eternal oxide
#

eyeLocation.getDirection()

#

thats a unit vector pointing the direction they are looking

#

if they look up or down it still points the way they are looking

little panther
#

i guess so, i just don't really understand how it gets the y-value at the correct distance

eternal oxide
#

you can also simplify gettign the final Location by Vector#toLocation(World)

#

so in your case java p.teleport(hitPosition.toLocation(world), PlayerTeleportEvent.TeleportCause.ENDER_PEARL);

little panther
eternal oxide
#

delete .setY(eyeloc.getY() * 0.75)

little panther
#

that fixed it, but how do i add the pitch and yaw in a good way? Cuz that resets

eternal oxide
#
destination.setPitch(eyeLoc.getPitch());
destination.setYaw(eyeLoc.getYaw());```
little panther
#

that solved it. Thank you very much

#

I have a few other things struggling around the same event, are you able to help me with that aswell? It's two small things and i might just be blind

eternal oxide
#

?ask

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!

little panther
#

fair enough then, thanks ๐Ÿ˜„

#

I also didn't get the cooldown to work and im not sure if its the cancel that doesnt work or if i put the value in the wrong way

eternal oxide
#

.getType().equals(Material.AIR) use .getType().isAir() for starters

#

there are currently two types of Air

little panther
eternal oxide
#

not generally in inventories but good to use so you don;t make teh mistake in other places

little panther
#

thats fair

eternal oxide
#

does teh Hand is empty debug show?

little panther
#

yes

#

I can do it when i hit on a block, thats why i was able to test it earlier

#

just not on right click air

#

so im guessing its the action in some way

eternal oxide
#

ok you need a few brackets in that test

#

because you have || and &&

little panther
#

yea, do i need more? thought i only needed one wraping the && statement

eternal oxide
#

if ((e.getAction() == Action.RIGHT_CLICK_AIR || e.getAction() == Action.RIGHT_CLICK_BLOCK) && p.isSneaking())) {

#

you do want it only when sneaking?

#

either action but only when sneaking?

little panther
#

if it was hitting a block i wanted the person having to sneak

#

or is that not possible, it doesnt really matter, was more me testing out

eternal oxide
#

oh so only when hitting a block you have to sneak

#

yes

little panther
#

yes

#

and the hitting on block works when sneaking, i just cant click on air

eternal oxide
#

if (e.getAction() == Action.RIGHT_CLICK_AIR || (e.getAction() == Action.RIGHT_CLICK_BLOCK && p.isSneaking())) {

eternal oxide
#

It should fire. It will fire as cancelled as you are clicking air

vocal cloud
#

And the event is registered?

eternal oxide
#

his debug on line 59 triggers

little panther
eternal oxide
#

but works when clicking a block

echo basalt
#

the client doesn't send packets

eternal oxide
#

Only reason I can see it doing that is if you are ignoringCancelled=true

#

oh yes

#

empty hand will not work. you have to have an item

echo basalt
#

I had to make a whole trippy system because of that shit

#

where we had an invisible armor stand

little panther
#

interesting, but then i know how to fix that

echo basalt
#

that would pop out slightly depending on where your cursor was pointed

#

so that it would have click priority over other armor stands

little panther
#

then that explains things atleast

#

though, i still dont know what i did wrong with the cooldown

echo basalt
#

was a royal pain in the ass that took me like a week to fix

#

had to raytrace client-sided entities and hitboxes

little panther
#

yea, thats fair. I just got into spigot coding so i have no idea how to even start on that

echo basalt
#

like using uuids as keys on a map

#

and removing cooldown stuff

#

you can probably use a Cache<UUID, Long> from guava

#

then set it to expire after write

#

and see if the cache contains

little panther
#

Yea, ill have to learn how to use Cache then. But im guessing that works the same way as map?

echo basalt
#

similar

#

I copilot made this class in like 30 seconds

#

could be useful for you

#
Cooldown<UUID> cooldown = new Cooldown(3, TimeUnit.SECONDS);

cooldown.insert(player);
boolean isOnCooldown = cooldown.isCooled(player);

long millisLeft = cooldown.getTimeLeft(player);
little panther
#

I'll try to learn that. Could be useful

echo basalt
#

hol'up gonna make a tiny change

little panther
#

sure

#

I have to get more used to using multiple methods tho. Have just started with that

echo basalt
#

added expiration millis

little panther
#

yea, thanks

#

I think ill use that

#

the Cooldown method at line 11, is that just to create the cache or?

echo basalt
#

yeah that's the constructor

#

just creates a cache with the params

little panther
#

so that will be kind of the same whatever i do?

shadow zinc
#

How can I return if the server is up to date?

#
    public static void check() {
        new UpdateChecker(NeoPerformance.getInstance(), 103183).getVersion(version -> {
            return isUpToDate(NeoPerformance.getInstance().getDescription().getVersion(), version);
        });
    }```
#

thats an example, you cant return in a lambda

echo basalt
#

you can indeed return on a lambda

#

just not on a consumer or runnable

#

a function, for example, allows it

shadow zinc
#

UpdateChecker is using a consumer

#

for getVersion

echo basalt
#

well

#

you can't return a value in a consumer

#

because the return type of a consumer is void

shadow zinc
#

So how would I getVersion and then process with isUpToDate and return the value?

echo basalt
#

so use a function

shadow zinc
#

bruh moment

#

create another class for this stupid thing

little panther
#

in the class you made me about cache= what do you use the "timeout" and "unit" for?

#

is it just for the constructor?

echo basalt
#

for indicating how long the cooldown lasts

carmine nacelle
#
  ConfigurationSection mainGuiSection = guiItemConfig.getConfigurationSection("gui-items" + ".main-gui");

        String mainGuiName = mainGuiSection.getString(mainGuiSection + ".gui-name");

        mainGuiSection.getKeys(false).forEach(hiveInfoItem -> {
            String itemType = mainGuiSection.getString(hiveInfoItem + ".type").toUpperCase();
gui-items:
  main-gui:
    gui-name: '#c35bfbโ‹ฏ#b65ff8ใ€Œ#a963f6C#9c67f3a#8f6af0d#826eedi#7572eba #6776e8H#5a7ae5i#4d7ee2v#4081e0e#3385ddใ€#2689daโ‹ฏ'
    hive-information-item:
      type: book

Why is the String itemType = mainGuiSection.getString(hiveInfoItem + ".type").toUpperCase(); line an "invalid configuration section"?

echo basalt
#

because you're doing mainGuiSection + .gui-name

#

weird ahh code

little panther
# echo basalt ye

okay, im gonna try to get it working and otherwise ill just tag you here if thats okay

carmine nacelle
#

trying to switch to lambda loops instead of the regular fors.

#

cause it looks cleaner

echo basalt
#
ConfigurationSection itemsSection = config.getConfigurationSection("gui-items");
ConfigurationSection mainGuiSection = itemsSection.getConfigurationSection("main-gui");

String guiName = mainGuiSection.getString("gui-name");

Material type = Material.parseMatrial(mainGuiSection.getString("hive-information-item.type").toUpperCase());
#

clean, simple code

#

is best

carmine nacelle
#

bruh

#

parsematerial is a thing??

echo basalt
carmine nacelle
#

why

echo basalt
#

overhead

carmine nacelle
#

?

upper vale
#

tf are lambda loops

#

forEach?

ivory sleet
#

Yes

echo basalt
#

forEach, stream, map

ivory sleet
#

Or well the finer name is higher order functions but no one uses that term here

carmine nacelle
#

i love when ppl tell me to do something so I start using it then get told its a bad idea

#

๐Ÿคฆโ€โ™‚๏ธ

echo basalt
#

How Java 8 lambdas and streams perform compared to longstanding implementations? Lambda expressions and streams received a heartwarming welcome in Java 8. These are by far the most exciting features making their way to Java in a long long time. The new language features allow us to adopt a more functional style in our code [โ€ฆ]

#

the performance difference is negligeble

#

but I still vouch for simple code

ivory sleet
#

I mean it will be pretty competitive once valhalla is fully delivered

echo basalt
#

you'll end up making fancy workarounds if you want to use variables inside a lambda as well

#

due to that "all values must be final within anonymous classes" thing that java does

carmine nacelle
#
 for(String itemLine: mainGuiSection.getKeys(false)) {
            Material materialType = Material.getMaterial(mainGuiSection.getString("hive-information-item.type"));
            int itemAmount = mainGuiSection.getInt(itemLine + ".amount");
            String itemName = cadiaBees.colorUtil.color(mainGuiSection.getString(itemLine + ".name"));
            List<String> mainItemLore = mainGuiSection.getStringList(itemLine + ".main-lore");
            List<String> upgradeItemLore = mainGuiSection.getStringList(itemLine + ".upgrade-lore");
#

alright back to the old method then.

ivory sleet
#

But like

echo basalt
#

I also recommend you make a class for parsing items out of configs

ivory sleet
#

You are reading that maybe once?

#

So in that case a stream is beneficial since it reduces boilerplate

echo basalt
ivory sleet
#

Nothing to lose

echo basalt
#

stream won't reduce that much boilerplate

ivory sleet
#

Consistency?

echo basalt
#

like

#

if you only show him streams because of this specific instance

#

man will figure out that streams are fine to use everywhere

ivory sleet
#

Not really

echo basalt
#

if you stick to for loops everywhere, sure it may have that tiny extra boilerplate but he'll get used to for loops everywhere

ivory sleet
#

I dont see your point here honestly, streams are fine in bootstrap cases certainly, knowing both is good generally, nothing here implies they ought to use it everywhere nor nowhere

#

I mean sure you dont see the fuck ton of extra objects the jvm creates depending on stream pipeline operations which is a downside sometimes, but that just shows us that streams should not be used everywhere

shadow zinc
#

With this code do I seriously need to make a functional interface?

#
    public static void check() {
        new UpdateChecker(NeoPerformance.getInstance(), 103183).getVersion(version -> {
            return isUpToDate(NeoPerformance.getInstance().getDescription().getVersion(), version);
        });
    }```
echo basalt
#

I don't see your problem

shadow zinc
#

my problem?

#

I thought I was clear

echo basalt
#

I thought my answer solved your issues but you're still stumbling around

#

Replace your Consumer<String> with a Function<String, Boolean>

shadow zinc
#

your done

echo basalt
#

yay I'm done

vocal cloud
echo basalt
#

๐Ÿฅฃ

little panther
echo basalt
#

the cache automatically removes stuff

#

so isCooled just checks if the cache contains the key

little panther
#

yea, and it returns true if it doesnt contain the key?

echo basalt
#

...

little panther
#

sorry, if im tired, its 3 am and im trying to finish ๐Ÿ˜„

echo basalt
#

copilot inverted it lmao

#

ok

#

invert that statement

#

rename isCooled to isInCooldown or something

#

for a clearer naming

little panther
#

yea, thanks then i know

#

thanks a lot

shadow zinc
#

So what I understand is the consumer doesn't return any value, I need the lambda express to retrieve the version. So change it from a consumer to something else, getting its return value and then passing that to my isUpToDate Util will do the trick?

echo basalt
#

A function is a consumer that has a return value

#
Function<Player, Boolean> isFlying = (player) -> player.isFlying();
quaint mantle
#

Player::isFlying

#

๐Ÿ˜„

echo basalt
#

boolean flying = isFlying.apply(player);

quaint mantle
#

Apple

echo basalt
#

shutup

quaint mantle
#

๐Ÿ˜ฆ

echo basalt
shadow zinc
#

Thanks, maybe next treat me less like an idiot and more like someone that is learning.

desert frigate
#

im getting "Expression expected" for this line of code:

if(player.hasLineOfSight(target) && target instanceof LivingEntity && !target.isDead() && target != player && target != ArmorStand) {``` anyone know solution?
little panther
#

how do i fix this error now again "java.lang.NullPointerException: Cannot invoke "com.cradlenetwork.CradleAbilities.Main.getConfig()" because "com.cradlenetwork.CradleAbilities.Dranwen.DranwenEvents.plugin" is null"?

ocean lion
#

show code

noble lantern
desert frigate
noble lantern
#

ArmorStand isnt a valid thing to check against

#

its not your statement thats the issue, its the ArmorStand

Thats not how you check if something is an armor stand

#

you either check the entity type of check of the Entity is a instanceof ArmorStand

desert frigate
#

i tried that

#

i tried target instanceof ArmorStand

noble lantern
#

also mixing like 5 boolean checks in one if is messy

#

and can lead to debugging issues

#

its better to use guard clauses

desert frigate
#

its alot smaller tho

desert frigate
#

i started java like yesterday so i dont know much lol

noble lantern
#
if (!statement) {
    // handling if statement is false
    return; // return to prevent from running
}

if (!statement2) {
    // handling if needed
    return; //return to prevent from running
}

// now that all checks have ran execute code
Bukkit.broadcastMessage("Guard clauses checked!");
#

a lot easier to debug, and detect issues with