#help-development

1 messages · Page 1510 of 1

eternal oxide
#

I believe they did, but it will go away too

young knoll
#

I think it already did

eternal oxide
#

quite possibly

young knoll
#

It would warn you in Java 11

#

But I think it just says no in Java 12+

woven epoch
#

do I have to add it? I get the vector that I'm rotating by Vector locv = loc.add(0,3,0).toVector(); and rotate it every 5 ticks

#

loc contains the location of the block I'm looking at

quiet hearth
#

what is all presnt in a vector. Im trying to teleport on top of an entity after right clicking it which pulls in a vector and need it as a location for the teleportation part.

worldly ingot
#

Vector#toLocation(World)

young knoll
#

Vector has x,y,z and direction

worldly ingot
#

No direction

#

Just x/y/z

quiet hearth
#

how would u extract the x y z from a vector

worldly ingot
#

getX(), getY(), getZ() 😛

quiet hearth
#

ok

worldly ingot
#

Or, if you want a Location, use the method I identified above

quiet hearth
#

ok

#

thanks ill see what i can do

quaint mantle
worldly ingot
#

EntityType.Builder?

#

That's not Bukkit

quaint mantle
#

nms

worldly ingot
#

Well AreaEffectCloud is a Bukkit interface

#

Which isn't instantiable

#

If you want the NMS one, it's an EntityAreaEffectCloud

quaint mantle
#

Ok, so Im trying to decompile the server jar, without spigot or bukkit atm, i just dont know where else to ask this

mortal hare
#

can you do unit tests on spigot plugins

wraith rapids
#

no that is illegal

mortal hare
#

or its way too much hassle to do them

worldly ingot
#

Usually not worth the effort but there are projects like MockBukkit

granite stirrup
#

omg thats alot of messages

mortal hare
#

what if i want to test something not specific to Bukkit API, like some kind of configuration system

worldly ingot
#

If you don't really require a running server at all then you can just make tests as you would normally

mortal hare
#

ok

#

how old are you btw, Choco

worldly ingot
#

Obviously things like World#spawnEntity() would require something like MockBukkit

#

I'm 21

ivory sleet
#

9+10

mortal hare
#

is there any way to set maven home path for project initalisation?

#

in linux

#

it always inits project in /home/ directory

quaint mantle
#

How do I get the type of the broken block in the block drop item event?
I keep getting air even if I use event.getBlockState() first

mortal hare
#

just use block break event

quaint mantle
#

I'm modifying the drops though

mortal hare
#

If isDropItems in BlockBreakEvent is set to false, BlockDropItemEvent event won't be called

#

event.getBlock().getType()

#

try this ^^

quaint mantle
#

I did that

#

it's air

#

as well as event.getBlockState().getType()

mortal hare
#

are you using newer than 1.13 version of minecraft?

quaint mantle
#

1.16

mortal hare
#

what's your api-version number

#

in plugin.yml

#

sometimes that causes these kinds of issues

quaint mantle
#

api-version: 1.16

opal juniper
mortal hare
#

lets start that forEach is slower than for (Location loc : locations) {} since its basically anonymous function being called every time

opal juniper
#

This caught me off guard

mortal hare
#

at least in C that would be slower

hybrid spoke
# hybrid spoke its not

would prefer the syntax for-loop too, but forEach is not slower than that. its just more useful in the context of collections

wraith rapids
#

it could be very very slightly slower

mortal hare
#

forEach is literally implemented like this

for(int i=0; i<size; i++)
    action.accept(elements[i])
hybrid spoke
mortal hare
#

it calls the method every iteration

wraith rapids
#

the difference is negligible if even existent

mortal hare
#

it adds up

wraith rapids
#

you know what doesn't add up

#

six million

mortal hare
#

Reflections are kinda slow in Java, do you do Reflection checking in "runtime" (every time method is called)?

wraith rapids
#

i don't know what you're asking about but I almost always cache my reflected methods

#

unless it's only done once in which case i don't bother

stone sinew
shadow gazelle
wraith rapids
#

dunno

#

kind of doing something rn

mortal hare
shadow gazelle
#

Okay

wraith rapids
#

not enough cpu cycles to go around for opening that in a browser

mortal hare
#

well as far i can see

#

its not cached

#

that may be the cause of lag

wraith rapids
#

what am i looking at

stone sinew
# mortal hare

Ah yeah cause its different blocks... I can't cache 1m blocks of data lol

mortal hare
#

You don't need to.

shadow gazelle
mortal hare
#

You only needto cache the only one Field/Method

wraith rapids
#

why are we using reflection to get the material of a block

mortal hare
#

and invoke or get, set

#

with its instance

lusty cipher
#

is there some sort of Map where it uses 2 keys? (In my case, a Block/BlockState/Location and a Player/UUID)

mortal hare
#

in this case it gets the field or method object, which is slowest thing in reflection every time it runs

#

which is inefficient

wraith rapids
#

yes, a Map<Key1, Map<Key2, Value>>

lusty cipher
stone sinew
#

Oh wait I see.. I was thinking blockdataclass was subclasses of BlockData

wraith rapids
#

alternatively you can create a specific Key class that holds those 2 elements

#

and implements hashcode and equals

lusty cipher
#

might do that in the future tho

wraith rapids
#

it would be significantly more space efficient

mortal hare
#

^^

wraith rapids
#

but depends on your use case

mortal hare
#

Guava has a multimap too

#

iirc

wraith rapids
#

multimaps are Map<Key, Set<Value>>

lusty cipher
#

well this method right now already works fine and I see no performance impact at all with just me, but idk if its 10 or 20 players or more

wraith rapids
#

or Collection<Value> instead of set

lusty cipher
wraith rapids
#

the performance impact will not be visible, or if it is, it won't be attributable to your map easily

mortal hare
#

i dont remember actually, i think its mojang's dependency

wraith rapids
#

but, the nested map may use up to an order of magnitude more memory

mortal hare
#

so it should be?

#

they do have gson tho

lusty cipher
wraith rapids
#

in that case an order of magnitude is not that big

lusty cipher
#

so it shouldn't be to bad memory wise

mortal hare
#

it wouldnt cause Memory leak

#

don't worry

lusty cipher
#

that wasn't the problem mentioned, it was about the nested maps using up much more memory than a Key that uses 2 objects.

mortal hare
#

but you do need to know that every key would have map

#

it would use more memory

shadow gazelle
#

It's saying this is always false?

if (event.getPlayer().getInventory().getItemInMainHand() == null)
wraith rapids
#

getItemInMainHand is annotated as @NotNull

#

it will never return null

shadow gazelle
#

Oh

mortal hare
#

intellij is smart

wraith rapids
#

it may, however, return an itemstack that is AIR

mortal hare
#

it reads annotations

shadow gazelle
mortal hare
#

also eclipse too

daring maple
#

Man I'm not fast enough of a typer to sound smart in these conversations

stone sinew
#

@mortal hare how would you cache the results? Cause They way I'm thinking is its using a new NMSBlock each time so if i cache it thats alot of data.

wraith rapids
#

