#help-development

1 messages · Page 322 of 1

sterile token
#

I prefer OOP, so i would make a UserModel and in that model keep all the properties you will going to use

quaint mantle
#

i dont like oop

river oracle
#

Lol

#

Don't use Java

sterile token
river oracle
#

Easiest solution for oop haters

quaint mantle
#

wo wo wo wo

#

i didn't say i hated it

sterile token
#

If you wont learn Java basics and most useful things you musnt be programming on Java, take another lang

#

💀 🤣

#

Dont wondering to be gross nor rude, its just an opinion from someone who had a really bad past cuz he didnt learnt Java how he should and now he have lot of problems while coding

#

So if you wont effort on learning proper the lang, this is not the way for going. Just leave programming for devs who love what they do and do it because they like it

livid dove
#

.... so update on why now our dev team be stressing the hell out. This entire manipulator uses the old Java Edition Alpha level format

quaint mantle
#

bro that doesn't even look good 😭

sterile token
livid dove
livid dove
sterile token
#

I thought you were looking for an api for working over regions

#

🤦‍♂️

livid dove
livid dove
remote swallow
#

you build it to maven local then dep on that, or build it and mvn install it from build folder

undone kernel
#

'getByName(java.lang.String)' is deprecated what should I use instead

remote swallow
#

on what

undone kernel
#

Enchantment enchant = Enchantment.getByName(args[4].toUpperCase());

compact haven
#

mate he meant what class

#

which you gave

undone kernel
compact haven
#

but yeah that’s what he meant lol

#

Uhm?

remote swallow
#

Enchantment.getByKey(NamespacedKey.minecraft(args[4]))

remote swallow
compact haven
#

Because no one knows what the fuck getByName is from?

worldly ingot
#

Bukkit has like a couple hundred classes ;p

compact haven
#

there definitely more than one method with that name

undone kernel
remote swallow
#

no

undone kernel
#

yes

remote swallow
#

Enchantment is a class

#

getByName is a method

undone kernel
#

and that's what i needed

compact haven
#

bro this is the most aggressive question asker I’ve seen in a long time

#

literally has no patience

worldly ingot
remote swallow
#

who wants to do it

worldly ingot
#

Knowing it was from Enchantment lets us give you an alternative, which in this case is getByKey()

undone kernel
#

how would I fix this then since it kind of relies on that

                if (args.length >= 5) {
                    Enchantment enchant = Enchantment.getByName(args[4].toUpperCase());
                    if (enchant == null) {
                        player.sendMessage("Invalid enchantment.");
                        return true;
                    }
                    int level = Integer.parseInt(args[5]);
                    giveItem.addUnsafeEnchantment(enchant, level);
                }```
worldly ingot
#

That's all they were asking. We know it's under the Spigot API, but knowing which class holds the method that is deprecated helps us give a proper replacement

undone kernel
#

but

#

the things use enchant

remote swallow
#

and that will give it to you

compact haven
#

youll still get the enchant..

#

do you know Java, or how to read a javadoc, or how to ask a question 😔

worldly ingot
#

I'd argue NamespacedKey.fromString(args[4]) is a bit of a better option given that this is (presumably) user input from a command, but yeah

undone kernel
#

that's what i'm talking bout

remote swallow
#

?learnjava

undone axleBOT
worldly ingot
#

You still have to assign it to a variable

compact haven
#

Choco you are too patient

undone kernel
worldly ingot
#

I was just going to say lol

undone kernel
worldly ingot
#

Man that patience is running thin though KEKW

remote swallow
#

he was just going to say he is too paitence

#

that isnt english

#

is it too patient

undone kernel
#

it is english

compact haven
#

sorry

worldly ingot
#
NamespacedKey key = NamespacedKey.fromString(args[4]);
if (key == null) {
    sender.sendMessage("Invalid key: " + args[4]);
    return true;
}

Enchantment enchant = Enchantment.getByKey(key);
if (enchant == null) {
    sender.sendMessage("Unknown enchantment with key " + key);
    return true;
}```
compact haven
#

fuck me

worldly ingot
#

This will be your replacement

undone kernel
#

ah ty

undone kernel
compact haven
#

wtf epic

worldly ingot
#

