#help-development

1 messages · Page 1171 of 1

candid ivy
#

is better

#

but aint required

wraith imp
#

A moderator on fabricmc discord helped me resolve this

kind hatch
# candid ivy but aint required

It would be required since those are modifications to the hashmap.
They would run into a ConcurrentModificationException if they are modifying the same map on different threads at the same time.

candid ivy
#

idk

#

im not thread pro

bold plume
#

It only occurs if I iterate through the hashmap, but I would just use .get and .put

bold plume
candid ivy
#

cuz its more safe

#

and like he said

bold plume
#

so should i use sychronized

candid ivy
#

use concurrent when multi threaded

#

and hashmap

#

when single

rough ibex
#

Instesd of relying on chatgpt

bold plume
rough ibex
#

Note that this implementation is not synchronized. If multiple threads access a hash map concurrently, and at least one of the threads modifies the map structurally, it must be synchronized externally. (A structural modification is any operation that adds or deletes one or more mappings; merely changing the value associated with a key that an instance already contains is not a structural modification.) This is typically accomplished by synchronizing on some object that naturally encapsulates the map. If no such object exists, the map should be "wrapped" using the Collections.synchronizedMap method. This is best done at creation time, to prevent accidental unsynchronized access to the map:

Map m = Collections.synchronizedMap(new HashMap(...));

The iterators returned by all of this class's "collection view methods" are fail-fast: if the map is structurally modified at any time after the iterator is created, in any way except through the iterator's own remove method, the iterator will throw a ConcurrentModificationException. Thus, in the face of concurrent modification, the iterator fails quickly and cleanly, rather than risking arbitrary, non-deterministic behavior at an undetermined time in the future.

Note that the fail-fast behavior of an iterator cannot be guaranteed as it is, generally speaking, impossible to make any hard guarantees in the presence of unsynchronized concurrent modification. Fail-fast iterators throw ConcurrentModificationException on a best-effort basis. Therefore, it would be wrong to write a program that depended on this exception for its correctness: the fail-fast behavior of iterators should be used only to detect bugs.

bold plume
candid ivy
#

bro

#

stop gpting

#

or sum

rough ibex
#

use a CHM

candid ivy
#

sychronized is making the thing accesible by one thread

#

at a time

#

its slower

#

pls just use concurredhashmap thats it

young knoll
#

We love concurrent hashmap

candid ivy
kind hatch
rough ibex
#

lol

kind hatch
#

Don't care

candid ivy
#

ok

kind hatch
#

Don't be stupid

candid ivy
#

i aint stupid

#

im losing braincells

#

rn

echo basalt
#

dawg at least be respectful

bold plume
rough ibex
#

Its the javadocs.

#

If you cannot read them, thats a deeper problem

#

i will not always be here to re-transcribe the entire library

bold plume
#

Can you tell me or not?

rough ibex
#

I can but I wont

bold plume
#

If you knew you wouldn't have gone to Java Docs to help me

rough ibex
#

okay

echo basalt
#

tbh in this case I'd rather use the official explanation than my half-assed understanding of it

bold plume
echo basalt
#

You need to use a thread-safe collection like ConcurrentHashmap

warm mica
bold plume
echo basalt
#

you're not iterating the collection so no, it won't happen

#

But regardless of that the map isn't thread-safe and shouldn't be used in a concurrent environment

#

Because its internal state might not be accurately reflected in your put/remove calls

#

There's a reason why ConcurrentHashMap exists and it's for scenarios like yours

bold plume
#

And when should I use Sychronized then?

echo basalt
#

when you don't care about performance

#

/ need it sorted

bold plume
#

But what is prioritized is the use of processing?

echo basalt
#

Assume this is a movie theater and you have multiple people coming in and buying tickets at once

#

A synchronized collection would basically consist of putting everyone in a queue and processing one person at a time

#

A concurrent collection would consist of just having multiple ticket booths

#

The synchronized collection has the benefit of processing in a "first come, first serve" basis but loses on performance

#

the concurrent collection might process batch writes better but comes at the drawback of bigger complexity

bold plume
#

hm ok

#

thank you

echo basalt
#

It also uses more memory

#

but memory's cheap and this is java so who cares™️

river oracle
#

