#help-development

1 messages · Page 377 of 1

regal scaffold
#

No spaces

#

Recommended

wary topaz
#

NamespacedKey key = new NamespacedKey(this, "Revive Token")
ShapedRecipe recipe = new ShapedRecipe(key, reviveToken());

#

oh

lost matrix
#

The namespace is your plugin and the key is something you imagined.
It has to be all lower case and can not contain spaces

regal scaffold
#

But close

wary topaz
#

ReviveToken

#

revivetoken

quasi flint
regal scaffold
#

I'm actually not sure if it does

wary topaz
#

i think it errors

regal scaffold
#

bUT

lost matrix
#
NamespacedKey key = new NamespacedKey(yourPluginInstance, "revive-token");
regal scaffold
#

There's a correct case for it

#

There

#

fk u smile

#

0-2

wet breach
wary topaz
#

Cannot resolve constructor 'NamespacedKey(everything, String)'

regal scaffold
#

Impor

lost matrix
wary topaz
#
        ShapedRecipe recipe = new ShapedRecipe(key,reviveToken());```
regal scaffold
#

t

wary topaz
#

the reviveToken is the itemstack

#

dw bout htat

regal scaffold
#

Did you import?

lost matrix
wary topaz
#

Ah

quasi flint
#

It needs the instance

#

Of your plugin

lost matrix
#

But dont just put this in your JavaPlugin class pls

quasi flint
#

To Register the namespace to

wet breach
#

Keyword this refers to the class the method is currently in

wary topaz
#

NamespacedKey key = new NamespacedKey(plugin,"revivetoken");

#

plugin is standed for the main class

regal scaffold
#

There you go

wary topaz
#

injection

regal scaffold
#

Except for

#

revive-token

wary topaz
#

yay me learning

quasi flint
regal scaffold
#

wat

wary topaz
#

ill load it

regal scaffold
#

smile

#

I'm gonna buy this 9 buck course lol for the memes

#

You wanna take a look at it?

wary topaz
wet breach
#

No

wary topaz
#

no errors

regal scaffold
#

Check console

wary topaz
#

ill show full file

lost matrix
wary topaz
regal scaffold
wary topaz
#

lines 42-45

regal scaffold
#

remember when we specifically said

wary topaz
#

not 45

#

44

regal scaffold
#

"don't just put this in your main class plz"

#

xd

wary topaz
#

its not my main class

regal scaffold
#

Oh yeah

wary topaz
#

import SpeedSMP.everything.everything;
import org.bukkit.event.Listener;
import org.bukkit.plugin.java.JavaPlugin;

public final class Main extends JavaPlugin implements Listener{

    @Override
    public void onEnable() {
        // Plugin startup logic
        saveDefaultConfig();
        new everything(this);
    }

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

this is my main class

#

and dw about main name

regal scaffold
#

lol

wary topaz
#

ill fix later

regal scaffold
#

Ok I want to clarify ethan

#

When people say

#

Don't put eveything in your main class

#

They mean, split stuff into different files

#

Not make a new file and put everything there

wary topaz
#

this plugin is made for 1 person

lost matrix
regal scaffold
#

Just for the future

wary topaz
#

it doesnt matter

#

but koay

#

thanks for the advice lol

wet breach
wary topaz
#

its like a lifesteal plugin but instead of hearts its speed

regal scaffold
#

What category

lost matrix
#

Final Advice

regal scaffold
#

Oh the last one

#

It's lit 9 bucks I got you

wary topaz
#

lmfao

lost matrix
regal scaffold
#

I wanna give it a look too

wary topaz
#

but any idea why it aint working?

regal scaffold
#

I have a plugin that does that 1 sec ethan

wet breach
#

Best advice for managing sales. Dont ignore your clients and learn paypal policies in regards to chargebacks which will help you to respond to them and not have paypal side with consumer

wary topaz
#

also i know this may be basic java but everything i tried aint fixing this

regal scaffold
#
    private void unregisterCrafting() {
        Iterator<Recipe> iter = Bukkit.recipeIterator();
        while (iter.hasNext()) {
            Recipe recipe = iter.next();
            if (recipe.getResult().getType() == Material.COPPER_BLOCK) {
                NamespacedKey key = new NamespacedKey(this, "copper_block");
                ItemStack copperBlock = new ItemStack(Material.WAXED_COPPER_BLOCK);
                ShapedRecipe copperBlockRecipe = new ShapedRecipe(key, copperBlock);
                copperBlockRecipe.shape("CCC", "CCC", "CCC");
                copperBlockRecipe.setIngredient('C', Material.COPPER_INGOT);
                Bukkit.addRecipe(copperBlockRecipe);
                iter.remove();
            }
            if (recipe.getResult().getType().name().contains("BED")) {
                iter.remove();
            }
        }
    }
wary topaz
#

i only want 1 decimal point

#

oo ill look at that

regal scaffold
#

I did that when I wanted to remove some recipes

#

And add a new one

#
                NamespacedKey key = new NamespacedKey(this, "copper_block");
                ItemStack copperBlock = new ItemStack(Material.WAXED_COPPER_BLOCK);
                ShapedRecipe copperBlockRecipe = new ShapedRecipe(key, copperBlock);
                copperBlockRecipe.shape("CCC", "CCC", "CCC");
                copperBlockRecipe.setIngredient('C', Material.COPPER_INGOT);
                Bukkit.addRecipe(copperBlockRecipe);
wary topaz
#

I dont see anything different to this than mine

regal scaffold
#

new RecipeChoice.ExactChoice(speedCapsule())

#

What is that

wary topaz
#

ill get the line number

#

113

regal scaffold
#

I know what the line is. What is it

wary topaz
#

when drank

#

gives

#

0.05 speed

regal scaffold
#

That a custom item?

wary topaz
#

yse

#

kindof

regal scaffold
#

You're gonna need someone with more experience to help you then

wary topaz
#

line 130

regal scaffold
#

Wait for smile or frost

wary topaz
#

okay

#

hope i dont have to use nms lol

wet breach
#

What we doing?

lost matrix
#

Was about to ask

regal scaffold
#

Crafting recipe with custom item

#

        NamespacedKey key = new NamespacedKey(plugin,"revivetoken");
        ShapedRecipe recipe = new ShapedRecipe(key,reviveToken());
        recipe.shape("ABA","B B","ABA");

        recipe.setIngredient('A',new RecipeChoice.ExactChoice(speedCapsule()));
        recipe.setIngredient('B',Material.DIAMOND);
#

line 5

wet breach
#

Nothing to it other then replacing output with custom item instead

lost matrix
#

No you dont

regal scaffold
#

That didn't work tho

wary topaz
#

the output is also a custom item

#

and one of the inputs is

#

they are all itemstacks besides the diamond

lost matrix
#

Some more code pls

wary topaz
#

thats all the code

lost matrix
#

The code on top looks right

regal scaffold
#

That's his class

lost matrix
#

Ah i see

regal scaffold
#

Smile do you only want the plugin licensing

#

Or the entire final advice

wet breach
#

Pretty sure they know plugin licensing lol

regal scaffold
#

Forst we understand. We're just evaluating how it looks

#

If you don't need it I won't send it to you

wet breach
#

I would be surprised with someone like 7smile7 knowing what they do and not know licensing lmao

regal scaffold
#

But there's about 19 hours of videos

#

In this course

vocal cloud
#

Most of it is self evident stuff

lost matrix
wet breach
wary topaz
#

I'll reload again.

lost matrix
wary topaz
#

Nope.

lost matrix
#

Never

wary topaz
#

?

vocal cloud
wary topaz
#

i'll restart;-;

lost matrix
#

always restart

wary topaz
#

takes a while loll

#

no errors

lost matrix
regal scaffold
#

Alright boys I'm heading to bed. 4am. Have a good one see you tomororw

lost matrix
wary topaz
#

green

wet breach
#

Maybe i should make my own udemy course for jvm intricacies and how it can relate to your code

regal scaffold
#

Make an advanced one

vocal cloud
#

Ikr look how many sales that one has

#

It's just teaching you basic java under the guise of Spigot

regal scaffold
#

Making a course that big is still very time consming

#

It's over 18 hours of 1080p video

vocal cloud
#

Quality > Quantity

wary topaz
#

Quandaledingle

vocal cloud
#

I 100% bet you I could make a wiki that would have less quantity but 100% more quality. It's of course easier and better to just sell this stuff

lost matrix
# wary topaz

Use sticks instead of your custom items and try the recipe again

wary topaz
#

aight

wet breach
#

Like for instance the amount of objects in a class or the size of objects cab cause your class to not be inside heap space and instead fragmented between heap and some other slower memory space and this be the source of your lag or why your code isnt performing as expected. There is only two ways to fix this. From user side increase object space per thread which means more ram consumed on thread generation or restructure your code to not have this happen

wary topaz
#

recipe.setIngredient('A',Material.STICK);
recipe.setIngredient('B',Material.DIAMOND);

lost matrix
halcyon hemlock
#

wsg guys

vocal cloud
#

I'm listening

wet breach
lost matrix
#

You sure

wary topaz
wet breach
#

Where you already pretty versed but just not might be aware of some things like that

wary topaz
#

no errors

#

ill try changing the recipe

halcyon hemlock
wary topaz
#

yep

halcyon hemlock
#

123
456
789

lost matrix
# wary topaz

Did you actually compile and copy your newly compiled plugin in your plugins folder?

wary topaz
#

yes

lost matrix
#

Change the result item to a simple vanilla item as well then

wary topaz
#

alr

#

let me make a vanilla itemstack

halcyon hemlock
#

make sure

lost matrix
wary topaz
#

@halcyon hemlock wdym

wet breach
# lost matrix You sure

You seem pretty well versed in regards to java coding wise then most. And only thing i could recommend for such people is learning jvm things that adversely affects your code but isnt really widely known or isnt really a easily searchable thing to learn unless you knew something beforw hand

regal scaffold
lost matrix
wary topaz
#

omg

halcyon hemlock
#

LMAO

wary topaz
#

it worked

regal scaffold
#

XD

wary topaz
#

but it didnt owkr for the otehr one

vocal cloud
#

Drunk science over here

wary topaz
#

the other custom item

halcyon hemlock
#

ABA
B B
ABA

halcyon hemlock
wary topaz
#

new RecipeChoice.ExactChoice(speedCapsule()) seems to not work

#

and yes i did the right placement

lost matrix
wary topaz
#

yes sir

wet breach
#

What i explained is one example of a niche thing most wont really know. The other thing is, is nulling out objects you dont need anymore

wary topaz
lost matrix
wet breach
#

While in general everhthing says it isnt required they are correct but it doesnt mean you shouldnt do it either

wary topaz
#

they odnt

#

but i dont check the nbt

#

i check if unbreakable

#

soany food thats unbreakable

#

is yk

wet breach
#

The main reason for nulling out objects you know you wont use again or are just done with is it lets the gc work faster

lost matrix
wary topaz
#

cause i add the number every time

#

its set in config.yml

#

because

#

i dont want it to stack

lost matrix
#

RecipeChoice.ExactChoice checks the whole nbt component

wary topaz
#

and theres no .setStackable

#

wait

#

WAIT

#

let me try something

wet breach
#

Instead of the gc trying to figure if it should or shouldnt gc something nulling out your objects just saves time on the gc doing that uwu

wary topaz
#

how can I make a item not stackable than?

lost matrix
wet breach
#

Make it unique

wary topaz
#

yes

#

but it checks

#

for exact nbt

lost matrix
#

If the nbt data does not match 100% then the recipe doesnt work

wary topaz
#

^

#

so how can I detect

#

with my settings

#

or should I just figure out how to make it unstackable

#

and revert my progresws

#

and someone said to do that I need nms

#

wait what?

wet breach
#

You might be progressing into the area where you have to implement your own recipe stuff. Like instead of the server validating the recipe for you. You would do that yourself. Which requires more work on your part

wary topaz
#

wdym

lost matrix
#

This is a very intricate problem.
You have 2 choices:

  1. Write a custom crafting system which checks for specific item
    properties. (Pretty complicated)
  2. Fetch the outgoing ItemStack packets and add lore lines in them (Very complicated)
wary topaz
#

@quaint mantle you say I can make it unstackable easily?

#

which could solve everything?

lost matrix
wet breach
#

You can listen for crafting inputs and validate yourself if what was put in is correct. You dont have to use the api for that. The advantage is you can basically use any item even if they dont match exactly because you said it is allowed

wary topaz
#

The problom with it being stackable is it takes the entire thing when consumed

wet breach
#

The disasvantage is a lot more code lol

wary topaz
#

I tried that

#

it just didnt do anything

lost matrix
#

Try harder 😄

wary topaz
#

yes sir

wet breach
lost matrix
#

That one is not too complicated actually. You just need to find out when to cancel the event and when to manually subtract items.

wet breach
#

If you can obtain the count and item, then you know how many needs to go back in their invebtory

lost matrix
#

Cancelling the consume event and decrementing the consumed item should work as well

wary topaz
#

i cancelled it before

wet breach
#

Yeah that works too

wary topaz
#

but icant subtract

wet breach
#

The way i explained doesnt require cancelling anything

#

So use which ever way you prefer

wary topaz
#

p.getinventory().remove(speedcapsule, (event.getItem().getAmount() -1))

wet breach
#

Instead of removing add

wary topaz
#

add

#

whoa

lost matrix
#

ItemStack item = event.getItem()
item.setAmount(item.getAmount() - 1)

#

something like that

wary topaz
#

ill be back when I finish

wet breach
#

Let the items get consumed keep track of what they had or what was required and instead you add to the onventory

#

For the way i am talking about

wary topaz
#

you cant add or remove a specific amount?

lost matrix
#

Well this could result in the item being added at the beginning of the Inventory

lost matrix
wary topaz
#

yse

wet breach
#

I am aware

wary topaz
#

hehe

#

yes but the add doesnt have a int?

lost matrix
#

Then i would strongly recommend this:

  @EventHandler
  public void onConsumer(PlayerItemConsumeEvent event) {
    event.setCancelled(true);
    ItemStack consumedItem = event.getItem();
    consumedItem.setAmount(consumedItem.getAmount() - 1);
  }
wary topaz
#

setamount!

#

thats what I needed!

#

loading the plugin

#

0 warnings

wet breach
#

My way i explained to use an analogy is if you owe me $10. But instead you gave me $20. All i have to do is give you $10 back. I didnt subtract anything because you gave me all what you had. If that makes sense. So in regards to what i was saying. If all the items are being consumed just allow it, but you return however many was too much. This isnt really subtraction per say lol

wary topaz
#

uhh it did not take the item

lost matrix
#

This one is also viable but you cant target a specific ItemStack in your inv. Besides that, the result is the same

  @EventHandler
  public void onConsumer(PlayerItemConsumeEvent event) {
    event.setCancelled(true);
    ItemStack consumedItem = event.getItem();
    ItemStack removalItem = consumedItem.clone();
    removalItem.setAmount(1);
    event.getPlayer().getInventory().remove(removalItem);
  }
lost matrix
wary topaz
lost matrix
lost matrix
wary topaz
#

nope

wary topaz
#

and yes ill remove the % after this

lost matrix
#

What version are you on? This only works for 1.14+ iirc

wary topaz
#

latest

wet breach
#

Add some debug messages

wary topaz
#

alr

wet breach
#

So you know what is or isnt being executed

#

Peecisely

wary topaz
#
 event.setCancelled(true);
            event.getItem().setAmount(event.getItem().getAmount() - 1);
            p.sendMessage("u hungy?");
lost matrix
#

Well the message after the removal line gets sent so something is weird here

wary topaz
#

im guessing he aint hungy

wet breach
#

Lol

lost matrix
#

Hm... Delay it by one tick

quaint mantle
#

hi

wary topaz
#

uhh you mean like scheduler?

quaint mantle
#

im beginner programmer

wary topaz
#

hi

#

welcome to paridise

#

no errors ever

wet breach
#

You could also just manually consume the item too

wary topaz
#

the problom with taht

#

the glass

#

glass bottle

lost matrix
wet breach
quaint mantle
wary topaz
#

I dont

lost matrix
wary topaz
#

precious we dnot spoonfeed

wet breach
#

You cancel the event then and then remove item and apply effects

wary topaz
#

7smile did you delay?

#

doesnt look like you did

lost matrix
wary topaz
#

oh

quaint mantle
wary topaz
#

default?

wet breach
#

?spoon

undone axleBOT
#

Spoonfeed a newbie for a day and they'll come back with more questions. Teach them to find their own answers and you'll both be better off: you won't get stuck answering the easy questions and they'll be much more productive than before.

lost matrix
#

Yes tasks run earliest at the next tick

wary topaz
#

nope

wet breach
#

Couldnt you just manually do it? Lol

lost matrix
#

Let me try it out myself...

wary topaz
#

frost but what if the player has glass bottles already in their inv?

#

7smile need the main class again?

wet breach
#

Cancelling the event stops it

wary topaz
#

but wdym manually than?

wet breach
#

So what you do is cancel the event when they drink potion. It doesnt stop the animation but it does stop the glass bottle problem

wary topaz
#

but than they dont drink it?

#

it just loops

#

its like lag but intentional

wet breach
#

After cancelling you remove potion from inventory and then you apply the effects it is suppose to have

wary topaz
#

what if it's in their offhand?

#

how would I know what to remove?

wet breach
#

You can detect that because its still inventory

wary topaz
#

what if they have multible :hehe:

wet breach
#

Just because you cancel the event doesnt mean you cant use the event to get what is in their hand

#

Event doesnt stop being useful just because you invoked cancel

wary topaz
#

But how would the event know what to remove if we cancel?

#

7smile you almost done with that test?

wet breach
#

Because you use it to get where item is at and then you use inventory api or player api to remove the item from the proper slot

wary topaz
#

And the exact amount?

wet breach
#

Sure

wary topaz
#

What api should I use

#

or they same

wet breach
#

Probably inventory api as it would have the methods you are in need of including subtracting and removinf

wary topaz
#

^

lost matrix
#

This works

#
  @EventHandler
  public void onConsumer(PlayerItemConsumeEvent event) {
    event.setCancelled(true);
    ItemStack equippedItem = event.getPlayer().getInventory().getItem(event.getHand());
    equippedItem.setAmount(equippedItem.getAmount() - 1);
  }
wary topaz
#

alr gimmie a min

#

wait

#

try honey bottles

#

or did you edit the code

lost matrix
#

Honey works as well

wet breach
#

7smile7 gave you the code uwu

wary topaz
#

😮

wet breach
#

I am at work currently and on a phone lol

#

So hard to just do up some code

lost matrix
#

What are you working and why do you have so much spigot time 😄

wary topaz
#

Method invocation 'setAmount' may produce 'NullPointerException'
would you be mad if I put not null 🙂

wet breach
wary topaz
#

its just nullable

wet breach
#

And i work for jbhunt and i dont habe much work tonight lmao

wary topaz
#

It worked!

wet breach
#

Dont use notnull for things that can become null outside of your control

wary topaz
#

Ah

#

yeah I hate memory leaks

wet breach
#

Its not a memory leak

wary topaz
#

wait what?

wet breach
#

It will throw errors if it is bull but hide that it is because something else made it null

wary topaz
#

but a player can just spam it and it could clog the server/

#

ohh

lost matrix
wary topaz
#

ima try to find some bugs

wet breach
#

Notnull is for if you ensured it cant be null and if it is something very terrible happened in the jvm and we should just stop anyways

wary topaz
#

like assert?

#

i feel they are the same thing lol

#

assert & not null

wet breach
#

Assert is kind of the same but slightly different. Both have differing uses where they are supposed to be used

wary topaz
#

ah

#

well tysm for the help!

#

you deserve discord helper role

#

you too 7smile7'

#

its 2 41 here so i'm gonna call it a day

#

have a good one

wet breach
#

So i stick to freelancing

#

I have had some decent freelance jobs before. I at one point sub contracted with phoenixNAP

#

For their customers where their contract prevented them from providing support

lost matrix
#

oof

wet breach
#

So like ovh for example. Servers are cheap because no software support

wary topaz
#

ah shoot we back at it again I was doing a bug check and

wet breach
#

Many dont know os is still software so it includes that too

lost matrix
regal scaffold
#

Bro you guys are still going with the crafting stuff

wet breach
#

Well phoenixnap had contracts like that, and where i came in is instead of their customer support saying we cant help they referred their customers to me instead

wary topaz
#

tomisan spigot is for nolifers only

wet breach
#

And i got to charge my own rates

lost matrix
#

well im off to the gym now, see ya guys

wary topaz
#

cya

wet breach
#

Cya later

wary topaz
#

yk what i dont care if theres glass bottles in the crafting grid

#

no plugin is perfect

wet breach
#

Lol

#

I will be home in like 5 hours 🙂

wary topaz
#

AND IM BACK AGAIN 😉

#

the the revive token

#

it can craft becaons

#

beacons

#

how can I make it specificly NOT craft beacons

#

(im addicted to spigot)

#

the way you can tell this is a revive token is because of the unbreakable tag

#

ping me while im sleeping

#

idc

tall dragon
# wary topaz

cancel CraftItemEvent when the crafting inventory contains ur custom item i guess

tender shard
#

intelliJ drunk? how does List<T> clash with List<T>

tall dragon
tender shard
#

yeah

#

what is the difference between List<Invention> and List<Invention>

wet breach
hybrid spoke
#

type erasure

tender shard
#

guys

hybrid spoke
#

so you gotta be explicit

tender shard
#

I got an interface that declares getInventions() returns List<Invention>

#

so how can the above thing be wrong lol

wet breach
#

I cant see what you are returning

#

Its hidden by that big message

hybrid spoke
#

List.of doesnt return List<Invention>

#

at least not in the first place

#

type erasure fucks things up just like this

#

so your return has to be explicit or your class generic

wet breach
#

In order for a method to be a valid overiddeb method you have to return the same kind of object as well

#

Otherwise if you dont you get a method clash from your inplements

#

Godcipher knows what they are talking about and my phone is just hating me with all these spelling mistakes

#

Think i need to recalibrate the touch lmao

tender shard
#

You are both confused, if the method body would be the problem, intellij wouldn place the red underlinings there instead of under the method return type

#

Btw File -> Invalidate Caches fixed it

wet breach
#

Well i couldnt see what you were returning

#

I stated as such

#

A big box over your method isnt helpful sometimes lol

hybrid spoke
#

and still is that one of the annoying issues with generics

tender shard
hybrid spoke
#

you were asking why it complains if both are the same

#

we couldnt see it

#

"trust me bro"

tender shard
#

if intellij already complains about the red part, the green part is completely irrelevant

#

it complained that "List<Invention>" is not the same as "List<Invention>" declared in the "Inventor" interface, although it was

hybrid spoke
#

then i understood that wrong

regal scaffold
#

If I have an event that's getting called twice each time when it shouldn't

hybrid spoke
#

but what kind of plugin will this be

#

InventorOfTheWalkieTalkie

regal scaffold
#

How can I make my eventlistener pause for less than a second so the second one doesn't do anything

hybrid spoke
#

what event is it

regal scaffold
#

Dumb third party event

#

DonationReceivedEvent1

#

From crafting store

#

Getting called twice identically each time

jagged monolith
tender shard
# hybrid spoke but what kind of plugin will this be

it's not a plugin, I tried to turn a simpsons episode into some code lol. and they were talking about the inventor of the walkie talkie and were confused because he attended a convention with a girl who's not his wife

regal scaffold
#

Not a player tho

#

I mean I guess I can attach it to a player

#

Aren't events processed async?

tender shard
# wary topaz

just cancel the CraftItemEvent if any of the items in your crafting matrix is your custom item.

    public boolean isMyItem(@Nullable ItemStack item) {
        if(item == null) return false;
        if(item.getType() != Material.NETHER_STAR);
        if(!item.hasItemMeta()) return false;
        ItemMeta meta = item.getItemMeta();
        return meta.isUnbreakable();
    }
    
    @EventHandler
    public void onCraft(CraftItemEvent event) {
        for(ItemStack item : event.getInventory().getMatrix()) {
            if(isMyItem(item)) {
                event.setCancelled(true);
                return;
            }
        }
    }
hybrid spoke
regal scaffold
#

Yeah I just noticed for a second I thought it was a spigot method

wet breach
# tender shard but why would it matter

Because you have to return same object type as the super does otherwise its not a method you are overriding. I was going based on what godcipher said as i assumed they knew what it was you were returning. Sometimes not important in what exactly the message says but what the code looks like and i just couldnt see that because of you big message box

hybrid spoke
tender shard
#

by giving the correct groupid, artifactid and version

regal scaffold
#

What if I make this event run in a separate thread and pause it for 10 ticks

wet breach
tender shard
regal scaffold
#

Whatever I'll just use the `triggeredRecently

