#help-development

1 messages Ā· Page 934 of 1

native nexus
#

I remember having to use the windows api for C

blazing ocean
native nexus
#

Switch statements 🤦

rough ibex
#

Is that gitea; awesome

worldly ingot
#

Some people have far too much free time

rough ibex
#

I remember seeing a writeup on it on HN before

lost matrix
#

We could just compile spigot to native binaries with Graal, no?

shadow night
#

You could but plugins?...

blazing ocean
#

"can somebody help me? heres my code:" ```bash
function timer() {
while true; do
if [[ $time_left -le 0 ]]; then
pos=$(cat $TEMP/players/$nick/position)
pkt_effect $(awk -F, '{print $1}' <<< "$pos") $(awk -F, '{print $2}' <<< "$pos") $(awk -F, '{print $3}' <<< "$pos") 1032
sleep 1
break
elif [[ $time_left -le 5 ]]; then
sleep 1
pos=$(cat $TEMP/players/$nick/position)
pkt_effect $(awk -F, '{print $1}' <<< "$pos") $(awk -F, '{print $2}' <<< "$pos") $(awk -F, '{print $3}' <<< "$pos") 1000
time_left=$((time_left-1))
elif [[ $time_left -le 10 ]]; then
sleep 5
time_left=$((time_left-5))
else
sleep 10
time_left=$((time_left-10))
fi
if [[ ! -a $TEMP/players/$nick ]]; then # die if disconnected
break
fi
pkt_chatmessage "§aTime left: §r${time_left}s" "00000000000000000000000000000000"
done
pkt_disconnect "Time's up! Your final score: §a$(cat $TEMP/players/$nick/score)"
}

young knoll
#

Wonder if hypixel does that

peak jetty
#

can i use this "§" instead of ChatColor?

lost matrix
#

Probably not. Something as dynamic as a game is quite difficult to not fk up with graal binaries.
There is no garbage collection, so everything needs to be statically analyzable at compiletime.

worldly ingot
young knoll
worldly ingot
#

Because that'd be so masochistic and awesome at the same time

blazing ocean
#

surely

young knoll
worldly ingot
#

oh lol

peak jetty
blazing ocean
#

use some serializer

dry hazel
worldly ingot
#

You should use & instead and translate that into the section symbol

young knoll
#

That’s why you use & and translateAlternateColorCodes

#

Or minimessage or minedown or whatever

rough ibex
#

uhh

blazing ocean
#

ok buddy

dry hazel
#

?services probably

undone axleBOT
worldly ingot
#

Yeah that's a services thing :p

#

See thread above

lost matrix
#

Its only viable for running jvm bytecode or javascript, R etc

young knoll
#

Hypixel actually runs in web assembly

lost matrix
#

It runs in javascript. Without node. Some poor guys just have a blank website open all the time which run all the servers.

blazing ocean
#

just compile your entire server including resources and plugins to an exe guys

#

šŸ˜”

young knoll
#

I wonder if any of hypixel is in Kotlin

blazing ocean
#

probably not

young knoll
#

Or Scala

blazing ocean
#

groovy

lost matrix
#

Honestly i should look a bit more into Graal and do some benchmarking with it.
Just to see if has general benefits over an openjdk for example.

worldly ingot
#

(/s)

young knoll
#

Knew it

rough ibex
#

buildbattle.war

young knoll
#

Choco can you disclose if there is any Kotlin usage?

blazing ocean
#

buildbattle.bat

lost matrix
#

Dont tempt him

worldly ingot
#

I can probably say that the job listing doesn't require any Kotlin knowledge

#

So, do with that what you will

rough ibex
#

fair enough

young knoll
#

Fair enough

blazing ocean
#

thats sad

#

kotlin is really fun to use

rough ibex
#

to be fair, being a java dev and going to kotlin isn't hard

round finch
#

NO not kotlin

dawn flower
#

why are docs to annoying to make 😭

rough ibex
#

haha

dawn flower
#

how do i make this in a gitbook

lost matrix
#

I would be astonished if a big project actually decides to use Kotlin. The language is so scripty, i wouldnt want
a bigger team to throw their infix and extension garbage into every corner of the code.

rough ibex
dawn flower
#

this thing

worldly ingot
#

Would it not just be `this` in gitbook as well?

dawn flower
#

blah

worldly ingot
#

It's just Markdown so

rough ibex
#

yeah

dawn flower
#

oh

#

im dumb

rough ibex
#

you can write ```java
this
```

#

and whatever

#

I'm positive gitbooks has language highlighting

lost matrix
#

Depends on the installed style. But it has on default.

round finch
rough ibex
#

hm?

round finch
#
//test
rough ibex
#

i intentionally wrote `

#

to show how to actually write it

dry hazel
lost matrix
#

I wanna compile the spigot server with Graal now

dry hazel
#

it's probably possible without too many drawbacks

dawn flower
#

i didn't even make alot of actions and i spent an hour just writing player actions

lost matrix
#

I mean reflections are just dead -> Plugin loading will not work. Anything that does classpath scanning wont work.
Serializations based on marshalling wont work.

Thats what i imagine the drawbacks gonna be.

young knoll
#

No plugin loading seems like a bit of a drawback

blazing ocean
#

datapacks >>

young knoll
#

Will those load

#

Kek

lost matrix
rough ibex
#

Datapacks should load as long as you have IO

quaint mantle
#

Any way to add hearts to the player but not show it past 2 bars? (1.20.4)

rough ibex
#

since they're all data driven

young knoll
#

Use the wacky health scaling system

shadow night
lost matrix
#

Shure you can just add your plugin as a dependency and shade it in.
Just need to find a way to run your onEnable and onDisable without the plugin loader.

blazing ocean
#

mixins /j

lost matrix
#

Or dont use JavaPlugin at all, since you are writing code directly into spigot in the first place

dawn flower
#

mixins should exist in plugins ngl

#

kinda useful

#

but abit op

shadow night
dawn flower
young knoll
#

Well yes there is some effort to make 2 mixins to the same method not conflict

shadow night
young knoll
#

But that doesn’t stop people from being dumb

dawn flower
shadow night
#

We need some kind of nms plugin system

dawn flower
#

highest weight applies the mixin if it conflicts

shadow night
young knoll
#

What does that even mean

blazing ocean
fallen lily
#

Mixins are nice

shadow night
dawn flower
#

if both are equal then it just picks whatever plugin loaded first

young knoll
#

Yes

#

But again that doesn’t stop people from being dumb

