#help-archived

1 messages · Page 98 of 1

brisk mango
#

not sure about that

timid valley
#

you don't use spigot?

brisk mango
#

not really

timid valley
#

then why are you here

brisk mango
#

ive fixed some shit in spigot

#

i have my custom 1.12.2 jar

keen compass
#

there is many things that can be fixed

brisk mango
#

well for example

#

i've added the Consumer<BukkitTask> in the scheduler

wide gate
#

this is getting fun again

worn temple
#

synchronized is not thread safe.

brisk mango
#

it is

worn temple
#

no, its not

brisk mango
#

okay.

timid valley
#

sychronized is a tool to write thread safe code, but yes code can still be unsafe that uses synchronized if logic is not designed correctly

worn temple
#

sync and threadsafe are 2 different things

timid valley
#

still requires understanding concurrent access, happens before/after concepts

brisk mango
#

they are really not 2 different things

timid valley
#

CPU caches

worn temple
#

No, they are 2 different things.

You can be sync and threadsafe, not sync and threadsafe, or neither.

keen compass
#

or sync and non-threadsafe as well 😉

timid valley
#
Map<String, String> foo = Collections.synchronizedMap(new HashMap<String, String>());

if (!foo.containsKey("bar")) {
   foo.put("bar", someCriticalValue);
}

This uses synchronized. This is not thread safe.

worn temple
#

yup, 4 combos, missed it

#

Use project reactor and try and tell me sync = threadsafe. I dare you.

keen compass
#

lol

#

However, I will say Aikar knows more then me and does more complicated stuff usually then I do XD

#

However, what you should probably do is run some tests @brisk mango and the provide the results as well as the code used to conduct your tests

worn temple
#

Yee, he's pretty nuts. And me and my girlfriend both work within the reactive standard so I know pretty well how sync and threadsafe are not the same

daring crane
brisk mango
#

I didnt say I created the idea

#

I said ive added it to an older jar

timid valley
#

I sincerely hope you are not scheduling so many bukkit runnables that you need to worry about synchronization. holy crap that would be a lot of tasks

brisk mango
#

🤦‍♂️

worn temple
#

Yeah, that would be... not good

brisk mango
#

im not using BukkitRunnable coz its an shit class

dusty topaz
#

why is it shit

keen compass
#

And yet so many plugins use it just fine without performance problems

tiny dagger
#

^

timid valley
#

ignore him avro hes trolling

worn temple
#

yeah, big troll at this point

dusty topaz
#

i mean i am learning a lot reading this but even i run stuff async with bukkit runnable and it works fine

brisk mango
#

because of the synchronized methods and exception throws

#

it just uses BukkitTask's methods

keen compass
#

synchronized methods do not cause performance problems on their own

tiny dagger
#

he knows a bit of java and now thinks he is a know it all 😂

timid valley
#

"gasp it throws an exception if i do something stupid, its bad!"

keen compass
#

lol

obtuse rose
#

pro tip, synchronized is hit about a billion times a second in running a server, just an FYI. 1 every second from a Bukkit runnable with 0 contention where BiasedLocks is default on.... yeah
@timid valley once every few clock cycle? 🤔

brisk mango
#

they can

naive goblet
#

Who are you guys helping?

timid valley
#

@obtuse rose lol ok i prob exaggerated a bit there

keen compass
#

yes they can, but then you might as well say that every API method in the JDK has that ability @brisk mango

tiny dagger
#

imagine letting user errors go thru an api, sounds like the people who designed it knew what they were doing

obtuse rose
#

that legit confused me 😆

worn temple
#

More or less just trying to deal with a troll than helping @naive goblet

brisk mango
#

@keen compass but then there is a question why use BukkitRunnable when there is BukkitScheduler

#

when BukkitRunnable is fairly useless

daring crane
#

why use lambdas when there are anonymous classes

#

lambdas are useless

brisk mango
#

thats not a good example

keen compass
#

Because sometimes you don't need a scheduler

fallen garden
#

It is a good example tho

brisk mango
#

and thats when?

opaque swan
#

Hello i have problem with Player Count with my bungeecoord server

timid valley
#

why run minecraft when we have cube world, minecraft is useless

keen compass
#

lol

worn temple
#

@daring crane yeah... no, lambdas are way more useful than you can possibly imagine.

tiny dagger
#

the schelduer is this new BukkitSchelduer() {}?

keen compass
#

@brisk mango that is for you to decide. But if its just like a once off task, why have a scheduler for that?

timid valley
#

screw you guys im going back to FFXI!

opaque swan
#

Anyone have any solution

#

?

brisk mango
#

whatever, for me its an useless class

timid valley
#

whats the problem ricky

brisk mango
#

when you could just do

timid valley
#

you didnt state what the problem was

brisk mango
#

Bukkit.getScheduler().runTaskLater(task -> task.cancel());

tiny dagger
#

another known user gave up on discord for today, gg temedy

dusty topaz
#

isn't most of scheduler deprecated though

fallen garden
#

@opaque swan what subchannel are you using to get player count?

keen compass
#

Ok that is a lot better statement. It is useless to you, but not necessarily useless to others

timid valley
#

no avro

brisk mango
#

no its not

daring crane
#

@worn temple that was just an example, i use lambdas all the time

worn temple
#

I may dip out of this server tbh, seems like it just brings in the worst of the forums.

opaque swan
#

i see only the lobby players

#

@opaque swan what subchannel are you using to get player count?
@fallen garden nothing i think

naive goblet
#

Wouldn’t say temedy is a troll but you guys seem to have different views of it

worn temple
#

@daring crane ah, okay, just making sure, because its hard to tell trolls from ironic people at this point.

daring crane
#

true

brisk mango
#

BukkitScheduler is an interface

timid valley
#

you probably have ping pass through on

#

turn that off

opaque swan
#

Ok wait

#

yes i have it on

wide gate
#

The point of BukkitRunnable is that it gives us a way to declare and use instance variables without having to implement BukkitTask (or without having to depend on its implementation, CraftTask)

worn temple
#

@naive goblet There's a line between an opinion, and just something factually completely wrong. That's the issue, is they have an opinion on a fact and are trying to disagree with it.

fallen garden
#

@opaque swan look at the player list section of this page:

wide gate
#

no, temedy is a great comedian

naive goblet
#

Nova fair enough

dusty topaz
#

when should you be using runnable over scheulder then? i always use runnable - is this bad or

empty salmon
#

Is there a way to force a player's enderchest they are in to close

opaque swan
#

Now work thank you! @timid valley ❤️

timid valley
#

yeah not every day I get accused of not knowing about concurrency haha

keen compass
#

lmao

brisk mango
#

I mean it can be bad but let people use whatever they want, for me its an totally useless class and i'd prefer BukkitScheduler instead of BukkitRunnable, because you can even write an easy lambda and cancel the task inside of the scheduler if needed

