#help-development

1 messages ยท Page 1216 of 1

torn shuttle
#

maybe

sweet pike
#

is there anything bukkit/spigot provides that uniquely identifies a server, persisted through restarts and is not modifiable

eternal night
#

no

shadow night
#

That is not possible, I believe

#

Anything is modifiable

blazing ocean
#

also makes no sense

shadow night
#

The best you can do is use the main worlds UUID ig

blazing ocean
#

uid.dat in shambles

quasi gulch
#

Hi i have a problem. When i use launchProjectile() it trigers the LaunchProjectileEvent which launches even more projectiles because of a specific method. And when i spawn the projectile and set its Velocity it hits the entity thats suposed to "lauch" it. Does anyone have any idea how to fix this problem?

#

Should't normaly spigot methods not triger any other events?

pliant topaz
#

Well, it's still happening on the server

#

afaik, everything that triggers a certain action still calls the corresponding event

chrome beacon
#

Are you launching projectiles in the launch projectile event

quasi gulch
#

yes

chrome beacon
#

One hacky way you can get a round it is to just keep a boolean that you toggle

#

event:
if myEvent
myEvent false
else
myEvent = true
launchProjectiles

quasi gulch
#

i will try thanks

blazing ocean
#

what the skript

quasi gulch
#

If i use the setShooter void on the projectile will it still hit the shooter when fired?

nova notch
#

try it and see

quasi gulch
#

didnt work

nova notch
#

then there's your answer

misty ingot
#

how can i go about using flags in my commands in ACF?
like for example
/kick player -s true would make the kick silent (gimme a variable named silent to work with)
and /kick player would just be normal

#

or just -s instead of -s true would work too

errant cradle
#

what to do when people spawn in the wrong world
like i want them to spawn in a second world when they join

misty ingot
#

if thats all you want, and not making a custom plugin is an option then just use EssentialsSpawn or some other spawn setting plugin

split gull
#

hey, looking for some advice, i have no clue how to use SpecialSource, I wasn't able to find any documentation on it, the only thing i was able to find was some old forum post referencing some old Shopkeepers module files where it uses SpecialSource but i can't figure out how to use it, any help?

#

this is what im trying to do

eternal oxide
#

?nms

split gull
#

the issue im facing is that i dont have a mojang remapped jar

eternal oxide
#

then you didn;t follow the tutorial

split gull
#

uh, maybe i skipped something, not sure, im going to read it again

eternal oxide
#

at the very top it tells you to run buildtools with a specific arg

eternal night
#

pretty sure build tools cannot do mojang mapped for version before it supported it

split gull
eternal oxide
#

ah

#

yeah you are out of luck

#

1.17 was when remapping began

split gull
#

yeah but there should be a way, right?

#

i used a tool to convert the mojang mappings (txt) into a tsrg file, can i use that? somehow?

eternal oxide
#

mappings for 1.16 are there

#

you need stash access (probably)

split gull
#

i'll see what i can do with that page, thanks

split gull
errant cradle
#

what command do i run to set the spawn?

misty ingot
split gull
#

?paste

undone axleBOT
split gull
#

and it also fails to find the special source main class

blazing ocean
#

oh god not someone trying to use mojmaps on gradle

split gull
blazing ocean
#

it's just a huge pain, especially without wanting to go through the mess of SS

split gull
#

what would SS be

blazing ocean
#

specialsource

split gull
#

well, im looking to use it but i dont know how, im not even sure if what im doing is correct

#

do you have any reference for this? or a repo i could take a look at

river oracle
split gull
#

i have so much little clue that i commented out the line that sets the main class and it built the jar just fine ๐Ÿ’€, it prob wont work though

buoyant viper
#

Wtf

#

drop ur routine thx

split gull
#

i cut it recently ๐Ÿ˜ญ

split gull
buoyant viper
split gull
#

sometimes a foamy thing to make it nice and curly

split gull
#

i must grow it back

buoyant viper
#

Real

misty ingot
#

im pretty sure 2/3 messages here are not even related to spigot, and i love it

nova notch
#

average help development conversation

misty ingot
#

well when you put a lot of cs nerds together, they are definitely gonna talk since its the first human interaction theyve had all week

blazing ocean
#

true

safe crown
#

I will send the build.gradle in a sec

#

So I added the id and version to the plugins block. I noticed the things in the example didnt work because I think they are using a kotlin build script and mine is a groovy one?

#
tasks.register('launchMinecraftServer', LaunchMinecraftServerTask) {
    dependsOn("build")
    jarUrl.set(LaunchMinecraftServerTask.JarUrl.Paper("1.21.2"))
    agreeEula.set(true)
}
#

So I tried to recreate it using what I am using, now when I try to run gradle I get the following output:

#
A problem occurred configuring root project 'growable-rebalance'.
> Could not create task ':launchMinecraftServer'.
   > No signature of method: static dev.s7a.gradle.minecraft.server.tasks.LaunchMinecraftServerTask$JarUrl.Paper() is applicable for argument types: (String) values: [1.21.2]
     Possible solutions: Paper(java.lang.String), grep(), tap(groovy.lang.Closure), wait(), every(), any()
#

So the thing I put into the JarUrl.Paper is a string in the config as you can see above

#

But I don't get whats wrong here

blazing ocean
safe crown
safe crown
mortal hare
#

this might sound pedantic but is there a way to make intellij add spacing between different package imports?

chrome beacon
#

far from ideal though

#

Settings:
Editor > Code Style > Java > Imports > Import Layout
Manually add every import group and a space between them

urban cloak
#

does anyone read the import list tho?

#

i have it folded the entire time

mortal hare
#

its good to have when you read code from git repo

mortal hare
#

how do you call this bar in UI that's in windows file explorer baked in

#

tracker bar?

#

details bar?

urban cloak
#

footer?

worldly ingot
#

Yeah, either a footer or a status bar probably

wet breach
vestal sinew
#

because another plugin maybe canceled event

#

What exactly do you need to get in the end?

#

I wanted to know what kind of plugin you want to make.
But try EntityDamageByEntityEvent

#

xd

#

Funny idea

#

How is pvp disabled? Some kind of plugin?

chrome beacon
#

If you're worried about it being cancelled you should set ignored cancelled instead

dense geyser
#

does anyone know why cancelling the InventoryClickEvent doesn't stop people picking up items anymore? It's setting the item back, but the item duplicates onto the cursor? This is a debugging thing and every inventory interaction is cancelled.

worthy yarrow
#

you wouldn't happen to be in creative mode would you?

dense geyser
#

in this case yeah, does that break it?

worthy yarrow
#

Indeed

dense geyser
#

oh yeah that's strange, is there a way to fix that?

worthy yarrow
#

There should be a creative inventory interact event or something iirc

dense geyser
#

ah, thanks! I'll have a little look for it

worthy yarrow
#

?jd-s

undone axleBOT
dense geyser
#

thank u

worthy yarrow
#

No worries

#

yeah weird spigot things

wet breach
#

its an implementation thing from mojang

#

Creative has long been known to not work the same way as typical play usage

worthy yarrow
#

Oh a mojank even better

wet breach
#

this goes back to like almost the first versions

#

believe it was around 1.5-1.7 though where it was more noticable since more features being made available through the api

split gull
#

Is there any documentation on how to use specialsource or do i have to inspect the source code?

mortal vortex
#

using it for what it does, probably?

#

"Anyone know how to use a lawn mower"
"using it for what"

split gull
# remote swallow using it for what?

i want to use nms on 1.16.5, i have read the patrick remapper tutorial multiple times and have used that for all versions past 1.16.5 but since build tools doesnt have mojang mappings for versions pre 1.17 im forced to do all kinds of weird stuff

remote swallow
mortal vortex
#

oh yeah

remote swallow
#

spigot doesnt support mojang mappings back then

#

so you just use the normal spigot dep with no mojang mappins

#

and dont need to worry about any deps

#

not deps, remapping

split gull
#

what if i made the remappings myself

remote swallow
#

your gonna have a really really fun time dealing with it all

#

its much easier to either not support 1.16.5 or you just have to use the obf jar

split gull
#

how hard is it on a scale from 1 to 10