tender shard
#

obviously it is the same as the super class, that is even written in the message I sent

wet breach
tender shard
wet breach
#

Ides are not always smart

tender shard
#

yeah

#

intellij actually seems to be stupid quite often

hybrid spoke
tender shard
#

but it wasnt

wet breach
#

All i am saying is i just couldnt see your code exactly is all. I trust what i see from the code not what the ide wants to tell me lmao

hybrid spoke
#

anyways guys topic is over

#

next

wet breach
#

Indeed

#

In other news its boring tonight at my work

#

Like 2 trucks out of 200 needed tires

#

Still have 3.5 hours left of work

tall dragon
#

so ur out of work? haha

wet breach
#

Well no, there is trailers but trailers are not todays schedule

#

Those are tomorrow

tall dragon
#

cant u just work ahead then?

wet breach
wet breach
tall dragon
#

ah right

wet breach
#

And i rather not bring a trailer in for tires and then turns out it needs 10 other things done

tall dragon
#

there is always work

#

at least i have not yet found a day where i had nothing to do in the 3 years ive worked here

wet breach
#

Doesnt help i have a crap ton of truck tires right now with no trucks to put them on lmao

#

Tire container is full so i have like 5 stacks of tires just sitting in the tire bay because no where to put them

tender shard
#

time to annoy myself again:

