#help-development

1 messages · Page 816 of 1

wet breach
#

the user that executes said query needs to have perms to be able to create DB's

#

same way you do it from a terminal

#

the commands are not different just because its a query

#

you can use sql scripts btw too

#

that has basically all the queries to create your DB the way you want

#

if it doesn't already exist

#

this is actually the recommended method instead of a bunch of hardcoded queries 😛

winter galleon
#
    public void onArmorStandInteract(PlayerInteractAtEntityEvent event) {
        Player p = (Player) event.getPlayer();
        ItemStack macchinetta = new ItemStack(Material.PURPUR_BLOCK);
        ItemMeta itemMeta = macchinetta.getItemMeta();
        itemMeta.setCustomModelData(16);
        macchinetta.setItemMeta(itemMeta);
        if (p.hasPermission("eternitystaff")) {
            if (event.getRightClicked().getType() == EntityType.ARMOR_STAND) {
                ArmorStand armorStand = (ArmorStand) event.getRightClicked();
                if (armorStand.getEquipment().getHelmet().equals(macchinetta)){
                    p.sendMessage("Its Working");}
                else{
                    p.sendMessage("Its not working");

                }
            }
        }
    }```
why its not working
prime reef
#

at no point is the armor stand's helmet set to this item

young knoll
#

.equals should work as long as the items are identical

#

.isSimilar is the same but ignores stack size

#

Neither ignore durability tho

remote swallow
#

and whose fault is that

echo basalt
inner mulch
#

would there be any difference between broadcasting a message, or sending it to each player in a for loop ?

young knoll
#

broadcast also goes to console

echo basalt
#

Habit 1 - Guard clauses might be applicable here

inner mulch
hazy parrot
#

no

grim hound
wet breach
#

weird to think a message would cause such things

upbeat hornet
#

How can I ensure my plugin will only start the onEnable() method after another plugin has been 100% initialized?

young knoll
#

depend: [OtherPlugin] in plugin.yml

upbeat hornet
#

have done that

#

but my plugin still starts slightly before the other plugin is done executing onenable

inner mulch
upbeat hornet
#

Other plugin onEnable:
At the very end: important method 1

My plugin onEnable:
At the very begining: important method 2 depending on important method 1

upper hazel
#

1270 ms for find rtp location it's a lot?

upbeat hornet
young knoll
#

Is that the correct name?

wet breach
#

I also recommend learning about chat channels and conversation api as well if you want to make a more decent chat system

upbeat hornet
proud badge
#

how do I parse Entity to ArmorStand?

chrome beacon
#

Just instanceof and cast?

proud badge
#

Ok

eternal oxide
#

So long as you are not using NMS

upper hazel
#

There is code for finding locations, but the thing is that it usually takes more than a second, and I have seen where it takes a maximum of 366 milliseconds. Any optimization ideas? https://paste.md-5.net/eluvozekul.cs

eternal oxide
#

it would be faster to loop all blocks in the region that are in your blockList then add their Location to a Collection and pick a random one

#

the performance of randomly picking a location until it matches one of your types could take forever

#

or at least until time runs out

young knoll
#

Generally the issue is loading chunks

#

Also you can speed up the height check by using getHighestBlockAt

grim hound
#

Just generate a random loc

#

Get the highest block

#

Add 1 to y

eternal oxide
#

loading chunks could cause bad performance but his issue is line 6

grim hound
#

And teleport

grim hound
eternal oxide
#

he's literally picking a location at random every time

glossy venture
grim hound
#

Also you can search async if you use a heavy method

#

And have it fire a synced teleport at completion

glossy venture
#

also possibly pass the chunk to getSolidLocation and use local block coordinates so it doesnt have to find the chunk for the location every time but that prob wont matter much

remote swallow
#

what would be the better way to have a leaderboard setup, do i have my 1 map for stored data unsorted then another map that stores leaderboard pos plus uuid or do i sort it when the leaderboard is needed

glossy venture
glossy venture
#

u could do this by selecting a couple random chunks, taking snapshots and asynchronously checking those for locations

#

or use nms

sullen marlin
#

Use a tree map 🙂

remote swallow
#

could be queried every 5 seconds by papi or could be a 40 minute difference between query from command

grim hound
#

Even have the whole process be async

remote swallow
glossy venture
sullen marlin
#

Ye custom comparator

#

Although need to reinsert to update so use immutable value

remote swallow
#

something like this?

young knoll
#

You also cannot load chunks async

glossy venture
#

yeah so maybe just take chunk snapshots on the main thread and do the searching on another thread

sullen marlin
remote swallow
#

would it be better with a hashmap and a treemap

glossy venture
remote swallow
#

nah

#

configurable amount of leaderboard positions and as they join

glossy venture
#

wouldnt it only put loaded players on the leaderboard

remote swallow
#

i mean you would expect a leaderboard to include offline people right

glossy venture
#

yeah

young knoll
#

I just do my leaderboard queries when requested

#

Course that doesn’t work with papi

remote swallow
#

well i dont want to query something from db with papi

young knoll
#

Papi completable future support when?

remote swallow
#

kekw

glossy venture
#

why do u need papi

remote swallow
#

so people could show the leaderboard position on a scoreboard or a hologram or whatever

grim dock
#

I am trying to detect a Right Click Interaction with a specific item using the held item's displayName to get an object from a HashMap. This works for every item with a normal ColorCode like §a but if displayName has an RGB color and is generated with textComponent.toLegacyText(), the saved name does not match the name from the Interaction Event. Why is that?

glossy venture
#

u makign a library or like public plugin?

remote swallow
#

public plugin

wet breach
#

kind of, except you can reference a sql file

glossy venture
wet breach
#

also the exception you should be catching is SQLException

#

and not just generic exceptions lol

glossy venture
#

i need to add bulk queries and indexes to my datastore framework bc i just realized how little it can do

remote swallow
#

im sensing jankness emerging

lost matrix
#

?pdc

glossy venture
lost matrix
#

ugh

wet breach
#

says access denied

remote swallow
#

7smiles been here 30 seconds and his head hurts

grim dock
wet breach
#

your credentials are either wrong, or the user in question doesn't have the perms required

#

seeing as you are using the user test I am going to assume the user doesn't exist

glossy venture
young knoll
#

@Inject some memes

lost matrix
glossy venture
lost matrix
#

You animal

glossy venture
#

i wrote regex just to show u exposed collections

lost matrix
#

Yeah, ill never get people sabotaging their data integrity like that...
Might as well make your fields public.

glossy venture
#

i did

#

nah but this is a private project and im lazy so idc

wet breach
#

you need to log into the DB server as root and create the appropriate user

#

I recommend creating 2 users one with localhost and the other with 127.0.0.1

#

so it doesn't matter which you use

#

or just create 1 user that is allowed access from both domains

#

either or doesn't matter a whole lot

glossy venture
wet breach
#

no

glossy venture
#

oh tf

wet breach
#

localhost is the hostname

#

127.0.0.1 is the ip

glossy venture
#

ah

#

but the os will resolve localhost to 127.0.0.1 right

#

probably even earlir

#

than the os

wet breach
#

some OS's don't have localhost mapped to 127.0.0.1 and thus can fail

glossy venture
#

interesting

#

i assumed it would be hardcoded in earlier, like maybe in java but ig not

wet breach
#

but mysql doesn't treat hostnames like localhost the same as 127.0.0.1 either even if localhost is mapped appropriately

glossy venture
#

weird

lost matrix
wet breach
#

I think ubuntu was one of them, they could have since fixed it and was probably just a bug in their stuff

#

I haven't used any recent versions of ubuntu to see if its still there, but its not like it bothered me either

#

I just learned to not rely on localhost meaning loopback address

#

localhost could be the local ip instead of loopback

#

there is no standard that says localhost has to map to loopback lol

upper hazel
wet breach
#

some methods in the api can be used async

glossy venture
#

so if u select like 3 random chunks

#

and make snapshots of them

#

then search for a location in those asynchronously

#

and then once found do Bukkit.getScheduler().runTask(plugin, () -> player.teleport(location))

#

that would work in theory, unless those chunks are like all ocean

#

in which case maybe dispatch the process again which sucks but at least it doesnt lag the server

glossy venture
wet breach
#

not sure if you could do it via query, but if you can you need to use a user that can create users and modify them and then you have to flush the privileges

#

typically the root user is all that exists to do this

#

I don't recommend using the root user though, generally your DB server should already be setup with the appropriate users and permissions before usage

glossy venture
#
final Random random = new Random();

public void findRandomLocationAsyncThenRun(World world, int range, Consumer<Location> consumer) {
  final int CHUNKS = 3;
  int rangeInChunks = range / 16;

  List<ChunkShapshot> chunks = Stream.generate(() ->  world.getChunkAt(random.nextInt(rangeInChunks), random.nextInt(rangeInChunks), /* generate */ true))
      .limit(CHUNKS)
      .map(Chunk::getChunkSnapshot)
      .toList();

  Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
    Location loc = null;
    // find location using the chunks list

    if (loc == null) {
      // restart process with different chunks
      Bukkit.getScheduler().runTask(plugin, () -> findRandomLocationAsyncThenRun(world, range, consumer));
    } else {
      Bukkit.getScheduler().runTask(plugin, () -> consumer.accept(loc));
    }
  });
}

void someMethod() {
  findRandomLocationAsyncThenRun(world, 6400, loc -> player.teleport(loc));
}
grim hound
#

Not all

#

But many can

glossy venture
#

shit like sendMessage is just packets

#

im not sure if thats async doable tho

#

i dont see a reason why it wouldnt be tho

grim hound
young knoll
#

It is

inner mulch
#

Is there a workaround to create a static method which uses generics?

slender elbow
#

huh

inner mulch
#

i know it sounds crazy

#

but i somehow need it

young knoll
#

Static methods can use generics

inner mulch
#

oh wait generic classes

young knoll
#

They just can’t use the generic types specified for the class since they aren’t a part of the class instance

inner mulch
#

yeah :/

river oracle
#

you need some form of static constructor or what

inner mulch
#

im following this tutorial

#

i want the get method to be static

slender elbow
#

n oyou don't

hazy parrot
#

why would any of those methods be static

inner mulch
#

how should i use the data in another plugin?

#

if i cant acces the get map

hazy parrot
#

you can sure access map even if it isn't static

inner mulch
#

but not the same filled one?

river oracle
#

use Dependency Injection or in your case you can easily just do
MainClassWhatever.getDataHandler()

inner mulch
#

its a different object

hazy parrot
#

get your api -> get data manager

inner mulch
#

?

wet breach
#

?di

undone axleBOT
inner mulch
#

okay, but isnt dependency injection not clean?

wet breach
#

not sure what you mean about not clean

inner mulch
#

injecting it into every class that needs it doesnt sound fun to me

wet breach
#

you don't necessarily need to inject the main plugin instance into the class, but all classes are just objects

#

you either create the object and hold it somewhere for it to be accessed or you create a new one

#

you should avoid static if it doesn't need to be static. Anything static can not be GC'ed and stays in memory

#

one of the caveats of statics

inner mulch
#

whats GC'ed?

#

but isnt letting something stay in memory the thing i want, when trying to load the database data into memory?

wet breach
#

database data is independent of the objects

#

Your data depending how its structured could be multiple objects and those objects held in memory

#

when that data isn't needed which also means the object you will want it to go away

#

not persist

#

your connection manager for the database could be static since this object wouldn't be ideal in going away and you don't necessarily want more then one thing controlling your connections

inner mulch
#

but static isnt a problem when im unloading the player from the static map once its not needed?

wet breach
#

it can be because static persisting in memory isn't the only thing that may be bad

#

it also prevents there being multiple instances

inner mulch
#

i dont want there to be multiple if the data is the same?

wet breach
#

ok, but static isn't dyanmic though

inner mulch
#

money or something shouldnt be different per player per object

minor junco
# inner mulch whats GC'ed?

Garbage collected, it's a memory process from the java virtual machine that erases phantom/loose objects whose references aren't used anymore

wet breach
#

its an all or nothing thing

#

when it comes to static

inner mulch
minor junco
#

I'd recommend googling Garbage Collector theory and studying more, a really interesting topic

#

Also very helpful when you start working with lower level languages such as C

minor junco
#

Indeed

wet breach
#

it could be its own class in my opinion XD

minor junco
#

That will superficially cover GC

wet breach
#

I recommend not using static until you learn more about it

#

so that it doesn't interfere with your stuff in ways you are not expecting

#

you actually don't need static to make the majority of anything, its just a handy utility to help improve stuff

minor junco
#

@wet breach Wheres his code? I cannot follow the thread you lads have

wet breach
#

they wanted their get method to be static so that they can access it from other classes

#

and basically everyone so far said for it to not be static, and then I sent the link for di and that it doesn't just apply for the plugin main instance 😛

#

and then you appeared in the convo above

#

XD

minor junco
#

Oh okay

wet breach
#

but everyone is correct that it shouldn't be static

minor junco
#

I mean just make an attribute in your plugin object where the data manager is initialized and access the main manager through your plugin singleton no?

inner mulch
#

frostalf i know static should be use carefully but in my opinion this data should be singleton because why would there be 2 instances of money data or something

wet breach
#

the thing about singleton is that it makes the object only have a single instance. You can have multiple money objects/data per player

#

making a class a singleton wouldn't help as it would mean all the player objects would have the same data for money

inner mulch
#

no thats not ture

minor junco
#

I mean it's more like if you assign a data manager to a plugin instance, whereas there's a possibility in which a plugin instancr is initialized more than once (which it is for spigot's case code wise, since there can be another allocation), I'd use a class local variable

inner mulch
#

every player has a object in my design assigned to them, i want this hashmap to be static

wet breach
# inner mulch no thats not ture

you are correct it isn't entirely true but unless you have some method in the singleton that can obtain data dynamically then the data the singleton holds is the same for anything accessing it across the board

inner mulch
#

i dont really understand, but im sure that every player has its own data in the hashmap

remote swallow
#

if the player data manager is the singleton the data can be seperate per user

minor junco
#

You should differentiate between the ideologies behind what you're trying to solve. If your goal is to make a decorator of a hashmap to store custom data, you should focus on modularity. By making it static, you ensure there only is one decorator and this enforces logic and a specific pattern for users of that map

#

Which in turn is not modular

#

And not disconnected from it's usage

inner mulch
#

yeah i want it static but it doesnt work because the class is generic

#

:(

minor junco
#

Singleton it is then mate

#

But again, no need

#

Makes not a lot of sense

wet breach
#

in my opinion I would go with a player manager singleton with a wrapper around the player object for custom data

#

in this manner, you only need to have the player object to access your data

#

with a centralized place it is held

minor junco
#

Or use the player's uuid (preferred)

wet breach
#

if you want, depends how it is all setup really

#

reason we generally recommend using uuid or avoiding the player object is because many forget to ensure they are removing the objects when players leave

#

or otherwise known as doing cleanup

minor junco
#

and remove the player on leave to ensure

wet breach
#

if you want, its not an inherent need

minor junco
#

it should be tho, so the JVM actually enqueues the player instances. It is also recommended by the spigot authors since the underlying entity object can become invalid

#

or again, use the simpler variant: UUID's

wet breach
#

the advantage weakmap would provide over not using it, is ensuring gc happens on it faster

minor junco
#

allows you to also have data when players become invalid

wet breach
#

if you just use the player object, it still gets gc'ed if nothing is referencing it

minor junco
#

unless the player is a specific type of reference

#

such as WeakReference, or SoftReference if you want to allow JVM to enqueue the referee on memory demand

wet breach
#

yes if you don't remove it from a map, which is basically what I am saying in terms of clean up it won't get gc'ed

minor junco
#

ah yes

wet breach
#

yes everything you said is true in terms of recommendation but its just because we get a lot of people that don't know the proper things so the recommendations just helps them in the long run from running into some weird errors 😛

#

well weird errors for them anyways

minor junco
ivory sleet
#

yeah id also advice using singleton

#

if static at all that is

minor junco
#

@wet breach all good I am just trying to be as accurrate as possible to give the best advices to people, so if they don't understand something they can google it and learn even more (at least that's what helped me a decade ago when i started programming lol)

ivory sleet
#

I think its fair to give ppl options and sometimes let them experience the pros and cons for the different options you may give them

minor junco
#

yeah true

ivory sleet
#

as opposed to telling them in advance ^^

minor junco
#

i mean afterall we need to make the mistakes to actually learn from them, being told not to do them won't have much of an affect when you're a beginner

ivory sleet
#

yeah, definitely

minor junco
#

but id argue its different for advanced people yk

#

but its always hard to measure how much a person have had experiences in the field with only a couple messages

ivory sleet
#

fair

minor junco
#

like when im trying to help here im starting off thinking that the people involved are advanced, since i think thats the median (maybe im wrong)

#

havent been in this forum for too long

ivory sleet
#

oh it vastly differs,

minor junco
#

i guess yh

wet breach
#

gc will remove nulled out objects faster then if they are not

#

also, another trick to that is you can kind of force a gc to happen if you null out many objects quickly too lol

minor junco
#

yeah

#

but don't overdo it the compiler and JVM have become really smart

wet breach
#

typically you will want to try to re-use objects though to stick with OOP

minor junco
#

but its an optimization for complex code yh

wet breach
#

long time ago you were taught to null out objects you were done with, but I don't think they teach that anymore

#

except for languages like C or CPP

#

where it is a necessity

ivory sleet
#

jvm flags also huge part of optimization

#

esp the gc ones

#

:>

wet breach
#

yes I agree

#

all those flags are meant to be used

#

the JVM is good for a general standpoint

#

but you should utilize them as each program is actually different and it helps the JVM out instead of guessing

hazy parrot
#

how is it important for c or cpp, never heard about it 🤔

wet breach
#

because C and CPP don't have GC so you have to do your own memory cleanup

#

the only way you can remove an object in those programs is to null them out

hazy parrot
#

isn't every object cleared when it goes out of scope, as there is no gc

wet breach
#

there is no gc at all

#

its left to the programmer to handle all the memory cleanup

hazy parrot
#

aside from dynamicly allocated objects

hazy parrot
wet breach
#

no, it stays until something tells it to go away, which is why memory leaks are more common to happen in C or CPP then other languages

#

because typically somewhere someone forgot to null out an object

#

so it just got left behind lol

hazy parrot
#

i wouldn't say so, memory leaks are due to bad use of dynamic allocation

ivory sleet
#

rust 🦀

#

;:D

hazy parrot
#
std::string &foo() {
  std::string bar();
  return bar;
}
#

this will not work

#

as bar doesn't exist when out of scope

wet breach
#

even in Java you could technically go out of scope of the memory that GC handles commonly. Anything done using native methods for example GC doesn't handle, but most of this happens with JNI related things or if you use unsafe and manually make buffers in memory.

#

and the exception to either of these two is memory mapping files

minor junco
# hazy parrot isn't every object cleared when it goes out of scope, as there is no gc

you have to differentiate where the objects are allocated. Heap or stack? It plays an important role since a so-called stack frame is allocated for each block / method invocation. The stack pointer tells you where the current last object and next object will be allocated. Objects saved on the heap go through the OS, thus the heap is way slower (!) than stack allocation (also cache misses come into play but thats a different topic). For C/C++ the developers have the responsibility to free memory for heap objects. There are so-called smart pointers which have a reference count and free heap allocated objects automatically when they go out of scope.

#

so to actually answer your question: objects allocated on stack are automatically cleared; heap allocated objects not.

hazy parrot
hazy parrot
minor junco
#

(... didnt see that ...)

wet breach
#

well aparx provided a more thorough answer for those that don't understand

#

nice job 🙂

minor junco
#

no worries gotcha

#

haha

hazy parrot
#

that is exactly what i said, no need to nullify objects on stack, just free ones from heap

minor junco
#

I think we were talking about Java, no?

wet breach
#

well to free them you null them out unless this has changed

minor junco
#

in Java every object (actually: non primitive) is allocated on the heap

hazy parrot
#

nah we started talk about cpp

minor junco
#

ah okay

ivory sleet
minor junco
#

exactly

#

it's a lot of overhead, but the JVM GC is probably the best out there

ivory sleet
#

gen zgc is extremely op

minor junco
#

there was a language (forgot the name) that claimed to have like crazy stats on GCing

ivory sleet
#

haskell maybe

minor junco
#

turned out it was all sketchy and untrue

#

nah dont remember

ivory sleet
#

oh idk

#

well haskells gc is also interesting

minor junco
minor junco
wet breach
minor junco
#

yeah didnt know it was possible for a language to falsely advertise important design choices

ivory sleet
#
Haskell's computation model is very different from that of conventional mutable languages. Data immutability forces us to produce a lot of temporary data but it also helps to collect this garbage rapidly. The trick is that immutable data NEVER points to younger values. Indeed, younger values don't yet exist at the time when an old value is created, so it cannot be pointed to from scratch. And since values are never modified, neither can it be pointed to later. This is the key property of immutable data.

This greatly simplifies garbage collection (GC). At anytime we can scan the last values created and free those that are not pointed to from the same set (of course, real roots of live values hierarchy are live in the stack). It is how things work: by default, GHC uses generational GC. New data are allocated in 512kb "nursery". Once it's exhausted, "minor GC" occurs - it scans the nursery and frees unused values. Or, to be exact, it copies live values to the main memory area. The fewer values that survive - the less work to do. If you have, for example, a recursive algorithm that quickly filled the nursery with generations of its induction variables - only the last generation of the variables will survive and be copied to main memory, the rest will be not even touched! So it has a counter-intuitive behavior: the larger percent of your values are garbage - the faster it works. 

wiki.haskell.org

minor junco
#

Data immutability
nice!!

#

i hate mutability

ivory sleet
#

well I think of them as mutually exclusive tools/ideas rather

minor junco
#

its an oop concept (I think, correct me if im wrong) and its making me mad sometimes

ivory sleet
#

dont really have strict hate nor love towards one or the other

#

I mean sometimes mutability is just needed depending on language and other functional requirements by the means of optimizing a design or perhaps speed

minor junco
#

yeah

#

i mean always allocating new objects to "mutate" a single attribute is really costly and unnecessary. It comes down to the paradigm you use

ivory sleet
#

yeah

minor junco
#

I think structs as in cpp is a great thing

#

whereas you have restrictions but can group closely related attributes

#

but working with a language like Java that enforces you to use OOP is just... yeah...

ivory sleet
#

yeah, procedural programming is something many prefer to traditional object oriented programming

minor junco
#

I love Java for it's adversity but yh idk

wet breach
minor junco
#

I mean you see Java adapting it more and more

ivory sleet
#

but java has sort of (like many other langs) gone over to a more modern approach

minor junco
#

especially with Java 8

#

with streams

wet breach
#

many people will probably hate you for it

#

XD

ivory sleet
#

esp since java also allows for easier use of the data oriented programming style nowadays

#

and the functional bit also :^)

minor junco
#

okay but now we talk javascript lmfao

#

if we talk about data objects

#

lets talk about JSON

#

xD

#

the simplicity is crazy

wet breach
#

json is so overrated

minor junco
#

but comes at a cost

ivory sleet
#

bson

#

:D

wet breach
#

the only thing I hate about json is the fact that it can have infinite arrays of arrays

ivory sleet
minor junco
#

i mean there are a lot things wrong with JSON

#

no questions asked

wet breach
#

which is weird and there isn't really a way to know when you reach the end of a multi-dimensional array except just looping until you encounter no more arrays

ivory sleet
#

i mean java has made major steps towards letting devs step in that direction of paradigm

minor junco
#

yh i mean the new JDK versions are all great imo

#

from java 8 onwards they made good changes

#

slow, but qualitative changes

ivory sleet
#

yea

wet breach
#

oh that reminds me, I think next weekend I should work on a lib for unix sockets 🤔

minor junco
#

rather have them overthink everything 100x than do a breaking change down the road for their stupidity for committing too quick

ivory sleet
#

i prefer that to kotlin tho, just pushing new features as soon as possible almost

wet breach
#

still don't know how I am going to implement that for spigot and bungee though

ivory sleet
#

lmao

#

and well for things like REST apis we now have graphql, (yes there are still some issues w/ it but hey, its cool)

minor junco
#

hell been programming 10+ years with java

ivory sleet
#

well I just think kotlin is a harder tool imo

minor junco
#

why switch huh

wet breach
minor junco
#

nullability yeah

wet breach
#

which I don't really have an issue in terms of null lmao

ivory sleet
#

kotlin gives away ton more features, it becomes hard to know which of them one should use, code can become very messy and unreadable with kotlin rather hastily

minor junco
#

well there was a time where i only programmed in typescript with complex generics, coming to java again was a pain simply due to the nullability

#

but typescript is type erased anyways

#

so can't really compare that

ivory sleet
#

type erasure

#

is

#

in java

#

;-;

#

well u have reifiable and non reifiable types, but still

minor junco
#

loops alone are so weird for the trained java eye

#

it seems like unnecessary object allocations

#

but it probably isn't

ivory sleet
#

also the dumb interoperability

minor junco
#

since the compiler handles all the underlying tasks

ivory sleet
#

i mean interop is cool and all

hazy parrot
#

but coroutines 🤑

ivory sleet
#

its just that it wasnt semantically designed in a good way

minor junco
#

may i say something, we kinda got off topic guys

ivory sleet
#

true

minor junco
#

from the help-development

#

to this

ivory sleet
#

altho virtual threads :)

minor junco
#

drifted away slightly

hazy parrot
#

coroutines even cooler with loom

ivory sleet
#

yea aparx, true, well as long as this channel covers the more programming talk its rather fine

minor junco
#

ig

wet breach
# ivory sleet ;-;

I think there would be a lot of hinderance if this wasn't the case in java

ivory sleet
#

yeah true

#

well it was stated that its mostly for backwards compat that it exists

wet breach
#

if it didn't exist polypmorphism would be more complex

ivory sleet
#

since they wanna touch on completely non type erased generic types

young knoll
#

OwO?

wet breach
#

also, because of type erasure generics don't incure overhead at runtime either

ivory sleet
#

well I mean, project valhalla

ivory sleet
#

i mean there is some info retained

#

like for reflection purposes

#
    Value Objects, introducing class instances that lack identity

    Flattened Heap Layouts for Value Objects, supporting null-free flattened storage

    Enhanced Primitive Boxing, allowing primitives to be treated more like objects

    Null-Restricted and Nullable Types, providing language support for managing nulls

    Parametric JVM, preserving and optimizing generic class and method parameterizations at runtime

@young knoll

wet breach
#

hence it would probably be more complex if we didn't have type erasure

ivory sleet
#

yea

quaint mantle
#

Should I use abstract classes as a way of preconditions or no

ivory sleet
#

idk if u need abstract classes for that

quaint mantle
#

what's the best way to do this

ivory sleet
#

to do what, now?

quaint mantle
#

handle all those runtime exceptions

ivory sleet
#

I mean dont u just throw those in the implementation class?

quaint mantle
#

ok

ivory sleet
#

this is also one of javas weaknesses

#

since u're in principle specifying implementation details in the javadoc by mentioning the cases of which an exception will yield

#

so yeah, prob just have some conditions in the impl class :>

slender elbow
#

lol

#

like, if it's detailed in the documentation it's contract, not impl detail, e.g. "throws NPE if param1 is null"

short pilot
#

how could I handle a join system message for factions where a player could request to join a faction and someone of high ranking from said faction could accept?

Like if the leader did /faction requests chat prompts would pop up with this format

NAME [Accept] [Decline]

And you could click on the different parts to handle said actions

#

ive def seen it before but not sure what that's called

young knoll
#

ClickEvent in a TextComponent

short pilot
#

is there a way to pass in the name it's associated with as a parameter

young knoll
#

It runs a command

#

So you can pass the name as a param to said command

short pilot
#

i see

#

looking at the reverse situation, how could one handle invites to every player from a faction leader inviting them to join? Even if said player was offline

#

provided a player name

minor junco
#

hello there, could anybody tell me what I have to do to change the level verbosity of my plugin logger so that records with that level are actually printed out? Changing the logger's level to ALL does not have any affect

#
logger.setLevel(Level.ALL);

The above did not work, I assume it's due to the handlers?

true shuttle
#

How can I rotate a mob using its yaw value

wet breach
fleet kraken
#

Is there no way to get Shapeless with a specific amount of ingredient?

#

Like 10 obsidian; 5 nether star -> bedrock

young knoll
#

Recipes aren’t designed to have stacked ingredients

fleet kraken
#

So it's only possible with shapedrecipe?

young knoll
#

Even those aren’t designed for it

#

Might work with exact choice tho, idk

fleet kraken
#

but it only works with shapedrecipe

young knoll
#

Yeah like I said it’s not designed for that

fleet kraken
#

Is it possible to remove the necessary items when crafting? I mean there are no bugs in the process

#

Like, when craft with 11 obsidian and 5 nether star, remove 10 obsidian and 5 nether star

young knoll
#

You can try with the CraftItemEvent

fleet kraken
#

Working, thank you 👍

remote swallow
#

any nerds in here that might have some ideas of how i could add config updation to this https://github.com/The-Epic/ebiclib/tree/master/ebiclib-core/src/main/java/xyz/epicebic/ebiclib/config its pretty much just an annotated config but idk what a good way to do it would be, im already guessing ill need a version for it but im stuck on the part of actually adding it to something, bc i doubt adding an @Update("version", old, new) would be very good if there was 90 of them but i could probably just compact the conversion, but im welcome to any ideas

minor junco
wet breach
minor junco
#

btw this is a perfect opportunity to promote my library

wet breach
#

ah nothing like self promoting

#

at opportune times

minor junco
#

yee

grand flint
wet breach
#

I ignore my DM's

remote swallow
umbral ridge
minor junco
#

Hey guys I need help with something weird.
So I have a factory that allocates an item (or in this case an implementation of the factory that returns the below item).

  @ConfigMapping
  @Document("Item used to leave a match")
  @SuppressWarnings("deprecation")
  private ItemWrapper leave = ItemBuilder
      .builder(Material.INK_SACK)
      .damage(DyeColor.RED.getDyeData())
      .lore("§8Click to leave this match")
      .name("§cLeave")
      .enchants(Map.of(Enchantment.LUCK, 2))
      .flags(ItemFlag.HIDE_ENCHANTS)
      .wrap();

The item material that was initially given to the player differs from the material of the item when the player interacts with it.
The ItemWrapper is a simple and tested wrapper around an itemstack to add some custom serialization onto it, it does not affect the item itself.

The material of the item when it was created and set into the player's inventory: LEGACY_INK_SACK x 1 and when interacted with RED_DYE x 1. This is a huge problem for me, since I am using a Set with weak itemstacks to register game items allocated.~~ Trying to create a custom hashcode would result in the reference not being weak anymore. So any ideas or fixes?~~

Update: I figured out it is simply due to the versions and will just use IdentityHashMap as the underlying map for my set to use referencial equality instead of object equality

sullen marlin
#

and .damage isn't 1.13+ api

minor junco
#

yeah

minor junco
#

what exactly would you want

#

ah yeah it is open source

#

there's a prod ready release but it's still early development

minor junco
# sullen marlin and .damage isn't 1.13+ api

btw. is there any public data about what versions are used the most? When planning out projects I am always worried about users not being able to use my plugin since I still think legacy versions are used often, nah?

sullen marlin
#

bstats has some, but < 1.13 is like 10-15%

minor junco
#

oh okay

#

perfect haha 😄

native bramble
#

i run BuildTools with --remapped tag and have net.minecraft.server.network.PlayerConnection

sullen marlin
#

what version

native bramble
#

1.20.2

#

i cant get this class in my code

sullen marlin
#

did you use the remapped-mojang jar

native bramble
#

yes i think

#

im trying to create custom strength for blocks

minor junco
sullen marlin
#

there is no color, each color is a different item

minor junco
#

yeah I see

#

just because I cannot find RED_DYE anywhere

sullen marlin
#

is your dependency 1.13+

#

no its not

minor junco
#

its just a library I use

inner mulch
#

Is it possible to not nest in for loops, as a return statement stops the loop (correct me if im wrong)?

quiet ice
#

Huh?

sullen marlin
#

use a break?

quiet ice
#

You can use continue and break if that is the question

#

Labels are also a thing, though not liked by many

minor junco
#

call me stupid but i just dont find red_dye, im on 1.13.2-R01

#

im not giving up til i find it!!

#

Xd

sullen marlin
#

red_dye not dye

minor junco
sullen marlin
#

make sure spigot is the top dependency

quiet ice
#

?jd-s

undone axleBOT
sullen marlin
#

it may be being overwritten by another dependency

quiet ice
minor junco
#

mhnn

#

i checked it, no library exports a dependency

#

and i have spigot as a top dependency

#

I think this is an IDE thing

#

ima reset my caches and some other stuff

quiet ice
#

If anything, kill all transitive deps

inner mulch
minor junco
quiet ice
#

Nope, break means "break away from the current bracket context"

minor junco
#

like my IDE crashes as soon as im trying to decompile Material.class

#

lmfao

#

wtf

quiet ice
#

So you can have

{
break; //dead code
}
// Alive code
label: {
  {
    break label;
  }
  // Dead code
}
#

continue works only for loops though

#

Which basically means "redo the given scope"

#

Though it will reevaluate the condition (though idk if that is the case for do-while loops)

minor junco
#

mhn after invalidating caches, deleting dependencies still doesn't work, I cannot even compile Material.class this is 100% an IDE error

quiet ice
#

Compile?

#

||Geol had a stroke||

minor junco
#

decompile*

#

well restarts do nothing

#

well for some reason 1.13 does not work, but 1.14 works, so Ima use this as a dependency

lost matrix
bitter rune
#

So gui general gui; I need to get something created preferably in C because I don't have an environment setup to play with Java, I don't think intellij would open a gui after compiling. I just need a direction to start this I never worked with gui but I need to make a program in 6 days utilizing them

lost matrix
#

Uh, Qt maybe

#

Its either GTK or Qt i think. Or some open source library

bitter rune
#

I haven't even read the source material for this yet but it's based on all languages and not structured towards anything so I can figure it out in any language. They want pseudocode but I'm giving them real code it's the last big project of this course so want to go above and beyond.. I'll check those out thanks

wet breach
#

good luck making one in C though I guess

bitter rune
#

I can actually tell you let me look at it

#

It's based on this (keep in mind I don't want answers just guidance)

Draw a customer-input screen for a utility company. What information should be
captured? In what order should the fields appear? Keep in mind that
programmers would need to know database structure for their screens to be
useful.

wet breach
#

programmers generally shouldn't need to know database structures, this is why DB Administration is a thing of its own

#

it is the job of a DBA to ensure the programmers don't need to worry about the structure just the information in how to obtain the data they need or how to store it

bitter rune
#

They want to teach you a little bit of everything this course branches out in multiple directions, everyone in the college has to do this course if they are doing anything IT related

wet breach
#

I guess doesn't change the facts though

#

as far as customer input screen goes, this is a screen for the customer?

#

or a screen to display customer related stuff?

bitter rune
#

That's part of it it's purposely vague it says this and then underneath says give a hierarchy chart and pseudocode or flowchart after answering the questions

wet breach
#

interesting

bitter rune
#

So far I've aced every programming task each week I don't p!an on this week being any different just first time I don't know how to do anything in advanced

proud badge
#

does a json lookup from an api website cause lag? whenever I do it my server has insane lag spikes

#

I'll make it async rn to see if it helps

eternal oxide
#

on teh main thread it's bad

proud badge
#

Ok

lost matrix
proud badge
#

also what does IO stand for

lost matrix
eternal oxide
#

input output

lost matrix
proud badge
#

yes I read that when I was working on my plugin that uses coreprotect API

lost matrix
#

From the post ^

proud badge
#

what do I replace "this" with if it isn't in my main class?

eternal oxide
#

?di

undone axleBOT
proud badge
#

ok thanks

bitter rune
#

Does something like drawRectangle() work in Minecraft? Where would this image be placed? In the game or on the screen

eternal oxide
#

no

proud badge
#

define rectangle, you mean like a worldedit one?

#

in blocks

eternal oxide
#

drawRectangle would be a rendering method. The server has no render

bitter rune
#

No it's animation I'm learning very vague concepts that don't work in every language

smoky oak
#

well minecraft is rather limited in it's GUI stuff
you have:

  1. Resource pack overlays
  2. Boss bars
  3. Title cards
  4. scoreboard
  5. Inventory GUIS
    and thats about it
bitter rune
#

If you wanted to add stuff this is where modding comes in? Instead of plugins

lost matrix
bitter rune
#

Appreciate the info, was going to mess with it in Minecraft but I've never touched mods before, and not ready to do complicated things

smoky oak
#

depends on what ur doing tbh

icy beacon
#

Can be manipulated to an extent

bitter rune
#

Have a goal over break to create a GUI that plays an animation nothing big but stuff I never touched before (not inside Minecraft, another language)

proud badge
#

and the async task is in a different class

smoky oak
#

le shrug

smoky oak
proud badge
#

asking me to insert new

smoky oak
#

yea cuz that isnt your instance

#

thats your class constructor without new

#

you have to either cache your main instance or get it via PluginManager

bitter rune
#

Looking at my options looks like I want c++ with Qt to accomplish this, and I want Python with tkinter

proud badge
#

ima just ask chatgpt

icy beacon
proud badge
#

Anyone know how could I check which velocity proxy a player is connecting from?

#

I have a dual proxy setup

proud badge
#

How could I import my HashMap from class A to class B?

#

I cant seem to figure it out, chatgpt doesnt say

#

Or I dont understand what its saying

undone axleBOT
lost matrix
#

PS: You should never transfer maps (or any other collection) between classes

proud badge
#

Oh

#

Ok

lost matrix
#

Never make them public, never create getters or setters for them

proud badge
#

so I should transfer my command to my class with the hashmap?

lost matrix
#

No you should create one manager class which holds this hashmap. Then write proper methods to manager this map.
In the end you can pass around your manager class and use its methods.

lost matrix
# proud badge so I should transfer my command to my class with the hashmap?

Here is an example

public class PlayerDataManager {
  
  private final Map<UUID, PlayerDataStorage> playerDataStorageMap = new HashMap<>();
  
  public PlayerDataStorage getPlayerDataStorage(UUID uuid) {
    return this.playerDataStorageMap.get(uuid);
  }
  
  public void addPlayerDataStorage(PlayerDataStorage data) {
    this.playerDataStorageMap.put(data.getUUID(), playerDataStorage);
  }
  
  public void removePlayerDataStorage(UUID uuid) {
    this.playerDataStorageMap.remove(uuid);
  }
  
}
public class PlayerDataListener implements Listener {

  private final PlayerDataManager playerDataManager;

  public PlayerDataListener(PlayerDataManager playerDataManager) {
    this.playerDataManager = playerDataManager;
  }

  @EventHandler
  public void onJoin(PlayerJoinEvent event) {
    PlayerDataStorage data = new PlayerDataStorage(event.getPlayer().getUniqueId());
    this.playerDataManager.addPlayerDataStorage(data);
  }

  @EventHandler
  public void onQuit(PlayerQuitEvent event) {
    this.playerDataManager.removePlayerDataStorage(event.getPlayer().getUniqueId());
  }
  
}
native bramble
#

is it possible to remove item from the server?

#

like what i need to do? check many events and remove item?

#

like from looting, trades and other?

quaint mantle
#

Mates, I'm new to the NMS development, and I am trying to conditionally remove the carved pumpkin's blurred screen effect by following a trail in the thread below.

https://www.spigotmc.org/threads/how-to-set-carved-pumpkin-as-helmet-without-carved-pumpkin-in-helmet.574715/

I built the Bukkit, CraftBukkit, and Spigot-Server and imported all the libraries, but I still can't find the ClientboundContainerSetSlotPacket like the image below.

https://imgur.com/a/XZRkUlh

I think I have missed something really important, such as deprecation. It would be really helpful to get some tips to get out of this disaster. many thanks

chrome beacon
#

Also as stated in that thread you're probably better off making a resourcepack

proud badge
#

k i think ima just have the http lookup everytime I do the command instead of trying to understand this hashmap between classes stuff

chrome beacon
#

The only way to remove the pumpkin overlay is to make the client think that there isn't a carved pumpkin in that slot

proud badge
#

its async surely it wont cause lag

chrome beacon
proud badge
#

true

quaint mantle
lost matrix
#

I would probably go for protocollib instead of nms for this

quaint mantle
quaint mantle
proud badge
#

any1 know what I did wrong here? its throwing a stacktrace

lost matrix
lost matrix
#

You cant magically pull an instance of your JavaPlugin out of thin air. You need to give it to your class when creating an instance of it.

quaint mantle
proud badge
#

ok so I tried fixing it but now another error occurred

quaint mantle
#

and I wanted to hide its blurring screen basd on customModelData value

proud badge
#

ok thanks

quaint mantle
proud badge
#

ok the entire plugin works epic

#

now async

lost matrix
grim hound
#

Like what can and can't be async

quaint mantle
grim hound
#

What was tye

#

Spigot item burning event

lost matrix
quaint mantle
grim hound
#

How do I kick a player async?

#

Because a forced connection close

#

Does not allow for a custom feedback message

river oracle
#

why do you need to kick a player asynchronously

#

kicking doesn't damage server performance that much lol

#

making it async probably makes you worse off xD

grim hound
grim hound
#

Cuz I'm operating on another thread already

#

And need to sync the kick

river oracle
#

BukkitScheduler#runTask it'll kick them the next tick

grim hound
grim hound
river oracle
#

this is such a micro-optimization you're going in a super round about way to do something simple for maybe if at all a marginal gain in performance

grim hound
#

Cuz a connection close can be async

#

So why can't a kick be?

grim hound
timid hedge
#

Can someone please help me, so my problem is that i have opened another eclipse project in intellij, and after i have closed that and opened a new one all the depencyes are at the other projects location. How do i fix that so i dosent be at the same location?

I have an example here, all the locations are like this: D:\clients\minecraft\abaac\workspace\jars\versions\1.8.8\1.8.8.jar but it should be: D:\clients\minecraft\FC-1.8\workspace\jars\versions\1.8.8\1.8.8.jar, and it is also like that with every other dependency with mcp (the abaac is the earlier project i wrote about)

Can someone help me fix this error?
https://pastebin.com/Yd9wHiwy it's with mcp

quaint mantle
proud badge
#

What does the key mean in PDCs? can I just set it to random text or what exactly does it mean

rotund ravine
#

It’s your identifier for that key

proud badge
#

so like a password or something?

lost matrix
rotund ravine
#

If you want to get the value back you would “need” the key. So sure a password

#

Except it’s not a secret

proud badge
#

so more like a username

rotund ravine
#

Sure it’s a key

proud badge
#

also can I not store stuff like UUID or Player in the PDC?

lost matrix
#

UUID -> Yes
Player -> You should not

You can store pretty much anything in a PDC to be honest. You just need the right PDC type.

proud badge
#

cause this doesnt work

lost matrix
#

Because spigot doesnt have such a PDC type. You would have to either use a String or create your own type.

proud badge
#

I guess I'll convert the UUID to string

rotund ravine
#

?extrapdc

#

?morepdc

undone axleBOT
proud badge
#

do I need to install some plugin for it to work or no?

#

or is the repository and dependency fine

rotund ravine
#

Just a dependency u need to shade

proud badge
#

ok thanks it works

upper hazel
young knoll
#

Some of it

#

You can't load chunks or teleport async

upper hazel
#

But then, is there any point in asynchrony if you need to wait until the location is received?

eternal night
#

I mean, instead of async you can just spread this over multiple ticks

proud badge
#

ok and how could I delete a PDC? Set it to null (would that work)?

eternal night
#

like, if you only want to load e.g. one chunk per tick.
Do one check per tick

#

lemme find smiles post

eternal night
#

?workdist

#

skill issue

#

?workdistro

eternal night
#

lets goo

proud badge
#

Ok I assume this will remove all of the PDC related to the thing and I dont need to specify the type?

upper hazel
eternal night
#

that method would remove that inner PDC from the dataContainer

lost matrix
proud badge
#

Ok

#

Time to redo all of my plugins

eternal night
#

👀

#

how do any of your plugins work if you use == for object comparison kekwhyper

upper hazel
eternal night
#

that shit is bound to break fast

young knoll
#

Oops! all singletons

shadow night
#

Holy fuck

#

How

river oracle
eternal night
#

Merry Milesmas

river oracle
#

Doesn't work as well

eternal night
#

feels like your fault tbh

quaint berry
#

Can anyone help on how to just send basic chat messages in 1.20.1? Or at least how to use component builders for it?

river oracle
#

More component methods coming soon ™️

quaint berry
#
ComponentBuilder builder = new ComponentBuilder();

This requires importing a couple dozen methods

worldly ingot
quaint berry
river oracle
#

I smell paper

quaint berry
#

Correct

river oracle
#

This isn't the place mate

shadow night
quaint berry
#

I assumed there wasn't much of a difference?

river oracle
#

Much difference

shadow night
#

There's too much of a difference

quaint berry
#

Oh.

#

I'm presuming spigot plugins work on paper natively?

river oracle
#

Yes

shadow night
#

Well, they should

river oracle
#

But paper plugins don't work on spigot

quaint berry
#

Oh ok

shadow night
pseudo hazel
#

its just that paper added a lot of extra stuff, making it very hard for us to suggest the right thing to do

shadow night
#

Well, there is a chance a spigot plugin may not work on paper for whatever paper reason

river oracle
pseudo hazel
#

so if you are planning to just develop for paper, you should use their server as they know more of whats going on

shadow night
#

Is it possible that one of the patches paper does to vanilla could somehow change the behaviour of a spigot plugin?

eternal oxide
#

Paper also behaves differently in certain situations. If you dev on Spigot we can help. If you dev on Paper we can;t be certain an issue is not caused by Paper. So advise is to dev on spigot to get help here.

river oracle
shadow night
#

Well, there are some bugs that are considered features by players or mojang ig

proud badge
#

Should I register my NamespaceKey inside or outside of the event/command?

eternal oxide
#

Yes somethings behave differently in Paper, like entities through portals.

pseudo hazel
#

I mean paper does a lot of optimizations so that shouldnt be surprising

vague swallow
#

Does anyone have an idea why player.isBlocking() doesn't return true even if the player is blocking with a shield?

vague swallow
worldly ingot
#

It should but it's worth noting that it only returns true if the shield is fully up

#

isHandRaised() will return true even if the player only just recently clicked block, but it takes like 0.5 seconds before isBlocking() will actually return true

topaz kestrel
#

How can I change this to a annotation which checks it all for me:

MenuRows menuRows;
        try {
            menuRows = MenuRows.valueOf(rows);
        } catch (IllegalArgumentException exception) {
            this.logger.warning("Rows for \"" + menuName + "\" menu is invalid!");
            return null;
        }```

