#help-development

1 messages Β· Page 1454 of 1

eternal night
#

Speed :>

quaint mantle
#

im just following what spigotmc told me to do

#

oh it worked

#

sweet

#

thanks

keen kelp
#

So is it possible to get how much a player is suppose to regenerate before being limited by the health bar?

eternal oxide
#

Not easily no

keen kelp
#

oof

keen kelp
#

I see

#

this is was I was planning on doing

#

calculate the heal potion myself

#

now I only need to recreate natural regen

digital rain
#

oh welp

#

how do i get an empty map, i mean which material is an empty map

#

bc both MAP and FILLED_MAP are normal maps instead of empty ones

#

any ideas? :(

#

ill try LEGACY_EMPTY_MAP

torn crescent
#

Hey,
I am working on a Recipe-Addon for my Server.

I created an object called CustomShapedRecipe.class and I serialize it using the ConfigurationSerializable interface.

It saves the object correctly to the config, but when I am trying to get the object back from the config, it cannot even find the stored Keys, even tho they show up in the .yml.

This is the yml-file:

  ==: customShapedRecipe
  name: Test-Recipe
  skill: COMBAT
  conditions:
    ==: conditionList
  enabled: true
  result:
    ==: org.bukkit.inventory.ItemStack
    v: 2586
    type: NETHER_GOLD_ORE
  ingredients.7:
    ==: org.bukkit.inventory.ItemStack
    v: 2586
    type: NETHER_GOLD_ORE
  ingredients.8:
    ==: org.bukkit.inventory.ItemStack
    v: 2586
    type: NETHER_GOLD_ORE
  ingredients.9:
    ==: org.bukkit.inventory.ItemStack
    v: 2586
    type: NETHER_GOLD_ORE```

I also registered it using 
```registerConfigurationSerializable(CustomShapedRecipe.class,     "customShapedRecipe");```
keen kelp
#

can't you only listen to 1 event?

eternal oxide
wraith rapids
#

the legacy compat layer is bullshit

keen kelp
#

yeah but it asks for PotionSplashEvent, LivingEntity and PotionEffectType?

digital rain
#

seems like i didnt

#

what should i put there?

eternal oxide
keen kelp
#

wait I can just listen to EntityPotionEffectEvent and I can get them right

eternal oxide
#

you listen to the PotionSplashEvent

keen kelp
#

wait then what about drunken potion

wraith rapids
#

backwards compatibility measures should be employed by the plugin, not the platform

eternal oxide
#

what about it? This method accepts a PotionEffectType

digital rain
#

ok then hmm

#

ty

keen kelp
#

but it's not a splash potion?

#

or is that not how things work

eternal oxide
#

I'm not writing your plugin for you

keen kelp
#

Im just confused

#

listening PotionSplashEvent would only listen to potion splashed onto players right?

#

so drunken potion won't be managed?

eternal oxide
#

You asked how to get the full heal amount on a splash potion. We answered that one. Do you have another question?

keen kelp
#

wait did I

#

my example mentioned splashing a potion but I never specified I only want to handle splash potions tho?

eternal oxide
keen kelp
#

so PotionSplashEvent for splash pots and this for consumed potion

#

got it

flint elk
#

how can I start a sub server through the proxy?

ivory sleet
#

sub server?

flint elk
#

nah

#

i mean

ivory sleet
#

Like a spigot backend server?

flint elk
#

like a lobby

ivory sleet
#

Oh yeah

flint elk
#

im not very good at english πŸ˜…

ivory sleet
#

That’s fine

#

One way to do it would be through ProcessBuilder I think

wraith rapids
#

are you trying to be hypickle

flint elk
#

no

wraith rapids
#

why do you need to spin up new instances at runtime

keen kelp
#

if not Im gonna start debugging

flint elk
wraith rapids
#

a valid use case

#

carry on

keen kelp
#

ok I shall start debugging

royal hawk
#

Guys who can help particles..

eternal oxide
#

?ask

queen dragonBOT
#

If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply.

digital rain
#

it works ty 😊

kind coral
#

anyone?

earnest junco
# kind coral anyone?

looks like you're implementing some form of id system to store your data under, make sure that ID stays permanent or that you wipe the file before writing to it again

eternal oxide
earnest junco
#

^or even better, take the uuid as key and if one uuid can have multiple locations, make it a list

wraith rapids
#

what are we talking about

keen kelp
kind coral
#

setup saving is called in the onenable

quaint mantle
#

I like that theme πŸ™‚

kind coral
quaint mantle
#

Which one is it?

kind coral
opal juniper
#

Can you stop the items in a crafting table from being put into a players inventory when the exit it?

earnest junco
kind coral
earnest junco
kind coral
opal juniper
#

Do i just have to remove them manually?

kind coral
#

why u spoonfeed me, you could have told me what to do and i would have tried to do it xd

wraith rapids
#

how about you don't persist arbitrary data with the bukkit config api

earnest junco
kind coral
#

yeah its also i really dont get a lot of english i am italian my bad ahah

earnest junco
earnest junco
#

dont compare strings with == pls ty

dense goblet
#

is persistentDataContainer.remove(key) broken?

#

it doesnt clear the NBT

eternal oxide
#

no its not broken

dense goblet
#

oh I think I know whats happening, my bad

keen kelp
#

how do I change gamerule s

#

GameRule.getByName("NATURAL_REGENERATION") and what's next

quaint mantle
#

I get a compilation error when trying to compile my plugin (updated to Java 16):

P:\xTag\src\main\java\me\N137\xTag\events\xTagEvent.java:33:44
java: cannot access java.util.function.Consumer
  class file for java.util.function.Consumer not found

The xTagEvent file: https://paste.md-5.net/iniyesukok.cs

quartz anchor
#

make sure to use the right java version

quaint mantle
#

16

quartz anchor
#

are you using maven?

quaint mantle
#

Yes?

quartz anchor
#

try include this build configuration

quaint mantle
#

Solved it, thanks πŸ™‚

keen kelp
#

what's the range for setFoodLevel

#

is it 0 - 20

eternal night
#

I don't think food level has an enforced limit

#

it will be reset to 20 whenever it is updated (if it was above that prior)

royal hawk
#

Who can help particles location please?

#

no

#

this does not solve my problem

eternal night
#

Tbh if you are going to dive deeper there isn't much generic help anyone could offer

dense goblet
#

why are there false Left Click Air events when right clicking sometimes?

eternal night
#

left click air events are triggered when the server receives the swing arm packet

dense goblet
#

nah it registers the item correctly

eternal night
#

anything on the client side that procides such behaviour will trigger a left click air event

dense goblet
#

ah so there's no way to circumvent it

eternal night
#

yeah, either the fake ones or no left click air events at all 😦

dense goblet
#

oh well

royal hawk
#

U understand finnbon docs?

opal juniper
#

i need to do serialisation and deserialisation now

#

but, the concept works

#

its like the tinkerers crafting bench from modded

#

Is there a good way to serialise / deserialise ItemStacks?

wraith rapids
#

yes

#

paper's ItemStack::serializeAsBytes

#

everything else that i know of is either incomplete or runs into versioning issues

opal juniper
#

But i don't want to use paper 😒

#

thats fair enough

wraith rapids
#

copy the impl i suppose

#

Bukkit.getUnsafe().serializeItem(itemStack);

#

assuming that is included in spigot, anyway

opal juniper
#

nope

#

getUnsafe has no methods

wraith rapids
#
java.io.ByteArrayOutputStream outputStream = new java.io.ByteArrayOutputStream();
        NBTTagCompound compound = (item instanceof CraftItemStack ? ((CraftItemStack) item).getHandle() : CraftItemStack.asNMSCopy(item)).save(new NBTTagCompound());
        compound.setInt("DataVersion", getDataVersion());
        try {
            net.minecraft.server.NBTCompressedStreamTools.writeNBT(
                compound,
                outputStream
            );
        } catch (IOException ex) {
            throw new RuntimeException(ex);
        }

        return outputStream.toByteArray();
opal juniper
#

what version is that for

wraith rapids
#

any

#

of course you will need to import the NBTTagCompound and other nms classes from different packages depending on the nms version

opal juniper
#

ok

#

i will have a look in a bit

eternal night
#

just be a bit inspired by the paper commit for it xD

tired spoke
#

someone can link me how to add the APIs of an another plugin in mine custom work (for example add PAPI support and create placeholders)

opal juniper
#

just add them as a dependency

tired spoke
#

for addind a placeholder

tulip lodge
#

hi

eternal night
opal juniper
#

either in maven or in ur ide

tulip lodge
#

?paste

queen dragonBOT
tulip lodge
#

how to a fix this

#

command is not works

#

pls help i need

#

?

eternal night
#

wat xD

opal juniper
#

Can blocks have a UUID or something
I need something unique

eternal night
#

there isn't even a stacktrace, what am I missing

#

no 😦

tulip lodge
eternal night
#

blocks (which are not tile entities) are just a few bytes representing the material later one

#

16 bytes for a UUID would be a bit of a yikes

wraith rapids
#

blocks are just a few bits in a chunk's palette somewhere

opal juniper
#

i guess i will have to use their location then

eternal night
#

most likely

wraith rapids
#

what're you trying to do

tired spoke
#

when i added the plugin on the dependent i can create a placeholder?

eternal night
#

idk if you could craft a unique key for a block combining chunk x and z plus the x,y,z of the block

opal juniper
#

but i need a 'key' for each crafting table

#

atm i am just using their location

eternal night
#

I mean, then just chunk x,y,z and internal location x,y,z

#

as your keys

#

should work out nicely in the database

wraith rapids
#

redlib has some sort of a persistent block data feature

#

although supposedly it is kind of prone to exploding

maiden briar
#
private static Field getStaticField0(Class<?> clazz, String field)
    {
        Class<?> superClass = clazz;

        if(superClass == null)
            return null;

        while(superClass != null)
        {
            try
            {
                System.out.println(Arrays.toString(superClass.getDeclaredFields()));
                System.out.println(superClass.getDeclaredField(field));
                Field reflectedField = superClass.getDeclaredField(field);
                System.out.println(reflectedField);
                reflectedField.setAccessible(true);
                System.out.println(reflectedField);
                Field modifiersField = Field.class.getDeclaredField("modifiers");
                System.out.println(reflectedField);
                modifiersField.setAccessible(true);
                System.out.println(reflectedField);
                modifiersField.setInt(reflectedField, modifiersField.getInt(reflectedField) - Modifier.FINAL);
                System.out.println(reflectedField);
                return reflectedField;
            }
            catch(NoSuchFieldException e)
            {
                superClass = superClass.getSuperclass();
            }
            catch(SecurityException e)
            {
                System.out.println("A security manager may be preventing you from setting this field");
                e.printStackTrace();
            }
            catch(IllegalAccessException | IllegalArgumentException e)
            {
                e.printStackTrace();
            }
        }

        return null;
    }

All prints are printing the good thing, but if I call Field reflectedField = getStaticField0(getClass(className), field); and print reflectedField it is null? Btw getClass works

opal juniper
#

I realised tho, that i have to listen for every single thing that could happen to the tnt

eternal night
#

?paste

queen dragonBOT
eternal night
#

please

maiden briar
#

Ok....

eternal night
#

you are spamming the entire chat xD

wraith rapids
#

yeah, you have to listen to like 500 events

eternal night
#

can't even read what is said above 😦

wraith rapids
#

and it's still not reliable

opal juniper
#

yeah

maiden briar
#

https://paste.md-5.net/oqafecoder.cs (All prints are printing the good thing, but if I call Field reflectedField = getStaticField0(getClass(className), field); and print reflectedField it is null? Btw getClass works)

opal juniper
#

like, e.g piston movements explosions etc etc

#

OOOOOOOHHH

#

i had an idea

wraith rapids
#

btw that reflective final bullshit will go rip once 1.17 comes around

eternal night
#

😦

wraith rapids
#

1.17 apparently uses a fairly new version of java which has nerfed reflection into a limp dicked shadow of what it was

maiden briar
#

Why?

eternal night
#

project jigsaw

maiden briar
#

Is it an good idea to already use Java 16 then?

wraith rapids
#

probably yes

eternal oxide
#

Security

eternal night
#

will murder your reflective access to jdk internals

opal juniper
wraith rapids
#

you can't reflectively access the fields of propietary classes anymore

maiden briar
#

Come on

drifting halo
#

oh my, NNY still alive

wraith rapids
#

f.e modifiersField will throw a NoSuchFieldException

maiden briar
#

How does reflection work then?

wraith rapids
#

it fucking doesn't

#

that's the point

drifting halo
#

it doesnt lol

wraith rapids
#

you can't do anything

maiden briar
#

Why is Java so rude?

wraith rapids
#

because "security"

#

imagine being able to fuck with your code on your system

eternal night
#

I mean, unless mojang actually packages their server code into a package

wraith rapids
#

who do you think you are

maiden briar
#

Btw somebody knows when 1.17 will be released?

eternal night
#

you can still modify the server reflectively all you like

#

afaik projects without their respective modules expose everything

#

and may still be mutated using reflection

wraith rapids
#

issue is that java 16 reflection can't find a lot of fields from the java base libraries

opal juniper
eternal night
#

oh yeah, java base library is rip

wraith rapids
#

for example the modifiers field he is using to change finality cannot be found via reflection anymore

eternal night
#

you can't access that

#

ye

maiden briar
#

AARGH why.....

eternal night
#

securityyyy

#

:>

wraith rapids
#

which leaves methodhandles hacks as your only option for fucking with finality

maiden briar
#

Ok then I have to live with it.....

wraith rapids
#

and that's a pain in the ass

maiden briar
#

Yes

wraith rapids
#

tbh just mix in some bytecode hacks

eternal night
#

tbh we will just live in a world where everyone uses their own fork

#

and I am happy

#

like, not too hard to just create a fork off of paper

#

and patch your way to happiness

wraith rapids
#

forking and maintaining everything you use is also a pain in the ass though

quaint mantle
#

I just found out Java has textblocks since Java13 and I'm happy now πŸ™‚

maiden briar
#

Haha nice

#

But 1.17 takes not too long then

#

Then I have to upgrade everything to java 16...................

eternal night
#

I mean, java is backwards compatible

#

well

#

to some degree

maiden briar
#

So only upgrading to 11 is also good?

#

Yes, thanks

#

Wth already 1.18 known?

opal juniper
#

well, its like 1.17.5

#

its the other half

maiden briar
#

Oh

opal juniper
#

terrain and shit

quaint mantle
#

I just upgraded to Java 16

#

It's worth it

maiden briar
#

Haha

#

Will it work if I now upgrade to 16, and then use the plugin in a java 8 1.16.5 server?

opal juniper
#

no

maiden briar
#

Or do I need to run the server on 16?

opal juniper
#

yeah

maiden briar
#

Ok, then I will download Java 16

opal juniper
#

older classes work on newer java but not the other way around

maiden briar
#

Ok thanks

opal juniper
#

Can you have one method listen for 2 events

#

cause they have the same params

#

BlockPistonRetractEvent && BlockPistonExtendEvent

eternal night
#

no

wraith rapids
#

kind of

eternal night
#

well some have parent classes

wraith rapids
#

f.e you can listen to EntityDamageEvent

eternal night
#

InventoryInteractEvent listeners execute for a bunch too

wraith rapids
#

which will catch both EntityDamageByEntity and EntityDamageByBlock

opal juniper
#

Ahh, ok

wraith rapids
#

but that only works for classes which have a static getHandlers method declared

#

you can't f.e listen to Event and catch all events

maiden briar
#

I just found out I have more than 5800 .java files on my pc....

wraith rapids
#

because Event doesn't have a HandlerList

opal juniper
#

so this would be BlockPistonEvent

wraith rapids
#

assuming it has a handlerlist, yes

opal juniper
#

yeah, it wouldn't work in this case but ok thanks

tardy delta
#

does this logs a player join to the console?

@EventHandler
    public void onPlayerJoin(PlayerJoinEvent event) {
        Player p = event.getPlayer();
        event.setJoinMessage(ChatColor.translateAlternateColorCodes('&', "&7[&a&l+&7] &b" + p.getName() + " &7joined the server."));
}
eternal oxide
#

No, you have to listen to Extend and Retract as BlockPistonEvent is Abstract with no handlers

maiden briar
#

I can't find any download for java 16 jre

quaint mantle
#

get jdk

#

not jre

#

jdk = java development kit
jre = java runtime enviroement.

maiden briar
#

Ok, but I also need to run the server?

quaint mantle
#

Yeah, do you use pterodactyl or?

maiden briar
#

No local pc

quaint mantle
#

Can't help ya with your server πŸ™‚

#

I use pterodactyl on a vps

maiden briar
#

What is a vps?

wraith rapids
#

you can have multiple jdk's

quaint mantle
#

Virtual Private Server

maiden briar
#

Ah

tardy delta
#

is pterodactyl free?

quaint mantle
#

yes

wraith rapids
#

a jdk is just a directory with a bunch of shit in it

quaint mantle
#
tardy delta
#

ooh

maiden briar
#

@wraith rapids I need to jre

wraith rapids
#

nothing is stopping you from having all of them at once

#

jdk includes jre

maiden briar
#

Oh ok

#

@quaint mantle you know that I don't have a vps?

#

Or can't I just create a virtual os?

quaint mantle
#

DM me πŸ™‚

opal juniper
#

what is the event for endermen picking up blocks

opal juniper
#

oh

#

hmm

quaint mantle
#

EntityChangeBlockEvent

opal juniper
#

yeah ok thanks

#

why did they get rid of

#

EndermanPickupEvent

maiden briar
eternal oxide
#

too specific

opal juniper
#

i mean, that could just be a subclass, right?

eternal oxide
#

no need if you make it for Entity, Naming a Mob type is pointless

opal juniper
#

Fair enough

maiden briar
#

My servers starts with java 16 but yea the reflection errors started to appear.....

drifting halo
#

all player messages are logged to the console too

#

not much of a logger if it doesnt log everything

wraith rapids
#

consider yourself logged

tardy delta
#

If i want to make a command /<plugin name> reload do i need to make a command with the name <plugin name> and the subcommand reload?

wraith rapids
#

yes

tardy delta
#

oh okay

scenic zenith
#

what will happen to the uuids when the mojang accounts are completly replaced by microsoft ones?

wraith rapids
#

i don't know anything about that but going by common sense they'd stay

eternal oxide
#

But going by MS logic, they will be completely replaced and break everything

scenic zenith
#

nice πŸ™‚

wraith rapids
#

one more reason to use offline mode

scenic zenith
#

seriously?

wraith rapids
#

i don't trust microsoft

#

i didn't trust mojang either

eternal oxide
#

I trusted Mojang, up until MS purchased them

#

MS is all about Money and selling user data, so no trust there.

wraith rapids
#

minecraft is the new skype

tardy delta
#

rip minecraft πŸ˜”

paper viper
#

return to roblox

tardy delta
#

noo

paper viper
#

xD

tardy delta
#

even worser

#

πŸ™„

scenic zenith
#

but is it really getting that bad with microsoft?

quiet ice
#

I mean, worst case scenario the community opens it's own authserver

scenic zenith
#

wdym with own authserver?

wraith rapids
#

mojang runs an auth server

#

clients authenticate against that server

#

and servers check whether their authentication is valid from that server

#

iirc servers can set their own auth servers now, so it'd be relatively trivial for the community to just set up its own auth server

scenic zenith
#

thx

quiet ice
#

that is interesting

wraith rapids
#

that said it wouldn't ever actually work and nothing would ever come of it

#

nobody could agree on which of the dozen auth servers people would invariably start is the right one

quiet ice
#

So I should do it quick to secure a monopoly then?

scenic zenith
#

then i will just run an offline mode server

tardy delta
#

did microsoft already bought discord?

scenic zenith
#

no

#

sony made a cooperation i think

#

so that the ps5 gets it

wraith rapids
#

tbh microsoft would be almost better than the current people in charge

scenic zenith
#

the new Font 😦

tardy delta
#

ew

quiet ice
#

idk, I think the recent changes were made for MS

#

Or just any other company actually

wraith rapids
#

what are the recent changes

quiet ice
#

advertising friendliness

wraith rapids
#

what

#

i'm going to plaster my website with distorted and irrelevant fake discord logos out of spite now

#

how does a goatse discord logo sound

keen kelp
#

since setDurability is deprecated, what do we use instead of it now

wraith rapids
#

itemmeta

wraith rapids
#

durablity is no longer stored on the itemstack, it's stored on the itemmeta of the itemstack

#

and the itemmeta may be an instanceof damageable

keen kelp
#

What do I put in the brackets then

wraith rapids
#

what brackets

scenic zenith
#

just cast the item meta to a damagable

keen kelp
#

p.getInventory().getItemInMainHand().setItemMeta()

#

and?

wraith rapids
#

get the item

#

get the meta

#

check and cast to damageable

#

set damage

#

set the meta

#

set the item

scenic zenith
#

*and import the right damagable

blazing scarab
#

Hi, do you know good rtp algorithm? I mean finding safe place to teleport

wraith rapids
#

an important step yes

keen kelp
#

the Inventory one

#

not the entity one

#

am I doing something wrong?

scenic zenith
#

could you show your code

wraith rapids
#

yes

keen kelp
#
ItemMeta meta = p.getInventory().getItemInMainHand().getItemMeta();
                            org.bukkit.inventory.meta.Damageable.s
wraith rapids
#

you are trying to call the method statically

scenic zenith
#

just import it

wraith rapids
#

the item meta may be an instance of damageable

#

do not call any methods on the damageable class

#

cast the meta object to the damageable class and then call methods on the object

#

Damageable damageableMeta = (Damageable) itemMeta;
damageableMeta.setDamage()

keen kelp
#

oh

#

so treat the meta AS a damagable

wraith rapids
#

yes, that is what casting means

#

literally

keen kelp
#

so then I can use methods of damagable on it

wraith rapids
#

yes

#

again, the literal definition of a cast, to treat something as something

#

of course it will explode if you're trying to treat something as what it is not

#

which is why you want to check instanceof first

#

to see if it actually is that something

keen kelp
#

should be fine

#

ItemMeta meta = p.getInventory().getItemInMainHand().getItemMeta();

scenic zenith
#

btw can .getItemMeta() be null?
bc there is .hasItemMeta()

keen kelp
#

oh now you say that

opal juniper
#

?paste

queen dragonBOT
wraith rapids
#

it is for air

#

again, that is why you instanceof first

keen kelp
#

kk

wraith rapids
#

you don't want to treat something as something it is not

#

you don't want to take a Vehicle and threat it as a Car without checking whether it's actually a Car

#

it could be a Bicycle

opal juniper
scenic zenith
#

my antivirus recognises it as a trojaner

wraith rapids
#

is that a serialization test

opal juniper
#

Yeah

#

and the other way

summer lily
#

Hello, so i have this
if(player.getInventory().getItemInMainHand().getItemMeta().equals(meta)) {

#

essentially i have a custom item and I don't know what the meta of the item is

#

how do i find out?

wraith rapids
#

should be fine

opal juniper
wraith rapids
#

but since bukkit object stream uses the config serializer, it'll run into the versioning shit

#

so expect it to explode on server upgrades

scenic zenith
opal juniper
keen kelp
#

and after I set damage I just setItemMeta((ItemMeta) damagablemeta) correct?

scenic zenith
#

yeah

wraith rapids
#

you don't need to cast it back to ItemMeta

scenic zenith
#

I think thats automatically

wraith rapids
#

well, you shouldn't need to

summer lily
keen kelp
#

Required type:
ItemMeta
Provided:
Damageable

#

nope :/

wraith rapids
#

i don't actually remember if Damageable extends ItemMeta, but it should

#

i suppose it doesn't

scenic zenith
keen kelp
#

yeah

#

that's what I did

wraith rapids
#

give it the itemmeta you have, it's the same object

summer lily
#

basically when a custom bow shoots , i want my code to do stuff. so i added this:
if(player.getInventory().getItemInMainHand().getItemMeta().equals(meta)) {
But I DONT know the itemmeta of this bow, how do i find out?

wraith rapids
#

ItemMeta meta = item.getMeta();
((Damageable) meta).setDamage(10);
item.setMeta(meta);

#

don't test the entire meta

#

if you do, it will basically never return true

summer lily
#

Ok thanks

wraith rapids
#

meta includes shit like durability, item names and enchants

#

store a tag in the pdc of the item and check whether that tag is there

scenic zenith
summer lily
summer lily
#

basically i added some attributes to it

#

and some lores

#

and stuff

#

and now when it hits a player i need to insta kill the player

#

i did that

knotty fractal
#

Hentai

summer lily
#

but i need my plugint o actually check

scenic zenith
#

then juts create a custom Itemmeta with the lores and attributes...

summer lily
#

if it's the right bow

wraith rapids
#

add a tag in the pdc of the item

#

and check for that tag

#

to see whether it is your custom bow

summer lily
scenic zenith
wraith rapids
#

i don't know

summer lily
wraith rapids
#

if it isn't, it's kind of shit

summer lily
#

thanks

scenic zenith
#

I would make a debug message so you can see the item meta and then create it by yourself

wraith rapids
#

again, if you test the entire meta, it will never return true

scenic zenith
wraith rapids
#

itemmeta contains durability and everything else about an item

mystic tartan
#

How could I do something similar to player.hidePlayer() but still allow armour to be visible?

scenic zenith
#

I would just check the important attributes...

wraith rapids
#

you'll want to open up the itemmeta and look at like the lore or something

scenic zenith
#

invisibility

#

and disable the particles

mystic tartan
#

is there a way for someone to be invisible for everyone else, but not them self

scenic zenith
#

maybe with nms

mystic tartan
#

any suggestion to how it'd be achieved?

wraith rapids
#

a player can't be invisible to themselves

maiden briar
#

private static java.lang.String me.tvhee.tvheeapi.core.test.AClass.aMethod(java.lang.String) is listened in Class#getDeclaredMethods, but if I try to do Class#getDeclaredMethod("aMethod") it will throw NoSuchMethodException ?

wraith rapids
#

the best you'll get is the invisibility potion effect

scenic zenith
#

or just use .hidePlayer()

summer lily
wraith rapids
#

if you want the inverse, that is, the player is visible to themselves but invisible to everyone else, you can either send the potion effect packet to everyone else

#

or use the hidePlayer method

#

keep in mind that the latter hides the player entirely

#

armor and tablist name and all

sand hinge
#

how to fix bug??

wraith rapids
#

BUG

#

FIX BUG

scenic zenith
maiden briar
#
public static Reflection invokeStaticMethod(String className, String method, Object... parameters)
    {
        Class<?> superClass = getClass(className);

        while(superClass != null)
        {
            try
            {
                System.out.println(Arrays.toString(superClass.getDeclaredMethods()));
                System.out.println(superClass.getDeclaredMethod(method));
                Method javaMethod = superClass.getDeclaredMethod(method);
                System.out.println(javaMethod);
                javaMethod.setAccessible(true);
                System.out.println(javaMethod);
                return new Reflection(javaMethod.invoke(parameters));
            }
            catch(NoSuchMethodException e)
            {
                superClass = superClass.getSuperclass();
            }
            catch(InvocationTargetException | IllegalAccessException e)
            {
                e.printStackTrace();
            }
        }

        try
        {
            throw new NoSuchMethodException("Method '" + method + "' not found!");
        }
        catch(NoSuchMethodException e)
        {
            e.printStackTrace();
            return null;
        }
    }```
summer lily
maiden briar
#

The first thing prints, and the method is inside that array, but System.out.println(superClass.getDeclaredMethod(method)); does not print
-->

catch(NoSuchMethodException e)
{
   superClass = superClass.getSuperclass();
}

is called then

scenic zenith
#

then you dont have an item in main hand

summer lily
#

i did

sand hinge
summer lily
#

i tried both hands

maiden briar
#

javaMethod.invoke(parameters)?

scenic zenith
maiden briar
#

Oh I understand, thanks

wraith rapids
#

when retrieving a method reflectively, you need to describe the method's signature

#

the method's signature consists of 3 components

#

the return type

#

the method name

#

and the method parameters

#

you need to provide both the name and the parameter types to find the method

maiden briar
#

Yes, thanks

wraith rapids
#

are you still writing your horrible plugin loader shit

maiden briar
#

Yep

wraith rapids
#

give up already

maiden briar
#

But I want to test reflection

wraith rapids
#

or rather, do it properly

maiden briar
#

That is not the point now

summer lily
# scenic zenith code?

i solved it instead i'll just set a custommodeldata for the item and my plugin will read it

#

nevermind

summer lily
#
    @EventHandler
    public void onHit(ProjectileHitEvent e) {
        if (e.getHitEntity() instanceof Player) {
            if (e.getEntity() instanceof Firework) {
                Firework firework = (Firework) e.getEntity();
                Entity shooter = (Entity) firework.getShooter();
                Player player = (Player)shooter;
                
                if(player.getInventory().getItemInMainHand().getItemMeta()) {
                    
                }
            }
        } else {
            Firework firework = (Firework) e.getEntity();
            Entity shooter = (Entity) firework.getShooter();
            Player player = (Player)shooter;
            
            System.out.println(player.getInventory().getItemInMainHand().getItemMeta());
        }
    }
queen dragonBOT
dense goblet
#

what's the maximum zoom (FoV contraction) you can do and how to do it?

quaint mantle
#

???

quiet ice
#

try adding the Speed effect at Short.MAX_VALUE - 1

#

Or Short.MAX_VALUE / 2 - 1, one of those

dense goblet
quiet ice
#

then nothing you can do as you cannot alter the settings of the client (duh)

quaint mantle
#

What's the event for when a blaze sets a block on fire

#

their fireball, whatever

opal juniper
#

Can i serialise a Location and then use that as a key to multiple ItemStacks?

#

Cause i have a HashMap<Location,ItemStack[]> which i need to serialise / deserialise

eternal oxide
#

serialize into what? a config?

opal juniper
#

I need to be able to read from it so that i can store it for the next time the server starts

eternal oxide
#

in a config?

opal juniper
#

I mean, i guess

eternal oxide
#

Well you decide how you are going to store it and come back for how to do it.

opal juniper
#

I would like to use a YAML file

#

but firstly, can u use a location as a key

eternal oxide
#

then simply put it in the file. Map, Location and ItemStack are all serializable

#

yes you can use a Location object as a key

#

if you add it to a config be sure to save it and always reload your config if you want to access the data again.

opal juniper
#

i mean, ideally it would be in a separate file from the default config.yml

eternal oxide
#

Map are converted to MemorySections on loading.

#

yes, just use FileConfiguration

opal juniper
#

sorry ><

eternal oxide
#

to store you are simply going to use config.set("path", HashMap);

tired spoke
#

the soft-depends are kile softwares where the plugin not works well without them, and depend are the plugins required to a plugin?

#

for example an bw addon has the depend, and PAPI a soft-depend of bw?

eternal oxide
#

Depend = plugin will not start without it. softdepend = would like it but its not essential.

tired spoke
#

ok thanks

eternal oxide
#

depend will make your plugin load after those it depends on. softdepend will not affect load order. Do NOT use depend and softdepend on the same plugin as it will break the load order of depend.

opal juniper
#

how do i deal with the fact that it is a ItemStack[]

eternal oxide
#

you donl;t

#

it will be auto serialized

#

you just add the map

opal juniper
#

ok, so i really am kinda lost. this is what i have

    private void loadAllBenches() throws IOException, InvalidConfigurationException {
        File file = new File(getDataFolder().toString().replaceAll("\\\\", "/") + "/Benches.yml");
        if(!file.exists()) file.createNewFile();
        FileConfiguration configuration = new YamlConfiguration();
        configuration.load(file);

        Set<String> keys = configuration.getKeys(false);

        for(String key : keys){
            this.inventoryContents.put(Location.deserialize(key),configuration.getObject(key,ItemStack[].class))
        }
    }
tired spoke
tired spoke
#

i use the Intellij plugin named mincraft development, if i add the plugins in that when i start project it generates the dependency?

mystic tartan
#

im able to make a player invisible through packets, not using potion effects, however when they sprint or crouch it resets the invisibility, what could cause this?

eternal oxide
opal juniper
#

sorry

tired spoke
#

i use them

#

to help me

wraith rapids
#

different environments use \ and / for paths

maiden briar
#
public static void setStaticField(Class<?> clazz, String field, Object object)
    {
        Class<?> superClass = clazz;

        while(superClass != null)
        {
            try
            {
                System.out.println(superClass.getDeclaredField(field));
                Field reflectedField = superClass.getDeclaredField(field);
                System.out.println(reflectedField);
                reflectedField.setAccessible(true);
                Field modifiersField = Field.class.getDeclaredField("modifiers");
                modifiersField.setAccessible(true);
                modifiersField.setInt(reflectedField, modifiersField.getInt(reflectedField) - Modifier.FINAL);
                reflectedField.set(null, object);
                return;
            }
            catch(NoSuchFieldException e)
            {
                superClass = superClass.getSuperclass();
            }
            catch(SecurityException e)
            {
                System.out.println("A security manager may be preventing you from setting this field");
                e.printStackTrace();
            }
            catch(IllegalAccessException | IllegalArgumentException e)
            {
                e.printStackTrace();
            }
        }

        try
        {
            throw new NoSuchFieldException("Field '" + field + "' not found!");
        }
        catch(NoSuchFieldException e)
        {
            e.printStackTrace();
        }
    }```

[16:30:28 INFO]: private static final java.lang.String me.tvhee.tvheeapi.core.test.AClass.stringField
[16:30:28 INFO]: private static final java.lang.String me.tvhee.tvheeapi.core.test.AClass.stringField
[16:30:28 WARN]: java.lang.NoSuchFieldException: Field 'stringField' not found!

I do the same thing to get the field and that works
eternal oxide
eternal oxide
opal juniper
wraith rapids
#

Location is ConfigurationSerializable

opal juniper
#

i just am not familiar with this at all and am kinda confused

eternal oxide
cyan oyster
#

hey

wraith rapids
#

although since the config is deserialized all in bulk, you often end up with weird broken location objects when pulling them from the config

cyan oyster
#

anyone knows how to fix a .jar logo

wraith rapids
#

because the worlds they're in aren't loaded yet at the time of deserialization

cyan oyster
#

i downloaded java 8 then it change my icon

wraith rapids
#

you need to jump through a few hoops to get it to work as intended

eternal oxide
#

you know they are locations and ItemStacks, just call config.get("path").getValues(); and it will give you an annoymous Map

#

or somethgin close to that

opal juniper
#

this.inventoryContents.put(configuration.get(key));

?

eternal oxide
#

No, that will be a ConfigurationSection, or a MemoryMap

opal juniper
#

there is no getValues()

cyan oyster
#

do you know how to fix .jar file logo

eternal oxide
opal juniper
#

will do

maiden briar
#

Hasn't bungee an interface ConfigurationSerializable ?

cyan oyster
#

someone send me a java 15 download link then fucked up my .jar logo

eternal oxide
wraith rapids
#

who cares about a logo

#

a file is a file

#

go into your file association settings and change it there if you don't like it

cyan oyster
#

you will know how bad it is

eternal oxide
#

It will look different for anyone who has a different type

cyan oyster
#

if you see it

eternal oxide
#

The look of a jar file does not persist across machines

opal juniper
eternal oxide
#

The system I showed you eliminates AIR and null slots. but to store that under yours you'd have Map<Location, Map<Integer, ItemStack>>

solemn shoal
#

question, how can i interface with a TOML configuration?

eternal oxide
#

or if you don;t care about storing nulls and AIR, you'd process your Itemstack[]

opal juniper
#

basically, i am storing the contents of crafting tables.

wraith rapids
#

just feed them into the stream and shit it out as base64

opal juniper
#

i think for now i iwill just store at ItemStack[]

wraith rapids
#

using yaml to store arbitrary data is dumb

#

using bukkit config api to do it is even dumber

#

you should at the very least rig up your serialization so that you don't need to rewrite everything when you inevitably switch to something better

opal juniper
#

i mean, i have the methods for base64 to itemstack and viceversa

wraith rapids
#

shove all of the itemstacks into the stream

eternal oxide
#

Do craftign tables have TileEntities? I forget

wraith rapids
#

they don't sadly

#

nor do they have any state

eternal oxide
#

Odd

opal juniper
#

they aren't designed to hold items ><

wraith rapids
#

they don't really store any data or have any state

#

they exist solely to open a transient inventory screen

young knoll
#

At least they can be moved by pistons

opal juniper
#

So, i mean, i could store Location : ListOfBase64Strings

wraith rapids
#

no

opal juniper
#

no?

wraith rapids
#

shove all of the itemstacks into the stream

#

there is no point in converting them to strings in the intermediate stage

eternal oxide
wraith rapids
#

f.e write the # of itemstacks in the inventory, then for each number read an int representing the slot and an itemstack representing the item in the slot

opal juniper
#

idk how you get the location from the config that is the whole problem πŸ˜„ 😩

wraith rapids
#

you are serializing data, you should think serially

opal juniper
#

like i have the 'key' but idk how to turn that from a string to location

wraith rapids
#

maps aren't serial

tardy delta
#

Should I make this static:

public void reloadConfig() {
        if (this.configFile == null) {
            this.configFile = new File(this.plugin.getDataFolder(), "config.yml");
        }
        this.dataConfig = YamlConfiguration.loadConfiguration(this.configFile);

        InputStream defaultStream = this.plugin.getResource("config.yml");
        if (defaultStream != null) {
            YamlConfiguration defaultConfig = YamlConfiguration.loadConfiguration(new InputStreamReader(defaultStream));
            this.dataConfig.setDefaults(defaultConfig);
        }
    }
wraith rapids
#

why would you make it static

tardy delta
#

I want to use the reloadConfig() inside a command

wraith rapids
#

that is not a reason to make it static

tardy delta
#

well It's easier than making an instance and calling a method on it

wraith rapids
#

you never make an instance of your main class

young knoll
#

Make everything static

#

For ultimate ease

wraith rapids
#

something to keep in mind about static is that it is not an access modifier

#

you don't make something static because "i need to access it from here"

opal juniper
#
Location:
  - Itemstack1
  - ItemStack2
  - ItemStack3
  - ItemStack4

Why can't it be this easy ><

wraith rapids
#

you make something static because the related function or data is not bound to an instance of the class but rather the class itself

tardy delta
#

yes

wraith rapids
#

your config is bound to your plugin instance

#

not your plugin class

tardy delta
wraith rapids
#

then it's bound to your datamanager instance

tardy delta
#

what

wraith rapids
#

great the node my shitbyte test server was on crashed

#

everything is down

quaint mantle
#

guys someone hacked my server and later I banned him but the problem is every time I join is that they disconnect as well as my friends and others

wraith rapids
#

imagine paying for this

tardy delta
wraith rapids
#

why are you creating a new data manager each time and then discarding it immediately

#

that is like going to the grocery store, buying a banana, peeling it, and then throwing it away

tardy delta
#

well that's why i asked to make reloadConfig() static

wraith rapids
#

what does reloadConfig do

#

what fields does it mutate

#

are those fields static?

tardy delta
#
private final MagmaBuildNetwork plugin;
    private FileConfiguration dataConfig = null;
    private File configFile = null;

public void reloadConfig() {
        if (this.configFile == null) {
            this.configFile = new File(this.plugin.getDataFolder(), "config.yml");
        }
        this.dataConfig = YamlConfiguration.loadConfiguration(this.configFile);

        InputStream defaultStream = this.plugin.getResource("config.yml");
        if (defaultStream != null) {
            YamlConfiguration defaultConfig = YamlConfiguration.loadConfiguration(new InputStreamReader(defaultStream));
            this.dataConfig.setDefaults(defaultConfig);
        }
    }
wraith rapids
#

those are not static

tardy delta
#

how would i do it else?

wraith rapids
#

you are creating a new DataManager each time

tardy delta
#

mmm

wraith rapids
#

each instance of DataManager has its own set of these fields

#

each DataManager instance has its own configFile

#

and dataConfig

tardy delta
#

ow

wraith rapids
#

you are creating an object which has these two fields

#

then you are telling the object to do some stuff with those fields

#

then you throw the object away

#

you are doing nothing

#

you are repeatedly buying a banana, peeling it, and then throwing it away

#

construct one singular instance of DataManager and then use that same instance across your entire plugin

#

do it at startup or whatever

#

store it in a field in your main class instance or whatever

short hazel
#

uh does anyone know how to invert a players vision in 1.16

#

there's this plugin called UltimateDrugs v2 (which is paid). it implements a negative vision effect

wraith rapids
#

define negative

young knoll
#

Do those random shaders still exist in the game

wraith rapids
#

they do yeah

short hazel
#

the thing on the right

quaint mantle
#

if you mean super secret settings then no

young knoll
#

That's the enderman shader

wraith rapids
#

the settings don't no

#

but the shaders do

short hazel
#

ahhhh

quaint mantle
#

oh yeah

wraith rapids
#

the one on the left is the creeper shader

tardy delta
wraith rapids
#

i think

#

private

#

create a getter method for it

#

never expose state directly

tardy delta
#

oh okay..

quiet ice
#

It might be even the wheather

#

I have heard you can do fucked up things with this

young knoll
#

what

wraith rapids
#

third time this month that my server.props gets nuked by multicraft on my shitbyte test server

keen kelp
#

is it possible to tell idea to upload the artifact to an ftp after a successful build?

#

it's getting annoying to test

hard isle
#

Hey everyone ! I have a quick question , how can I get like the type of an item that's on the ground ? Idk if that makes sense

keen kelp
#

it's an entity

wraith rapids
#

get the item

#

get the itemstack

#

get the type

hard isle
#

Yeah but how

wraith rapids
#

depends on where the item is

#

and what it is

#

and what you're doing

hard isle
#

I have the location where it is and I know it's an item how do I know what it is ?

wraith rapids
#

getnearbyentities at that location i guess

#

and find the nearest entity

hard isle
#

I did all of that

wraith rapids
#

and check whether it's an Item, then cast to Item

hard isle
#

I have the entities

wraith rapids
#

then get the underlying ItemStack

#

and then get the Material

tardy delta
#

my method is public and i cant access it :/

hard isle
#

getItemStack method to get it as an itemstack ?

wraith rapids
#

that's because you're trying to access it statically

solemn shoal
#

how can i read/write TOML files?

wraith rapids
#

you are trying to invoke a method on the class

#

you need to invoke the method on an object

#

learn and understand the difference

quaint mantle
#

I want to a leaderboard containing 10 armor stands, now all is fine and dandy however I don't know how to store those mfs across restarts

tardy delta
#

yea i know so why not making dataManager static?

quaint mantle
#

Oh I can just recreate them on start.

tardy delta
#

like private static DataManager data;

wraith rapids
#

no

quaint mantle
#

why do you make them static

wraith rapids
#

it's bound to your plugin instance

#

it should not be static

tardy delta
#

but what then?

wraith rapids
#

you get your plugin instance

#

and call the method

tardy delta
#

yea i made it like this long ago
private static MagmaBuildNetwork plugin;

wraith rapids
#

yes, you have written a static getter for your plugin instance

#

this is fine because your plugin is a singleton; only one instance of it exists at a time

tardy delta
#

uhu

wraith rapids
#

get your plugin instance, call the method

upper vale
#

How can i force a player to do the swimming animation?

tardy delta
#

so normally i can easy do getPlugin() and it returns plugin

quaint mantle
#

packet

upper vale
#

which packet?

#

the entity meta data one didnt seem to do anything

wraith rapids
#

yes, now you do getPlugin().yourmethod()

#

the swimming animation is clientside

quaint mantle
#

oh I thought he wanted a swinging animation as in their arm, mb

young knoll
#

You don't need a packet for that

tardy delta
#

brrr

wraith rapids
#

what

upper vale
#

theoretically setting a barrier block at player's head would force a player down no

young knoll
#

yes

opal juniper
#
    private void saveAllBenches() throws IOException, InvalidConfigurationException {
        File file = new File(getDataFolder().toString().replaceAll("\\\\", "/") + "/Benches.yml");
        if(!file.exists()) file.createNewFile();
        FileConfiguration configuration = new YamlConfiguration();
        configuration.load(file);

        int i = 1;
        for (Map.Entry<Location,ItemStack[]> entry : this.inventoryContents.entrySet()){
            configuration.set("Location" + i + ".x", entry.getKey().getX());
            configuration.set("Location" + i + ".y", entry.getKey().getY());
            configuration.set("Location" + i + ".z", entry.getKey().getZ());
            configuration.set("Location" + i + ".world", entry.getKey().getWorld());
            for (int x = 0; x <= 9; x++){
                configuration.set("Location" + i + ".item" + x, encodeItemStack(entry.getValue()[x]));
            }
            i += 1;
        }

        configuration.save(file);
    }
``` does this look ok?
#

its just it doesn't work
i get no errors tho

upper vale
#

ok

quaint mantle
#

the heck is a bench

upper vale
#

ill just like lag back if somebody steps on the barrier block lol

wraith rapids
#

it's like a chair

#

but long

opal juniper
#

work bench

quaint mantle
#

god damn it

tardy delta
#

this is inside the main class
public static MagmaBuildNetwork getPlugin() {
return plugin;
}

opal juniper
#

nothing gets saved thats all

tardy delta
#

:/

wraith rapids
#

literally

young knoll
#

You aren't in the main class

#

So you can't just magically call getPlugin with no class prefix

tardy delta
#

well can't i call public methods in another class then?

wraith rapids
#

look at this

#

and see if it rings any bells

#

you can call public methods in another class

#

but the compiler doesn't know what "getPlugin" refers to

#

there is no "getPlugin" in this class

#

you need to tell it what class's getPlugin you mean

#

learn java

tardy delta
#

every time i've done it before it worked...

#

but yea

wraith rapids
#

that's because every time you've done it before was in the same class

woeful crescent
#

Is there any difference between Bukkit.getScheduler().scheduleSyncDelayedTask() and Bukkit.getScheduler().runTaskLater()?

wraith rapids
#

the other one might be deprecated

woeful crescent
#

I don't think so

wraith rapids
#

i remember some of them being deprecated because of dumb naming conventions

#

other than that they do the same thing

woeful crescent
#

hm

#

Why are there 2 different ones?

wraith rapids
#

the scheduleSync one was around first

#

but apparently itas async variant, scheduleAsyncTask, was too confusing for people

young knoll
#

scheduleX are mostly depreciated

wraith rapids
#

as people thought it meant "schedule a sync task"

#

rather than "schedule async task"

woeful crescent
#

Also, is it better to construct a new runnable (with the same code) every time I want to schedule the task, or store that runnable statically?

wraith rapids
#

doesn't matter

#

storing it statically is generally more boilerplate and has negligible benefit if any

#

lambda expressions are very fast anyway

woeful crescent
#

ok

solemn shoal
#

is there any TOML wrappers to Configuration?

woeful crescent
#

So I should use .runTaskLater()?

woeful crescent
#

instead of scheduleSyncDelayedTask in BukkitScheduler?

wraith rapids
#

you should do whatever

woeful crescent
#

ok

wraith rapids
#

it doesn't matter

young knoll
#

Forge uses that

paper viper
#

What gradle plugin do people use for generating javadocs? (I already typed the shit, I need to turn it into html/css and that stuff)

solemn shoal
#

i mean something to use a TOML file as a Configuration object

wraith rapids
#

not in bukkit no

#

i don't remember seeing any community made impls of one either, but I haven't really looked for one anyway

solemn shoal
#

hm

severe night
#

anyone knows how can i change the wheat and other seeds growing velocity? i have tried this but I was unsuccessful

young knoll
#

Ah legacy data

solemn shoal
#

i would love to be able to use a TOML file with bukkit's Configuratoin api

severe night
young knoll
#

Yes it is

severe night
#

no, i'm testing it right now

young knoll
#

Okay?

#

It's still legacy data

#

Because 1.8

#

Did you register the event

severe night
#

yep

wraith rapids
#

why are you writing 1.8 code but building against 1.13+

severe night
winged mica
#

o_0

wraith rapids
#

yes but why are you building against 1.13+ then

winged mica
#

trully, I don't get it

wraith rapids
#

build against 1.8 if you're building for 1.8

#

you can't use any of the 1.13 features or api anyway

keen kelp
#

what do I check to know if player is interacting with a crafting table

#

it's a tile entity so I can't getClickedBlock() == Block.CRAFTING_TABLE

outer crane
#

smh imagine using 1.8 in the first place

#

not even worth it

eternal oxide
keen kelp
#

wait what

#

what's it's ID

eternal oxide
#

ID?

keen kelp
#

event.getzClickedBlock() == <here>

wraith rapids
#

it's not a tile entity

#

get clicked block -> get the block's type -> compare to Material.CRAFTING_TABLE

keen kelp
#

but getClickedBlock returns Block.block?

#

do I cast it

wraith rapids
#

yes, it returns a block

#

look at the methods a block has

#

you can get a block's type

#

which returns a material

keen kelp
#

oh

#

getType

quaint mantle
#

hey guys

#

so i have a chunk like: -6 5 -11
how to know if my player (using getPlayer()) is in this chunk?
I'm new here

eternal oxide
#

divide the players x and z by 16

quaint mantle
#

and what i should do with this sum

#

how could i use it

eternal oxide
#

it will give you the chunk x and z

quaint mantle
#

i can't get the chunk using F3 ?

#

oh

#

wait

#

i can get the location, then get the chunk of the location no?

eternal oxide
#

yes

quaint mantle
#

i tried

#

and it's retuning a class

#

but idk how to use it

#

returning

#

it says "CraftChunk{x=-5z=6}"

#

how could i use it

#

and compare it

maiden briar
quaint mantle
#

uh

eternal oxide
#

you compare the getX and getZ to the values of your chunk

keen kelp
#

how do I know when player closes out of an inventory

quaint mantle
#

thanks

#

can i create a chunk class so i can just compare the 2 classes instead of typing everything?

keen kelp
#

I want a NPC to open an inventory when I right click it and say: buy what you need

maiden briar
#

PlayerInteractEvent

keen kelp
#

and when I cloes it it would say something like goodbye

woeful crescent
#

InventoryCloseEvent

keen kelp
#

yes I found it

eternal oxide
maiden briar
#

Because it's static

keen kelp
#

but how do I tell it's my inventory he closed

woeful crescent
#

check if the inventory's name equals your npc inventory's name

quaint mantle
#

is there something like "new Chunk(x, z)" ?

#

like*

wraith rapids
#

lol

keen kelp
#

but wouldn't a chest named the same thing also trigger the event?

chrome beacon
#

This can cause issues

woeful crescent
#

In what version of minecraft could you name chests?

wraith rapids
#

ever since name tags were added ages ago

keen kelp
#

so how do you do it the non-dummy way

wraith rapids
#

or no

#

that's for entities

keen kelp
#

anvilll

wraith rapids
#

ever since anvils were added

woeful crescent
#

hm

#

The more you know, I guess

maiden briar
wraith rapids
#

why are you writing all of this redundant boilerplate

#

can't you just use reflection

keen kelp
#

so how do people do it

maiden briar
#

Because this is plainer so I don't have to use try/catch everywhere

wraith rapids
#

people compare the inventory instance

keen kelp
#

oh?

wraith rapids
#

if (event.getinventory == myinventory) do stuff

keen kelp
#

ok so basically Im trying to return all non-GUI thing back to the player when they close the GUI

#

wait I just realised

#

I would need a hashmap of inventory right

wraith rapids
#

if you have more than one, yes

#

a Player -> Inventory map f.e

keen kelp
#

if I don't want the inventory to be the same for every player

wraith rapids
#

myes

shy wolf
#

can i give an item to player on join event?

#

public void onJoinServer(PlayerJoinEvent e)

maiden briar
#

If removing

Field modifiersField = Field.class.getDeclaredField("modifiers");
modifiersField.setAccessible(true);
modifiersField.setInt(reflectedField, modifiersField.getInt(reflectedField) - Modifier.FINAL);

I don't get NoSuchFieldException, but now I get java.lang.IllegalAccessException: Can not set static final java.lang.String field me.tvhee.tvheeapi.core.test.AClass.stringField to java.lang.String

wraith rapids
#

setAccessible no longer makes final fields accessible as of some version

maiden briar
maiden briar
shy wolf
wraith rapids
#

get the player's inventory

#

add it to the inventory

maiden briar
#

Oh I forget getInventory my bad

#

e.getPlayer().getInventory().addItem(new ItemStack(Material));

shy wolf
wraith rapids
#

the way you used to do it was to get the root field on the Field object and modify that

tardy delta
#

can i fix that i can just do getPlugin(). ... instead of MagmaBuildNetwork.getPlugin().

private static MagmaBuildNetwork plugin;

public static MagmaBuildNetwork getPlugin() {
return plugin;
}

wraith rapids
#

since the Field returned by getDeclaredField is just a copy

keen kelp
#

ok how do I set what the items are in an inventory

tardy delta
#

it worked before

wraith rapids
#

the copy does however hold a ref to the original backing Field instance

#

that'd be the Field object you want to modify

maiden briar
torn crescent
#

Hey!

How can I check, if an entity exists even tho it is not loaded?

E.g.: An Armorstand in an unloaded Chunk, and I've only got the UUID.

wraith rapids
#

of course the root field is a private field in a propietary class and so you can't actually find it with reflection past like java 8 or something

maiden briar
#

We are on java 16

wraith rapids
#

yeah get fucked basically

maiden briar
#

....

wraith rapids
#

reflection is cucked now

#

you can't do shit with it

keen kelp
#

how do I create an inventory with like items in it

wraith rapids
#

you create it

#

then you put items in it

keen kelp
#

then?

#

but how put item

wraith rapids
#

see the javadocs

shy wolf
#

how to set the location of the item

maiden briar
wraith rapids
eternal oxide
keen kelp
#

setContents

eternal oxide
#

no

#

that sets all

keen kelp
#

yes

#

that's what I need for a GUI right

tardy delta
eternal oxide
#

try it and see

maiden briar
shy wolf
#

i am not trying to make a GUI

maiden briar
shy wolf
maiden briar
#

Ok

tardy delta
#

strange

#

very strange

wraith rapids
#

there's nothing strange