wet breach
#

I have approximately 200 truck tires and 100 or so trailer tires

tall dragon
#

Thatsss alot of tires

wet breach
#

Trailer tires will get used up quick bit with no trucks needing tires its going to take like a week of waiting for trucks needing tires

tender shard
#

fuck obs

regal scaffold
#

btw yes I'm aware this is spigot but how does this look

remote swallow
#

Its dumb

regal scaffold
#

Isn't that like if you "forked" paper but easier?

remote swallow
#

It broke q load of spigot plugins

tender shard
#

is it normal that the "update dependencies" button in intellij doesn't do anything when using gradle?

regal scaffold
#

Alex it's like day 3 of these gradle issues

#

I think gradle knows you're the maven master and doesn't want to work with you

tender shard
#

I convert a different project every day

#

none of which has properly worked so far, though

regal scaffold
#

Somehow gradle gives you issues every day lol

#

And somehow, different issues. which is crazy

tender shard
#

not only me, everyone got the same stupid issues. however this is an intellij problem

regal scaffold
#

this why maven good

tender shard
#

obviously maven is better

regal scaffold
#

ebic would disagree

tender shard
#

oh he actually knows it's true, after all he probably knows how much hours he wasted converting maven projects to gradle, probably taken him 5 hours of his time, while saving 37 seconds

