#help-development

1 messages · Page 1598 of 1

ivory sleet
#

Lmao yeah

paper geyser
#

hmmm

quaint mantle
#

can someone helpes me

paper geyser
#

theres got to be a better way to do this bc .getChunk() doesn't have any .getPlayers or .getCreatures

#

and the issue with having .getEntities is players & item drops :/

quaint mantle
#

breh]

#

help

#

plz

ivory sleet
#

I think it takes a predicate idolp

#

Oh nvm

#

You’ll have to manually filter

echo basalt
#

Dependency injection 👀

quaint mantle
#

it turn 1 error

#

into 7 error

ivory sleet
#

Then fix those 7 errors

quaint mantle
#

it says make it static

#

so i do

echo basalt
#

That's because your code sucks enough to cause 7 errors

quaint mantle
#

then it give another error

ivory sleet
#

Which is a bad recommendation

quaint mantle
#

this go

#

error

ivory sleet
#

Because that method is static

quaint mantle
#

no?

paper geyser
#

bruh

echo basalt
#

He has a local variable and wants a static getter

ivory sleet
#

Yes literally

quaint mantle
#

:(

#

i new

paper geyser
#

it literally says the non static method is in a static context

quaint mantle
#

how fix

ivory sleet
#

You’re trying to do something from an instance variable and then referencing it in a static method, or you got a static method and try to invoke that on an instance.

#

Paste your classes

#

?paste

undone axleBOT
marble granite
#

how do armorstands react when they are in unloaded chunks and it try to access them?

quaint mantle
#

ok

#

main class

paper geyser
quaint mantle
#

other ione

marble granite
#

yea thats wht i thought..

ivory sleet
#

Maybe not but might be

#

Send SurgeCore @quaint mantle

quaint mantle
paper geyser
#

hmmm

ivory sleet
#

Okay so do you know what dependency injection is cimex?

#

It’s a really buzzy term for a simple thing

paper geyser
quaint mantle
#

a thingy where put dependency into a covid vaccine and inject

marble granite
#

hm?

ivory sleet
#

No

#

It’s a design pattern in code

quaint mantle
#

ok

echo basalt
quaint mantle
#

wat that got to do with thing

quaint mantle
#

waht

#

stop make fun of me

paper geyser
ivory sleet
#

Lombok is fine Ig

paper geyser
#

cant speak for the authenticity but

echo basalt
#

I'd be mad if it were static but seeing it not static makes me even angrier

quaint mantle
#

it was static

#

i took off astatic

#

ok now why all this error

paper geyser
#

getShopConfig is not static

quaint mantle
#

but if i make static

paper geyser
#

but its being referred to in something that is static

quaint mantle
#

it says nio make static

paper geyser
#

so try making the other thing not static

quaint mantle
#

how

echo basalt
quaint mantle
#

breh

#

stop

ivory sleet
quaint mantle
#

everyonhe always tell me to do that

#

but i just wanna fiux one thing

ivory sleet
#

It would produce a getter method

echo basalt
ivory sleet
#

Probably null

paper geyser
echo basalt
#

it makes a getter for itself

quaint mantle
#

som1 tell me how to fix

#

ths

ivory sleet
marble granite
ivory sleet
#

?learnjava read into this

undone axleBOT
echo basalt
#
SurgeCore core = ...; 

assert core == core.getInstance(); // true
paper geyser
#

my advice is to listen to these guys's advice bc they have the best (in their opinion) resources that will teach you the basics

#

It's rough getting told to learn java BUT it is worth it to write your first bits of code without help and then see yourself improve over time

ivory sleet
quaint mantle
#

he gave me more error

ivory sleet
#

No because then in main you pass new ShopsCommand(this) with the keyword this which is a reserved variable that points to the class instance itself

#

And that will probably make 0 sense whatsoever (for you)

quaint mantle
#

lol

#

wat do i do with public SurgeCommand(SurgeCore plugin {
this.plugin = plugin;
}

echo basalt
#

Cimex I hope you realize it's kinda hard to explain stuff to beginners because half the stuff we say is nonsense to them IMO

ivory sleet
#

^

quaint mantle
#

lol

#

where put new ShopsCommand(this)

ivory sleet
#

Where you had it before

quaint mantle
#

i never had it anywhere]]

paper geyser
#

???

echo basalt
#

Cimex, do you understand the concept of object-oriented programming?

#

Just be honest and close those google tabs for now 👀

quaint mantle
#

meanie

reef wind
echo basalt
#

If not, I'll explain it in the simplest technical way I can

paper geyser
#

ooh can i try?

quaint mantle
#

no

#

u b meanie

opal juniper
reef wind
#

hy

echo basalt
quaint mantle
#

all

#

meanie

echo basalt
#

bRuh ok

reef wind
#

how are ppl mean

paper geyser
#

I'm just gonna do it

quaint mantle
#

i fixed it myself

paper geyser
#

yk what classes are right?

quaint mantle
#

yes

#

im leave

#

yall r measnies

#

bye

echo basalt
#

my man left the server

paper geyser
#

basically OOP is sort of like this common practice thing where you should use reusable pieces of code and put them into classes so you can reuse them to make-

#

oh

echo basalt
#

Give me a topic you don't understand

paper geyser
#

me?

echo basalt
#

Yeah sure

reef wind
#

he really took that personally

ivory sleet
#

?kick @reef wind disrespect inappropriate

undone axleBOT
#

Done. That felt good.

paper geyser
#

i hope he does read those docs

ivory sleet
#

I mean I did see the gif desk sent

#

Or image whatever

paper geyser
#

wh-

echo basalt
#

it was cursed

paper geyser
#

what did they send?

echo basalt
#

He was washing a motherboard in a sink and it was amazing

paper geyser
#

ahh yes

#

the true best way to clean out your memory

reef wind
#

It said “cry about it”

paper geyser
#

I will not that motherboard was being lathered

#

I recently learned that water isnt actually going to damage a motherboard its the minerals in it that do SO

echo basalt
#

Imagine a motherboard without the plastic

#

just a ton of wires

paper geyser
#

why

#

you woke up

#

and decided to say that today

#

why

#

remember before you post, think NUT

is this

Necessary
Useful
THOUGHTFUL

echo basalt
#

It was thoughtful

#

and useful

tame coral
#

yeah it was

paper geyser
#

im gonna cry

tame coral
#

Eh, crying feels good

paper geyser
#

in other news I have run out of brain energy and forgotten how to use or statements so its time for me to sleep

#

cya later stay safe and dont remove the plastic from your motherboard

#

even if its to spite others you will create an abomination

stone sinew
#

Well new MinecraftFont().getWidth(ChatColor.stripColor(colorize(s))); is better then the enum with each char's width. xD

echo basalt
#

idk why the string length

#

But keep that in mind if you're having weird results

stone sinew
echo basalt
#

I believe you can even use the static font instead of instancing a new one

#

As I did here

outer sorrel
#

I am making basically a custom permission system to suit my needs. whats a good way to store permissions that the players have?

gleaming grove
#

just make JSON file

tame coral
#

Or a yml

outer sorrel
#

How does bukkit do it?

tame coral
#

yml

outer sorrel
#

ok

tame coral
#

bukkit (and spigot by extension) stores permissions in the permissions.yml file

outer sorrel
#

ok thanks

hollow sand
#

