#help-development

1 messages ยท Page 2083 of 1

viral temple
#

remember when oil prices went negative

noble lantern
#

+rep for senior team

lost matrix
#

Intellij comes boundled with its own maven instance

wet breach
granite owl
#

member when donald trump was still president? oh yea i member

wet breach
#

you had to be super quick to get in on that deal for the oil prices XD

viral temple
noble lantern
#

uh oh were getting political

#

byebye

granite owl
#

xD

slim kernel
wet breach
viral temple
wet breach
#

they were just pointing out what was better then free

#

XD

granite owl
#

referencing the best series

#

ever

lost matrix
wet breach
#

wooo

#

7smile7 is here

#

I can leave now ๐Ÿ˜„

lost matrix
#

lul

wet breach
#

and the place won't fall apart chaotically

slim kernel
noble lantern
#

oh its the man who steals top slot on server boosters from me

lost matrix
wet breach
#

Also @noble lantern what happened to that test?

slim kernel
noble lantern
lost matrix
slim kernel
noble lantern
#

and compile takes 1 mins i got bored of recompiling to test

granite owl
#

i suspect my pom.xml isnt even setup properly but whatever, it works xD

wet breach
granite owl
#

but i just left the namespaces empty

#

xD

noble lantern
#

but nope

#

its probably something deeper than the main class

lost matrix
glossy venture
#

wouldnt you just divide 1000 by the tick time in miliseconds

viral temple
#

Oh boy, is this lag free?

glossy venture
#

to get tps

#

think it might be a local variable

#

in some method

noble lantern
lost matrix
noble lantern
#

theres TPS = 20 but changing it past that doesnt change anything, unless /tps is lying

Plus was just doing it for fun

granite owl
#

@wet breach what would you say to my approach to write my own permission system using the scoreboard teams as its backbone? (its already working xD for the most part) xD

lost matrix
glossy venture
#

why do you want to change tps

slim kernel
noble lantern
glossy venture
#

i think it would rather use the tick time

glossy venture
#

for calculations

lost matrix
wet breach
slim kernel
lost matrix
slim kernel
noble lantern
#

I think that plugins broken tbh

lost matrix
glossy venture
#

theyre changing the minimum length the tick is adjusted to

noble lantern
#

unless that command is lying

#

and my changes did work when i changed them

glossy venture
#

is that with the plugin or your own code

lost matrix
# slim kernel

Make sure to use the latest version of the maven shade and maven compile plugins.

noble lantern
glossy venture
#

ah

noble lantern
#

i know its not really possible with a plugin past jdk 12 as you cant edit public static finals really

#

already tried it

slim kernel
lost matrix
#

Just change the version in you pom

slim kernel
smoky oak
#

can i force a scheduled task to wait until a different scheduled task finished?

granite owl
#

memory usage is so dumb

#

the server only deletes data when he needs memory

#

if u give it 32gigs itll first fill 32gigs before freeing memory

lost matrix
noble lantern
#

LMFAO

#

@wet breach

#

theyre fucking

#

teleporting

smoky oak
lost matrix
noble lantern
#

i figured out the problem my spawn chunks has 10k tile entities somehow so i legit couldnt do 17tps

lost matrix
noble lantern
smoky oak
# lost matrix Would you mind explaining the overall task that you want the tasks to accomplish...

I have a config filled with 'effects' and a function that translates them into a hashSet of EffectPreset extends BukkitRunnable, iterates it and schedules them. The issue is that one of those effects is supposed to read in coordinates from a lodestone locked compass and another effect is supposed to use those coordinates. The reason they're separate effects is bc there's more than one effect that's dependent on those coordinates.

granite owl
#

but the way the server does so

#

is quite exentive

#

as its just swallowing all the memory for this

lost matrix
granite owl
#

at some point the cpu will be the problem anyway

lost matrix
smoky oak
gleaming grove
#

Hi does Java has some handy way of loading Resource files to code?

wet breach
#

sounds like you just need to make a method that is intermediary that allows them to exchange information with each other

lost matrix
smoky oak
cursive loom
#

Hey do you know why I can't do that ?

lost matrix
cursive loom
#

Thats say he want int ?

lost matrix
lost matrix
cursive loom
#

So what he want ? ๐Ÿ˜‚

lost matrix
smoky oak
lost matrix
smoky oak
#

the reason i ask if i can make one task wait for the other is because of the nature of HashSet to not have a ordered structure

smoky oak
#

because the order of those effects isnt particularly important since they're all BukkitScheduler instances that call themselves

cursive loom
lost matrix
#

?learnjava

undone axleBOT
lost matrix
smoky oak
#

yea but

#

even then theres still the issue of parsing the information from one task to the other

lost matrix
#

Ok let me show you a mock up.

cursive loom
#

thanks

lost matrix
# smoky oak even then theres still the issue of parsing the information from one task to the...

Example number one:

public class EffectContext {

  private final List<EffectPreset> effectList = new ArrayList<>();
  private final Map<String, Object> dataMap = new HashMap<>();

  public void runAllEffects() {
    for (EffectPreset preset : effectList) {
      preset.trigger_effect(dataMap);
    }
  }

}

You use a List so you have a fixed order. You then simply pass a Map<String, Object> to every effect in order.
The first one can write something in there, the next one can read something and so on.
This would run all those effects in one tick after another.

smoky oak
#

but it returns a set not a list

kindred valley
#

when im trying to reach arraylist from another class it makes the arraylist empty why is it

lost matrix
#

Example number 2:

public class EffectContext extends BukkitRunnable {

  private final List<EffectPreset> effectList = new ArrayList<>();
  private final Map<String, Object> dataMap = new HashMap<>();
  private int currentIndex = 0;

  public boolean hasNext() {
    return currentIndex < effectList.size();
  }

  public void runNextEffect() {
    effectList.get(currentIndex++).trigger_effect(dataMap);
  }

  @Override
  public void run() {
    if (!hasNext()) {
      this.cancel();
    }
    runNextEffect();
  }

}

The effects will be run in order but only one per tick

lost matrix
smoky oak
#

in either case how can i get the effects in their proper order

slim kernel
lost matrix
kindred valley
smoky oak
#

