#help-development

1 messages Β· Page 748 of 1

eternal night
#

you only pause single thread

#

das an option in IJ

remote swallow
#

or break the law and use paper with the dsable watchdog flag and keep alive timout

eternal night
#

Well

#

the client would still jump

#

Β―_(ツ)_/Β―

smoky oak
#

uh... i meant the mod that'd remove the timeout thing from the client

eternal night
#

so yea, then you'd need a mod

smoky oak
#

server has this 'dont timeout' thing iirc

remote swallow
#

i wish there was a way to have a run config on all projects, its not hard to make the debug config i just wish i didnt have to

#

and i could make the debug button go to a specific task

sterile token
#

Could you give me a hand with my sendUsage() method of my command system. I have complications with recursion, since my commands are going to be of hierarchical types and where a command can have many arguments and/or sub commands associated with it.

In my case I would like the help to look like this, in case of executing a root command it will only show me the name of the arguments andr sub commands associated to it.

In case of executing a root command without arguments it would be something like this. Where %command% represents the name of the initial command and %argument%, represents the name of the argument and/or sub command associated to it.

%command% Help:
/%command% %argument% %usage% - %description%.

On the other hand, in case a root sub command is executed, the help should show only the names of arguments and sub commands associated to it. Very similar to the detail above, thus obtaining a complete example of how it would be:

Example:

Running /faction would return in the help the names list (argument) and points (sub command).

In case of executing /faction points it would return in the help, the names of arguments and/or sub commands associated to it.

I don't know if I am making myself clear with respect to the sendUsage command

shut shoal
#

Unfortunately, your recent report has been rejected: Resource Update in 'Buildings' - No text description

#

i don't understand :/

#

They deleted the plugin when they sent me that

sterile token
shut shoal
#

which is the contact?

remote swallow
#

?support

undone axleBOT
sterile token
remote swallow
#

go for it

sterile token
sterile token
#

If its not well explained just ping me and i answer in the momment. Thanks because in struggling with recurstion

remote swallow
sterile token
#

Command - interface level with common methods
SingleCommand - a command with no implicit arguments
ParentCommand - This one handle all the logic for sub commands containing a List<Command>

#

Just struggling around the help part, because so far i didnt it appear the help in this way following a simple faction structure

Faction help

/faction list
/faction points add <player> <amount>
/faction points remove <player> <amount>

When it should only appear, when just running /faction

/faction list
/faction points

When running /faction points, then yes it should appear like this:

/faction points add <player> <amount>
/faction points remove <player> <amount>

remote swallow
#

youd have to loop over the command list and get the arg name

sterile token
#

Do i explain more or less to what i refer?

sterile token
#

Do i explain?

hybrid turret
#

Is the BlockBreakEvent fired, when a door is broken on one half and the other half still drops a door?

sterile token
#

So far im testing around this code i just finished:

public void sendUsage(Sender<?> sender, Command command) {
  List<Command> children = getArguments().stream().filter(arg -> isAuthorized(sender) || arg.isAuthorized(sender)).collect(Collectors.toList());
  if (children.isEmpty()) return;
  StringBuilder builder = new StringBuilder(command.getName() + " help \n \n");
  for (Command argument : children) {
    // struggling at this part, because it sends all the command availaible
  }          
  sender.sendMessage(builder.toString());
}
worldly ingot
remote swallow
worldly ingot
#

Unsure

#

Only one of the halfs would do it, I'm just not sure which

hybrid turret
worldly ingot
#

Sounds like a job for BlockPhysicsEvent

hybrid turret
#

oh

#

What is BlockDropItemEvent then?

worldly ingot
#

Called when a block drops an item :p

hybrid turret
#

wouldn't that be the right event then?

worldly ingot
#

I don't know. Is that what you want?

hybrid turret
#

I'm still working on that key system with PDC + CustomBlockData-API
I want to check if the broken block has CBD and then cancel the drop event and drop a custom item

worldly ingot
#

Oh, then yeah, probably that then

sterile token
#

what means CBD?

worldly ingot
#

custom block data, presumably

sterile token
#

Just for curious haha

hybrid turret
#

yes

#

not the weed stuff

hybrid turret
sterile token
#

right thanks

#

Choco could you read my text? i need some help too

#

I know they too much text but they fully detailed what issue i having and how i would like to fix it

hybrid turret
#

okay it just got a lot weirder.
i changed the condition for cancelling the event and now both halves drop the right item....
but upon breaking one, the other won't break, what

sterile token
#

hah that remeber me tonight when i was having a compile maven error, which must be first marked by the IDE while coding but wasnt it. But when i compiling it started to appear that eror

#

Those type of things make us strugglig asf

mortal hare
#

ok i fucking give up

#

for some reason commands, even vanilla ones are case sensitive

#

type ./gamemode the server and ./gAmemode

#

they're case sensitive by default

hybrid turret
#

damn, F

#

but tbf, what is that important for?

upper cypress
#

would I look in here for potential developers?

mortal hare
#

what do you need?

hybrid turret
#

you could ig? idk the server rules that in depth

upper cypress
#

well like I'm not really well versed in code and I got a plugin made as the main part of my server but the dev delivered it like half completed so now I'm looking for someone to either fix and add to it or just created a whole new one, its pretty big tho is the issue\

hybrid turret
#

what exactly does "main part of my server" mean?

#

also how big we talking?

#

like what kinda functionality does it provide?

upper cypress
#

wellll its like a magic based plugin with unlockable spells so like rn it has 4 different magic abilities with like 4-5 spells each. But later on im looking to add more abilities, a level up mechanic, a death ban and revival mechanic, a couple custom items, and some changes to fighting

valid burrow
#

what would be the simplest aproach for a map reset system

#

anyone got maybe a github repo or something i can look at?

hybrid turret
#

(depending on how your wallet looks)

upper cypress
#

I'm pretty flush rn, I also have like $200 in fiverr balance after the guy scammed me

hybrid turret
#

like bedwars or something?

hybrid turret
upper cypress
#

well it sort of does, the scam went though bc the guy delivered me a totally broken plugin but then I appealed it and got the money back. Wasted a whole month tho

hybrid turret
#

i mean at least u got ur money

upper cypress
#

yeah

hybrid turret
#

yeah i have no idea how the coding market works yet. for now it's a hobby lol

upper cypress
#

can't really complain

hybrid turret
#

and as far as i'm concerned there's not a huge market for minecraft plugins anymore sadly lmao

hybrid turret
valid burrow
#

ive seen people just create a copy of the world and load it again every time but that doesnt work for me

#

i dont want to remove the players from the map while reseting it

ivory sleet
#

I know its possible to just yeet the chunks files and put in new ones with desired data

#

but that does imply the players should be somewhere else

#

Like tping them away at least, and making sure nothing gets in the way

hybrid turret
#

i mean easiest way for that would be bungeecord tbh

#