shadow night
dawn flower
#

šŸ’€

shadow night
#

Lmao

blazing ocean
#

LGTM

young knoll
#

Feeling cute might mixin Player.getItemInMainHand to always return a potato

dawn flower
#

šŸ—æ

shadow night
blazing ocean
#

so real

dawn flower
#

they could limit mixins to only add code and not modify the return value

#

to head or tail

shadow night
dawn flower
#

u got a point

shadow night
#

I always wanted to make cos always return 0.4719154

dawn flower
blazing ocean
#

mixin to the bukkit class so it returns null for everything

dawn flower
#

mixin getServer to return null

#

and getPluginManager

#

watch 500 exceptions of plugins trying to register listeners

blazing ocean
#

mixin JavaPlugin so you cant getconfig and similar stuff

dawn flower
#

honestly adding a plugin from a dummy can do abunch of stuff anyways

#

they can break a plugin with reflection

#

they can break the entire server already so mixins wouldnt be that bad

quaint mantle
dawn flower
#

exactly my point ^

quaint mantle
#

My command aint working

blazing ocean
#

mixin so the server owner cant do anything šŸ’€

dawn flower
blazing ocean
#

and has a diff name

dawn flower
quaint mantle
dawn flower
#

bukkittask ban everyone with perms that isn't u

dawn flower
#

in resources

quaint mantle
#

Nvm

#

I do

dawn flower
#

add

#
commands:
  commandName:
    description: description here
    permission: add a permission if needed
    usage: usage here```
#

to to end of plugin.yml

#

if u dont want a permission u can remove it

young knoll
#

I don’t think any are technically required

#

But yeah

dawn flower
#

you can literally do

#
commands:
  commandName:```
#

that works

delicate lynx
#

it's better to delcare permissions properly

shadow night
#

Why tf are those even required in the plugin.yml

dawn flower
#

infact i do that for test commands all the time

shadow night
dawn flower
#

you technically dont even need to put it in plugin.yml but it's better to than messing with command map

blazing ocean
#

AFAIK ACF does that

dawn flower
#

why cant u just make a command executor class with getPermission, getUsage, getPermissionMessage, getDescription and register that

quaint mantle
#

Yep It works now

young knoll
#

Yeah there are plenty of frameworks to do it without plugin.yml

dawn flower
#

honestly i dont like messing with command map

#

i like doing it the official way

peak jetty
#

how do you sent colors in console?

dawn flower
#

to avoid bugs

blazing ocean
dawn flower
#

you can do getLogger().warning

#

or .severe

#

.severe is red but .warning is better

blazing ocean
eternal oxide
#

You can with ConsoleSender

blazing ocean
#

yeah

eternal oxide
#

So long as your console supports colours

dawn flower
young knoll
#

The better method is to not tho

#

Logs don’t need fancy colors

dawn flower
#

it gets mest up

#

if it doesnt support colors

eternal oxide
#

colours in console are a bitch for logs

dawn flower
#

honestly dont even tell the console itt cant run that command

#

most plugins dont pretty sure

#

i personally dont, it's pointless

young knoll
#

Better than just doing nothing with no message

dawn flower
sterile flicker
#

is there a pathfinder so that the entity does not move further than a certain distance from spawn?

sterile flicker
dawn flower
#

or use listeners and teleport the entity back if it got too far

sterile flicker
#

but is there such a pathfinder?

dawn flower
#

prob not

#

u gotta make ur own

eternal oxide
#

kinda, but it's dragon logic

dawn flower
young knoll
#

There’s a few mobs with that behaviour

#

But it’s better to just make your own

sterile flicker
young knoll
#

?

quaint mantle
#

Well it now gives me the usage and shows the command but the command doesn't work

#

and now my loop is broken

dawn flower
#

uh how do i fix /untitled in gitbook

sterile flicker
quaint mantle
#

?files

#

?upload

#

?file

sterile flicker
#

or I can't avoid creating my own

quaint mantle
#

?code

#

?msg

young knoll
#

I don’t think there’s any that will work out of the box

quaint mantle
#

Whats the link

blazing ocean
#

?past

young knoll
#

?paste

undone axleBOT
blazing ocean
#

?paste

undone axleBOT
blazing ocean
#

fml

quaint mantle
#

And this is the console msg

#

Idk what I did wrong so

young knoll
#

You misspelt the command in your plugin.yml

blazing ocean
#

damn lmao

quaint mantle
#

Now it works šŸ’€

#

Well now I have this

#

It doesn't do what I expected very nice

#

Yea I figured out why

acoustic pendant
#

How can I avoid numbers showing like this?

sterile flicker
#

nms pathfinders. how to cancel the move of an entity through getNavigation?

chrome beacon
#

§f

blazing ocean
acoustic pendant
chrome beacon
#

oh xd

acoustic pendant
chrome beacon
#

Use the NumberFormat class

acoustic pendant
#

But it doesn't allow more than integer limit

chrome beacon
#

or DecimalFormat if you want decimals

acoustic pendant
chrome beacon
#

DecimalFormat should allow that

acoustic pendant
#

I'll try that thanks

quaint mantle
acoustic pendant
young knoll
#

Use the players attributes to change their max health

chrome beacon
young knoll
#

Specifically attribute.GENERIC_MAX_HEALTH

chrome beacon
#

There's probably a better way to do it though šŸ¤·ā€ā™‚ļø

rough ibex
#

That's how I've been doing it, not sure there is another way

acoustic pendant
quaint mantle
dawn flower
#

how do i check if a crop is grown from a Block object

dawn flower
#

can that be used to check if a block is a crop

young knoll
#

There is actually a formatter for that in newer java

chrome beacon
young knoll
#

CompactNumberFormat

dawn flower
#

wait wouldnt CropState work as well?

young knoll
#

Or something similar anyway

chrome beacon
peak jetty
#

an error is saying that this message is null:

acoustic pendant
chrome beacon
peak jetty
rough ibex
#

did you set a wrongUsage field

chrome beacon
#

^^

peak jetty
rough ibex
#

I assume EasyBanGUI is the plugin and you're looking for the static field

chrome beacon
rough ibex
#

it would be nice to see more than 1 line at a time too

#

and maybe as text

#

?paste pls

undone axleBOT
dawn flower
#

in plugin.yml

rough ibex
#

do you understand what static does

#

and why its different from not static

peak jetty
chrome beacon
#

alr then stop the static abuse

young knoll
#

Aboose

rapid vigil
rough ibex
#