remote swallow
#

more effort than its worth

split gull
#

mh

grim hound
#

Does anyone know of an api/plugin I could use to see what the server would normally send to the player?

#

Just joining a fake player

blazing ocean
#

packetevents?

grim hound
#

I'n just trying to parse the visuals a player (even if there's no player on the server) would see after an entity spawn from commands

grim hound
unborn goblet
#

is there an event to tell when a player hits an entity which no health value? (eg: tnt)

summer scroll
#

Probably PlayerInteractEvent check for action LEFT_CLICK_BLOCK

#

Could you explain what you're trying to achieve? I can probably answer it better.

fast jasper
#

hello, I've been learning Spigot for just about 2 months now, so apologies if I make any mistakes here or misunderstand anything.

right now in my plugin I have a title and sub title text being sent to players on my server that just shows a few minus and equal signs "[-=-=-=-]" changing color as a sort of "loading animation" a few times per second. I would like this "animation" to continue playing at a constant rate, even when the server's main thread has slowed or briefly freezes, however I have been having trouble doing this.

so far I've set up this code within a class extending BukkitRunnable and am running this task asynchronously, using title packets to send display the title message on players screens. the target players are referenced off a HashSet which has been given the needed set of players ahead of time before starting the runnable.

this has been "functioning" as expected, correctly displaying the title text "animation" on players screens, however during testing I've observed that it seems to stay exactly in sync with the server still. by that I mean it slows down / freezes when the main thread also slows/freezes. this happens even after changing this from a synchronous task to an asynchronously with packets and no Bukkit API calls. this slowdown occurs even when my computer resources aren't being fully utilized, and other applications on my computer, as well as my Minecraft game client, are running at their full independent speed just fine from what I can tell. I'm aware that features such as game chat and such still seem to function just fine and do not experience the same slowdown, implying to me that that also uses the type of async usage I am looking for.
_ _

#

_ _

is it possible to make the rate of my packet sending NOT tied to the server's tick rate, so I can keep this visual text updates continuing at a constant rate? perhaps I'm misunderstanding how something works here as well. been researching this topic but have been unable to find an answer. if anyone knows, any tips or suggestions would be appreciated. thank you.

#

I just realized I forgot to mention. I am using specifically this method "runTaskTimerAsynchronously" on my bukkit runnable extending class

eternal oxide
#

you are overloading yrou server

#

packets are placed in an async queue to be sent, they have no real limitations

#

if yoru main thread is slowing down AND your async tasks are lagging then your whole server is lagging

fast jasper
#

I see. so basically this is a server issue and not a plugin issue, correct?

eternal oxide
#

hardware limitation, or you are saturating your network

fast jasper
#

hm not sure if it's a network thing since I am running the server and the game client I'm testing on the same device

#

I'm still a bit curious as to what might be causing this, as like I stated in my message, my computer usage isn't that high and all other software including my Minecraft game client is running at the normal speed

#

all of the slowdown is contained just within the server. I would like to know what I may be able to do to look further into this

eternal oxide
#

run a spark profile and see what is putting the most load on yrou server

#

you may have made a mistake somewhere and you are hammering packets out unknowingly

fast jasper
#

that sort of tool isn't something I've ever worked with before but I could look into it

#

also as previously mentioned, during this sort of "slowdown", not just other software, and my gameclient continue at a consistent speed noninterrupted, but so does the server chat itself. I can see both in my console and in game the chat continueing to update immediately when I write test messages

eternal oxide
#

server chat is async

#

runs in its own thread

fast jasper
#

yes, that is what I'm trying to set up here with my title packets

#

I'm trying to replicate that sort of behavior

eternal oxide
#

run it in your own thread (scheduled executor)

fast jasper
#

that is what I am doing

eternal oxide
#

no you are running an async bukkit task

#

which can run on teh main thread

fast jasper
#

oh I see. thanks for informing me. what method(s) should I use or look into instead?

fast jasper
#

that makes a lot of sense why I see no performancechange here then in my plugin

eternal oxide
#

this is actully not a good example as they schedule a new task for every number

#

you just want one task from what I understand

fast jasper
#

oh okay so this is non Bukkit it's just Java? as mentioned previously I am quite new to learning a lot of this stuff. from what I've read and what others have informed me, using asynch runnables outside of Spigot or Bukkit api is "not a good idea"

eternal oxide
#

but ScheduledExecutor is what you want

fast jasper
#

so I wasn't sure if it was okay to use that sort of thing

eternal oxide
#

its fine depending on what you are doing

#

you are just sending packets so its fine

fast jasper
#

got it. thank you so much. I'll definitely look into that. I see why my runnable solution didn't work now that you've explained it

misty ingot
#

any good data storage libs? i dont feel like doing the whole mysql/sqlite integration setup manually for the millionth time

granite crown
#

combine with Jackson and you are good to go (u can use it with the integrated json tho)

#

I advise this one for small to medium plugins ; if you are going to make a big data plugin stay with a database ^^

#

because of the performances and storage space in game server side

misty ingot
#

i plan on sticking to a database

#

i was wondering if theres any libs for easy integration

mortal vortex
echo basalt
#

for kt exposed's nice yeah

misty ingot
#

oh its by intelliJ

#

im using java tho

granite crown
#

But building a service for your database doesn't take too much time :/

misty ingot
#

yeah well i wasnt home so i was wondering if theres any good simple ones

#

but now that i am on my pc im thinking why not just make my own handler

misty ingot
#

i think im gonna just

#

copy my old code from my plugin, refactor it, and turn it into a package

split gull
#

hello, im looking for a way of obtaining spigot jars programmatically, preferibly from a url; I've tried using buildtools but when i do so it takes a long time and i need it to not take that long

eternal oxide
#

Buildtools is the only legal method of obtaining the server jar

split gull
eternal oxide
#

if its private and only for you, yes. If its public, no.

split gull
#

mh

misty ingot
#

hm, now to learn how to make a package

#

anyone got a link?

split gull
chrome beacon
#

so what package are you looking to make

chrome beacon
split gull
misty ingot
#

i wish to make a simple mysql handler, to avoid having to write the same code in every goddamn plugin i make

#

but i have never made a package before (that people can import and stuff yk from their pom or gradle)

split gull
#

beautiful, thanks

mortal hare
#

is there any utility method in java that allows to resize the fixed size array

#

ik i can use System.arraycopy but im wondering whether there's one liner function for this instead

#

i would love to have something like js :[...foo, 'bar'], but java afaik doesnt have something like this

echo basalt
#

mm protocollib's fucked

#

gotta do it manually

eternal night
#

On spigot

chrome beacon
#

I believe so

#

ObjectArrays#concat if so

#

Do note that it returns a new array

mortal hare
#

the only place in 2-3 years where i use & operator in generics

  public static <T extends Observable & Collection<V>, V> Button selectAll(final EventHandler<? super MouseEvent> handler, final T tracked, final T selected) {
      return GenericButton.selectAll(handler, GenericBinding.deselected(tracked, selected));
  }
misty ingot
#

hmm yes
mhm yes hmm

#

ive had IntelliJ open for an hour and a half and all ive done is delete a thing i made yesterday because i realised it cant work

echo basalt
#

T extends PlayerEvent & Cancellable

#

type shit

smoky oak
#

every time i think i understand generics i stg

echo basalt
#

Basically defines multiple generic constraints

#

For example that my event must be a subtype of both PlayerEvent and Cancellable

#

So you can do stuff like getPlayer, check -> setCancelled

smoky oak
#

classes can only extend one thing tho. i take it this merges implements into it too?

echo basalt
#

You can implement multiple interfaces

#

But yeah it does

#

the T extends Whatever applies to interfaces too

#

you can just treat it as a "T inherits Whatever"

smoky oak
#

noted

#

can i assume this only supports 'and'?

echo basalt
#

there's also T super whatever but it isn't as popular

smoky oak
#

is it the same meaning as extends?

chrome beacon
#

They are slightly different

mortal hare
#

javafx... why?

#