having a seperate server -> players can't be there

ivory sleet
#

No not really, not if its just one server

ivory sleet
glad prawn
#

ArmorTrim?

#

yes pls create one

upper hazel
#

I was ready for anything.... but opening the project in eclipse πŸ’€

#

help pls

glad prawn
#

which one

young knoll
#

Those are the ones in game

#

Just pick a material and pattern

#

new ArmorTrim(TrimMaterial.GOLD, TrimPattern.VEX)

#

If you want a random material or pattern, use the registry to get one

valid burrow
#

just in a different chunk?

ivory sleet
#

No

#

Far away so that the chunk can be unloaded

valid burrow
#

oh

#

well thats not the case

#

they are like

#

2 chunks away

ivory sleet
#

Yes, that’s a bit more problematic

valid burrow
#

ik

ivory sleet
#

If they have to be in touch closely to the regeneration

sick edge
#

is .hashcode() safe to use for uniquely identifiying Inventories? (Need it to identify chests in the world)

ivory sleet
#

no

#

and hashCode() should never be used to identify anything uniquely

#

use equals()

#

if equals() is true then it implies hashCode() is true
but the converse is not always true

young knoll
#

I use hashcode to identify my ints

ivory sleet
eternal night
#

(hashmaps btw do use .equals, inventories do hence work as map keys if that is what you are asking)

sick edge
#

I needto identify ItemStack[] in a map (the chest contents are saved and compared in the future to contents of the same chest). I need to somehow identify the chest/inventory but also save the contents as a clone

eternal night
#

what is the xy in the end here ?

ivory sleet
#

is the ItemStack[] the key? (if I so may ask)

sick edge
#

No that would be the value as it changes

sick edge
eternal night
#

Like, what is the end goal

ivory sleet
eternal night
#

I am confused by the data structure you are describing

ivory sleet
#

same

#

quite frankly what you are actually trying to achieve in the end

smoky oak
#

where do we put feature requests?

eternal night
#

for the spigot API ?

smoky oak
#

ye

#

i want a @after annotation

eternal night
#

issue tracker

smoky oak
#

cuz events are dumb

eternal night
#

okay yea, that is a dumb feature request KEKW

smoky oak
#

what

sick edge
# eternal night Like, what is the end goal

Ah: I want to have it so that if you open a chest again after loot generation and nothing is changed then it regenerates the loot. So right now Im saving the Inventory StorageContents when a LootGenerateEvent happens and then on an IvnentoryOpen i want to check if that same inventory is opened again and if all the contents are still the same

smoky oak
#

mate im resorting to THIS

sick edge
eternal night
#

Yea, but properly implementing an after event entry point is less of a "feature" request and more of a "rewrite of the event calls"

ivory sleet
smoky oak
#

events

#

run after event is processed

#

not before

eternal night
#

yea, that wowuld be one of the largest redos of the entire codebase KEKW

#

if even possible

#

sure, open an issue for it

#

but like

#

Β―_(ツ)_/Β―

smoky oak
#

all i learned those last 2 days is that the spigot base is dumb :kekw:

eternal night
#

do not expect progress on it

#

I mean, events just don'T work that way

thin iris
#

for (int i = 0; i < 10; ++i) or for (int i = 0; i < 10; i++) πŸ€”

eternal night
#

what is your xy here

ivory sleet
river oracle
smoky oak
#

that I need to obtain the state of the player as-is after the event concluded to apply the code I'm writing, and having the event code run once simulated and once real sounds even worse

ivory sleet
#

so its highly problematic now if you'd use hashCode as K type

#

or well Integer more or less

rough drift
eternal night
#

I mean, scheduling things a tick after an event is not really uncommon practice

smoky oak
eternal night
#

So yea I guess

rough drift
# smoky oak dafuq why

because ++ first copies the value to another register so that it can be retrieved after adding

eternal night
#

?issues

rough drift
#

because

river oracle
eternal night
#

?jira

undone axleBOT
river oracle
#

fuck

#

I spelt it wrong

eternal night
#

get reckt

#

go ahead and open a "feature request" but like

smoky oak
#

shouldnt something as simple as that be compiled to the faster version anyways

rough drift
#

System.out.println(i++); is 0 if i is 0, meaning that 0 got copied
System.out.println(++i); is 1 if i is 0, meaning that 0 didn't get copied

rough drift
eternal night
#

don't expect a universal "post event" entry point to be implemented any remotely time soon

river oracle
#

MD_5 would prob be like PR it if anything

smoky oak
#

πŸ’‘

rough drift
river oracle
#

PlayerPostMoveEvent πŸ˜‚

ivory sleet
#

yeah spigot doesnt rly have a clear notion of post and pre in the api

eternal night
smoky oak
#

can't we just make an annotation that wraps the entire method into a BukkitRunnable.runTaskLater(this,0)

eternal night
#

I doubt it

smoky oak
#

how do annotations work exactly?

eternal night
#

oh god

rough drift
#

and that runs after

#

ez

eternal night
#

true

river oracle
#

agony

ivory sleet
river oracle
#

and reflection

rough drift
#

and allow listening to Event goddammit

sick edge
ivory sleet
#

NO

#

dude

smoky oak
ivory sleet
#

did you just read what I said in that message

river oracle
eternal night
ivory sleet
#

no

#

but yes

eternal night
#

a compiler plugin can pick up on the annotations

ivory sleet
#

since jvm does care about certain annots

eternal night
#

but the annotations themselves do nothing

river oracle
#

Annotations by themselves don't do shit, you need a processor

smoky oak
#

anyone got a tutorial on how to make such a plugin

eternal night
#

google

smoky oak
#

bleh

eternal night
#

its a not fun process tho

#

given that you literally just have to write a single util method to schedule a task for you

#

and pass it a runnable

#

I don't see the usage here

smoky oak
#

i mean GPT3.5 got faster lately

#

it's a) faster b) can be used by more than this one plugin

eternal night
#

Yea, but GPT needs a competent developer to check its work

sick edge
eternal night
#

it really isn't faster

smoky oak
#

to type

eternal night
#

it really isn't faster to type

smoky oak
#

how would u pass what is functionally a method to a runnable then

eternal night
#

what would you annotate to run a tick later

dry hazel
ivory sleet
#

i already said it

sick edge
#

πŸ˜‚

smoky oak
river oracle
#

no afaik pretty sure runTask auto queues for the next tick

eternal night
#

runTask just invokes runTaskLater with 0

smoky oak
#

ask 2 people get 2 answers lol
so which one is it

eternal night
#

what

smoky oak
#

or does 0 just translate to 1 anyways

river oracle
#

both answers are equivalent

eternal night
#

you literally got the same answer

smoky oak
#

eh

eternal night
#

0 does not exist, it it scheduled for the next scheduler heartbeat

smoky oak
#

*ah

lilac dagger
ivory sleet
#