static abuse is using static when you shouldn't

peak jetty
#

how should i be doing it then?

chrome beacon
#

?di

undone axleBOT
chrome beacon
#

Use di

peak jetty
#

but doesnt it work either way?

chrome beacon
#

Ideally you'd split things up in to more classes

blazing ocean
#

is this what you call static aboos

rough ibex
#

Yes

hazy parrot
#

Yea

blazing ocean
#

i have way more but i wont go over it

ivory sleet
#

more like companion object abuse lol

peak jetty
blazing ocean
#

is this better? (other project)

young knoll
#

Kotlin wacky

#

What is lateinit

blazing ocean
#

smh

#

its something that gets initialized later

fallen lily
blazing ocean
#

its like a "trust me bro" sorta thing

chrome beacon
#

You instead create an empty config

#

and then load the file ignoring the result

chrome beacon
#

Use the loaded messages file

#

save it to the messages variable instead of ignoring it

peak jetty
rapid vigil
#

no

chrome beacon
#

That's you saving it

#

well saving an empty config

blazing ocean
#

also you shouldnt throw runtime errors for that

#

in most cases

rapid vigil
blazing ocean
#

why would it be

rapid vigil
#

then why shouldnt he

blazing ocean
#

why do you want errors in your console for that

chrome beacon
#

if it fails to save the config

peak jetty
rapid vigil
#

ooh i didnt know throwing an exception would shutdown the server

young knoll
#

It doesn’t

blazing ocean
#

is it a runtime exception thing?

young knoll
#

Unless it’s in a critical part of code that triggers a crash

rapid vigil
#

oh so throwing a runtime exception after failing to save the file would cause it to shutdown

young knoll
#

It shouldn’t

chrome beacon
#

yeah ignore me

#

either way that's a bad error to use there

rapid vigil
blazing ocean
#

catching an error and throwing another one also isnt good

young knoll
#

It’s best to log a message and then either disable the plugin or do something to recover

blazing ocean
#

at that point just dont trycatch

peak jetty
#

@chrome beacon i dont really get how im meant to do it

chrome beacon
#

It's a 1 line change

#

Don't over think it

peak jetty
#

should i be changing createCustomConfig();?

chrome beacon
#

yes

rapid vigil
#

Olivo you dont die if you spoonfeed 😜

#

jk

peak jetty
#

any clue lol?

chrome beacon
peak jetty
#

createCustomConfig(); creates and empty config right?

chrome beacon
#

yes

#

but why does it do that

young knoll
#

Slime spotted

chrome beacon
#

sweats md_5

peak jetty
chrome beacon
#

sort of

rapid vigil
#

because youre not giving it a loaded file

chrome beacon
#

^^

zealous osprey
chrome beacon
#

wrong slime

peak jetty
#

so i gotta change something here?

private void createCustomConfig() {
        messagesFile = new File(getDataFolder(), "message.yml");
        if (!messagesFile.exists()) {
            messagesFile.getParentFile().mkdirs();
            saveResource("messages.yml", false);
        }
        messages = new YamlConfiguration();
        YamlConfiguration.loadConfiguration(messagesFile);
    }```
chrome beacon
#

yes

rapid vigil
#

fOr ThE 500tH tImE yEs HeRe

chrome beacon
#

Try asking better questions

#

you've asked the same thing like 3 times now

#

If you can't find the problem try explaining row for row what the code does

peak jetty
#

so it sets messagesFile to messages.yml

#

then if it doesnt exist it creates it and saves it

#

then it makes messages a yamlconfiguration

rapid vigil
#

oh btw, heres a side note

peak jetty
#

wait the probems here

chrome beacon
#

mhm

peak jetty
peak jetty
# chrome beacon mhm

so it loads a new configuration(messagesFile) instead of loading it from messages?

chrome beacon
#

?

#

You're loading the messageFile and doing nothing with it

#

if that's what you're asking

rapid vigil
#

more like doing nothing with it then loading it?

chrome beacon
#

no

rapid vigil
#

oops sorry

chrome beacon
#

messages will always be an empty config because you're just making it an empty config

#

instead of using the loaded one

rapid vigil
#

youre not using the one you need to use but instead making an empty one

peak jetty
#

i got it!

chrome beacon
#

Not quite what I had in mind

peak jetty
#

oh

#

it works now tho

chrome beacon
#
messages = YamlConfiguration.loadConfiguration(messagesFile);
young knoll
#

YamlConfiguration.loadConfiguration

#

Doesn’t throw any exceptions

#

Actually I think it can still throw invalid

#

But not io

ocean hollow
#

how can I get amount of lines in TextDisplay?

chrome beacon
#

You can use a regex to count line breaks

ocean hollow
#

like it? and than .length?

young knoll
#

Does the line break even get added server side

chrome beacon
#

It's just a string?

tawdry echo
#

What do you think about SmartInvs? It's good to use or something else?

chrome beacon
#

or am I missing smth

young knoll
#

I know you can manually add line breaks

#

But you can also just set a size for it to automatically break

chrome beacon
#

I guess it would be a component and Spigot doesn't expose that

chrome beacon
young knoll
#

Idk if the breaks are added on the server or the client though

chrome beacon
#

Never used them

ocean hollow
young knoll
#

The heck is smartinvs

tawdry echo
dawn flower
#

how do i make an api for a paid plugin without accidently giving free access to the plugin

glad prawn
inner mulch
chrome beacon
#

It's a library I think

inner mulch
#

i wouldnt use it

chrome beacon
#

to it's own module and jar

dawn flower
#

then how does the api interact with the plugin

chrome beacon
#

Your plugin contains the api

dawn flower
#

oh

#

ic

inner mulch
#

guys do you think i should make my own placeholderapi?

rough ibex
#

like, your own placeholders?

#

or your own placeholderAPI fork

inner mulch
chrome beacon
#

PlaceholderAPI with Component support

inner mulch
#

making a placeholderapi doesnt seem to hard, or is there anything i might have overlooked in terms of how hard it can get to create one?

chrome beacon
#

The hardest part is getting people to use it

inner mulch
#

im not planning to publish it, i just wanted to create it myself so i dont rely on a plugin

chrome beacon
#

Then no it's not hard

hazy parrot
#

I mean papi is kinda standard, can't see reason to not rely on it

final wharf
eternal oxide
#

why boosted?

quiet ice
#

try updating maven-shade-plugin

final wharf
final wharf
eternal oxide
#

he lied

final wharf
#

i just like how boostedyaml is

quiet ice
eternal oxide
#

Snake Yaml that is already bundled with Spigot is simplest to use

final wharf
quiet ice
final wharf
#

it got underlined

quiet ice
#

Consider updating the other plugins too if you are already at it and they aren't updated yet - I don't know the latest versions from the top of my heart though

final wharf
#

reloaded maven

quiet ice
#

Flush caches and restart the IDE

final wharf
final wharf
quiet ice
#

Unless you provide me with a good enough log it's an IJ issue and not something I can support you with

final wharf
#

what other stuff do you need?

quiet ice
#

Just restart the IDE

#

Else, wait until some IJ fanboy arrives. Here, I'll summon them for you: Eclipse is the best IDE ever

final wharf
final wharf
quiet ice
#

Oh, and don't duplicate the maven-shade-plugin entry

final wharf
#

oh okay

#

still with red

quiet ice
#

why does maven even allow that?

quiet ice
final wharf
#

nope

quiet ice
#

What is the build error?

final wharf
#

i would honestly just go with gradle

#

its easier to shade in gradle

quiet ice
#

that is using the old maven-shade-plugin version...

#

what pom are you using right now? This shouldn't be that complicated

#

In fact, shading in maven is miles easier than in gradle (though you give up quite a lot of control in the process)

final wharf
quiet ice
#

Remove lines 51 to 63, they are redundant

final wharf
#

done

quiet ice
#

Why that is a valid POM is beyond me, but I suppose it has to do with how maven evaluates super-POMs being a bit too hacky which ends up being all too lax

#

Does it build now?

final wharf
#

lemme try and do something with boosted yaml

#

and see if it acctually shaded

quiet ice
#

Great, you may need to restart your IDE though.
Also, it'll shade unconditionally so you can simply look at the filesize and if it is inflated it did some shading

#

Regardless of whether a dependency is being used.

Also, beware: This pom shades in adventure-api, which is provided on paper already and won't work as-is on bukkit.

As such, I recommend to set scopes explicitly (provided for stuff that doesn't need to be shaded [as it is provided by bukkit or by another plugin] and compile for dependencies that need to be shaded [usually 3rd party libraries])

final wharf
#

its a paper plugin

#

"where i am"

quiet ice
#

then don't shade in adventure-api

final wharf
#

its only minimessage

quiet ice
#

Hell, I wouldn't even declare the dependency

final wharf
#

afaik

#

eh

#

if it doesnt cause issues

quiet ice
#

Well shading the dependency does cause issues (the least of which is inflated file size)

final wharf
#

1mb at most

quiet ice
#

hence, the least. The bigger one is that you'll get classloading failures if the paper classloader isn't smart enough to ignore your shaded adventure classes

#

Removing the dependency means that you'll have access to the same version of adventure that paper uses which means that you'll not be troubled by out-of-date stuff or other incompatibilities

dawn flower
#

how do i listen to all events?

#

public void onEvent(Event e) throws

org.bukkit.plugin.IllegalPluginAccessException: Unable to find handler list for event org.bukkit.event.Event. Static getHandlerList method required!
        at io.papermc.paper.plugin.manager.PaperEventManager.getRegistrationClass(PaperEventManager.java:124) ~[paper-1.20.4.jar:git-Paper-430]
        at io.papermc.paper.plugin.manager.PaperEventManager.registerEvents(PaperEventManager.java:84) ~[paper-1.20.4.jar:git-Paper-430]```