most readable java stream

        return new Recipe(
                UUID.randomUUID(),
                random.ints(25, 0, 255).collect(StringBuilder::new, StringBuilder::appendCodePoint, StringBuilder::append).toString(),
                random.ints(random.nextInt(1, 11), 0, 5).mapToObj((i) ->
                        new Ingredient(new int[]{i, 1}, Registries.MEASUREMENT.random(random).orElseThrow())).toList(),
                random.ints(random.nextInt(0, 5), 0, 1).mapToObj((i) -> random.ints(random.nextInt(100, 150), 0, 255).collect(StringBuilder::new, StringBuilder::appendCodePoint, StringBuilder::append).toString()
                ).map(Instruction::new).toList()
        );```
young knoll
#

wtf

river oracle
young knoll
#

wtf is it even doing

river oracle
#

generating a random Cooking Recipe

#

obviously

#

are you blind

young knoll
#

What are we cooking with

#

Measurements and Instructions

river oracle
#

Its actually ingredients and instructions

#

I'm cooking this beautiful GUI

young knoll
#

Ah yeah that’s a nice recipe

#

I’ll cook that

nova notch
#

dont forget to sprinkle in a little aighneagohneaoghnuanuigf

torn shuttle
#

where in the .m2 folder are the remapped files supposed to be going

pure dagger
#

i need to make a gui, that is editable, its one gui for server, so it should be not possible for 2 players to edit it in 1 time probably, if i do a boolean, and makeit true when someone opens the gui, and make it false when someone closes it, is it safe? are there no like cases when it wont work?

#

probably... its hard to imagine for me i need to make sure

slender elbow
pliant topaz
pure dagger
#

i think when he leaves its just close event

#

why crash? he can just turn of

#

also, will onDisable always happen?

#

is it safe to get data from config at onEnable() and save it back at onDisable() ?

fading drift
#

just save whenits changed

pure dagger
#

so answer is "no"

#

?

fading drift
#

cus it wont be cxalled if server crashes afaik

pure dagger
#

umm okay

#

so i have a problem

fading drift
#

?

pure dagger
#

ill figure it out i need to test it

fervent gale
#

whenever summoning a nether star can i set it so it can't be burned or destroyed?

because currently i get this... 1.21.1 also is there a way to summon the item and drop in single spot, not in the diag spot it did lol

pure dagger
#

ok so if i have global inventory when should i save the items from it to config? every click event? every close event by any player (they can have it opened at the same time)

#

i think every InventoryCloseEvent is okay

fading drift
#

should be right

torn shuttle
#

I'm going to lose it

#

not once in my miserable life has this maven remapping bs worked properly in the first try

#

nothing ever works correctly

#

it doesn't recognize that the remappings are installed, it doesn't recognize updates, it can't find remote repos, it can't upload to remote repos, it can't resolve versioning for local repos

#

it categorically can't resolve anything if two plugins shade the same codebase but with different versions

pure dagger
#

how do i get actual distance between player and a block because normally player.getLocation().distance(block.getLocation()); returns location between player and a corner of the block.. ;c how do i get it from the middle of the block

fading drift
#

subtract or add .5

pure dagger
#

you mean what

#

i think i should add .5 to x and z of block.location

fading drift
#

yeah something like that

pure dagger
#

(and to y but i dont care about y)

#

ill just set both y's to 0 i guess

pure dagger
fading drift
#

idk what that nether star shit is

fervent gale
#

i'm trying to figure out a way to make nether stars invincible to lightning bolts

pure dagger
#

cancel damage event for them

#

😺

fervent gale
#

but i just want to do for the specific item i summon...

pure dagger
#

i was joking i guess

#

but

fervent gale
#

i was hoping

pure dagger
#

nether stars normally are invincible

#

to blow

#

why not to lightning bolts what

fervent gale
#

idk lol

young knoll
#

There’s a setFireproof on ItemMeta iirc

#

Otherwise I think you’ll need to use events and pdc

pure dagger
#

umm.. i just blown up my star

#

why isnt it

#

unblowable

young knoll
#

Ah it’s setDamageResistant now

#

You can even set it to be resistant to lightning damage

fervent gale
#

I'm using 1.21.1 so it's still ItemMeta#isFireResistant()

pure dagger
#

why is it fire if its damage

pure dagger
#

nvm

young knoll
#

Weird that the damage resistant component only takes a single tag and not a list

#

I guess you could make a custom tag but still, kinda meh

pure dagger
#

idk what components are

#

thats new i geugss

fervent gale
#

Awesome that worked perfectly now i just need to figure out a way to drop it perfectly centered in the pentagram so when i set the gravity to false it floats straight up

young knoll
#

dropItem should work fine

#

Assuming you have the exact center position

fervent gale
#

I've tried dropItem and dropNaturally it drops and then floats diag

young knoll
#

dropItem and set velocity to 0 mayhaps

fervent gale
#

i'm unsure on how to set velocity

#

nvm

#

i figured it out

humble terrace
#

where can i find the java docs for 1.21

eternal oxide
#

?jd-s

undone axleBOT
granite burrow
#

How can I tell if a block is a #minecraft:crop

sonic goblet
granite burrow
#

the only one I see is Legacy Crops but its depreciated

sonic goblet
#

Ahh ya, are you wanting wheat in specific?

granite burrow
#

Just like the basic crops youd get "Carrot, Potato, Beatroot, Netherward, Wheat" I think thats all the ones that grow from seeds and are harvestable

#

Ima prob just make a list tho seems easier lmao

sonic goblet
#

BlockData for Ageable

granite burrow
#

ooo, I will look into that

#

thank you very much

sonic goblet
#

No problem, I’m not sure what other blocks besides what you stated Ageable includes so depending on your use-case might need some tweaking

granite burrow
#

yeah, I think ima do a list in the config and make a tag system so people can choose if they want all Ageable or just certain ones, prob a blacklist too

echo basalt
#

pretty sure blocks have tags

granite burrow
#

from what I could see in the Block Data for the weat I couldnt tell it but in minecraft they do have the #minecraft:crops tag

echo basalt
#

no clue what my AI code completion is going off of

granite burrow
#

Oh... Ima have to learn more about tags. Thank you

quaint mantle
sly topaz
#

if so, you would just send the resource pack to the player

#

that said, I wouldn't personally recommend doing that since it sounds performacne heavy

quaint mantle
#

in the mod I could switch it instanntly

sly topaz
#

I mean, the mod is local, a plugin isn't

#

there is no way around that

quaint mantle
#

alright, thanks

sly topaz
#

that said, as long as you do it in the configuration phase, it is probably not noticeable at all anyways (well, beside from the prompt)

quaint mantle
sly topaz
#

sure, that works. If you have a mod on the client then you can do pretty much anything really

quaint mantle
#

i heard someone talking about timer in the resourcepack, so on specific world time the shader in resourcepack would enable

sly topaz
#

most people don't opt for that since it artificially limits the reach of the server by depending on mod loaders and what not

sly topaz
quaint mantle
sly topaz
#

it depends tbh, say, there's mods like proximity voice chat which you do want to have, but if it is just a cosmetic mod then the user may think twice before installing it

#

if there's no gameplay value to it, it isn't worth the hassle. This is why people do modpacks, since it's easier to get the users to install a tons of mods without thinking twice (except when it starts affecting performance heh)

#

then again, I do believe most people do play with some kind of performance modpack nowadays so it isn't as much of an issue

#

there's also the rise of launchers like Prism which make it easier than ever

quaint mantle
#

or like tlauncher, I could create modpacks

sly topaz
#

tlauncher 💀

quaint mantle
#

I know I dont trust it either

sly topaz
#

just use Prism, that's the best there's around

quaint mantle
#

I had it installed, but not all my friends bought minecraft

sly topaz
#

unless you play in offline mode, I don't know what launcher is popular for that nowadays tbh

sly topaz
#

-# shh don't say it out loud or people are going to bully you here

quaint mantle
#

I gtg

fading drift
#

is there a way to prevent player dater saving at all in a server

upper hazel
#

does it make sense to switch to kotlin?

#

it's localized but sometimes not clear.

rough ibex
#

Eh

proud badge
#

But i wouldnt recode everything just to switch to kotlin

upper hazel
rough ibex
#

data classes are good

#

and delegation

upper hazel
#

i have only 1 reason

#

null protection

#

this what i want see in java

#

but...

rough ibex
#

How many nulls do you have

sly topaz
#

I would do it for the experience

rough ibex
#

jspecify :>

sly topaz
#

you'll never know if it is any better if you don't actually try working with it

upper hazel
#

s that it's annoying to use annotations for protection.

#

like lombok for example

sly topaz
#

those are really menial things to worry about

#

when your code base is big enough, this is the least of your worries

upper hazel
#

?

sly topaz
#

then again, if it annoys you, just give it a try and see how it goes

upper hazel
#

this start annoying when you do same code again and again loop annoying cycle

#

especially on big projects.

#

it's no small thing on the bottom line

sly topaz
#

it really is

#

in the end it's just lines of code, for which most are auto-completed by your IDE

upper hazel
#

You don't have to oversimplify things

sly topaz
#

if you feel like verbose-ness isn't your thing, then go ahead and use kotlin, you'll probably have a better time with it. That said, the repeating part isn't the issue with verboseness, but rather the mental overhead it may induce

#

I for one find it good to keep consistency across a code base, which I honestly cannot get with kotlin. However when just prototyping kotlin feels 10 times better as it has a vast amount of utility functions which once you learn, can keep a good chunk of code very compact

upper hazel
#

does kotlin support java libraries?

sly topaz
#

yes, kotlin has good interop with java

#

same goes for the vast majority of JVM languages, since a good chunk of being a JVM language is taking advantage of the JDK itself and its huge ecosystem (i.e. Spring)

upper hazel
#

Too bad there are fewer jobs than java.

sly topaz
#

Eh, I wouldn't say that is the case, kotlin has a pretty good market within the android ecosystem

upper hazel
#

i want write sites

#

i dont like android app development process

sly topaz
#

then you don't want anything to do with kotlin or java lol

#

well, not quite. They're both good backend languages, Java definitely has an edge when it comes to jobs

upper hazel
#

I made it up. I will use both java and kotlin lol

#

i hope this not will be problem in furture

sly topaz
#

I mean, if your goal is getting a job, it might be

#

ultimately what will help you get a job is building actual products/services so that you have something to show off

upper hazel
#

I'm mean about knowledge issues.

sly topaz
#

they're both JVM languages, they share a lot in common

#

well, Kotlin does branch off when it comes to KMP but it is still essentially the same

upper hazel
#

nice

granite burrow
#

Is it possible to get the crop from the seed? Like say I have WHEAT_SEEDS but the crop (block) is called WHEAT is there a easy way to get this through spigot or would I have to make a look up table?

Note: I plan to do this for all crops (ex. beetroot, carrots, potatoes. etc.)

proud badge
#

nvm if u have the crop and need the block then idk

spiral light
granite burrow
#

I haven't messed with NMS yet, however, I realised that I'm dumb and the way I was storing the data allowed for me to just access the crop part too :/ 🤦

mellow edge
#

Hello, how would I enable legacy pvp on 1.21?
My idea is to remove attack cooldown of weapons.
Give items in my plugin legacy attack/protection values. Is that all? The old sword animation doesn't metter. How about ciritcal hits? Do they behave differently?

spiral light
#

i dont thinks so... there is a plugin that disables the new pvp system ^too

mellow edge
#

The thing is... I have a minigame already made... I cannot integrate it

sly topaz
#

why not

#

it isn't like it is going to interfere in your system

mellow edge
#

Ok so specifically if I buy armour or weapons from my shop, will they automatically behave like old ones.

sly topaz
#

it should yeah, but try it out and see how it goes

#

you're better off making your plugin compatible with that one rather than dealing with bringing back all of these shenanigans by yourself

mellow edge
#

Ok good point

#

That way I can make my plugin compatible with new and old pvp

hushed spindle
#

would it be unsafe to cast this? i dont really understand why it doesnt like this

upper hazel
#

bukkit api has "scared" function for mobs in 1.20?

worthy wraith
#

should gethealth return absorption hearts?

spiral light
#

nope ?

#

there is getAbsorption or smth like that

worthy wraith
#

im running 1.8.8 so its not avaliable

spiral light
#

outdated

quaint mantle
#

?1.8

undone axleBOT
worthy wraith
#

thats when minecraft was good

spiral light
#

you mean empty, no content, to play a cool game you needed like 126 mods and the fps dropped to 10 ?

smoky anchor
#

Wasn't that when you could crash servers with an anvil ?
Yeah, def good.

hushed spindle
#

1.8 being good is hard copium

worthy wraith
umbral ridge
#

can you prevent trapdoors from changing their open state if they get powered?

spiral light
#

BlockPhysicsEvent ?

umbral ridge
#

I turn on the lamps but the trapdoors get opened because they're powered by it

#

hmm

#

ty i'll try

smoky anchor
#

How do you power the lamp ?
Via the API or just normal redstone stuff ?

umbral ridge
#

with the api

#

I synchronized the server time with realtime and lamps turn on everyday at 6:20pm and turn off at 7:20am in the morning

#

XD

fading drift
#

how to get full health including absorption hearts in 1.8

granite burrow
#

Is there a way to get all foods? like a tag or someting? I couldn't find any when I looked but I might have missed something. I know that you can accomplish something similar by looping through all materials and checking if its edible

smoky anchor
umbral ridge
#

1.8inflatable 😿

fading drift
#

yeah soz

fading drift
#

how do I cast Player to LivingPlayer

smoky anchor
smoky anchor
#

what exactly did you do ?

umbral ridge
#

i changed my code a little bit

smoky anchor
#

ofc you did...

#

haha

umbral ridge
#

XD

umbral ridge
#

Do all entities look at you as you approach them? Like villager

spiral light
#

hmmm i would say yes but to be sure you need to check all entities if they have the same goal

smoky anchor
umbral ridge
#

I'm making npcs and if i disable their ai, because i dont want them to harm players or move around, they will just stay still

smoky anchor
#

LookAtPlayer goal is part of AI so.. ye

umbral ridge
#

how do I stop specific entites from moving? xD

#

like zombies and skeletons

#

and make them not harm players or anything

spiral light
#

remove their goals

#

and code them new

umbral ridge
#

how do i remove their goals

smoky anchor
#

If you don't want NMS
Use attributes, set their follow range to 0, set movement speed to 0

umbral ridge
#

ohh

smoky anchor
#

I am not 100% sure on the follow range tho

#

I know the other way is to set them to the same team as player

umbral ridge
smoky anchor
#

no 🥄 from me
search for anything attribute related

umbral ridge
#

ohh it's the attributes, ty

quaint mantle
#

where can i see new features for minecraft like display entites and #addCustomChatCompletions method

young knoll
short drift
#
// Check if player is online now.
Player player = server.getPlayer(playerUUID);
boolean isOnlineNow = false;
if (player != null) {
    isOnlineNow = player.isOnline();
}

What am I doing wrong?

spiral light
#

i think if you use getPlayer it is automatically an online player

worldly ingot
#

Yeah it will only ever get an online player

spiral light
#

if you use getOfflinePlayer it will try to get an offline player (who has joined already before)

short drift
#

Ah .. the problem is that it's never true.

#

It doesn't detect that I'm online.

worldly ingot
#

Where are you running that?

short drift
#

Inside a command.

worldly ingot
#

That might not be true in an event like PlayerJoinEvent or PlayerLoginEvent

#

Mk, then yeah, just a null check is fine

#
Player player = Bukkit.getPlayer(playerUUID);
if (player == null) {
    // player is offline
    return;
}
short drift
#

I tried that first. But it's never null.

worldly ingot
#

Then you're either using a weird server implementation or you're passing in the wrong playerUUID

short drift
#

If I'm passing wrong UUID then particularly it should never be anything but null, IMO.

#

There's only me on the server.

worldly ingot
#

That's what I mean. Maybe you're passing in the UUID of the sender

#

Because #getPlayer() returns null for offline players. Not sure what else to tell you :p

short drift
#

What's the difference of using the method from static Bukkit vs. from server?

worldly ingot
#

Nothing. Bukkit mirrors all of Server's methods as static redirects. Bukkit holds the Server instance, so it's convenience

short drift
worldly ingot
#

Oh your playerUUID is a string. Okay, so you're effectively doing Bukkit.getPlayer("73c62196-2af7-463d-8be1-a7a2270f4696"), which is never going to yield a result

#

Bukkit#getPlayer(String) gets by name, Bukkit#getPlayer(UUID) gets by UUID, which is what you're trying to do

#

Remove the toString() and change your variable type to UUID

short drift
#

Why?

short drift
#

I read it, but it I didn't follow.

worldly ingot
#

You're trying to call a method that expects a username, like Bukkit.getPlayer("2008Choco"). But you're passing a stringified UUID, which isn't a username

short drift
#

But why does it always ... like ... work?

#

I need to think about this for a while.

worldly ingot
#

You said the value is never true

#
Player player = server.getPlayer(playerUUID);
boolean isOnlineNow = false;
if (player != null) {
    isOnlineNow = player.isOnline();
}

Which in this snippet, the one you sent earlier, means the player is never online. Which is correct. It's trying to get a player that doesn't exist

short drift
#

Ah, I see. Yes. Ok.

worldly ingot
short drift
#

Hmm. Thank you. I think I can get it working now that I understand the issue.

worldly ingot
slender elbow
#

choco should get the helpful role

shadow night
eternal night
worldly ingot
slender elbow
#

the api is an api <-> impl bridge

#

:nodders:

young knoll
#

I'm a bridge

river oracle
pure dagger
#

I'm making an random teleport plugin, i want to teleport a player to random place but it has to be bigger than some MIN value and smaller than MAX value

so the big square without the smaller square is the area,

my code does:

x = random(-max, max)
y = random(-max, max)
if ( -min < x < min && -min < y < min) generate x and y again
else we have result

do you think its correct?

#

it should be z not y but doenst matter

slender elbow
#

that would work but it also has the infinitesimally small chance of looping infinitely

#

i would just generate the coords as the difference between the min and max

#

and then offset by the min

#

no looping needed

pastel spade
#

when will food components be fixed?

dreamy nimbus
pure dagger
slender elbow
#

no

#

I am in a bus

pure dagger
#

okay

#

ill try to explain what i think

upper hazel
#

first familiarization with kotlin and project creation is already giving difficulties. build plugin for bukkit api not support kotlin?

spiral light
pure dagger
#

what does "value between (max-min)" mean

spiral light
#

value = Math.random() * (max-min)

pure dagger
#

what abut negative numbers

#

i really dont get it 😦

pseudo hazel
#

min would still be the lower value

pure dagger
#

what im thinking about is to generate x, if its in a position when its impossible for y to be in that little square then just generate the y, if x is in position when y can be in the little square, then generate y so its not in the square , i dont know how to do it but yeas

pseudo hazel
#

5 - 3 = 2 and -3 - -5 = 2

spiral light
#

i see what his problem is....
my idea was to generate a distance which is positive all the time,
you could then add a 50% chance to make x and 50% to make z negative

pure dagger
spiral light
pure dagger
#

so if x is in something like this black dot, then just generate the Y, if its in position like the red one, generate the Y somehow so its not in the middle square

#

sorry for poor drawing

pseudo hazel
#

that sounds like overcomplicating it

#

how big are these ranges anyways

pure dagger
#

yeah

#

but my solution

#

was workking

#

but it can repeat w few times before doing this

pseudo hazel
#

and can it be a circular range or is it specifically rectangular

pure dagger
pure dagger
#

do you do the same for y?

spiral light
#

do the same for z ?

pure dagger
#

year z*

#

but then

spiral light
#

dont call it y xD

pure dagger
#

yeah but its like 2d llol

spiral light
#

still in mc

#

2d is x/z in mc

pseudo hazel
#

what

pure dagger
#

i dont think your idea will work

#

jesus whats with my typing

spiral light
#

i think it will work

pure dagger
#

jeesus why so hard

spiral light
#

all you wanne do is generate the distance which is max-min and add the min value to get a value which is higher then min and lower max
do it for x and z and add 50% to make it negative per value

pure dagger
#

but you know that they both (x and z) have to be between these coordinates for the (x, z) to be in the rectangle

spiral light
#

yes.

pseudo hazel
#

if you solve it for either x or z, you literally copy paste it for the other axis

#

so instead this is a 1d problem

pure dagger
#

i dont think so

pseudo hazel
#

why not

pure dagger
#

i think his solution makes only this are possible to be generated (blue ones)

pseudo hazel
#

no because you are generating the x and y separately

pure dagger
#

because he makes so both x and z are not in the coordinates

#

😭

spiral light
#

i see

pure dagger
#

because i understood that these are possibilities for x an z

#

red ones are x blue ones are z

spiral light
#

what about generating a value between
+minX and +maxX
and also -minX and -minX
and choice one of the results ?

#

(better would be to decide before if negative or positive before generating both)

pure dagger
#

but do you agree that your previous solution was not ok?

#

was i right?

#

i mean i already have the solution but its a little slower sometimes

spiral light
#

my brain crashed while thinking about it ...

pure dagger
#

yeah

#

its so hard

#

i made slower but easier

#

solution

spiral light
#

i think my new idea would work

#

not

pure dagger
#

"not"?

spiral light
#

its the same problem again

pure dagger
#

ugh

#

i already have the idea in my mind, i said it, but its complicated

#

i think i dont care that much

#

to fix it

spiral light
#

circle would be a easier

pure dagger
#

yes i know xD

#

because x and y is the same way

#

okay z

#

wait am i dumb?

#

yes i am but im tired

#

of thinking

spiral light
#

i got it... maybe ?

generate X like i said with
generating a value between
+minX and +maxX
and also -minX and -minX

but for Z you only generate between maxZ and -maxZ

upper hazel
#

Everything was wonderful with so many benefits until it came to kotlin syntax. I assure you it's just awful when you're a Java programmer looking at it.

For some reason the data type and the type name are reversed. some ? !! to work with null objects. Some strange creation, assignment of getters and setters. Compactness is good, but not to such an extent.

remote swallow
remote swallow
#

what does data type and the type name are reversed mean

pure dagger
#

we could generate any x, then y until its ok, OR find a way to generate it so its ok in the first time, which you just probably did

upper hazel
#

and the funny thing is that when people talk about the advantages of kotlin over java, they mention null protection, but they forget that you will interact with these nulls anyway.

#

nice jbrains love you

pure dagger
#

ill just stick to my solution.. its not actually that big deal

#

because samller rectangle is too small

#

compared to the bigger one

rough ibex
#

Rubber duck debugging

dry hazel
upper hazel
#

it's not about that, it's about how you deal with it. Wth this “?...” “!!” ???

#

why just not use annotation

remote swallow
#

!! is asserting not null

#

? is nullable, and is the prefix to a safe call

#

technically !! is casting to non null but similar for explanation purpose

upper hazel
#

this unconfortable especially when interacting with the api written in java

remote swallow
#

i can use kotlin with java apis perfectly fine

upper hazel
#

easer use lombok nonNull annotation then this

chrome beacon
#

(if it's not intended)

dry hazel
remote swallow
chrome beacon
#

Same goes with Scala code

pure dagger
#

4<x<6
this syntax should work

chrome beacon
#

Had to work with that decompiled

upper hazel
#

inteliji use annotation

#

for example

#

why kotlin not can use some class processor inside for checking

remote swallow
#

because its on the type system

#

if you dont like it dont use kotlin¯_(ツ)_/¯

dry hazel
#

having a null-aware type system allows the compiler to enforce more rules around its usage, so you don't get unexpected runtime NPEs

upper hazel
#

but use sings...

remote swallow
#

can null is ClassName?

upper hazel
#

what?

remote swallow
#

String? means it can be null, by default it is non null

keen sapphire
#

Can I send my zipped world files from a minecraft server to a github repo via a plugin?

upper hazel
#

"then","it"

#

etc

dry hazel
#

huh?

remote swallow
upper hazel
#

sec

keen sapphire
#

I think it's a issue with the host

peak depot
upper hazel
#

what this??

remote swallow
#

file?.let is a safe call for if its not null

#

the override is just removing the boiler plate and letting values be returned directly

#

override fun getValue(): Double = value is the same as ```java