i use the keys so i can parse arguments to the functions via the config. For example, the volume, pitch, and relative coordinaet shift of the playsound_lightning

lost matrix
smoky oak
#

no

lost matrix
#

Then i dont see why you would need keys

smoky oak
#

because the keys indicate where to grab the configuration sections indicating the effects:

effects:
 a:
  type: sound
  pitch: 2.5
  shift:
   x: 10
   y: 0
   z: 10
lost matrix
#

How is your data structured

smoky oak
#

well like what i showed as example. 'a' is a generic key, and the function instantizing the effects does for(String key : section.getKeys(false))

#

i just number them 'a' 'b' 'c' etc because its fast

wet breach
#

fast in what way?

smoky oak
#

in typing in

slim kernel
smoky oak
#

also its helpful to name them like that because if i want to indicate a more uncommon effect the name of the key doesnt matter

#

so i can name it like 'explosion_effect'

lost matrix
#

Im now completely confused how your data is even structured and i dont see any reason why you would need keys at all.

wet breach
#

I am not sure how you are dealing with the people here @lost matrix lmao

chrome beacon
#

Anyways if no other server is running delete the session lock file

smoky oak
#

?paste

undone axleBOT
smoky oak
slim kernel
pliant copper
#

running a server in google drive bru

smoky oak
#

assuming you use an IDE

wet breach
#

i am not sure where else you would reload a pom or would need to ๐Ÿ™‚

lost matrix
lost matrix
smoky oak
#

i told you before the names of the keys dont matter. Their purpose is to separate the effects from each other. The key 'visual' is there because I have a scheduling class, which gets extended by different effect classes - audio, visual, and things permanently changing in the world

#

i iterate over each key in the sections 'visual', 'audio' and 'world', adding the effects to the HashSet and returning it to the main function, which then calls the for loop to schedule them all

wet breach
# slim kernel <@554314763992170507>

maven doesn't work every well in google or one drive directories because the software involved with syncing those directories with the services, locks the files and prevents maven from being able to use them. If that isn't the issue then the pom is opened up somewhere else.

lost matrix
wet breach
#

and inefficient

smoky oak
#

if it works without noticeable lag its good enough

#

again what i really need to do is to parse some information from one effect to the other

wet breach
#

yeah if you like degraded quality sure

smoky oak
#

hwo would you do it then

wet breach
#

probably something similar to what 7smile7 would do it lol

#

idk, when you got two pretty decent developers here confused in what you are doing or how you are doing it, odds are it probably isn't a very good way lmao

lost matrix
# smoky oak hwo would you do it then

Still not 100% clean but its def better than what you are doing rn:

public class EffectContext {

  private final List<EffectPreset> effectList = /*load the effects in order*/;
  private final Map<String, Object> dataMap = new HashMap<>();

  public void runAllEffects() {
    for (EffectPreset preset : effectList) {
      preset.triggerEffect(dataMap);
    }
  }

}

Load them in order and pass some sort of data structure between them. From 0 to N.

smoky oak
#

about that... i remember having an issue with my IDE telling me its not possible to call a function with a HashSet<Item> when the parameter type was HashSet<Object>. Do you know why that is?

wet breach
lost matrix
smoky oak
#

HashSet<T> then?

wet breach
#

well if they were referring to casting, think they meant the other way

smoky oak
#

ah no

wet breach
#

but now we are getting into the realms of generics though

#

which I doubt you are ready to really mess with

lost matrix
# smoky oak HashSet<T> then?

Yes. If you want to allow any type of collection you can either do this:

  private <T> void call(List<T> list) {
    
  }

Or use a wildcard:

  private void call(List<?> list) {

  }
wet breach
#

also different types of generics

#

allow for different things too

smoky oak
#

where's the difference between T and ? then?

lost matrix
smoky oak
#

im confused

wet breach
#

very good reason for you to not mess with generics right now lol

lost matrix
#

For example:
This is not valid

  public void otherCall() {
    List<String> elements = new ArrayList<>();
    String element = "TEST";
    call(elements, element);
  }

  private void call(List<?> list, Object obj) {
    list.add(obj);
  }

While this is allowed:

  public void otherCall() {
    List<String> elements = new ArrayList<>();
    String element = "TEST";
    call(elements, element);
  }

  private <T> void call(List<T> list, T obj) {
    list.add(obj);
  }
#

But lets stay away from generics for now...

smoky oak
#

maybe context for this one

