#help-development

1 messages · Page 1631 of 1

daring lark
#

can i add custom item as an ingredient to custom recipe?
ShapedRecipe magicPickaxe = new ShapedRecipe(NamespacedKey.minecraft("magicpickaxe") , item);
magicPickaxe.shape( "MMM" , " S " , " S " );

    magicPickaxe.setIngredient('M' , magicOre);
    magicPickaxe.setIngredient('S' , Material.STICK);
    Bukkit.getServer().addRecipe(magicPickaxe);

don't work.

eternal oxide
#

if you want no warnings you have to break your code up, use local variables for everything and null check anything that could be null

ivory sleet
#

It doesn’t get called in a separate file

steep nova
#

You can turn off the null warnings in intellij if you want

ivory sleet
#

It should only be invoked by spigot not directly by you

paper viper
#

Null warnings are arguably important

#

And should be handled

grim ice
#

@eternal oxide btw

paper viper
#

You shouldn’t ignore them

ivory sleet
#

Integer

grim ice
#

?paste

undone axleBOT
ivory sleet
#

Optional<Integer> @paper viper (:

grim ice
#

u think dats good

paper viper
grim ice
#

or do i need to fuck with DRY

eternal oxide
paper viper
#

But Bukkit apparently doesn’t know what Optional is

ivory sleet
#

Optional<MutableObject<MutableInt>> (:::

paper viper
#

They return -999 for invalid slot

#

Lol

grim ice
#

why tho

#

its way shorter right

ivory sleet
#

It’s still left at using the File class also

#

Lol

grim ice
#

and doesnt it do same thing

snow vector
#

Also, how would I make a function run from outside of a java file (js)

paper viper
#

are you trying to catch a NPE?

#

🤡

ivory sleet
grim ice
paper viper
#

God forbid never ever do that

ivory sleet
#

Like interoperability

grim ice
#

real clown = who gets toxic at someone who just started

paper viper
#

NEVER catch a NPE

grim ice
#

ok but why toxic

paper viper
#

I’m not

grim ice
#

just say it like normal humans

#

u r

#

bruh

paper viper
#

It’s because it’s actually bad

#

I’m not kidding

grim ice
#

Okay??

paper viper
#

Dude one emoji makes me toxic

#

Lol

grim ice
#

yes

snow vector
grim ice
#

🖕

#

am i not toxic now

snow vector
#

i have smthing setup already

grim ice
#

thats just an emoji, why r u mad?

#

thats what you are saying basically

snow vector
#

its a clone of a addon thing im upgrading

paper viper
ivory sleet
#

Pretty sure you can’t use JavaScript with Java at compile time

paper viper
#

Idc

#

xD

grim ice
#

Aaaaany ways

#

@paper viper why is catching npe bad

ivory sleet
#

GoldenStack it’s not interoperable

#

But yeah that’s possible

paper viper
#

Because in some cases it’s not catchable, it’s also much slower compared to just doing a simple check using a conditional

#

And also it’s longer (in terms of code)

grim ice
#

o

honest iron
#

BUMPPPPPP

snow vector
#

it does mostly work

grim ice
#

i have like

snow vector
#

i just need to get a boolean from java to js

grim ice
#

15 null checks to do btw

plain scroll
#

so in my item stack i use a honey bottle, is there a way to make it so when its consumed it wont give the player the bottle after?
+
Is there any way to give a player a "buff" after consuming an item??

grim ice
#

is it still longer

paper viper
#

Never ever use try and catch without knowing when to use it

steep nova
grim ice
#

ah yes

#

15 if statement

#

aaaaaa

#

is that only opiton

#

option

paper viper
#

Yes

grim ice
#

fuck sake

paper viper
#

Or you can do Objects.requireNonNull

waxen plinth
#
if () {
  if () {
    if () {
      if () {
        if () {```
paper viper
#

Or whatever

snow vector
#

so is it possible to get a boolean from java to javascript?

paper viper
#

But it throws an exception

#

If it’s null

grim ice
paper viper
#

Better to handle using conditional

ivory sleet
paper viper
#

Sure, but I doubt he knows how to use that

#

Lol

waxen plinth
#

At that point why not just use Optional.ofNullable(obj).orElse

plain scroll
#

like regen?

#

ohhh

grim ice
#

?paste

undone axleBOT
plain scroll
#

so does that need to be in an event?

#

or can it be like meta.add

paper viper
#

Also is the switch statements with instanceof checks present in Java 16 yet

#

Not the preview version

#

But normal

grim ice
honest iron
paper viper
#

It’s called WPM

#

Lol

grim ice
#

i can swear thats 900 wpm

paper viper
#

Programmers have fast wpm

#

Elgar what’s yours

#

Just wondering lol

grim ice
#

mine is like 110 with 100% accuracy

#

is that fast

eternal oxide
#

I have no idea. I type slower than I think 😛

ivory sleet
#

Yo I have 60 wpm none taken tho

paper viper
#

I’m around 120 ish

young knoll
#

Wait wait

paper viper
grim ice
#

if i focus i get

young knoll
#

requireNonNullElse is a thing?

grim ice
#

150 wpm 90 to 95 acc

ivory sleet
#

Yeah lol

grim ice
ivory sleet
#

Newer java versions (:

young knoll
#

I wish I could easily 1 line a if null return

grim ice
#

should i make private Map<NamespacedKey, ShapedRecipe> recipes = new HashMap<>();
final

young knoll
#

I guess if (object == null) return; works

grim ice
#

its 9

#

no?

snow vector
ivory sleet
hybrid spoke
#

150 wpm. shouldnt be too bad

grim ice
#

i had a friend that has 210 wpm

#

lol

young knoll
#

Why can't java just magically know I want to return if null

#

smh

paper viper
#

Because of stupid null

grim ice
#

null bad

paper viper
#

The language is structured based off that idea

#

Of null

grim ice
#

I HAVE TO GO CHECK 15 NULS

#

I HATE MY FUCKING LATE

paper viper
#

That’s why Kotlin is 99% better

grim ice
#

LIFE

paper viper
#

Null safety

young knoll
#

You could make a helper method

grim ice
#

fuck is kotlin

young knoll
#

anyNull(Object[] objects...)

grim ice
#

can

#

private Map<NamespacedKey, ShapedRecipe> recipes = new HashMap<>();

#

be

#

final

#

?

young knoll
#

yes

grim ice
#

ok pog

young knoll
paper viper
#

Depends if you gonna initialize it

#

In constructor

eternal oxide
#

its a field so he's fine

young knoll
#

I mean they initialized it in that line

#

so yeah

paper viper
#

Oh I’m dumb

#

Lol

#

I’m used to doing it in the constructor

ivory sleet
#

Technically we could have something like
class Stop extends RuntimeException {
static void ifNull(Object o) {
if (o == null) throw new Stop();
}
}

try {
Stop.ifNull(playerFromInput);
} catch (Stop stop) { return; }

Just isn’t better than catching NPE

grim ice
#

wait

#

nvm

#

daddy elgar fixed the null

#

i should add him to contributors at this point lmao

#

tbh if someone makes a helpers tier list

#

elgar would easily be at the top 10

eternal oxide
#

Shh I'm blushing

young knoll
#

That isn't how a tier list works :p

paper viper
#

🥲

grim ice
#

hes never toxic even with my dumb questions

grim ice
hybrid spoke
#

GodCipher at number 0 in that list

paper viper
#

I’m a veteran

grim ice
eternal oxide
#

Toxic in here is rare these days

grim ice
#

but elgar at number 1 probably :)

grim ice
hybrid spoke
#

or if NNY comes back

eternal oxide
#

you just troll

paper viper
#

Lmao

eternal oxide
#

oh yeah I remember

paper viper
#

Then you sent a middle finger emoji

#

And asked if you were toxic

eternal oxide
#

you toxic ass 🙂

grim ice
#

don't take it out of context

paper viper
#

It’s not out of context

#

Lol

grim ice
#

I was showing you how your logic works

#

you said clown emoji is just an emoji, so i sent u another "Emoji"

#

you should not be offended, hm?

young knoll
#

🍆

ivory sleet
#

Elgar, LuckPermsManager when? :0

paper viper
#

Clown emoji isn’t the same as a middle finger

regal anchor
#

are emojis about development ?

young knoll
#

Yes

#

New programming language, Eggplant++

ivory sleet
grim ice
#

EmojiScript

#

new best language

young knoll
#

Don’t tempt someone

#

Actually it probably exists already

paper viper
#

You can use Emojis as variable names iirc

hybrid spoke
paper viper
#

I forgot the Lang someone did it in

plain scroll
#
package me.duke.jam;

import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;

public class PlayerInteractEvent implements Listener {

    @EventHandler
    public void onPlayerInteract(org.bukkit.event.player.PlayerInteractEvent e)
    {
        
    }
}
``` << i just wrote this, what would be my like "on consume item stack thing"
young knoll
#

I want everything to be emojis

#

Even keywords

ivory sleet
#

There’s an event for that duke

plain scroll
#

what?

ivory sleet
#

PlayerConsumeItemEvent iirc

hybrid spoke
grim ice
#

is this fine

#

if(Material.matchMaterial(material) != null) {
itemStack = new ItemStack(Objects.requireNonNull(Material.matchMaterial(material)));
}

ivory sleet
#

Tho that’s only for food

plain scroll
#

OH YEA

#

LMAO

ivory sleet
#

Or eatable things

grim ice
#

i added requireNonNull to get rid of error

plain scroll
#

ty lol

young knoll
#

I mean you really should use a variable rather than running match material twice

ivory sleet
paper viper
#

Does matchMaterial use a HashMap

ivory sleet
#

Internally yes

young knoll
#

It also does some string stuff though

paper viper
#

Yeah true

young knoll
#

And it will shut up the null warning if you use a variable

ivory sleet
#

It uses Enum<T extends Enum<T>> T#valueOf(string) which uses a hashmap

plain scroll
#

ok so i use an item stack from another class... how would thi swork lol

fluid cypress
#

can i do Player == Player? or should i use .equals()?

young knoll
#

I think they are technically a singleton

ivory sleet
#

^

grim ice
#

like dis

#

Material tz = Material.matchMaterial(material);
if(tz != null) {
itemStack = new ItemStack(tz);
}

regal anchor
#

== is not for objects I think @fluid cypress

grim ice
#

ill change tz to smth else

ivory sleet
#

It’s fine for players tho

grim ice
#

but ok

fluid cypress
young knoll
#

== compares memory references

paper viper
#

Use UUID if you want to do a deep comparison tho

ivory sleet
#

A player instance is the same during its entire connection session

fluid cypress
young knoll
#

Correct

#

Also used for enums

regal anchor
young knoll
#

Internally minecraft uses it with blocks since they are all singletons

regal anchor
#

is good

ivory sleet
#

Will also work

#

But some extra method calls for no reason

young knoll
#

My cpu cycles!!!!11

ivory sleet
#

Lmao

paper viper
#

I mean it does at least work if it’s two different Player objects but one is invalid

#

Lol

grim ice
#

you guys think this will work? I think i fucked it up

            for(int i = 0; i < order.length(); i++) {
                Material matchitems = Material.matchMaterial(items[i]);
                if(matchitems != null) {
                    recipe.setIngredient(order.charAt(i), matchitems);
                }
            }```
#

i meant the variable things

#

like u got it right

regal anchor
ivory sleet
#

Awww wait logging in on spigot

paper viper
#

Learn to try it yourself

#

And debug

eternal oxide
ivory sleet
#

Okay problem is

#

You’re adding async

#

And CraftInventory and all of its derivatives are as far as I know not thread safe the slightest

regal anchor
#

no CraftInventory, no async anymore

ivory sleet
#

CraftInventory implements Inventory

austere cove
#
BigInteger bi = new BigDecimal(tokens.subtract(BigInteger.ONE))
                .multiply(BigDecimal.valueOf(0.75D + Math.min(3.25D, Math.abs(random.nextGaussian())) * (random.nextDouble() <= 0.75D ? (-0.23076923076D) : (0.07692307692D))))
                .setScale(0, RoundingMode.HALF_UP)
                .toBigIntegerExact()
                .add(BigInteger.ONE);

I love magic values

#

halp im losing my sanity

grim ice
#

` } else {
Material matchMat = Material.matchMaterial(material);
if(matchMat != null) {
itemStack = new ItemStack(matchMat);

            }
        }
        ShapedRecipe recipe = new ShapedRecipe(key, itemStack);`

this is last question iirc, how do i access itemStack outside of the else block

#

since its telling me itemStack might have not been initialized

eternal oxide
#

yes because if yoru material match is null you will never set itemStack

young knoll
#

Make sure you continue if match material is null

ivory sleet
ivory sleet
#

@regal anchor can you just paste all the classes here?

#

?paste

undone axleBOT
young knoll
#

?services

undone axleBOT
grim ice
#

hmmmmmmm

#

so it needs a default value

eternal oxide
#

as coll said, continue if null

#

if its null there is an error in the recipe

grim ice
#

yep

#

if(matchMat == null)
continue;

eternal oxide
#

yep

regal anchor
ivory sleet
#

Uh yes

#

In a moment I will

paper viper
#

Weirdo

#

GitHub better

regal anchor
#

not my decision

ivory sleet
#

Okay my name is Conclure

grim ice
#

having 1 else is fine right @ivory sleet

ivory sleet
#

In clean code it should be avoided

grim ice
#

aaa

prime mountain
#

anyone have a conversation example because the api docs do not have one and they really should

grim ice
#

i have like 1 else in my whole plugin tho

ivory sleet
#

Because an if then else statement mostly do more than one thing

#

Oo

quaint mantle
ivory sleet
#

Yeah not always

snow vector
#

https://srcb.in/iXZQduJRyk this returns org.mozilla.javascript.EvaluatorException: missing ; before statement (ChatSyncAddon.js#48)

#

i cant see the issue

grim ice
#

mozilla?

#

wtf?

grim ice
prime mountain
#

annyone... have a conversation example

snow vector
#

but im probably just blind

ivory sleet
#

Many indentation levels

#

Hex

grim ice
#

yes

quaint mantle
#

if (null) return

#

Vs

#

if (!null) { with more

grim ice
grim ice
#

thats what i do

quaint mantle
#

Either is fine

grim ice
#

o

#

tbh im happy conclure told me about implicit else

regal anchor
grim ice
#

or i wouldve fucked all my plugins lmao

ivory sleet
#

Yeah Bomp was talking about

if (x) {

} else {

}

snow vector
grim ice
#

else is really confusing

ivory sleet
#

Sometimes it’s fine Ig

paper viper
ivory sleet
#

But could/should be extracted imo

grim ice
#

i had a command with like 4 args

#

i used else in every if i had

#

oh god

paper viper
#

Conclure is the instanceof checks

#

With switch

regal anchor
paper viper
#

Do they exist in java 16

ivory sleet
#

Believe pattern matching with switches do exist in the preview

paper viper
#

Rip preview

ivory sleet
#

Ye lol

#

Math ima check

grim ice
#

not having warnings in a plugin

#

is so satisfying

#

btw

quaint mantle
#

Not having to make plugins is so satisfying too

grim ice
#

before i learnt about custom crafing recipes

#

i made a custom gui jfor custom recipes

#

lol

#

it was so painfu;

#

painful

#

my way of doing it made it 10x worse

#

it was all a mess that i couldnt read it myself

quaint mantle
#

Doesent seem so bad can all be array based

grim ice
#

my friend told me to change it so i looked around more

quaint mantle
#

If you want to do it yourself

grim ice
#

eh

#

idk

#

its kinda dumb tho

#

wanna see the code?

quaint mantle
#

Sure

ivory sleet
#

Math can guests see the code?

grim ice
#

its really old tho

ivory sleet
#

@regal anchor

grim ice
#

ah god here we go again, im opening that shit again

#

btw

#

the plugin had like

#

20 kb or smth worrth of code

#

and it has 3 classes including main class

#

wait nvm

quaint mantle
#

Eh size is whatever

grim ice
#

2 classes including main class

regal anchor
grim ice
#

?paste

undone axleBOT
grim ice
ivory sleet
#

Hmm yeah looks like I can’t see it

grim ice
#

boil your eeyes

#

Conclure wanna feel some pain?

grim ice
ivory sleet
#

No thanks

grim ice
#

LOLOLOL

ivory sleet
#

Maybe tomorrow

grim ice
#

its like

#

i have 1 class in my whole plugin

#

with like

#

700 lines

regal anchor
grim ice
#

26k letters

quaint mantle
#

Omg

grim ice
#

lololololololololololololol

quaint mantle
#

You handled it all in click event

#

Why lol

grim ice
#

YEAH LMAO

#

idk i sucked so hard back then

prime mountain
#

getPlayerExact returns crafter={name} right

grim ice
#

i still suck but not as much

quaint mantle
#

You can do recipe int[]

#

Each recipe is an int[] then you just slot map

ivory sleet
#

@regal anchor okay so what was the issue now, sorry

grim ice
#

@regal anchor wtf

#

ppl still use labymod

regal anchor
#

yea it's perfect

prime mountain
#

?

grim ice
#

its not

regal anchor
#

why

grim ice
#

even badlion is better

#

did u even try lunar

ivory sleet
#

I use vanilla

grim ice
#

lunar isnt as good imo

#

but ppl like it

#

it gets really good fps tho

#

but i prefer forge tbh

#

way better load time

regal anchor
#

in labymod I have my server list with esc, better discord integration and name history

grim ice
#

(its different from pc to pc)

#

but 4gb 2013 laptops get 200 fps

#

in lunar

#

lol

#

tbh

#

today was successful

regal anchor
grim ice
#

i did a lot of coding

#

:D

regal anchor
grim ice
#

if its a survival plugin

#

u might want to check if player inv is full

#

right?

regal anchor
#

ppl told me to print addItem() as it returns a list of items that didn't fit

#

I print the list size and it always returns 0

eternal oxide
regal anchor
#

just talked about that above your message

quaint mantle
#

hey how should i check if a player jumped

regal anchor
#

via event

quaint mantle
#

ok what event

#

Hey there!
Do you know how to get the block Material associated to a Material?

regal anchor
#

move event -> compare getFrom().getY() & getTo().getY()

quaint mantle
#

For example when you right click with REDSTONE, it places REDSTONE_WIRE

young knoll
#

Players can move up for many other reasons

quaint mantle
#

Or when you right click with GRASS it places GRASS and when you right click with SWORD it doesn't place anything. Is there a way to find the second knowing the first?

quaint mantle
quaint mantle
quaint mantle
#

Yes there is a player.onGround iirc idk about in newer versions but I assume

#

i tihnk i'll just check their velocity

eternal oxide
#

Monitor the jump statistic

quaint mantle
#

i forgot thats a thing

#

thats actually a better idea

#

just check onmove, then get the statistic

#

etc.

#

Velocity works

#

Id use the scheduler move event can get spammed

#

Just by angle changes

eternal oxide
#

are you trying to do something with jumping or just detect it?

quaint mantle
#

im just trying to see if they jumped

#

A velocity check will work

eternal oxide
#

yeah, then a timer checking the statistic then. run it once a second as you don;t need accuracy

quaint mantle
#

i'll try both

#

to get this right, jump velocity is 0.41999998688697815, yes?

young knoll
#

There is an event for the stat increasing

quaint mantle
#

hero

hasty prawn
#

"This event is not called for some high frequency statistics, e.g. movement based statistics.", is Jumping considering a Movement statistic?

#

I assume it probably is

young knoll
#

It’s called for jumping

hasty prawn
#

Oh cool

timber willow
#

hey, i have a question about this tutorial : https://www.spigotmc.org/wiki/creating-a-gui-inventory/
can someone explain to me how to make the event work with a constructor that takes arguments?
When I execute the GUI opening I use arguments (basically profileGUI('arckene', 1) because my constructor is void ProfileGUI(String name, int page).
In short, the events don't work (to prevent drag or detect click in the inventory) because I can't get the same inventory with InventoryClickEvent.getWhoClicked() and this.inventory (which is the inventory created in the gui)

steep nova
#

wdym

#

the inventory is saved in a variable called inv so just use that

timber willow
#

yes

steep nova
#

yes

timber willow
#

I called it inventory

#

well

#

I can't register the event

steep nova
#

did you put implements Listener

timber willow
#

ofc

#

The problem is that when I click in the inventory in question, I don't get the same toString between my created inventory and the clicked inventory

raw coral
#

I have an armor stand and i am attaching a falling block to it so the falling block doesnt fall but the armor stand cant teleport when the falling block is attached for some reason s how do i move the armors tand

undone axleBOT
timber willow
#

yep wait 5 second i try something

raw coral
#

Anyone know something about my question?

timber willow
raw coral
timber willow
#

I don't know too much about the behaviour of the armors stand but I don't really understand the relation with the development ^^

raw coral
#

its something i need help with it

#

and its in spigot

steep nova
#

not the open gui

#

e.getInventory() returns the player's inv

timber willow
#

why?

#

e in on the click event

#

player.getInventory is checking the player's inventory

steep nova
#

so you're sure you clicked on the other inventory right

timber willow
#

yep

#

it's the fake debuging x)

#

but here i just check if e.getInv == this.inv

steep nova
#

try using .equals

#

idk

timber willow
#

dont work

#

maybe it's not working at the register level ```java
public void onEnable() {
// Plugin started
getServer().getPluginManager().registerEvents(new PassGUI(), this);
this.getCommand("pass").setExecutor(new CommandPass());
}

steep nova
#

no its working

#

otherwise it wouldnt print false

timber willow
#

hm

#

on the tutorial, the event is basicly the same as me

steep nova
#

how are you opening the GUI

timber willow
#

with a command

steep nova
#

oh

#

u have two methods with the same name?

#

nvm

#

someone else can help

crude charm
#

send your pass gui class

#

@timber willow

rancid snow
#

is there a chainable potion api?

timber willow
crude charm
#

1s

#

Why are you passing an inv but hardcoding the values?

crude charm
#

In your constructor

#

Also

#
    public void open(final HumanEntity ent) {
        ent.openInventory(inventory);
    }
#

should be an instance of player

timber willow
crude charm
#

no

#

in your method

timber willow
#

the opening is working

crude charm
#

you need to set the first pram to player

timber willow
#

and i follow the tutorial

crude charm
#

I told you why

timber willow
#

okay okay

#

but I didn't understand what I did wrong with the constructor

crude charm
#

you are passing an instance of the inventory but hardcoding the values

#

usually you would set them when you instance the class

timber willow
#

The problem is that I don't see what you mean by hardcoding the values

reef wind
#

int x = 5;

timber willow
#

Oh okay

reef wind
#

x is harcoded to 5

crude charm
#

in this case you are hard coding the name, slots ect in the inventory. You should do that in the constructor and then set them when you instance the class. Or just move the inv out of the constructor

timber willow
#

Yes i see, but now I'm mostly doing tests and I'm stuck on the events

crude charm
#

You said the inv isn't opening?

timber willow
#

No

#

I said the event dont detect when i click on the inv

crude charm
timber willow
#

its patched

crude charm
#

you need to set Player as the first param

#

send new code

#

?paste

undone axleBOT
timber willow
crude charm
#

usually you dont set constructor params to final

timber willow
#

yeah i know but i just copy paste the tutorial x)

reef wind
#

copy pasting = errors

crude charm
#

your naming is off

#
@EventHandler
    public void OnInventoryClick(InventoryClickEvent e) {

        Player player = (Player) e.getWhoClicked();
        player.sendMessage(((e.getInventory().equals(this.inventory)) ? "true" : "false"));
    }

civic tapir
#

how do I add org.bukkit.craftbukkit.v1_17_R1

torpid zinc
#

Hey I'm switching back to eclipse after a while, is there a different way to apply a build path? the button "Add external jar" seems disabled

crude charm
#

debug a player.sendMessage or sys.out

civic tapir
#

I need it for an entity but I cant figure out how to add it as a dependancy??

torpid zinc
torpid zinc
#

I have my reasons

#

but

crude charm
#

what are they

#

why wouldn't you use a compiler

torpid zinc
#

because for this project I can't

crude charm
#

?

torpid zinc
#

i'm not going to talk about this for a few reasons

civic tapir
#

Maven is better all around

torpid zinc
#

but still, why would my add external jar feature be disabled

civic tapir
#

theres is no reason why you wouldnt use maven

torpid zinc
crude charm
#

but use maven or gradle

torpid zinc
#

then don't answer 😄

glass sparrow
#

Does anyone know how to load an internal directory in a jar so I can iterate through the files?

eternal oxide
#

Project -> properties -> Java Build Path -> Libraries tab

#

add jar and add external jar shoudl be available

torpid zinc
crude charm
#

send a ss

civic tapir
#

where can I find craftbukkit??

crude charm
torpid zinc
civic tapir
#

can i get a link

crude charm
#

?

reef wind
civic tapir
#

to craft bukkit download

crude charm
#

just import it

civic tapir
#

it isnt

eternal oxide
civic tapir
#

@crude charm no craftbukkit

#

in org.bukkit

reef wind
#

select "modulepath"

timber willow
crude charm
timber willow
#

i dont have error

crude charm
#

and new code

#

you just said you do

timber willow
crude charm
#

?paste

undone axleBOT
timber willow
#

too late

crude charm
#

?

dense compass
#

lol

dense compass
timber willow
#

yep

crude charm
#

just use

#

?paste

undone axleBOT
crude charm
#

Im not reading off screenshots

timber willow
crude charm
#

thanks

timber willow
dense compass
#

dont use system.out

timber willow
#

i know

crude charm
#

it literally tells you whats wrong

timber willow
#

getLogger().info("text")

dense compass
#

yeah

crude charm
#

java never spoonfeeds like this

#

lmfao

#

[02:08:51 WARN]: Nag author(s): '[Arckene]' of 'ZPass' about their usage of System.out/err.print. Please use your plugin's logger instead (JavaPlugin#getLogger).
[02:08:51 INFO]: org.bukkit.event.inventory.InventoryClickEvent@6c3d106a

dense compass
#

its the most simple error

eternal oxide
#

Thats a paper message

timber willow
#

yes

dense compass
#

eh

timber willow
#

i'm using paper

dense compass
crude charm
#

maybe I should use it lmfao

#

I use pure spigot

#

or a fork

#

(my fork)

dense compass
crude charm
#

thats why I dont use it

#

cause it's my test server

eternal oxide
#

You don't have to, if you know what you are doing

crude charm
#

I cba updating

dense compass
timber willow
#

the problem is the register of the event i think ```
@Override
public void onEnable() {
// Plugin started
getServer().getPluginManager().registerEvents(new PassGUI(), this);
this.getCommand("pass").setExecutor(new CommandPass());
}

crude charm
#

no

#

its not

#

it tells you

#

what the issue is

timber willow
#

the issue is inv is null

dense compass
#

@timber willow please just explain your problem

#

is it the console errors?

crude charm
#

📐

dense compass
young knoll
#

So make sure it isn’t null

dense compass
#

"inventory" isnt defined

crude charm
#

@timber willow maybe part of the reason is because you're hardcoding the values 😉

young knoll
#

Clicking outside the window will result in a null inventory in the click event iirc

timber willow
#

basically the InventoryClickEvent detects when I click in the inventory of my GUI but can't get the information from my inventory which is not empty

dense compass
#

use #getInventory

timber willow
#

same issue

#

the inv is always null

dense compass
#

or do a check before that like

if (e.getInventory() == null)
    return;
crude charm
#

it's extremely easy to fix

#

just read the error

dense compass
#

yeah send error

crude charm
#

that wont open it

#

because it's smth else

dense compass
#

idk what he is trina do

#

srry

reef wind
#

then read the context?

timber willow
#

I'm trying to detect a click in a GUI x)

crude charm
#

send

#

error

timber willow
#

I

crude charm
#

?send

timber willow
#

dont

crude charm
#

?paste

undone axleBOT
timber willow
#

have

dense compass
#

LOOK IN CONSOLE

#

bro

crude charm
#

ikr

timber willow
crude charm
#

you said it's null

#

show the error where it's null

reef wind
crude charm
#

m8

dense compass
#

they dont get an error

#

okay first of all

crude charm
#

are you taking the piss

dense compass
#

switch to getLogger().info("")

crude charm
#

^

dense compass
#

lmao

crude charm
#

ikr

timber willow
#

i'm not in the JavaPlugin class

#

so i don't have getLogger

dense compass
#

well then

crude charm
#

what JavaPlugin class

#

LMFAO

reef wind
dense compass
#

put this in your main class

#

and this in on enable

crude charm
#

or

#

get an instance of it

dense compass
#

confused

crude charm
#

private Main main

public Class(Main main) {
this.main = main;
}

#

both work

dense compass
#

yeah that would also work

#

just making it simple

eternal oxide
timber willow
#

the empty one

crude charm
#

no

dense compass
#

wha-

#

lmao

crude charm
#

it has the inv in it

#

lmfao

eternal oxide
#

then you never initialize the inventory field

dense compass
#

inventory isnt defined

crude charm
#

?learnjava

undone axleBOT
dense compass
crude charm
dense compass
#

python maybe

#

xd

crude charm
#

scratch maybe?

timber willow
dense compass
dense compass
#

and ill send code that actually works

crude charm
quaint mantle
crude charm
#

its something else

dense compass
#

oh ur right lamo

#

oops

quaint mantle
#

i saw that was like no why static that

dense compass
#

yeah idk why I put static

crude charm
#

@timber willow

#

?learnjava

undone axleBOT
timber willow
#

?

quaint mantle
#

cause you need it access able every wher eyou make a static thats gonna go bad

crude charm
#

learn java

dense compass
#

:)

timber willow
#

--"

crude charm
#

there is so much basic knowledge you dont know

timber willow
#

Bro

reef wind
#

@timber willow what language are you a full stack dev in peepSelfie

dense compass
crude charm
#

lol

dense compass
#

i can spell

#

shh

quaint mantle
#

Zoi even if he watch YT tutorials they teach the basics before anything 😛

dense compass
#

true look up "how to code plugin" on yt

granite beacon
reef wind
#

docs > videos

crude charm
quaint mantle
#

its best too know Java principles before coding the language

dense compass
#

look at the commented out bit

#

lmao

crude charm
#

he said it was lol

quaint mantle
crude charm
#

he copy and pasted the tutorial

granite beacon
#

I think learning by coding isn't a bad idea but java questions should be asked in servers dedicated to java alone rather than spigot

reef wind
#

I wonder what guy is a full stack dev in lol

timber willow
#

But seriously, what is this? I don't know much about spigot, I've been asking for an hour how to make registration events work with a constructor that extends a listener with arguments and you answer that it doesn't come from the

dense compass
#

honestly spoon feeding kinda works

#

but

#

you gotta know some code

quaint mantle
crude charm
#

?learnjava

undone axleBOT
granite beacon
quaint mantle
torpid zinc
#

Weird, I'm trying to follow someone's code, but intellij can't find EntityPlayer from NMS, is there any extra maven depedency I need to add

dense compass
#

@timber willow

#

;-;

quaint mantle
dense compass
#

like if you know python

#

or c# idk

#

java is easier to learn

quaint mantle
#

Java is good as a starter too then learn things like Python and C++ in my opinion

young knoll
quaint mantle
#

ive been coding java for 6 Years and ive always enjoyed it but im learning more into python and C++ now

dense compass
#

honestly if you use intellij you gotta get minecraft dev plugin

#

it makes life so much easier

torpid zinc
dense compass
young knoll
#

I told you

#

Change spigot-API to spigot

quaint mantle
#

Yeah its a pain but its good habit too have when your use too it tbh

#
public class ListLocations implements CommandExecutor {
    @SuppressWarnings("unused")
    private Main plugin;
    public ListLocations(Main plugin) {
        this.plugin = plugin;
        plugin.getCommand("listlocations").setExecutor(this);
        System.out.println(1);
        }
    @Override
    public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
        System.out.println(2);
        if(!(sender instanceof Player)) {
            sender.sendMessage("Only players can use commands for this plugin");
            return false;
        }
        System.out.println(3);
        Gson gson = new Gson();
        Reader reader = null;
        try {
            reader = Files.newBufferedReader(Paths.get("C:\\Users\\gaela\\OneDrive\\Documents\\advanedChorusFruitPlugin\\src\\me\\JiovannyAlejos\\advancedChorusFruit\\tpData.json"));
        } catch (IOException e) {e.printStackTrace();}
        CoordinateData data = gson.fromJson(reader, CoordinateData.class);
        String coordList = "List of warp locations\n";
        if(data.coordinates.size() == 0) {
            coordList = "No warp locations set";
        } else {
            ArrayList<String> names = data.locNames;
            for(int i = 0; i < data.coordinates.size(); i++) {
                String[] coordinates = data.coordinates.get(i).split(Pattern.quote("|"));
                coordList += "\n" + names.get(i) + ", " + coordinates[0] + ", " + coordinates[1] + ", " + coordinates[2];
            }
        }
        Player p = (Player) sender;
        p.sendMessage(coordList);
        return true;
    }
}

why is it that this only ever outputs 1 but never 2 or 3, and it doesn't send the player the message either

#

as with C# and C++ you use it alot TBH

quaint mantle
#

sorry sorry, i'll get a pastebin since it's a bit much

undone axleBOT
quaint mantle
dense compass
#

yeah might be a good idea ol

#

@quaint mantle what is the command meant to do?

#

just to make this quicker

#

like a list of locations i assume

quaint mantle
#

is the command register in plugin.yml

#

well, I have a json file with two arrays, one with coordinates strings and the other with the names, this just brings them all together in a string and sends it to the player

#

it is

dense compass
#

any errors?

quaint mantle
#

no errors that wouldve helped me ;-;

granite beacon
#

Question, let's say that a player makes the event PlayerToggleFlightEvent go off. If you cancel the event and get the players location (assuming the player is lagging therefore they fly for a little), will it return the location where the player initially toggled the flight or where they are once the event gets canceled?

quaint mantle
#

SLeepy by the looks of things the onCommand isnt Running it skips past it so How are you registering the event Smol

granite beacon
quaint mantle
#

@granite beacon Yes

#

i registered it in the main class like this

public class Main extends JavaPlugin {
    @Override
    public void onEnable() {
        new ListLocations(this);
        new RemoveLocation(this);
        getServer().getPluginManager().registerEvents(new EntityBurn(), this);
        getServer().getPluginManager().registerEvents(new PlayerConsumeItem(), this);
        getServer().getConsoleSender().sendMessage("plugin ready");
    }
}
dense compass
#

i dont see an immediate problem tho

quaint mantle
#

also

#

you havnt register the command

granite beacon
timber willow
#

@dense compass Thank you for giving me the solution ^^

prime mountain
#

if there are no args, is args[0] empty?

quaint mantle
#

wait wot?

prime mountain
#

or does args[0] include the command?

crude charm
dense compass
#

uh

#

no?

quaint mantle
# granite beacon yes to?

If you cancel the fly event so on flight it will put them too last known position as the server sees the player isnt aloud to fly

prime mountain
# dense compass no?

look, checking this stuff is a little annoying and i did a whole bunch of things and the error cascade is bound to be real

quaint mantle
#

I- w-wait how do i register the command?

granite beacon
granite beacon
quaint mantle
quaint mantle
prime mountain
#

the other assumption i made is that getPlayerExact outputs crafter={name}

crude charm
#

or be a cool kid

prime mountain
#

is that correct?

crude charm
#

and use a api / util

dense compass
crude charm
#

read the spigot docs

#

?docs

granite beacon
prime mountain
#

i have been reading the docs

quaint mantle
dense compass
prime mountain
quaint mantle
#

okay

prime mountain
#

just double checking

quaint mantle
#

Yeah np

quaint mantle
prime mountain
#

in python i think args[0] outputs the python file name

granite beacon
quaint mantle
#

getServer().getPluginCommand("listlocations").register(new ListLocations(this));
like this? the ide seems to want to autocorrect to getPluginCommand but then there's an error The method register(CommandMap) in the type Command is not applicable for the arguments (ListLocations) in the .register

#

ohhh ik whgat your doing now

#

how to tell if a server is restarting

dense compass
#

cooldown ? ground check?

#

idk

dense compass
prime mountain
# crude charm no

so then what does it output? it outputs a player object but what does that look like in text form

dense compass
#

the plugin would be disabled ;-;

#

thats not how that-

crude charm
dense compass
#

ya know what you can figure that one out

quaint mantle
crude charm
#

not just their name

#

a whole player

granite beacon
quaint mantle
#

I casted it to commandmap so i'll try testing it now since it removed the err

prime mountain
crude charm
#

ban everyone over 50 ping?

granite beacon
dense compass
crude charm
quaint mantle
#

use the one i sent you

dense compass
#

wait why would you use that type of cmd

quaint mantle
#

use the getCommand one it Bukkit Native and the one that is generally used by most people tbh

dense compass
#

yeah wouldnt you just use this.getCommand("cmd name").setExecutor(new CMDCLASS());

quaint mantle
#

Yep

#

thats the easy and simple way

#

ohhh woops it's bc i accidentally left the getServer there oop

prime mountain
#

whatever that type is called

dense compass
digital plinth
#

is it possible to hook an Machine learning AI to the citizens api

native nexus
#
if(pluginCommand != null) pluginCommand.setExecutor(commandExecutor);```
#

Easy peasy

quaint mantle
dense compass
#

oh lmao same here

digital plinth
dense compass
digital plinth
#

u said its simple

dense compass
#
@Insert("Machine Learning AI")
public void CitizensAPI() {
  getLogger.info("shh")
}

bam simple

#

dont ban me is joke

native nexus
#

@digital plinth There is literally a wiki on how to do everything

dense compass
#

also why would you need machine learning for citizens api

#

trina make an army lmao

digital plinth
#

lol yea

#

sorta

dense compass
#

alrighty then

digital plinth
dense compass
quaint mantle
#

Is it possible to check if a server is restarting using a plugin and change a hologram placeholder if it is restarting ?

native nexus
#

Yes there is also the AI API documentation for it and the javadocs

digital plinth
quaint mantle
#

like if the server is restarting then it changes a hologram in another "server" to "Restarting" if its restarting,.

dense compass
#

i mean no one would see that if the server is restarting lmao

quaint mantle
#

im not good at plugin development so Im not good at explaining.

dense compass
#

but yeah, just use onDisable()

quaint mantle
#

Someone told me its impossible.

quaint mantle
dense compass
#

uh

#

so you mean just if it restarts

native nexus
#

Yes it is possible via bungeecord

dense compass
#

yeah idk how to do that unless there is another plugin running like bungeecord

quaint mantle
#

Theres a difference between rebooting and turning off the server but i dont know if its possible to check so,.

dense compass
quaint mantle
#

so a plugin for the host then

dense compass
#

yeah, like bungeecord

quaint mantle
#

Someone told me that its impossible

native nexus
hasty prawn
#

You're trying to change a Hologram for a server that is restarting?

native nexus
#

No not at all lol

dense compass
#

or if you are just gonna use /reload and then use PlayerCommandPreprocessEvent and change it then

flint pewter
#

i need help with my mod pack

dense compass
flint pewter
#

im developing my mod pack right

hasty prawn
#

?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.

quaint mantle
dense compass
#

it says server info about another server

hasty prawn
quaint mantle
tame elbow
dense compass
#

idk much about bungeecord but there would be a way to check if a server is restarting

native nexus
#

It can be a bukkit plugin...

hasty prawn
#

Doesn't even need to be Bungeecord plugin, Spigot plugins can communicate through the PMC. Husker sent a link.

#

is

#

?pmc

dense compass
#

i dont know what im talking aobut

dense compass
#

mk?

hasty prawn
quaint mantle
#

someone told me to do this

ask them to explain why it’s impossible to get restarting

dense compass
quaint mantle
dense compass
#

no as in we didnt say it was impossible

hasty prawn
#

It's not impossible, you just need Bungeecord.