timid valley
#

that was quite a hit

wide gate
#

you can't use lambdas if you use the runnable, which means some unnecessary boilerplate code @dusty topaz

worn temple
#

@empty salmon yeah, just get the inventory they are in and close it. You can just check if its an ender chest before that

dusty topaz
#

is there a reason to use one over the other though

timid valley
#

no

brisk mango
#

sometimes

wide gate
#

they achieve the same thing

timid valley
#

just dont do stupid things in them, the framework doesnt matter

#

well except for spigot and async tasks, async does cause lag on spigot ._.

#

dont spam them

tiny dagger
#

temedy

#

you don't always need a canceling task

brisk mango
#

I've said if you do

#

you can just write an easy lambda

#

or () ->

tiny dagger
#

so why this a vs b thingy

brisk mango
#

replaces new Runnable()

empty salmon
#

@worn temple I have the inventory variable, what do I do to close it?

tiny dagger
#

they both exist for a reason

brisk mango
#

BukkitRunnable is fairly useless IMO

worn temple
#

@empty salmon Inventory#close() iirc

timid valley
#

@empty salmon player.closeInventory()

#

or that

#

i think thats a shortcut to iterate all viewers and close their inventory

tiny dagger
#

it gets the job done it's in no way useless

bleak osprey
#

 17:49:12 [WARNING] Exception encountered when loading plugin: NuVotifier
while scanning for the next token
found character '\t(TAB)' that cannot start any token. (Do not use \t(TAB) for indentation)
in 'reader', line 3, column 8:

does anyone knows what this means?

brisk mango
#

Async is fine for sending messages and doing things like that @timid valley

keen compass
#

BukkitRunnable just implements runnable and adds some methods of its own

brisk mango
#

I use java executors whenever i can

timid valley
#

literally not what I said

worn temple
#

I believe so, assuming there's only one viewer then its fine, but could become an issue if you have those plugins that allow "spying" on inventories

brisk mango
#

its not what you said you're right

empty salmon
#

I have tried player.closeInventory() and that doesn't work!

#

What can I do?

dusty topaz
#

it should work 🤔

empty salmon
#

That's what I thought!

keen compass
#

closeInventory() only works on the player inventory I thought o.O

worn temple
#

Doesn't work can mean many things? Are you sure the code is executing? Are there errors? etc?

keen compass
#

and not for other inventory types

worn temple
#

Should work with whatever inventory the player is viewing

empty salmon
#

Yes I am sure the code is running. I want the code to close the enderchest inventory they have open. I have a message run before to check that the conditions of my if statements are met, and that runs but the inventory won't close

worn temple
#

use hastebin or at least code blocks, that is impossible to read

empty salmon
#

Sorry

keen compass
#

use 3 back ticks `

dusty topaz
#

```

empty salmon
keen compass
#

that works too

minor flint
#

lambdas are useless
@daring crane i mean go to school

empty salmon
#

Any idea?

worn temple
#

@minor flint he was kidding, already figured that out awhile ago

brisk mango
#

why not just use InventoryOpenEvent

#

and close the opened inventory

#

also don't worlds have an UUID

empty salmon
#

I will try that now

brisk mango
#

u could compare

#

instead of the name

empty salmon
#

Oh that's a shout, thanks

worn temple
#

Yeah, should be using inventory open event, pretty sure this event happens before then, so therefore there is no inventory to close

keen compass
#

it gives you an InventoryView in that event @worn temple

#

which you can get the inventory in question from it

worn temple
#

@keen compass Ah, my b.

#

Haven't worked with the bukkit/spigot API in like 2 years, bit rusty.

keen compass
#

lol

empty salmon
#