public static boolean allOne(HashSet<HashSet<Object>> tHashHashSet){
        for(HashSet<Object> tHashSet : tHashHashSet){
            if(tHashSet.size()!=1)
                return false;
        }
        return true;
    }```
This function is uninterested in the data type the inner HashSet contains so i wanted to make it generic but neither Object nor T work here
lost matrix
#

Use a wildcard instead. Also: wtf

wet breach
#

lmao

smoky oak
#

worked thanks

wet breach
#

not sure if we should be worried about that

#

I suppose we find out when they come back and complain about something along the lines of they can't read from their generic method but can write to it or vice versa ๐Ÿ˜‚

smoky oak
#

context for this one, i iterate through a list of locations and get all item entities in a bounding box of loc, loc.clone().add(1,1,1). I require that each of those bounding boxes contain exactly 1 item entity

lost matrix
smoky oak
#

oooh i see

#

noted

#

is that the reason getKeys returns a set?

wet breach
#

probably better if you use that instead of generics so you don't run into issues that you don't quite understand yet ๐Ÿ™‚

smoky oak
#

wait isnt that again not able to get parsed?

worldly ingot
#

Ah beat me to it lol

wet breach
#

lol

smoky oak
#

so wait

#

it can parse HashMap<HashMap<?>> to Collection<Collection<?>> but cant parse HashMap<HashMap<Item>> to HashMap<HashMap<Object>>

worldly ingot
#

Maps and Collections are different, so no

wet breach
#

well the first matches because it is using wildcard generics

worldly ingot
#

? is a wildcard so it could be either Item or Object

wet breach
#

the second way you are attempting to implicitly cast which isn't allowed in this way

full forge
#

How would I create an item? I want to override a BlockDropItemEvent, but the event.getItems() doesn't take ItemStacks

smoky oak
#

wait what does HashSet have that Collection doesn't?

wet breach
#

a set

worldly ingot
#

HashSets are Collections, they're just a more specific type of one

#

Collection -> Set -> HashSet

smoky oak
#

i mean in functionality

#

as in

#

why use hashset instead of collection

wet breach
#

Order I suppose?

worldly ingot
#

Sets don't allow duplicates and aren't ordered, but HashSets operate on the hash values of objects so #contains() operations are faster

wet breach
#

oh right there we go

lost matrix
full forge
#

Yes, I want to add items, but how would I actually make an item to add

smoky oak
#

Use set when you dont do contains() then?

worldly ingot
lost matrix
#

Note: There are some sets that maintain an order like TreeSet or LinkedHashSet.

worldly ingot
#

Mhmm

smoky oak
#

i used this as a guide thus far

worldly ingot
#

I guess order isn't really a specification of a Set, just a HashSet

wet breach
#

Well someone is certainly getting a free lesson in advanced java this morning lol

worldly ingot
#

Yeah, List/Set/Map are probably the three you'll use most often

#

ArrayList/HashSet/HashMap implementations generally

#

Until you explore alternative options you'll be okay with those lol

lost matrix
smoky oak
#

well every bukkit plugin ever I've seen has used HashMap instead of Map

worldly ingot
#

BlockDropItemEvent gives you a mutable list, doesn't it?

full forge
#

Yes

lost matrix
worldly ingot
#

Oh you're right

#

mbmb

#

No additions

wet breach
worldly ingot
#

You'll see Map<K, V> map = new HashMap<>() very, very often as you really don't need to know the implementation type in most cases

#

It provides no benefit

#

(again, in most cases*)

smoky oak
#

I'm more curious about the reason to use HashSet instead of Set. I dont call contains() at all

full forge
#

My problem is whever I make an item using new Item(), it wants me to override all methods in the class. Obviously I'm using the wrong constructor, so how should I properly do this

lost matrix
worldly ingot
glossy scroll
worldly ingot
#

What if you're keeping track of a set of player UUIDs that are able to perform some functionality?

#

You'll add to/remove from it, then #contains()

full forge
worldly ingot
#

(though for reference, a HashSet is a Set much like how a HashMap is a Map)

smoky oak
#

Oh i havent meant overall. I meant is there a reason to, in an instance i know i will not call contains(), to still use a HashSet

worldly ingot
#

Maybe. If you aren't iterating either (because iteration tends to be slower in sets) but you don't want duplicates, a Set is probably ideal over a List

#

It's all extremely situational

chrome beacon
smoky oak
#

Ah that would be a reason. I do iterate that HashSet in particular quite often

#

also Set still cannot contain duplicates right?

glossy scroll
#

Dont optimize your code before writing it

smoky oak
#

I've written most of it already

glossy scroll
#

All set implementations do not have duplicates

glossy scroll
#

If it doesnt need to be

smoky oak
#

to clone my earlier question

#

spawning 40000 Particle.DustTransition in causes them to appear over a few seconds in the order they're initialized in, but the method is supposed to run in one tick (50ms) and also tells me it finishes in that time in the logs. Any idea why?

#

so yes

#

optimization might be useful here

#

if i ever find out the reason it doesnt work like it says it does

glossy scroll
#

I dont think you will be able to do this in one tick

smoky oak
#

the server says it works in one tick

#

it also says if i call /tps immediately afterwards that the tps of the last 5 seconds was 20.0 tps

glossy scroll
#

Well the problem is

#

You have to send 40,000 packets to the player

#

Thats easy

#

Sending packets is easy

#

I think there would be a client limitation at this point

#

They may not be able to receive all of these at the same time

smoky oak
#

i recall that issue not happening with lower amounts of particles

#

but i use so many to generate a continuous shape

wet breach
# smoky oak I'm more curious about the reason to use HashSet instead of Set. I dont call con...

While this may be true, you shouldn't limit yourself to API options just because you are not making use of them. There isn't any loss of benefits by using a HashSet over a Set even if you are not making use of the extended features in fact you have more benefit because later down the road you won't have to spend time refactoring code because it turns out you do need that extended functionality.

#

most of the time where you have to worry about these things is if you are making an API where you would return the lowest type instead and let the user decide if they want to make use of a higher type because you don't know what the user would want.

slim kernel
smoky oak
#

doesnt set still have the contains function? wouldnt the onyl thin i need to change be the implementation method behind the instantication of the set?
Set<Item> itemSet = new Set<>() -> Set<Item> itemSet = new HashSet<>()

glossy scroll
#

You cant instantiate Set on its own

#

Its an interface

smoky oak
#

well that answers that question bruh

#

imma take a break and then deal with the part of my code thats not working

glossy scroll
#

Im very confident youve just reached a mc limitation

#

Also 40,000 packets

wet breach
#

that sounds ideal since you basically got a crash course into some advanced java stuff ๐Ÿ˜›

glossy scroll
#

Thats a lot of data

#

Players may hit throttling if their ISP sees that!

wet breach
#

40k packets is nothing ๐Ÿ™‚

smoky oak
#

im unsure if its 4k or 40k packets

glossy scroll
#

40k would be a lot

smoky oak
#

i call spawn particle 4000 times with 10 particles each

glossy scroll
#

I usually try to keep lower than 1200 for complex visuals

glossy venture
#

spawn particle packet contains the amount i think so it would probably be 4k

glossy scroll
#

You can also use the debug screen in minecraft to see if your client is receiving all the packets

smoky oak
#

where?

glossy scroll
#

Its in the packet?

#

You can specify amount

smoky oak
#

no in the debug screen

glossy scroll
#

Oh

wet breach
glossy scroll
smoky oak
#

must be a client issue then

glossy scroll
#

โ€œrxโ€

glossy scroll
smoky oak
#

is tht over the lst second?

wet breach
#

makes it easier to handle in this manner

glossy scroll
#

Im just thinking like

#

That requires around 20mbps internet

#

Which most have

#

But a decent chunk dont

wet breach
#

while true, the packets are not sent or received all at once

glossy scroll
#

I think these are?

wet breach
#

so while total it is 2.4mb they are not coming down the pipe all at the same time

smoky oak
#

it goes up to 5000 rx over a few seconds then drops down

glossy venture
#

isnt rhere some conpression on the minecraft networking

wet breach
#

yes

glossy venture
#

so it will prob be a bit lower than 60 bytes/packet

wet breach
#

doesn't change tcp packet sizes though, just changes the size inside of the packets themselves

glossy venture
#

oh

#

tcp

#

yeah

glossy scroll
#

Should emphasize i have no real expertise

glossy venture
#

me neither

glossy scroll
#

So take anything i say with a grain of salt

glossy venture
#

lmao

wet breach
#

well networking is actually an area where I am an expert at ๐Ÿ™‚

glossy venture
#

nice

wet breach
#

didn't take 52week course in Satellite communications to not know anything ๐Ÿ˜›

glossy venture
#

lmao

glossy scroll
#

idk maybe yoy can help with this problem

#

The issue is trying to send 40k packets alledgedly

#

Theyre not all appearing at once like he wants em to

wet breach
#

however while the packets are padded to 60bytes, the nic will discard those empty bytes upon receiving ๐Ÿ˜‰

glossy scroll
#

Server says they were all sent in a 50ms interval

wet breach
#

well this is going to be probably an issue along the route as well as the receiving ends hardware and setup

smoky oak
#

wait a fucking second
I just sent a quarter million particles in 25k spawnParticle calls stretched over 2 seconds

#

no lag

wet breach
#

while the server may have sent those packets, that doesn't mean none of them needed to be re-transmitted

#

TCP requires acknowledge packets in return

#

if it doesn't get one, it will send a new one

smoky oak
#

so if the client cant recieve that many packets they get resent

midnight shore
#

hi! How can i set an item to be unpickable from the ground?

smoky oak
#

resulting in the stuttering display?

#

give it a tag in pdc then cancel whatever event is called when it get spicked up

wet breach
#

yes, but what I explained is an over simplification

#

there is a lot more to it

midnight shore
#

would this work?

wet breach
#

network hardware takes care of the re-transmitting the mc server wouldn't even know about it

glossy scroll
wet breach
#

oh talking about something else

glossy scroll
#

Also i believe there is a packet loss metric

smoky oak
#

i meant client side

#

server side there seems to be no issue considering the function finishes within one tick

wet breach
#

so if the server sends 40k packets, the client doesn't know it was suppose to get 40k packets

glossy scroll
#

Right

#

Server does

#

Just unsure if there is any feasible way to know

#

Probably not

wet breach
#

you would need a mod of some sort on the client

#

to report back to the server

glossy scroll
#

Mhm

wet breach
#

IE, you send 40k packets, client then reports back to server how many it got

smoky oak
#

hm i recall one of the things i tried - i set the particle display to decreased

#

can you spawn in particles without nms that only those whose setting is all see

wet breach
#

however though most of the time 40k packets isn't an issue for most people

#

minimum down speed someone would need for that is 5mb/s

#

maybe even 2 or 3 would just be fine too

glossy scroll
#

Right but theyre all at once

#

In this case

wet breach
#

client tick rate is the same as that of the server

#

so as long as they can get all the packets in 50ms

#

or even 100ms

#

then it shouldn't be an issue lol

glossy scroll
#

Right well that doesnโ€™t explain why its not working

smoky oak
#

no it does work

#

it stutters

#

but the server says theres no lag at all

#

must either be the client or the transmission then

wet breach
#

well that is going to be more of a case of client lag then it is a network problem

#

if the client can see all the particles but it is stuttering then that means the client got all the packets or most of them anyways

glossy scroll
#

Ya thats what i said

smoky oak
#

well theres no actual lag on the client

#

but the particles appear over time

#

not at once

glossy scroll
#

How much over time?

wet breach
#

I bet the server is throttling the sending of the packets

#

throttle limit is for both tx and rx

smoky oak
#

uh if i spawn in about 2000 * 10 particles

glossy scroll
#

Yea yhats also something i was thinking

smoky oak
#

SOMETIMES they appear over time

glossy scroll
#

Hardware or mc?

#

If its mc i would just recommend using protocollib

midnight shore
wet breach
#

I am thinking its client related

glossy scroll
wet breach
#

if you wanted to be sure it wasn't hardware related, send a custom ping packet from your server terminal that is 60bytes to the client system

smoky oak
#

the weird ting is that while it may stutter one time, the other time it eats three times as many particles without any issue

midnight shore
#

?? how could it be wrong?

glossy scroll
#

Data type mismatch

#

E.i you are getting and int when it really is a double

wet breach
#

@glossy scroll for not being an expert in networking at least your intuition wasn't off base either ๐Ÿ˜›

glossy scroll
#

Well i had to make tornado in mc

#

And faced a little bit of stuttering

midnight shore
#

but i never mention arrays

glossy scroll
#

Darn i cant find the gif of my tornado

wet breach
#

lol

wet breach
midnight shore
smoky oak
#

he means 'shouldnt there be a caused by below that'

wet breach
#

you are trying to store an integer when it wants a bytearray

midnight shore
#

but how could it 'want' an array?

#

i'm storing in a pdc

smoky oak
#

you need to declare thedata type youre storing in a pdc

#

it only allows primitives, byte array and string

wet breach
#

need to serialize your data or put it in a string

midnight shore
#

true! but i'm using a library from @tender shard

wet breach
#

doesn't mean it is perfect ๐Ÿ™‚

midnight shore
#

thats the DataType thing

wet breach
#

or you are not using it correctly lol

glossy scroll
#

Youre trying to store an integer where an array already exists

#

That is the issue

wet breach
#

I am not familiar with alex's lib

midnight shore
#

it worked perfectly until now and also i stored integers really well

eternal night
#

I mean, you are clearly accessing one value as an int and then the same value as a uuid

glossy scroll
#

The error doesnt lie

midnight shore
#

so i don't really understand whats wrong

wet breach
#

I can only tell you what the error means

#

and as martoph said

#

it doesn't lie lol

eternal night
#

whatever value is stored under WillowCore.entity_data

wet breach
#

well that isn't true

glossy scroll
#

Do not claim to have perfect code if it errors out

wet breach
#

rarely it lies about the error ๐Ÿ˜›

eternal night
#

you read it once as an DataType.INTand once as a DataType.UUID

midnight shore
#

oh my god

#

i'm dumb

#

i had a typo

#

in the namespace name

eternal night
#

๐Ÿ‘€

glossy scroll
#

That explains

wet breach
#

I do hate it when java lies about the error though

#

glad that isn't a common thing for people to complain about when they come here ๐Ÿ™‚

gleaming grove
#

how can i get the server IP adress in my plugin?

#

ok nvm

tardy delta
#

what does that mean?

granite owl
#
11.04 14:19:21 [Server] Server thread/ERROR Error occurred while enabling PlayerControl v1.0 (Is it up to date?)
11.04 14:19:21 [Server] INFO java.lang.ClassCastException: class java.util.HashMap cannot be cast to class java.lang.String (java.util.HashMap and java.lang.String are in module java.base of loader 'bootstrap')
#
rankPermissions = (HashMap<String, ArrayList<String>>) Utils.deserializeFromFile(permissionFile.getPath());
#

is it not possible to serialize/deserialize an object

#

like a hashmap

#

that holds another arraylist?

#
public static HashMap<String, ArrayList<String>> rankPermissions = new HashMap<String, ArrayList<String>>();
glossy venture
#

where does the error occur

granite owl
#

it serializes just fine

#

ive read the file

#

but when its supposed to deserialize the object

glossy venture
#

weird

granite owl
#

it throws an error

noble lantern
#

Error says your cating hashmap to a string though?

granite owl
glossy venture
#

when are you casting it to a String wtf

granite owl
#

ik it says im casting it to a string

#

but i dont see where

#

thats lit a 3liner so far

noble lantern
#

Gson deserializes and dsrializes though so it should be possible

#

String lists*

hasty prawn
#

It is possible

granite owl
#

the arraylist itself holds strings ya

#

but yet again, im not casting to a string im casting to a hashmap holding those members

noble lantern
#

Has to be the way your storing it

granite owl
#
public static HashMap<String, ArrayList<String>> rankPermissions = new HashMap<String, ArrayList<String>>();

@SuppressWarnings("unchecked")
    public static void loadPermissions()
    {
        File permissionFile = new File(Utils.getOwnDir + "/RankPermissions.bin");
        
        if (permissionFile.exists())
        {
            rankPermissions = (HashMap<String, ArrayList<String>>) Utils.deserializeFromFile(permissionFile.getPath());
        }
    }

public static void savePermissions()
    {
        Utils.serializeToFile(rankPermissions, new File(Utils.getOwnDir + "/RankPermissions.bin").getPath());
    }
``` this is the whole code
#