public double getValue() {
return value;
}```

upper hazel
#

why just dont return

shadow night
upper hazel
#

why "Class = value"

remote swallow
#

: Double is the type

#

= value is what to return

upper hazel
#

i can use this without var and val?

remote swallow
#

no

#

val input = "woah"

#

is valid

#

so is val input: String = "woah"

remote swallow
shadow night
upper hazel
#

val this private final?

#

i can just use java syntax?

remote swallow
#

private val is a private final variable

#

val is default public

upper hazel
#

like private final value: Class

#

i dont like var

#

and val

remote swallow
#

so dont use kotlin

upper hazel
#

this confused

#

yea i not will

shadow night
#

why do you use kotlin if you don't like it

upper hazel
#

curiosity

#

one reason

#

null protection

#

but syntax this crazy

shadow night
#

It's just the average high level language lol

#

Javascript syntax is nearly identical lul

upper hazel
#

this is the point where the developers went overboard with the compactness

shadow night
upper hazel
# shadow night Javascript syntax is nearly identical lul

except that the developers made a java analog, not JavaScript. I don't know why they didn't make the syntax closer to Java. Why reverse the order of variables, why add : when assigning, etc. And I've only translated 2 classes to kotlin

shadow night
upper hazel
#

The developers themselves said it's an improved java.

#

Well, from the stories I've heard on youtube, at least.

shadow night
#

Well, it's hard to explain

#

But basicaly

#

They are two seperate entities

#

Do not compare them

#

Kotlin is a language that gets rid of what some people see as redundant in java

#

And adds things that are too non-verbose for java

upper hazel
#

and with that they messed up the syntax when added javaScript lang niice.

wet breach
blazing ocean
#

I mean just use optionals if your sole reason of using Kotlin is nullability

stable gorge
#

is it possible to get a player to play one frame / stick to one frame of the crossbow loading animation?

scarlet gate
#

Is there any api to send a PlayServerEntitySoundEffect packet?

chrome beacon
#

Yes

#

the playSound API

scarlet gate
#

Oh I'm tripping, I already did what I was asking for help with

#

Thank you though haha

ivory sleet
#

Optionals are so not even close to kotlin null safety

#

i mean i wish, but its just not

worldly ingot
#

If your whole codebase is optionals, you might as well just run now before I ban you

ivory sleet
worldly ingot
#

There is a time and a place, and unfortunately for some developers, that place is everywhere

remote swallow
#

like Option.None and Option.Some

worldly ingot
#

wtf

river oracle
#

I do use these unironically a decent bit

ivory sleet
#

sure, sadly you still deal with Java’s limited generics semantics and there’s gonna be some operation and memory overhead if u scatter around a wrapper for every nullable that you have to deal with

river oracle
#

I mainly use kotlin so not a problem for me

#

I use options generally with registries and that's about it

#

But I do use registries a good bit

orchid brook
young knoll
#

Spigot already shades the SQLite driver

#

So you don’t actually need it

orchid brook
#

okkk thxx

hazy parrot
#

But for other cases, you need dependency because java.sql is just an API, you need driver implementation which you usually obtain with DriverManager.getConnection factory method

summer scroll
#

Guys, is there any discord bot that can automatically give role to my customers?

river oracle
#

You'd have to make something yourself and be smart about it

summer scroll
humble terrace
#

If i have a working plugin for spigot 1.21 how can i use it on spigot 1.20.1?

#

What do i change?

drowsy helm
humble terrace
#

Api endpoints?

#

I mean i changed it to 1.20 in the pom.xml file

remote swallow
#

change the api-version in plugin.yml to 1.20

humble terrace
#

I did

#

Didnt work

#

I changed it there and the pom.xml

#

When i do /pl

#

It says 0 plugins

remote swallow
#

so check logs for a start up error

timid berry
#

some plugins work with multiple versions

#

what version should i put so it works with the most versions?

remote swallow
timid berry
remote swallow
#

the older you go the less support you get

timid berry
#

it will work with the all above 1.8?

remote swallow
timid berry
#

isnt this what they would call an array in other langauges??

drowsy helm
#

other languages may call them dictionaries, but never array

timid berry
#

why isnt this like (a,b,c,d)

#

which is 0,1,2,3

drowsy helm
#

no a map is whats called a KVP

#

key value pair

timid berry
#

i see

drowsy helm
#

an array is just a list of elements

#

a map has a key and a corresponding value

timid berry
#

would the server get really laggy?

drowsy helm
#

no not at all

#

ideally you should use player uuid isntead of username btw, it cant be changed

timid berry
#

if the server is offline

drowsy helm
#

but even for 10s of thousands of players, it would not lag

timid berry
#

wouldnt the uuid be based on their username?

drowsy helm
#

no clue

timid berry
#

i see

drowsy helm
#

i dont use offline mode

timid berry
#

u need to use it

#

if server

#

is behind bunge

drowsy helm
#

theres way of working around that

#

but either way, good practice to use uuid

timid berry
#

i see thanks

young knoll
#

Bungee should forward the uuid

#

Might need a setting for it

timid berry
fading drift
#

did you specify public?

timid berry
#

I dont know

#

i followed the example

#

but the example never decalres default_cooldown

#

method 3

fading drift
#

is there a way to have this world only save world data (region folder)

glad prawn
blazing ocean
river oracle
blazing ocean
#

That is exactly what rust does

river oracle
#

Oh

#

Well it's probably the best way to do it without it being a built in language feature

blazing ocean
#
pub enum Option<T> {
    Some(T),
    None
}
#

rust stdlib ^

river oracle
#

Java really missed with it's Optional impl

worthy yarrow
#

Why's that

river oracle
#

Overall meh experience at best

blazing ocean
#

you know what else is an overall meh experience at best

river oracle
#

Not being able to switch on them just sucks

blazing ocean
#

no

#

java

river oracle
#

Subjective

blazing ocean
#

Because to the rust compiler the concept of null just does not exist

worthy yarrow
#

What's the difference between an optional and like a completable future? Just that the type of returned data or response as it were is different?

blazing ocean
#

which is a good thing

river oracle
river oracle
#

CompletableFuture may not even properly exist

#

The code it's running could not even have happened yet

worthy yarrow
#

Ah

river oracle
#

Optional simply encapsulates a values null state

worthy yarrow
#

Hmm what do you mean? I thought it handled null cases by just throwing or running another function

quaint mantle
#

It basically forces user to make proper null handling

timid berry
quaint mantle
#

Wrong command when you are setting the executor

quaint mantle
#

Show plugin yml

timid berry
quaint mantle
#

paper-plugin.yml😭🙏🏻

timid berry
quaint mantle
#

Just put commands into plugin.yml

timid berry
#

i have none

#

should i create one?

quaint mantle
#

Just rename it to plugin.yml

echo basalt
#

why use Optional when you can use completablefuture and just complete null

#

@river oracle

timid berry
#

same error @quaint mantle

#

oh bruh its auto creating paper-plugin.yml

#

:(

#

fixed

#

chat how do i get players item

#

idk how to access playerInteractEvent

#

in a command

lyric spindle
#

Returns the ItemStack

timid berry
#

but what do i put here?

#

it worked fine in my main file having it at "this"

lyric spindle
#

1 params write the Class where extends JavaPlugin, then key from "String". Not use ",.-/" and other incorrect symbols, and the length should be a maximum of 12 characters

blazing ocean
#

?di

undone axleBOT
blazing ocean
#

?learnjava! first tho

undone axleBOT
timid berry
#

aight bro i get it

#

i fixed it last time

#

but this time its in a command not in the main file

#

so "this" does not work

lyric spindle
#

Do it in the main class:

private static Again instance;

public void onEnable() {
instance= this;
}

public static Again getInstance() {
return instance;
}

then:
NamespacedKey key = new NamespacedKey(Again.getInstance(), "key");

And change the name of the main class so that it starts with a capital letter

lyric spindle
#

Add in onEnable "instance = this"

timid berry
#

ohh

#

sorry i didnt see that

lyric spindle
#

ctrl + z

#

And change the name of the main class so that it starts with a capital letter

#

The name of the classes must begin with the main letter

timid berry
#

oh okay thanks

blazing ocean
#

🥄

timid berry
#

how can i rename a players item?

#

player.getItemInHand().getItemMeta().setDisplayName("renamed");

#

does not work

blazing ocean
#

Because you're not re-setting the meta

timid berry
#

how can i do that

blazing ocean
#

setItemMeta

drowsy helm
#

first isolate the ItemMeta as a variable then set it back, you really shouldn't be doing those long strings of methods

timid berry
#

what would i put in here?

blazing ocean
#

._.

blazing ocean
timid berry
#

uh

echo basalt
#

hm where have I seen this

drowsy helm
#
ItemStack item = player.getInventory().getItemInMainHand();
ItemMeta meta = item.getItemMeta();

// do stuff
item.setItemMeta(meta);
#

see how much cleaner that is

echo basalt
#

dawg they don't give a fuck

blazing ocean
drowsy helm
#

i give all the fucks

timid berry
drowsy helm
#

do the stuff after the getItemMeta

#

so meta.setDisplayName("yahyah");

timid berry
drowsy helm
#

almost

#

add a new line with the setDisplayName

#

where i did the //do stuff comment

timid berry
#

everyday my iq gets lower

drowsy helm
#

java uses " for strings

#

' is for chars

timid berry
#

that is so

shadow night
#

That's normal

drowsy helm
#

java is very specific with the way it wants things

timid berry
#

it works!

drowsy helm
#

😄

granite burrow
#

Is there a way that I can NamespacedKeys to save multiple values?

Like example the key is User and add in 2 values of say Player 1 and Player 2 would that work or would it override the NameSpacedKey

pseudo hazel
#

user:player1

#

thats fine

#

but user is kind of a weird namespace

granite burrow
#

its saved as allowed-users just used User as an example one.

pseudo hazel
#

that sounds like it would be a list

pseudo hazel
#

idk how namespacedkeys help with that

sly topaz
#

because that sounds like xy

granite burrow
#

basically I want to save a list of allowed users to a container, and from what I found name spaced keys are a good way to do that for other data im just not sure about for lists

sly topaz
#

namespacedkeys are just strings which have a namespace attached to them, which is often either the minecraft namespace or the plugin's. You can use them for other purposes but a list of users isn't really one

granite burrow
#

ah, okay :/ I will find another solution for that one then

sly topaz
#

you can just use a list of UUIDs or something

granite burrow
#

you can do a list of UUIDs?

sly topaz
#

you can do a list of anything you want

granite burrow
#

for namespacedkeys?

sly topaz
#

I don't understand what you mean, why do you need namespaced keys

#

what is this allowed-users list used for? Where is it being stored?

granite burrow
#

im allowing users to access a certain chest that can be anywhere. from what I've researched a good way to do this is with name spaced keys, however, I dont think it will work with a list so I gotta find somethign else

sly topaz
#

so, you're storing it on the chest's PDC then

granite burrow
#

yeah with a namespaced key as the key for it

#

sorry its late for me I messed up not having that in my first message

sly topaz
#

I understand now, the namespaced key isn't mean to be the value that you're going to store, but a way to identify these values you're storing in the pdc

granite burrow
#

yeah, would it be overridden if I set another value to the same key?

sly topaz
#

you probably want something like this:

// screw this not being a default type btw
public class UUIDTagType implements PersistentDataType<byte[], UUID> {
      
        private static final UUIDTagType TYPE = new UUIDTagType();
        private static final ListPersistentDataType<byte[], UUID> LIST = PersistentDataType.LIST.listTypeFrom(TYPE);

         @Override
         public Class<byte[]> getPrimitiveType() {
             return byte[].class;
         }

         @Override
         public Class<UUID> getComplexType() {
             return UUID.class;
         }

         @Override
         public byte[] toPrimitive(UUID complex, PersistentDataAdapterContext context) {
             ByteBuffer bb = ByteBuffer.wrap(new byte[16]);
             bb.putLong(complex.getMostSignificantBits());
             bb.putLong(complex.getLeastSignificantBits());
             return bb.array();
         }

         @Override
         public UUID fromPrimitive(byte[] primitive, PersistentDataAdapterContext context) {
             ByteBuffer bb = ByteBuffer.wrap(primitive);
             long firstLong = bb.getLong();
             long secondLong = bb.getLong();
             return new UUID(firstLong, secondLong);
         }
}

private static final ALLOWED_USERS_KEY = new NamespacedKey(MyPlugin.instance(), "allowed-users");

var PDC = block.getState().getPersistentDataContainer();
// you *may* have to wrap the returned list into a new ArrayList since I don't know if the returned list by the LIST PDT is mutable
List<UUID> allowedUsers = PDC.getOrDefault(ALLOWED_USERS_KEY, UUIDTagType.LIST, new ArrayList<>());
if (!allowedUsers.contains(somePlayer.getUniqueId())
  allowedUsers.add(player);
PDC.set(ALLOWED_USERS_KEY, UUIDTagType.LIST, allowedUsers);
granite burrow
#

hmm it seems I cant do PersistentDataType.LIST I will try to figure out why thank you very much for your help

sly topaz
#

then you are using an old version

granite burrow
#

oh that make sense, im using 1.20

sly topaz
#

oh wait, it was just me not including the type on the variable lol

#

there, I edited it

shadow night
smoky anchor
#

((it's literally in the docs, excluding the list and type))

sly topaz
#

was gonna say lmao

smoky anchor
#

Tho I would be for a type that stores 4 integers instead of 8 bytes, to match vanilla MC

sly topaz
#

that'd be less memory-efficient, but more compact in the string representation probably

pseudo hazel
#

idk, its just what mojang decided is the most common way to store uuid in nbt

smoky anchor
#

probably used ints 'cause of scoreboard manipulation for datapacks

sly topaz
#

I'd assume it was for when 32-bit ints were more common

#

it's an old game so I wouldn't be surprised

#

eh, now that I think about it, the JVM would've emulated the operations with longs anyway so it is pretty much the same

#

don't know why they went with that representation

pseudo hazel
#

why ints though

#

it was decided before datapacks existed

smoky anchor
#

you mean in scoreboards ?
That is a good question

pseudo hazel
#

yeah you brought it up

#

so I assumed you have an explanation

#

I just think they used 4 ints because its 2 longs

sly topaz
#

I'd like to assume they used an int array instead of a byte array simply because it didn't look as wonky on the string representation:

// TAG_Byte_Array
[55, 0E, 84, 00, E2, 9B, 41, D4, A7, 16, 44, 66, 55, 44, 00, 00]

// TAG_Int_Array
[550e8400, e29b41d4, a7164466, 55440000]

// TAG_Long_Array // not available until 1.13 apparently
[550e8400e29b41d4, a716446655440000]
pseudo hazel
#

well string representation shows the uuid format

#

like with the dashes

sly topaz
#

idk it feels weird to look at without the dashes lol

pseudo hazel
#

yeah

wet breach
#

Maybe i read your message wrong lol

sly topaz
#

no you read it right, I just got it mixed up in my head lol

#

I meant to say 32-bit longs, then again that's all handled by the JVM so it shouldn't have affected the UUID representation

wet breach
#

Right

#

Just more optimal now

#

Instead of it using double width its single width since 64bit native stuff

vital ridge
#

Can the text on actionbar be moved lower through code

#

Or are the text coordinates on the actionbar hard coded?

stable gorge
#

any good resources for mongodb? hoping to use something like Morphia ( idk if theres any alternatives ) and also want to try for it all to be async for performance reasons rather than hug up the main thread (:

https://www.spigotmc.org/wiki/mongodb-with-morphia/

got this but idk how up to date it is

#

2023

#

so basically up to date

rough drift
stable gorge
#

too right

#

they go deprecated after like a year anyway

smoky anchor
vital ridge
#

Gotchu

blazing ocean
fading drift
#

I am rewriting database mangement for my minigames plugin and wanted some feedback/ideas on how to lay it out
my plugin is split into a core plugin, running on every server, and then a lobby plugin and a matches plugin, and in the future I am looking to write my matches plugin so I can create addons to it for different types of minigames as currently my network only supports one.

I need to save uuid, title data (ie chat prefixes), friends, statistics (per type of minigame), minigame settings (for example hypixel will store a selected kit for games like skywars)

I am using mongodb and I was thinking I could have a main collection, that handles uuid, title data, friends and then a collectionfor each type of minigame, which will store the specific settings as well as statistics

inner mulch
#

sounds good

fading drift
#

yeah

inner mulch
#

okay

fading drift
#

I think the original system does let me check

#

yeah it caches it in a uuid to playerdata map

inner mulch
#

okay

fading drift
#

it caches it every 100 ticks async

inner mulch
#

do you mean save?

fading drift
#

yes sorry

inner mulch
#

i personally only save when the player leaves

#

altough really important data shouldn't be cached

lilac dagger
fading drift
#

is my concern

lilac dagger
#

i store game specific settings into options TEXT

#

this is a game specific table

fading drift
#

I use mongo I cant read sql sorry

fading drift
inner mulch
#

data player spent money on (like currency)

fading drift
#

true

deft summit
#

I desperately need help, I've been trying to get Hot-Code-Replacement to work for over 4h now and it simply is not working... I'd be glad if anyone is able to help me:

I looked through a crap ton of sources to see how to do hot-code-replacement, but almost everything was for IntelliJ, which is not what I want to use, since I prefer Cursor (basically VSCode). (note that I do have IntelliJ, and yes it does work in IntelliJ, but I am stubborn and don't want to use it.. don't question it)

I've managed to install the JBR 21 (jbr_jcef-21.0.5-windows-x64-b631.8) and added the hotswap-agent.jar to it aswell. I've even managed to set up a tasks.json which runs my local dev server with the correct jar AND has the hotswap loaded (it appears in the logs)

        {
            "type": "shell",
            "label": "Start server",
            "command": "java -XX:+AllowEnhancedClassRedefinition -XX:HotswapAgent=core -javaagent:../.vscode/hotswap-agent-core.jar -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005 -jar ./paper.jar nogui",
            "problemMatcher": [],
            "options": {
                "cwd": "./.server",
            },
        },

I've also installed the necessary Java extension pack in Cursor, and I have made a launch.json to connect to the debugger:

        {
            "type": "java",
            "name": "Attach",
            "request": "attach",
            "hostName": "localhost",
            "port": 5005
        }

Attaching works.... even breakpoints work... everything, LITERALLY EVERYTHING is working, except that when I change the code, and even build it manually with gradle (even tho I don't think that should be necessary) and I click the Hot-Replace button, I ALWAYS get the message "Cannot find any changed classes for hot replace!". I've also tried adding a hotswap-agent.properties file (in multiple places to be sure that it is in the right place lol) and I've even gone as far as to provide the options in that file directly in the run command itself (see here), mostly to make sure that "plugin.classes" is set to the correct built classes, and yet it still does not work.

Does ANYONE have ANY clue how to get this crap working? PLEASE xD

pseudo hazel
#

sounds like something noone has ever done xD

sly topaz
#

I was mingling with this the other day, it was painful

#

no matter what I did, I couldn't get hotswap agent to recognize my classpath, the funniest thing is that even when I did get it to recognize my classpath, I couldn't get CommandAPI to work properly so I just gave up on it (it broke upon reloading, probably some code generation shenanigan changing the anonymous class order or something)

#

ah it doesn't have the hotswap stuff

sly topaz
young knoll
#

@remote swallow knows about hotswap stuffs

sly topaz
#

then again, I don't think you need hotswap agent for basic hot reloading?

#

just using the debugger for java and JBR is enough

deft summit
#

Im not gonna lie, I copied it... 5 times... I had it in my resources folder, in my project root folder, next to the hotswap-agent jar file, in the server directory and I even manually put it in the arguments of where i set the path of the agent jar file lmao

deft summit
sly topaz
#

also make sure you have redhat's debugger for java extension working properly

#

if you don't change class definition, you don't even need JBR

remote swallow
sly topaz
#

HotswapAgent is more for when you need a platform-specific plugin so that hotreloading behaves well with the system

#

i.e., there's quarkus and spring plugins for hotswap agent that fix issues around hotswapping these platforms/frameworks since they do a lot of dynamic stuff that needs to be properly handled when hotreloading happens

#

that said, you can still use hotswap agent if you want

deft summit
deft summit
#

lemme try really quick

sly topaz
#

also what do you mean it doesn't work, does it not let you use the reload classes button or when you hit it, nothing changes?

#

it could potentially be an issue of where you are testing it too, since if you change code that isn't getting called, nothing will change until that code is called again (i.e., for anything in the onEnable, that will never happen until server restart/reload)

deft summit
deft summit
sly topaz
deft summit
#

now that you mention it, this time I didnt

#

I did the last times tho

sly topaz
#

hot reload button should do it for you, given all integrations work properly but I maybe it just isn't lol

valid basin
#

Is there PlayerChunkLoadEvent?

#

I need it when player loads a chunk or when a chunk loads for him client side

deft summit
sly topaz
#

hm, let me try do it myself and see how it goes

deft summit
#

yep, just tested intellij (without the agent, just a regular JDK even), hotswapping there works

#

so it only causes an issue in VSCode

sly topaz
#

I think when you hit debug the output console tells you what flags it uses, maybe check out which ones it uses and copy them over to vscode

deft summit
#

my exact thoughts lmao

sly topaz
#

you'd have to use PacketEvents/ProtocolLib to detect that

rapid wharf
#

When i use some external plugin api from maven rep, i need to get instance of this plugin to use its api? or how it works

sly topaz
valid basin
rapid wharf
#

or im blind

sly topaz
#

what plugin are you depending on

rapid wharf
rapid wharf
sly topaz
sly topaz
rapid wharf
sly topaz
#

what does + mean

#

positive?

rapid wharf
# sly topaz what does + mean
version: '1.0'
main: org.midnight.midnightCommands.MidnightCommands
depends: [WildLoaders, LuckPerms]
api-version: '1.21'
commands:
  getloader:```