How should I check it is an inventory? @EventHandler public void onEnderChest(InventoryOpenEvent event) { Player player = (Player) event.getPlayer(); if (player.getWorld().getName().equalsIgnoreCase("test_world")) if (player.getInventory().getType() == InventoryType.ENDER_CHEST) { //DO SOMETHING } }

#

I've got that!

keen compass
#

well that event doesn't run unless it is an inventory

#

do you mean you want to check if its an enderchest inventory?

empty salmon
#

Yep

brisk mango
#

get the type.

#

InventoryType.ENDER_CHEST

empty salmon
#

I have ```(player.getInventory().getType() == InventoryType.ENDER_CHEST)````

brisk mango
#

if(event.getInventory().getType() == InventoryType.ENDER_CHEST)

#

yes

keen compass
#

That should work

empty salmon
#

Oh right!

#

Got it

#

Okay, just checking, to close the inventory, do I use event.inventory or player.inventory ?

obtuse rose
#
@EventHandler
    public void onEnderChest(InventoryOpenEvent event) {
        Player player = event.getPlayer();
        if (!player.getWorld().getName().equalsIgnoreCase("test_world")) return;
        if(event.getInventory().getType() != InventoryType.ENDER_CHEST) return;
        // DO SOMETHING
    }
#

please don't nested it 😄

keen compass
#

you should do event.inventory instead of player.inventory

empty salmon
#

Okay

keen compass
#

player.inventory gives you the players inventory

empty salmon
#

Thank you

keen compass
#

player inventory doesn't mean chest inventory

#

if that is more clear

brisk mango
#

dont compare the name

#

compare the UUID

empty salmon
#

Yeh, so how do I close it because event.closeInventory() isnt a thing

brisk mango
#

player.closeInventory()

empty salmon
#

That's what I've done

#

But others were saying don't

brisk mango
#

why

#

lol

keen compass
#

I think there is some confusion in some of the methods in player object lol

brisk mango
#

nah

#

they meant the event#getInventory

keen compass
#

player.closeInventory() should close whatever inventory is opened by them, player.getInventory() gives you the players inventory and not an inventory they are viewing.

obtuse rose
#

hmmm, isn't that event implemented cancellable?

timid valley
#

nope

obtuse rose
#

tragic

brisk mango
#

that wouldnt even work

cloud crater
#

closeInventory() will close the current viewed inventory no matter what type it is

timid valley
#

server expects it to be closed if its closed

#

cant cancel that

empty salmon
#

It doesn't work! Like, it doesn't even run my message to the user!

#
    public void onEnderChest(InventoryOpenEvent event) {
        Player player = (Player) event.getPlayer();
        if (player.getWorld().getName().equalsIgnoreCase("test_world")) 
            if (event.getInventory().getType() == InventoryType.ENDER_CHEST) {
                player.sendMessage(ChatColor.translateAlternateColorCodes('&', "&cDon't try and exploit enderchests!"));
                player.closeInventory();
            }
    }```
brisk mango
#

so the event isnt registered.

empty salmon
#

Exactly

brisk mango
#

???????

empty salmon
#

Hang on a minute

#

Lemme try something

timid valley
#

did you register the listener

obtuse rose
#

wow, still nested >:(

brisk mango
#

why did you say exactly

empty salmon
#

Will change it!

brisk mango
#

whatever

empty salmon
#

Sorry, I don't know

#

I'm just trying to get my head round it

timid valley
#

but why is opening enderchests an exploit for you

brisk mango
#

maybe he doesnt want players to open enderchest

#

what a dumb question

cloud crater
#

if your trying to close it as soon as they try, then why not setCancelled?

empty salmon
#

So, with the code I've got, it sends the message but doesn't close the eventory

#

Okay, will try @cloud crater

#

So I'm assuming do event.setCancelled(true);

daring crane
#

that event is called before the inventory is actually opened so closeInventory doesnt do anything

cloud crater
#

yes it will cancel everyone doing so

daring crane
#

So I'm assuming do event.setCancelled(true);
yep

keen compass
#

Well if its an exploit for them @brisk mango there actually might be a better way in handling this then using the inventory stuff lol

timid valley
#

ender chests are shared across worlds, so it doesnt make sense to target one single world

cloud crater
#

then just set permissions if otherwise, if needed.

brisk mango
#

@timid valley are you missing common sense?

timid valley
#

@subtle blade we need you

brisk mango
#

he wants players to not be able open enderchests in a certain world

empty salmon
#

Omg! It works

#

Thank you very much everyone!

cloud crater
#

np

empty salmon
#

You are amazing!

brisk mango
#

@timid valley Lets say you have 2 worlds, and you want players to not be able to open enderchest in 1 world, what would you do

keen compass
#

if you don't want them opening ender chests, why even allow ender chests to begin with o.O

#

could just solve all that if you can't build them

timid valley
#

@empty salmon you are aware ender chests arent duplicated on a world backup right

empty salmon
#

It is only for one world because they have access to creative there and I don't them being able to spawn items into their enderchest to sell for money in another world. As, yes @timid valley, it is just a name someone else gave it, I haven't got round to changing it

timid valley
#

do you clear their inventory on leaving the world

empty salmon
#

Yeh

#

Don't worry, that's the only exploit I found

timid valley
#

alright then, i guess that makes sense

hoary parcel
#

as much as I dont like how wiz deals with some ppl, I sure sometimes wish he was a mod in more discords, lol

keen compass
#

could just not allow placing ender chests @empty salmon

empty salmon
#

No, it is decorative

timid valley
#

its creative, its an exploit world already 😛

empty salmon
#

I want people to be able to decorate just not use

cloud crater
#

it's done what he needed @keen compass

keen compass
#

fair enough

empty salmon
#

Well, cheers for your help everyone

obtuse rose
#

@empty salmon then cancel PlayerInteractEvent against enderchest

#

👍

timid valley
#

but your gonna have to worry about every dang possibility of items moving worlds

keen compass
#

^

timid valley
#

like donkeys through portals, teleporting entities, plugins that allow trading items etc

brisk mango
#

@obtuse rose no that doesnt work lol and why when he already has a fucking solution

empty salmon
#

Haha, I've sorted every way apart from enderchests which have been sorted

minor flint
#

@timid valley Can I ask you a question?

timid valley
#

sure

minor flint
#

Are you working for spigotmc?

hoary parcel
#

haha

obtuse rose
#

@brisk mango yes it does but okay

timid valley
#

I use to many years ago. I work on the larger fork of spigot 😛

brisk mango
#

he has just litterly tried that

#

and it didnt

keen compass
#

alright well the problem is resolved

#

person is happy

brisk mango
#

what fork is that? 😂

keen compass
#

Paper

hoary parcel
#

Paper, what else?

minor flint
#

I hope it isn't Paper

brisk mango
#

omg that shit

#

well whatever

hoary parcel
#

lmao

daring crane
#

craftbukkit is what modern servers use Kappa

tiny dagger
#

ok this guy is on drugs, no way

hoary parcel
#

paper is literally the only reason servers survive on 1.15

brisk mango
#

Im fine with CraftBukkit

minor flint
#

@timid valley Thanks, from this day I know why Paper sucks

keen compass
#

probably should go check out async chunk loading 😉

timid valley
#

cool story

hoary parcel
#

its your personal fault aikar!

timid valley
#

is kyngs temedy's partner in trolling?

hoary parcel
#

yes

naive goblet
#

Lmao

brisk mango
#

I have a question aikar

keen compass
#

I think it was meant as sarcasm? or were they serious?

daring crane
#

he blindly says yes to all of his dumb statements

#

so id assume he is

brisk mango
#

why is my paper server lagging when there is alot of people?

#

like such weird lagspikes

#

normal spigot doesnt

timid valley
#

thought you didnt use paper

keen compass
#

XD

tiny dagger
#

😂

brisk mango
#

i did, very best spigot

hoary parcel
#

if you want support for paper, you should join paper discord

#

and provide timings

keen compass
#

ah beat me to it

brisk mango
#

the timings were fine

daring crane
#

and ping wiz

tidal pulsar
#

Anyone know if I can use a library licensed with GPL-3.0-or-later for closed sourced purposes?

brisk mango
#

there was 100 ppl and 19.5 tps

#

but weird lag-spikes

#

every time there is more than 100 people

tiny dagger
#

temedy, how many threads your schelduer api is using/making?

brisk mango
#

only one other thread?

timid valley
#

@tidal pulsar if you don't release the jar

brisk mango
#

im using ScheduledExecutorService

timid valley
#

then yes you can use gpl stuff

tidal pulsar
#

Thanks!

brisk mango
#

oh aikar has no answer

#

i guess that paper is just shit thats why

daring crane
#

you still didnt send timings

brisk mango
#

😂

timid valley
#

yeah it totally is

verbal inlet
#

Hello

brisk mango
#

why do i need to send timings

hoary parcel
#

if you want paper support, join paper discord

brisk mango
#

nah i dont want paper support

hoary parcel
#

so you can get banned in under 30 second for being an asshole

brisk mango
#

im not using that shit anymore

#

im just curious

#

explains alot if this guy is it's main dev

timid valley
#

that uber synchronized-free custom server he runs

gentle kelp
#

🤔

verbal inlet
#

Hello people

daring crane
#

btw temedy never user Player#sendMessage, it calls code which contains a synchronized block

hoary parcel
#

I mean, 50k servers on 1.15 are very happy with papers work

tiny dagger
#

synchronized keyword can cause lag spikes btw

brisk mango
#

I've removed that keyword

#

from it

daring crane
#

from where

brisk mango
#

its no longer synchronized

#

from the method

timid valley
#

so we got akkarin and the like that adds synchronized everywhere, and now temedy-spigot that removes it

daring crane
#

its not in that method though

timid valley
#

the best of both worlds!

brisk mango
#

it is

#

it uses synchronized in that method

hoary parcel
#

he also removed the Thread.sleep in the main tick loop

brisk mango
#

which i had removed

hoary parcel
#

since that cuases lag

brisk mango
#

i fixed alot of shit tbh

#

now it has way better performance

daring crane
#

mini you should make MiniJDK single threaded so you cant run into concurrency issues

hoary parcel
#

aikar, at least we now know how mcm fork ppl think

subtle blade
#

How come the topic always moves onto forks whenever I’m gone? I mean really

tiny dagger
#

choco save us

hoary parcel
#

oh choco is here

subtle blade
#

If you want to glorify another fork, do it there. I’m sick of seeing it here

hoary parcel
#

can you pls remove the trolls?

subtle blade
#

Also, temedy, I’m getting real sick of your shit. I’ve seen far too much of your attitude lately

timid valley
#

well we were trying to get you to deal with temedy, it only recently changed to fork talk >_>

subtle blade
#

I’m giving you your last warning and you’re gone

hoary parcel
#

does a ban here means ban on the forums?

tiny dagger
#

last warning 👀

subtle blade
#

Typically yes but I honestly don’t think it’s much too worth it

#

He’s not active on the forums

keen compass
#

Yay Choco is back, we missed you 😄

subtle blade
#

Still at work. Last thing I want to be doing is this lol

keen compass
#

oh, so you are semi-quasi back then

#

that is alright then, we still missed you anyways 😛

subtle blade
#

😉

naive goblet
#

What are you working on 😮

hoary parcel
#

hes in retail iirc

keen compass
#

So customer service or cleaning/organizing

subtle blade
#

Yep

#

The most joyous time right now in retail

#

I WANT TO DIE

#

Not customer service though

#

Can’t possibly do that

keen compass
#

I can't imagine it being fun in retail with no customers or hardly any customers

dusty topaz
#

Yay Choco is back, we missed you 😄
:notthis:

#

we need a not this emote

#

😠

subtle blade
#

There are more than the limit of people that our government requests

tardy lance
#

cant i write a Hashmap<UUID, ItemStack> to a file with a FileOutputstream?

bleak osprey
#
17:49:12 [WARNING] Exception encountered when loading plugin: NuVotifier
while scanning for the next token
found character '\t(TAB)' that cannot start any token. (Do not use \t(TAB) for indentation)
in 'reader', line 3, column 8:

does anyone knows what this means?

dusty topaz
#

you can just deserialize a map manually @tardy lance

subtle blade
#

^

#

BigLife read the error

#

Answer is in literally plain English

tardy lance
#

Ive done this:
File bountyNameData = new File(getDataFolder() + "/userdata/bountyNameData");
fos = new FileOutputStream(bountyNameData);

oos = new ObjectOutputStream(fos);
oos.writeObject(fileManager.getBountyNameMap());

And the error:
Caused by: java.io.NotSerializableException: org.bukkit.inventory.ItemStack

#

at: oos.writeObject(...)

torn robin
#

Does anyone know if there is a packet/other event for when the server modifies a player's potion effects?

subtle blade
#

Entity status packet or something

torn robin
#

ty will look that up

#

indeed it was, it was hidden under another section ty for pointing that out

keen compass
torn robin
#

yeah i was looking on that lol

idle zodiac
bleak osprey
#

it dosnt make sense... there ist no\t ...

keen compass
#

you have tab's in there

#

tabs are not good replace them with spaces instead

subtle blade
#

A tab is represented by \t

brisk mango
#

well ItemStack is not serializable @tardy lance

bleak osprey
#

oh ok thx 🤦‍♂️

tardy lance
#

thank you for that information

tiny dagger
#

itemstack is serialized tho by the yml configuration

minor flint
#

You can serialize it with JSON

tiny dagger
#

yeah like any other object

minor flint
#

^

brisk mango
#

^

brisk mango
#

NotSerializableException

#

🤔

tiny dagger
#

huh?

keen compass
#

Because serialize uses bukkits ConfigurationSerializeable

idle zodiac
#

did anyone see my thing lol

#

sorry

keen compass
#

as opposed to Java's serialize function

brisk mango
#

^

minor flint
#

^

idle zodiac
#

EZ

#

YES

#

^

#

oh

keen compass
#

Well you don't do anything with the stuff outside of said border

idle zodiac
#

ok...

#

i made an empty void thou

#

empty generator

keen compass
#

did you start the world that way? o.O

idle zodiac
#

um..

#

no

keen compass
#

that would be why. Generator won't remove what is already created

idle zodiac
#

ok...

#

but i made the world with a generator...

#

OH

#

i see what you mean

#

let me delete the world

#

and try and create again

cloud crater
#
                                        setupworld.type(WorldType.FLAT);
                                        setupworld.generatorSettings("2;0;1;");
                                        setupworld.generateStructures(false);
                                        setupworld.createWorld();```
#

^^ my void method

idle zodiac
#

ah

#

thats a thing

#

i didnt make it flat

#

my bRRAAAAAAAAAAAAAAAAAIN

#

thanks lol

keen compass
#

that void method handles making a new world for you too

wanton delta
#

Im having trouble with the SQL result set type... is there a way to make a specific type the default for all resultsets? instead of having to define the type for each prepared statement?

cloud crater
#

@keen compass yes

#

i use it for my world manager plugin

keen compass
#

@wanton delta what do you mean?

wanton delta
#

Operation not allowed for a result set of type ResultSet.TYPE_FORWARD_ONLY

#

I could define the result set type for every single prepared statement i already have

#

but i dont want to do that

keen compass
#

you do know you can easily make a function for your prepared statements

#

so that you can feed it what you want it to query

tiny dagger
#

declare it somewhere with a small name?

#

or a small utility method to easily generate them for you

frigid ember
#

^^^^

wanton delta
#

i suppose

keen compass
#

Generally isn't common that you need to go backwards for results though

frigid ember
#

also that

wanton delta
#

well im using beforeFirst and i believe that is what is triggering it

frigid ember
#

there is no need to ever go backwards

keen compass
#

well there is, just isn't common is all lol

frigid ember
#

lmao true

#

what does beforeFirst do

wanton delta
#

....

#

it moves the cursor before the first object lol

keen compass
#

it puts the cursor before the First result

frigid ember
#

i dont know java lmoa

#

ah

wanton delta
#

is that what it is by default? if so i can just remove it

#

(this isnt my code if you could tell)

keen compass
#

By default, it reads the result from forward to back

#

so in most cases you really don't need to do that

wanton delta
#

well i mean

#

if you want context

#

all thats happening is rs = stmt.executeQuery();

#
            rs = stmt.executeQuery();

            rs.beforeFirst();

            while (rs.next())
            {```
keen compass
#

if you don't have a specific reason to set the cursor back to the beginning then remove it

wanton delta
#

could i just remove beforefirst?

frigid ember
#

that's what he said

wanton delta
#

i sent that message very close to when he sent his lol

frigid ember
#

xd

#

i am learning java soon

keen compass
#

the only thing you want to make sure is that your result set didn't come back empty

#

before trying to iterate over it

cloud crater
#

@idle zodiac are you teleporting the player after generation is complete?

frigid ember
#

i was gonna say that but i did not know if i was gonna be right

idle zodiac
#

@cloud crater no, they are t spawn

cloud crater
#

be good to do so.

idle zodiac
#

ok

cloud crater
#

most sb plugin you get teleported after created island.

idle zodiac
#

ye ik

cloud crater
#

nice feature just saying.

idle zodiac
#

i'm just trying to get the generation working again ol

cloud crater
#

yeah it should work now

#

well the void

idle zodiac
#

it doesnt

#

my brain hurts

cloud crater
#

any errors?

idle zodiac
#

nope

#

i need to get in a call ol

cloud crater
#

if you need

#

or put the createIsland() method in a try#catch

idle zodiac
#

ok

brisk mango
#

Why

#

what exception do you expect there

cloud crater
#

if anything goes wrong it will print.

brisk mango
#

🤦‍♂️

naive goblet
#

Ceezy like what?

brisk mango
#
   try {
            ClipboardFormat.SCHEMATIC.load(file).paste(world, loc, true, true, (Transform) null);
        } catch (IOException e) {
            e.printStackTrace();
        }
idle zodiac
#

if anyone gets a big brain moment dm me ima go afk

brisk mango
#

theres nothing else that can go wrong

#

or that needs to be surronded with try/catch

#

it will get printed if something goes wrong itself

minor spruce
#

how do I delete a patch? I made one as a test and I've unstaged and removed it (I think) but when I do ./rebuildPatches.sh it reappears

cloud crater
#

that's what i just said

brisk mango
#

That is already in a try / catch @cloud crater

#

if you dont see

cloud crater
#

that's to see if it loads the schematic.

brisk mango
#

why wrap it again

#

yeah, the only thing that can go wrong in the code

#

and it is in a try/catch

#

so whats the reason to put the method call in a try/catch?

cloud crater
#

world creation?

brisk mango
#

that will get printed though

#

if it goes wrong

#

actually wait

#

Nope, it doesnt throw any exceptions

#

so it doesnt need to be try/catched

pastel condor
#

anyone know why this !(event.getInventory().equals(Main.openGUI.get(player.getName()))) seems to be true in all my guis? (it should only be true in the open gui) Here is some more code: public void openInventory(final Player player) { Inventory inv = worldsAddedToGUI(player); player.openInventory(inv); Main.openGUI.put(player.getName(), inv); }

brisk mango
#

why are you comparing the inventory with .equals

pastel condor
#

should I use ==

brisk mango
#

does openGui.get(player.getName()))) return the same inventory object

#

if so, use ==

#

also this static stuff

pastel condor
#

it should, thats what I have to check

brisk mango
#

remove static

pastel condor
#

okay?

#

but that shouldn't magically fix it

brisk mango
#

it shouldnt but its better

pastel condor
#

what would fix it?

brisk mango
#

try ==

pastel condor
#

k

brisk mango
#

and make sure it saves the same inventory object

#

Map<String, Inventory>

pastel condor
#

correct

#

I'm doing that

brisk mango
#

map.put(player.getName(), inventory)

pastel condor
#

static HashMap<String, Inventory> openGUI = new HashMap<String, Inventory>();

brisk mango
#

final Inventory inventory = Bukkit.createInventory(null, 54, "Inventory");

#

okay done watching this static collections

pastel condor
#

then I have Inventory inv = worldsAddedToGUI(player); player.openInventory(inv); Main.openGUI.put(player.getName(), inv);

brisk mango
#

fine but do you have to use static everywhere

pastel condor
#

just a habbit

brisk mango
#

"habbit" LOL

#

okay dude

#

its not gonna be me who's code is gonna have bad performance

pastel condor
#

is static slower?

#

I've never checked that

#

oh it might be

#

because I have to create a class instance

#

which uses up memory

brisk mango
#

you know that everything that is static gets loaded into memory and never get GC'd

#

better than doing static

pastel condor
#

yeah

brisk mango
#

static breaks the rule of the language lol, OOP

pastel condor
#

time to remove static

tiny dagger
#

don't use it till you mastered it's proper uses :p

brisk mango
#

the proper uses are not hard to learn

pastel condor
#

sorry it's just my java teacher always had us write static

brisk mango
#

very bad teacher

wind dock
#

anyone here know any good free queue plugins with donator priority support?

brisk mango
#

nope

#

its not hard to make your own tho

wind dock
#

um how do i make my own?

#

actually I dont know how to code so nvm :/

tiny dagger
#

do it for him temedy :d

keen compass
#

@pastel condor statics cause your objects or variables to not get garbage collected if you are done using them. Also, statics can prevent you from getting the appropriate instances of objects. IE you want a new instance, and not an instance from before.

cloud crater
#

@wind dock just google a "spigot queuesystem plugin", or google bungee methods

wind dock
#

I googled it but everything is paid :/

#

thinking of using thishttps://www.spigotmc.org/resources/queuesystem-1-12-support.44013/

pastel condor
#

oh I see thanks @keen compass

wind dock
#

this plugin isnt a virus right lmaohttps://www.spigotmc.org/resources/queuesystem-1-12-support.44013/

brisk mango
#

maybe

wind dock
#

maybe as in probably or probably not @brisk mango

brisk mango
#

ofc it is virus

pastel condor
#

it looks like this (event.getInventory() != Main.openGUI.get(player.getName())) didn't work

brisk mango
#

idk man

pastel condor
#

same here

brisk mango
#

just an code issue somewhere

pastel condor
#

😦

#

it's an issue with all my gui classes

#

should I just send you the code of one of the classes?

wind dock
#

@brisk mango is that sarcasm

cloud crater
#

just read reviews.

little lava
#

anyone know a plugin for adding new objects to minecraft 1.15 with custom recipes for the objects?

brisk mango
#

it is

#

ofc there is no viruses on spigotMC

#

You cant with plugin @little lava

#

you cant add new items

#

mods do that

pastel condor
#

textures

tiny dagger
#

there are a few viruses on spigot tho

#

lucky we have optic to find them

timid valley
#

Spigot does not review free resources, so it is very possible for someone to upload a virus or "force op". Take caution with what you download.

cloud crater
#

unless you decompile

tiny dagger
#

even then

#

depends on the decompiler

brisk mango
#

obfuscators

tiny dagger
#

bridge methods for example aren't visible in jdgui

#

those aren't allowed

#

anymore

hoary parcel
#

Any good decompiler allows you to show syntetic members

#

Spigots section is full of viruses, but they get found rather quickly

cloud crater
#

9/10 server owners with no coding experience isn't going to think about decompiling to see.

tiny dagger
#

yeah but if you download a plugin with quiet a few of reviews/downloads you'll be fine

agile girder
#

What is network-compression-threshold?
What's the effect that has in the server?
Someone told me that slows the amount of players if they join at the same time or something like that but I didn't understood

hoary parcel
#

No, that would be connection throttling

#

Network compression threshold means how big a packet has to be for it to be compressed iirc

cloud crater
#

it is how hard the server works to compress the data sent between the server and the client to reduce lag

hoary parcel
#

You lower it, you get less bandwidth but more cpu usage or smth

keen compass
#

you are correct @hoary parcel Default value is generally sufficient

#

if a packet is 64bytes or smaller, you won't gain much from compression

cloud crater
#

the lower the better but lowest you should go is 64 no lower

pastel condor
#

I still can't seem to solve my gui issue

lament wolf
#

I mean

#

If a player types /skull Bread, it gonna take the linked skull

worn temple
#

they should have an API you can hook into. Otherwise, you're gonna need to learn how to do webscraping

lament wolf
#

Yeah I guess

tulip pendant
#

Help me plz

brisk mango
#

CraftMetaSkull @lament wolf

tulip pendant
clever hornet
#

why arent mobs spawning from spawners on my server? im using silkspawners

tulip pendant
#

That’s my issue

worn temple
#

@tulip pendant ffs stop spamming servers! If you want help with a complex issue, open a thread on the forums. This is not a clearlagg support server. Talk to the devs of the plugin and/or stop using it in the first place.

brisk mango
#

ClearLagg is such an shit plugin

#

lol

tulip pendant
#

I don’t have Clearlag

#

I just posted an issue there

brisk mango
#

opened a thread for clearlagg

tulip pendant
#

Since I thought it’s the issue

#

?

hallow surge
#

how can you have an issue with a plugin you dont have

#

im interested

worn temple
#

Yeah

#

This kid is nutty sometimes.

brisk mango
#

just ignore him guys please

hallow surge
#

there is another kid that got book banned on his own server and doesnt know what view bobbing is and posted on the forum lol

worn temple
hallow surge
#

that linkk

#

tho no thx

worn temple
#

Its just a screenshot of him spamming my server

#

its a custom image host

lament wolf
#

CraftMetaSkull @lament wolf
@brisk mango What is that

#

Yeah an object

#

But,

#

I mean

little lava
#

well I mean something like adding an object with the same ID of a minecraft object but a different recipe and texture, for example I add the Netherite Armor by replacing it by the leather texture and editing the armor it has but what i search is a way for doing it without the needing of eliminating the other object @brisk mango

pastel condor
#

anyone know why when a player click in one of my guis, it seems to call all the guis? (like if they click in slot one in one gui it calls slot one in all the guis) here is the code of one of my guis (it's mostly the same between all of them) https://pastebin.com/gTB3wNV1

timid valley
#

@little lava just use a mod platform for mods. dont hack mods into a non mod platform.

clever hornet
#

whats a good mob spawner plugin

barren abyss
#

well I mean something like adding an object with the same ID of a minecraft object but a different recipe and texture, for example I add the Netherite Armor by replacing it by the leather texture and editing the armor it has but what i search is a way for doing it without the needing of eliminating the other object @brisk mango
@little lava item textures can be modified depending in the durability, theres a lot of texture or item appareance changer in youtube, without using mods etc

frigid ember
#

can someone help?

barren abyss
#

Lé Spam

frigid ember
#

?

barren abyss
#

A bit more code?

little lava
#

@timid valley I know its posibble without mods because im trying to copy it from a serie of YouTube but i dont know how

frigid ember
#

can u check dm @barren abyss ?

timid valley
#

what you are doing IS a mod

#

its textbook definition of modding

brisk mango
#

@frigid ember the IDE error is clear

#

Can only iterate over an array

#

or over anything thats Iterable

#

show some more code

pastel condor
#

anyone know why this isn't working? ```public class BasicSettingsGUI implements Listener {
@EventHandler
public void gui (InventoryClickEvent event) {
final Player player = (Player) event.getWhoClicked();
if (event.getInventory() != Main.openGUI.get(player.getName())) return;

    event.setCancelled(true);

}```

brisk mango
#

still using static?

pastel condor
#

oh just for the map

#

thats it

#

I removed every other static thing

brisk mango
#

"just for a map"

#

its still static

#

why make collection static

timid valley
#

don't use != to compare objects

#

at least use .equals() but i dont believe even equals works reliably for inventories

brisk mango
#

why not use != LOL

pastel condor
#

I was using that but then people told me to use !=

timid valley
#

they told you wrong

brisk mango
#

check if the object is not identitical

#

nope they didnt

#

!= checks if the oject isnt identical

#

if its not it will return true

timid valley
#

!= is not safe in java except for enums unless you know for sure you have object identity

#

but for inventories, you do not have object identity

brisk mango
#

LOL okay i have enough of you today

#

"is not safe"

timid valley
#

@subtle blade hes still trolling

brisk mango
#

okay so i guess

#

lets just do

little lava
brisk mango
#

if(!world.equals(null)) { }
#

just because why fucking not

#

its safer isnt it?

#

totally wont throw an exception

timid valley
#

noone said anything about a null check

brisk mango
#

!= is an null check though

timid valley
#

I'm talking to @pastel condor who is not doing a null check

brisk mango
#

we were talking about != werent we?

#

why is it wrong

#

teach me

#

and how come even java code uses it

pastel condor
#

but the gui can't be null

#

or it shouldn't be

#

but I guess it could

timid valley
#

Inventory a = map.get(uuid);
if (player.getOpenInventory() == a) {

A = Inventory1
player.getOpenInventory = inventory2

But, a.equals(b) might be true. not the same

brisk mango
#

You know what is the difference between .equals and == do you?

#

doesnt seem like

timid valley
#

you're really wanting to get banned aren't you.

brisk mango
#

@pastel condor ignore this guy

pastel condor
#

not really I though .equals was for objects

brisk mango
#

nope

timid valley
#

it is, use it.

brisk mango
#

== checks if the objects are identical i.e same instance

#

which is fine

timid valley
#

Yes, and inventories are not always the same instance.

brisk mango
#

if the map returns an identical object

#

they are

#

if he saved the same instance

#

into the map

#

dummy

pastel condor
#

for some reason the thing from the map is broken

obtuse rose
#

Remember kids, don't compare non primitive types with ==

pastel condor
#

like other guis think they are equal to it

#

I'll compile my edits and test it again

timid valley
#

If you open a custom inventory, the object is wrapped. It is not identical.

pastel condor
#

but if you use .equals it would be the same?

timid valley
#

yes, should if not its a bug 🙂

pastel condor
#

thats odd then

timid valley
#

always use equals except for enums, it's java standard practice (outside of null checks to make temedy hush)

pastel condor
#

oh okay

#

for some reason even with .equals the problem is still there

timid valley
#

is it a custom inventory?

pastel condor
#

I belive so

timid valley
#

I do believe there is a bug on those actually, which is why people use Inventory Holders

pastel condor
#

I used to use that, but I was told not to

timid valley
#

but spigot has a vendetta against them

pastel condor
#

yes

#

It worked fine with them

timid valley
#

i suggest continue to use them

pastel condor
#

oh okay

#

thanks

timid valley
#

spigot is being silly with trying to get people off them

pastel condor
#

xD

barren abyss
#

Hi, NBTags needed when modifying armor properties with ItemStack?, just tried and it seems like but im not sure.

timid valley
#

but would be good if the damn equals bug was fixed

brisk mango
#

@timid valley why did you mislead them

#

you said never use != to compare objects

pastel condor
#

I think he is correct

timid valley
#

do you want to know what's the very first line of code in nearly every equals method?

#

if (a == b) return true;

brisk mango
#

no need to tell me that, there is a thing though

#

you shouldnt say never use != because there are cases when you want to use it

#

i.e if u want to check if an object isnt instance of another object u use !=

#

or on a nullcheck

#

You use .equals though if the class itself has an overriden equals method that has more checks than just checking if the object isnt identical

#

so dont mislead people, thanks

timid valley
#

you should not rely on identity checks unless you explicitly know identity is the right type of comparison

brisk mango
#

I said it depends on the use case. Definetly should not be never

#

u use it most likely all the time

dusty topaz
#

i.e if u want to check if an object isnt instance of another object u use !=

#

wat

#

sender != instanceof Player

brisk mango
#

no

dusty topaz
#

new hidden syntax

brisk mango
#

🤦‍♂️

#

if(object != object2)

dusty topaz
#

thats checking if they arent the same reference

brisk mango
#

Object object = new Object();
Object object2 = new Object();

if(object == object) // returns true
if(object == object2) // returns false

#

no

dusty topaz
#

it's literally called a reference comparison

brisk mango
#

okay cool and?

dusty topaz
#

but it it's not checking if they are the same reference?

brisk mango
#

it is checking if the objects are identical

dusty topaz
#

no it isn't

brisk mango
#

it is

#

== checks if an object is identical to another object

wanton vine
#

best anti cheat in your opinion?

dusty topaz
#

it checks if they hold the same reference 🤦

brisk mango
#

🤦‍♂️

#

damn youre stupid

dusty topaz
#

😦

barren abyss
#
if (obj1 == obj2){
  //if true do stuff
} else {
  // if false do other stuff
}
timid valley
#

actually no, saying "is identical to another" is misleading. It checks that the object the variable points to is literally the exact same object.

but 2 objects with the absolute same data such as class foo { int bar = 42; } if ((new foo()) == (new foo()) { is false

worn temple
#

you should never ever ever use == to compare objects. Always use object1.equals(object2)

brisk mango
#

why should you never use ==

timid valley
#

or Objects.equals() for null safe

barren abyss
#

i'll note that

worn temple
#

Because it doesn't actually compare the objects

brisk mango
#

it does?

timid valley
#

temedy you should go read some tutorials/books on java, or go to school for it.

brisk mango
#

😂

worn temple
#

== is more for numbers and enums.

naive goblet
#

When we work with inv menus using == wouldn’t be totally useless

brisk mango
#

no

#

yes

brisk mango
#

but you should use it whenever u want to check if the object is identical

#

@worn temple why you say such bullshit

naive goblet
#

temedy yeah indeed

brisk mango
#

you use .equals if the class has overriden method .equals

#

and you use == to check if the object is identical to another object

#

if it is it will return true

worn temple
#

No, .equals() should be used, == does not work for comparing two objects.

timid valley
#

stop saying identical

#

it's IDENTITY

brisk mango
#

there is nothing like " you should never use =="

timid valley
#

they are different

brisk mango
#

they are not

#

new Foo() == new Foo() is different

#

because its 2 instances so its not the same

little crater
#

== is reference equality check. equals is value equality check

timid valley
#

yes and this is called identity

brisk mango
#

wait hold your horses

timid valley
#

literally System.identityHashCode

brisk mango
#

so youre saying if i would be comparing 2 objects if == they would be different or what?

#

you dont make much sense tbh

little crater
#

== compares memory locations where they are stored. It returns true if they are the exact same object, not equal values

brisk mango
#

why you keep sending this? rather read it urself

#

before saying bullshit

#

@little crater exactly

worn temple
#

I am reading it tho

brisk mango
#

then stop sending it here

#

youre the only one who needs to read this with aikar

worn temple
#

I highly recommend you take an actual class on java

brisk mango
#

fine

frigid ember
#

someone help

brisk mango
#

i dont think i need it though

frigid ember
brisk mango
#

PlayerJoinListener.java:28

timid valley
#

dat 1.8

wooden harness
#

:outdated:

#

aw

little crater
#

What you mean @brisk mango

exactly
I was correcting you. You aren't saying what I am saying :p

brisk mango
#

Im saying what you were saying

timid valley
#

your saying it with misleading words

brisk mango
#

actually it deosnt check if its the same value so you werent right

#

If a class does not override the equals method, then it defaults to the equals(Object o) method of the closest parent class that has overridden this method.

#

which is litterly what ive said and you've tried to correct me @worn temple

#

the default .equals(Object o) method just uses if(object == object2)

#

which is the same as using it directly, though u wouldnt be able to use if(object.equals(null))

frigid ember
brisk mango
#

have to use the equality operator for that

frigid ember
#

what is the error?

timid valley
#

you probably want INSERT INTO ... ON DUPLICATE KEY UPATE instead of that code

little crater
#

Yeah, you're just saying it weird. Very misleading. Easiest way to say it is == is a reference check and equals() is a value check. Any object worth using already overrides the equals() method (like ItemStack from your example) so talking about overrides and defaults just muddles the convo even more, imho

brisk mango
#

how is .equals an value check

tiny dagger
#

equals is for the object insides == is for the instances

#

easiest way to remember

brisk mango
#

no?

daring crane
#

yes?

brisk mango
#

It depends on what .equals is

#

because sometimes it can be overriden

#

and if its not overriden

#

then it is just wrapper for

#

if(a == b)

tiny dagger
#

yeah

#

but usually tht's why you would look for equal instead of ==

#

if it has inside checks

wind dock
#

hey guys, does balck spigot leak ips??

#

black*

#

:/

naive goblet
#

Black Spigot user 🤨🤨

cold wharf
#

Hey

tiny dagger
#

your message got deleted tho

cold wharf
#

Is it possible to center a MOTD?

wind dock
#

@naive goblet I admit that I have used it, but only when im desperate. i dont use it anymore tho

tiny dagger
#

why you circumvented the system?

barren abyss
#

That fucking beef tho

wind dock
#

Because I wanted to know :/

barren abyss
#

they just screaming at each other fighting for who have the reason

naive goblet
#

Proba

#

Geo they probably leak it idk

wind dock
#

how do they even get your ip??

naive goblet
#

Don’t take it as they wouldn’t do it

barren abyss
#

just mute each other if you think you have the right idea

naive goblet
#

When browse their site ?

wind dock
#

oh

naive goblet
#

dev true

wind dock
#

welp

naive goblet
#

Nitpicking arguments is just a bamboozling view

cold wharf
#

Is it not possible to do it so you can change motd to anything in config?

wind dock
#

should i probably change my ip :///

naive goblet
#

Calculate spaces

tiny dagger
#

and word sizes

wind dock
#

just go on motdcreator

#

and put spaces

tiny dagger
#

there was a lib some time ago

wind dock
#

until its in the center

naive goblet
#

Geo there is probably tons of other organizations that picked up ur ip

wind dock
#

uh how

#

from different websites??

#

but black spigot is like

#

the black market

worn temple
#

lool not even close

wind dock
#

wouldnt they be like

worn temple
#

Trust me, there are worse places for your IP to get

wind dock
#

like?

worn temple
#

black spigot is literally just where shitheads go to post a plugin they have bought so others get it free. Not even close to the blackmarket.

cold wharf
#

Is it not possible to make it so the MOTD stays in center and you can chsnge the MOTD to anything from config

naive goblet
#

Yes probably some plugin that does that

#

Pretty ambiguous though

cold wharf
#

Do you know any plugin like that?

#

Which does that*

naive goblet
#

Nope

#

Just use the online generator

barren abyss
#

well

#

isnt that hard i guess... just check how many characters a motd allows per lane

#

like... if its 20 chars and the word is HELLO the word have to start at char 7

#

It's probably easy to make

worn temple
#

I think its part client side? doesn't it line wrap for smaller screens?

pastel condor
#

anyone know why this doesn't work? `if (!(event.getInventory() instanceof AdvancedSettingsGUI)) return;

    event.setCancelled(true);` I create my inventory with```    public Inventory advancedSettingsGUI(Player player) {
    AdvancedSettingsGUI gui = new AdvancedSettingsGUI();
    Inventory inv = Bukkit.createInventory(gui, 36, "Advanced Settings");
    Worker work = new Worker();

    inv.setItem(11, work.createGuiItem(Material.BLUE_ICE, "§fFreeze Day Night Cycle at current time", "§f(Default on)"));
    inv.setItem(13, work.createGuiItem(Material.DEAD_BUSH, "§fToggle plant growth", "§f(Default on)"));
    inv.setItem(15, work.createGuiItem(Material.PIG_SPAWN_EGG, "§fToggle Mob Spawning", "§f(Default on)"));
    
    inv.setItem(31, work.createGuiItem(Material.BARRIER, "§fGo Back"));


    return inv;
}```
dusty topaz
#

(!(event.getInventory() instanceof AdvancedSettingsGUI is probably why

pastel condor
#

but the owner is gui: Bukkit.createInventory(gui, 36, "Advanced Settings");

#

AdvancedSettingsGUI gui = new AdvancedSettingsGUI();

dusty topaz
#

thats the inventory holder

pastel condor
#

yes

dusty topaz
#

and you shouldn't be checking like that anyway

#

yes, you're setting the holder. you're checking if the inventory is the instanceof, not the holder

#

and you shouldn't be doing that anyway

pastel condor
naive goblet
#

Yh encapsulate inventories instead and compare

pastel condor
#

idk

#

I was told to use them

#

I switched to a different way but it didn't work

naive goblet
#

Who told u 😳

dusty topaz
#

i mean, personally i don't use them because they're not intended for that purpose

pastel condor
#

ik

dusty topaz
#

there is no actual issue with using them, you're just not supposed to

naive goblet
#

They will probably go deprecated anyways

pastel condor
#

I have tried many ways

#

so I gave up and went to the dumbest and easiest way

naive goblet
#
class InventoryWrapper {
  private final Inventory inv;
  public InventoryWrapper(String title, int size) {
    this.inv = Bukkit.createInventory(null, title, size);
  }
  public Inventory compareTo(Inventory inv) {
  return this.inv == inv ? this.inv : null;
  }
}```
#

the method is just an example and you would do a null check then

#

But I mean a bool method would work as wel

pastel condor
#

I've kinda given up, is there a super simple way?

naive goblet
#

This is the super simple way lol

pastel condor
#

or do I just hack my way though with inventory holder?

#

oh?

naive goblet
#

Don’t use holders

pastel condor
#

but I want to check if the inventory is equal to the one given

naive goblet
#

I can write an example code

pastel condor
#

that would be great

naive goblet
#

10 min

#

On phone

#

Heh

pastel condor
#

before I did the inventory holder junk

brisk mango
#

AdvancedSetingsGUI isnt an inventory itself

#

you need to ocmpare the inventory holder

#

either compare the inventory object or the holder

#

i.e
if(event.getInventory().getHolder() instanceof Holder) {

}

#

In order to have it; InventoryHolders are random bukkit interfaces and you shouldnt implement it in your plugin; youre not supposed to (md_5)

pastel condor
#

okay 🙂

#

I'm reverting my git repo

#

to remove the inventory holder

#

I'm going back to an hour ago

naive goblet
#
abstract class InventoryBase {
  protected final Inventory inv;
  public InventoryBase(String title, int size) {
    this.inv = Bukkit.createInventory(null, size, title);
  }
  public final Inventory compareTo(Inventory inv) {
    return inv == this.inv ? inv : null;
  }
}
class ExampleGui extends InventoryBase {
  public ExampleGui() {
    super(9, “Example);
    inv.addItem(new ItemStack(Material.DIRT);
  }
}
class InventoryListener implements Listener {
  private final InventoryBase inv;
  public InventoryListener(Main instance) {
instance.getServer().getPluginManage().registerEvents(this, instance);
  inv = new ExampleGui();
  }
  @EventHandler public void onClick(InventoryClickEvent e) {
    Inventory inv = e.getInventory();
    if (this.inv.compareTo(inv) != null) {
      //inv is ExampleGui
    }
  }```
}
#

Something probably went wrong when typing

#

But this something like this

brisk mango
#

why are those package-private

#

not bad code, i just dont like those methods in the constructors.

naive goblet
#

Yhyh just tried to make the concept

#

And phone + autocorrect isn’t nice

pastel condor
#

how could I edit my code to make it work?

naive goblet
#

What’s ur current code

pastel condor
#

I got to revert in git one sec

#

It's a huge mess

naive goblet
#

Feels like I’m unprepared

pastel condor
#

one minute

#

doing research on how to revert in git