yeah moterius they do the exact thing, like they're quite literally identical

#

just that one consumes more braincells to read I suppose

smoky oak
#

'next tick' and 'in 0 ticks' sounds different mate

#

as in 1 != 0

ivory sleet
#

well if u wna run sth the current tick you'd just run it

#

without any scheduling lol

smoky oak
#

i mean

#

i would prefer to run it in the current tic

sterile token
#

Is posible to know when player touch the water?

smoky oak
#

but after the event has been processed

river oracle
#

you can't do that though not with the API atleast

smoky oak
ivory sleet
#

isnt there like a tick start and tick end event

#

nvm thats paper

smoky oak
wary harness
#

So got specific situation and now got two options to solve a problem.
I got shop item restocking each item has there custom restock time set in shop file for example after last piece is sold item should restock in 6h and etc
now solton options:

  1. to have runnable and go thru all items in multiple shops check if item has restocking and should it be restocked
    2.run code when player opens gui shop to check only items which are in that shop section so no need for runnables
    What do you think what would be better aproch
    Plus there is 2 type of restocks type per: player/server
eternal night
#

number 2

smoky oak
# wary harness So got specific situation and now got two options to solve a problem. I got shop...

personally - I dont know if this is a good solution - I'd store a global timer for 'most recent server refresh', and store when a shop's been used last
Then, on shop open:
If that timer is older than the refresh, refresh shop 'globally'.
do something similar for player.

Your first solution is guaranteed to be worse than the second, because it iterates through everything, for all items, which is very likely to never be necessary in it's entirety

#

just dont do a discord oopsie and store time in seconds, what kinda nonsense timestamp is that lol

#

<t:1>

#

depends if you want timers in ticks or in real time

worldly ingot
#

It's time in seconds since January 1st, 1970

weak meteor
#

how do people

smoky oak
#

unix time is in millis tho?

weak meteor
worldly ingot
#

Java's System.currentTimeMillis() is based on the unix epoch as well

#

Yeah, Discord, a chat messaging program, doesn't really need millisecond precision lol

smoky oak
#

oh hi mr console guy, no progress im afraid

#

thats no fun

tranquil dome
#

@smoky oak I asked a spigot fork developer by the way and they said the only way to bypass it was to print to System.console(), but this didn't print out anything. System console may also be null in certain terminals, so it wouldn't have been the best option either.

The other solution he provided was editing the log4j.xml file in the server jar, which obviously wasn't the intended way to achieve this.

So I guess there's not really a workaround for it if the runtime exception method doesn't work.

smoky oak
#

tried that, no result lol. got the suggestion to use the console thingy directly

#

whats it called again

#

something something five capital letters

tranquil dome
#

So in that case, what would you recommend me to do. Partially use the bukkit logger and send anything above level info as an info message?

quiet ice
smoky oak
#

ye

smoky oak
quiet ice
#

Bruh, this is basic java knowledge - you shouldn't forget the name of SLF4J!

smoky oak
#

if i print to console I#ve lost all hope geol

quiet ice
#

That is like developing a web application without knowing what HTML stands for!

smoky oak
#

my logs are there as a courtesy

#

been there, done that

tranquil dome
#

Mainly just wanted to print fine finer finest as debug for my plugin

#

Preferably in a blue color

thin iris
#

can i cancel duping items in gmc

tranquil dome
#

But also keep a consistent theme, so I'll probably keep them white if the prefix is already white too

ivory sleet
#

its possible to injectively change format or whatever, dont remember what I used to do but dont get ur hopes down bloedarend

tranquil dome
#

Could you give me any leads? It has already gotten fairly complicated and I'm not sure where to look

shell robin
#

Is mod development similar to plugin development?

weak meteor
#

for me is more complex forge than spigot

shell robin
#

i understand

#

thank you

sterile token
#

Can i get some sort of help fixing this issue

#

faction appears double in points usage, should be only /faction points

#

right

#

sorry i will send it

#
public void sendUsage(Sender<?> sender, Command command) {
        List<Command> children = getArguments().stream().filter(arg -> isAuthorized(sender) || arg.isAuthorized(sender)).collect(Collectors.toList());
        if (children.isEmpty()) return;
        StringBuilder builder = new StringBuilder(command.getName() + " help \n \n");
        for (Command argument : children) {
            if (argument instanceof SingleCommand) {
                builder.append(String.format("- /%s %s %s - %s \n \n", command.getName(), argument.getName(), argument.getUsage(), argument.getDescription()));
                continue;
            }
            builder.append(String.format("- /%s %s %s %s - %s \n \n", command.getName(), this.name, argument.getName(), argument.getUsage(), argument.getDescription()));
        }
        sender.sendMessage(builder.toString());
    }
#

let send full code ok?

#

Its better

#

?paste

undone axleBOT
sterile token
#

Also i get this output running /faction points (a faction sub command), if yo usee carefully it doesnt appear the sub command name. Just appear the root command name (faction)

#

basically is a coding skill hehe

#

To clarify structure is next

faction - ParentCommand
faction list -> SingleCommand of faction
faction points -> ParentCommand of faction
faction points add -> SingleCommand of points

#

but this.name should be returning points, shouldnt it?

#

Recurstion its a mess i struggle a lot with it

weak meteor
#

its necesary to use recursion in this really?

#

thought it was like something that'll be used in some specific cases

#

not even near to minecraft

sterile token
#

oh right, i will try that thanks zacken. If i dont fix i will come hehe

sterile token
weak meteor
#

oh

#

that makes sense now

sterile token
#

Yeah its a mess i struggle a lot with them haha

#

Because you get confused too easly

#

yeah this is the first version, can you give me recommendations

#

yes i know but i dont like third parties impl, they use weird annotations which im not a custom to them

#

right, but the one who dont use they are a mess

#

Mines is exactly the same as Luckperms, the idea of the command api structure was taken from their one

#

just maven being maven (to clarify i havent toch anything related to dependency-reduced)

#

its creates a reduce pom named "false" and with no extension πŸ’€

#

@quaint mantle one part is fixed, now is missing the part of the sub command helping where doesnt appear the sub command name

#

yeah i know, but how do i do it? Im nightmare around the recursition

#

but why? its really simple the Parent is just a collection of more parents and/or single commands. I dont see it really messy or confusing

#

oh right that the problem

#

I will add some sort of parent field to parent object

orchid gazelle
#

yo is it possible to make entities invulnerable (not getting removed by /kill and so on too) or do I have to save them and load->check them with my plugin?

grand flint
orchid gazelle
#

Does that make it unkillable by /kill?

#

And ClearLag type of garbage

young knoll
#

/kill maybe

#

ClearLag no

orchid gazelle
#

Alternative would be "serialize to file, deserialize on boot, check for entity-existance somehow and spawn it if needed"

grand flint
orchid gazelle
#

I don't use clearlag, just wanted to see how "powerful" it is

#