sly topaz
#

well, dumb to ask but, do you have WildLoaders on your server?

rapid wharf
#

kinda

sly topaz
#

what does kinda mean

rapid wharf
#

yes

deft summit
#

xd

sly topaz
#

if you have it shaded in your plugin or something weird like that, it won't work properly

rapid wharf
#

what is shaded? im stupid

sly topaz
#

anyhow, it shouldn't be returning null, where are you calling the method? in onEnable?

deft summit
sly topaz
#

even weirder, hm

#

welp, I'd just ask the WildLoaders author what's up with their API, because it shouldn't be returning null at this point

#

unless you got to do some kind of initialization which isn't apparent from their javadoc

rapid wharf
sly topaz
#

ah it is open source

#

let me check then

rapid wharf
sly topaz
rapid wharf
eternal night
#

if you have the shade plugin in your pom as well, you'd indeed be shading

sly topaz
#

the readme doesn't say anything about shading and they don't seem to know what shading is anyway so I doubt it but yeah ^

eternal night
#

could just

#

?paste

undone axleBOT
rapid wharf
# eternal night if you have the shade plugin in your pom as well, you'd indeed be shading

im stupid, need to fix anything here?

<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>org.midnight</groupId>
    <artifactId>midnightcommands</artifactId>
    <version>1.0</version>
    <packaging>jar</packaging>

    <name>midnightcommands</name>

    <properties>
        <java.version>21</java.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>

    <build>
        <defaultGoal>clean package</defaultGoal>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.13.0</version>
                <configuration>
                    <source>${java.version}</source>
                    <target>${java.version}</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.5.3</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
            </resource>
        </resources>
    </build>

    <repositories>
        <repository>
            <id>bg-repo</id>
            <url>https://repo.bg-software.com/repository/api/</url>
        </repository>
        <repository>
            <id>spigotmc-repo</id>
            <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
        </repository>
        <repository>
            <id>sonatype</id>
            <url>https://oss.sonatype.org/content/groups/public/</url>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>com.bgsoftware</groupId>
            <artifactId>WildLoadersAPI</artifactId>
            <version>2024.3</version>
        </dependency>
        <dependency>
            <groupId>net.luckperms</groupId>
            <artifactId>api</artifactId>
            <version>5.4</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.spigotmc</groupId>
            <artifactId>spigot-api</artifactId>
            <version>1.21.1-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>