do the gui rows start from top or bottom

#

since like

#

I have 36 item slots, and I want to center my items in the gui. Would I have to start from the top or bottom by putting the item sltos

#

slots*

opal juniper
#

Top left = 0

hollow sand
#

ah, ok

#

Thanks m8!

opal juniper
#

np

#

I have an entity which is travelling down a vector path

i need to work out when it is going to go into unloaded chunks in order to despawn it so that teh chunks dont get loaded as it travels.

anyone know how to work this out

quaint mantle
#

bump

near crypt
#

how can i cancel that lava is floating?

hybrid spoke
opal juniper
#

i wonder

#

if i could just cancel the load event and have it work properly thinkeye

hybrid spoke
hybrid spoke
opal juniper
#

you cant?

near crypt
opal juniper
#

thats a shame

opal juniper
hybrid spoke
near crypt
opal juniper
#

it dont matter

hybrid spoke
opal juniper
#

hmm yeah

#

its a shame there is no "getReason"

#

like Entity / Spawn etc etc

hybrid spoke
#

wouldnt it be always an entity?

opal juniper
#

by spawn i mean like spawn chunks on start

#

but mostly, yes actually

#

HMm

#

what is the least performant part of loading chunks

hybrid spoke
#

but the most important question is: do entities really load chunks by itself?

opal juniper
#

the fact that the chunk is ticking?

opal juniper
hybrid spoke
#

probably not. otherwise entities would have to keep every chunk active they are in.. and they do not

opal juniper
#

hmm true

#

but i think that once it gets to an unloaded chunk it would just freeze in place you know?

#

stops ticking

hybrid spoke
#

also why should the chunk tick?

opal juniper
#

no the entity

#

yep about to

#

yeah my sysout with the drone location data isn't changing when it is not in loaded chunks

#

so i mean i could just always load the chunk that the drone is in and then just unload them as it leaves them

#

but, that seems, stupid

#

my approach was gonna be to:

despawn the entity when it reaches an unloaded chunk
calculate how many chunks/blocks until it was in loaded chunks, wait an amount of time that is precalculated based on that
once in loaded chunks respawn the entity

final monolith
#

hi @opal juniper, can you send me a NMS Tutorial? i want to learn how to insert multiples versions on my plugins

#

i not fouded

chrome beacon
#

You're not ready for NMS yet

final monolith
#

yeah, i think to...

chrome beacon
#

The thing about NMS is that it's undocumented

opal juniper
#

^

final monolith
#

hmm

#

ok, what i need to learn now?

opal juniper
#

well, unless u work at mojang

chrome beacon
#

You will have to figure things out on your own and we might not help

final monolith
#

(sorry my bad english)

chrome beacon
final monolith
#

oh, ok men

#

thanks for the tip

#

;D

hybrid spoke
opal juniper
#

lmao

hybrid spoke
maiden briar
#

Is there a good way to sort a Map<UUID, Integer> on the highest Integer values? Like if UUID1=3, UUID2=1, UUID3=2, then I want UUID1, UUID3, UUID2 in a List

hybrid spoke
#

or is the location just continueing

opal juniper
#

its working out when the chunks are unloaded and how far for

hybrid spoke
maiden briar
#

I will look, thx

hardy swan
#

If you want it sorted

#

You may not want to use hashmaps

hybrid spoke
#

treemap ftw

hardy swan
#

Thats like, hashmap's biggest flaw

hardy swan
hollow sand
#

would this work?

if(clickEvent.getSlot() == 11-14); ```
maiden briar
#

Ok, I will look into TreeMap, but I have never used it

opal juniper
#

how would i go about working out which chunks a ray passes through?

maiden briar
#

Are there any docs for?

hybrid spoke
hardy swan
hollow sand
maiden briar
#

Ok I will search on the web, thx for the help

opal juniper
hybrid spoke
opal juniper
#

predict the future lmao

#

its like i need to get the points along the ray

#

to get their location

#

to get their chunk

#

to check if it is loaded

hybrid spoke
#

yeah

#

and?

opal juniper
#

hOw ?

#

idk how

hybrid spoke
#

never really worked with raytracing except of custom mades

#

so i can just recommend using the bezier formula to get a line to a location in front of the drone

maiden briar
hardy swan
#

That i know of

hardy swan
hybrid spoke
maiden briar
#

Yes I understand, but I don't want it sorted by UUID, I want it sorted by value (Integer)

hardy swan
#

Then integer is the key

opal juniper
hardy swan
#

Key value are just names

hybrid spoke
#
//pseudo
for(Location loc : line(droneLoc, destinationLoc)) {

Sysout(loc.getChunk().isLoaded());
}
maiden briar
#

Do I need to reverse the map to <Integer, UUID> if I want to get the values?

hardy swan
#

Yes

maiden briar
#

Then I have a key

#

Ok

hybrid spoke
#

look up your pms

grim ice
#

Uh

#

AM i supposed

maiden briar
#

But then another problem: What do I do if 2 players have the same Integer as kills?

grim ice
hardy swan
#

Using uuid

maiden briar
#

?

hardy swan
#

Instead of using integer

#

Create a player object

#

Bruh

grim ice
#

oops

#

?paste

undone axleBOT
maiden briar
#

No I mean, if UUID1=5 and UUID2=5

grim ice
#

do i learn those

hardy swan
#

Yep ik

maiden briar
#

Then UUID1 will get removed

hardy swan
#

Yep so you may want to use a custom made class

#

Extending comparable

#

That contains uuid and score

#

Compare with score, break tie with uuid

maiden briar
#

Ok I will create a custom class

#
private static class KillScore implements Comparable<Integer>
    {
        @Override
        public int compareTo(Integer o)
        {
            return 0;
        }
    }```
What to do here?
dusty kraken
#

Hello can someone please help me with my plugin

#

i am trying to make just a simple npc

#

but i cant do the .ADD_PLAYER

#

i am on 1.17

hardy swan
maiden briar
#

Ah

hardy swan
#

so KillScore will have two fields, score and player/uuid

maiden briar
#

And what to return there?

maiden briar
#

What to do in compareTo ?

hardy swan
#

return this.score == o.score ? this.uuid.compareTo(o.uuid) : (this.score - o.score);

#

sth like that

maiden briar
#

It can't compare this.score, because that is an int

hardy swan
#

there adjusted

#

i am just giving you the idea

maiden briar
#

Ok thx

#

And what do I now need to do with this custom class?

hardy swan
#

So now you sort them by putting them into a TreeSet

near crypt
#

what does this exception mean: java.lang.IllegalArgumentException: Plugin already initialized!

hardy swan
#

maybe it is the last 3 words?

near crypt
#

yes i know but how can i fix it?

maiden briar
#

Ok just creating a new TreeSet, and the get(0) will return the highest or lowest value?

hardy swan
#

also full stacktrace helps more

maiden briar
#

Ok highest?

hardy swan
#

That I don't know you have to test it yourself

maiden briar
#

Ok

hardy swan
#

just read the docs

maiden briar
#

From TreeSet then

hardy swan
#

yes, but treeset HAS-A treemap

#

so they are essentially the same thing

chrome beacon
near crypt
#

okay

hardy swan
maiden briar
#

Why not .size() - place ?

hardy swan
#

wdym

#

I mean TreeSet gets everything sorted

#

so you will have the benefit of having an ordered list for ranking or idk