To this:
```java
@Catch(exception = IllegalArgumentException.class)
@Log("Rows for \"" + menuName + "\" menu is invalid!")
MenuRows menuRows = MenuRows.valueOf(rows);```
eternal night
worldly ingot
#

You don't have to use annotations for everything :(

topaz kestrel
#

I want to check if that enum exists

shadow night
#

Can't you like check things before

eternal oxide
#
@WritePluginALLInAnnotations```
eternal night
#

You'd have to write an annotation processor which is fun

river oracle
#

Annotations are evil

topaz kestrel
#

why? they look so cool

worldly ingot
#

You get over that quickly

shadow night
pseudo hazel
#

java was not meant for this smh

#

probably*

shadow night
#

Java was meant for TVs and you're writing plugins in it

rotund ravine
#

Annotations are devilish

topaz kestrel
#

Can you guys help please instead talking what Java was made for?

river oracle
# topaz kestrel why? they look so cool

Anyways you'll need an annotation processor iirc you can do this with a maven or gradle plugin or just a jar file idealistically it searches for your annotations and replaces it with code

#

Beyond that no one here will be of much help seeing as annotation proccessors aren't an easy ask

shadow night
#

And most people here probably do programming as a hobby, probably

river oracle
#

Bobby

rotund ravine
#

Google “annotation processor java” or smth

shadow night
eternal night
#

I mean, the help here is "don't write custom annotation processors"

pseudo hazel
#

programming as a hobby is no excuse to know nothing

river oracle
#

Factz

#

Get smarter broda

shadow night
#

A excuse to not know annotation processors tho

pseudo hazel
#

well the excuse would be that I have never tried something like this so I wouldnt know how to do it

#

whether it is my job or not

shadow night
#

Yes

lost matrix
shadow night
#

Like, why would I write an annotation processor if everything works without annotations

eternal night
#

Given you can implement pretty much this exact same concept in like, an interface and a static method

#

annotation processor is just the wrong tool for the job

topaz kestrel
eternal night
#

I mean, you can google annotation processors

#

and go down that path

#

its a complete waste of your time

river oracle
#

You're way over thinking this

hazy parrot
#

Btw this looks like local variable, afaik you can't annotate that

pseudo hazel
#

why cant you write a simple function for this though

lost matrix
proud badge
#

Huh why isnt the target file being created when I package the plugin?

eternal night
#

the folder might be there

#

your IDE just might not show it

proud badge
#

hmm weird

#

it is there I checked

#

ok i restarted it its back now

#

What is the event for removing items from an armour stand (and adding)? I tried this and didnt work (the DataType.UUID is definitely true)

pseudo hazel
#

and a print or something does not show up?

topaz kestrel
proud badge
#

This E does not get printed

#

when I add/remove items from the armour stand

topaz kestrel
#

iirc

lost matrix
topaz kestrel
eternal night
#

Annotations are literally not meant to generate code

#

you are trying to abuse a system that is there for pure metadata for code generation

#

they are not macros if you come from a language that has those

lost matrix
topaz kestrel
#

I mean I don't know how to do that. It seems hard to create. Is there any source on github for me to get inspired or something so I can write it easier?

chrome beacon
lost matrix
chrome beacon
#

Oh no don't look at Lombok

#

Lomboks code is actually a mess

eternal night
#

yea really don't look at lombok kekwhyper

topaz kestrel
eternal night
topaz kestrel
eternal night
#

the codebase is terribly complex

lost matrix
bitter rune
#

sound slike spaghetti code

eternal night
#

it does a LOT, if you have 0 idea on annotation processors, lombok is not the project to learn from

#

follow some bare bone guide

#

or

#

write a single damn helper function that does this whole thing for you kekwhyper

topaz kestrel
#

lol

lost matrix
#

Yeah i also feel like an annotation processor would be completely wasted on checking if an enum value exists...

topaz kestrel
#

I thought It would be cool if I use an annotation for a variable instead of try/catching it, however, I might regret now. try/catch exceptions are kinda messy and its syntax is so boring tbh.

river oracle
#

Don't even use try catch here this can be done without it if you make your own custom fromString method

lost matrix
# topaz kestrel lol

One example:

  public static <T extends Enum<T>> T getSafeEnumValue(Class<T> enumClass, String name) {
    try {
      return Enum.valueOf(enumClass, name.toUpperCase());
    } catch (IllegalArgumentException e) {
      // Do whatever you want here, like logging the wrong name.
      return enumClass.getEnumConstants()[0];
    }
  }
  
  Particle particle = getSafeEnumValue(Particle.class, "test");
topaz kestrel
proud badge
#

When i right click a pig it gets executed, but when I right click an armour stand it doesnt

#

Are armour stands not entities or something?

river oracle
topaz kestrel
proud badge
#

Cannot use getRightClicked then

river oracle
twin venture
#

Hello there , iam trying to remove an arena by its uuid from the map

#

[15:56:14 ERROR]: Error occurred while disabling game v1.0-SNAPSHOT (Is it up to date?)
java.lang.NullPointerException: null
at org.skywars.core.sync.JedisServerSync.messageServerClose(JedisServerSync.java:94) ~[?:?]
at org.skywars.game.Game.onDisable(Game.java:143) ~[?:?]

topaz kestrel
twin venture
proud badge
#

exactly what I did

twin venture
#

this is my jedis part of the code

proud badge
#

ah wait no

#

i misread your sentence

river oracle
#

They're entities

lost matrix
twin venture
#

but it can't be null cuz its already there ..

proud badge
twin venture
#

i already added it .-.

topaz kestrel
topaz kestrel
#

What do you mean?

river oracle
#

I don't have time In class atm sry

topaz kestrel
#

okay

lost matrix
twin venture
#

each server is represented by a new random uuid each time a server restart :

#

its , i deleted some empty lines

#

everything is working just fine , my only problem now is

#

it does not decress this by 1

#

when a server close

#

any ideas?

#

do i need to send a hset?

#

starting with server uuid?

river oracle
# topaz kestrel okay

https://java-design-patterns.com/patterns/registry/#explanation this is a basic outline of what you should kinda do though its a simple example

Java Design Patterns

Intent Stores the objects of a single class and provide a global point of access to them. Similar to Multiton pattern, only difference is that in a registry there is no restriction on the number of objects. Explanation In Plain Words Registry is a well-known object that other objects can use to find common objects and services.

#

just note you don't need a concurrent map in most cases

lost matrix
twin venture
#

when a server close decrese by 1 :

topaz kestrel
deep herald
#

anyone know why i cant import my other plugin?

eternal oxide
#

run mvn install when you build your other plugin

hazy parrot
#

Have you installed it

weak bear
#

Hello I have a question which version do I use to minecraft 1.16.5 thx you

weak bear
#

Java sorry x)

#

which version of Java

lost matrix
#

I would go with 11 but it supports up to 16

weak bear
#

Okay but I saw that's recommended to use Java 8 that's true ?

eternal oxide
#

no

weak bear
#

Okay thx you so I think that I will use Java 11 or newer

valid burrow
#

how can i check if a location is above ground

#

other then checking the blocks above it

#

cause

eternal oxide
#

getHighestYat

valid burrow
#

thx

eternal oxide
#

if the Y is above your Y then there is a block above you

twin venture
#

hi , was able to figure out what's wrong :

valid burrow
twin venture
#

can it be that bcz its in another thread?

valid burrow
#

wtf is going on with my llamas

#

they always walk straight in some direction for no reason

#

i have a class spawmning all kinds of mobs

#

and llamas are the only ones behaving weird

eternal oxide
#

You smell so they are leaving

valid burrow
#

sometimes they also just spin in circles

eternal oxide
#

did you change their brain?

#

goals

valid burrow
#

too lazy to screen record

#

but these spin

valid burrow
#

no nms involved

#

i only put an invisible wolf ontop of em

eternal oxide
#

um, tamed or wild?

valid burrow
#

wild

#

i mean i didnt specify

#

so wild ig

eternal oxide
#

they are probably scared

#

so trying to run away

valid burrow
#

no theyx arent they arent running away

#

they are walkiung ina straight line

#

from where they are spawned

#

no matter if theres a wall

#

or i move

#

they will get stuck and dont care

eternal oxide
#

change the mob from a wolf to a pig or chicken

valid burrow
#

but then it would loose its purpose

#

i need the wolves ai

eternal oxide
#

try it to see if their behavior changes

valid burrow
#

is their any other mob with a behaviour similar to a wolf?

#

like attack uppon being attacked

#

holy shit theres many

#

never realized

#

but now that i think about it makes sense

weak bear
#

Hey How can I get title of inventory in event InventoryClickEvent

eternal oxide
#

don't compare inventories by name

weak bear
#

how can I compare it so ?

eternal oxide
#

compare by instance

weak bear
#

okay

eternal oxide
#

I'll assume you are making a UI?

weak bear
#

Yes I use Bukkit.createInventory

eternal oxide
#

store the instance when you create the inventory

#

then compare to it when the player clicks

valid burrow
eternal oxide
#

if (yourInventory == clickedInventory)

weak bear
#

okay