why not this instead:

    public static <T extends Observable & Collection<?>> IntegerBinding size(final T observable) {
        return new IntegerBinding() {
            {
                super.bind(observable);
            }

            @Override
            public void dispose() {
                super.unbind(observable);
            }

            @Override
            protected int computeValue() {
                return observable.size();
            }

            @Override
            public ObservableList<?> getDependencies() {
                return FXCollections.singletonObservableList(observable);
            }
        };
    }
#

i literally copy pasted the implementation from javafx internal static method and applied generics

#

it works perfectly fine

#

and allows for any observe any collection size

#

there's no point either way to listen for size of observable array

#

its not fixed size

#

so what's the big deal really

smoky oak
mortal hare
#

if you have

List<? extends Player> as a parameter, you cant pass List<Player> it will error out

#

List<? super Player> will also take List<Player>

smoky oak
#

noted

mortal hare
#

well its not like that really, ? super Player is better since then you can downcast list to lets say List<Object> and it will still take it as a parameter:

public void foo(List<? super Player> list) {
  final String name = player.getName(); // error! Even if we know that object provided has any of the superclasses, but we dont know that if it has Player class on the object
}
public void bar(List<? extends Player> list) {...}
...


List<Object> objects = players;

this.foo(objects) // this would still compile and but you lose access to methods of Player
this.bar(objects) // with ? extends, compiler be like wtf you're passing List<Object> to List<? extends Player> parameter method??
#

you usually use ? super for consuming values a.k.a parameters, because compiler can infer the type even if was downcasted, meanwhile ? extends you would use for producer return types

#

basically you need those wildcards because java doesnt implictly downcast generic values if you have function:

public void foo(List<Object> list) {
  ...
}

you cant pass anything higher in terms of inheritance:

foo(List.of((Object)0)) // works because List.of((Object)0) evaluates to List<Object>
foo(List.of(0)) // doesnt work because List.of(0) evaluates to List<Integer>

so if you want to control what kind of downcasting or upcasting checks can compiler do when you provide an argument you use ? super Foo to provide for the compiler that it can take generic parameters which are lower or equal inheritance related to Foo class and ? extends Foo to enforce that provided object should at least have access to Foo methods

misty ingot
#

what would be the best way to store a list of players in a mysql column?

#

like
CREATE TABLE IF NOT EXISTS playerGroups (groupId integer PRIMARY KEY, playerList {SOMETHING});

mortal hare
#

it depends if you want normalized data or not

misty ingot
#

i simply wish to store a list of player UUIDs in the column

#

order does not matter

#

(and then get them back easily)

mortal hare
#

if you want flexibility with filtering data, etc. you would store it in normalized form by creating new row for each user

#

if you prefer performance over flexibility, you store the list in encoded format like json inside varchar or some other data type

misty ingot
#

json it is then

#

i need no flexibility, it is just a pile of UUIDs

#

nothing less nothing more

mortal hare
#

well if its only uuids i guess

misty ingot
#

yeah i made sure that i was working with UUIDs

#

makes things easier

mortal hare
#

normalized tables are not that expensive either nowadays, if you would need to expand your code later i would just use new row for each user so that i can add more columns

#

but if you're only storing it just for the sake of storage well it doesnt matter much

misty ingot
#

thats the first thought i had, but there is literally nothing to store or will be there to store

#

i have a seperate table for player data already, this is just telling each team object that "hey mate, these players are part of you" "aight bro thanks"

mortal hare
#

mysql iirc support json as a datatype

misty ingot
#

convenient

chrome beacon
#

Do note the implementation difference of JSON between MySQL and MariaDB

#

I do recommend keeping the database normalized instead of using JSON

urban cloak
#

or does mysql not have tat

#

uuid array?

#

wtf why do people still use mysql its so shit

#

i just read it doesnt even have arrays

#

like wheres the advantage over postgres other than less features

eternal oxide
#

more widely supported

chrome beacon
#

You're supposed to normalize your database

#

instead of having an array directly in a column

urban cloak
#

sometimes normalizing it just doesnt make sense

smoky oak
urban cloak
#

i think he means that youre supposed to have only 1 value per table cell

#

so you eliminate arrays by making groupId just an index and have multiple rows with the same groupId

#

that way you can get all members of a group by filtering groupId and reading all rows returned

chrome beacon
urban cloak
#

but what if you tread the array as 1 value

#

not the contents of the array which would be multiple but just the array which would be 1

chrome beacon
#

The contents should be one value

#

when properly normalized

urban cloak
#

the contents of the cell is one value, namely one array

#

๐Ÿค”

chrome beacon
#

That array contains multiple values

#

and therefor should be normalized

eternal night
#

Least interesting discussion to date

urban cloak
#

databases support custom types nowadays, they arent one value either

eternal night
#

do whatever the fuck you want with your SQL, if it works for you, life is good. If it doesn't, run a DB migration

urban cloak
#

you could argue that an integer is multiple values too: 4 bytes

chrome beacon
#

It represents a single value

eternal night
#

now that I think about it, the entire DB is a single value

#

its all just a big byte blob

urban cloak
#

the array represents a single value, the "members of a group" is one value

#

cause its a list

#

and a list is one value

eternal night
#

well no, you can update parts of that value

#

that means it isn't a single value

chrome beacon
#

I'm just saying that storing a JSON string as an array in a column is a bad idea, but if you want to do so I can't stop you

urban cloak
#

if i cant update parts of that value (for example by storing it as JSON) then its one value

#

and json in that case is simply less efficient than a native array

eternal night
#

given you can update parts of it

urban cloak
#

they could be seen as such

eternal night
#

But tbh, members of a group in an array does sound complete ass. Unless pg has some mystical in-array indexing

urban cloak
urban cloak
eternal night
#

Yea and at that point one should be banned from database design

urban cloak
#

xd

mortal hare
#

why java doesnt have function scope static variables

#

i see it kinda useful for encapsulation of reusable constants which are being used exclusively within that static method

river oracle
#

What.. would be the use of that exactly?

mortal hare
#
public static void display() {
  final static Alert ALERT = new Alert(...);

  ...
  this::display.ALERT.show()
}
#

something like this would be pretty cool

river oracle
#

Okay now explain why this isn't possible with static fields

blazing ocean
#

...?

#

why would you need that

mortal hare
river oracle
river oracle
mortal hare
#

well i can move function without carrying the dangling static field outside

blazing ocean
#

and now explain how that is needed in java

river oracle
#

So basically you designed something poorly and need to cope so hard you need a language feature nah I get you tho

mortal hare
river oracle
#

Case in point

#

If you need it to be portable provide it as a parameter

mortal hare
#

what if i use that variable only within one function, what's the point of exposing the field outside the functions scope

river oracle
#

I think you're looking for something like Haskell you can find that out by the dumpster outside

mortal hare
#

muh OOP. if java was truly oop we would've never got lambdas

#

what's the point of lambdas

river oracle
#

I'm not having this argument you need help

mortal hare
#

hah

#

gotcha

#

i mean its not neccessary and stuff, but it would be pretty cool feature to have

blazing ocean
#

fucking autocorrect + my inability to type

chrome beacon
#

Java allows for multiple paradigms

river oracle
#

It gives you the choice to do some functional programming but it's nowhere near thr capabilities of any competent functional language

blazing ocean
#

kotlin

#

still not very functional but it gets you further than java

mortal hare
#

iirc static methods anyways are not living on top of the class implementation, they're stored outside of the class in bytecode level so having function scoped static fields are not something that's deal breaking in terms of compatibility

river oracle
#

Java at heart is based in OOP and it's fairly opinionated about it I mean see the language design

#

The exception would be enum and static methods but these are fairly sensible additions

granite crown
#

Go for Kotlin @mortal hare

mortal hare
#

fr, the more i want something out of java the more i see this

granite crown
#

It fit perfect for you ithink

blazing ocean
#

kotlin my beloved

chrome beacon
#

Didn't mean to send that one but sure it works

blazing ocean
#

hey that's mine

misty ingot
#

nice gif

#

i shall steal it

misty ingot
#

this channel really is 90% shitpost huh

pliant topaz
#

correct

blazing ocean
#

only noticed now?

misty ingot
#

i noticed last night

#

now its confirmed

#

btw map values are pass by value right