so far

#

its like nothing

noble lantern
#

Ack im on my phone

#

Hard asf to read on mobile lmao

granite owl
#

ik

noble lantern
#

Whats it look like when stored in a file also whats serializeToFile method look like

granite owl
#

Utils.getOwnDir works fine, it just gets a static reference to the main class and then parses it to its own directory

#

so i can move plugins in different directories and they still find their own directory

#

where theyre supposed to store data

noble lantern
#

Wait ik

#

DeserializeFromfile

#

Does that returns a string itself

#

And not a type of Map

granite owl
#

it returns Object

#

i kept it generic

#

sec

noble lantern
#

Check if its instanceof String

granite owl
#

it already works

#

with a hashmap

#

holding <string, UUID>

noble lantern
#

Oh idd

#

Odd*

granite owl
#

sec

#

this is still more or less from a tutorial which ive alternated to fit my needs

#
public static Object serializeToFile(Object obj, String str)
    {
        try
        {
            ObjectOutputStream s = new ObjectOutputStream(new FileOutputStream(str));
            s.writeObject(obj);
            s.flush();
            s.close();
            
            return 0;
        }
        catch (Exception e)
        {
            return e;
        }       
    }
    
    public static Object deserializeFromFile(String str)
    {
        try
        {
            ObjectInputStream s = new ObjectInputStream(new FileInputStream(str));
            Object ret = s.readObject();
            s.close();
            return ret;
        }
        catch (Exception e)
        {
            return e;
        }
    }