regal scaffold
#

It'll pay off in around...

#

2 years

tender shard
#

not even then, gradle has meanwhile received an upgrade and now your build.gradle isn't compatible anymore

regal scaffold
#

What project you working on rn alex

tender shard
#

MorePersistentDataTypes

regal scaffold
#

What you adding to it

tender shard
#

a build.gradle lol

regal scaffold
#

bruh lol

tender shard
#

unfortunately gradle init always gets rid of the proper repo to publish to

remote swallow
#

Give me like 6 days and ill pr it

tender shard
#

I have added it like in their docs, but the task doesnt even exist

remote swallow
#

Your missing the other publication stuff, and login

tender shard
remote swallow
#

Look at epic spigot lib or better item config

tender shard
#

EpicPluginLib doesnt declare any publishing stuff

#

but it also wouldnt be needed since it uses maven

#

and EpicSpigotLib, i didnt find anywhere

#

what the fucking hell

#

ALL OF THIS is required to make gradle upload a tiny .jar?

#

lol

remote swallow
#

That is for 2 repos

tender shard
#

however how is this different from what I sent? except that you also declared the username / password

remote swallow
#

It has the shadow(MavenPublush)...

tender shard
#

I do not want to publish any shadow stuff

#

just the normal .jar that gradle outputs