#

but if you just want the highest

#

priority queue wins trees in time complexity of doing the query, but doesnt matter if you dun have a lot of players

hollow sand
#

How do I open a gui when a player join?

hardy swan
#

evt.getPlayer().openInventory(...), might have to do it one tick later not sure

#

you can do so using Bukkit.getScheduler().runTask()

dusty kraken
#

What happend .ADD_PLAYER

#

how can i make an npc without it

sour loom
#

is there an asynchronous quit event?

eternal oxide
#

?jd just search async

eternal oxide
#

But to save you the time, no

lost matrix
manic bison
#

hey

#

is there a way to listen to blockbreakevent in a specific region ?
like block.getLocation().getY() == 62 to 70

#

so all blocks between Y62 and Y70 are listened

lost matrix
#

Just make a simple check if the broken blocks y coordinate is between 62 and 70

manic bison
#

yeh but how do i do that ?

#

if(block.getLocation().getY() == 62 && block.getType().equals(Material.IRON_ORE))

#

no spoonfeed

#

just wht method

vivid temple
#

how do i get the users UUID?

manic bison
#

from what action

#

player.getUniqueID()

vivid temple
lost matrix
# manic bison just wht method
  @EventHandler
  public void onBlockBreak(final BlockBreakEvent event) {
    final Block block = event.getBlock();
    int y = block.getY();
    if (y < 62 || y > 70) {
      return;
    }
    event.getPlayer().sendMessage("You can read this message if a block is between y [62, 70]");
  }
#

Just simple Java

#

<

manic bison
#

oh well thank you

hardy swan
#

what is the point of writing final in the arguments' type

lost matrix
hardy swan
#

but under what circumstances is that unfavorable?

lost matrix
#

Also i can automatically assure that i can access them from anonymous inner classes and lambdas.

hardy swan
#

ok that's true

hardy pivot
#

Hi. Anyone knows how to create waypoints?

vivid temple
#

why is .exists erroring?

if (tpcsurvival.getBankFile().get("player" + player.getUniqueId()).exists())
tame coral
#

What error does it raises

vivid temple
lost matrix
vivid temple
tame coral
#

Send the full stack trace

lost matrix
#

Ah i see. getBankFile returns a FileConfiguration

#

Right?

vivid temple
tame coral
#

There's no such thing as a exists() method, is there ?

lost matrix
#

Then you need to call FileConfiguration#isSet(String)

#

get returns an arbitrary Object from of the FileConfiguration.

vivid temple
lost matrix
#

But i think you can also just null check the Object

quaint mantle
#

a value can be set but be null

#

yaml supports null values

opal juniper
#

When you think code is gonna work first time and it doesn't work at all Sadge

lyric grove
#

What would 1 minute in double be?

chrome beacon
#

Well start by telling us where that is from

lyric grove
#

im registering a placeholder using holograthic displays api

#

what would 1 minute be?

chrome beacon
#

Refresh rate is in seconds

#

A quick look at the javadoc tells you that

lyric grove
#

oh thanks

chrome beacon
indigo crypt
#

hey bro, i try save MobData to config, but. why data not loaded

#

this is my code

quaint mantle
#

"modern looking holograms"

#

how do they differ from not-modern holograms?

quaint mantle
undone axleBOT
indigo crypt
#

ohh, i am sorry. i am new at discord

#

this discord server*

quaint mantle
tardy delta
#

for some reason bossbar.removePlayer doesnt work

indigo crypt
#

Hey, how to fixit, i am try to save mobs to config data. and data saved. but cant loaded data if i am reload it. and this is my onEnable and onDisable code:
https://paste.md-5.net/etaquhatun.cs

#

MobData hash map variable is mdata

#

oh yeah, someone cant help me

quaint mantle
#

well, its early for some people still, just wait a little.

#

it's always early for some people

quaint mantle
#

its 8am for me is what im saying

opal juniper
#

its 1 pm for me

#

1:05 to be exact

quaint mantle
#

est gang 🦀

opal juniper
#

bst gang NM_CrabRave

reef wind
#

14:09/2:09 PM For me 😎

indigo crypt
lost matrix
lost matrix
quaint mantle
#

who looking for development at smp server craked

opal juniper
undone axleBOT
lost matrix
indigo crypt
vivid temple
#

my file doesnt get created
i have this in my main class


private File Bank;
private YamlConfiguration modifyBankFile;

@Override 
public void onEnable() {

//some code here

try {
            InitiateFiles();
        } catch (IOException e) {
            e.printStackTrace();
        }
}

//some code here

public YamlConfiguration getBankFile(){ return modifyBankFile; }

    public void InitiateFiles() throws IOException {
        Bank = new File(this.getDataFolder(), "bank.yml");
        if (!Bank.exists()){
            Bank.createNewFile();
        }
        modifyBankFile = YamlConfiguration.loadConfiguration(Bank);
    }
indigo crypt
lost matrix
lost matrix
vivid temple
lost matrix
#

then change Bukkit.getServer().getPluginManager().getPlugin("TPCSurvival").getDataFolder() to -> this.getDataFolder()

indigo crypt
#

Okay, Thanks for Helping, i will try it

young shell
#

Since many people here us Nexus for Dependency Management, i have a question. What Priviliges do i need to give to a group, so it's able to deploy to a maven repository

lost matrix
# vivid temple yeah

After you have done that und it doesnt work, put some sysouts before and after some lines of code. Then see what gets printed. Also look out for stack traces in your console.

lost matrix
young shell
#

Do you know the Exact Names of the Privileges

#

I assigned nx-repository-view-maven2-- and it doesn't work

lost matrix
#

CRUD =
create
read
update
delete

#

Just comma separate them in the "Actions" List

vivid temple
#

this doesnt write anything in my file

if (!tpcsurvival.getBankFile().isSet("players")){
                            tpcsurvival.getBankFile().createSection("players");
                        } else{
                            if (tpcsurvival.getBankFile().isSet("players." + player.getUniqueId())){
                                int bank = tpcsurvival.getBankFile().getInt("players." + player.getUniqueId() + ".bank");
                                int purse = tpcsurvival.getBankFile().getInt("players." + player.getUniqueId() + ".purse");
                                bank = bank + purse;
                                tpcsurvival.getBankFile().set("players." + player.getUniqueId() + ".purse", bank);
                            } else{
                                tpcsurvival.getBankFile().createSection("players." + player.getUniqueId());
                            }
                        }
lost matrix
vivid temple
#

intellij

unreal quartz
#

did ya save it

vivid temple
unreal quartz
#

the file

lost matrix
paper viper
#

Yeah that formatting is whack

vivid temple
young shell
lost matrix
#

And then post more code ^^