methods/fields exist per-class

#

not per-instance

#

you'd only have to cache the relevant methods and fields for each class involved

#

not each instance involved

mortal hare
#

we're talking about reflection objects

#

you're right but

wraith rapids
#

calling the actual methods isn't slow

shadow gazelle
wraith rapids
#

it's finding the methods/fields through reflection that takes the most time

mortal hare
#

searching of the actual method is fucking slow

#

so you need to cache the Method object somewhere

wraith rapids
#

so anything beyond the per-class caching I mentioned is probably redundant

#

or, not redundant, but unnecessary

stone sinew
#

Ok. Ill do some testing

wraith rapids
#

the real question is

mortal hare
#

You need to imagine everything as objects except primitives

#

even classes

wraith rapids
#

why the fuck is reflection involved to begin with

mortal hare
#

he's doing backwards compatibility

#

but

paper viper
#

Idk if this is preference but I like MethodHandles for specifically method related operations

mortal hare
#

he could just use interface method

wraith rapids
#

methodhandles are slightly faster

paper viper
#

Yeah

mortal hare
#

which detects the version

#

via OBC

#

and load appropiate class implementation

paper viper
#

Still need to cache obviously

#

But only for methods

mortal hare
#

that way it could use Spigot API

wraith rapids
#

iirc methodhandles have almost the same performance as native method calls

mortal hare
#

instead of Reflections

#

a.k.a compat classes

wraith rapids
#

easy solution

#

don't pander to ancient versions

stone sinew
paper viper
wraith rapids
#

i'm a j8 guy so I haven't really fucked with methodhandles at all

paper viper
#

Aren’t there methodhandles tho

#

In java 8

wraith rapids
#

if there are it's super limited

mortal hare
#

what's the difference between Method object and MethodHandle

#

aren't they're doing the same

paper viper
#

Ones faster

wraith rapids
#

i remember trying to do something with them in a plugin because reflection was fucked in j9+ but ran out of effort because my j8 environment didn't have the necessary classes and shit

paper viper
#

MethodHandle tho is more suited only for methods specifically tho, unlike reflection and methods that stuff

quartz goblet
#

Player.sendBlockChange() is deprecated whats the new one?

wraith rapids
#

have you read the deprecation note in the javadocs

#

i sure haven't, but it's a good place to start looking for the new alternative

mortal hare
#

MethodHandles can be faster than using reflection as there is more direct support in the JVM e.g they can be inlined. It uses the new invokedynamic instruction.

#

🤔

#

that's kinda cool ngl

quartz goblet
#

its only deprecated if you use material and byte instead of blockdata so I guess its half deprecated lol

wraith rapids
#

well yeah, the old block damage values have been deprecated for ages

quartz goblet
#

yeah ive definetly been working on spigot for ages

mortal hare
#

so basically from what i see that MethodHandle and Reflected Method object are like roughly (in c'ish terms):

Method* method;

MethodWrapper wrapper;
#

am i right?

stone sinew
mortal hare
#

isLegacy() can be computed in construction time in constructor

stone sinew
#

true

#

One sec

wraith rapids
#

take a spark report and see which parts are using the most time

mortal hare
#

that way you would only return the boolean

wraith rapids
#

or plug it into an actual profiler

mortal hare
#

and not the use for looping contains everytime with regex

stone sinew
shadow gazelle
#
    @EventHandler()
    public void onBlockBreak(BlockBreakEvent event) {
        if (event.getPlayer().getInventory().getItemInMainHand().getType() == Material.AIR)
            return;
        if (event.getPlayer().getGameMode() == GameMode.CREATIVE || event.getPlayer().getGameMode() == GameMode.SPECTATOR)
            return;
        if (!event.getPlayer().getInventory().getItemInMainHand().getItemMeta().hasEnchant(Enchants.TELEKINESIS))
            return;
        if (event.getPlayer().getInventory().firstEmpty() == -1)
            return;
        if (event.getBlock().getState() instanceof Container)
            return;

        event.setDropItems(false);
        Player player = event.getPlayer();
        Block block = event.getBlock();

        Collection<ItemStack> drops = block.getDrops(player.getInventory().getItemInMainHand());
        if (drops.isEmpty())
            return;
        player.getInventory().addItem(drops.iterator().next());
    }

What's wrong here? It drops the item from the block on the ground even if the item I have has the enchantment.

mortal hare
#

Is enchantment real of "fake"

#

i.e custom made

shadow gazelle
#

fake

mortal hare
#

have you registered it?

shadow gazelle
#

As a MC enchant?

mortal hare
#

yes

shadow gazelle
#

Yes

mortal hare
#

have you tried debugging enchantment map

stone sinew
#

Wow... the .contains check was causing a shit ton of lag. Thanks for the help

shadow gazelle
mortal hare
#

regex is slow af too

stone sinew
#

Damn.... well I gotta work out how to check for certain materials then xD

#

cause I have a list of logs leaves etc... and use .contains

mortal hare
#

excuse me its not regex but sequence of characters

#

well maybe you can do it async

#

but there may be better ways

stone sinew
#

Yeah I'll work on async after speed.

#

Still need to make sure the speed of my lumberjack recode matches the speed of my test plugin

mortal hare
#

why wouldnt you use the map instead?

stuck kindle
#

Hello

stone sinew
mortal hare
#

nvm

stuck kindle
#

so I got mcp set up on intellij, but it's giving me like 50+ errors on imports

mortal hare
#

this is spigot dev channel

#

not forge

#

neither fabric

wispy dagger
#

I asked a client question before, and it was answered. also

mortal hare
#

neither vanilla injection modding

stuck kindle
#

^

mortal hare
#

what are the errors then

sudden raft
#

hey

stuck kindle
#

for example: src\minecraft\net\minecraft\util\ResourceLocation.java:3 java: package org.apache does not exist

mortal hare
#

more info - less hassle

sudden raft
#

do u prefer kotlin dsl or groovy dsl for gradle?

worldly ingot
#

Wasn't MCP not even updated beyond 1.12?

stuck kindle
#

basically the same error - but with different imports

mortal hare
#

it lacks the dependencies

stuck kindle
#

ah, this sounds dumb, but how?

mortal hare
#

check the class Of ResourceLocation.java

#

and provide me

#

the imports of it

stuck kindle
#

ok

#

it's literally just one import: import org.apache.commons.lang3.Validate;

#

however, the errors are spread throughout different files

#

it's not all about apache either, google as well

mortal hare
#

here one dependency for commons

shadow gazelle
mortal hare
#

to the logs or the chat

#

and see what the map contains

#

there's method to get all enchantments

#

of the item

#

in itemmeta

#

i think

#

honestly it lacks info

stuck kindle
#

all of the dependencies are underlined red in intellij

mortal hare
#

yes

#

you need them to import it

#

via intellij build system or via maven or via manual classpath or via gradle

#

in your case i see you're using intellij build system

stuck kindle
#

yes

#

is there a jar anywhere? or

mortal hare
#

download v3

#

and put it inside your dependencies

#

bin zip file

#

not src

#

ofc

stuck kindle
#

alright

shadow gazelle
#

@mortal hare if I add System.out.println(event.getPlayer().getInventory().getItemInMainHand().getEnchantments()); to
if (!event.getPlayer().getInventory().getItemInMainHand().getItemMeta().hasEnchant(Enchants.TELEKINESIS)), it works as intended. But I only see this in console [INFO]: {}

mortal hare
#

if there nothing inside the brackets

#

there are no enchantments on it

#

have you tried outputting iteminmainhand

#

method?

shadow gazelle
mortal hare
#

debug itemInMainHand() method

#

maybe that could be cause

shadow gazelle
#

event.getPlayer().getInventory().getItemInMainHand() ?

mortal hare
#

yes

shadow gazelle
#
ItemStack{NETHERITE_PICKAXE x 1, UNSPECIFIC_META:{meta-type=UNSPECIFIC, lore=[{"extra":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"color":"gray","text":"Telekinesis"}],"text":""}], Damage=21}}
#