#

and kept a few placeholders where i dont need them like the return value just in case

midnight shore
#

How can i listen for the Enderchest open event?

granite owl
midnight shore
#

ty

tardy delta
noble lantern
#

Hes loading data

#

Oh wait

#

Not there

#

Mb

granite owl
#

did i initialize it incorrectly?

noble lantern
#

That might fix it

#

Worth a try

tardy delta
#

ye but it looks ugly

granite owl
#

tho this works fine too

#
public static HashMap<String, String> defaultMsgs = new HashMap<String, String>();
#

im keeping a bunch of config data in memory yes

noble lantern
#

Maybe you need to serialize the List too

#

Just a thought not sure though

granite owl
#

serialize the list on its own?

tardy delta
#

never worked with serialisation ๐Ÿ‘‰๐Ÿ‘ˆ

granite owl
#

but its very handy

noble lantern
#

I just let gson handle it

#

Ez

granite owl
#

imagine writing pagefiles when ur provider only gives u 4gb ram

tardy delta
#

its just maps and objects :}

granite owl
#

cough

#

i would never do that ofc

hasty prawn
noble lantern
#

We dont talk about gsons stupidites

#

Theyre features

#

Okay?

#

Jackson has that feature too

#

ObjectMapper

granite owl
#

im going to try just for a quick debugging to change the data type of the hashmaps value members

#

doesnt matter since its an empty snipped so far anyway

hasty prawn
#

"ok Gson go save this int"
"ok"
"Can I have that back now Gson?"
"yes but I put a .0 at the end so now it's a double"

granite owl
tardy delta
#

๐Ÿคฃ

granite owl
#

but that shouldnt make a difference

#

because all hashmap, arraylist and string inherit Serializable

#

implement*

noble lantern
#

Though not as serious in Java, still annoying

granite owl
#

ik what the problem might be

#

i keep storing the same corrupted arraylist

#

from before

#

nope

#

still corrupted

#

wtf

#

why wont it load its both strings now

#

even my uuid works

restive tangle
#