Imma probably go for the hard way then I guess

grand flint
#

Well, if you want a clearlag plugin, you could probably just check if the entity is invulnerable or not

#

Which clearlag probably should do already, and if it doesn't that's just stupid by them

storm crystal
#

Im a beginner and need help.

wet breach
orchid gazelle
#

Interesting

wet breach
#

its like trying to stop the server from being stopped, ultimately you won't prevent it

#

because eventually your plugin would be viewed as malicious

orchid gazelle
#

Yeaah fair

#

So imma go with the thing on boot I guess

#

How would I check for existance of the entity?

#

on boot

#

Does it have some UUID I can serialize to my Entity-Database-File and then look for?

wet breach
#

you would need to know the location

#

and the UUID

orchid gazelle
#

Can save the Location for sure

young knoll
#

Entities have a uuid

wet breach
#

location so you know you need to load the chunk to check if its still there, UUID to identify it

young knoll
#

Yes

orchid gazelle
#

So basically

#

I make a hook on ChunkLoad

#

And if the chunk loads, I check if it contains any entity I need

#

And then load in from db

wet breach
#

that is one way to do it

young knoll
#

Entities don’t load with the chunk anymore

#

There’s EntitiesLoad event or something

orchid gazelle
#

Ohhh

#

Wait EntitiesLoad at ChunkLoads or what?

#

In other words, when is the time I gotta check for the targetted entities

young knoll
#

Chunk loads first

#

Then the entities

orchid gazelle
#

Ah ok

#

So I need the LoadEntities event which fires for a specific chunk right?

#

And have a Map of which Entities are associated with which chunk

young knoll
#

Yes

orchid gazelle
#

Great, thanks a lot!

young knoll
#

The entities load event will contain which chunk it’s for

orchid gazelle
#

Ah yes ok

river oracle
#

Is there a way to predict craftbukkit package version through version number or is it arbitrary

kind hatch
#

You talking about the RO.1 RO.2 naming?

river oracle
#

yeah

kind hatch
#

It's arbitrary.

river oracle
#

😭

kind hatch
#

Sadly

river oracle
#

I was scripting up for auto-updating my NMS

kind hatch
#

It's up to mojang when they want to bump the number. :p

river oracle
#

sigh is there some way I could scrape that data somehow :P

kind hatch
#

Post update?

river oracle
#

yeah

kind hatch
#

Does the bukkit method not return the full string?

echo basalt
#

it basically just reflects protocol changes p sure

kind hatch
#

Yea, Server#getBukkitVersion() should give you the full string. (Example: 1.20.2-R0.1-SNAPSHOT)

river oracle
#

No access to spigot api here

kind hatch
#

Oh

#

Wtf are you doing then? lol

river oracle
#

Well, I'm making a script to automatically update my NMS version and notify me of conflicts or methods that moved if that happened

#

the latter part is easy the hard part would be determining the version

#

seeing as the Release number is arbitrary I can't confidently bump it

orchid gazelle
#

Im annoyed that you gotta change package names for nms

#

Every update the nms package names go brrr

river oracle
#

that is also annoying

young knoll
#

You mean craftbukkit packages?

kind hatch
#

Probably

river oracle
#

yeah

young knoll
#

Downstream wants to end that

#

πŸ‘€

kind hatch
#

How?

orchid gazelle
#

Yes plz

river oracle
#

Is there a reason it even exists as is

orchid gazelle
#

When no more cb package names with versions??? When????

river oracle
#

wait real talk then how would we know what version the plugin runs on I've always used regex lol;

kind hatch
#

Good question.

remote swallow
#

Api version

#

Bukkit methods

river oracle
#

Bukkit#getServerVersion just bump it each version?

kind hatch
#

Ayooo, a reason to add @since tags??

orchid gazelle
young knoll
#

No idea

young knoll
kind hatch
#

I haven't touched CB, so I wouldn't know the process or why that's necessary. Please explain.

young knoll
#

The process is just maven doing it at compile time

#

Why it’s necessary, it isn’t

kind hatch
#

What would the import path look like then?
org.craftbukkit.entity.CraftPlayer
instead of
org.bukkit.craftbukkit.v1_20_R2.entity.CraftPlayer

young knoll
#

I’m sure there’s a reason it’s done, but it’s in no way required for things to work

#

Yes

river oracle
#

bug choco see if he knows

orchid gazelle
#

10000x better

kind hatch
#

I would assume it's relocated because of the constant changes between versions. There's tons of methods that get obfuscated to other methods depending on the version used. How would that be accounted for if it wasn't version specific?

young knoll
#

How would what be accounted for

kind hatch
#

Lets say CraftPlayer#a() points to one method in 1.20
Let's also say CraftPlayer#a() points to a different method or field in 1.19

How would that work across versions?

#

Just leave as is and let the devs deal with the problems?
Or....

young knoll
#

Craftbukkit classes don’t have obfuscated methods

slender elbow
#

true

kind hatch
#

Don't they get obfuscated though?

young knoll
#

No

kind hatch
#

Is that because of the mojmaps? I know they help us devs, but I thought everything had be be obfuscated back once compiled?

slender elbow
#

CraftBukkit is code written by Mr 5

young knoll
#

Yeah Mojang code does

#

Craftbukkit code isn’t Mojang

slender elbow
#

well

#

it isn't written by them

#

but it is theirs :p

young knoll
#

Method arguments and fields will get obfuscated if they use NMS types

#

But no method names or field names will

kind hatch
#

Hmmm, I guess I just don't fully grasp how this works.

river oracle
#

I always forget Mojang owns Craftbukkit so weird

#

they don't even help us maintain it 😭

#

what are they busy making a game or something

eternal oxide
#

Thats mostly because that ownership is questionable

#

CB is in limbo

young knoll
#

If you take the method CraftPlayer.whatever(Player NMSplayer)

#

After all compiling and reobfuscation you will have

#

CraftPlayer.whatever(a NMSplayer)

#

Obviously a isn’t the obfuscated name for player but you get the idea

kind hatch
#

Ok, I understand that part of it.

#

Am I thinking of how it was done previously? Where spigot methods being obfuscated would not equate to the same method across versions?

#

Wait, nevermind. I think I'm misremembering part of this.

rotund ravine
river oracle
#

If I target experimental branch for the thing I'm testing out with craftbukkit that will include the registry changes right?

quaint mantle
#

whats the difference between asyncchatevent and chatevent

echo basalt
#

one's deprecated

#

and the other is deprecated on paper

quaint mantle
#

is async just a replacement for normal

echo basalt
#

ideally

vale robin
#

is it only me or itemstack[].clone() doesnt work

chrome beacon
#

?notworking

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.

hazy parrot
#

You are trying to call clone() on array?