(NamespacedKey#fromString() just allows user input to be either minecraft:sharpness or just sharpness)

compact haven
#

I was correct it’s patient

#

patience is something else

#

some gaslighting me

#

like you have patience

#

but you are patient

remote swallow
#

yeah

#

i he is too patient, not too patience

undone kernel
#

they aren't

kind hatch
#

They actually are.

#

Patient is a homonym.

undone kernel
#

no homo

compact haven
#

you can’t say I am patience

undone kernel
#

but I can say you have patience

remote swallow
#

this is too much for my brain

kind hatch
#

That's why you say you are patient

remote swallow
#

im going to find food

undone kernel
#

you already know where it is though

#

you're just going to the food

#

no

#

find and going aren't the same thing

compact haven
#

mate did you take a class on how to be annoying

undone kernel
#

yes

remote swallow
#

ive got no idea what food we have

#

thats why im going to find food

compact haven
#

well you’re definitely top of the class

#

so congratulations

undone kernel
remote swallow
#

i have not

#

i didnt buy it

undone kernel
#

yes you have

#

you've seen it

remote swallow
#

i havent

undone kernel
#

yes you have

remote swallow
#

okay so

compact haven
#

bro is trying to gaslight you into thinking you bought and put away the food

undone kernel
#

also it's "haven't"

remote swallow
#

you got unblocked for a day

compact haven
#

W

#

L

undone kernel
remote swallow
#

yeah

undone kernel
#

what isn't

compact haven
#

this entire damn convo

undone kernel
compact haven
#

sorry a sentence needs to have more than just a subject

undone kernel
#

yes as in "you have patience" and "you've very patient"

compact haven
#

well obviously

undone kernel
#

yes

compact haven
#

no one was confusing patient with the person admitted to a doctor

#

ehm?

undone kernel
#

who knows the difference between bow bow and bow (:

#

i learned that in like 2nd grade

compact haven
#

Bow is to bend your waist in response to another entity

#

bow is an item that archers use to shoot arrows

undone kernel
#

you should've been able to read my mind and see what order I wanted it in

compact haven
#

Bow is a thing that goes on your shirt, like a bowtie

#

well no you just didn’t graduate second grade yet

undone kernel
#

damn

#

bro got roasted

compact haven
#

no like I don’t mean to be rude

#

but how do you not know what an adjective is

undone kernel
#

?paste

undone axleBOT
compact haven
#

Like if you didn’t know what an adverb was or a preposition

#

can’t care less

undone kernel
compact haven
#

but an adjective???

undone kernel
#

I've created an abomination

compact haven
#

you do realize

#

you can separate those right

undone kernel
#

yes

#

but I choose not to

#

hence why I called it an abomination

compact haven
#

I see

undone kernel
#

also putting all of those into one file made the file reduce 20kb so now it's just 13kb

atomic swift
#

how can i store an ItemStack in a sql file

undone kernel
# atomic swift how can i store an ItemStack in a sql file

One way to store an ItemStack in a SQL file is to use a plugin like PersistenceAPI or H2Conomy, which allow you to save ItemStack objects in a database. You can also manually convert the ItemStack to a serialized string using Bukkit's BukkitSerialization, and then store that string in the SQL file. When you need to retrieve the ItemStack, you can then deserialize the string back into an ItemStack using the same method.

atomic swift
#

which one would you choose

compact haven
#

serialize

atomic swift
#

alright thank you

worldly ingot
#

Basically create a new ByteArrayOutputStream and wrap it around that BukkitObjectOutputStream, get the result as an array of bytes

livid dove
remote swallow
#

the fuck does that say

worldly ingot
#
var stream = new ByteArrayOutputStream();
var bukkitStream = new BukkitObjectOutputStream(stream);
bukkitStream.write(itemStack);
byte[] bytes = stream.toByteArray();```
humble tulip
#

And import with maven

remote swallow
#

build to maven local

#

import normally

livid dove
remote swallow
#

or build normally then mvn install

remote swallow
#

what plugin did you fork @humble tulip

humble tulip
#

It's gradle

#

Not a plugin

remote swallow
#

you forked gradle?

humble tulip
#

No

#

It's a gradle lib

sterile token
#

I need some recomendations for my CommandParser class which extends BukkitCommand, that class manage the command and sub command parsing. My issue is the next, im overriding the execute(CommandSender sender, String alias, String[] args) from its super.

So when args lenght is 0 im treating it as normal command
When args lenght are more than 1 i parse it as a sub command

But what happens? Well pretty much obviously normal command, can have arguments, so when i have a simple command like "/msg <player> <text>", the parser treats it as a sub command because of the lenght. That is not expected tho

compact haven
#

as for Verano

#

the solution is to treat it all as arguments, with sub commands being a literal argument that can only be a single value: the sub command. Or to use an actual command framework like CLOUD or ACF instead of once again reinventing the wheel

#

reinventing the wheel is not conducive to efficiency xd

sterile token
#

itzd i know but acf for me its completly shit, anottations, weight, etc

compact haven
#

then take a look at CLOUD

sterile token
#

But listen to me please

compact haven
#

no

#

I saw that verano

sterile token
#

What?

compact haven
#

yes what

sterile token
#

🤔

#

lmao dont be like that with that actitue no one will like you

livid dove
compact haven
#

mate I was literally going to help you, the no was sarcasm

#

but ain’t no way I’m staying in the convo with the thing u deleted and that latest message

autumn violet
#

hi i kinda need help how to get some old versions of minecraft after a year

compact haven
#

the answer was actually already given to you

#

have commands be commands and sub commands be arguments

sterile token
#

I mean dont play with me i dont like those play while im working

remote swallow
sterile token
#

Sorry man, my fault

compact haven
#

to match a command you simply continue to attempt matching the possible arguments

#

so if you have the attempts /heal <player> 20 and you want the sub command /heal full <player>

livid dove
compact haven
#

you had a structure like [PlayerArgunent, IntegerArg] or [LiteralAegumenr(“full”), PlayerArgumenr]

#

once an argument fails to match, you try the next tree

#

at least your algorithm can be similar to that

#

that’s how CLOUD works, at least

humble tulip
#

Nooo

#

Here's what to do

livid dove
# humble tulip Use jitpack

So just for record you sent me and my team down a rabbit hole with this one chief "it'll take like 4 hours". 2 days later and a depreciated id for the builder, having to use gradle and now having to utilise and learn bloody jitpack too xD

Im not mad, not got the luxury of time for that but jesus what did I do to deserve this lmao

humble tulip
#

No

#

That's the import lol

winged anvil
#

how the hell are bedrock servers like cubecraft developing features

#

cause ik damn well they arent using addons

#

trying to look into creating stuff for bedrock and other sources arent giving me the answers i want\

humble tulip
livid dove
sterile token
compact haven
#

none of which is simple btw but alright

humble tulip
sterile token
compact haven
#

ehm give me an example of what your framework looks like in the end

livid dove
remote swallow
#

url = uri("url")

#

@compact haven so what i had earlier, BaseHandler would that be BaseProcessorImpl? so to say my brain did its thing and realised i was doing the completely wrong this

#

so im just trying the stuff you sent me again lol

livid dove
#

sorry for the hand holding btw

#

this has been a stressful day xD

#

and i still have the damn code to run haha

remote swallow
#

implementation("stuff")

remote swallow
#

change the c-a ect to just a9842a668b

livid dove
#

Finally

Thank you based based dev you

compact haven
#

but like

#

there should be no constructor that takes an ItemStack for BaseProcessorImpl

#

or really a constructor for any of them at all

#

iirc it was a constructor

#

maybe it was a method overload for read with an ItemStack

#

in any case, BaseProcessor and the Impl should only return ItemStack, never intake one

remote swallow
#

yeah

#

i just figured that part out

#

i think im understanding it more?

#

but im tireder

#

brain works in mysterious ways

compact haven
#

lol

remote swallow
compact haven
#

yep

#

and it's incredibly embarrasing that I forgot to return Builder in a Builder pattern

remote swallow
#

yeah i noticed that

compact haven
#

dw about it

remote swallow
#

and am i correct in saying BaseHandler should just handle type and amount

compact haven
#

as long as u rename BaseHandler

remote swallow
#

Base

compact haven
#

BaseHandler makes no sense. if u want to change it from BaseProcessor name it ItemStackHandler and make it implement Handler while consuming a null ItemStack parameter

remote swallow
#

BaseItemStackHandler

compact haven
#

no

remote swallow
#

the longest class name

compact haven
#

no Base

remote swallow
#

ill use ItemStackHandler

compact haven
#

alright

remote swallow
#

should i throw illegal arg exception if the types dont exist

compact haven
#

what types

#

give example

remote swallow
#

the material and amount

compact haven
#

uh

remote swallow
#

been as their required to actually make the stack

compact haven
#

yeah I'd say so

remote swallow
#

mkay

#

makes my life like 0.5% easier

#

no need to make custom exceptions

#

i also need to do a null check i just realised

#

because materials

compact haven
#

and btw if it implements Handler

remote swallow
#

i just thought

#

i dont need to require amount

compact haven
#

u dont

#

default to 1

remote swallow
#

yeah

compact haven
#

ik u say that u do on ur wiki

#

i was very confused as to why

remote swallow
#

yeah

#

my brain doesnt brain sometimes

#

thats probably obvious now

sterile token
#

I need explanations please, im really confused at this point

#

The condition will join only if args leght is more than 1 and command is instance of SimpleExecutor, isnt what i code there?

remote swallow
#

you are checking if it isnt instance of SimpleExecutor

sterile token
#

because: commnad instanceof SimpleExecutor its make you think that will return true in case of using command instead of SimpleExecutor type

remote swallow
#

if you use command instanceof SimpleExecutor simpleExecutor on java 16 or higher that will pass if command is an instance of SimpleExecutor and it gives you a SimpleExecutor instace

sterile token
# remote swallow if you use `command instanceof SimpleExecutor simpleExecutor` on java 16 or high...

Both Class#isInstance() and instanceof are used to check if an object is an instance of a certain class, however, they have some key differences:

Syntax:
instanceof is a keyword in Java that is used in conditional statements to check whether an object is an instance of a particular class or one of its subclasses.
Class#isInstance() is a method that is used to check whether an object is an instance of a particular class or one of its subclasses.

Type Checking:
instanceof is used for type checking at runtime. It returns true if the object is of the specified class or any of its subclasses.
Class#isInstance() also performs type checking at runtime, but it is more flexible, as it can be used to check if an object is an instance of a particular class or any of its subclasses, or implement any of its interfaces.

Null Handling:
instanceof throws a compile-time error if the object is null, while Class#isInstance() returns false if the object is null.

#

💀

#

ChatGPT is fkg amazing

young knoll
#

Idk

#

ChatGPT told me to make my private variables private

remote swallow
#

make your private variables private private

undone kernel
winged anvil
#

like less than one argument ok make this class and if its a sub command create classes for the sub commands

#

and then just pass in interface

tender shard
#

Gh copilot > chat gpt

remote swallow
#

that costs money

#

also alex massive tragedy

tender shard
#

What happened

remote swallow
#

md doesnt like the getVanillaName or fromVanillaName

tender shard
#

Why?

remote swallow
#

he just doesnt get it

tender shard
#

Send link

remote swallow
#

i was talking about it in general, and he appeared

#

heres the pr

tender shard
#

What did he say?

remote swallow
#

if you search for messages in general from md you can probably find it

young knoll
#

TL:DR it's kinda useless

remote swallow
#

sendDemoScreen like

young knoll
#

Just do Namespacekey.minecraft(enchantname) and then use getByKey

#

Shh

remote swallow
#

this saves time

tender shard
#

Thats a workaround

#

The API should have this builtin

#

I am 100% pro for this PR

young knoll
#

It's not really a workaround

tender shard
#

It is

young knoll
#

That is what the keys are for

tender shard
#

No

#

The keys are only there because thats how mojang does it

#

They might change any time

young knoll
#

They added them to get away from magic values

#

I doubt they would just yeet them and go back to 1.12

tender shard
#

So?

#

Arguing like this, we could also get rid of the whole Material class

young knoll
#

I am for that

remote swallow
#

yes please do that

tender shard
#

I am not

remote swallow
#

im pretty sure choco has a pr for it somewher

young knoll
#

Replacing it is easy

#

Replacing it and keeping binary compatibility is not

tender shard
#

Having a 1:1 connecting between „vanilla enchantment names“ and „internal enchantment names“ doesnt hurt anyone, so why NOT add it?

remote swallow
#

convincing md that its worth it is our only issue

buoyant viper
#

?jd-s

undone axleBOT
remote swallow
#

wheres the "for me"

buoyant viper
#

true

buoyant viper
#

i too vouch to have a way to easily use "SHARPNESS" instead of DAMAGE_ALL

remote swallow
#

yes

#

everyone to my pr

#

we will scare md into approving it

young knoll
#

I mean I still think the key way is easy enough

buoyant viper
#

what the fuck is WATER_WORKER in game???

young knoll
#

Aqua affinity

remote swallow
#

that would still be a pointless method hundreds of people are creating for no reason

buoyant viper
remote swallow
#

fucking

#

proven

#

who wants to use water_worker over aqua_affinity

young knoll
#

I guess for that one you need to replace space with _ first

#

So that is a bit more effort

buoyant viper
#

what if instead of adding methods

#

we PR changes to the enum

young knoll
#

That's a breaking change

#

Can't do that

buoyant viper
#

we could move it to LEGACY prefixed no?

worldly ingot
#

It's getByKey()

remote swallow
worldly ingot
#

I'm with md on this and I knew before he even commented that he would disapprove of it because it really doesn't add much

remote swallow
worldly ingot
#

If anything it makes things a little more ambiguous because what type of string are you passing in?

#

NamespacedKey kind of restricts it

buoyant viper
#

or only add to enchantment and keep the former Bukkit names alongside them

young knoll
#

String vanilla = "Aqua Affinity"
NamespaceKey key = Namespacekey.minecraft(vanilla.replace(" ", "_"));
Enchantment.getByKey(key);

#

3 lines, not that bad

buoyant viper
#

a little duplication couldnt hurt anybody duke

worldly ingot
#

The proposed methods don't even do that, Coll

young knoll
#

Actually you'll want a toLowerCase as well

worldly ingot
#

It's not converting English translations to Enchantment, it's just doing getByKey() without the namespaces

#

Auto appending the Minecraft namespace. That's all

young knoll
#

Ah

#

So you still need to pass "aqua_affinity" specifically

worldly ingot
#

Yes

#

There is only one class that does this sort of thing and it's Material#matchMaterial()

#

So if something like this were to be added, (1) getVanillaName() should be removed because it's useless, and (2) it should match existing nomenclature

buoyant viper
#

time to fork and publish EpicSpigot @remote swallow

remote swallow
worldly ingot
#

I would say scrap what you have currently and mirror what #matchMaterial() does, only #matchEnchantment()

#

getVanillaName() doesn't need to exist imho

#

Then maybe do that for all keyed types

buoyant viper
#

matchMaterial matchEnchantment and matchPotionEffectType AbsoluteHalal

worldly ingot
#

Exactly

young knoll
#

Time to steal his PR and do that

remote swallow
#

my pr will probably be denied so you can probably just do something like "replica of "807 with extra features ect"

worldly ingot
#

I mean you can adjust the trajectory of your PR

#

Just need to make a new commit

remote swallow
#

can i change name of pr? or would that need new

#

ill probably do that, when i finish the other stuff ive gotta work on

worldly ingot
#

Yeah you can edit the PR name

#

I think adding match methods would be something worth merging in

#

For everything that extends Keyed, ideally

remote swallow
#

@blazing mica remember tomorrow

#

And thats the wrong account

#

@remote swallow

humble tulip
#

Send me a region file with the item

#

Or show me what the item looks like

#

And I'll write code to do it for u

humble tulip
livid dove
#

I just need a loop that gets me every region file in a world

#

as i keep getting acces is denied

humble tulip
#
    public static void main(String[] args) throws IOException {
        File file = new File("region");
        if (!file.isDirectory())
            return;
        for (File listFile : file.listFiles()) {
            Region region = RegionIO.readRegion(listFile);
            for (Map.Entry<ChunkPos, Chunk> entry : region.getEntries()) {
                NbtList<NbtCompound> list = entry.getValue().getCompound().getCompoundList("block_entities");
                for (NbtCompound nbtCompound : list) {
                    if (!nbtCompound.getKeys().contains("Items"))
                        continue;

                    NbtList<NbtCompound> itemList = nbtCompound.getCompoundList("Items");

                    for (NbtCompound compound : itemList) {
                        //check items here
                    }
                }
            }
        }


    }
humble tulip
#

my project looks like this

worldly ingot
#

See updated comments on your PR, @remote swallow

#

RE: @Contract annotations and Validate

#

Asking md for input before you start any changes though. What I think is mergeable and what md thinks is mergeable may differ

sterile token
#

StackOverflowError

#

LMAO discovering new java errors

#

💀

young knoll
#

You haven’t seen that one yet?

sterile token
#

So far not haha

#

Look that lmao its explained the error section like infinite times

#

😂

#

Okay im definitly dumb

livid dove
#

cause ngl we may of wrote in kotlin 0_0

humble tulip
#

that's java

sterile token
humble tulip
#

i send you a multithreaded version in java

sterile token
humble tulip
#

lmfao

#

you're passing command to the command.execute

#

well a stackoverflow will happen tbh

sterile token
#

Yeah, that why i get a new exception OflerFlow

sterile token
#

I sent the url

#

Were appear that

#

That why i first get without words, because the line where the problem was, was sent thousans times

dull magnet
#

Is it possible to get a block's hardness and make that hardness disappear by 1 each time it is hit with a snowball and the block disappears when that number reaches 0?

regal scaffold
#

Is it possible to make a plugin that can override other plugins onPlayerJoin messages?

river oracle
#

You could inject bytecode

#

But that's beyond me

eternal night
#

I mean, you can just register your listener later on in the chain ?

#

e.g. priority HIGH or HIGHEST

regal scaffold
#

No

eternal night
#

unless that is what the other plugin is already doing

regal scaffold
#

I want first

eternal night
#

wat

regal scaffold
#

Like I want to cancel all the messages

#

From other plugins

#

Or even better

#

I want to get all the messages that would be sent, sort them with a plugin and then send them onJoinEvent

eternal night
regal scaffold
#

Nope

#

All the messages that plugins send to users when they join the server

eternal night
#

then no

#

you are fucked

river oracle
#

I mean byte code???????? It'd take Literal years of his life

regal scaffold
#

Really that impossible?

#

Technically only way

eternal night
#

you'd have to catch the outgoing chat packets

regal scaffold
#

Would be changing the server .jar right?

river oracle
#

Oh thays smart PacketEvents

regal scaffold
#

Not even sure if modifying spigot is allowed

eternal night
#

I mean, the packet catching only "works" partially tho

#

you can certainly fork spigot

#

your plugin should not tho

#

if you are going to publish it

regal scaffold
#

So technically it could be done

eternal night
#

I would 100% not publish a plugin to spigot that edits the server code

regal scaffold
#

By forking spigot, making a custom version which can give access to a plugin

eternal night
#

if this is for a private server, then yea

#

fork spigot

regal scaffold
#

Seems like a dumb amount of work

river oracle
#

What the fork

eternal night
#

well you are trying to do something that isn't possible rn

regal scaffold
#

Easier to prob just edit the plugins and rebuild them lmao

#

but not allowed on some

river oracle
#

Def not easier than fork

eternal night
#

fork is rather simple tbh

#

well

#

depends I guess, spigot fork sounds like a hassle

regal scaffold
#

Forking isn;t the issue

#

The issue is somehow blocking every possible message sent

#

And then make a plugin that can handle that

river oracle
#

Fork spigot

eternal night
#

how is that the issue if you can fork 😂

#

would literally be a single event fired on sendMessage calls

#

and then your plugin just collecting them

regal scaffold
#

Oh wait

#

you're right lo

#

Might be an interesting idea

eternal night
#

I mean, this obvs only makes sense if it is for your private server and you can fork

regal scaffold
#

Yeah yeah fair

eternal night
#

no user is going to download your fork if this is logic for a public plugin

dull magnet
#

please help me..

jagged monolith
#

?ask

undone axleBOT
#

If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!

dull magnet
#

Do you know how to solve this problem?

regal scaffold
#

Yes! It is possible

dull magnet
#

How can I do it?

regal scaffold
#

EntityDamageByEntityEvent -> Detect when player throws a snowball, get the target block from the event
Create a itemstack and get the itemmeta from the target block if it wasn't null
Decrease the hardness, if it reaches 0 replace the block with air or make it drop normally

#

I believe are the steps

dull magnet
#

I'll try

regal scaffold
#

@dull magnet I was wrong

#

Use ProjectileHitEvent

#

You don't care about who threw, just about the block hit

dull magnet
#

So what do we do?

jagged monolith
#

Use ProjectileHitEvent

regal scaffold
#

Same thing as I said but with ProjectileHitEvent

#

ProjectileHitEvent -> Detect when a snowball hits a block. add if so if the hardness is 0 then breaks, decrease the hardness

dull magnet
#

All right!

regal scaffold
#

If you have any issues send it here I'll be more specific

dull magnet
#

OK

regal scaffold
#

@dull magnet Just did some testing and it works perfectly, just have in mind the hardness of a block is not 100 as full

#

Doing some tests, blocks have different hardness

#

Oak log has 2.0

#

Dirt block has 0.6

dull magnet
#

OK

regal scaffold
#

btw you might need to change how you do this

#

Or just group some block durability and set specific hardness

dull magnet
#

if you do not mind
Can you send me the code when it fails?

regal scaffold
#

@dull magnet After some more reading you're trying to do something pretty complicated

dull magnet
#

oh great!

regal scaffold
#

It's not really possible with spigot but instead with the actual minecraft API

#

I think you have to use something like Reflection but you can wait here maybe the more experienced people have another idea even though I doubt it

dull magnet
#

thanks!

twin venture
#

hi , i have a bit of hard question , its something iam trying to do ..
so i have a quests plugin system ,
how it works server owners can create their own quests from yaml file .
and it does show the quests in the gui , my only problem with the system is the events handling parts :
so for example lets say there are 2 quests with the same event that trigger them :
1- Win 1 game of bedwars
2- Win 5 games of bedwars
the same goes for other type of quests :

  • Play 1 game of bedwars
  • ... etc

  • Break 5 beds ..
    ..
    my problem now its duplicating the values when i win so insted of increasing by 1 , it dupilicate to 2 , 4 , 6 , 8 ..
lament bridge
#

Stand on block

twin venture
#

any ideas maybe on how i can create better event handling for all quests?

torn shuttle
#

that's weird, I've got MHF_ArrowLeft displaying correctly but MHF_ArrowRight does not

torn shuttle
# twin venture sooo

this is not a question any sane person here will help you with, it has everything to do with your own implementation of quests and if you are having issues with implementing multiples of quest objectives then you probably already have a very bad structure for it

twin venture
#

but i edited the system so it can work with yaml file to load the quests from their .. and it does work the loading part atleast , but the even'ts part to handle it not so much

torn shuttle
#

yeah so it sounds like I was right

twin venture
#

yeah

#

what do you think the best aproch to fix it?

torn shuttle
#

probably the one I wrote for my own yaml-based custom quest system which is free and open source and available to be viewed on github right now, or else I probably wouldn't have spent weeks writing it in the first place

twin venture
#

can i see ?

torn shuttle
#

only if you promise to stop spamming the same reaction to everything that gets posted

torn shuttle
twin venture
#

Alright thanks

#

i already finished 90% of the plugin , its amzingly works , the problem only with the events part

torn shuttle
#

get ready to find out you only actually did 15% of the plugin and the rest needs to be rewritten

torn shuttle
#

is MHF_ArrowRight broken?

#

hm seems fine when I give it but not when I assign it as owner of a skull

lament bridge
#

I coded so that the plugin gives jump boost 4 for 1 second to the player that is standing on the emerald block. Why could this not be working?

@Override
public void onEnable() {
// Plugin startup logic
getServer().getPluginManager().registerEvents(this, this);
}

@Override
public void onDisable() {
    // Plugin shutdown logic
}

@EventHandler
public void onPlayerMove(PlayerMoveEvent event) {
    if (event.getTo().getBlock().getType() == Material.EMERALD_BLOCK) {
        event.getPlayer().addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 20*1, 4, false, false));
    }
}

}

tardy delta
#

that would mean the player is standing in an emerald block

#

do getRelative(BlockFace.DOWN).getType() == emerald block ig

torn shuttle
#

icky

tardy delta
#

never used them ;-;

torn shuttle
#

wow

tardy delta
#

well maybe once when copying code from yt for an effects plugin like two years ago

#

;-;

torn shuttle
#

wow

#

quite literally the first thing I did in modding used the hell out of vectors, it was my old just cause 3 adaptation of the grapple + parachute mechanic using fishing rods and elytras in mc

#

worked great too

tardy delta
#

uh oh

torn shuttle
#

this arrow thing bothers me

#

I wonder why it's like this

lament bridge
tardy delta
#

wondering where the methodhandles are

round eagle
#

i have this TextComponent which is supposed to be a clickable link that i wanna use for event.CancelReason. it just turns out to be a just piece of normal text.

TextComponent link = new TextComponent("click me");

link.setClickEvent(new ClickEvent(ClickEvent.Action.OPEN_URL, "<the link>"));
event.setCancelReason(link);

any sort of hint will be appreciated. thanks in advance
ps. i'm fairly new to java and plugin development

round eagle
#

onPreLogin

tardy delta
#

AsyncPlayerPreLoginEvent?

#

cant find CancelReason anywhere in the docs

round eagle
tardy delta
#

ah bungee?

round eagle
#

yes

tardy delta
#

im sorry i dont have experience with that

round eagle
#

i see

next kernel
#

I'm looking for ideas on maintaining a good code structure here.
I have a huge Bukkit plugin project, but even though I split it into multiple Maven modules, it's still extremely mentally taxing to maintain.
The main problem is that the main plugin class maintains the reference relationships between modules, and basically any module of the plugin needs to get the other modules/classes it needs from this main class.

This leads to a rather cumbersome project to maintain, as shown in the figure.
Should I use dependency injection, or something similar, in order to minimize the use of the main class?

#

I'm not sure if dependency injection is necessary for use in the Bukkit plugin ...... or if there is a better solution

tardy delta
#

its recommended to use dependency injection if you werent already using it yes

next kernel
tardy delta
#

?di

undone axleBOT
tardy delta
#

thats the most simple thing you can do

next kernel
tardy delta
#

werent you already using constructor injection?

torn badge
next kernel
#

this worked well at begin, but became a problem as it grew faster and larger

torn badge
#

And don’t pass the main class for everything, pass the objects you actually need

tardy delta
#

static getter go brr

#

^^

next kernel
#

well, I think I need a major overhaul for plugin design, thanks for the suggestions guys!

torn badge
#

Create interfaces to decouple your code

next kernel
#

I have a dedicated maven module to put interfaces, but still ^^

tardy delta
#

wait are you having modules instead of packages?

#

is there really a point for doing that?

next kernel
#

basiclly, api but also internal use

tardy delta
#

ah

next kernel
#

It took me almost a year to make the API package independent

#

and created a lot of interfaces, which really made my life a little better.

zealous edge
#

hi, I wanted to know, how do we make it so that when I enter the nether it sends a msg in the chat I can't find the event

torn badge
#

Your interfaces still sound very specific though

zealous edge
tardy delta
#

check if the world type is nether or smth or compare with Bukkit.getWorlds().get(1)

ivory sleet
#

arguably a bit too premature

#

like its good for general imagination, but you will eventually at impl stage write things differently, inevitably

#

and by dependency injection, if you mean one of those frameworks sure

#

it helps with mapping dependencies a bit

#

but honestly not such a big deal

#

else just do it in some factory methods

#

also

#

regarding your module system, do you mean you have a cyclic relationship between ur modules?

torn badge
next kernel
ivory sleet
#

yes it doesnt but thats the entire point

next kernel
#

In fact, I didn't use much of the Maven Module

ivory sleet
#

ye well i dont use maven so idk

next kernel
#

I think I've gotten enough advice from there, now I'll go try them out and pick the right one

#

uwu thanks for everyone

tardy delta
#

thank me for letting md5 add the uwu

summer scroll
#

Does anyone know if ProtocolLib has discord server?

#

been searching and couldn't find one

next kernel
#

as far I know, no

zealous osprey
#

Hoi, I want to seperate a string at all the single .. Issue is my string looks like this:
Items[1].tag.BlockEntityTag.Items[..], note the [..] term.
I tried using the following regex: [\w\]]\. but that matches not only the dots, but also the character before them. Is there a way of doing this without seperating the string with that character before the dot?

#

I guess I could just change the [..] to something like [§§] and then seperate at all the dots

zealous osprey
#

ah fk me, the look behind

zealous osprey
# rotund ravine (?<!\.)\.

Doesn't seem to work. But I think I can figure it out now by myself. Thx for reminding me that lookbehind and lookahead exist :D

rotund ravine
#

ah

#
(?<!\.)\.(?!\.)
#

i guess

zealous osprey
#

yea, that seems to work

#

thx <3

zealous osprey
#

Ah yes, regex is fun... \.(?=\w). This finds the first single . and then I split the string there to remove the first key of the str

tribal holly
#

Someone know where chunk forced load are saved ? in a file inside world fodler or something similar ?

rotund ravine
#

huh?

gilded tangle
#

Do any of you know how to do this in 1.19.2? :/
Or knows a better solution for this?

lament swallow
#

are those RGB colors in scoreboard?

#

any idea how to achieve this?

kind hatch
# gilded tangle

You could use the open book packet provided that you are using the obfuscation mappings.

@Override
  public void openBook(JavaPlugin plugin, Player player, ItemStack book) {
    int slot = player.getInventory().getHeldItemSlot();
    ItemStack old = player.getInventory().getItem(slot);
    player.getInventory().setItem(slot, book);
    new BukkitRunnable() {

      @Override
      public void run() {
        ClientboundOpenBookPacket packet = new ClientboundOpenBookPacket(InteractionHand.MAIN_HAND);
        ((CraftPlayer) player).getHandle().connection.send(packet);

        player.getInventory().setItem(slot, old);
      }
    }.runTaskLater(plugin, 1);
  }
vale ember
#

is any event fired when an explosion is created via World#createExplosion?

kind hatch
# lament swallow are those RGB colors in scoreboard?

Yes, those are RGB colors in the scoreboard. You can convert them using ChatColor#of() and providing a hex color code. RGB colors are only supported in 1.16+

The common way plugins do this is with a short and simple method.

public static final Pattern HEX_PATTERN = Pattern.compile("#[a-fA-F0-9]{6}");

public static String formatHexColorCodes(String string) {
  Matcher matcher = HEX_PATTERN.matcher(string);
  while (matcher.find()) {
    string = string.replace(matcher.group(), "" + ChatColor.of(matcher.group()));
  }

  return string;
}
tardy delta
#

that took long lol

#

probably also want to do a ChatColor.translate blablabla at the end

kind hatch
#

Or just pass it in through another method.

public static String colorText(String msg) {
  return TextUtils.formatHexColorCodes(ChatColor.translateAlternateColorCodes('&', msg));
}
#

Your choice though.

vivid skiff
#

How can i check if a block is a LARGE_FERN or a TALL GRASS in legacy because they have the same id and Material name

kind hatch
lament swallow
#

thanks i'll try that

lament swallow
twin venture
#

hi @torn shuttle , could you accept my friend request ? i have further questions ..

kind hatch
warm light
#

I am making a discord stats plugin to show bedwars1058 stats to discord
but stats not working for offline players.
I tried with API & placeholder. none of them works for offline players

lament swallow
lament swallow
#

so I can't rly set a color

glossy venture
kind hatch
#

When did that get added?

glossy venture
glossy venture
lament swallow
kind hatch
#

Uhh, not really. There's a reason we have methods like the one I posted earlier. It just didn't exist for a long time. I gotta learn how to navigate the stash. :3

kind hatch
wise pumice
#

Any API for nametags? Without nametagedit

ocean hollow
#

hi guys, how to control moving Items in Inventory?

molten hearth
#

does anyone know how to connect to mongodb using mongoimport? I always get sh No address associated with hostname using mongoimport --uri "mongodb://user:pass@cluster0.3oqgtcv.mongodb.net:27017/test?ssl=true&replicaSet=myAtlasRS&authSource=admin" --collection mc_scans --drop --file filtered.json

lament swallow
kind hatch
#

Oh, my bad. That unfortunately leaves packets as your only option.

lament swallow
#

The only way I can think of doing this would be to include the player name in the team prefix and change the color from there

#

cause that works

#

But that means a team for each player

lament swallow
kind hatch
#

I'm not sure as I haven't really dealt with scoreboard teams a whole lot, but I do think prefixes give you a little more flexibility.

restive mango
#

Kk so how to do it fast

lament swallow
#

ok, thanks for the help tho

vale ember
#

Is player change exp called when player's exp decreases like when enchanting or using anvil or dying?

humble tulip
#

Nt sure abt dying

#

But probably

hazy parrot
#

?tryandsee

undone axleBOT
molten hearth
#

got it to work with mongoimport --uri "mongodb+srv://user:pass@cluster0.3oqgtcv.mongodb.net/mc_scans?ssl=true&authSource=admin" --collection mc_scans --drop --file filtered.json

tardy delta
#

is it actually needed to close a resource from JavaPlugin#getResource?

#

like a yml file

pseudo hazel
#

well if its needed i would have gotten in trouble for it by now I would assume

gleaming grove
#

When I wasn't closing resources file IDE couldn't replace plugin file after project build

tardy delta
#

💀

hazy parrot
tardy delta
#

nope

ivory sleet
#

yes u need to close it

#

or well

#

you should

tardy delta
#

that

#

idk if it releases some resources or whatever

crude charm
#

I wanna make a prison core and there is alot to do with scaling enchants / levels. So I dont have to predefine level 1 - 2 is 100 tokens then it will scale so like 100 - 101 is 12309133 tokens or whatever. Or scaling enchants so the price is higher each level?

Does anyone have a util or an efficient way to do this?

ivory sleet
#

u have to close it

tardy delta
#

just doing it like this lol

worldly ingot
#

If you're specifically loading a configuration file from an input stream, YamlConfiguration#loadConfiguration() closes the stream

#

Or more accurately, #loadConfiguration(Reader) calls FileConfiguration#load(Reader) which wraps that reader in a BufferedReader and closes it, closing the wrapped reader

#

So in this case you're fine

tardy delta
#

oh here it does ye

quaint mantle
#

Hi guys! I would like to change NPC Skins based on which player is looking at them. Is that possible?

#

If yes, what would be the best way to go about it

vale ember
#

it is since npcs are created via packets, but it depends on how you create them

#

do you use any api?

#

or raw nms?

quaint mantle
#

raw nms

wet breach
tardy delta
#

hmm i should read about that

ocean hollow
#

can I change gui title without creating new?

eternal night
#

with packets yea

#

tho hacky

ocean hollow
#

so i don`t have inv.setTitle()?

eternal night
#

no

worldly ingot
#

(still open to PRs on that by the way)

wheat compass
#

Is there a built in spigot way to just mute players, or just disable chat entirely?

#

I tried using an outdated ChatDisable plugin, but any time someone typed, everyone got kicked for chat validation failure

tardy delta
#

cancel the async chat event

humble tulip
#

actually lemme do some testing first

#

and then

wheat compass
quaint mantle
#

Is there a way to convert sounds from the client to spigot Sounds?

#

or a way to know what is what

rotund ravine
#

huh?

river oracle
#

That question doesn't make sense

mighty mica
#

Good afternoon,

Could anyone here point me in the right direction please?
I'm trying to create multiple YAML files for my plugin, but I can't find a single article / forum / post / whatever online that could help :c

Any help would be majorly appreciated.
Thank you,
Seb <3

quaint mantle
#

to spigot sounds

humble tulip
#

or PlayerInventory

river oracle
humble tulip
#

as in the name doesn't even show on the client. Also for horses, a packet isn't sent to open the inventory when e is clicked

quaint mantle
humble tulip
wheat compass
vale ember
tender shard
#

for enchanting: also no

#

anvil: also no

humble tulip
#

hey alex

tender shard
#

hewwo

humble tulip
#

see that msg

#

then this msg

humble tulip
#

thoughts?

tender shard
#

i first of all gotta wait until my pull request is accepted before I do a new one lol

humble tulip
#

i wanted to make a pr for it

#

but do you think there should be a nameable interface for inventory?

eternal night
#

I still advocate for the fact that this rename functionality belongs in UnsafeValues

#

it is horribly hacky

#

that entire functionality depends on an implementation detail in the client KEKW

#

not even server

#

hence; hacky af

#

yea

#

flame mojang to fix shit ¯_(ツ)_/¯

#

mojang has done stuff for server software before

#

but yea, this is such a niche case

topaz cape
#

you don't have to i guess

#

but I'd rather do that as well most of the time

halcyon mica
#

Does 1.19.3 not having mojang mappings?

river oracle
#

every version after 1.17.1 has mojang mappings

remote swallow
#

it should

halcyon mica
#

Running build tools with the --remapped flag still results in intermediaries

river oracle
#

they are releasesd before spigot every version

#

make sure you followed the steps correctly

#

?nms

halcyon mica
#

I'm not using maven, but yes special source is set up

river oracle
#

uhhh

#

i didn't know special sources worked without maven

#

iirc thats been a long standing issue

eternal night
#

are you sure you are depending on the correct artefact

halcyon mica
#

Specialsource with gradle has been working just fine so far

#

Also, the issue is not even with packaging, the jar is not generated with mappings during the build tools run

wise pumice
#

Any NAMETAG API without nametagedit?

tender shard
#

anyone know how I can make bitbucket know that my commits are actually from me / tied to my stash account?

tender shard
eternal night
#

nametag api but screamed at you 👍

wise pumice
#

Prefix, suffix in tab

glossy venture
#

if i have a class Bootstrap which loads a set of libraries from a Maven repo into a URLClassLoader, how could i load and execute a class Main with those libraries availible

i assume id need a child loader to load the class but just constructing a new abstract ClassLoader and using that doesn't seem to work

eternal night
#

I mean, if your main class is already loaded you are fucked

#

idk what exactly you are doing with an abstract classloader tbh 😅

quaint mantle
#

Is there any github gists anyone knows for serializing and deserializing itemstacks?

glossy venture
floral furnace
#

Can someone help with relocating kotlin-stdlib in maven, asked on the forums and someone said to ask here

glossy venture
eternal night
#

but its in the same jar ?

glossy venture
#

current attempted solution:

ClassLoader childLoader = new ClassLoader(parentClassLoader) { };
logger.info("Running ClusterMain.execute(...)");

try {
    Class<?> mainClass = Class.forName("net.neonpvp.ClusterMain", true, childLoader);
    Method main = mainClass.getMethod("execute", String[].class);
    main.invoke(null, (Object) args);
} catch (Exception e) {
    e.printStackTrace();
}
glossy venture
#

doesnt mean its loaded

eternal night
#

what explodes ?

glossy venture
#

java resolves and loads symbols when it needs them

eternal night
#

i know, thanks

glossy venture
rotund ravine
#

you should help this guy

tender shard
#

Id never voluntarily touch Kotlin without gloves

rotund ravine
#

he just needs to relocate his libs.

floral furnace
#

brother

#

i aint no dummy

rotund ravine
#

hm?

#

I called alex a dummy

floral furnace
#

oh i cant read gg

rotund ravine
#

?paste

undone axleBOT
rotund ravine
#

your maven file

#

and then let @tender shard help you use relocation in maven

tender shard
#

kk

floral furnace
#

worked?

rotund ravine
#

We can see it yes

eternal night
glossy venture
#

tf both of these pass

tender shard
#

whats the package of stdlib

eternal night
#

like, go run .getClassLoader() on your loaded Main class

#

and sob

tender shard
#
<project>
    ...
    
    <build>
        ...
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.4.1</version>
                <configuration>
                    <relocations>
                        <relocation>
                            <pattern>kotlin</pattern>
                            <shadedPattern>your.package.kotlin</shadedPattern>
                        </relocation>
                    </relocations>
                </configuration>
            </plugin>
        </plugins>
    </build>
rotund ravine
#

@floral furnace

floral furnace
#

❤️

#

lemme check

eternal night
#

yea

glossy venture
#

its not even getting loaded by the class loader i specifid

eternal night
#

because that loader does not know it ?

#

the loader cannot find that class its a NOOP classloader

#

it just forwards the request to the parent

#

until you hit the AppClassLoader

#

which knows the class and loads it/takes ownership

glossy venture
#

ah

eternal night
#

hence why you don't do these things with in the same jar 😅

#

usually you do what like, paperclip does.

floral furnace
#

shade error Failed to execute goal org.apache.maven.plugins:maven-shade-plugin:3.0.0:shade (default) on project GBOQueue: Error creating shaded jar: null

eternal night
#

bootstrap in the class and then unpack the actual application jar

#

to properly load via URLClassLoader

tender shard
#

you are using maven-shade-plugin version 3.0.0

#

what I sent uses version 3.4.1

floral furnace
#

real

#

plugin doesnt enable now

tender shard
#

stacktrace?

floral furnace
tender shard
#

what's NitrogenAPI line 21?

floral furnace
#

@JvmStatic lateinit var jedisPool: JedisPool

tender shard
#

are you sure? then where does this "Intrinsics" class come from? o0

floral furnace
#

i have no clue

rotund ravine
#

huh

floral furnace
#

i can send u the class if u want

rotund ravine
#

NitrogenAPI is part of your plugin or someone elses?

floral furnace
#

different kotlin plugin

tender shard
#

I have no clue. Does your .jar actually contain this Intrinsics class, in the relocated location?

floral furnace
#

its mine

rotund ravine
#

I guess the other plugin doesn't have all the kotlin classes

worldly ingot
#

Just looks like you're missing the Kotlin stdlib at runtime

heady wasp
#

trying to make it so player's can't /dupe when they have nothing in their hand.

code:

            player.sendMessage(CC.color("&c&lERROR: &fYou can't dupe AIR!"));
        }

        player.getInventory().addItem(player.getItemInHand());
        if(DupePRO.getInstance().getConfig().getBoolean("send-message")) {
            player.sendMessage(String.valueOf(player.getItemInHand()));
            player.sendMessage(CC.color(String.valueOf(DupePRO.getInstance().getConfig().getString("dupe-message"))));
        }```
error: none this is just what i see
rotund ravine
heady wasp
#

i sent the item stack thing for debuging

floral furnace
#

in the relocated position

#

but it doesnt realise it ?

worldly ingot
rotund ravine
#

You say it's a different jar that nitrogenapi right?

worldly ingot
#

if (itemStack.getType() == Material.AIR)

heady wasp
#

kk

tender shard
#

well it's the Nitrogen / NitroLib thing throwing the error

worldly ingot
#

In modern versions you can do getMaterial().isAir()

tender shard
#

Ofc there you gotta shade your kotlin stuff too

floral furnace
#

it wasnt before

rotund ravine
tender shard
#

it looks like your Nitrogen thing is trying to get the STDLib from your current plugin

floral furnace
#

but i will try now

tender shard
#

in your nitrogen thing, also shade and relocate STDLib

floral furnace
#

yeye will

tender shard
#

and ofc not to the same package that you currently use

#

uk.rayware.nitrogen.shaded.stdlib
uk.rayware.myotherplugin.shaded.stdlib
etc ...
sth like that

#

otherwise you'll again have the original problem lol

worldly ingot
#

could also use the libraries feature of the plugin.yml

worldly ingot
#

lol

rotund ravine
#

org.bukkit.craftbukkit.v1_8_R3.scheduler.

floral furnace
#

works, thanks guys

worldly ingot
#

Wish that version would die an insufferable death

#

Been on life support for like 5 years now

tender shard
#

ooga ooga

floral furnace
#

true but new combat is too gross

worldly ingot
#

old argument

#

rehashed a million times

tender shard
#

it's way better

#

now it's actually about timing and not just spam clicking lmao

worldly ingot
#

rehashed a million times
let's not, please lol

floral furnace
#

ye buts thats ur opinion i prefer the old version and there is nothing wrong with that

eternal night
#

Wouldn't say nothing XD

worldly ingot
#

The thing wrong with it is that you're intentionally and willfully neglecting tools to make your life easier

eternal night
#

MD should have just left the log4j exploit

#

Easy fix

worldly ingot
#

Could have fixed your whole problem with just 2 lines in your plugin.yml

#

But that was post-1.17 or something

tender shard
#

oh and the API is shitty and misses thousands of features

eternal night
#

What do you mean I cannot set noAI on mobs ???

tender shard
#

wait, does that mean I can not send action bar messages without NMS?

heady wasp
#
org.bukkit.command.CommandException: Unhandled exception executing command 'dupe' in plugin DupePRO v1.0
    at org.bukkit.command.PluginCommand.execute(PluginCommand.java:47) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?]
    at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:155) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?]
    at org.bukkit.craftbukkit.v1_19_R1.CraftServer.dispatchCommand(CraftServer.java:916) ~[paper-1.19.2.jar:git-Paper-215]
    at org.bukkit.craftbukkit.v1_19_R1.command.BukkitCommandWrapper.run(BukkitCommandWrapper.java:64) ~[paper-1.19.2.jar:git-Paper-215]
    at com.mojang.brigadier.CommandDispatcher.execute(CommandDispatcher.java:264) ~[paper-1.19.2.jar:?]
    at net.minecraft.commands.Commands.performCommand(Commands.java:305) ~[?:?]
    at net.minecraft.commands.Commands.performCommand(Commands.java:289) ~[?:?]
    at net.minecraft.server.network.ServerGamePacketListenerImpl.performChatCommand(ServerGamePacketListenerImpl.java:2294) ~[?:?]
    at net.minecraft.server.network.ServerGamePacketListenerImpl.lambda$handleChatCommand$20(ServerGamePacketListenerImpl.java:2248) ~[?:?]
    at net.minecraft.util.thread.BlockableEventLoop.lambda$submitAsync$0(BlockableEventLoop.java:59) ~[?:?]
    at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1768) ~[?:?]
    at net.minecraft.server.TickTask.run(TickTask.java:18) ~[paper-1.19.2.jar:git-Paper-215]
    at net.minecraft.util.thread.BlockableEventLoop.doRunTask(BlockableEventLoop.java:153) ~[?:?]
    at net.minecraft.util.thread.ReentrantBlockableEventLoop.doRunTask(ReentrantBlockableEventLoop.java:24) ~[?:?]
    at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:1341) ~[paper-1.19.2.jar:git-Paper-215]
    at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:185) ~[paper-1.19.2.jar:git-Paper-215]
    at net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:126) ~[?:?]
    at net.minecraft.server.MinecraftServer.pollTaskInternal(MinecraftServer.java:1318) ~[paper-1.19.2.jar:git-Paper-215]
    at net.minecraft.server.MinecraftServer.pollTask(MinecraftServer.java:1311) ~[paper-1.19.2.jar:git-Paper-215]
    at net.minecraft.util.thread.BlockableEventLoop.managedBlock(BlockableEventLoop.java:136) ~[?:?]
    at net.minecraft.server.MinecraftServer.waitUntilNextTick(MinecraftServer.java:1289) ~[paper-1.19.2.jar:git-Paper-215]
    at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1177) ~[paper-1.19.2.jar:git-Paper-215]
    at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:305) ~[paper-1.19.2.jar:git-Paper-215]
    at java.lang.Thread.run(Thread.java:833) ~[?:?]
Caused by: java.lang.NullPointerException: Cannot invoke "org.bukkit.inventory.ItemStack.getType()" because the return value of "org.bukkit.entity.Player.getItemInUse()" is null
    at org.cartyoo.dupepro.DupeCommand.onCommand(DupeCommand.java:24) ~[DupePRO-1.0.jar:?]
    at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[paper-api-1.19.2-R0.1-SNAPSHOT.jar:?]
    ... 23 more```

```if(player.getItemInUse().getType().equals(Material.AIR)) {```
tender shard
#

the itemInUse is obviously null

heady wasp
#

i tried what intelej suggested and if(Objects.requireNonNull(player.getItemInUse()).getType().equals(Material.AIR)) {

#

but that still errored

eternal oxide
#

Objects.requireNonNull is pointless

tender shard
#

if getItemInUse() is null, why on earth would you want to throw into Objects.requireNonNull()?

heady wasp
#

idk

tender shard
#

you cannot do null.getType()

#

and player.getItemInUse() is null

#

because they don't use any item

humble tulip
#

Do all nulls point to the same thing?

#

Or does it point to nothing?

#

Oh wait

#

LOL

#

Null pointer

heady wasp
#

i fixed it

humble tulip
#

I'm stupid

hazy parrot
#

Well null is in fact pointer with address 0

#

At least in c

#

So it's probably same thing in java

tender shard
#

null is a keyword

#

how the reference works:

#

no clue lol

#

very helpful right?

#

ever seen such a fucked up project strucutre?

vale ember
#

omfg

remote swallow
#

what da fucj]

rotund ravine
#

also are you some sort of python person since you name your mainclass that

tender shard
#

that's a maven archetype

rotund ravine
#

lol

tender shard
#

__mainClass__ gets replaced with the main class name defined in the properties

tender shard
#

archetypes are probably the most useful thing in maven

#

yet nobody uses them

#

everyone generates their pom with the shitty minecraft dev plugin

wet breach
tender shard
#

thats good. you got a spigot archetype?

remote swallow
#

they

#

they should change that default

wet breach
tender shard
#

that's mine

#

it also has a GUI

#

next thing I'll add is kotlin support

rotund ravine
tender shard
remote swallow
#

you should totally add better item config when its full working

tender shard
#

sure

#

everyone can easily pull request new libraries by editing the archetype-metadata.xml

#

the GUI automatically reads that file so it's also in the GUI then

remote swallow
#

fancy

tender shard
#

oh you also gotta edit the pom.xml in archetype-resources