remote swallow
#

So get the non shadow stuff from maven publish

tender shard
#

I did

tender shard
#

just like the docs say

remote swallow
#

You need the publish stuff

#

Ill go find

tender shard
#

the publishing { } section

remote swallow
#

Dont need version, groupid or artifact id

#

Then put the maven section under the from components.java

tender shard
remote swallow
#

Googling maven publish and opening the first pink

#

Link

tender shard
#

cant you just send the actual link pls lol

tender shard
tender shard
#

which I don't want to

remote swallow
#

You dont need that

#

Like I said

#

YOu need the rest of the stuff

tender shard
#

still doesnt work

remote swallow
#

Just call punlish

#

Publish

tender shard
remote swallow
#

Use publish and see if it works

tender shard
#

like, if the docs call it "PublishToMavenRepository" and the actual name is "publish", then "build" could as well be "eatDogShit"

#

nope:

remote swallow
#

If it doesnt leave gradle alone and ill pr it when im home

tender shard
#
Execution failed for task ':publishMavenPublicationToJeff-media-publicRepository'.
> Cannot convert URL 'https://hub.jeff-media.com/nexus/repository/jeff-media-public/' to a file.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
#

that's when I do "gradlew publish"

remote swallow
#

Ill pr it when im home, in the mean time stop trying to convert gradle

tender shard
#

why? I am doing everything exactly as explained in the docs

remote swallow
#

The docs are wrong most of the time

tender shard
#

lmao

#

what a great piece of software 👍

wet breach
#

I understand what alex is saying lol

#

Basically they dont like the semantics of it

tender shard
#

i dont like the general idea of "you always just gotta copy/paste from someone else because the official docs are always wrong"

wet breach
#

Which i can agree. But both me and alex though are accustomed to mave and love the verbosity of it that makes it clear

tender shard
#

like, how is one supposed to know that it has to look like this:

while the docs state sth completely different

rocky tree
#
ItemStack item = new ItemStack(Material.BOOK);
ItemMeta oM = item.getItemMeta();
ItemStack iM = new ItemStack(player.getItemInHand());
if (iM.getItemMeta().getDisplayName().equals(oM.getDisplayName())) {
...
} else {
....
}

It is always false, anyone?

tender shard
#

it's only false if the display names don't match

#

o0

rocky tree
tender shard
#

btw you should not use weird variable names like iM or oM

wet breach
#

Probably if you are not accounting that displayname can have colorcodes