Why can't it find the enchant?

#

This also has it, but it doesn't show up there

ItemStack{DIAMOND_PICKAXE x 1, UNSPECIFIC_META:{meta-type=UNSPECIFIC, lore=[{"extra":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"color":"gray","text":"Telekinesis"}],"text":""}], Damage=44}}
shadow gazelle
#

w h a t

#

Does Paper have something against "unsafe" enchantments?

#

wtf

#

now my chestplate with the flight enchant isn't working

#

idek anymore

stuck kindle
#

is there a way to make intellij detect the jars automatically instead of adding them all one by one? there seems to be a libarary folder in mcp, can't I just use that?

proud basin
stuck kindle
#

idk how to, im just starting out rn

#

well with a client*

proud basin
#

You're trying to make a minecraft client?

#

What are you trying to do

cold pawn
#

Why would this return an NPE?

wraith rapids
#

because something is null

#

where is the NPE thrown

cold pawn
#

I know but what

wraith rapids
#

i don't know

#

you have literally all of the relevant information

#

maybe share some of it

cold pawn
#

It says that

wraith rapids
#

what is line 107

cold pawn
wraith rapids
#

that is not the full error

cold pawn
#

Thats the full error

#

nothing else

wraith rapids
#

then the code that is running and the code you're looking at aren't the same

cold pawn
#

They are thats literally the class its refrencing

empty swallow
#

c function isnt returning anything

wraith rapids
#

not returning anything doesn't throw a NPE

empty swallow
#

can you even do for loops like that in java?

wraith rapids
#

yes

empty swallow
#

without { }

wraith rapids
#

yes

#

it's a single line/statement, so it doesn't need curly brackets

proud basin
#

@wraith rapids You're now Mr. Mustache

#

1

stuck kindle
#

Ok this should hopefully be the last problem

#

so - Exception in thread "main" java.lang.UnsatisfiedLinkError: no lwjgl64 in java.library.path

#

I've looked it up but I don't think I see a straight answer

#

Full error:

    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1860)
    at java.lang.Runtime.loadLibrary0(Runtime.java:871)
    at java.lang.System.loadLibrary(System.java:1124)
    at org.lwjgl.Sys$1.run(Sys.java:72)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.lwjgl.Sys.doLoadLibrary(Sys.java:66)
    at org.lwjgl.Sys.loadLibrary(Sys.java:87)
    at org.lwjgl.Sys.<clinit>(Sys.java:117)
    at net.minecraft.client.Minecraft.getSystemTime(Minecraft.java:3030)
    at net.minecraft.client.main.Main.main(Main.java:39)
    at Start.main(Start.java:11)```
#

Someone

proud basin
#

@stuck kindle Are you trying to make a minecraft client?

#

I think so, you're in in the wrong discord server for help with it. Read channel description

gaunt hatch
#

Is there a plugin that lets you change the tab menu in 1.9+?

stuck kindle
proud basin
#

Where? I don't see that

stuck kindle
#

at the top of the channel, the description

proud basin
#

I only see Serious Spigot and BungeeCord programming/development help

stuck kindle
#

Serious Spigot and BungeeCord programming/development help | Ask other questions here

proud basin
#

I don't see the last part hold up lemme restart discord

stuck kindle
#

Right next to the channel #?

proud basin
#

I might be bugged

stuck kindle
#

well, if anyone knows, please tell me

proud basin
#

Oh I see it now

#

my bad

stuck kindle
#

I almost got it to work

#

its np

proud basin
#

I think I remember a discord server that is dedicated to this stuff

stuck kindle
#

Please send me the link if possible, problem is most other discord servers are dead

sand raven
#

anyone know how to make all hostile mobs prefer a certain player more?

indigo iron
#
    
    @EventHandler
    public void onClick(PlayerInteractEvent event) {
        
        Player target = (Player) event.getPlayer();
        
        
        if(event.getPlayer().getInventory().getItemInMainHand().hasItemMeta()) {
            if(event.getPlayer().getInventory().getItemInMainHand().getItemMeta().getLore().contains("Search the pockets of")) {
                if(event.getAction() == Action.RIGHT_CLICK_AIR) {
                    event.getPlayer().openInventory(target.getInventory());
                }
            }
        }
    }
}``` 
Hey guys so this code is suppose to open the inventory of the person i right click on but it doesn't work when I click them but it works when I right click the air but it opens my inventory not theirs
sand raven
#

because when you right click someone, Action.RIGHT_CLICK_AIR isnt fired

#

also event.getPlayer() gets the rightclick-er not the rightclick-ee scratch that you're using target.getInventory()

wraith rapids
#

probably the lore check

sand raven
#

yeah that lore check hurts my soul

young knoll
#

But the target is still the same player

#

You want PlayerInteractEntityEvent

indigo iron
stuck kindle
proud basin
#

Go to your run configuration and send a screenshot of that

young knoll
#

Of course not

stuck kindle
#

alr

young knoll
#

The only action is right clicking an entity

stuck kindle
#

Not a screenshot because I can't send those - but the VM option is -Djava.library.path=versions/1.8/1.8-natives

proud basin
#

hm try changing it to -Djava.library.path=versions/1.8.9/1.8.9-natives/

stuck kindle
#

AY

indigo iron
stuck kindle
#

IT WORKED

#

ty