vale robin
vale robin
# chrome beacon ?notworking
ItemStack[] originalArmor = player.getArmorContents();
ItemStack[] newArmor = originalArmor.clone();
// <modify enchants to newArmor>
player.setArmorContents(newArmor);
// <does stuffs for 10 seconds>
player.setArmorContents(originalArmor);
chrome beacon
#

You're only cloning the array not the ItemStacks in the array

#

meaning if you modify a item stack in originalArmor it will change the item stack in newArmor

#

since they're the same item stack

vale robin
hazy parrot
#

TIL there is actually arr[].clone lol

#

I mean it makes sense but anyway

vale robin
#

is there a way to do it

#

properly

#

instead of just keeping track of everything in originalArmor?

chrome beacon
#

So you can just store that if you're only modifying enchantments

lost matrix
#

But this looks like you should write more classes for this. Something like TemporaryEquipment which uses the PersistentDataContainer of
the Player to make sure he gets his items back when he disconnects and doesnt drop his new armor etc.

abstract spindle
#

Hi I have a discussion with a fellow developer and wanted to ask your opinion on the topic.
Which of the following implementations is more of a kill to the Server ?

  1. To run a one second timer which loops throw a list with 10.000 elements and subtracts from a variable one if it reaches zero it executes a method
  2. To add the 10.000 elements to the BukkitSheduler as a AsyncTask

Edit: Every element has a different time when it reaches the point where its method should be executed

lost matrix
#

Or are you speaking about adding 10k async tasks to the scheduler

abstract spindle
#

In 2. I just schedule the task to when the method should be executed. 1 and 2 executes the same method
For example it should be executed in 2 min.

  1. Would cont from 120 down to 0 before executing the Task
  2. Would execute it after 120 seconds passed
lost matrix
#

Yeah adding 10k tasks to the scheduler is a pretty bad idea.
But so is iterating over a list and decrementing a timer in each one.

mortal hare
lost matrix
#

Let me write you a mock impl which outperforms both by a mile. One sec.

abstract spindle
mortal hare
#

decay?

abstract spindle
#

no - it sets the block back to its original state before it was broken
So if you break a Stone it will be there again after a certain time

mortal hare
#

sound like you're doing some kind of prison mining system, did i guessed correct ? πŸ˜„

abstract spindle
#

yes

#

kind of

mortal hare
#

is the variable that you're talking about subtraction, is it per element based (integer per block), or is there one for the region?

abstract spindle
#

per region and block

lost matrix
#

Here. This outperforms both approaches by a landslide.

public abstract class TimedExecutable implements Comparable<TimedExecutable>, Runnable {
  
  private final int executionTime;

  public TimedExecutable(int executionTime) {
    this.executionTime = executionTime;
  }

  public int getExecutionTime() {
    return executionTime;
  }

  @Override
  public int compareTo(TimedExecutable other) {
    return Integer.compare(this.executionTime, other.executionTime);
  }
  // Its abstract and implements Runnable
}
public class TimedExecutionManager {

  private int currentTime = 0;
  private final PriorityQueue<TimedExecutable> executables = new PriorityQueue<>();

  public int getCurrentTime() {
    return this.currentTime;
  }

  // Insertion is O(log(n))
  public void addExecutable(TimedExecutable executable) {
    this.executables.add(executable);
  }

  // Run this every tick with a single task
  public void tick() {
    currentTime++;
    while (true) {
      TimedExecutable next = executables.peek();
      if(next == null || next.getExecutionTime() > this.currentTime) {
        break;
      }
      next.run();
      executables.poll();
    }
  }

}
abstract spindle
#

thanks

lost matrix
#

Wait there is a flaw. It needs to peek for the first element

mortal hare
mortal hare
#

so what im not seeing here

#

is it ordered according to time or what

lost matrix
#

The queue is sorted by the time to execute. And it only polls the elements from the queue until it reaches one that is not
due for execution, which makes all 9999 elements before that also not due, meaning we can just break very early.

mortal hare
#

yea, that i've just realised before you typed that

#

i mean yea its better, since you poll like only 20% (my rough estimation) of data instead of iterating them all

#

i like it

#

im gonna use it probably by myself πŸ€” \

abstract spindle
#

What would be the difference to execute it every tick and second

mortal hare
#

tick runs every 1/20th second

lost matrix
#

But performance wise there is no difference. Maybe a few nanos each tick.

mortal hare
#

unless its some kind of competitive disadvantage

abstract spindle
#

okay thanks fore the greate help and info πŸ™‚

lost matrix
# abstract spindle okay thanks fore the greate help and info πŸ™‚

Btw if you dont look for timed scheduling but throughput optimization each tick then i have a guide for that:
https://www.spigotmc.org/threads/guide-on-workload-distribution-or-how-to-handle-heavy-splittable-tasks.409003/

mortal hare
#

is there any way to run code in the minecraft main thread instantly, without waiting for a tick, after running the code in the separate thread?

#

ik some NMS methods have some methods to do this afaik, but is there any api calls to support that

quaint mantle
#

why

lost matrix
#

I dont see how that would be possible as you cant just interrupt the code flow. You could maybe append something to the end of a tick
if the executor service looks into the tickables afterwards again. But then you are pretty much on par with running it next tick.

smoky oak
#

I've got a var a = switch { ...
piece of code. One of the cases requires logic inside it. How can i make the result of the switch differ depending on a bool?

#

return var says its returning out of the method

icy beacon
#

Plz elaborate a bit more, I don't exactly understand the question

smoky oak
#

ah yield keyword

lost matrix
# smoky oak ah yield keyword
    var time = switch (material) {
      case OAK_LOG -> {
        if(this.boostActive) {
          yield 20;
        } else {
          yield 10;
        }
      }
      default -> 0;
    };
smoky oak
#

huh im getting a weird warning here

#

Inventory.getType may produce NULL?

#

why

lost matrix
smoky oak
#

in an inventory click event

#

yea sure lol

abstract spindle
#

yes it can if you click outside

lost matrix
#

If you click outside of an inventory

smoky oak
#

oy wtf is this

#

so can it be null or not

lost matrix
#

The inventory can

#

The type cant

smoky oak
#

ah

lost matrix
# smoky oak ah

*PS The inventory can only be null in old garbage versions

smoky oak
#

im on 1.20 but apparantly it still can

#

or the jd is outdated

abstract spindle
lost matrix
#

Ah getClickedInventory, not getInventory

smoky oak
#

ye im making item blocks

#

by material per inventory

upper hazel
#

bruh... i just open eliscape project in intelji wth

#

Bukkit api say bye

lost matrix
upper hazel
#

i was think eliscape has maven

#

but how i see

#

this not have

#

how demm this eliscape work

#

why plugin.yml not in resurces

lost matrix
young knoll
#

Eclipse supports maven just fine

lost matrix
#

whgat?

upper hazel
#

config.yml and plugin.yml in scr

lost matrix
upper hazel
#

this not eliscape system?

#

i just not have derictory??

#