</project>
eternal night
#

paste your pom

rapid wharf
eternal night
#

<artifactId>maven-shade-plugin</artifactId>

rapid wharf
#

i need to remove it?

eternal night
#

you should just slap a <scope>provided</scope> at the wild loader api

sly topaz
#

why are you using a plugin you don't understand lmao

#

all your APIs are provided, so you can just remove it instead

sly topaz
rapid wharf
#

intellij did it

#

not me

sly topaz
#

what the maven shade plugin does is create a fat jar, which means all your dependencies which aren't marked as provided will be bundled into your plugin jar

rapid wharf
#

i mean from deps

sly topaz
#

just remove the maven shade plugin from your pom

#

you don't need it right now, you'll eventually learn what it does when you do need it

rapid wharf
#

ok

rapid wharf
sly topaz
#

because that also works

eternal night
#

you should do that anyway

#

no matter if you remove the shade plugin or not

#

that dependency is provided to your plugin at runtime, it should be scoped as such

rapid wharf
#

i removed shade plugin and it works without <scope>provided</scope>

eternal night
#

yes

rapid wharf
#

why

eternal night
#

because now there is no shade plugin?

rapid wharf
eternal night
#

shade plugin basically "merges" all your dependencies into your output that are not marked as provided

sly topaz
#

setting the scope doesn't do anything other than giving maven information about the dependency's well, scope

#

it does do something when there's plugins like maven shade involved, however

#

that being said, given that the dependency is in fact provided, you should mark it as such

rapid wharf
#

from maven repo is provided?

rapid wharf
#

thnks

sly topaz
#

if you don't understand what it means, feed it to chatgpt and ask it to reword it in a simpler way or something

#

not totally what I do myself with these kind of technical guides

deft summit
sly topaz
deft summit
#

I'll have to figure out how, but I'll try that

sly topaz
quasi kite
#

The plugin isn't workingEven I placed the files in the bukkit,yml and also deleted the previous world please help me

deft summit
sly topaz
deft summit
#

would be great, thanks a lot

undone axleBOT
#

"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.

deft summit
#

I suppose I'll just use intellij for the time being, cuz i really don't want to have to restart the server every single time I make a change lol

sly topaz
#

I don't personally find that being that big of a burden tbh

#

but that's mostly because I test with a remote server and not a local one lol

#

otherwise my computer would be fried

peak depot
sly topaz
#

it is wrong, now I can't un-notice it

blazing ocean
#

That's intentional

shadow night
somber scarab
#

hello

#

I have a weird issue,... Whenever I try to get a display name of an Item, it's always blank