vivid temple
# lost matrix And then post more code ^^
if (ChatColor.translateAlternateColorCodes('&', e.getView().getTitle()).equals(ChatColor.DARK_GRAY + "Deposit Menu")) {
            if (e.getCurrentItem() != null) {
                e.setCancelled(true);

                switch (e.getCurrentItem().getType()) {
                    case CHEST:
                        if (!tpcsurvival.getBankFile().isSet("players")) {
                            tpcsurvival.getBankFile().createSection("players");
                        } else {
                            if (tpcsurvival.getBankFile().isSet("players." + player.getUniqueId())) {
                                int bank = tpcsurvival.getBankFile().getInt("players." + player.getUniqueId() + ".bank");
                                int purse = tpcsurvival.getBankFile().getInt("players." + player.getUniqueId() + ".purse");
                                bank = bank + purse;
                                tpcsurvival.getBankFile().set("players." + player.getUniqueId() + ".purse", bank);
                            } else {
                                tpcsurvival.getBankFile().createSection("players." + player.getUniqueId());
                            }
                        }
                        break;
                    case OAK_SIGN:
                        player.sendMessage(ChatColor.YELLOW + "[NPC] " + ChatColor.WHITE + "Banker» " + ChatColor.GRAY + "Type the amount you want to deposit in chat");
                        break;
                    case GOLD_BLOCK:
                        player.closeInventory();
                        Bukkit.getScheduler().runTaskLater(tpcsurvival, new Runnable() {
                            @Override
                            public void run() {
                                bankerGui.bankerGUI(player);
                            }
                        }, 1);
                        break;
                    default:
                        return;
                }
            }

            player.closeInventory();
        }
        if (ChatColor.translateAlternateColorCodes('&', e.getView().getTitle()).equals(ChatColor.DARK_GRAY + "Withdraw Menu")) {
            if (e.getCurrentItem() != null) {
                e.setCancelled(true);

                switch (e.getCurrentItem().getType()) {
                    case PAPER:

                        break;
                    case OAK_SIGN:
                        player.sendMessage(ChatColor.YELLOW + "[NPC] " + ChatColor.WHITE + "Banker» " + ChatColor.GRAY + "Type the amount you want to withdraw in chat");
                        break;
                    case GOLD_BLOCK:
                        player.closeInventory();
                        Bukkit.getScheduler().runTaskLater(tpcsurvival, new Runnable() {
                            @Override
                            public void run() {
                                bankerGui.bankerGUI(player);
                            }
                        }, 1);
                        break;
                    default:
                        return;
                }
            }

            player.closeInventory();
        }
opal juniper
#

?paste

undone axleBOT
opal juniper
#

lmao

unreal quartz
#

soo.. do you save it at any point?

vivid temple
unreal quartz
#

there's no point in the code you sent where you save the file

lost matrix
# vivid temple and i have this

Ok so FileConfiguration is basically a glorified HashMap. Which means it only exists in memory until you write it to a File.

vivid temple
vivid temple
lost matrix
vivid temple
lost matrix
#

You should also save it into a File and not just a String

lost matrix
vivid temple
foggy bough
#

can someone explain what this does? ```java
this.plugin.reloadConfig();

lost matrix
summer scroll
foggy bough
summer scroll
lost matrix
foggy bough
#

also how can I put stuff in a config.yml with my code?

random ledge
#

how to prevent creeper dead after exploded?

vivid temple
summer scroll
lost matrix
lost matrix
random ledge
lost matrix
vivid temple
lost matrix
lost matrix
# vivid temple okay

I would just make sure that it runs for now. So save it when a player clicks the icon.

mighty aurora
#

I have been looking into making a plugin that can stack potions but i have been looking into it and everything i can find in the documentation and forum posts does not work. can someone help me with this?

lost matrix
foggy bough
#

also how can I do something like this with getConfig.set()? Config: blocks: IRON_BLOCK: - DIRT?

lost matrix
foggy bough
lost matrix
foggy bough
#

like?

lost matrix
#

You are just showing a yml setup that has the structure

Section:
  List<String>:
    - String

Without context. So you can just create a section called "blocks" and then add a List<String> with the name "IRON_BLOCK" to it.
This list contains the element "DIRT"

lost matrix
foggy bough
#

using config

lost matrix
#

Ah i see.

maiden briar
#

How works String.format()?

lost matrix
#

Materials can be represented by Strings as they are just enum entries.
Your problem will be that blocks will not be able to drop custom items like named iron ingots or enchanted fishing rods.
Anyways. You could read the config like this:

public class BlockData {

  private final FileConfiguration configuration;

  public BlockData(final JavaPlugin plugin) {
    this.configuration = plugin.getConfig();
  }

  public Map<Material, List<Material>> getMappedDrops() {
    final Map<Material, List<Material>> dropMap = new HashMap<>();

    final ConfigurationSection blockSection = this.configuration.getConfigurationSection("blocks");
    if (blockSection == null) {
      return dropMap;
    }

    for (final String materialKey : blockSection.getKeys(false)) {
      final Material material = Material.matchMaterial(materialKey);
      
      final List<String> materialValues = blockSection.getStringList(materialKey);
      final List<Material> dropMaterialList = new ArrayList<>();
      
      for (final String materialValue : materialValues) {
        final Material dropMaterial = Material.matchMaterial(materialValue);
        dropMaterialList.add(dropMaterial);
      }
      
      dropMap.put(material, dropMaterialList);
    }

    return dropMap;
  }

}

@foggy bough

fluid cypress
#

im doing this, but i still get the old config, what else do i need to do? idr, wasnt reloadConfig enough?

instance.saveDefaultConfig();
instance.reloadConfig();
FileConfiguration config = instance.getConfig();
lost matrix
#

and saveDefaultConfig fails silently if a config already exists.

#

Make sure that you actually use the content of your newly loaded config after calling those methods because the rest of your code doesnt magically update just because you reloaded your FileConfiguration.

fluid cypress
#

yea, i was loading the config after using it, im retarded

foggy bough
#

this is the code I have: java for(int i = 0; i <= mats.length; i++) { this.plugin.getConfig().set("blocks", mats[i]); } but I don't know how to set it like this: blocks: DIRT: - IRON_INGOT

lost matrix
#

Whats the type of your "mats" array

quaint mantle
#

what is java?

foggy bough
lost matrix
lost matrix
# foggy bough Material

So this will result in only the last entry of your array appear in your config.
Example:
[IRON_ORE, STONE, DIRT]
Will result in:

blocks: DIRT

Because you overwrite the section again and again with other materials.

foggy bough
lost matrix
#

You want the array of Materials in the config?

foggy bough
#

trying to make something that drops a random item and stays like that drop

lost matrix
# foggy bough yeah
  public void saveTo(Material[] mats, FileConfiguration configuration) {
    List<String> materialList = new ArrayList<>();
    for (Material material : mats) {
      materialList.add(mats.toString());
    }
    configuration.set("blocks", materialList);
  }
foggy bough
lost matrix
foggy bough
#

bruv

opal juniper
#

just provide the respective config

lost matrix
# foggy bough bruv

This code just writes the materials into the FileConfiguration. Which exists entirely in memory. You need to save it to the file you want later.

indigo crypt
#

ohh yeah, i am still cannot load data. but, when data saving, i see location just *id001. anyone knows?

lost matrix
#

Nothing in that code will work

brisk jacinth
#

No the issue was I had extends JavaPlugin on a command class

indigo crypt
lost matrix
#

But in most cases none

indigo crypt
lost matrix
#

Entity specific data has to be saved/loaded with the chunk they stand in.
Player specific data has to be saved/loaded when they log in or out.

warm lynx
#

Hello again
so
I did not succeed in restarting the servers because I need java 16
But I don't know how to install it
@quaint mantle how did you do?

warm lynx
#

linux

warm lynx
#

what link ?

indigo crypt
dusk flicker
#

?java16_linux

undone axleBOT
#
add-apt-repository --yes https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/
apt-get update

apt-get install -y openjdk-16-jdk

update-alternatives --config "java"```
lost matrix
#