i mean were gradle or maven exists in eliscape project

#

i not see it

glad prawn
#

what is eliscape 😭

celest notch
#

Hes either not english or using a phone or bad keyboard

mortal hare
#

hmm is it worth it to trade object allocation for less null checking in the end?

#

i mean memory is tad bit cheaper than cpu power

lost matrix
#

especially in spigot i would trade ram for a bit more free cpu time any day. Most machines have plenty of ram nowadays.

slender elbow
#

null checking is dirt cheap

#

literally one or two cpu cycles even in c1 lol

mortal hare
#

yea, but when you run lets say a repeatable task

#

its better to have less cpu cycles

scenic onyx
#

because in 1.18 get error?

mortal hare
#

i havent used bungee's chat components for a while (adventure api ftw)

lost matrix
scenic onyx
mortal hare
#

wrong import

#

that's java.awt package you need ones from bungeecord

#

iirc

scenic onyx
slender elbow
young knoll
#

Okay but what’s the overhead on using optionals

slender elbow
#

the memory overhead is larger than the cpu overhead

hybrid spoke
#

negligible

slender elbow
#

and it is negligible in modern jvms

lost matrix
#

neigillibleble

scenic onyx
lost matrix
hybrid spoke
#

if you have to worry about stuff like that you should probably switch languages

mortal hare
#

you probably need this

hybrid spoke
mortal hare
#

but im not sure

scenic onyx
young knoll
#

I like the idea of optionals

#

Kinda

lost matrix
young knoll
#

But they are just a worse option than null checking in pretty much every case

slender elbow
#

eh, it depends on your project structure really

#

they are not apt for every use case

mortal hare
young knoll
#

Boo

slender elbow
#

yooo

young knoll
#

Adventure would be nice if it supported spigot more

#

Sadly it does not

scenic onyx
lost matrix
# young knoll I like the idea of optionals

I wrote a micro service once where everything that came in was wrapped in optionals and
everything that got out was unwrapped again. Internally null was not allowed. Was kinda nice
but also a bit exhausting.

slender elbow
#

tell spigot to add more api

young knoll
#

I mean

lost matrix
young knoll
#

The component PR is still there

slender elbow
#

merg merge :whip:

mortal hare
#

Optionals should be fake classes which get compiled by the compiler into raw null checks

scenic onyx
slender elbow
#

valhalla goes brrrrr

young knoll
#

I don’t have merge powers

#

Sadge

lost matrix
young knoll
#

Didn’t adventure use to have a serializer for bungee components

#

But they dropped it

slender elbow
#

pretty sure that still exists

scenic onyx
young knoll
#

Ah, maybe the issue is just that bungee components don’t work in most places yet

lost matrix
#

New mc block coming in 1.21 πŸ™‚

young knoll
#

Indeed

#

Means I don’t need to make an auto crafter plugin :p

mortal hare
lost matrix
#

They could also just give us the tools to add blocks via resourcepacks.
Same for proper UIs and entities. Then they dont need many more updates.

mortal hare
#

its so good

mortal hare
young knoll
#

The configuration phase is interesting

mortal hare
#

yea tbh minecraft update by update is being more and more configurable

young knoll
#

Slowly but surely

#

Tis why we need to figure out a spigot api for datapack content soon

mortal hare
#

custom dimensions, sky colors, biome colors, fonts, client entities

#

these are all possible to do nowadays, which was unimaginable in 1.8 without hacks

hybrid spoke
young knoll
#

Idk if it’s possible to move plugin loading before server loading without fooking everything

#

What about a premain class in plugin.yml

young knoll
#

Kek

mortal hare
#

this wouldnt make sense

eternal night
#

I mean, a certain spigot fork does it

young knoll
#

Not moving the current method calls

mortal hare
#

but why

young knoll
#

But moving the loading itself

#

The problem is static fields in the main class

mortal hare
#

i mean if that would be case, mixins would probably be the best solution for this, like some kind of fabric loader

young knoll
#

Fabric doesn’t need mixins to register nee content

#

That would be silly

eternal night
#

not that mixins would help there either beyond being glorified reflections. You don't need to change logic for your registries

#

you just need to be early enough to mutate them

young knoll
#

Yep

#

Or just freeze them later

eternal night
young knoll
#

I need to look at what parts of CraftServer actually need the backing server

hushed spindle
#

does anyone know of a way to add more item drops to BlockDropItemEvent#getItems(). in spigot it's illegal to add more things to it which i think is dumb, but could i force this using reflection or something

young knoll
#

I mean you can just spawn new drops

#

They just won't be in the list

opal carbon
#

^

hushed spindle
#

that doesnt play nice with other plugins

#

i kinda need that to be the case

young knoll
#

Unfortunately it does not

opal carbon
#

well neither does adding drops to that event

#

so

hushed spindle
#

how so

young knoll
#

Adding drops means other listeners would see them

opal carbon
#

i mean its not legal for a reason

hushed spindle
#

thats what i want yes

young knoll
#