rough ibex
#

its a general question

quiet ice
#

At least I think that is the correct article

#

For some reason I am now forced to enable 2FA to view threads?

dawn flower
#

i found this which looks simpler

RegisteredListener registeredListener = new RegisteredListener(this, (listener, event) -> onEvent(event), EventPriority.NORMAL, MAINCLASS, false);
        for (HandlerList handler : HandlerList.getHandlerLists())
            handler.register(registeredListener);```
#

but im not sure what it means by MAINCLASS

rough ibex
#

I would imagine your plugin

#

its main class...

quiet ice
#

Nah

rough ibex
#

ah

quiet ice
#

?jd-s

undone axleBOT
kind hatch
#

Couldn’t be that easy

quiet ice
#

Okay, apparently yes

#

Who the fuck names their plugin instance like that

kind hatch
#

I would assume that is placeholder text

rough ibex
#

yeah

quiet ice
#

At least use JavaPlugin.getPlugin(ExamplePlugin.class)

#

But no, it has to be MAINCLASS

#

But I digress

dawn flower
#

RegisteredListener registeredListener = new RegisteredListener(eventListener, (listener, event) -> eventListener.onEvent(event), EventPriority.NORMAL, this, false);

#

like this?

quiet ice
undone vapor
#

anybody know if it's possible to intercept network streams before any handshaking has been done on a Spigot/Bukkit server using mixins?

quiet ice
#

I suppose you already use ignite or comparable?

#

But I don't think mixins is required here, you can plainly attach you code to the netty channel handler

#

They are most likely not

undone vapor
#

can this be done with protocollib?

#

I need to be able to intercept the raw streams and take control of them if the data received passes some checks

#

Okay thanks

final wharf
quiet ice
#

Check Flux.java:44. Otherwise not much I can do here

#

Outside guessing ofc

final wharf
#

it was something with boostedyaml

quaint mantle
#

can someone help me w my server rq pls

final wharf
quaint mantle
#

what

undone vapor
#

Is it possible to intercept data this before the player actually "joins" the server? I need to read right from the connection of the client to listen for a custom handshake format

quaint mantle
#

pls someone help me

quiet ice
quiet ice
quaint mantle
# quiet ice Sir, this is a Wendy's

cool anyways

[17:58:13] [Netty Epoll Server IO #1/WARN]: An exceptionCaught() event was fired, and it reached at the tail of the pipeline. It usually means the last handler in the pipeline did not handle the exception.
java.lang.RuntimeException: Unable to access address of buffer
    at io.netty.channel.epoll.Native.read(Native Method) ~[server.jar:git-Spigot-21fe707-741a1bd]
    at io.netty.channel.epoll.EpollSocketChannel$EpollSocketUnsafe.doReadBytes(EpollSocketChannel.java:678) [server.jar:git-Spigot-21fe707-741a1bd]
    at io.netty.channel.epoll.EpollSocketChannel$EpollSocketUnsafe.epollInReady(EpollSocketChannel.java:714) [server.jar:git-Spigot-21fe707-741a1bd]
    at io.netty.channel.epoll.EpollSocketChannel$EpollSocketUnsafe$3.run(EpollSocketChannel.java:755) [server.jar:git-Spigot-21fe707-741a1bd]
    at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:380) [server.jar:git-Spigot-21fe707-741a1bd]
    at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:268) [server.jar:git-Spigot-21fe707-741a1bd]
    at io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:116) [server.jar:git-Spigot-21fe707-741a1bd]
    at java.lang.Thread.run(Thread.java:840) [?:?]
#

:3

quiet ice
#

And what does that have with us?

final wharf
#

it works now

quaint mantle
final wharf
#

thanks for the help

chrome beacon
quiet ice
#

I'll bully you off this channel if I have to :meanfaceemojiiiiiii:

chrome beacon
#

It's already fixed

#

No need to ask for assistance with it

quiet ice
#

Well I mean you only have to get access to the netty pipeline. But given that I never touched NMS I cannot assist you further

young knoll
#

Unfortunately that error isn’t very helpful in finding the cause

chrome beacon
#

eh I know what the issue is

tulip owl
#

Has anyone ever tried implementing NuVotifier in Minestom? Or even something that is platform agnostic

chrome beacon
#

Just going to delay the answer since they decided to try and ping @here

chrome beacon
young knoll
#

Isn’t it fairly platform agnostic already

chrome beacon
#

It is

tulip owl
#

Ah, nice

young knoll
#

Since it’s mostly just dealing with http stuff

tulip owl
#

Yeah

#

I guess I’ll see if i can implement it without any commands or config though as that’s what I’d prefer in a Minestom environment

#

Is protocol V1 used any more? Do I need to bother supporting it

quiet ice
#

You most likely could make use of the common artifact as-is as it has Velocity support it shouldn't depend on anything NMS-related anyways

#

and the bukkit implementation is incredibly stripped down

tulip owl
#

Ah, yeah! I’ll take a look through common and see

dawn flower
#

damn im so proud of myself

#

i made an addon system first try

#

šŸ”„

quiet ice
#

with a custom classloader?

dawn flower
#

(im not that advanced)

#

explain in simpler terms

quiet ice
#

oh god, that does not bode well

dawn flower
#

i might have a custom classloader and i woudlnt know

quiet ice
#

You probably do know given that I mean anything being an or subclassing ClassLoader with that

#

unless you don't mean the same with addon system as I do

dawn flower
#

it's basically just the good ol' addon system where you register an addon object with stuff like skript

tulip owl
#

Isn’t that what the Bukkit API is for?

analog mantle
#

Do you guys have any ideas how I can format this better?
[Sword] 2 is the amount of danger that item has.
+1 [Shield] is the percent of damage you take. (100% is 1, .75 is 75% damage)
+1.02 [Crossed Swords] is the amount of damage that you deal in 1 damage (Currently deals 2% more damage, no limit)

quiet ice
#

ah well then, yea. I was thinking of something else. But then again, I do a bit too much with classloaders so I immediately jumped to the conclusion that you decided to go down that dangerous path

dawn flower
#

ah

#

im still insanely proud

#

cuz of how hardcoded my code was

#

which is a bad thing

#

but now i dont have to worry about adding 500 actions and 600 events and 300 placeholders

quiet ice
#

For the incoming damage either use something like "x1.0"/ "x0.75" or "100%"/"75%", which is probably the best way out there (and use hex colors to make 1x be red and 0x green, and neatly color the rest in between)

dawn flower
#

maybe bold the 2 swords abit

analog mantle
#

That's too much bloat in the lore tho

dawn flower
#

limit double to 1 decimal point

dawn flower
#

the 2 swords are too thin

#

the new line is optional

rough ibex
#

clearly visible

quiet ice
#

the main problem I see are the symbols that are used and what they convey

dawn flower
#

but thin

#

1 pixel wide

quiet ice
#

We are playing minecraft, a pixel is rather large here

#

though honestly you can't be talking about a pixel here

dawn flower
#

just make it bold and compare both

rough ibex
#

Nah

dawn flower
#

ok so now how do i disconnect my api from the plugin so people cant get the plugin for free

rough ibex
#

just delete the api key

dawn flower
rough ibex
#

what are you doing

analog mantle
dawn flower
#

im talking abt an api like a dependency

dawn flower
#

that looks

rough ibex
#

Bad

dawn flower
#

amazing

analog mantle
rough ibex
dawn flower
#

how does one explain this

dawn flower
#

uh

rough ibex
#

You want people to be able to talk to your plugin

#

without providing it

#

Yes?

analog mantle
dawn flower
inner mulch
dawn flower
#

what do u think

inner mulch
analog mantle
dawn flower
#

oh

inner mulch
analog mantle
#

I dabble.

dawn flower
#

so people dont spam kill alts

analog mantle
dawn flower
#

that's cool

analog mantle
#

I think I want to change the crossed swords to +1.02 to +2%

#

what would be the equation for that

inner mulch
analog mantle
#

I got it

rough ibex
#

The order of the icons isnt consistent

analog mantle
inner mulch
#

1st parameter has icon first

rough ibex
#

Icon number number icon number icon

inner mulch
#

2nd paramter has icon last

#

3rd parameter has icon last

analog mantle
inner mulch
#

looks good

analog mantle
#

But the green part is a little misleading

inner mulch
#

green part defense?

analog mantle
#

I would assume as a player, that the higher the green, the better. In reality, it's actually the opposite. The closer to 0 green is, the less damage you take

quiet ice
#

yeah, I already outlined possible solutions there

inner mulch
quiet ice
#

Also, green = good; red = bad. Keep this video game logic in mind

analog mantle
#

Yes, red = bad

#

If you have higher danger, you are inherently more dangerous = more outlawish

quiet ice
#

Yeah, damage is the only real place where this rule doesn't really apply tbh

analog mantle
#

Japanese Symbol For Beginner or Shield emoji?

rough ibex
#

shield

analog mantle
#

How can I convey that the player only takes that amount of damage

#

Maybe I invert it and make it +7%

short shale
#

hello guys, i would like to know how can i get the truth item's name

#

item.getItemMeta().getDisplayName() doesn't works

analog mantle
#

Welp, I think that's wraps

#

thank you guys

chrome beacon
#

Ideally you wouldn't get the name yourself and use a translatable component instead

short shale
#

i've heard about it before

#

i'll try, thank you ā¤ļø

timid summit
#

change the world of hell in mc

dusky wigeon
#

can you make it so that entities other then sheep and that mushroom cow can be sheared ?

#

specifically when it comes to PlayerShearEntityEvent.

rough ibex
#

no but

#

you can check for right click event on ent with shears

#

and then do stuff

dusky wigeon
#

F

rough ibex
#

that's not that bad

dusky wigeon
#

true, can you play the sheering sound when that happens ?

rough ibex
#

like I said

#

you can do stuff

#

you can do anything

#

playing a sound isn't hard

dusky wigeon
#

yeah, i am not that familiar with spiggot or plugin developments so that is why i was asking for the sound part.

i have only been doing it for like 3 days or so šŸ’€

#

but yeah, it is WAY easier then mods.

rough ibex
#

?jd-s

undone axleBOT
rough ibex
#

search for playsound

dusky wigeon
#

šŸ™

lost matrix
#

For a chest shop plugin, do you guys think i should just use normal chests, or should i display if a shop is empty/closed/open with colors like that?

#

Scaled up heads kinda look a bit pixelated, even for minecraft

#

Nvm i have a better idea. Ill decorate the corners of the vanilla chest with colors.

wet breach
#

All of it

twin venture
#

i have a problem , its 7am my brain stoped working xD

so when i click on enchant book , it open gui with the items can be enchanted = done
my problem is when i click on the item that is displayed in the gui , it get enchanted , but when it close the inv , it does not update the item in player inv

#

this is the enchanting code :

glad prawn
analog mantle
#

//ToDo thing is the most cursed thing i've seen

#

It's // TODO: thing. End of story.

jagged bobcat
#

Looks like my todo comments

rough ibex
#

I should write more // TODO

#

Instead of trusting my memory

jagged bobcat
#

I do // todo too

#

Comment previous code and crown it with // TODO

oak bolt
shadow night
#

?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! šŸŽ‰

oak bolt
glad prawn
#

then ask chat gpt

shadow night
#

And fail again

#

Without learning java you won't be able to do anything in java

oak bolt
#

im not tryna make a massive plugin for a massive server, im just tryna get help making a very tiny thing that just adds a single effect to a plugin...

shadow night
#

And you'll still want to know java

oak bolt
#

ok, let me clear this up

#

i dont want to learn java, i want help making this one thing, then il most likely never touch java in my life again...

#

i already established i just want help making this one tiny thing

glad prawn
#

i mean you can ask the devs in that plugin's community to help create it instead of asking here.

shadow night
#

Yes

oak bolt
#

thats the first thing i did

shadow night
#

And if you are lacking java knowledge, they'll tell you to learn java

#

We aren't a java support discord, this is spigot

oak bolt
#

yea

#

ik

#

so idk y ur so adamant about java

shadow night
#

Because you need java to code a plugin

oak bolt
#

why are you so adamant about telling me this when im just asking for help with this one thing?

blazing ocean
shadow night
oak bolt
#

bro why

#

why tf are you being like this

blazing ocean
#

...

lost matrix
#

This can not be done without a basic knowledge about java and the spigot api.
Hire a developer or learn to write code. Those are the only options available.

blazing ocean
#

you need to know java to make plugins

#

or, hell, use skriptlang

shadow night
#

Some people šŸ˜‘

blazing ocean
#

did they leave

shadow night
#

ĀÆ_(惄)_/ĀÆ

blazing ocean
#

looks like it

shadow night
#

Imagine you are trying to use an API without knowing the programming language

blazing ocean
#

and trying to do an advanced project for a "small plugin"

shadow night
#

Lmao

lean arrow
#

I think not knowing it is fine, people start somewhere, is fine but not wanting to know it is just ignorant

#

But idk what that guy was trying to achieve

shadow night
#

Usually when I try to write in a language I never wrote in before I try to not ask questions in any communities and just google

#

And that's how I learnt java

slender elbow
#

xd

winter cradle
shadow night
#

Are you two best friends?

slender elbow
#

she says more

quiet ice
#

To be honest either you have such basic questions that noone feels like responding or you have enough knowledge to respond to the basics yourself and stumble on questions that noone can help you with

calm lichen
#

alright its a new day, need to figure this out and hopefully all my other problems will be fixed šŸ™‚

lost matrix
calm lichen
#

i swear i literally had that in 2 seconds ago and it didnt work smh

#

er but i was told yesterday that i need just the spigot and not the spigot-api

#

because i need to fix these 2 errors

lost matrix
# calm lichen because i need to fix these 2 errors

Ah you need craftbukkit.
In that case: Change spigot-api to spigot and make sure to run BuildTools for that version.
Using NMS requires you to locally build spigot at least once, because the sources cant be distributed.
Running BuildTools will do that for you.

#

What do you need nms for btw?

calm lichen
#

right and thats where i got stuck yesterday having installed buildtools but not really understanding what exactly i needed to do with it

fallen lily
#

Thats crazy

calm lichen
#

I'm forking over a core plugin that one of my buddies made for a prisons server several years ago to make it work on 1.20 rather than 1.8, just going off of his code rather than trying to redo everything from the ground up but I'm realizing now that that is probably the better choice lol

#

and he uses those imports for CraftPlayer and a couple other things

lost matrix
#

A lot of stuff which needed nms and crafbukkit back then, is now supported in the API.
It has been 8 years after all.

calm lichen
#

haha yea i figured

#

a little annoying cuz i fixed pretty much everything else that it was telling me was wrong, but oh well

calm lichen
#

😭 i was right it fixed it all

#

god it's beautiful seeing no errors man

zealous osprey
#

Now imagine your code doesn't run and there are no errors. That's so much worse

calm lichen
#

yea lol

#

im just gonna redo the whole thing from scratch šŸ™‚

#

now that I understand and organized everything I have a much better idea how I want to do everything

zealous osprey
fallen lily
#

I like to think of stuff functionally before I introduce OOP, or else you get this eerie ā€œEnterprisenessā€ feeling where suddenly X can be turned into a builder, Y can be a delegate etc etc and in the end you’re wasting hours working on abstraction which you don’t even end up needing

#

Language also helps, Kotlin for sure is easiest to prototype in

twin venture
radiant aspen
#

Yo, is the best way to listen for if a spawner has changed type by listening to PlayerInteractEvent? is there really no specific event?

#

And assuming alot of servers will disable this feature, is there a way to see if its disabled or not? just check if event is canceled? is there a gamerule or anything in spigot.yml I should be aweare of?

twin venture
#

i got everything working now , only 1 bug left ..
it duplicate the item when i enchant :

  • enchanted new item
  • old not enchanted item
    both are in player inventory :p
    how i can fix it?
fallen lily
#

Its in the UI’s inventory

smoky anchor
#

if (clickedItem == null) return;

fallen lily
twin venture
#

:p

lost matrix
#

Just set its ItemMeta

fallen lily
#

How is the item ending up in the player inventory

#

Does this only occur on shift click

twin venture
pseudo hazel
#

is that not the same item?

#

or does it get copied

slate surge
#

can any1 explain me why this shit works in one method and not the other?
gameSession.addPlacedBlocks(location);

#

basically

twin venture
slate surge
#

when i add that method

#

it adds an item but also replaces the all old ones with the new one

slate surge
#

where it works ```java
@EventHandler
public void onBlockPlace(BlockPlaceEvent event)
{
if (event.getPlayer().getGameMode() == GameMode.SURVIVAL)
{
Location location = event.getBlock().getLocation();
gameSession.addPlacedBlocks(location);
}

}```

where it doesn't works

private void setBlockLayer(Location location, Material material, int xOffset, int yOffset, int zOffset)
    {
        location.add(xOffset, yOffset, zOffset);
        location.getBlock().setType(material);
        System.out.println("Item: " + location);
        gameSession.addPlacedBlocks(location);
        for (Location _location : gameSession.getPlacedBlocks())
        {
            System.out.println("List item: " + _location);
        }

    }```