chrome beacon
#

More like a pointer

mortal hare
#

Map returns references due to generic parameters not wannabe primitives

#

unless you use fastutil maps

chrome beacon
#

Only primitives are pass by value

misty ingot
#

if i have a value that is a custom class
and i grab the value and use a setter of the class
will the map now have the updated class

slender elbow
#

yes

misty ingot
#

so ive been paranoid for nothing

chrome beacon
misty ingot
#

good.

slender elbow
#

all java is pass by value though

misty ingot
#

now thats what had me confused

#

if all java is pass by value

#

then is the map thing reference or nah

mortal hare
slender elbow
#

you're passing more so a pointer

#

indeed, C doesn't have references

misty ingot
#

ok so but the value will update automatically tho

#

so im good right

#

i dont have to put the updated class instance back in the map

mortal hare
chrome beacon
#

If you modify something inside of the object you got in the map then yes it's updated in the map

misty ingot
#

yeah the class has setters for all its internal stuff

chrome beacon
#

It's not copied

misty ingot
#

ok ok ok good

mortal hare
#

the only things in java that are copied are primitives

#

but you cant pass those directly into map

chrome beacon
#

(yet)

slender elbow
#

the reference to an object is copied, but not the underlying data of the object

mortal hare
#

you need to box int -> Integer, boolean -> Boolean object types

slender elbow
#

"reference to" here is key

misty ingot
#

hm.. mhm

mortal hare
#

IdentityHashMap: am i joke to you

proven kite
#

does anyone know how to make copy of a world and paste it?

#
World temp = Bukkit.getWorld("template");

lets say I got a world named "template"

#

and how do I create a new world thats name gonna be "duels" and it will look 1:1 to world "template"

#

cus I want to make copys of world for duels so when someone duels another player it creates this world and delets after.

misty ingot
#

i want to run a task to save all data when the plugin is being disabled
but spigot wont let me access any of the api once shutdown has started

#

are there any workarounds?

eternal oxide
#

do it IN onDisable not in a task. The scheduler is not available at that time

misty ingot
#

so it has to all be done on the main thread

eternal oxide
#

once onDisable fires yes

proven kite
misty ingot
proven kite
#

like when you disable your server or reload it or restart it it automaticly saves itself

misty ingot
#

i meant, all plugin data

#

into the db

proven kite
#

what data are you talking about?

#

oh

misty ingot
#

why the hell would i do the server's job

proven kite
#

like thats why I asked lol

#

I thought you wanted to do that.

misty ingot
#

but oh well

proven kite
#

@misty ingot could u help me real quick?

misty ingot
#

with what

proven kite
#

with this

#

like how do I create a new world that is copy of an existing world

#

in my plugin

#

???

misty ingot
#

if the arena is small you should use schematics

ancient plank
#

copy the folder, rename it to the desired name, then create the world gg

misty ingot
#

otherwise copying the whole world directory is the only way (^)

proven kite
#

I just want new worlds to avoid any glitches

misty ingot
#

then copy paste the whole world directory

#

give the directory a unique id-ed name

#

delete it after

proven kite
#

I dedicated my yt channel to bug finding Im mod on berry for finding glitches and found a lot of vespa glitches

#

I know how the duel mechanics should work

#

and Im trying to prevent every glitch from the start

misty ingot
#

also make sure to clear it up when the server starts, in case theres any leftover dirs from a crash

proven kite
misty ingot
#
void createNewWorld(World world){
     File worldDir = world.getWorldFolder();
     String newName = world.getName() + "_temp";
     FileUtils.copyDirectory(worldDir, new File(worldDir.getParent(), newName));

     WorldCreator creator = newWorldCrator(newName);
     World newWorld = Bukkit.createWorld(creator);
}
#

for giving it a unique id, literally like make an iterator variable

proven kite
#

FileUtils dont work for me idk why

#

I tried it cus I asked chat gpt first

misty ingot
#

well you might want to find out why it doesnt work

proven kite
#

and it just doesnt lett me use it

proven kite
ancient plank
#

time for a

misty ingot
#

well i have told you the basic outline

proven kite
misty ingot
#

its time for a google search

ancient plank
#

i haven't done this in a while

#

?learnjava

undone axleBOT
#

For Beginners:

Codecademy - Learn Java: Interactive Java programming course from basics to more advanced concepts. Perfect for absolute beginners.
https://www.codecademy.com/learn/learn-java
JetBrains Academy - Java Developer Track: Learn by doing with projects and challenges. It covers Java fundamentals to advanced topics.
https://www.jetbrains.com/academy/
Udemy - Java Programming Masterclass for Software Developers: Updated courses that cover Java 8 to Java 17 features. Suitable for those who prefer structured learning.
https://www.udemy.com/course/java-the-complete-java-developer-course/

For Intermediate to Advanced Learners:

Oracle Java Tutorials: The official guides by Oracle for Java programmingโ€”great for understanding the depth of Java.
https://docs.oracle.com/javase/tutorial/
Baeldung - Learn Java and Spring: Focus on Spring Framework and modern Java technologies. Best for intermediate learners aiming to expand their knowledge.
https://www.baeldung.com/

Practice and Hands-on Learning:

Exercism - Java Track: Solve exercises and get feedback from mentors. Great for practicing coding skills.
https://exercism.io/tracks/java
LeetCode: Practice your coding skills and prepare for technical interviews with Java.
https://leetcode.com/

Free Resources and Documentation:

Java Programming and Documentation: A comprehensive collection of Java programming guides, tutorials, and API documentation.
https://docs.oracle.com/en/java/

Community and Support:

Stack Overflow: A vast community of developers. Great for getting help with specific problems or understanding concepts.
https://stackoverflow.com/questions/tagged/java
r/learnjava on Reddit: Join the community of Java learners and get advice, share resources, and discuss projects.
https://www.reddit.com/r/learnjava/

Remember: Learning to program takes practice and patience. Don't hesitate to experiment with code and participate in community discussions. Happy coding! ๐ŸŽ‰

misty ingot
#

ah, so thats what the command was

proven kite
#

learnjava

misty ingot
#

anyway, good luck

proven kite
#

๐Ÿ’€

proven kite
grim hound
#

Are skull textures loaded by doing an io request to some api with the image of the skin?

wet breach
#

yes and no

grim hound
#

So they wouldn't load offline?

wet breach
#

first the cache is checked for said player texture otherwise it then does a request to mojang servers for it

grim hound
#

Okay

misty ingot
#

im actually doing .setOwningPlayer on a skull to an offlineplayer and it doesnt seem to work if they are actually offline

grim hound
#

Are there any special measures you can take

#

To extract just the head or just left leg for example

wet breach
#

left leg? For skull?

grim hound
#

From a normal texture as in

#

I have a player named Shadow

#

I want to give the player head the texture of just the left leg

wet breach
#

don't think that would work without cutting off some of the leg

grim hound
proven kite
#

@misty ingot could you tell me how are you able to use FileUtils?

wet breach
#

the way texture png works is there is a predefined area of the png and size for each of the parts

proven kite
#

omg

grim hound
#

Can you somehow generate custom textures on the spot?

wet breach
#

and t hen the game basically does origami folding of said png to make the 3d of it

wet breach
#

the textures just need to be in the right positions in the data of the textures

proven kite
#

?help

wet breach
#

I forget how far in the png format where data would be expected to start and end for each section but I am sure you could probably find some wiki on it

ancient plank
proven kite
#

I will keep on guessing

ancient plank
#

I will time you out

proven kite
#

omfg

#

there

#

I thought it was a list of commands...

wet breach
#

probably should listen to the staff

grim hound
# wet breach sure

I mean like: I want to generate a custom skull based on dynamic parameters

wet breach
#

ok?

ancient plank
#

I've always wanted to do skin splicing in minecraft

wet breach
#

I already state it is possible to generate dynamic textures on the fly, not sure how asking the same question but in a different way would change that response

ancient plank
#

it shouldn't be too hard since skins are a set format

wet breach
#

there is a format to the textures

#

where each body part starts and begins

#

so think of 2d format, and then the game takes that 2d and folds the image to form the 3d model