indigo iron
# young knoll Add an instanceof check
    
    @EventHandler
    public void onClick(PlayerInteractEntityEvent event) {
        
        Player target = (Player) event.getRightClicked();
        Player player = event.getPlayer();
        
        if (target instanceof Player)
        if(event.getPlayer().getInventory().getItemInMainHand().hasItemMeta()) {
            if(event.getPlayer().getInventory().getItemInMainHand().getItemMeta().getLore().contains("Search the pockets of")) {
                    event.getPlayer().openInventory(target.getInventory());
                }
            }
        }
    }```
like this?
stuck kindle
#

oh boy I am not looking to do this again for 1.16

#

anyways, thanks so much

wraith rapids
#

check instanceof before casting

#

you're casting before checking

fickle helm
#

anyone had this issue? I've been working off a branch of my github project. Today finally finished the branch and merged it into the master.
Soon as I switched to master branch on my github desktop, all the code hasn't changed but it's complaining about almost every single function or variable in there.
It's saying things like it can't find a function I'm referencing when it is right below it in the same class

#

I cannot for the life of me figure out wth is wrong with it

vast sapphire
#

where can i go if I want to create a minecraft forge mod

indigo iron
young knoll
#

?learnjava

undone axleBOT
indigo iron
proud basin
restive mango
#

Hello! I am looking for help with saving blockstates between restarts.

#

I have a plugin, in which you can blow stuff up. Then, over the course of a handful of minutes, the blocks all regenerate. I do this by saving the blockstates of those blocks in a list and creating a bukkitrunnable which simply updates them back to their original state over a period of time.

HOWEVER, what if the server crashes? Oh no! Then, we'd lose the bukkitrunnable, which means the terrain wouldn't regenerate. Terrible!

So, I need some way to preserve the list of blockstates (or, something which holds all the block's information) between crashes.

worldly ingot
#

Could also just quickly run through all the runnables and finish piecing everything back together before the server shuts down

restive mango
#

My main concern is that a crash might not allow that.

worldly ingot
#

Though that assumes the server stops gracefully. If it crashes, you're SOL whether you're saving to file or not

#

Yeah

indigo iron
restive mango
#

Yeah, so I need some way of saving everything to a file during the first tick when it's destroying everything.

#

I just don't know

#

How to do that

#

I could save the locations and blockdatas for everything, since those I can parse from strings

worldly ingot
#

Well you can save block data extremely easily but you get into more complicated territory when it comes to states. i.e. inventories

restive mango
#

yah

#

inventories

#

thats the prob

#

i need some way to preserve those

#

and i dunno how

#

any tips, masterman?

indigo iron
#

is using an eye of ender considered a throw event?

gaunt hatch
#

Is there a sample of using a IChatBaseComponent somewhere?

#

I can't fine one using google.

#

Trying to get it format & characters for color

empty swallow
#
public class Formatter {
    private static final Pattern pattern = Pattern.compile("(?<!\\\\)(#[a-fA-F0-9]{6})");

    public static String format(String message) {
        Matcher matcher = pattern.matcher(message);
        while (matcher.find()) {
            String color = message.substring(matcher.start(), matcher.end());
            message = message.replace(color, "" + ChatColor.of(color));
        }
        return message;
    }

    public static String colorize(String message) {
        return org.bukkit.ChatColor.translateAlternateColorCodes('&', message);
    }
}
@EventHandler
    public void chat(AsyncPlayerChatEvent e) {
        e.setMessage(Formatter.colorize(e.getMessage()));
        e.setMessage(Formatter.format(e.getMessage()));
    }
#

supports & and #hex colors

young knoll
#

Ooh

#

Convenient

gaunt hatch
#

That's cool, not what i am look for.

#

i am trying to translateAlternateColorCodes to a IChatBaseComponent for entity names

young knoll
#

I believe you need to do fromLegacyText

#

Actually that’s for the API version, no idea for NMS

gaunt hatch
#

oo not a bad idea, i can hook into bukkkit layer from nms and see if that will work since i was in the nms layer

sand raven
#

how can I check if an item's PersistentDataContainer contains any key in a namespace

restive mango
#

Anyone else got any ideas regarding

#

Me problemino

clear blade
#

ayo~ is there a way to make like,, cosmetic armor? as in the player is wearing one set of armor but it appears they're wearing a different set to other users

sand raven
#

you can make an ItemStack with the desired set appearance and then change the attributes to make it the same as a different set

gaunt hatch
#

its harder with armor

#

Since it does not work the same way as items when being woren

clear blade
#

hm, i see. but currently no way to, say, wear diamond armor in the inventory but appear to be wearing iron armor to other players/F5?

gaunt hatch
#

Not that i have found yet

clear blade
#

(this is a very niche use case i am aware, if it isnt possible, fine)

empty swallow
gaunt hatch
#

using IChatBaseComponent

#

not as a string value

#

translateAlternateColorCodes does not work on a IChatBaseComponent it does not change the color of the value and it still shows the &

empty swallow
gaunt hatch
#

my bad

#

i did say using IChatBaseComponent

#

i just did not add that translateAlternateColorCodes does not work.

#

I got it thx

young knoll
clear blade
#

monkaS

clear galleon
#

This method stops working (seemingly freezes) after the last line calling getNearbyEntities. I call it using Bukkit.getScheduler().runTaskAsynchronously in onEnable. am i doing something wrong

    public static void playerNearCow()
    {
        for (Player player : Bukkit.getOnlinePlayers())
        {
            World world = player.getWorld();
            //all lines up to here work
            List<Entity> entities = player.getNearbyEntities(explodingCowRange, explodingCowRange, explodingCowRange);
            //all lines after here dont get called since getNearbyEntities() is breaking or freezing somehow
hardy swan
#

It is not-advisable to call Bukkit API within runtaskasync

clear galleon
#

how should i do async then

hardy swan
#

You have to do it in the main server thread for that line, no other way

#

You can try adding a nested BukkitRunnable for that line

#

And runtask

clear galleon
#

is there a more convenient way to continuously check for player conditions without an event triggered

hardy swan
#

Depends on what conditions you need

clear galleon
#

whenever a player is in range of a cow

hardy swan
#

Is the cow static?

#

If so playermoveevent

clear galleon
#

no

quiet hearth
#
            player.getInventory().addItem(CustomItems.magicStickKB);
        }``` 
When i go to run this with all the correct listeners and code within main class, it outputs the error : java.lang.IllegalArgumentException: Item cannot be null
#

Not sure why tho

#

It runs onPlayerJoin

young knoll
#

MagicStickKB is null

clear galleon
quiet hearth
#

no it is an item that i created in a seperate class

young knoll
#

Evidently it’s null

quiet hearth
#

ok im stupid, forgot to initialize the method

#

take 2

hardy swan
# clear galleon no

Are you using scheduleAsyncRepeatingTask or sth like that, if so, thats prob the best way

hardy swan
#

I think it is called runTaskTimerAsynchronously now

young knoll
#

Keep in mind you can’t access most of the API async

hardy swan
#

But you prob still need a nested runnable to run that task on main server thread

hardy swan
quiet hearth
#

also just random, when u add an enchant on a material, if u say true then it follows minecrafts standard rules, and if you say false it follows the non standard max levels? correct?

hardy swan
#

That is addUnsafeEnchantment

quiet hearth
#

o

#

what is true and false for? wether it shows or doesnt show effect?

#

like enchantment glow

clear galleon
#

minecraft sets enchantment level caps, false disables it

#

im p sure thats what it is

quiet hearth
#

thats what i though

hardy swan
#

Oh

hardy swan
summer scroll
#

How can I update GUI title? Like change it every x seconds.

young knoll
#

unSafe is for the item iirc

#

The meta version uses a boolean

quaint mantle
#

[04:46:46 WARN]: java.sql.SQLException: No value specified for parameter 1 when value 1 is my id field