please ignore the debug souts
agile anvil
#

So what exactly doesn't work ?

slate surge
#

in the setBlockLayer method

the list should be like this with every call

[location1]
[location1, location2]
but is rather
[location1]
[location2, location2]

agile anvil
#
  1. Can u show your GameSession thingy?
  2. Please clone the location before applying an offset (especially if it's loc from a player)
slate surge
#
package net.jamnetwork.fireballfight;

import org.bukkit.Location;
import org.bukkit.entity.Player;

import java.util.ArrayList;
import java.util.List;

public class GameSession
{
    private static GameSession gameSession;
    private final List<Player> players;
    private final int maxPlayers;
    private List<Location> placedBlocks = new ArrayList<>();

    public GameSession(int maxPlayers)
    {
        this.players = new ArrayList<>();
        this.maxPlayers = maxPlayers;
//        this.placedBlocks = new ArrayList<>();
        gameSession = this;
    }

    public static GameSession getGameSession()
    {
        return gameSession;
    }

    public boolean joinPlayer(Player player)
    {
        if (players.size() < maxPlayers)
        {
            players.add(player);
            return true;
        } else
        {
            return false; // Game session is full
        }
    }

    public void leavePlayer(Player player)
    {
        players.remove(player);
    }

    public List<Location> getPlacedBlocks()
    {
        return placedBlocks;
    }

    public void addPlacedBlocks(Location location)
    {
        placedBlocks.add(location);
    }

    public void removePlacedBlocks(Location location)
    {
        placedBlocks.remove(location);
    }


}
lost matrix
slate surge
slate surge
agile anvil
#

Do Location have a proper toString method?
What is the output when you print a location?

slate surge
#

when printing the location which is the param it prints correctly but when lopping it messes up

#

first two method calls


List item: Location{world=CraftWorld{name=world},x=93.0,y=58.0,z=-4.0,pitch=0.0,yaw=0.0}

Item: Location{world=CraftWorld{name=world},x=93.0,y=59.0,z=-4.0,pitch=0.0,yaw=0.0}

List item: Location{world=CraftWorld{name=world},x=93.0,y=59.0,z=-4.0,pitch=0.0,yaw=0.0}

List item: Location{world=CraftWorld{name=world},x=93.0,y=59.0,z=-4.0,pitch=0.0,yaw=0.0}```
agile anvil
#

When do you call setBlockLayer?

sand spire
#

Is it safe to use timestamps as unique identifiers or is it possible for 1 player (with autoclicker) to click twice in the same millisecond?

eternal night
#

I mean, even if you'd immediately process two interaction packets, the event handler would not be called in the same milli second

#

if you wanna go real sure, nano second exists too kekwhyper

#

tho the values of those are ehhh, not as well defined

thorn crypt
#

Hello, does someone know how I could spawn DragonBreath ?

lost matrix
#

I think nano is fairly unique for the current runtime. But dont persist it.

eternal night
#

Yea

lost matrix
eternal night
#

I mean, or you just go the normal uuid route and safe yourself the trouble or something doing something stupid.

sand spire
thorn crypt
sand spire
#

But I'll just add a check to cancel the creation of the timestamp if it already exist. No one would ever notice except cheaters šŸ’€

eternal night
sand spire
eternal night
#

no like, for every auction you just create a new random uuid for its id

lost matrix
#

You can just give a UUID to an auction

slate surge
sand spire
#

I thought UUID meant UniqueUserID

#

that's why i was confuse

eternal night
#

like, SQL wise you'd have like

identifier UUID,
owning_player UUID,
creation TIMESTAMP
slate surge
# agile anvil When do you call setBlockLayer?
double x = config.getDouble(path + ".x");
            double y = config.getDouble(path + ".y");
            double z = config.getDouble(path + ".z");

            Location location = new Location(world, x, y, z);

            setBlockLayer(location, Material.getMaterial(26), 0, 0, 0);
            setBlockLayer(location, Material.getMaterial(5), 0, 1, 0);
            setBlockLayer(location, Material.ENDER_STONE, 0, 1, 0);

            setBlockLayer(location, Material.getMaterial(26), -1, -2, 0);
            setBlockLayer(location, Material.getMaterial(5), 0, 1, 0);
            setBlockLayer(location, Material.ENDER_STONE, 0, 1, 0);
sand spire
#

I'm using mongodb but I guess I could use an ObjectID instead of a date of creation as I can extract the date from the _id

lost matrix
#

You can use UUIDs as primary ids in mongo. Indexing is very quick even.

worldly ingot
sand spire
worldly ingot
#

Nah you can just generate a random one

#

It's just a combination of two random longs, basically

sand spire
#

oh wait nvm cause they use the timestamp for creating it

dawn flower
#

what's the difference between

FishHook#setMinLureTime
and
FishHook#setMinWaitTime
and
FishHook#setMinLureAngle

#

which one sets the fishing speed, if any even sets it

worldly ingot
#

Wait time is before a fish bites, so that's probably the one you want

sand spire
worldly ingot
#

Lure time is the time it takes for a fish that is currently swimming (the little particles) to reach your bobber

sand spire
dawn flower
#

luretime and wait time are the same

worldly ingot
#

No they're different :p

dawn flower
#

what's the difference

worldly ingot
#

One is before the fish particles show up, one is after

#

Lure time is the fish particle duration

dawn flower
#

intresting

worldly ingot
#

Wait time is the time between fish particles showing up

dawn flower
#

what abt lure angle

worldly ingot
#

That's just the angle that the fish is coming towards you at (while its particles spawn)

sand spire
dawn flower
#

so the limit is 360?

#

cuz a circle im guessing

worldly ingot
#

Yeah I think I had it wrap around though

#

It's in degrees, so yes, 360

dawn flower
#

šŸ‘

lost matrix
dawn flower
#

last thing, can you listen for armor change event without looping all players every second or using paper api?

worldly ingot
#

We don't have an armour change event in Spigot unfortunately. We've had one PR'd for some time now but nobody's updated it to the latest version to get merged

young knoll
#

I was told diamond was just busy!

worldly ingot
#

Yeah she was busy. I ACTUALLY GOT TO CHAT WITH HER LAST WEEK THOUGH. SHE'S ALIVE

dawn flower
#

is there a way to listen tho

worldly ingot
#

I just didn't wanna prod her the first second I saw her though KEKW

#

Like "Hey, nice to see you again! Wanna get back to work on the armour PR?"

sand spire
sand spire
young knoll
#

That is a non spigot method

worldly ingot
#

Yep, that's good

#

That's a standard JDK method

sand spire
#

ooh

young knoll
#

Time for spigot to invent our own!

#

The SUUID: Super Universally Unique Identifier

#

256 bits

lost matrix
#

Its backed by a global database which checks every single instance ever created to make sure its actually super unique

sand spire
#

Uh, how would I get the timestamp from a UUID? Cause I heard the timestamp is used in generating it

                    Instant.from(timestamp);```
young knoll
#

UUID.randomUUID(); is a v4 uuid

#

Which has no timestamp

sand spire
#

oh

#

i guess I'll just use MongoDB's ObjectID then so I have an identifier and a timestamp at the same time

lost matrix
#

Or you just use a UUID and a timestamp...

young knoll
#

But muh bytes!

sand spire
#

^

#

i learned that in code less is more

#

Why get a music app AND a streaming app if I can just get youtube premium šŸ¤·ā€ā™‚ļø

worldly ingot
#

I mean really you're talking about the difference between 8 bytes and 12 bytes :p

#

I don't know how unique you want to go but you could also just use a single integer as the unique id, but if you're going to access the timestamp often, store it as a separate field

sand spire
#

But I load all auctions once onEnable so i'd only convert the ObjectID to a timestamp once

lost matrix
sand spire
agile anvil
#

Because right now you just add x times the same location to the list

#

Without cloning the location, changing its values will affect the origin object

#

So even if you add it to the list you will just have multiple references to the same object

#

(that will change over time)

sand spire
agile anvil
inner mulch
#

is .startsWith reliable to use when comparing? Or what counts as "startswith"

wide coyote
#

if it starts with, it starts with

fallen lily
#

Ofc if you’re only checking if the string contains another substring, you can’t use this methof

inner mulch
#

tahts what i was about to say, in my case i think this will not work

shadow night
#

the fuck

inner mulch
icy beacon
shadow night
#

huh how

icy beacon
#

Isn't it accepting a Player as the first argument

#

Or even a String

shadow night
#

no

icy beacon
#

Haven't worked with it in a while

shadow night
#

the string is deprecated

icy beacon
#

Uhh

shadow night
#

it should be a player profile

icy beacon
#

Try casting last null to a String

#

Or whatever it should be

remote swallow
#

^^

#

theres mulitple ban methods so it doesnt know what to pass null as

icy beacon
#

Oh that's fair

shadow night
#

that's better

eternal night
#

it is soooo scuffed

icy beacon
#

Though they all seem to take a String

icy beacon
#

That works too ig

remote swallow
eternal night
#

idk, not me

#

lets see who to blame

remote swallow
#

doc i think

young knoll
#

yes

eternal night
#

do I get a role

young knoll
#

Man why does Mojang use private static final

#

It's static and final just let me access it :c

shadow night
#

Lol

#

no, use reflection.

young knoll
#

re

inner mulch
#

isnt static only for constants

young knoll
#

Making me sad

inner mulch
#

me too

icy beacon
#

like constants that aren't useful outsdie of a class

remote swallow
#

imagine if theres kotlin in mc codebase, we wouldnt know bc they'd prob remove metadata

young knoll
#

Welp time to do a little jank

icy beacon
inner mulch
#

instaneof

#

event.getEntity or whatever the method is called instaneof Player for exmple

#

if it is a player cast the entity to player

rapid vigil
#
if(e.getDamager().getType() == EntityType.ZOMBIE) {

}

or

if(e.getDamager() instanceof <ENTITY-HERE>) {

}
ivory sleet
#

I mean ideally but thats pure idealism I suppose

inner mulch
rapid vigil
#

use == for checking enums, and EntityType is an enum

tall dragon
rapid vigil
#

^^

upper hazel
#

how check if custom flag allowed or not

#

wg api

#

i mean not like exists or not

#

i mean really boolean state

rapid vigil
inner mulch
rapid vigil
#

i wonder if there is CommandSender#getType šŸ¤”

young knoll
#

no

#

Just use instanceof

ivory sleet
# inner mulch isnt instanceof like 2 nanoseconds

Instanceof and other stuff like iirc exception handling used to be quite costly, I think the difference is negligible between instanceof and ==, I’d guess tho that at best instanceof is equally fast to ==, but in a worse scenario it may be super ultra negligibly slower

rapid vigil
ivory sleet
#

lol

rapid vigil
#

can u show your code

inner mulch
#

because it is a living entity?

rapid vigil
inner mulch
#

yes but look at what he does LivingEntity entity = (LivingEntity) event.getDamager();

rapid vigil
#

oh yes

shadow night
rapid vigil
shadow night
#

No

#

Arrow is not a living entity

rapid vigil
#

make it check if the damager type is instanceof Arrow instead of Entity and cast to Arrow instead of LivingEntity

#

isnt there a ProjectileHitEvent tho

modern plank
#

hello how do i get the corresponding Sound enum instance from a minecraft key

like lets say i have minecraft:music.nether.basalt_deltas, i need the Sound.MUSIC_NETHER_BASALT_DELTAS, but there is no function like getByKey

icy beacon
#

Arrow is a Projectile so you can check for that