proven kite
#
                        FileUtils.copyDirectory(new File(Bukkit.getWorldContainer(), "hello"), new File(Bukkit.getWorldContainer(), "new_world"));

is it possible to use some alternative for FileUtils?

wet breach
#

as long as you know the areas for these body parts in the png format, you can just feed the data directly into the method

#

instead of feeding a file. Since the file just gets read in as bytes, you could just give the bytes instead

ancient plank
#

I suggest loading pmcskin3d on planetminecraft and looking at where edited points go to see the zoning for each limb texture

mortal hare
#

might be dumb question, but is there any hack to return two distinct values which i can reference in java without creating an object for them to be stored? Arrays and lists are not an option here, nor wrappers. im thinking whether there's some kind of hacky way to do this

#

something like c++ references passed via arg or smth

mortal hare
#

reference values

#

object references

#

void foo(bar& bar, baz& baz); looking smth like this from c++

#

probs there's no such thing, even it was i would need to probably wrap the object somehow

wet breach
mortal hare
#

yeah

wet breach
#

you could just use a static for that

mortal hare
#

i want a helper static function

mortal hare
wet breach
#

static can store object references fyi

mortal hare
#

yea

wet breach
#

even classes

mortal hare
#

i just want to reuse same user field objects

#

for each edit user dialog

wet breach
#

which is handy when you want to create a dynamic loading of classes depending on certain parameters IE versions ๐Ÿ˜›

mortal hare
#

since there will be only one instance of it

wet breach
mortal hare
#

yeah its java fx thing, that i've made its a form for editing user

#

maybe bad wording here

wet breach
#

that is how you would use a static method that gets current instance or makes one for singleton pattern ๐Ÿ™‚

#

there is other ways, such as lazy loading etc

misty ingot
#

i have never even touched worlds related stuff, and dont plan to for a while

cunning solstice
#

uhhh idk why vault isn't working

Could not determine the dependencies of task ':shadowJar'.
> Could not resolve all dependencies for configuration ':runtimeClasspath'.
   > Could not find org.bukkit:bukkit:1.13.1-R0.1-SNAPSHOT.
     Searched in the following locations:
       - https://repo.codemc.io/repository/maven-releases/org/bukkit/bukkit/1.13.1-R0.1-SNAPSHOT/maven-metadata.xml
       - https://repo.codemc.io/repository/maven-releases/org/bukkit/bukkit/1.13.1-R0.1-SNAPSHOT/bukkit-1.13.1-R0.1-SNAPSHOT.pom
       - https://repo.codemc.io/repository/maven-snapshots/org/bukkit/bukkit/1.13.1-R0.1-SNAPSHOT/maven-metadata.xml
       - https://repo.codemc.io/repository/maven-snapshots/org/bukkit/bukkit/1.13.1-R0.1-SNAPSHOT/bukkit-1.13.1-R0.1-SNAPSHOT.pom
       - https://repo.extendedclip.com/releases/org/bukkit/bukkit/1.13.1-R0.1-SNAPSHOT/maven-metadata.xml
       - https://repo.extendedclip.com/releases/org/bukkit/bukkit/1.13.1-R0.1-SNAPSHOT/bukkit-1.13.1-R0.1-SNAPSHOT.pom
       - https://jitpack.io/org/bukkit/bukkit/1.13.1-R0.1-SNAPSHOT/maven-metadata.xml
       - https://jitpack.io/org/bukkit/bukkit/1.13.1-R0.1-SNAPSHOT/bukkit-1.13.1-R0.1-SNAPSHOT.pom
       - https://repo.maven.apache.org/maven2/org/bukkit/bukkit/1.13.1-R0.1-SNAPSHOT/maven-metadata.xml
       - https://repo.maven.apache.org/maven2/org/bukkit/bukkit/1.13.1-R0.1-SNAPSHOT/bukkit-1.13.1-R0.1-SNAPSHOT.pom
       - https://repo1.maven.org/maven2/org/bukkit/bukkit/1.13.1-R0.1-SNAPSHOT/maven-metadata.xml
       - https://repo1.maven.org/maven2/org/bukkit/bukkit/1.13.1-R0.1-SNAPSHOT/bukkit-1.13.1-R0.1-SNAPSHOT.pom
     Required by:
         root project : > com.github.MilkBowl:VaultAPI:1.7

Possible solution:
 - Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html
#

i litteraly got everything:

repositories {
    maven {
        name 'papermc'
        url 'https://repo.papermc.io/repository/maven-public/'
        content {
            includeModule("io.papermc.paper", "paper-api")
            includeModule("io.papermc", "paperlib")
            includeModule("net.md-5", "bungeecord-chat")
        }
    }

    maven {
        name 'minecraft'
        url 'https://libraries.minecraft.net'
        content {
            includeModule("com.mojang", "brigadier")
        }
    }

    // PacketEvents repositories
    maven { url = uri("https://repo.codemc.io/repository/maven-releases/") }
    maven { url = uri("https://repo.codemc.io/repository/maven-snapshots/") }

    // PlaceholderAPI repository
    maven {url = 'https://repo.extendedclip.com/releases/'}

    // Vault repository
    maven { url 'https://jitpack.io' }

    // Additional repositories
    maven { url = 'https://repo.maven.apache.org/maven2' }
    maven { url = 'https://repo1.maven.org/maven2' }

    mavenCentral()
}

dependencies {
    compileOnly 'io.papermc.paper:paper-api:1.21.4-R0.1-SNAPSHOT'
    compileOnly 'com.github.spotbugs:spotbugs-annotations:4.8.6'
    implementation 'io.papermc:paperlib:1.0.8'
    spotbugsPlugins 'com.h3xstream.findsecbugs:findsecbugs-plugin:1.13.0'
    testCompileOnly 'com.github.spotbugs:spotbugs-annotations:4.8.6'
    testImplementation 'io.papermc.paper:paper-api:1.21.4-R0.1-SNAPSHOT'
    testImplementation 'org.junit.jupiter:junit-jupiter:5.11.4'
    testRuntimeOnly 'org.junit.platform:junit-platform-launcher:1.11.4'

    // PacketEvents dependencies
    compileOnly("com.github.retrooper:packetevents-spigot:2.7.0")

    // PlaceholderAPI
    compileOnly 'me.clip:placeholderapi:2.11.6'

    // Vault
    implementation "com.github.MilkBowl:VaultAPI:1.7"
}
#

is vault repository is down or?

eternal night
#

you are limiting the paper repo to paper artefacts

#

when that is where the bukkit dep comes from

cunning solstice
#

come again?

eternal night
#
    maven {
        name 'papermc'
        url 'https://repo.papermc.io/repository/maven-public/'
        content {
            includeModule("io.papermc.paper", "paper-api")
            includeModule("io.papermc", "paperlib")
            includeModule("net.md-5", "bungeecord-chat")
        }
    }
#

the bukkit dependency is not hosted on jitpack

#

it is pulled in from spigot or paper repos

#

but you are marking the paper repo to only be used for resolving the above 3 modules ^

#

so add includeModule("org.bukkit", "bukkit")

cunning solstice
cunning solstice
#

ummmm idk if it made it worse or better

#
Execution failed for task ':compileJava'.
> Could not resolve all files for configuration ':compileClasspath'.
   > Could not resolve io.papermc.paper:paper-api:1.21.4-R0.1-SNAPSHOT.
     Required by:
         root project :
      > Module 'io.papermc.paper:paper-api' has been rejected:
           Cannot select module with conflict on capability 'org.bukkit:bukkit:1.21.4-R0.1-SNAPSHOT' also provided by [org.bukkit:bukkit:1.13.1-R0.1-SNAPSHOT(compile)]
   > Could not resolve org.bukkit:bukkit:1.13.1-R0.1-SNAPSHOT.
     Required by:
         root project : > com.github.MilkBowl:VaultAPI:1.7
      > Module 'org.bukkit:bukkit' has been rejected:
           Cannot select module with conflict on capability 'org.bukkit:bukkit:1.13.1-R0.1-SNAPSHOT' also provided by [io.papermc.paper:paper-api:1.21.4-R0.1-SNAPSHOT(apiElements)]

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
For more on this, please refer to https://docs.gradle.org/8.12/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.
BUILD FAILED in 1s
1 actionable task: 1 executed
#