young knoll
#

Iirc sql starts at 1 rather than 0

worldly ingot
#

correct

deep solstice
#

i've noticed that an InventoryClickEvent is sent 4-5 times just for one click, is there anyway to limit this?

summer scroll
#

Does Inventory#containsAtLeast check for the ItemMeta too?

quiet hearth
#
    public static void onPlayerConsume(PlayerItemConsumeEvent event) {
        Player player = event.getPlayer();
        ItemStack item = CustomItems.enchantedDiamondApple;

        PotionEffect jumpEffect = new PotionEffect(PotionEffectType.JUMP, 3600, 4);
        PotionEffect speedEffect = new PotionEffect(PotionEffectType.SPEED, 3600, 4);
        PotionEffect nightvisionEffect = new PotionEffect(PotionEffectType.NIGHT_VISION, 3600, 4);
        PotionEffect invisEffect = new PotionEffect(PotionEffectType.INVISIBILITY, 3600, 4);

        if (event.getItem().getItemMeta() == item.getItemMeta()) {
            player.addPotionEffect(jumpEffect);
            player.addPotionEffect(speedEffect);
            player.addPotionEffect(nightvisionEffect);
            player.addPotionEffect(invisEffect);
        }
    }```

When i go on minecraft and eat the "echanted diamond apple" it does not give the player any effects. Is there something wrong with this code?
empty swallow
#

are you registering the event?

quiet hearth
#

yes

empty swallow
#

item meta's probably dont match

#

maybe match names instead

summer scroll
quiet hearth
#

ok

sage swift
#

?jira if 1.17, i'd report it here

undone axleBOT
deep solstice
#

im on 1.16.5

sage swift
#

odd, i swear that doesn't happen to me

deep solstice
#

if you log to console every time it is sent, you'll see 4 msgs

sage swift
#

latest spigot? /ver

deep solstice
#

yeah i should probably update

#

let me restart that: im using paper

#

lmao

vagrant stratus
#

ask on the paper discord then

deep solstice
#

yeah i just realized that

#

my bad

plucky comet
#
!sender.hasPermission(plugin.getConfig().getString("adminperms")))```Am i doing something wrong. I have the permission in the config
young knoll
#

Gonna need more than that

plucky comet
# young knoll Gonna need more than that
if (!sender.hasPermission(plugin.getConfig().getString("adminperms")) || !sender.isOp() || !(sender instanceof ConsoleCommandSender)){
                    sender.sendMessage(Utils.formatChat("&cNo permissions"));
                    return true;
                }```
#

only does what it is supposed to if im console

vagrant stratus
#

does it send if the sender isn't an op?

dim chasm
vagrant stratus
#

not even a needed check tbh, I'm pretty sure op's have full perms

dim chasm
#

actually you don't need the sender instanceof check since console's isOp returns true anyway

summer scroll
#

Spigot has deprecated Enchantment#getByname and can someone tell me how exactly to use Enchantment#getByKey?

young knoll
#

You shouldn’t hardcode a command for ops anyway

plucky comet
dim chasm
#

i replaced the || with &&

#

was a mistake

plucky comet
#

Thx alot finally get to sleep

sacred vector
#
    @EventHandler
    void onSmallAxeRightClick(PlayerInteractEvent event){
        if(event.getAction() == Action.RIGHT_CLICK_BLOCK){
                if(event.getItem().equals(itemManager.smallAxe.getItemMeta())){
                    Player player = event.getPlayer();
                    player.setInvulnerable(true);
                    player.getWorld().createExplosion(player.getLocation(), 5, false);
                    player.sendMessage(ChatColor.GOLD + "You Have Stuck The Ground With The Holy Power Of The Gods!");
                    player.setInvulnerable(false);
                }
            
        }
    }

    public static void smallAxe(){
        ItemStack item = new ItemStack(Material.NETHERITE_AXE,1);
        ItemMeta meta = item.getItemMeta();
        assert meta != null;
        meta.setDisplayName(ChatColor.GOLD + "Holy Godly Axe");
        List<String> lore = new ArrayList<>();
        lore.add(ChatColor.AQUA + "The Holy Godly Axe Used By The First lander Of The Overworld ");
        lore.add(ChatColor.AQUA + "Only The Worthy Used To Wield, But Now It's Yours!");
        meta.setLore(lore);
        meta.addEnchant(Enchantment.ARROW_INFINITE, 1, false);
        meta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
        item.setItemMeta(meta);
        smallAxe = item;


    }```
Nothing happens with this...
#

like, when i right click the ground on a block it doesnt do what i told it to do lol

summer scroll
vagrant stratus
#

You're checking an item stack against item meta

summer scroll
#

and that too ^

sacred vector
#

ohh lol, that would make sense just way to early for this lmao

#

well instead of an explosion what about striking an entity with lighting when left and or right clicked? i looked and didnt see no clicked entity action

vagrant stratus
#

probably a separate event

sacred vector
#
    @EventHandler
    void onSmallAxeEntityHit(EntityDamageByEntityEvent event){
        if(event.getEntity() instanceof  Player && event.getDamager() instanceof  Player){
            Player whoHitEntity= (Player) event.getEntity();
            Player whoHit = (Player)  event.getDamager();
            whoHitEntity.getWorld().strikeLightning(whoHitEntity.getLocation());
            whoHit.setSaturation(20);

        }
    }
``` i came up with this, now if used on the weapon how could i do that..
#

im trying the get item, but i get red underline on it

vagrant stratus
#

and what's the error you get from that?

sacred vector
#

nothing

sage swift
#

did you register the event

sacred vector
#

yeah

#

it works

#

it strikes lighting

#

but my problem is making it work only with the axe, i just dont know how to do that with a entitydamagebyentityevent

sage swift
#

Player#getInventory go from there

summer scroll
sacred vector
#

everytime i hit tab on getInventorywith detDamagerit adds a lot of stuff like this extra

(Player) ((Player) event.getDamager()).getInventory() 
``` and when i remove the extra player im getting an error and when i finish what i am writting i still get that red line
sage swift
#

what IDE

sacred vector
#

im using IntelliJ but dont worry about it im just a idiot

#

i was trying to reference that in a variable

#

instead of an if statement

#
 player.setSaturation((short) 20);
``` And does this like not work
#

or is saturation like the health and its actually 10

summer scroll
#

are you trying to set the player's food?

sacred vector
#

yeah

#

to max when they right click

summer scroll
#

It's actually Player#setFoodLevel

sacred vector
#

then what is saturation lol

summer scroll
#

I don't know haha, but this is from the javadocs.

Saturation is a buffer for food level. Your food level will not drop if you are saturated > 0.

sacred vector
#

so like you ate to much at dinner

#

so it doesnt work with the faster full hunger regen, any way to make that work?

#

what i mean like is if you eat food till your full it used more hunger to heal you faster

gaunt relic
#

what is the max size a inventory can have?

summer scroll
#

54

gaunt relic
#

alright thanks

summer scroll
sacred vector
#

player is 9x4

gaunt relic
sacred vector
#

what is fortune called in the code

jagged monolith
#

LOOT_BONUS_BLOCKS

subtle kite
#

SO I made it where I can get the item and ect ,I just need help to give the item from the command to another person. example
/give Billybob24 dirt 64

sacred vector
green comet
sacred vector
#

when i am creating recipes will they show up in the green book?

#

and is there a way to add so my custom gold pickaxe can break anything

mortal hare
#

does anyone use maven in terminal here

#

without any IDE integration

#

how can i change maven project init root path

#

it always set the maven project in /home/ directory

sacred vector
#
                   player.addPotionEffects(Collections.singleton(new PotionEffect(PotionEffectType.FAST_DIGGING, 120, 1)));
``` When using this it only gives for 5 seconds instead of 120
#