(I actually have no idea why it's not allowed)

opal carbon
#

why not trigger another block drop item event

hushed spindle
#

md5 doesnt even know either

young knoll
#

lol

hushed spindle
#

and its legal on paper and purpur

#

so it seems to me like it just might be a relic of the past

young knoll
#

I mean

#

Only one way to find out

opal carbon
#

try it and see then ig

hushed spindle
#

wdym lol ive already tried it

opal carbon
#

did it not work

hushed spindle
#

it throws an illegalstateexception on spigot and its fine on paper and forks if you add drops to the list

opal carbon
#

then sounds like its not legal

hushed spindle
#

πŸ—Ώ

young knoll
#

It's documented on spigot that you can't add to it

hushed spindle
#

i know thats not my question lol

young knoll
#

But there isn't really a documented reason why

quaint mantle
#

hi

hushed spindle
#

hello

quaint mantle
#

i wish you could draw skins

hybrid spoke
#

just drop them

#

like

#

naturally

young knoll
#

Hmm

pseudo hazel
#

wdym, you can draw skins

hushed spindle
#

i would prefer if other plugins could see those drops

young knoll
#

I do see one issue adding would cause

#

It's expected that the items aren't spawned in the world yet

#

There is no way with the spigot api to create an item that isn't spawned in the world yet

hushed spindle
#

right

#

seems a bit weird for them to be using item entities to begin with

#

instead of itemstacks

young knoll
#

True

#

But it does let you modify the entities which is nice

#

Mmm yeah it looks like it would be fine to add new stuff to it

hushed spindle
#

though it seems rather inconsistent to then allow the removal of items even though they're already meant to exist

#

if removing an item also removes the entity, how come adding an item doesnt simply add an entity

young knoll
#

It could

#

The problem is there's no way to add an unspawned entity

#

Since you can't make an unspawned entity with the api

#

*yet

hushed spindle
#

then i dont get how getItems() already contains a collection of item entities lol

eternal night
#

internals can offer you those entities

young knoll
#

Because the api doesn't make them

quaint mantle
young knoll
#

When the api creates an entity, it has to be added to the world

hushed spindle
#

ah

young knoll
#

NMS does not have such requirements

quaint mantle
#

nms πŸ’ͺ

young knoll
#

However there is currently a PR in progress to add such functionality

scenic onyx
#

how i can get

#

???

quaint mantle
scenic onyx
young knoll
#

That's something that would be better in a modding discord

quaint mantle
#

i don't really understand

young knoll
#

Spigot doesn't touch any client stuff

scenic onyx
quaint mantle
young knoll
#

Anticheats cannot see any client stuff

#

Beyond what the client tells the server

quaint mantle
#

nor edit them

scenic onyx
young knoll
#

Yeah you can't with spigot

#

Or NMS

quaint mantle
#

the brandname?

young knoll
#

Or anything server side

scenic onyx
hushed spindle
#

they usually dont

young knoll
#

They don't

#

Forge will tell the server that the client is using forge

quaint mantle
#

iirc

hushed spindle
#

hacked clients can simply choose not to

young knoll
#

But obvsiouly a cheat client isn't gonna tell the server they are using a cheat client

scenic onyx
#

1.20...

#

bruh

young knoll
#

Ooh that's fun api

#

Smh paper y u no upstream

hushed spindle
#

its like a child asking entrace into a pub saying they're 20 years old and the bouncer is blind so they just believe em, you can just be dishonest with the server about what you're using

young knoll
#

If life was that easy we would have 100% effective anticheats

scenic onyx
hushed spindle
#

basically

#

hacked clients lie

young knoll
#

Or just don't tell

quaint mantle
hushed spindle
#

server cant know hacked client is hacked

young knoll
#

Unless the hacked client is very dumb

hushed spindle
#

the player, with stacks of netherite in 10 minutes, "no"

quaint mantle
quaint mantle
hushed spindle
#

luckily the average cheater is pretty damn dumb

#

yeah im just randomly tunnelling and finding diamonds at every corner man idk what to tell you πŸ—Ώ

quaint mantle
hushed spindle
#

my dad works at microsoft and told me where the diamonds were

quaint mantle
worldly ingot
#

A Slot in the wiki.vg documentation is just a serialized item stack

quaint mantle
#

of?

quaint mantle
#

a bukkit itemstack?

worldly ingot
#

NMS ItemStack

#

Serialized to NBT

hybrid spoke
quaint mantle
#

index 8

hushed spindle
#

same with griefers who do all of their griefing the moment they go on the server

#

they grief for like an hour and then coreprotect be like mmmm yeah cool story

#

all your hard work gone in 3 seconds

worldly ingot
#

So if you’re using protocol lib it should have a getItems() or getItemStacks() method to modify

#

Which would use Bukkit ItemStacks

hushed spindle
#

is there a reason not to use protocollib btw

#

over using nms yourself

quaint mantle
#

imo i would say no

#

but probbaly yes

#

depends how much obfuscation u need

#

but a sane person should use protocol

hushed spindle
#

is there like some downside to it maybe in terms of performance to not use it in projects

#

or just if you dont want your plugin to have that extra dependency

quaint mantle
#

in performance? if i were to do a guess doing nms yourself is better

hybrid spoke
quaint mantle
#

but you need to keep it updated yourself then

hybrid spoke
#

but nowadays nearly every server has it

quaint mantle
hybrid spoke
#

but protocollib does practically the same under the hood as you would do with nms

#

i just dont like the api

#

but its the best you can go for

quaint mantle
#

it's actually really easy to maintain nms code

#

90% doesn't change

uncut folio
#

how do i make a custom mob ignore one player but stay hostile to the rest?
i'm making a custom warden inspired by jujutsu kaisen and i want it to not attack the person who summoned it but still go for every other player

public class Mahoraga extends Warden {
    public Mahoraga(Location location, Player player) {
        super(EntityType.WARDEN, ((CraftWorld) location.getWorld()).getHandle());
        this.setPos(location.getX(), location.getY(), location.getZ());
        this.setCustomName(Component.literal(Common.colorize("&lMahoraga")));
        this.setCustomNameVisible(true);
        this.setHealth(60f);
    }
    @Override
    protected boolean shouldDropLoot() {
        return false;
    }
}
quaint mantle
#

goal something

#

it has predicate

uncut folio
#

can it target multiple entites at once?

#

or do i have to loop?

quaint mantle
#

oh i can't send pic

#

Modifier Constructor
public (Mob mob, Class<T> targetClass, boolean checkVisibility)
public (Mob mob, Class<T> targetClass, boolean checkVisibility, Predicate<LivingEntity> targetPredicate)
public (Mob mob, Class<T> targetClass, boolean checkVisibility, boolean checkCanNavigate)
public (Mob mob, Class<T> targetClass, int reciprocalChance, boolean checkVisibility, boolean checkCanNavigate, Predicate<LivingEntity> targetPredicate)
πŸ‘

river oracle
quaint mantle
#

i dunno how to do multi module

#

heh

hybrid spoke
quaint mantle
#

i haven't touched that method

#

but i imagine it sucks

stray nacelle
#

ah i remember how i tried to add custom items to craft on 1.12.2 api

#

using reflection and hashmap instead of map on java 8

river oracle
#

NMS been never been easier to use NMS

quaint mantle
hybrid spoke
#

module

quaint mantle
#

yeah

#

but same

river oracle
#

Yeah it takes like 1 minutes to update if nothings changed which a lot of times it doesn't tbh unless you use nms a ton

quaint mantle
#

lol

stray nacelle
#

i included multiple spigot api's when been on eclipse

quaint mantle
#

multi module on maven?

#

since when

hybrid spoke
#

always

river oracle
#

Hell I'm making a script to update for me atm

shadow night
#

Bungee is multi module afaik

quaint mantle
#

oh maybe i got confused with using paperweight maven multi module

river oracle
#

If you use paper you gotta use gradle modules

quaint mantle
#

yeah

#
public static Object getHandle(Player player)
        Method getHandle = player.getClass().getMethod("getHandle");
        return getHandle.invoke(player);
    }

πŸ‘ no multi module :)

river oracle
#

You still need multi module with reflection

#

Because the obfuscated fields change every version

#

Idk why anyone would ever use reflection its just harder

#

Ig you could make a pack for each version in one module but that's just harder

river oracle
quaint mantle
#

multi module def better

#

but i haven't used it for javaplugins

#

what's the difference between paperweight and spigot's (i don remember the name)

eternal night
#

one is a gradle plugin the other a maven plugin ?

#

paperweight offers you papers NMS, spigots spigots NMS

river oracle
#

Spigots is objectively better(not biased)

quaint mantle
#

where do i find spigot's

#

or what's the name

river oracle
#

?nms

river oracle
#