tender shard
rocky tree
wet breach
#

There is another method you can use to get the name that doesnt include color codes

regal scaffold
#

There aren't that many good ways to compare if the item is a custom item

#

It's a bit annoying tbh

hybrid spoke
#

simply the best way

regal scaffold
#

Well yeah I know but not that many more options

#

Names, pdc, what else

tender shard
#

yeah, comparing items by name is always a bad idea

hybrid spoke
#

lores, nbt tags

rocky tree
#

Ok work, I'd fix.
Ty

tender shard
#

PDC is the only proper solution

wet breach
#

Or just compare item objects and not strings

hybrid spoke
#

#isSimilar also an option

regal scaffold
tall dragon
tender shard
wet breach
tall dragon
#

yea debatable. but just tryna help on the issue he is having :S

rocky tree
#

Thanks

tall dragon
#

ok. but again, you shoulnt use the name of an item to make it unique or a "custom item"

#

should be using pdc tags

rocky tree
#

Okk, thanks

regal scaffold
#

Alex when's the intelliJ gui plugin coming

tender shard
#

when intellij fixes their docs that explain how to write intellij plugins

#

i once tried, the docs were of a totally outdated version

#

so obviously everything was wrong and I didnt understand anything

#

@regal scaffold maybe I found a workaround to their shitty docs

regal scaffold
#

I'm blind

tender shard
regal scaffold
#
  1. chatgtp does know the way
tender shard
#

worldguard 6?!?!

#

isn't that like 10 years old?

regal scaffold
tall dragon
regal scaffold
#

Yeah

#

How does it not work tho alex

#

Like wut

tender shard
#

just update to a still supported version of worldguard that's available in their repo

tender shard
regal scaffold
#

IntellIj is massive and actively developed

#

Plguins are made daily

tender shard
#

no clue how people do it

#

I at least am not smart enough to understand it

regal scaffold
#

What's broke about their docs?

tender shard
#

using the current docs, that is

#

well, the first thing is how to even add a new wizard type. Couldnt find that in their docs

regal scaffold
#

Did you follow their getting started?

tender shard
#

not right now, right now I only used the builtin "IDE plugin" project template

regal scaffold
#

I read somewhere that was deprecated

#

They

#

"removed" it a while ago

tender shard
#

however I dont see ANY tutorial in this "quick start guide"

tender shard
#

it tells about the general structure about a plugin etc, but not really any example on how to setup the workspace

regal scaffold
tender shard
#

the class that chatgpt mentioned definitely doesnt exist anymore

#

i could ofc check the source code of the minecraft development plugin but I would rather see it explained in the official docs

#

also why the heck do people call it a "requirement" when it's optional

#

I am now trying to extend "ModuleType" as per the IJ docs but already stuck there.

tall dragon
tender shard
#

all they say is I should "derive" my custom module type from the existing class, giving no information about where I should obtain e.g. the builder from that I am supposed to return from that class. do I write that myself? can I use any existing one?

tender shard
#

from what is explained in the docs, this should be enough for a IJ ModuleType. I highly doubt it's true

#

fun fact: intellij plugins must not contain the name "plugin"

#

which is a bit weird because this plugin's only purpose is to create spigot plugins, so obviously it wants to have "plugin" in its name

tender shard
#

@regal scaffold if you know anything about IJ plugins, pls enlighten me. I have added exactly what the docs say, which is I created a custom ModuleType as seen above, and I added my moduletype to my plugin.xml. Still, when doing "new project", nothing's there

regal scaffold
#

I know a bit but I can't right now cause I'm trying to do something odd

#

I'm trying to fork CraftingStore to add an event that I need but I reached a point where if I add my method to their interface I need to create the methods for all 4 of their versions cause they have them separated....

#

So idk what to do

tender shard
#

most plugins from that list don't even have a plugin.xml file o0

#

for real, how does one learn to do intellij plugins when every existing information about it is outdated

#

I just wanna know how other people managed to learn it without proper sources of documentation

twin cliff
#

Hi all, It's been years since I was doing any kind of plugin development.

Does anyone know a good template I can pull to start?

tender shard
#

wtf is wrong with kotlin

#

the arrayOf method seems to be one of the funniest things ever, wtf is that

vocal cloud
#

Kotlin was a mess made to fix a mess

hazy parrot
#

Doest sponge inherit module wizard thingy

tender shard
hazy parrot
#

I assume so, you can probably just cast that

#

Dk why it's erroring in ide, fully valid code lol

tender shard
#

nope

#

it's kotlin

#

e.g. this:

#

e: file:///Users/mfnalex/IdeaProjects/MinecraftDev/src/main/kotlin/creator/MinecraftModuleBuilder.kt:123:17 Type mismatch: inferred type is Array<BuildSystemWizardStep> but Array<ModuleWizardStep> was expected

#

it's just kotlin being stupid again

#

and that's what happens everyone when you think "consiseness" is more important than declaring the proper types lmao

twin cliff
hazy parrot
#

working for me

#

well, if you do it like you do its not, you have to cast

#

lmao funny

undone axleBOT
wet breach
wet breach
#

Not saying that is easy or even ideal

tender shard
#

typical kotlin bullshit

wet breach
#

Love the infinite screens

hazy parrot
#

alright, i admit this is stupid

tender shard
#

weirdest thing I've seen today lol

#

I also still don't understand how to create a new intellij project wizard

#

I followed their tutorial 1:1 and it just shows this instead of my custom label.

hazy parrot
#

well, its same in java

twin cliff
#

InventoryMoveEvent seems good, does anyone know if this also handles things like,

  • Player add Item
  • Player remove Item
  • Player break Chest (Moves to world)
  • Player drags item out of chest (Moves to world)
hazy parrot
#

to silent cast it

tender shard
#

works fine for me

hazy parrot
#

its generic type issue

tender shard
#

if that'd be the problem, then why does it get fixed by adding more objects to arrayOf

hazy parrot
#

because kotlin decides type under the hood if you didn't specify it explicitly

tender shard
#

funny lol

hazy parrot
#

if you have just 1 type, it will assume that supertype

tender shard
#

yeah explains it, typical kotlin bullshittery

#

also thanks for this totally useful error message intellij

#

yay, only took like 3 hours

#

another nice error message

#

Today I really hate IJ + gradle

#

another reason why IJ is a bad joke