ig maybe vault api doesn't support it

#

i'll create my own currency system or smt

remote swallow
#

It's caused by vault having a transitive dep of bukkit

#

If you exclude bukkit from the vault api dep it should work

eternal oxide
#

just move vault down in your dependency list

cunning solstice
#

nothing helped

#

ima create my own

misty ingot
#

I used .equals() instead of equalsIgnoreCase() in checking database type and spent 15 minutes figuring out why the disbanded guilds wouldnt get deleted ๐Ÿ™‚

#

i love java

viscid maple
#

hey what a problem

PacketContainer packet = protocolManager.createPacket(PacketType.Play.Server.ENTITY_METADATA);
            WrappedDataWatcher dataWatcher = new WrappedDataWatcher(entity.getBukkitEntity());
            WrappedDataWatcher.Serializer chatSerializer = WrappedDataWatcher.Registry.getChatComponentSerializer(true);
            WrappedDataWatcher.WrappedDataWatcherObject watcherObject = new WrappedDataWatcher.WrappedDataWatcherObject(2, chatSerializer);
            Optional<Object> optional = Optional.of(WrappedChatComponent.fromChatMessage(entity.getBukkitEntity().getCustomName())[0].getHandle());
            dataWatcher.setObject(watcherObject, optional);
            dataWatcher.setObject(3, true);
            packet.getIntegers().write(0, entity.getBukkitEntity().getEntityId());
            packet.getWatchableCollectionModifier().write(0, dataWatcher.getWatchableObjects());
            NMSPacketWrapper.sendPacket(packet, packetData);

[17:10:17 ERROR]: Error sending packet clientbound/minecraft:set_entity_data (skippable? false)
io.netty.handler.codec.EncoderException: Failed to encode packet 'clientbound/minecraft:set_entity_data'

chrome beacon
#

1.19.3

#

I believe

echo basalt
#

.

#

sumn like that yeah

viscid maple
#

a okey thanks hah

#

i use 1.21.3

#

lots of new developments and I'm still getting lost

smoky oak
# echo basalt .

do ya actually havev a list like that somewhere or did you just write that down from memory?

blazing ocean
echo basalt
#

^

#

I write these guides when I feel like it and reference back to them often enough

#

some are pinned, some are not

smoky oak
#

ah

#

i just tag my messages in another server with a not so random string of letters

#

helps me find em again

#

havent written anything noteworthy here yet tho ๐Ÿ™ƒ

viscid maple
#

thx works

grim hound
#

Doesn''t the "textures" nbt contain the url to the servers?

#

Only thing I found is that it needs go be some kind of url, can even local

#

But, well, as you can imagine, it wouldn't work for me to have the url point locally

rough ibex
#

the client refuses urls that are not a certain domain

#

you could exploit that and use the education minecraft thing to get a texture URL under that but they fixed it

grim hound
#

So how can I go about creating custom head textures dynamically

#

Ideally without uploading anything anywhere

misty ingot
#

is there a way to get the skull of a player who is offline? (i have their UUID)

rough ibex
#

its easy and theres a webapi and plugin

chrome beacon
#

Mineskin will upload the skins for you

summer scroll
#

Hello, i've been using this serializer for ItemStack to sync inventories accross servers https://gist.github.com/graywolf336/8153678, but recently i've encountered an issue where i cannot deserialize ItemStack from newer version of minecraft to older version of minecraft, is there any possible solution to this?

chrome beacon
#

Downgrading items won't work magically

#

You'd need to write your own adapter

pseudo hazel
#

yeah thats simply because the ood server does not have the new item definition so it doesnt know how to load things it never saw

summer scroll
#

That's tough, yeah just wondering if anyone has solution to this, this thing never occurred to me only after working on this specific features for weeks lmao.

misty ingot
#

is there a way to get the commandsender as an argument in the command completion processing in ACF?
basically i wanna have a commandcompletion where it shows the options depending some factors related to the player

#

also how can i use flags like -s in my commands in ACF

#

nvm i think i got the first one, but still wondering about flags

viscid maple
#

I have a question if it is possible to do sectors on po via protocollib and would it be efficient?

crisp forum
#

Is there any event that detects both right click equips and inventory click equips on armors

chrome beacon
crisp forum
#

thanks

smoky oak
#

can i query FOV

chrome beacon
#

no

smoky oak
#

darn

#

i was planning on making a HUD outta particles

blazing ocean
#

don't

pliant pulsar
#

Is there a way to generate an update folder on bungee like spigot it already has?

#

I wanna write an auto updater for my plugin so the user doenst have to do it manual every time

misty ingot
#

how can i use command flags like -s in ACF
and how can i set custom messages for things like command not found

fickle spindle
#

if getItemInHand is deprecated what i should use?

chrome beacon
#

It should tell you in the deprecation note

chrome beacon
#

That's the context menu

fickle spindle
chrome beacon
#

You can see the deprecation note when hovering over the method if Javadocs are downloaded

#

otherwise you can check the javadoc in your browser

#

?jd-s

undone axleBOT
chrome beacon
#

Javadocs are missing

#

also you're not using Spigot

#

?whereami

fickle spindle
chrome beacon
#

That does not look like Spigot

fickle spindle
#

fixed ๐Ÿ™‚

#

how can i dowload the javadocs? it's like a plugin that i need to add?

mortal vortex
#

No

chrome beacon
#

Open the maven/gradle tab and click download sources

fickle spindle
#

okay i dowloaded it now where i can find it?

chrome beacon
#

Now you can hover over the method again

#

And it should show more info

fickle spindle
#

okay thanks a lot for that last question and sorry for disturbing, now everytime i want the docs i have to dowload it or i directly have it in any my new project?

chrome beacon
#

Just new projects or when you update Spigot version

fickle spindle
#

thanks a lot for your time and sorry for disturbing you

slender elbow
wet breach
#

Sorry for late reply. Went to bed lol. Now am at work

#

However you could skip the url part if i am not mistaken. You only need that api portion to fetch the texture but if you already have it you dont need to use that

chrome beacon
#

The client won't accept random urls nor can you create the texture file in memory without modifying or having access to the client

wet breach
chrome beacon
#

There is only one solution which is to upload the skin to mojang servers. Mineskin will help you do that

wet breach
#

The other solution i can think of is swapping the player out for a display entity

#

Then you can give them whatever texture you want without the constraints of the player model

chrome beacon
#

Yeah actually that would also be possible

#

Load the texture with a resource pack and then have a model for the entity

mortal hare
#

WTF is wrong with oracle's way of writing SQL

#

who tf writes comma at the beginning

coarse pelican
#

unique people

mortal hare
#

this is just cursed

rough ibex
#

*DISTINCT people

mortal hare
misty ingot
#

theres also people who write the opening bracket on the NEXT LINE in cs or cpp or java and stuff and i hate all of them

#