is there a specific reason of why that is happening ?

mortal hare
#

its probably measured in ticks

sacred vector
#

mhm

mortal hare
#

20 ticks * 120 seconds = 2400 ticks per 120 seconds

#

try this

#

im not sure tho

#

check the docs

sacred vector
#

ill just test it, it woould become 2400

#

if its in ticks

mortal hare
#

also i suggest to save this singleton collection

#

inside the class global field

sacred vector
#

😃 good thinking lol

mortal hare
#

you will save CPU cycles

sacred vector
#

yeah it was in ticks

burnt current
#

Hey quick question:
I would like to program a villager which, when clicked with a book written on it, changes its customname to what is on the first page in the book. Does anyone know how to query the string of the first page in the book?
So far I have already written the following:

 if(NPC.getCustomName().equals("Villager")) {
                if(player.getItemInHand().getType() == Material.WRITTEN_BOOK) {
                    if(player.getItemInHand().hasItemMeta()) { 
                        
                }
            }
        }

thank you in advance

proper notch
#

Cast ItemMeta to BookMeta, then String getPage(int page)

burnt current
#

ok so should I make a new itemstack which is cast as bookmeta and corresponds to player.getItemInHand ?

#

ok i will try it

mortal hare
#

create a new itemstack

edgy goblet
#

when using NMS which compiled jar is okay for distribution?
plugin.jar
plugin-remapped.jar
plugin-remapped-obf.jar
original-plugin.jar

mortal hare
#

with a book

edgy goblet
#

thank you

quaint mantle
sacred vector
#

how can i add my custom recipes to the green book in 1.17

burnt current
wraith rapids
#

that is because that's not how that works

#

number one

#

naming conventions

#

book, not Book

#

bookMeta, not BookMeta

#

number two, book is an ItemStack, and does not have book related methods

#

bookMeta does

#

that's the whole reason why you're getting it in the first place; to access the book related methods

edgy goblet
#

i think they did try it and did see a compilation error

clear galleon
#

what is the best way to wait in an event handler

proper notch
#

wdym to wait?

#

as in to do something X seconds/ticks after an event occurs?

clear galleon
#

in the event wait x seconds between calls

#

wait i worded that weird

#

on event triggered, wait x seconds within the call to the event handler

worn tundra
#

Runnable doesn't work?

clear galleon
#

idk how to use it

worn tundra
#

oh

#

what exactly are you making

#

in practice

clear galleon
#

when exp bottle breaks, take all the exp orbs around the exp bottle (up to a few ticks after the bottle has broken) and summon lightning on them

worn tundra
#

Oh

#

Yeah just a simple runTaskLater runnable

#
int timeTicks = 40;

Bukkit.getScheduler().runTaskLater(plugin, () -> {
// Code to run later here
}, timeTicks);

clear galleon
#

ty

vapid thorn
#

what did it change to now or is this bork atm? It worked in 1.16.5 and earlier
org.bukkit.craftbukkit.v1_17_R1.block.data.CraftBlockData cannot be cast to class org.bukkit.block.data.Levelled

#

ref Cauldron btw

hazy rock
#

lets say i have a yaml file i want to use as my config.yml saved in the resources folder or smth:

thing: true
another_thing: 9 # this is a comment yay!
idk:
  subthing1: "hello"
  subthing2: -5.8```if i were to use `saveDefaultConfig()` or smth wold it make this the default config?
#

sry for very basic question

quaint mantle
#

hey guys,
not sure where I should post that, but what can I do ?

<plugin_name> has been compiled by a more recent version of the Java Runtime (class file version 60.0), this version of the Java Runtime only recognizes class file versions up to 52.0

chrome beacon
quaint mantle
#

how to "update java on the server"

#

i'm running the server on my own pc

chrome beacon
#

?java16

undone axleBOT
quaint mantle
#

yeah

#

it's installed

#

but

#

how can i "choose" it

chrome beacon
#

Are you on Windows

quaint mantle
#

yeah

chrome beacon
#

So what you need to do is change the path enviromental variable

quaint mantle
#

lemme see

#

I don'"t have it

#

the java variables

#

if it's in path

chrome beacon
#

oh well just add it then it's fine

frosty tinsel
chrome beacon
#

Add a new entry with the path to the bin folder of your Java 16 installation folder

quaint mantle
#

where's the java default folder ?

#

installaition

vapid thorn
#

program files generally

#

in the C drive

chrome beacon
#

^^

hazy rock
#

not the resources foldder

#

but the resources folder is in the src folder

frosty tinsel
#

Yes

hazy rock
#

where in the src folder must it be put?

frosty tinsel
#

The one you have plugin.yml in

hazy rock
#

but that is the resources folder

quaint mantle
#

about to cry

vapid thorn
#

requires java 16

hazy rock
#

wait

quaint mantle
#

I JUST DOWNLOADED JAVA 16

#

watafak

vapid thorn
#

its installed?

hazy rock
#

is that 1.17 or 1.16

quaint mantle
#

1.16

vapid thorn
#

oh

#

well

quaint mantle
#

guess i gotta move

hazy rock
#

YOU NEED JDK11

#

JDK16 is for 117

quaint mantle
#

if i just get 1.17

#

ALRIGHT

#

LEMME CHANGE

vapid thorn
#

im hating cauldrons today

frosty tinsel
#

The config.yml, you want to be default

hazy rock
#

kk

#

the comments in the yml file wil carry over right?

chrome beacon
quaint mantle
#

it's ok i changed to 1.17

chrome beacon
#

Aight

outer sorrel
#

im trying to build with maven but i get this error
Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project Test: Fatal error compiling

hazy rock
outer sorrel
#

nope

eternal oxide
#

You need to find the full error

outer sorrel
#

how would i get that?

eternal oxide
#

it will be in teh build log

outer sorrel
eternal oxide
#

theres more to it than that. Thats just the summary

chrome beacon
#

invalid target release: 11.0.10

chrome beacon
eternal oxide
#

nm, its all in one silly line

outer sorrel
eternal oxide
#

?paste your pom

undone axleBOT
chrome beacon
outer sorrel
#

whats the issue?

eternal oxide
#

paste your pom

outer sorrel
#

uhhhh, im gonna be honest. its not exactly a spigot plugin :/ but tis still maven

#

im just really stuck

eternal oxide
#

it has to be your java.version

#

Fatal error compiling: error: invalid target release: 11.0.10

vagrant stratus
#

Any idea on if you're able to do a custom mob spawner item or do i need to use NMS for that 🤔

outer sorrel
eternal oxide
#

11.0.x is nto a valid java version

outer sorrel
#

11 doesnt work either so just making sure

eternal oxide
#

delete the config section from you compiler plugin

#

you have a source and target in yoru properties already

outer sorrel
#

nope

#

didnt work

eternal oxide
#

you deleted the whole config section from your compiler plugin?

outer sorrel
#

the


                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                </configuration>

part right?

eternal oxide
#

yes

outer sorrel
#

yea didnt work

chrome beacon
eternal oxide
#

is the error now exactly the same or different?

chrome beacon
eternal oxide
eternal oxide
#

still saying 11.0.10 in the error?

outer sorrel
#

it said that?

#
Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project MinestomAirConditioner: Fatal error compiling

eternal oxide
#

does it? Thats what I'm askign you

#

the next line?

outer sorrel
#

thats the only error in the final part

eternal oxide
#

what is the very next line?

outer sorrel
#
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project MinestomAirConditioner: Fatal error compiling: java.lang.NoClassDefFoundError: com/google/gson/JsonParseException: com.google.gson.JsonParseException -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.

i found more text

eternal oxide
#

thats better. Its a different error

outer sorrel
#

maybe i shouldve slept before going into a help channel

#

because 99% sure that error was there the whole time

eternal oxide
#

show the log now

#

we will see

outer sorrel
#

i just added

<dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
            <version>2.8.0</version>
            <scope>compile</scope>
        </dependency>

and it worked

#

its not actually my plugin so no idea if it used that

eternal oxide
#

teh compile error says it does

outer sorrel
#

i think it works now

#

uhhh

#

yea

#

thanks

vagrant stratus
thorny siren
#

This is probably off topic, but anyone worked with the Streamlabs socket API before?

opal juniper
#

Nope

#

Surely it is just like any other api tho

fierce gale
#

I've tried to update my plugin to 1.17
But I get the error while building the artifact:

    class file has wrong version 60.0, should be 52.0
    Please remove or make sure it appears in the correct subdirectory of the classpath.``` 