#

anybode knows the awt equivalent of swing's JFrame?

#

oh I'm stupid, I meant a JPanel

tender shard
#

only been 29 hours so far lol

chrome beacon
#

Gradle speed

analog thicket
#

Hey, how would i go about making animated armorstands?

eternal oxide
#

Do you know Java?

halcyon hemlock
#

I'm not sure

analog thicket
eternal oxide
#

then you need to decide what type of animation you want

#

just the stand itself, or a set of stands

analog thicket
#

Probally more than one

#

But ill start off with one

eternal oxide
#

what kind of animation do you want? just move teh stand around? or move it's arms etc?

analog thicket
#

Move stand around, wanna make a crate animation when opening it.

#

But probally gonna move arms too

#

I know how to move the body parts, but not the whole armorstand

eternal oxide
#

ok, well moving is not hard, it's simply a case of deciding where you are moving to and progressively teleport teh stand in small increments over time

#

If you are using the normal scheduler and teleporting you can do 20 animations per second.

#

if you need a higher rate than that it's a little more complex as you need to use packets

analog thicket
#

All this works for 1.8.9?

eternal oxide
#

probably but you'll not get 1.8 specific support here

small hawk
#

Anyone have nice Color Util for Components, to easily transform HEX colors and more?

analog thicket
tender shard
#

finally

final monolith
#

Hey guys, trying to install a dependency on my pom.xml but gets an error.

mvn install:install-file –Dfile=Downloads\FILE.jar -DgroupId=group -DartifactId=artifact -Dversion=version -Dpackaging=jar

Error:
The parameters 'file' for goal org.apache.maven.plugins:maven-install-plugin:2.4:install-file are missing or invalid

#

--
org.apache.maven.plugin.prefix.NoPluginFoundForPrefixException: No plugin found for prefix '–Dfile=C' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (C:\Users\Laivy\.m2\repository), central (https://repo.maven.apache.org/maven2)]

eternal oxide
#

you didn't fill in any of the required parameters to install a jar to your local repo

#

file name, group, artifact, version

final monolith
#

i filled, i just changed the values to give an example

spare prism
#

?paste

undone axleBOT
eternal oxide
#

can't help you with "examples"

final monolith
#

sorry

#

i tried with mvn install:install-file –Dfile=Downloads\oraxen-1.152.0.jar -DgroupId=com.oraxen -DartifactId=oraxen -Dversion=1.152.0 -Dpackaging=jar -X

tender shard
#

another person who has to install oraxen manually because their uploading to repo is still broken :X

final monolith
#

xD

spare prism
tender shard
#

the command looks correct

tender shard
tender shard
#

or are you using an obfuscator or anything

spare prism
final monolith
#

and try again

tender shard
#

are you not using maven? o0

spare prism
tender shard
#

then make IJ run mvn clean before package

spare prism
spare prism
final monolith
tender shard
#

where it says "mvn package", change it to "mvn clean package"

chrome beacon
#

You're building an artifact rather than using maven to build the jar

#

Which probably means the new plugin jar isn't placed in the plugins folder

chrome beacon
#

Use maven to build your jar rather than that artifact

final monolith
#

xD

tender shard
#

what was the issue

final monolith
#

it gives me a fixed command mvn install:install-file -Dfile=libraries/oraxen-1.152.0.jar -DgroupId=com.oraxen -DartifactId=oraxen -Dversion=1.152.0 -Dpackaging=jar -X

#

apparently its the \, needs to change to /

tender shard
#

oh I see the problem

#

you used the wrong hyphen

final monolith
#

xD

tender shard
#

see how it's not highlightig the "-" in front of -Dfile

spare prism
#

nothing changed

#

I get the same stacktrace

chrome beacon
#

Don't use that run config to start the server

spare prism
chrome beacon
#

and delete the old plugin jar and make sure the server is stopped

#

when building with maven

tender shard
#

yeah try again, see if the stacktrace changed

#

btw how do you copy the file to the server dir?

#

did you do that in your maven-jar-plugin declaration?

spare prism
spare prism
tender shard
#

you let intelliJ run the spigot server but you manually copy the file? o0

#

that's a weird workflow

spare prism
#

when I tried to do that using Maven Build directly

#

I copied it manually

#

but normally I just let IntelliJ build the artifact directly there

#

and run the server

#

automatically

tender shard
#

?paste your pom pls

undone axleBOT
spare prism
tender shard
#

btw you can also make maven save the file in your plugins folder

chrome beacon
#

tbh I still think he's copy pasting the same old jar every time

tender shard
#

I also think that

spare prism
#

I can even try decompiling the plugin that is currently on the server

#

lol

tender shard
#

sure

#

or just add some debug message to your onenable

chrome beacon
#

also make sure you don't have two jars of your plugin in the plugins folder

spare prism
spare prism
chrome beacon
#

Send the new stacktrace

#

also add a debug message like mfnalex said

spare prism
chrome beacon
#

Send it

#

anyway

spare prism
#

k

tender shard
#

I mean, the line number MUST change if you add a new line to the code

chrome beacon
#

So the error is comming from ChunkBlockPlaceRestrict

tender shard
#

oh right lol

spare prism
#

oh

#

nvm

#

im retarted

#

XDDD

tender shard
#

it happens

spare prism
#

ty

#

guys

#

lmao

tender shard
#

definitely the most advanced CSV parser out there, EVER, lol

icy beacon
#

last time I checked this channel you were throwing hands at it because of bad docs

tender shard
#

yeah the documentation was, as always, outdated or just plain wrong

icy beacon
#

yeah I had a similar experience recently

tender shard
#

I had to look into other plugins to see how it actually works

icy beacon
#

that really sucks

tender shard
#

although I still wonder, how anyone is supposed to know how it actually works

icy beacon
tender shard
#

🥲

icy beacon
#

I remember working with a scuffed API where params would sometimes be called var1, var2 and shit

#

some methods had random names like a8M3shit

#

and it was an actual api

#

not like nms or smth

tender shard
#

fancy

#

anyone knows a good XML library for me to read custom XML files and deserialize them into my custom objects?

#

I do NOT want any "automatic serialization/deserialization" such as XStream, I wanna have control about how it works myself

#

the main thing why XStream sucks because it doesn't support any lists or anything, or at least their docs don't say anything about it

spare prism
#

Is there a way to fix that? I'm trying to convert an Object (it's a list) to a List:

                    List<String> blocks = Arrays.stream((Object[]) value)
                            .map(element -> (String) element)
                            .collect(Collectors.toList());