if () {
they do

if ()
{
blazing ocean
#

tbh it's not as bad

#

there's way worse coding styles, like md's

rough ibex
#

The gnu style is worse

paper viper
mortal vortex
#

Oh wait isn't gnu when its:

if ()
  {
    ..
  }
#

APL is what's truly cursed:

primes โ† {โต/โจโตโˆŠโจ(2=+/โˆ˜.=โจ)ยจโต}
sullen marlin
sullen marlin
misty ingot
#

i hate everyone who doesnt follow the same coding conventions as me

its time to bring racism to programming

#

btw any way to get the player head item for a player who is currently offline?

eternal oxide
#

OfflinePlayer#getPlayerProfile()

#

create head ItemStack and apply that profile

trim lake
#

Hi, I have again some coding practice question. Is this rly bad usage of exception? I kinda want to give acurate message what went wrong. I probably can do it for each method to return some boolean only, whould that be better or this is oke? (There is more requirements I cut them just to showcase code)

private List<Requirement> loadRequirements(YamlConfiguration yamlConfiguration) throws Exception {
        List<Requirement> requirements = new ArrayList<>();
        if (isToolTypeRequirementSet(yamlConfiguration)) {
            if (validateToolTypeRequirement(yamlConfiguration)) {
                ToolTypeRequirement req = loadToolTypeRequirement(yamlConfiguration);
               requirements.add(req);
            }
        }
        return requirements;
    }

private boolean isToolTypeRequirementSet(YamlConfiguration yamlConfiguration) {
        return yamlConfiguration.isSet("tool-settings.tool-type");
    }

    private ToolTypeRequirement loadToolTypeRequirement(YamlConfiguration yamlConfiguration) {
        System.out.println("Load tool type req");
        List<String> materialStrings = yamlConfiguration.getStringList("tool-settings.tool-type");
        String message = yamlConfiguration.getString("messages.wrong-tool-type");
        return new ToolTypeRequirement(materialStrings.stream().map(ToolType::valueOf).toList(), message);
    }
    

    private void load(YamlConfiguration yamlFile) {
        String name = yamlFile.getString("name");
        Material material = Material.valueOf(yamlFile.getString("material"));
        ConfigurationSection locationSection = yamlFile.getConfigurationSection("location");
        World world = Bukkit.getWorld(locationSection.getString("world"));
        int x = locationSection.getInt("x");
        int y = locationSection.getInt("y");
        int z = locationSection.getInt("z");
        double maxHp = yamlFile.getDouble("max-hp");
        Location location = new Location(world, x, y, z);
        ConfigurationSection respawnSection = yamlFile.getConfigurationSection("respawn-settings");
        Material respawnMaterial = Material.valueOf(respawnSection.getString("material"));
        int respawnTime = respawnSection.getInt("time");
        List<Requirement> requirements;
        try {
            requirements = loadRequirements(yamlFile);
        }catch (Exception e) {
            System.out.println(yamlFile.getName() + " is not loaded because of: " + e.getMessage());
            return;
        }
        this.meteors.put(location, new Meteor(this.getPlugin(), name, material, location, maxHp, respawnMaterial, respawnTime, requirements));
    }
undone axleBOT
valid burrow
#

for code snippets this long

#

also thats literally what exceptions are for

#

to tell what exactly went wrong

#

but you should probably make your own exception classes if you wanna use em like that

quaint mantle
#

Does a change in the item slot call InventoryClickEvent?

sullen marlin
#

no

#

only inventory clicks call inventory click event

quaint mantle
#

Thanks

#

How can I make sure that an item in a specific slot cannot be changed in a player's inventory?

sullen marlin
#

Changed how

twin venture
#

hi i need help ๐Ÿ˜ anyone good with php , larvel ?

#

no images or js work why?

#

i have everything there i checked permissions

trim lake
trim lake
# valid burrow but you should probably make your own exception classes if you wanna use em like...

nothing rly went wrong I was just asking if isnt it bad for performance or some other reason. I saw most of plugins just no handle that witch will crash enteire plugin, but I dont want that bcs of user erorr in file. I just discover I can carry the Exception with message true multiple methods I was shodek (idk why lol), I was about make some custom class for that (not exception). So thats all what I need to know. Just trying to be good and have good practices. Thanks a lot.

quaint mantle
wet breach
#

php isn't the reason

#

-.-

misty ingot
twin venture
torn shuttle
#

๐Ÿฅฒ always good

#

love hitting the intellij error cap

#

that's how I know I'm having fun

young knoll
#

At least thereโ€™s only 1 warning!

torn shuttle
#

I love reinventing the wheel

#

love having to rewrite a command system

#

especially love doing that 3x

#

also it seems like I sort of forgot to go to bed

#

I think I've been up for 25h?

eternal oxide
#

The programmers curse. Just another 5 minutes and I'll be done...

torn shuttle
#

well

#

just kinda got it to do what i wanted it to do

#

think I'll just go to bed and clean it up tomorrow

smoky oak
#

qq, how do i delete a chunk via code

amber fjord
smoky oak
#

2nd

#

i can just set all blocks to air and remove entities but im unsure how to clear it from the mca

amber fjord
#

oh idk sbout that but the first seems relatively easy

#

?jdocs

#

?javadoc

amber fjord
smoky oak
#

see thing is thats server side

amber fjord
#

if that could work

#

Isnt that what you want?

smoky oak
#

well i can check the event thing

#

depends if a chunk's base state is saved or not when it generates

amber fjord
#

so what exactly do you want to do then?

smoky oak
#

prevent elytra trails from fucking up disc space

blazing ocean
amber fjord
#

setSaveChunk(false) method

smoky oak
#

ah. good point, i can just keep track of the flying state

#

if no player ever leaves said state in said chunk, and doesn't enter it otherwise, its safe to discard

#

though i worry about the PlayerMoveEvent causing lag

amber fjord
#

Maybe

#

or override inside the chunk load and unload events to the player move event but idk how that works

#

yeah that makes no sense in hindsight

#

Theres no method to get the player that loaded the chunk

#

or maybe

rotund pond
#

Hello everyone !

I'd like to know if you guys know a way to change the time required to eat some food ๐Ÿค”
I mean, like extending the eating time

I know I can't do that using events because it sounds like it's handled client-side, but I'm wondering if I can fake it somehow using packets with ProtocolLib or else

amber fjord
rotund pond
#

ah ?

amber fjord
#

not even spigot

#

nvm not attributes but some command

#

idk which

rotund pond
#

๐Ÿค”

#

Well, if something has a hint it would be nice ๐Ÿ™

chrome beacon
#

It's missing in the API atm

rotund pond
amber fjord
#

its in the latest versions tho

rotund pond
#

Thank you !

chrome beacon
#

Please refer to the wiki link I sent

misty ingot
amber fjord
#

@smoky oak i have an idea for you

#

it might be a dead end but idk

#

if you get the world then get all the players

#

then you can constantly check if each player has the chunk loaded and is wearing an elytra

#

and if they unload a chunk and that chunk is unloaded at the same time

#

that sounds like sloppy code but it could work

#

maybe

pure dagger
#

how do i fix this.. i am trying
error: invalid target release: 19

SDK openjdk-19 is not compatible with the module jobs language level 19 in chosen run configuration jobs [package].

Change the version of JRE in the Maven Run Configuration

worthy yarrow
#

Well you change the jre version in the maven run configuration of course

pure dagger
#

i dont really know how this works

#

where to change it ?

worthy yarrow
misty ingot
#

is there a way to run a specific method like

String abc = "one";
lang.get{abc}();
String def = "two";
lang.get{def}();

basically the method thats being run is changed if the string has a diff value

worthy yarrow
#

You could do a simple if else

misty ingot
#

well i could yes

#

but lets just say theres a few too many strings

worthy yarrow
#

Ternary otherwise if I had to guess

misty ingot
worthy yarrow
#

Switch then perhaps?

#

How many we talking?

misty ingot
#

i have a list of enums

#

depending on the enum

#

i run a diff method

#

lets say like 15 enums

worthy yarrow
#

So then couldnโ€™t you just differentiate based on the enum itself?

#

Doesnโ€™t sound too bad

#

But also 15 what the fuck

misty ingot
#

well the string thing was an example

#

the thing im trying to do is not have to write a seperate statement for each enum

#

the method names are the same except the part with the enum's name

worthy yarrow
#

Gotta work now sorry mate

misty ingot
#

understandable

wet breach
misty ingot
#

basically

#

i have a list of enums, each enum is meant to refer to a specific cosmetic effect

#

for each cosmetic effect i have to grab the name and description of said effect from the lang.yml file

#

i am using configlib so instead of that its a get method in a class to grab the name, and description, seperately

pure dagger
misty ingot
#

since theres quite a lot of cosmetic effects i wanna know if theres a way to do this without having a match case or a tower of ifs

#

because readability, and also maintaining

wet breach
#

what you need is a map

misty ingot
#

hm i do indeed need a map

smoky oak
pure dagger
#

whats everything ๐Ÿ˜ญ

misty ingot
#

go into your pom.xml

#

and also your build configuration if you are using intellij (idk for eclipse)

#

change all the java version stuff to 21

#

and install the jdk

#

then try

pure dagger
misty ingot
#

yes

#

under maven options and also java options

pure dagger
#

the JRE ?

misty ingot
#

yes

#

set it to openjdk 21

pure dagger
#

what i there is no 21

misty ingot
#

then download it

pure dagger
#

i have to download

misty ingot
#

correct

pure dagger
#

thankss

misty ingot
#

after this also change it in your pom

pure dagger
#

i changed

misty ingot
#

good job

#

now compile

upper hazel
#

archetypal question. What is the best strategy for storing player role properties

#

for future expansion

worldly ingot
#

Well what are these properties? Very vague

#

What do they do? How are you representing them?

upper hazel
#

usable properties

#

i can use imp classes or map<String,Object>

#

but idk

chrome beacon
#

That doesn't really explain anything

upper hazel
#

ok for example effects

#

potion effects

#

custom effects

#

check type and use effects what role has

#

the roles are very different in properties

#

hard coding ๐Ÿ™‚

#

not just 1 role with all options

echo basalt
#

ECS GigaChad

thorn crypt
#

Hey, anyone here able to fork the Factions plugin by MassiveCraft and able to edit it a bit ? ๐Ÿค”

echo basalt
#

?services

undone axleBOT
sinful iron
#

hello, how do i add custommodelData if minecraft 1.21.4 is using strings now cuz i see the setCustomModelData(int)

echo basalt
#

think I've done it before

echo basalt
#

Not sure if spigot has an API for it but the one who shall not be named does

sinful iron
#

so i use this? void setStrings(List<String> strings) Sets a list of the custom strings.

echo basalt
#

Yeah

sinful iron
#

alrighty, thanksss

fickle spindle
#

i want to make a snowball launcher
Snowball ball = p.getWorld().spawn(p.getEyeLocation(), Snowball.class); ball.setShooter(p); ball.setCustomName("diamond"); ball.setVelocity(p.getLocation().getDirection().multiply(4.5));
and everything work fine but the problem is that when i call the ProjectileLaunchEvent it say null for the shooter and null cof the custom anme

echo basalt
#

Probably because the event fires before setShooter

fickle spindle
#

and how i can make the opposit way?

echo basalt
#

There's a spawn method that takes a consumer

#

You can modify the entity in that consumer and it'll do whatever

#

Pretty sure that'll work

#

worst case scenario you just use launchProjectile instead

fickle spindle
#

can u explain it for a stupid guy?

echo basalt
#

no

fickle spindle
#

okay

chrome beacon
#

Pass a lambda as the consumer and modify the snowball there

#

That will ensure it's modified before being spawned

echo basalt
#

TIL ProtocolLib has an auto wrapper thing

#

where you can make your own lil class and it'll wrap

#

nvm it crashed my client

#

๐Ÿ‘€ I think I found a fucked bug

#

might be a minecraft bug

floral drum
#

ooo

misty ingot
#

how can i check if a projectile has no velocity

echo basalt
#

and I've legit got no clue how it happened

#

because it's sporadic

floral drum
#

what the fuckkkk

misty ingot
#

excuse me waht the ufck

echo basalt
#

zero clue how to fix as well

#

I'll just add 10k to every entity id I got

#

thing is I'm using atomic ints so this should never happen

misty ingot
echo basalt
#

this soulds like a commission

misty ingot
#

it is not

#

unfortunately

#

i figured out the velocity part

#

but whats the fastest method to grab em all (iterate over all of them)

echo basalt
#

getEntities in the world or something?

#

then filter by projectile source and do whatev

misty ingot
#

oh ok

#

im already doing that

#

was wondering if i was skipping over some faster method

echo basalt
pseudo hazel
#

oof

#

casting skill issue

echo basalt
#

skill issue

#

using protocollib for this

#

they lack wrappers for hella things and metadata is broken for <1.19.3

#

because their data watcher just fires some error

pseudo hazel
#

just use packetevents smh

echo basalt
#

smh nah

pseudo hazel
#

oh rght because working with something that actually does the job is unfavorable

echo basalt
#

cba using it ngl

#

this works

#

just need to do raycasting and I can finally move on from this proj

chrome beacon
echo basalt
#

I actually cba now that it's done

misty ingot
#

how would i go about making it so the particles my plugin makes are only shown to certain players

echo basalt
#

player.spawnParticle

#

read the docs

misty ingot
#

wouldnt it be a bit slow to loop through all these projectiles and also have a nested loop through a list of players and spawn them for each individually

misty ingot
tidal kettle
#

hey i see when using head in an inventory (with offline player), the head is a steve /alex head (or a basic skin), but when i update the inventory like 10 tick later, the heads has texture. Can i check if a head has a model ans is not a basic skin (also the head already has a owner)

mortal hare
#

i have serious doubts that the person who created this havent heard of enums

zealous osprey
#

#isBush #isStone #isGrass ...

misty ingot
shadow night
fickle spindle
#

how can i fix the problem that when i try to type in a plugin that i dowloaded it says FIle is read only?

rough ibex
#

Why are you modifying a dependency?

misty ingot
#

i think hes trying to modify plugin source code

blazing ocean
merry cove
mortal hare
#

its not mine

#

im actually replacing bunch of this shit

#

with my ECS

#
        // TODO: Experimental
        final me.dovias.battlecity.scene.Scene gameScene = Game.scene();

        final Transform transform = Transform.of(0, 0, 48, 48, Direction.UP);
        final Entity entity = gameScene.components().entities().attach(
            transform,
            Sprite.resource("/assets/bush.png", transform)
        );

        for (final Sprite sprite : gameScene.components().type(Sprite.class)) {
            final IntVector2D position = sprite.transform().size();
            final IntVector2D size = sprite.transform().size();
            final Rectangle rectangle = new Rectangle(position.component1(), position.component1(), size.component1(), size.component2());
            rectangle.setFill(new ImagePattern(new Image(sprite.stream())));

            root.getChildren().add(rectangle);
        }
#

finally my ECS api works as i've intended it and i can attach multiple renderer pipelines through it (javafx, native opengl)

#

i've had plans for native opengl renderer but it took way too much time and im already rushing this

fervent rampart
#

Does somebody have a way to manipulate Sign-Content in 1.21.4?
I wanted the user to enter a number at a specific position on a written sign.
So I tried the following to set a sign:

  1. sendBlockChange Packet
  2. actually setting a sign near the player

In combination with either of the following to open the sign:

  1. player.openSign(sign)
  2. Open Sign Editor Packet
    With sendSignChange or BlockChange or Tile Entity Data update Packet to the server/player.
    Without and with delay.

Since there is no ProtocolLib build for 1.21.4 - and the last patchs plugin not working - I assume I did make a mistake which I dont see.
The farthest Ive archived this is setting a sign with content (on both sides), but as soon as I open the sign in any way, the Sign GUI is completely empty.

bronze laurel
#

Hello, what is a good way to register a command with reflection easily in Spigot?

#

I can't find much information on the topic online.

unborn hollow
#

how do you break out of a BukkitTask loop from within the BukkitTask?

chrome beacon
#

PacketEvents is also an alternative

undone axleBOT
mortal hare
#

using datapackRegistry object iirc

worthy yarrow
#

@bronze laurel

fervent rampart
bronze laurel
mortal hare
#

my bad, i thought you meant native commands, but i guess you want to have compatibility with bukkit api

#

brigadier commands arent friendly to bukkit api as bukkit command api impl that's present in Spigot and Paper is a big hack on top of brigadier

bronze laurel
#

Thank you.

worthy yarrow
#

I mean it already registers to the command map but sure

chrome beacon
fervent rampart
chrome beacon
#

Yeah I know what a version number is

#

I'm just asking about what version number you want

#

and why

fervent rampart
#

Since on spigot nor on their CI there is a listed version that supports 1.21.4

chrome beacon
#

As I mentioned the latest one (739) will work

bronze laurel
#
        try {
            Field field = Bukkit.getServer().getClass().getDeclaredField("commandMap");
            field.setAccessible(true);
            CommandMap map = (CommandMap) field.get(Bukkit.getServer());
            map.register(name, command);

        } catch (NoSuchFieldException | IllegalAccessException e) {
            e.printStackTrace();
        }
    }```