Ill lead you through it... what OS do you have? Ubuntu? Debian?

#

Oh

#

That exists.

indigo crypt
indigo crypt
warm lynx
#

?java16_linux

undone axleBOT
#
add-apt-repository --yes https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/
apt-get update

apt-get install -y openjdk-16-jdk

update-alternatives --config "java"```
lost matrix
# indigo crypt .

This wont install it as a default jdk and is quite tedious. Just use apt for installing.

warm lynx
#

what commands should I do?

indigo crypt
#

just copy it

dusk flicker
#

every command

#

one line at a time

warm lynx
#

ok

indigo crypt
#

sudo apt-get install openjdk-16

#

with sudo

dusk flicker
#

Just follow the command

lost matrix
# indigo crypt error just does at mobs, not at player

Back to your problem. Dont randomly save stuff. Some players may have logged off and some entities just randomly unload. So you will never properly save any data like this. You need to react to events if you want to save data.

warm lynx
#

I did everything but I'm still in java 11

indigo crypt
#

but, my entity test just at near me

lost matrix
indigo crypt
#

search on google

smoky oak
#

we need more than one channel but that's not my question.
Can I get an event fired when a player attempts to place a shulker in another shulker?

opal juniper
#

Inventory move item event iirc

smoky oak
#

k thanks

indigo crypt
#

try use it
sudo update-alternatives --config java

warm lynx
#

i try

lost matrix
warm lynx
#

Nothing to Configure.

indigo crypt
lost matrix
opal juniper
warm lynx
indigo crypt
#

try ss

warm lynx
#

ss ?

lost matrix
# indigo crypt btw

Nobody will be able to help you with this. The code is just messy and full of faulty assumptions.
Take it slow. Format your code properly and split it into several methods. This way it is way easier to maintain.

indigo crypt
#

screen shooooooooot

warm lynx
#

okay

lost matrix
#

Why did he pm it to me...

indigo crypt
heavy void
#

Why my Gson dont has all the functionalities, its the most updated, bruh.

lost matrix
heavy void
#

Not.

lost matrix
heavy void
#

ill send a print

lost matrix
#

spigot 1.8 + no dependency manager. Im out.

smoky oak
#
InventoryType type = e.getInventory().getType();```
That's always the inventory type of whats opened, how do I know if it's a click in the player inventory or the other inventory? Count slots?
opal juniper
lost matrix
smoky oak
#

ah thanks

heavy void
#

Can i delete that?

chrome beacon
#

Why

#

There is no reason to

lost matrix
#

If you delete gson out of the server jar then it wont work anymore.

opal juniper
#

i think they opened the jar with like 7zip or sommin

#

as in their plugin

chrome beacon
#

No that's spigot

#

And Winrar

lost matrix
#

Looks like he manually wants to tinker with the spigot server jar and just delete stuff out of there.

chrome beacon
#

^

opal juniper
#

why lmao

#

hahah

smoky oak
#

SetCursor is deprecated, what should i use instead?

opal juniper
#

look at the message

#

from the look of it

#

it just says not to use it

#
Deprecated.
This changes the ItemStack in their hand before any calculations are applied to the Inventory, which has a tendency to create inconsistencies between the Player and the server, and to make unexpected changes in the behavior of the clicked Inventory.
smoky oak
#

well thats why i dont want to use it

#

is there a better method

opal juniper
#

probably not

#

normally it is listed their if there is

smoky oak
#

okay different question

#

what im trying to do is

#

exchanging slot and cursor to get a shulker into another shulker

#

but now it just throws it in the player inventory

#
//Checks if Shulker box
ItemStack a = e.getCurrentItem();
ItemStack b = e.getCursor();
e.setCurrentItem(b);
e.setCursor(a);```
#

wait

#

it calls the event twice i think?

#

when I'm trying to put another item in it it puts it in the shulker and then back in my hand

#

okay problem solved

warm lynx
#

?java16_linux

undone axleBOT
#
add-apt-repository --yes https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/
apt-get update

apt-get install -y openjdk-16-jdk

update-alternatives --config "java"```
foggy bough
#

Does anyone know how to make a new line in a config.yml so then I don't override the existing data in my config this is my code so far ```java
for(int i = 0; i <= mats.length; i++) {
this.plugin.getConfig().set("blocks", mats[i]);

    }
eternal oxide
#

add them all at once, under one key

smoky oak
#

you're setting mats[i] to the key "blocks" in every iteration of theloop

#

yea like god said

eternal oxide
#

you are just replacing the same key every time

smoky oak
#

on another note: Is there a common material for shulker boxes? or do i have to check the 17 different boxes?

foggy bough
#

I have no idea how to do this

smoky oak
#

BlockBreakEvent, block.getType(), check if its in the config as key

#

if yes

#

grab the value from the config and replace the drop with that

foggy bough
#

I just want to push all minecraft items into the config so then it will change the drop

#

have you seen Dreams video on drops are Random and Multiplied?

#

that is what I want to do