java.lang.ClassCastException: class java.util.HashSet cannot be cast to class [Ljava.lang.Object; (java.util.HashSet and [Ljava.lang.Object; are in module java.base of loader 'bootstrap')

Before that I have this check:

value.getClass().isArray() || value instanceof Collection
tender shard
#

if it's a list, why do you cast it to an array?

spare prism
#

otherwise

tender shard
#

you cannot cast a List to an array

spare prism
#

how do I use streams if I have an Object?

tender shard
#

please explain again which type "value" actually has

spare prism
#

Object

tender shard
#

no, what it actually is

#

not what it's declared to be

tender shard
spare prism
tender shard
#

do .getClass() on it and show the result

#

(print it out or sth)

spare prism
#

ok

spare prism
tender shard
#

just cast your object to HashSet, then you can call stream on it

spare prism
tender shard
#

yeah, although you could also just directly cast it to HashSet<String> instead of casting each element

#
List<String> blockTypes = ((HashSet<String> value).stream().collect(...)
spare prism
tender shard
#

doing .map(...), then casting every element is doing the same thing, just more complicated

#

why do you need a List anyway? Can't you just use it as Set<String>?

tender shard
#

np

feral bear
#

Hello I have a problem:

Object worldname = main.getConfig().get("warps."+message+".world");
World world = main.getServer().getWorld((String) worldname);

config.yml :

warps:
  box:
    ==: org.bukkit.Location
    world: world
    x: 9.703408588152502
    y: 65.0
    z: 10.69579578168919
    pitch: 3.3000607
    yaw: -44.550293
tender shard
#

and what's the issue?

#

also why are you saving the worldname as "Object"?

feral bear
#

Caused by: java.lang.IllegalArgumentException: Name cannot be null
at org.apache.commons.lang.Validate.notNull(Validate.java:192) ~[server.jar:3096a-Spigot-9fb885e-af1a232]
at org.bukkit.craftbukkit.v1_16_R3.CraftServer.getWorld(CraftServer.java:1139) ~[server.jar:3096a-Spigot-9fb885e-af1a232]
at be.thedrewen.yttrium.commands.commandWarp.onCommand(commandWarp.java:42) ~[?:?]
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:45) ~[server.jar:3096a-Spigot-9fb885e-af1a232]
... 19 more

hazy parrot
#

also not sure u are using correct path

tender shard
#

your config does not contain any value called "warps.<message>.world"

hazy parrot
#

if you serialized that as location, get it as location

feral bear
tender shard
#

hence it returns null

feral bear
#
@Override
    public boolean onCommand(CommandSender sender, Command cmd, String msg, String[] args) {
        
        if (sender instanceof Player) {
            
            Player player = (Player)sender;
            if (args.length == 0) {
                player.sendMessage("§6[§eYttrium§6]§4Oups...La commande est §6/warp §e{nom}");
            }
            if (args.length > 1) {
                player.sendMessage("§6[§eYttrium§6]§4Oups...Le nom du warp ne peut contenir que 1 éléments.");
            }
            if (args.length == 1) {
                
                StringBuilder message = new StringBuilder();
                for(String part : args) {
                    message.append(part);
                }
                Object worldname = main.getConfig().get("warps."+message+".world");
                World world = main.getServer().getWorld((String) worldname);
                player.sendMessage(main.getConfig().getInt("warps."+message+".y")+"");
                Location location = new Location(world, main.getConfig().getDouble("warps."+message+".x"), main.getConfig().getDouble("warps."+message+".y"), main.getConfig().getDouble("warps."+message+".z"), main.getConfig().getInt("warps."+message+".pitch"), main.getConfig().getInt("warps."+message+".yaw"));
                player.sendMessage("§6[§eYttrium§6]§e Téléportation en cours...");
                player.teleport(location);
                player.playSound(player.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1.0f, 1.0f);
                        
                
            }
            
        }
        
        return false;
    }
tender shard
#

then you throw null into "Server#getWorld(String)" so it throws an NPE

hazy parrot
#

this code is so wrong

tender shard
#

also why do you have two arguments that are both called msg/message ?

hazy parrot
#

also string builder for array lenght 1

tender shard
#

yeah that also makes little sense

feral bear
#

I am a beginner

hazy parrot
#

plus you already saved location in config

tender shard
#

the "msg" variable should be called "label"

hazy parrot
#

you can just use get() and cast it to location

tender shard
#

what's the purpose of using a StringBuilder if you already checked that your "args" has a length of 1?

#

or use getLocation()

feral bear
#

okay

tender shard
#

but that'll error out if the world is not loaded

feral bear
hazy parrot
tender shard
#
final Location myLocationFromConfig = myPlugin.getConfig().getLocation("path.under.which.i.saved.the.location");
tender shard
#

np

#

what the heck is wrong with baeldung's method naming scheme, wtf

mortal hare
tender shard
#

obviously

opal juniper
#

new Constructor OMEGALUL

tender shard
# mortal hare that's a test method

is there any rule that I missed which states that test method names must both be misleading, way too long and also violate existing naming schemes?

mortal hare
#

who cares

echo granite
mortal hare
#

they dont want to make a comment that's a sentence long

#

i guess

tender shard
#

idk I just feel that this method name hurts

mortal hare
#

you

#

are right

#

it really does

tender shard
#

I would have called it "testYamlParsingWithNestedObjects()" or sth lol

#

or "üüaaagh()"

final monolith
tender shard
#

I don't think so, for example the weird "when" prefix, or the fact they mention it's about a "JavaObject" when basically everything in java is about java objects

#

what else would it be if not a java object

#

I mean, what else would it be? a C(++) template/struct?

#

makes little to no sense to mention this specifically

#

is it normal that gradle gives no useful output even when running gradle test --full-stacktrace? o0

#

are their docs outdated on that too o0

#

is there actually ANYTHING correct in gradle's docs?

#

note: it also fails to run when my @Test method is completely empty

rapid topaz
#

I cant figure out to get the item in the main hand. How do i do this?

tender shard
#

?learnjava

undone axleBOT
tender shard
#

you already know how to get the item in main hand, it's Player#getInventory()#getItemInMainHand()