`java: cannot access net.minecraft.core.BlockPosition`
#

Is there anything I can do?

chrome cape
#

what's the difference if creating a spigot plugin using Maven and not using Maven?

fierce gale
#

I've updated my JDK to 16. Do I have to do anything else?

eternal oxide
#

what IDE?

fierce gale
#

IntelliJ

eternal oxide
#

No idea on IJ, but have you updated to use 16 in your pom?

#

16 is required for MC 1.17

fierce gale
#

I don't use Maven lol

eternal oxide
#

then ensure your project is configured to use 16

opal juniper
#

I mean surely from that he has too newer java

#

🤷‍♂️

fierce gale
#

tbh I dont know how to configure it to 16

chrome beacon
#

Open project settings

eternal oxide
fiery inlet
#

nvm found cause

#

nvm yet again still aint no heads

lusty cipher
#

how can I change the colour of item lore

fiery inlet
#

get the lore

#

and use a new color

lusty cipher
#

like as in ChatColor.XYZ?

unreal quartz
fiery inlet
#

and strip it before

lusty cipher
#

well yeah

unreal quartz
#

and also your for loop is wrong

lusty cipher
#

@fiery inlet

meta.setOwningPlayer(player)
fiery inlet
#

but new problem

#

it doesnt like plugin.yml xd

unreal quartz
#

well that’s descriptive

fiery inlet
#
name: BarrySk
version: ${project.version}
main: me.barry.barrysk.MainClass
api-version: 1.16
authors: [ barry ]
description: First plugin

commands:
  gui:
    description: hi
  gravity:
    description: hi
@Override
    public void onEnable() {

        getServer().getConsoleSender().sendMessage("DEBUGGER: 02FE");
        getCommand("gravity").setExecutor(new BanCommand());
        getCommand("gui").setExecutor(new GUICmd());
        getServer().getPluginManager().registerEvents(new OnKick(), this);
    }
unreal quartz
#

and what’s the problem?

fiery inlet
#

invalid.plugin.yml

#

which makes no sense

unreal quartz
#

does it exist in the compiled jar

fiery inlet
#

i guess it doesnt anymore lol

unreal quartz
#

well you can check

fiery inlet
#

it doesnt

#

even though it did 5 minutes ago xd

#

it should be in resources right?

unreal quartz
#

yes

fiery inlet
#

oh 2sec ofc it was in test folder

#

ok

#

still says it doesnt contain plugin.yml

eternal oxide
#

Using Maven or artifacts?

fiery inlet
#

maven

#

the jar thing

#

jar:jar

unreal quartz
#

as in that’s the task you’re executing?

lusty cipher
#

u sure it's here?

eternal oxide
#

are you actualy using the maven menu in InteliJ? Many use Artifacts and don;t realize that doesn;t run maven

fiery inlet
#

and then it pops up in target folder

eternal oxide
#

under lifecycle in teh Maven menu (right of screen)

fiery inlet
#

mhh which one

#

package, compile?

eternal oxide
#

there is only one maven window on teh right

#

package

fiery inlet
#

and i use original or not original jar file?

eternal oxide
#

I guess you are not shading anythgin so orginal

fiery inlet
#

ahh there we go

#

ty

#

and who mentioned i could improve the list thing

fiery inlet
#

for the skinvalue to be the player or?

lusty cipher
#

for the skin to be the player's skin, yes

fiery inlet
#

doesnt seem to be a thing

lusty cipher
#

you might need to cast to SkullMeta first

fiery inlet
#

ItemMeta meta = (SkullMeta) pHead.getItemMeta();?

#

doesnt seem to do it

lusty cipher
#

yeah because you're casting back to ItemMeta

chrome beacon
#

^^

fiery inlet
#

ahh so scrap the itemmeta

#

and just use skullmeta

lusty cipher
#

ye

fiery inlet
#

and

#

what about the get Itemmeta thing

#

SkullMeta meta = pHead.getItemMeta();

and getSkullMeta no difference, doesnt work with it

#

oh nvm

#

SkullMeta meta = (SkullMeta) pHead.getItemMeta();

rigid otter
#

Hello! Can I have net.minecraft.server maven repository?

ivory sleet
#

It’s your maven local repo

fiery inlet
#
Player whoToKick = (Player) e.getCurrentItem().getSkulMeta(SkullMeta).getOwningPlayer();

this is what ive got now, doesnt seem to work

how do i get the owner of the skull in the inventory click again

lusty cipher
#

that's not what you've got.
getSkulMeta is spelled wrongly and doesn't exist so that wouldn't compile

maiden thicket
#

theres a .getSkullMeta ??

ivory sleet
#

Nope

maiden thicket
#

😔

fiery inlet
#
SkullMeta meta = (SkullMeta) e.getCurrentItem().getItemMeta();
Player whoToKick = meta.getOwningPlayer().getPlayer();
#