Some instructions on how to setup mojmaps here

quaint mantle
#

support gradle?

#

and j21?

subtle folio
#

minecraft doesn't support java21

halcyon hemlock
mortal hare
#

gradle doesnt support java 21

#

too

#

sad

subtle folio
#

21 wont be lts anytime soon

chrome beacon
mortal hare
subtle folio
#

lts as in widley accepted

#

by enterprise

mortal hare
#

oh

subtle folio
#

sure it can be labeled LTS but we're still using java 8 at my workplace

#

😭

slender elbow
mortal hare
#

java 8 is not bad, but some companies still use java 1.5 and 1.6 even today

subtle folio
mortal hare
#

minecraft client does support java 21

slender elbow
#

client and server support it lol

subtle folio
#

oops

#

then why cant you use it to develop spigot plugins?

slender elbow
#

you tell me, i can

subtle folio
#

then what was the question!

mortal hare
subtle folio
#

oh just use maven

mortal hare
#

it doesnt support running gradle

chrome beacon
mortal hare
#

only compiling java

subtle folio
#

I love gradle when I need to use it, but maven is just easier for my poor eyes

mortal hare
#

its quite opposite for me

quaint mantle
#

gradle is easier imo

mortal hare
#

when i see so much noise with xml my eyes are bleeding

subtle folio
quaint mantle
#

xml might make spelling mistake or mis tab

subtle folio
#

How do you pronounce xml

#

"Eggs-em-eL"?

mortal hare
#

after all XML wasnt designed for such tasks

#

eks em el

#

in my native language i would pronounce : iks mmm le

hybrid spoke
#

icks em el

subtle folio
#

weirddd

sick edge
#

I have an InventoryCLickEvent and want to check if the clicked Player is taking any kind of damage or is falling. Is there an easy way to do it or do I have to check the corresponding events and update a bool or smth like that?

subtle folio
#

You would have to make your own booleans for isFalling and such

ivory sleet
quaint mantle
#

based how 😭

#

im sorry if i like readablity

ivory sleet
#

no gradle is good

subtle folio
#

maven build configurations suck ass

#

but i like the repository dependency layout

hardy cairn
#

hi ```@EventHandler
public void ItemInteractEvent(PlayerInteractEvent event) {
Player player = event.getPlayer();
UUID playerId = player.getUniqueId();
ItemStack OffhandItem = player.getInventory().getItemInOffHand();

    if (isOnCooldown(playerId)) {
        return;
    }

    if (event.getAction() == Action.RIGHT_CLICK_BLOCK || event.getAction() == Action.RIGHT_CLICK_AIR) {
        // Check if the player is not eating or performing other right-click actions with a different item in the offhand
        if (!player.isHandRaised() && OffhandItem.hasItemMeta() && OffhandItem.isSimilar(createSpeedGemLVL3())) {
            if (!player.hasPotionEffect(PotionEffectType.FAST_DIGGING)) {
                player.addPotionEffect(new PotionEffect(PotionEffectType.FAST_DIGGING, HASTE_DURATION * 20, 1));
                player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 200, 4));

                setCooldown(playerId, COOLDOWN_SECONDS * 1000);
                startHotbarCooldown(playerId);

                spawnWhiteParticlesAroundPlayer(player);

                player.getWorld().playSound(player.getLocation(), Sound.UI_TOAST_CHALLENGE_COMPLETE, SoundCategory.PLAYERS, 1.0F, 1.0F);
                player.sendMessage(ChatColor.GREEN + "You Gained Speed 5 and Haste 2 for 10 Seconds!");
            }
        }
    }
}``` i have made a right click ability to activate on right click but it is aslo activating whenever i eat food or open chests etc can anyone help
sick edge
subtle folio
#

getFallDistance isn't accurate for what you want to do.

chrome beacon
#

So what is the goal here

#

Why are you checking it in the click event

subtle folio
#

check if a player has taken damage in an inventory click event

sick edge
sick edge
hushed spindle
#

well what do you want to define as "is taking damage"?

#

like do you want to close the inventory when a player takes damage or what

#

you need to do that with events

sick edge
#

Nah I just dont want to teleport the player in the InventoryCLickEvent when he clicks a head of a diff player

hushed spindle
#

ok but whats with the "is taking damage" part

#

do you want to have somekinda "is in combat" feature where the player cant teleport while in combat

tranquil dome
#

@smoky oak I've settled with this. This way I still get colored messages for severe and warning, and for all other messages it shows the level as like a prefix.

        /**
         * Send the logging message if the level is below the logger's level.
         * @param message The message to send.
         * @param level The level of the logging message.
         */
        private fun send(message: String, level: Level) {
            if (this.level.intValue() > level.intValue()) return
            val string = "$name${level.name}: $message"

            when (level) {
                Level.SEVERE -> Bukkit.getLogger().severe(string)
                Level.WARNING -> Bukkit.getLogger().warning(string)
                else -> Bukkit.getLogger().info(string)
            }
        }
sick edge
hushed spindle
#

right

#

so you listen to a damage event, can filter out what you do and dont want or whatever

#

have the class have a map with a uuid key and long value

#

when the player takes damage, put the current system time plus, say, 5000ms

#

then in your click event check if the current time is under that, if so, they're in combat

sick edge
#

Yeah good idea but isn't noDamageTicks fine for my case?

hushed spindle
#

otherwise go ahead

#

nodamageticks can be modified by other plugins and will in most cases be 0.5 seconds

sick edge
upper hazel
#

who worked with eliscape, is maven needed there? They keep throwing me a project without Maven wth

scenic onyx
#

How i can get Client Brand Name?

upper hazel
#

BukkitAPI jar lool

chrome beacon
#

?

upper hazel
chrome beacon
#

You add it to the project manually

#

should be a tab for that somewhere

#

Haven't used Eclipse in 5 years so πŸ€·β€β™‚οΈ

tranquil dome
#

Though maven would make maintaining the plugin easier

upper hazel
#

jar yes?

tranquil dome
#

And you wouldn't have to push libraries to version control

mortal hare
upper hazel
#

yea but this old practic

mortal hare
#

its still used till this day, its just that your IDE does it for you

chrome beacon
#

If you want modern practice use maven or gradle

upper hazel
#

I guess that means eliscape Dev users are 60 years old lol

mortal hare
ivory sleet
ivory sleet
#

choco

#

lol

chrome beacon
#

You can use maven and gradle with Eclipse

slender elbow
#

ant!!

upper hazel
#

I looked at ide and it seems very inconvenient to me

mortal hare
#

Eclipse IDE is not bad, but its plugin management is the worst

upper hazel
chrome beacon
#

Because they like it πŸ€·β€β™‚οΈ

mortal hare
#

half of the links on the plugin store, are literally dead

mortal hare
ivory sleet
#

well eclipse isnt bad, there are just better variants out there

mortal hare
#

its fast, uses less resources