How would I go about making a server selector in Bungee? What I think I'll try is make a command in bungee and whenever I click on an item in the server selector inventory I run the command with the name as the argument

tardy delta
#

can someone explain me what bungee actually is?

maiden thicket
tardy delta
#

is it just an api to work with mmultiple servers or what?

maiden thicket
#

player connects to proxy

#

player connects to server thru proxy

tardy delta
#

what is a proxy :kekw:

maiden thicket
#

well the way i think of it its like an extra layer

noble lantern
maiden thicket
tardy delta
#

a layer of networking stuff?

maiden thicket
#

basically?

#

i guess

glossy venture
#

just forwards the packets

maiden thicket
#

that

glossy venture
#

but you can handle them before they reach the actual servers

noble lantern
#

Ts i nice for js ngl I love having explicit types

glossy venture
#

and you can teleport players to other sevrers

maiden thicket
#

but proxy doesnt send game packets and stuff

glossy venture
#

yeah

#

it forwards them

noble lantern
#

And not some wildcard variable that thinks it can be everything

glossy venture
#

it doesnt send any

#

iirc

maiden thicket
#

it'll send the casual handshake and login probably

glossy venture
#

oh yeah

maiden thicket
#

but for game packets thats from the backend

glossy venture
#

yeah

#

it does the authentication

tardy delta
#

oh

granite owl
#

okay ive copied it 1:1 from my working project

#

its still not working

#

so i guess ik where to look at

#

and ive found it im so dumb

#

@noble lantern

#
public static Object deserializeFromFile(String str)
        {
            try
            {
                return (String)DeserializePtr.invoke(UtilsPtr, str);
            }
            catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e)
            {
                e.printStackTrace();
            }
            
            return null;
        }
tardy delta
#

try return kek

granite owl
#

ive already fixed it

#

its working now

#

the problem was that i actually access the method using reflection

#

and my wrapper function was returning a string because ive copied that wrapper from alot functions

#

because i outsource all standard methods i use into another plugin to access them via well reflection

restive tangle
#

Do custom channels we register in BungeeCord act the same as the default BungeeCord channel?

sterile token
#

Im a bit annoyed trying to do this in block place event

  • If claim exists, allowed players to place blocks (if they are inside the users)
  • if claim doesnt exists claim another
hasty prawn
#

whats annoying about doing that

sterile token
#

I have this code but im not secure about it

@EventHandler(priority = EventPriority.HIGHEST)
    public void onPlace(BlockPlaceEvent event) {
        Player player = event.getPlayer();
        Claim claim = this.claims.getClaim(event.getBlock().getLocation());
        if (claim != null) {
            if (claim.getUser(player.getUniqueId()) == null) event.setBuild(false);
        }
        this.claims.create(new Claim(player.getUniqueId(), "test", event.getBlock().getLocation()));
    }
tardy delta
#

are you storing every block of the claim?

#

and after that i asked what a proxy is

sterile token
tardy delta
#

well every location of the blocks of the claim?

sterile token
#

My claims are based on 1 location (the center block)

#

And them virtually im creating 2 corners

tardy delta
#

uh lol

hasty prawn
#

Whether there's one there or not.

sterile token
#

Oh

#

I jsut realized that

#

Im so dumb

tardy delta
#

im thinking that you have a weirdly designed claim class

sterile token
#

I explain, the claims have 1 location, and them i convert that location into a cuboid (to generate 2 virtually corners)

tardy delta
#

what if players place a block on a location that is not the middle of a claim, will that allow them to place or not?

hasty prawn
#

Yeah that's a fine way of doing it.

tardy delta
#

wait its correct

#

thought you were using claims::contains

hasty prawn
#

oh god

granite owl
sterile token
#

No i will send full code

#

So you can understand it better

granite owl
#

also for networking

tardy delta
#

the hell is event.setBuild(false) tho

#

since when is that method there

#

ye

#

i was thinking that

#

ah lol there's actually a method setBuild

undone axleBOT
tardy delta
#

screenshots on linux go brr

#

nah just shareX and press ctrl + printscreen

#

and it automatically copies the screen to your clipboard

#

๐Ÿค”

#

sharex is only windows

#

:(

#

screen capturing thing

#

its easier than pressing a few buttons

hasty prawn
#

I only use ShareX if I want to make a gif

tardy delta
#

i always used it

#

its just easy

opal juniper
#

best decision ever

tardy delta
#

lol

#

i could technically do that too

sterile token
#

Dessie and Fourteen this how looks now:

@EventHandler(priority = EventPriority.HIGHEST)
public void onPlace(BlockPlaceEvent event) {
  Player player = event.getPlayer();
  if (!event.getBlockPlaced().getType().equals(Material.BEACON)) return;
  Claim claim = claims.getClaim(event.getBlockPlaced().getLocation());
  if (claim == null) claims.create(new Claim(player.getUniqueId(), "test",      event.getBlockPlaced().getLocation()));       
}
tardy delta
#

i got a button which is basically ctrl now

lilac dagger
#

why not use the window's snipping tool and just press prt scr

tardy delta
sterile token
#

I seen and still wrong the code

sterile token
#

That why im so messier lmao

#

Because i need to:

  • Create claims when a claim doesnt exists on the location and if block placed is beacon
  • If claim exists, allow to place blocks (the owner) and his team users
tardy delta
#

is there a map with the claims?

#

i would do java Location loc = event.getBlockPlaced().getLocation(); Claim claim = claimsMap.computeIfAbsent(loc, () -> new Claim(player.getUUID(), "test", loc));

#

or well instead of new claim just claims.create

#

returns a claim too i guess

#

claims.create(new Claim()) wha-

tardy delta
#

heh?

grim ice
#

u cant have duped keys in a map

#

and even if u can u shouldnt do that

#

ur gonna have a few ten thousands of entries for each claim

tardy delta
#

i know that, computeIfAbsent just creates a new claim or returns the claim if it exists in the map

grim ice
#

bro

sterile token
#

Also my claim its nto a map

#

Its just a Set<Claim>

grim ice
#

u shouldnt use that type of map

#

anyways

#

ur map will look like this according to ya

#

HashMap<Location, Claim>

#

which sucks ass

sterile token
#

Hex

#

That why im using a Set<Claim>

grim ice
#

Exactly

sterile token
#

So im messed in the event

tardy delta
#

then tell me that >_<

grim ice
#

having an entry for each block in the claim

#

is absolutely garbage

sterile token
#

Hex

#

Can i explain?

grim ice
#

sure

tardy delta
#

when im done with rust i'll make a claims plugin too

grim ice
#

there are many

tardy delta
#

and a home plugin.. smh soo much more to do

grim ice
#

no one will ever make something better than the existing one

#

I wouldnt bother

#

and even if you do

#

no one will use it

tardy delta
#

i dont care about making it better i just want to try to make one

grim ice
#

oh ok

sterile token
#

My claim store (owner, name, location, team users)
For checking the blocks inside the claim i use a cuboid class

#

So i store a single location of the claim (the centered block)

#

Because its a block protection plugin, so the claims should be created base on a center block and protect all blocks around in a radius

tardy delta
#

mwe

fleet pier
#

How do i get the port of the spigot minecraft server?

#

I know how to get the ip address but there is no get port method

#

๐Ÿค”

tardy delta
#

getServer().getPort() i guess

sterile token
fleet pier
#

bruh

tardy delta
#

it is there :)