maybe this

lusty cipher
#

well if that current item has a player assigned through setOwningPlayer that would work, yes?

fiery inlet
#

ima try

#

haha it works great

#

so smart xd

#

How is it devs make it so that on startup, it checks for new updates and updates automatically

lusty cipher
#

you write a BukkitTask or Runnable that checks the SpigotMC API for the latest version on their site

#

then match that against the JavaPlugin plugin description

fiery inlet
#

ok too complicated

#

future project lol

lusty cipher
#

It's 46 lines in my project

fiery inlet
#

ah still later project

#

only testing

#

someone said something about optimizing this
ArrayList<Player> list = new ArrayList<>(p.getServer().getOnlinePlayers());

lusty cipher
#

yes

ivory sleet
#

Depends

lusty cipher
#

getOnlinePlayers return a Collection, you don't really need to make a new ArrayList from that

ivory sleet
#

If it’s just a temporary usage then it’s technically fine

fiery inlet
#

im basically only using it to get the index and whatever player is in that index

#

u know, to put in gui

ivory sleet
#

Well do u keep the list for a long time?

fiery inlet
#

well after i set the owner then no

lusty cipher
#

#getOnlinePlayers has no specific order

fiery inlet
ivory sleet
#

That’s why he uses an array list?

lusty cipher
#

yeah, absolutely wasteful

#

just iterate over the collection

fiery inlet
#

and

#

how

lusty cipher
#
for (Player p : p.getServer().getOnlinePlayers()) {

}
fiery inlet
#

so now i use p instead of i?

vagrant stratus
#

you can just do

for (Player p : Bukkit.getOnlinePlayers()){

}
ivory sleet
#

Uh well the variable for Player needs to be smtng else but yeah

lusty cipher
#

You have the player now

#

just replace list.get(i) with p?

ivory sleet
#

His p variable is already declared to be his plugin instance

lusty cipher
#

oh yeah

#

call it something else then

ivory sleet
#

1 letter variable names 😬

lusty cipher
#

was just for a quick example 🤷‍♂️

fiery inlet
#

changed it to player

ivory sleet
#

No that was to barry

#

Change p to plugin also

fiery inlet
#

wat

ivory sleet
#

Don’t write obfuscated code

#

Oh nvm name it player

#

Not plugin my bad lol

lusty cipher
#

basically:
don't name your variables by single or by a small amount of seemingly random characters
call a Player variable a player or give it some extra description
like the player who clicked the block in an event, call that playerWhoClicked or something like that

fiery inlet
#

mhh im used to doing that in skript

#

but i see alot of people using p and small stuff but ok ty

lusty cipher
#

still bad practice

fiery inlet
#

will do forth

ivory sleet
#

Don’t follow random peoples code

lusty cipher
fiery inlet
#

what you thinking now

ivory sleet
#

Hmm yeah that’s true I guess

lusty cipher
#

remove ArrayList<Player> list = new ArrayList<>(p.getServer().getOnlinePlayers());?

#

it's not used

fiery inlet
#

yeah i did

#

right after pasting it xd

ivory sleet
#

Also Barry the p in the for loop, name it to like tempPlayer or smtng hypixel_this_is_fine

fiery inlet
#

one thing thats very annoying though, is it keeps saying stuff is deprecated

lusty cipher
#

im sorry did I miss something? p.getPlayer()

lusty cipher
fiery inlet
#

huh oh yeah i know

#

changed

#

new one

lusty cipher
lusty cipher
fiery inlet
#

mhh i used it for some reason cuz i looked at the array as strings or somethng

#

even though i parsed through as player object

#

mrs darth hello

ivory sleet
#

Tomato ideally you might have to provide the library classes yourself which can be done with shading it in

lusty cipher
#

@fiery inlet I'm not telling you to use it, but Player#getDisplayName exists, which will return the modified name of a player, possibly including colour or whatever, if you want to use it.

thorny siren
#

Declare it as a dependancy

ivory sleet
lusty cipher
#

just not shaded correctly probably

ivory sleet
#

?

fiery inlet
lusty cipher
fiery inlet
#

i aint want dat xd

lusty cipher
#

ok sure

#

was just pointing it out

fiery inlet
#

mhh i know (: ty

thorny siren
#

Isn't it javacv-platform?

weak mauve
#

i want to change color of the POTION_SWIRL in 1.8.8, how can I?

thorny siren
lusty cipher
#

but does it run? no it does not

weak mauve
#

how i can add color to potion_swril help (1.8_

fiery inlet
#

anyone know why alot of stuff is just deprecated for me

#

it works fine but im just getting tired of stuff being deprecated

narrow vessel
lusty cipher
fiery inlet
dire marsh
#

1.8 bad

narrow vessel
#

but i have no idea what that question is anyway

dire marsh
#

particle api pretty bad and is even worse in 1.8

narrow vessel
weak mauve
dire marsh
#

remaking hypixel

narrow vessel
dire marsh
#

heard it ten thousand times

weak mauve
weak mauve
dire marsh
#

if you want to remake hypixel make it on 1.16 so it's actually playable

lusty cipher
#

@fiery inlet Those are not deprecated for me. Are you maybe using an older or special Spigot version, or using Paper or such??

dire marsh
#

and actually make something uniquee

weak mauve
#

i like messing around

dire marsh
#

that's why it's deprecated

narrow vessel
#

theres no point in remaking hypixel for 1.8 when hypixel exists
how about remake hypixel for and with 1.16/1.17 features

fiery inlet
#

soo nothing to do?

dire marsh
#

you can ignore it or use components

fiery inlet
#

what is components though

lusty cipher
weak mauve
dire marsh
fiery inlet
#

well if i code in spigot it will work in paper anyways most likely right

lusty cipher
#

yes

#

they just deprecate stuff, not remove them

weak mauve
#

so how can you "add" color to like potion_swirl in later version of bukkit/spigot API

fiery inlet
#

so paper deprecated sendTitle how could they

#

my favorite thing

weak mauve
#

like 1.16 for example

dire marsh
lusty cipher
#

@fiery inlet They completely replaced all the BungeeCord Chat API stuff with Adventure's Components.

weak mauve
narrow vessel
dire marsh
#

i play hypixel, I use 1.17

weak mauve
dire marsh
#

very useful for parkour houses by the way

weak mauve
#

so bad

#

no one do it

lusty cipher
#

A new Minecraft Version should really just add some switch for players to be able to use the 1.8 pvp system.
Just so that all these people still using 1.8 just don't have to

weak mauve
#

i play skyblock and skywars

#

1.17 is just harming my eyes

lusty cipher
#

1.8 is so badly outdated

weak mauve
#

it still good for vanilla gameplay

narrow vessel
weak mauve
dire marsh
#

almost 6 years old

weak mauve
#

like cubecraft for example

lusty cipher
#

6 years old

"not outdated"

dire marsh
#

cubecraft didnt lose all their players?

weak mauve
dire marsh
#

their 1.8 network was far less popular than 1.9 network

#

it only had a few hundred compared to the thousands playing on 1.9+