eternal oxide
#
Map<Material, Material> blocks...
blocks.add(Material.DIRT, Material.IRON_INGOT);
this.plugin.getConfig().set("blocks", blocks);```
#

or you could even change teh second to a list if you want multiple drops from one material

foggy bough
#

I want all blocks in minecraft

eternal oxide
#

not all Materials are blocks

foggy bough
#

what?

smoky oak
#

Materials contains everythign

#

sticks

#

void blocks

#

end portal

foggy bough
#

yeah that is what I want

#

I just want the drops

eternal oxide
#

Some materials you can;t create, like AIR

foggy bough
#

I don't need air

eternal oxide
#

Some you shouldn't like Command Blocks

#

exactly

#

so you can;t use ALL Materials

foggy bough
#

then how can I get rid of the materialss that I don't want?

eternal oxide
#

it all depends on what your end goal is

#

are you just messing up what drops from each block break? or you want it totally random?

foggy bough
#

like Dreams video https://www.youtube.com/watch?v=KDlO64GbxIQ&t=642s

eternal oxide
#

I'm not watchign a whoel video to get an idea of what you want

foggy bough
#

it will explain

eternal oxide
#

ok, completely random drops

foggy bough
#

yes

sharp moat
#

Does anyone know the name of the event before the player joins

eternal oxide
#

so break two sand blocks can give different drops

sharp moat
#

nvm, playerloginevent

foggy bough
eternal oxide
#

Not in that video

foggy bough
foggy bough
chrome beacon
#

If you just want to randomize drops use Sethblings datapack

foggy bough
#

hello @eternal oxide ?

chrome beacon
#

.-. Then you will have to filter materials yourself

eternal oxide
#

You will either have to compile a list of droppable items and assign drops per type

#

or completely random

#

In that video even mobs are droppign other things

foggy bough
#

nvm I can just do some other plugin this is hurting my head

foggy bough
smoky oak
#

What the hell is the difference between SHIFT_LEFT and SHIFT_RIGHT

manic bison
#

shift left = your left shift

foggy bough
manic bison
#

shift right = your right shift

smoky oak
#

but everythign else treats those as the same key

manic bison
#

look closely on uir keyboard

#

they do the same thing, but they aren't the same key

#

also
how can i wait a certain amount of time before executing a command ?
my code is

                
            
                @Override
                public void run() {
                    event.getPlayer().sendMessage("hello");
                }
            }, 100L);
#

and the first runTaskLater gives me aan error

#

The method runTaskLater(Plugin, Runnable, long) in the type BukkitScheduler is not applicable for the arguments (RegenBlockListener, new Runnable(){}, long)

#

I don't understand the error tho

smoky oak
#

post it

lost matrix
#

and "this" refers to your listener class.

manic bison
#

means i have to import javaplugin?

smoky oak
#

no

manic bison
#

confused lvl 100

smoky oak
#

it has to be the class that extends javaPlugin

#

and loads in everythign

lost matrix
#

Nope. You need to get an instance of your JavaPlugin class

manic bison
#

oooh

lost matrix
#

And dont use new YourMainClass()

manic bison
#

so bsically "implements JavaPlugin"

lost matrix
#

You need to get the instance of that class

manic bison
#

yep i have the instance

lost matrix
manic bison
#

so it'd be javapluginclass.

agile crown
#

I've been trying for the past 3 hours to get NMS to work on the temporary plugin I'm doing and when I compile I get cannot access net.minecraft.world.item.Item
Idk why use vanilla mappings, Fabric literally uses yarn mappings with no problems, and forge uses MCP mappings, spigot can use Spigot mappings for generated NMS file

smoky oak
#

alternatively just do Bukkit.getServer.getPluginHandler().getPlugin("Plugin name here")

lost matrix
unkempt ore
#

*PluginManager

manic bison
lost matrix
smoky oak
#

eh im saving it in a static variable anyways

lost matrix
woeful crescent
#

I'm kind of worried about InventoryHolders potentially staying in ram even if they're not being used...
I have a GUIHolder interface that I made that is implemented by a custom inventory class that extends InventoryHolder, and is used to store inventory data as well as methods such as inventoryClick(). What if I make a new one for one players inventory, the player uses the inventory, then closes it? Will the inventory holder stay in RAM? Will it be deleted by the garbage collector?

smoky oak
#

well java generally deletes stuff when theres no pointers to it anymore

#

so do variable = null

#

or in your case, listen for the event when the inventory closes then remove it

woeful crescent
#

How would I remove it, though?

lost matrix
unkempt ore
#

This isn't C++

#

You're not supposed to care

smoky oak
#

theres two kinds of people lol

unkempt ore
#

Unless you have like, an array of references, then you should null your stuff

woeful crescent
#

It's not stored anywhere except in the Inventory object itself

#

Right?

lost matrix
woeful crescent
#

Nope

#

Here's the code, one sec

#

Code to open the inventory in question:```JAVA
BossActivationInventory activationInv = new BossActivationInventory();
Inventory inv = activationInv.getInventory();
player.openInventory(inv);

lost matrix
#

If you create it inside a method and then dont hold a reference to it in your class its just on the stack and will be garbage collected when the method is done.

unkempt ore
#

Is there a stack?

#

Pretty sure it just makes the reference somewhere, but it's smart enough to know to delete it when the scope is done

woeful crescent
#

But... BossActivationInventory has processes running inside of it, right? Like maybe a BukkitRunnable to play an animation

unkempt ore
#

That isn't yours

lost matrix
unkempt ore
#

Make sure to stop that stuff under the right circumstances

lost matrix
#

If you cancel the runnable when the inventory closes you should be fine... But thats a bad separation of concernes.

unkempt ore
#

How so?

lost matrix
#

You should have one single runnable that runs all the time and contains some collection of your custom inventories. Then add and remove them from the runnable when they get created or discarded.

woeful crescent
#

What about using a BukkitTask?

lost matrix
#

This runnable should tick the inventories. Having a task for every single inventory will just clutter the mem with anonymous classes

woeful crescent
#

Saving it as one, and then cancelling it when I need to

unkempt ore
#

He's saying it should be a daemon runnable, essentially

#

Not really something you'd cancel until plugin disable or some other reason

unkempt ore
#

Satisfying solution

lost matrix
#

One example:

public class InventoryRunnable implements Runnable {

  private final Set<CustomInventory> inventorySet = new HashSet<>();

  public void addInv(CustomInventory inv) {
    inventorySet.add(inv);
  }
  
  @Override
  public void run() {
    inventorySet.removeIf(inv -> {
      inv.tick();
      return inv.isClosed();
    });
  }

}
unkempt ore
#

And then schedule this

lost matrix
#

And then in the inv close event -> customInventory.setClosed()
This will automatically let the inv remove itself without having a reference to the runnable

manic bison
#

Hey so i'm coming back again because it won't work
Eclipse doesn't throw me any errors but it doesnt work ig

code ```public class RegenBlockListener implements Listener{

@EventHandler
public void onMine(BlockBreakEvent event) {
    
    Player player = event.getPlayer();
    Block block = event.getBlock();
    int y = block.getY();
    int x = block.getX();
    int z = block.getZ();
    if(!(y < 68 || y > 72) && !(x < -223 || x > -218) && !(z < 273 || z > 279) && block.getType() == Material.IRON_ORE){
        
        //ItemStack ep = new ItemStack(Material.ENDER_PEARL);
        //ItemMeta epM = ep.getItemMeta();
        //epM.setDisplayName("§cEnder Perle du futur");
        //epM.setLore(Arrays.asList("§cCette ender perle est unique","§cIssou"));
        //epM.addEnchant(Enchantment.MULTISHOT, 200, true);
        //ep.setItemMeta(epM);
        player.sendMessage("123");
        
        Bukkit.getScheduler().runTaskLater(Bukkit.getServer().getPluginManager().getPlugin("GCAPlugin"), new Runnable() {
            
        
            @Override
            public void run() {
                event.getPlayer().sendMessage("hello");
            }
        }, 20 * 4);
                
                
        
        
    
    return;

}

}
}


basically it says 123 when someone breaks an iron ore, and what i want to do is, 4 secs later (80 ticks), send "hello" to the same player
lost matrix
# woeful crescent Saving it as one, and then cancelling it when I need to

Or a more simple approach:

public class InventoryRunnable implements Runnable {

  private final Set<CustomInventory> inventorySet = new HashSet<>();

  public void addInv(final CustomInventory inv) {
    this.inventorySet.add(inv);
  }

  public void removeInv(final CustomInventory inv) {
    this.inventorySet.remove(inv);
  }

  @Override
  public void run() {
    for (CustomInventory inv : inventorySet) {
      inv.tick();
    }
  }

}
lost matrix
manic bison
#

public clss RegenBlockListener implements Listener

#

and i imported the Listener, if its what you ment

#

meant

lost matrix
manic bison
#

so i register my RegenBlockListener in my class that extends JavaPlugin?

woeful crescent
#

Yeah

lost matrix
#

An instance of your RegenBlockListener class

manic bison
#

alrighty, i'll try, thanks

#

wait

#

i have already registered the isntance

unkempt ore
lost matrix
manic bison
#

getServer().getPluginManager().registerEvents(new RegenBlockListener, this)

indigo crypt
#

hey all, what is the best method for saving hash map at reload

lost matrix
lost matrix
manic bison
#

it goes through

#

it tells me 123 when i mine iron ore

#

but it doesnt go through my scheduler, thus doesnt send me hello aft-er 4 secs

lost matrix
indigo crypt
lost matrix
# manic bison 10000% sure

Hm... try player.sendMessage(...) instead of event.getPlayer().sendMessage(...)
Other than that i dont see a problem.

manic bison
#
org.bukkit.event.EventException: null```