sterile token
#

And maybe try using a good IDE or use github copilot

fleet pier
#

i was trying to work with

MinecraftServer minecraftServer = MinecraftServer.getServer();
sterile token
#

No that no the spigot api

tardy delta
#

dont work with the implementation lol

#

the impl isnt probably aware of the port

sterile token
#

Fourteen

#

S owhat do you u recomemnd?

grim ice
#

of what though

tardy delta
#

uhh about what

sterile token
tardy delta
#

lemme write something rq while u try to explain

sterile token
#

I already explained

grim ice
sterile token
#

Why?

#

Do you know a better way?

grim ice
#

where da abstraction sir

#

yes

sterile token
#

Oh u can help me a bit?

grim ice
#

and not all cuboids work with radiuses

#

yes

#

make a Cuboid interface

sterile token
#

Allr

#

Done

grim ice
#

make your class atm called RadiusBasedCuboid

#

or RadiusCuboid if u want

sterile token
#

ok

tardy delta
#

are you on java16+?

grim ice
#

then make it implement the Cuboid class

#

with the methods that are for a cuboid

#

like

#

contain() etc

#

any method related to radiuus shouldnt be in cuboid interface

#

and override them in radius implementation of Cuboid

#

and later if you want to

#

u can just implement Cuboid

#

to make a

#

SimpleCuboid or smth

#

which accepts 2 locations

sterile token
#

Hex, So cuboid interface should contains methods:

void expand(T location)

boolean contains(T location)

T getPos1()

T getPos2()

tardy delta
#

verano do you have access to records?

#

so java 16 or smth

sterile token
#

No sorry

tardy delta
#

np

sterile token
#

Im trying to do cuboid multi version

#

So be able to use it from 1.8 to 1.18x

#

If not i would be using BoundingBox

#

๐Ÿ˜ฎโ€๐Ÿ’จ

grim ice
#

you wanna make it generic?

#

I mean that makes sense

#

since not all cuboids are bukkit location cuboid

granite owl
#

short question cause i cant test it rn, if i do String.replace("{break}", '\0'); will this cut the rest of the string off as it would in C?

grim ice
#

cut the string off?

granite owl
#

using a null terminator character

rancid snow
#

that happens because c has null terminated strings

#

java doesnt

sterile token
#

Hex i make the interface generic, because you can have location cuboid or vector cuboid

granite owl
sterile token
#

But the difficult thing for me its the math lmao

#

Because based on 1 location i should calculate 2 corners

sterile token
#

Hex can i letter dm u?

grim ice
#

String.replace is not static

grim ice
#

do it here

sterile token
#

Allr

#

But dont yo u get mad i tag so you dont orget the message?

#

Because if you dont tag then you lost messages

#

I had many times losted my questions

#

Because this chat its so active

grim ice
#

its fine

grim ice
#

i failed in math cant help u with tha

#

LOL

sterile token
#

Yah dont worry the cuboid class i had was working great

glossy venture
#

also always get the -X -Y -Z corner and X Y Z corner

sterile token
#

So i just need to do it inside RadiusCuboid

sterile token
# glossy venture also always get the -X -Y -Z corner and X Y Z corner
private double x1, y1, z1;
    private double x2, y2, z2;

    public Cuboid(Location location, Double radius) {
        this.x1 = location.getBlockX();
        this.x2 = location.getBlockX();
        this.y1 = location.getBlockY();
        this.y2 = location.getBlockY();
        this.z1 = location.getBlockZ();
        this.z2 = location.getBlockZ();
        this.inflate(radius);
    }

    void inflate(double x, double y, double z) {
        if (x != 0) { x1 -= x / 2; x2 += x / 2; }
        if (y != 0) { y1 -= y / 2; y2 += y / 2; }
        if (z != 0) { z1 -= z / 2; z2 += z / 2; }
    }

    boolean contains(double x, double y, double z) {
        boolean xCheck = x >= x1 && x <= x2;
        boolean yCheck = y >= y1 && y <= y2;
        boolean zCheck = z >= z1 && z <= z2;
        return xCheck && yCheck && zCheck;
    }

    public void inflate(double radius) {
        this.inflate(radius, radius, radius);
    }

    public boolean contains(Location location) { return this.contains(location.getBlockX(), location.getBlockY(), location.getBlockZ()); }
glossy venture
#

so do like some Math.max and Math.min shit

sterile token
#

That work really wells

glossy venture
#

yeah but if the second corner is at -X -Y -Z it wont

#

so make sure the first is always - and 2nd always +

sterile token
#

Oh

#

So how i can do it?

#

can u do the math part if it doesnt fuck to you?

grim ice
#

hes saying

#

it should always be

#

0,0,0;1,1,1

#

OR

#

always

#

1,1,1;0,0,0

#

so you know for a fact the bigger position

sterile token
#

Hmn im dumb with math

#

๐Ÿ˜ก

glossy venture
#

well with the radius it works

#

always

grim ice
#

@granite owl

    System.out.println("{break}".replace("{break}", String.valueOf('\0')));
#

this will return nothing

glossy venture
#

but if you need two arbitrary corners it might be useful to force them to be correct

grim ice
#

just a line break

sterile token
#

And it most diff because its a 3d, so i dont just have an x and z i also have Y that i dont know how it works

#

I will have to read about x, y, z

tardy delta
#

whats now the problem in fact?

grim ice
#

it sounds easy

#

to get it from radius

#

just get paint

#

and draw

tardy delta
#

dunno why i was writing this but ye

sterile token
lost matrix
tardy delta
#

nah i decided to write smth for verano

echo basalt
tardy delta
#

i forgot whats the problem actually lol

lost matrix
#

@sterile token Just use Spigots BoundingBox

sterile token
#

If not i would already be using it

tardy delta
sterile token
#

Which is the math to calculate 2 (3d) corner based on 1 centered location and a radius

lost matrix
#

Then copy paste the class from spigot.

echo basalt
#

center.add(radius, radius, radius)
center.subtract(radius, radius, radius)

tardy delta
#

i just pasted it

#

basically

sterile token
#

I never had geometry its my first year of computer science im just 15y im a child lmao

tardy delta
#

wait what circles in mc ๐Ÿค”

lost matrix
#

Or you could just literally copy paste BoundingBox from spigot because it will work in all versions.

echo basalt
#

ehh still

sterile token
#

That why im so dumb

tardy delta
#

i just like to draw stuff down when i need to do maths

#

especially geometry

echo basalt
#

your age shouldn't really matter for these basic things

sterile token
#

Minecraft terrain:

= claim block

$1 = corner 1
$2 = corner 2

--$1----------------

--------#---------
--------------$2----

tardy delta
#

and what are you trying to calculate?

glossy venture
#

verano

sterile token
glossy venture
#

i wrote some simple class

sterile token
#

Oh oik

#

Really thanks people

#

I will check all your suggestions and accept then

#

That why i love this community

tardy delta
#

is that contains method properly working? because you have to check if the provided x and y are between the x and y of the obj

sterile token
#

Because other people will say me "Verano, dont fuck with cuboid and use WorldEdit"

sterile token
glossy venture
#

when

#

it does calculations to ensure the first corner is always the smallest and the second the largest

tardy delta
#

isnt this supposed to do it

#

ah the first is the smallest

glossy venture
#

yeah

tardy delta
#

lol

glossy venture
#

that would work too

#

doin git in the checks

tardy delta
#

im still wondering what hes doing

#

anyways is Object#clone returning an object with the exact same fields and stuff as the original or do you need to set them yourself?

echo basalt
#

it does return with the same fields

tardy delta
#

i was underestimating the C impl lmao

lost matrix
tardy delta
#

hmm

#

i came accross the term "shallow copy" and i forgot what it means lol

civic mica
#

Hello, I have a question does anyone have an image plugin for 1.16.5?

lost matrix
granite owl
tardy delta
#

but it basically does the same as a shallow copy

lost matrix
sterile token
#

So which final code i have to use people

sterile token
tardy delta
#

what was the issue actually?

sterile token
#

I dont know which code to choose

tardy delta
#

and what does that code do

#

lol i forgot

sterile token
#

Oh btw

#

Oh im so messed

pine elbow
#

hey does anyone know how to get the map color of a block? I Found the MapPalette class but I have no clue how to get one, and it looks deprecated. Is there a API way to get this data?

tardy delta
#

dutch lol

#

not you

#

๐ŸŒ

mighty pier
#
                    if (item == null || item.getType() == Material.AIR) continue;
                    player.getWorld().dropItemNaturally(player.getLocation(), item);
                }``` it doesnt drop the items
tardy delta
#

is there something in the inventory?

mighty pier
#

yes

pine elbow
tardy delta
#

still dutch

pine elbow
#

ye

tardy delta
mighty pier
#

EntityDamageByEntityListener, no errors

#

the code around it works

#

yes

#

yes

undone axleBOT
mighty pier
#

cuz

#

i want to do the title thing

#

and player.respawn buggy

#

yes but

#

i want the player to respawn instantly

#

and player.respawn buggy

tardy delta
#

sysout the contents

#

before and after

#

and use early returns smh

#

do people even know that those exist

#

same with && thing

mighty pier
tardy delta
#

prints the contents to a place

#

to see if its empty or not

#

ah lol didnt see that

mighty pier
#

omg

#

right

sterile token
#

I so confused

#

Because i need to calculate 2 corners knowing the center location and a radius

mighty pier
#

also how do i clear armor contents?

#

8 i think

tardy delta
mighty pier
#

1.8

sterile token
mighty pier
smoky oak
#

if i schedule two things, at different times (1 tick delay more), no matter how long the first one takes, will it finish before the second or does it run async?

mighty pier
#

ok

#

ty

viral temple
#

I just realised, this is the wrong channel

#

my bad

tardy delta
# sterile token he?

you are talking the whole time about corners and radius but i dont know what the actual problem is

sterile token
tardy delta
#

all of them?

sullen fox
#

hi

tardy delta
#

that includes checking the chunks around

#

hello

sullen fox
#

is there any package/api i can use to get player list?

#

like the whole list

#

of players

#

not just number

#

no no

#

im coding a dc bot

#

its javascript

#

true

#

well

#

ty

#

bye

#

wdym

tardy delta
#

what players? from the discord or the mc server?

sullen fox
tardy delta
#

im confused

sullen fox
#

I want to fetch the list of the players in the mc server

tardy delta
#

whats wrong with Bukkit.getOnlinePlayers then?

sullen fox
#

Bro

#

I'm coding a javascript discord bot

#

yes

tardy delta
#

there is no way to interact with the server via javascript

normal isle
#

can someone help me compile something?

tardy delta
#

unless theres native support iirc ๐Ÿ‘‰๐Ÿ‘ˆ

normal isle
#

no

#

its a free one

sterile token
#

Oh lmao

normal isle
#

furniture engine

normal isle
#

i have no idea how to compile it

sullen fox
#

well

tardy delta
#

is it from github?

sterile token
#

im So messed up i will finally search on google how to calculate 2 corners knowing from a centered location

normal isle
#

you know how to?