```Caused by: java.lang.UnsupportedOperationException
at java.util.AbstractList.add(AbstractList.java:153) ~[?:?]
at java.util.AbstractList.add(AbstractList.java:111) ~[?:?]
unkempt ore
#

It's the wrong type of list

lost matrix
unkempt ore
#

Strange

#

@manic bison Where are you adding something to a list

lost matrix
unkempt ore
#

Because UOE there means the implementation doesn't want you to modify it

lost matrix
#

Like add() to a SingletonList

unkempt ore
#

Yeah

#

You are adding to a Collection which doesn't want to be added to

indigo crypt
lost matrix
#

The thing is i dont see anything collection related in his code...

manic bison
#
org.bukkit.event.EventException: null
at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:320) ~[minecraft_server.jar:git-Spigot-cbd1a1b-009d8af]
at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:70) ~[minecraft_server.jar:git-Spigot-cbd1a1b-009d8af]
at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:529) ~[minecraft_server.jar:git-Spigot-cbd1a1b-009d8af]
at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:514) ~[minecraft_server.jar:git-Spigot-cbd1a1b-009d8af]
at net.minecraft.server.v1_14_R1.PlayerInteractManager.breakBlock(PlayerInteractManager.java:295) ~[minecraft_server.jar:git-Spigot-cbd1a1b-009d8af]
at net.minecraft.server.v1_14_R1.PlayerInteractManager.a(PlayerInteractManager.java:254) ~[minecraft_server.jar:git-Spigot-cbd1a1b-009d8af]
at net.minecraft.server.v1_14_R1.PlayerInteractManager.a(PlayerInteractManager.java:151) ~[minecraft_server.jar:git-Spigot-cbd1a1b-009d8af]
at net.minecraft.server.v1_14_R1.PlayerConnection.a(PlayerConnection.java:1185) ~[minecraft_server.jar:git-Spigot-cbd1a1b-009d8af]
at net.minecraft.server.v1_14_R1.PacketPlayInBlockDig.a(SourceFile:40) ~[minecraft_server.jar:git-Spigot-cbd1a1b-009d8af]
at net.minecraft.server.v1_14_R1.PacketPlayInBlockDig.a(SourceFile:10) ~[minecraft_server.jar:git-Spigot-cbd1a1b-009d8af]
at net.minecraft.server.v1_14_R1.PlayerConnectionUtils.lambda$0(PlayerConnectionUtils.java:19) ~[minecraft_server.jar:git-Spigot-cbd1a1b-009d8af]```
unkempt ore
#

Weird

manic bison
#
at net.minecraft.server.v1_14_R1.IAsyncTaskHandler.executeTask(SourceFile:144) [minecraft_server.jar:git-Spigot-cbd1a1b-009d8af]
at net.minecraft.server.v1_14_R1.IAsyncTaskHandlerReentrant.executeTask(SourceFile:23) [minecraft_server.jar:git-Spigot-cbd1a1b-009d8af]
at net.minecraft.server.v1_14_R1.IAsyncTaskHandler.executeNext(SourceFile:118) [minecraft_server.jar:git-Spigot-cbd1a1b-009d8af]
at net.minecraft.server.v1_14_R1.MinecraftServer.aX(MinecraftServer.java:909) [minecraft_server.jar:git-Spigot-cbd1a1b-009d8af]
at net.minecraft.server.v1_14_R1.MinecraftServer.executeNext(MinecraftServer.java:902) [minecraft_server.jar:git-Spigot-cbd1a1b-009d8af]
at net.minecraft.server.v1_14_R1.IAsyncTaskHandler.awaitTasks(SourceFile:127) [minecraft_server.jar:git-Spigot-cbd1a1b-009d8af]
at net.minecraft.server.v1_14_R1.MinecraftServer.sleepForTick(MinecraftServer.java:886) [minecraft_server.jar:git-Spigot-cbd1a1b-009d8af]
at net.minecraft.server.v1_14_R1.MinecraftServer.run(MinecraftServer.java:819) [minecraft_server.jar:git-Spigot-cbd1a1b-009d8af]
at java.lang.Thread.run(Thread.java:829) [?:?]
Caused by: java.lang.UnsupportedOperationException
at java.util.AbstractList.add(AbstractList.java:153) ~[?:?]
at java.util.AbstractList.add(AbstractList.java:111) ~[?:?]
at fr.pierronus.gcaplugin.RegenBlockListener.onMine(RegenBlockListener.java:35) ~[?:?]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:?]
at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:566) ~[?:?]
at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:316) ~[minecraft_server.jar:git-Spigot-cbd1a1b-009d8af]
... 20 more```
unkempt ore
#

No, no, no

lost matrix
unkempt ore
#

Please paste

lost matrix
manic bison
#

i've checked and its weird

#

its a comment

woeful crescent
#

Thank you guys for all of your help, but upon realizing that I don't actually need a new inventory for each player, since there are only 2 variations in total, I have decided to create 2 different inventories and open the same inventory for each player with the same outcome.

indigo crypt
lost matrix
#

Then you did not compile and add the right version. "10000% sure" @manic bison

manic bison
#

i did

#

3 times

#

imma downlod the plugin from my server files and open it

#

i don't know if that's related but i'm using plugman to reload the plugin

lost matrix
smoky oak
#
Inventory inv = Bukkit.createInventory(null, 27, "Shulker Box");
inv.setContents( ((ShulkerBox) e.getCurrentItem().getItemMeta()).getInventory().getContents() );```
leads to
`Could not Pass event` where e is `InventoryClickEvent` and ```java
e.getInventory().getType().equals(InventoryType.SHULKER_BOX)``` equals true
#

correction

#
e.getCurrentItem().getType()``` is a shulker item
manic bison
lost matrix
smoky oak
#
if(type.equals(InventoryType.PLAYER)
                && (e.getInventory().getType().equals(InventoryType.SHULKER_BOX))
                && (shulkerset.contains(e.getCurrentItem().getType()))
                && ((e.getClick().equals(ClickType.SHIFT_LEFT)) || e.getClick().equals(ClickType.SHIFT_RIGHT))){
                    player.sendMessage("5");

                    Inventory inv = Bukkit.createInventory(null, 27, "Shulker Box");
                    inv.setContents( ((ShulkerBox) e.getCurrentItem().getItemMeta()).getInventory().getContents() );
                    player.sendMessage("Click");
                    if(inv.isEmpty()){
                        player.sendMessage("Empty");
                    }

            }```
Returns '5' in chat then a error to console
lost matrix
smoky oak
#

theres none

#

just

#

ah wait wrong window

manic bison
smoky oak
#

java.lang.ClassCastException: class org.bukkit.craftbukkit.v1_17_R1.inventory.CraftMetaBlockState cannot be cast to class org.bukkit.block.ShulkerBox (org.bukkit.craftbukkit.v1_17_R1.inventory.CraftMetaBlockState and org.bukkit.block.ShulkerBox are in unnamed module of loader 'app')

lost matrix
#

This means the BlockState you are trying to cast is not of type ShulkerBox...

smoky oak
#

wait what's the shulker box item?

lost matrix
#

Ah i see. ItemMeta can not be a BlockState

#

Cast the ItemMeta to BlockStateMeta

#

And get the BlockState from that BlockStateMeta

#

Then cast the BlockState to ShulkerBox

#

And do it line by line.

smoky oak
#

well it works like that thanks

#

any simpler method to check if the box is empty tho?

maiden briar
#

I have a problem with the scoreboard, if I display the health of a player it is 0. If the player gets hit (for the first time), then the health changes and keeps displaying the correct health

lost matrix
smoky oak
#

ah ok

#

i want to allow shulkers to go in shulkers

#

but only when empty

lost matrix
indigo crypt
smoky oak
#

already did that but the problem is actually getting the shulker into the other shulker

lost matrix
maiden briar
#

Never

#

I just add it to the scoreboard

smoky oak
#

and im now working on the code for the shift click since the other function body is done

lost matrix
smoky oak
#

thanks

maiden briar
#

Do u know how to fix it?

lost matrix
#

What spigot version are you using?

maiden briar
#

1.17

hasty prawn
#

I think I had the same issue, I think I managed to get around it by manually setting the score to their current health

lost matrix
#

Or damage them for 0.001 one tick later :S

#

(dont)

hasty prawn
#

Lmao I mean it would work though

maiden briar
#

I am adding an Objective to the scoreboard with DisplaySlot.BELOW_NAME, and with criteria health, when the game starts I see 0 as health for everyone. From the moment somebody takes damage the health is set to their current health and keeps changing, so that works

hasty prawn
#

Set their score & their health to 20

maiden briar
#

Oh, can you change the score from an unmodifable criteria?

hasty prawn
#

Yeah you should be able to

maiden briar
#

Ok I will try it

#
for(Player player : Bukkit.getOnlinePlayers())
    healthNameObjective.getScore(player.getName()).setScore((int) player.getHealth());

Like this?

quaint mantle
#

where can i find it?

maiden briar
#

Does not work, it is still 0

#

No errors

#

Was doing it on board initializing, and not on applying so I will retest

#

Still not working

#

Will try to find out tomorrow

crude cedar
#

yo, i tried making a buildtools rev on 1.17.1 and it said my java was out of date for it, i need java 16, yet......

maiden briar
#

16.0.2

#

Just install it

crude cedar
#

i just got 16.0.2 today

maiden briar
#

Nice

crude cedar
#

those 2 are in my programs list

#

but it's still saying my java is out of date

#

i went into cmd prompt and did java -version and it says "Java 1.8.0"

#

which i have but i still have java 16

hasty prawn
#

You have to change your path variable to the Java 16 jdk

crude cedar
#

how......?

hasty prawn
#

Google how to change path variables

crude cedar
#

nothing's helped, i have java 16 installed but it doesn't show up in my Program Files (86x), Oracle, Java, javapath at all

and i'e searched youtube and weba nd found NOTHING helpful, nothing but indians i can't understand and 140p videos that skip through everything and don't explain shit

#

what the fuck is so hard about just showing HOW the actual fuck to change a path.......

torn shuttle
#

it's funny how people keep saying that indian videos are everywhere yet I hardly ever run into any

crude cedar
#

i searched up "how to change my path from 1.8 to 16" and the 1st video i clicked was an indian dude

torn shuttle
#

the most recent one I've seen was one linked by reddit where it was literally just a dude bullshitting for 5 hours straight pretending to remake twitter but the code was 100% nonsensical bullshit and he was clearly buying bots to promote his channel, it was hilarious

#

at the end he says he's going to show the results of his twitter clone and opens... twitter

crude cedar
#

ok that's great, that still doesn't help me find out how to change my path

torn shuttle
#

11/10 what a great programmer

crude cedar
#

or do what im attempting to do

dire marsh
#

Doesn't the openjdk installer set path for you?

torn shuttle
#

it should yes

#

as long as you install it properly

crude cedar
#

I installed it from oracle, and I just clicked next and whatnot

#

it installed the path like that when i did it for 1.8

#

unless java 16 decided to ucking change because nothing can be simple anymore..?!??!

dire marsh
#

Don't use oracle, use adoptopenjdk

crude cedar
#

so i gotta delete the 2 java 16's i have and replace them with adoptopenjdk

#

also y not use oracle? they've been around since java was basically made

quaint mantle
#

Why is the PlayererChatEvent like crossed out but still readeable

#

if you know what i mean

crude cedar
#

depricated

#

AsyncPlayerChatEvent

quaint mantle
#

why Async tho

#

what does that change

dire marsh
crude cedar
#

that i'm not 100% sure u can ask someone else

#

i just know that that's y

quaint mantle
#

and why does PlayerChatEVent work

#

but does it work like PlayerChatEvent

crude cedar
#

it works it's just not used anymore for the specific version of minecraft you're coding for

dire marsh
#

@quaint mantle AsyncPlayerChatEvent is used because chat is now async

crude cedar
#

different version, different methods

quaint mantle
#

ok but is it the same as PlayerChatEvent

dire marsh
#

no

#

it's on another thread

crude cedar
#

define async btw?

quaint mantle
#

ok but can it be cancellable

potent quest
#

yes

dire marsh
#

yes

quaint mantle
#

ok thats all i need thx

crude cedar
#

can anyone tell me whether or not i need to remove both my java 1.16's from oracle in my programs list and get 1 from adoptopenjdk or just get the 1 from adoptopenjdk and let that set its path

dire marsh
#

you don't need to but you probably should

lusty cipher
#

Just noticed this, why do some of my classes have a $1 at the back of it, as if there was a inner class called 1 there, but there isn't. What is this?

warm lynx
#

Hello again
so
I did not succeed in restarting the servers because I need java 16
But I don't know how to install it
@quaint mantle how did you do?

unreal quartz
lusty cipher
#

oh so its generating anonymous classes somewhere? 🤔

#

I don't use anonymous classes so this is kinda a surprise

unreal quartz
#

well you've made an anonymous class or I've seen it can be an enum as well

lusty cipher
#

huh

#

this class has 4 overriden functions and one other function. All of those just do simple stuff, and yet it is generating that $1 class

jagged badge
#

I'm trying to move my npc (EntityPlayer) as if it was walking (so no tp)
I tried to use PacketPlayOutRelEntityMove but no matter what I find on the internet nothing works (barely moves, or goes anywhere...) If anyone knows how to use this.
Thanks

unreal quartz
#

is that the right class? it's FriendManageInventory

crude cedar
lusty cipher
#

it generates it for a lot of them

#

that was just the shortest one of them all

dire marsh
warm lynx
#

how can i download java 16 on my VPS

unreal quartz
lusty cipher
#

huh

#

really? thats interesting

unreal quartz
#

it contains an array which helps determine where to jump to for each case

lusty cipher
#

and yeah that would line up with the classes were this is not generated

lusty cipher
#

i wonder why that is just not in the main class

proud basin
#

Are you not able to get is a ResultSet is null?

royal garden
#

i'm looking at getting into plugin development, I have some java experience from my runescape botting days. where should I start? are there any resources that might help?

torn shuttle
#

the spigot api has starter resources which start you down the right path

#

wiki I mean

#

that aside you'll probably need to hit up the forums quite a bit when you're first starting off to get a feel for how things are generally structured

#

it's easy to find a solution for pretty much every basic issue on there