#help-development

1 messages · Page 1407 of 1

glossy scroll
#

yea im aware

untold rover
#

that line does nothing other than inventory.setItem

glossy scroll
#

Well what does index out of bound mean

untold rover
#

that the index is out of the inventories range

wraith rapids
#

the issue is that his logic shits out an invalid value to set

glossy scroll
#

Correct

#

So to fix it....

wraith rapids
#

we already know it shits out an invalid value but he has no idea how to make it shit out the right value

glossy scroll
#

You cant have a value larger than 53 in an array of 54

untold rover
#

smh... Please read the whole conversation, before just assuming.

wraith rapids
#

lol

glossy scroll
#

Im literally just reading the stack trace lol

wraith rapids
#

just make it use rows and columns

untold rover
glossy scroll
#

Row = index / 9

#

Column = index % 9

wraith rapids
#

using rows and columns means you don't need to compute the index individually everywhere and figure out what a change to the index actually changes in the inventory

#

it means you can literally tell the item to "be right here"

#

and then it is there

#

with sensible numbers like row 3 and column 5

#

instead of magic index like 34

glossy scroll
#

Is there any code lol

#

I dont think youve posted the logic that has the slot numbers?

wraith rapids
#

he linked it somewhere

untold rover
#

okay, so I have added the column and row into the EntryItem, now for the util method, whats the best way to calculate it?

wraith rapids
#

this i think

#

if you want a row and a column from the index

#

row = index / inventoryWidth;
column = index % inventoryWidth;

#

inventory width of a chest is 9

glossy scroll
#

Looks like you need a page inventory system?

untold rover
#

and whats the opposite way, from row and column to index

wraith rapids
#

if you want an index from row + column,
index = (row * inventoryWidth) + column;

glossy scroll
#

Because you have too many objects to put in the inventory

#

This row and column stuff is good but its not gonna fix ur problem

wraith rapids
#

he's trying to like make animated items or something, i don't quite know

#

like items that move around in the inventory every tick

#

or some shit

glossy scroll
#

Mmmmm

wraith rapids
#

he linked a vague gif of something similar earlier but I can't be arsed to find it

glossy scroll
#

If he can rotate the collection then he should just be able to cut off the loop when it gets too high

untold rover
wraith rapids
#

yes

#

and don't let row become negative

wraith rapids
#

or exceed the inventory height

untold rover
wraith rapids
#

note that the gif has column-- not row--

#

target column and row

#

forget about indices

#

indices don't exist

#

they're an impl detail

glossy scroll
wraith rapids
#

or when column == targetColumn

#

and put on the brakes if column == 0 or column >= inventoryWidth

#

the latter shouldn't happen if your when-to-stop logic works properly, but might as well throw it in there

crude charm
#

why is my code not working, HELP!!!!!

wraith rapids
#

HALP

crude charm
wraith rapids
#

define not working

crude charm
#

broken

wraith rapids
#

define broken

crude charm
#

not working as intended

odd gulch
#

-.-

wraith rapids
#

what is it intended to do

#

what does it do

crude charm
#

hide / show players and change the item

odd gulch
#

It is intended to work is my guess

wraith rapids
#

lmao

crude charm
#

yeah

#

its intended to work

wraith rapids
#

and what does it do

crude charm
#

hide / show players and change the item

wraith rapids
#

then it works?

#

it does what it's intended

crude charm
#

no

#

it broke

wraith rapids
#

then what does it do

#

instead of the thing it should do

crude charm
#

not work

wraith rapids
#

are you fucking retarded

crude charm
#

yes

#

I press the item and it does nothing

#

when I right click air it does nothing

wraith rapids
#

does your listener run

crude charm
#

yes

#

when I click floor it does

#

but it deletes the item

#

and doesent give me the good item

wraith rapids
#

congratulations, you have reached step 1

#

you have now described your issue

#

unfortunately all of my effort was exhausted in trying to wrench it out of you

#

so someone else will have to actually help you with the issue

crude charm
#

nooooooooooooooooooooooooooooooooooooooooooooooooooooooooo

#

PLEASE

#

I WILL DO IT

eternal oxide
#

This event will fire as cancelled if the vanilla behavior is to do nothing (e.g interacting with air). For the purpose of avoiding doubt, this means that the event will only be in the cancelled state if it is fired as a result of some prediction made by the server where no subsequent code will run, rather than when the subsequent interaction activity (e.g. placing a block in an illegal position (BlockCanBuildEvent) will fail.```
quaint mantle
#

i wanna make something

#

but idk what to make

wraith rapids
#

make me a decent crates plugin

#

or find one that isn't trash

quaint mantle
#

customcrates

wraith rapids
#

doesn't support custom items and/or is laggy and garbage

crude charm
quaint mantle
#

also if i did make a crates plugin it'd probably be paid

crude charm
#

its easy

wraith rapids
#

i don't have the effort to decorate and polish it

quaint mantle
wraith rapids
#

i already have a million other projects

crude charm
quaint mantle
#

whats even sadder is the fact i cant use custom emojis here

crude charm
#

boom

#

done

quaint mantle
#

bugs?

#

roulette chest animation?

crude charm
quaint mantle
#

also im a perfectionist, i wouldn't make something less than perfect

#

i've been practicing animations and particles and all that

wraith rapids
#

yeah writing a shit tier bare bones crate plugin is easy

quaint mantle
#

^

wraith rapids
#

literally just pick a random item from a list and throw it at the player

quaint mantle
#

writing a perfect crates plugin on the other hand

#

or near perfect

#

is another story

wraith rapids
#

i haven't even found a good crates plugin out there yet

#

they are all either laggy and crummy or don't have proper custom item support

quaint mantle
#

like vouchers and all that?

crude charm
#

im an animations noob

wraith rapids
#

items with arbitrary tags in their PDC to identify them as custom items from plugins

quaint mantle
#

i need to either way for IGCSEs

#

so i mean it wasn't a waste of time

wraith rapids
#

most of the plugins can handle stuff like lore and display name fine

#

but like none of them offer support for pdc tags

crude charm
#

the whole year worth?

wraith rapids
#

which is understandable, because doing that would actually require some level of competence

#

which the average developer doesn't seem to fucking have

quaint mantle
crude charm
#

atleast in aus

quaint mantle
#

i learned that shit in 8th grade

crude charm
#

I didnt start it till 10

quaint mantle
#

lmao

#

we started in 7th grade and finished in 8th grade

crude charm
#

they never said the word till 10th

quaint mantle
#

i bet you'd fail my 9th grade tests lol

crude charm
quaint mantle
#

one sec ill send u last semester's exam paper

crude charm
#

ok

quaint mantle
#

idrc that my irl name is in there

crude charm
#

lms

quaint mantle
#

what u gonna do

crude charm
#

U LIAR

quaint mantle
#

first few pages are easy

crude charm
#

THIS IS GRADE 9

quaint mantle
#

yeah?

#

and?

crude charm
#

U SAID 8

#

SCAMMER

#

LIER

#

CANCEL HIM

quaint mantle
#

bro i said u'd fail my 9th grade exam

#

but to fair

#

you'd fail my 8th grade one too

crude charm
#

you only picked this one because you got 50/50 mariCool

quaint mantle
#

u want first semester exam?

crude charm
#

is this a joke

quaint mantle
#

bro i told u

#

first few pages are ez

crude charm
quaint mantle
#
Player player = dropItemEvent.getPlayer();
Item item = dropItemEvent.getItemDrop().getItemStack().;
#

a bunch of trigonometry here

#

how do I get dropped item name?

crude charm
quaint mantle
quaint mantle
quaint mantle
#

as a variable

#

@crude charm dis for u

#

?

#

im too lazy to help

#

bruh

crude charm
#

#getDisplayName

quaint mantle
#

umm

#

good boi zoi

#

it's spigot 1.8

crude charm
#

ik

quaint mantle
#

that ryhmed

crude charm
#

#getDisplayName

crude charm
quaint mantle
#

np babygurl

#

@crude charm dms

wraith rapids
#

like I explained yesterday

#

you first need to get the old value

#

add + 1 to it

#

and then write it back

#

int value = map.get(key)

#

value = value + 1

#

map.put(key, value)

#

do you understand

#

how is that possible

#

let's go back to the fucking phone book allegory then

#

so, your hashmap is a phone book

#

there are peoples names and peoples phone numbers in it

#

now, to change someone's phone number

#

you first need to read it from the phone book

#

then, you change the phone number

#

then, you write the phone number back

#

do you understand?

eternal oxide
#

playerHits.put(key, playerHits.getOrDefault(key, 0) + 1);

wraith rapids
#

you need to read, then you need to modify, then you need to write

fresh heath
#

what do you mean by old value

wraith rapids
#

how you add + 1 value to HashMap

#

you want to add + 1

#

you need something to add the +1 to

#

you need the value that is already there

#

you can't add + 1 to nothing

#

you need a number to add it to

fresh heath
#

yes howmanyhits is 0

wraith rapids
#

you don't know that

#

it could be 3

fresh heath
#

PlayerHits.put("howmanyhtis", 0);

#

it is 0

wraith rapids
#

yes, but you don't know that

#

someone may have done put(3)

eternal oxide
#

I gave you the code to increment/add an entry ^

fresh heath
#

but who ?

wraith rapids
#

you

fresh heath
wraith rapids
#

is the value always going to be 0?

fresh heath
#

no

wraith rapids
#

then you don't know whether it's 0 or not

#

so you need to get the current value

#

and add to it

eternal oxide
#

its one line of code

#

playerHits.put(key, playerHits.getOrDefault(key, 0) + 1);

wraith rapids
#

i think his issue is something more deeply rooted

eternal oxide
#

possibly trollism

wraith rapids
#

one can always hope i suppose

fresh heath
#

I think my issue is that Idk how to like make "howmanyhits" be always 0

wraith rapids
#

why do you want it to be always 0

#

what's the point of even having it if it's always 0

fresh heath
#

issue is that I dont want

#

I meant not be always*

wraith rapids
#

i don't even know how to explain anything to you anymore

#

okay, let's

#

let's make it even simpler

#

you have a bucket

fresh heath
#

does .getOfDefault means that it is 0 but not 0

wraith rapids
#

that's right, a fucking bucket

#

you know what a bucket is, right

fresh heath
#

no

#

jk

wraith rapids
#

a bucket can have things in it right

#

have you ever put something in a bucket?

fresh heath
#

yes

quaint mantle
wraith rapids
#

how about

#

have you ever taken something out of a bucket?

#

okay, now, imagine you have a piece of paper

eternal oxide
#

he said yes

wraith rapids
#

and some tape

#

have you ever taped a piece of paper onto a bucket?

quaint mantle
odd gulch
fresh heath
#

actually no but I can Imagine

wraith rapids
#

good, imagination is good

sick forum
#

Hey guys, I need some help with BungeeCord scheduler and async tasks. So, following "Pitfalls" from SpigotMC I should create async task with the code:

getProxy().getScheduler().runAsync(this, new Runnable() {
    @Override
    public void run() {

    }
  });

So, my question is can I just call function from another class like:

ProxyServer.getInstance().getScheduler().runAsync(Main.getInstance(), new Runnable() {
     @Override
     public void run() {
         response[0] = GetHTTPResponse.mainCheckEngine(IP);
     }
 });

Main is the main plugin class, GetHTTPResponse is a class contains static function returns string.

fresh heath
#

POG

wraith rapids
#

now, imagine you have a bucket

#

and you have taped a piece of paper onto it

fresh heath
#

yes

wraith rapids
#

and on this piece of paper, you have written "how many hits"

fresh heath
#

alr

wraith rapids
#

now, in this bucket, there is a piece of paper

fresh heath
#

yes

wraith rapids
#

on this piece of paper in the bucket, you have written the number 0

fresh heath
#

arent u just eplaining me this: PlayerHits.put("howmanyhtis", 0);

wraith rapids
#

yes

#

but it gets better

#

now, let's imagine something more complicated

#

bare with me here

fresh heath
#

ok

quaint mantle
# odd gulch registerEvents

hey, sorry but I didn't get. I already have an event but I only need listner:this and plugin:this but when I type only twice it take event:this and listner:this

wraith rapids
#

have you ever done a hand stand

fresh heath
#

yes

#

but next to wall

wraith rapids
#

right, so

odd gulch
wraith rapids
#

how many hand stands can you do in a single day?

fresh heath
#

i assume u want me to say 10

wraith rapids
#

i assume you don't know because you probably have never tried

fresh heath
#

bc on 10th hit

quaint mantle
wraith rapids
#

now, let's try to figure out how many times you can do a handstand in a single day

#

now, imagine you have really fucking severe dementia

#

and you can literally not remember anything

fresh heath
#

wait

wraith rapids
#

am I going too fast

fresh heath
#

what is dementia

eternal oxide
#

good acting

fresh heath
#

no you are not going fast

eternal oxide
wraith rapids
#

lol

#

well, point is, you can't remember anything

#

how many hand stands did you do up until now? you don't know

#

you can't remember shit

fresh heath
#

Idk what is my name

wraith rapids
#

now, bring back the bucket

#

remember the bucket?

#

with the paper in it?

fresh heath
#

no

eternal oxide
#

Nope, he has dementia

fresh heath
#

right

wraith rapids
#

okay you have selective dementia

#

you can only not remember how many hand stands you've made

fresh heath
#

it was 0 but idk

#

that

wraith rapids
#

you bring back the bucket

#

now, since you can't remember how many hand stands you have done, you need to keep track of them

#

at the start of the day, you take the paper and write 0 on it

#

you then put it in the bucket

#

you then write "how many hand stands i've done" on the bucket

#

so you know what the bucket is for

fresh heath
#

what are trying to say is that every time I hit an entity the value will be set to 0

wraith rapids
#

no

fresh heath
#

slt

#

alr*

wraith rapids
#

i am saying when your plugin starts, you set the value to 0

#

when the day begins, you write 0 on the paper

#

because you haven't done any hand stands yet

fresh heath
#

yes

wraith rapids
#

now, you start your day

#

you do a hand stand

#

then you get back down

fresh heath
#

I do 1 then add 1

wraith rapids
#

and then you go to the bucket

#

now, you can't actually remember how many times you've done a hand stand

#

so you find your bucket

#

you look around until you find a bucket with "how many hand stands i've done" written on it

quaint mantle
#
String item = dropItemEvent.getItemDrop().getItemStack().getItemMeta().getDisplayName();
wraith rapids
#

you eventually find this bucket

quaint mantle
#

this is giving null

wraith rapids
#

then, you take the paper out of the bucket

fresh heath
#

I am actually imagining that

wraith rapids
#

this operation is myRoom.get("how many hand stands i've done")

#

that is, you take your room

#

you look around in it for a bucket with that written on it

#

and then you take the paper in it

#

right

#

now, you can read the paper and see how many hand stands you have made

#

then, you know how to add two numbers together

#

you need to read the number, and in your mind, add +1 to it

#

then you take a big eraser and erase the old number on the paper

#

and put it back in the bucket

fresh heath
#

and repeat

wraith rapids
#

in code, this would be

int howManyHandStands = myRoom.get("how many hand stands i've done");
howManyHandStands = howManyHandStands + 1;
myRoom.put("how many hand stands i've done", howManyHandStands);
#

you find the bucket, take the number out of it with get()

#

you add +1 to it

#

then you put it back in the bucket

#

do you understand what this does now

fresh heath
#

but

#

do I still need this PlayerHits.put("howmanyhtis", 0);

quaint mantle
#

guys

wraith rapids
#

yes, you need to do that at the start of the day

#

however, there is an alternative

#

but imagining it is more complicated

fresh heath
#

what does myRoom stand for

#

in my code

wraith rapids
#

myRoom is your room; it's where you store your buckets

#

in your code, myRoom is a hashmap

quaint mantle
fresh heath
#

so Player Hits howmanyHandStands is howmany hits right ?

untold rover
#

@wraith rapids soo, no matter what I do, nothing happens, absolutely nothing. I get no result but no errors, I have debugged all variables and they are correct. here is the updated code: https://paste.sentinalcoding.eu/4Jew2k7835

wraith rapids
#

yes

#

now, you have more than 1 player on your server, yes?

fresh heath
#

no

wraith rapids
#

well imagine you do

fresh heath
#

wait

#

dont, let me try with 1 people rn

quaint mantle
#

is there a way to remove the console kick message on PlayerLoginEvent ?

#

like the log message

untold rover
wraith rapids
#

copy paste your question

#

i can't see replies

quaint mantle
#
String item = dropItemEvent.getItemDrop().getItemStack().getItemMeta().getDisplayName();

this is returning null

untold rover
#

oof

#

do you have hasItemMeta checks

#

do you have hasDisplayName checks?

quaint mantle
#

:?

glossy scroll
untold rover
wraith rapids
#

items usually don't have display names

#

display name is only present if a player has renamed the item

fresh heath
#

Is this what you mean

Map<String, Integer> PlayerHits = new HashMap<String, Integer>();
            PlayerHits.put("howmanyhtis", 0);
            int howmanyhits = PlayerHits.get("howmanyhits");
            howmanyhits = howmanyhits + 1;
wraith rapids
#

show your entire class file

eternal night
#

?paste

queen dragonBOT
wraith rapids
#

we are going to build a house

quaint mantle
#

how to get this name?

untold rover
#

thats not a display name afaik

quaint mantle
#

yeah, that's what I asked

wraith rapids
#

that's the I18 name

quaint mantle
#

how to this name

wraith rapids
#

ItemMeta::getI18DisplayName

#

or something

glossy scroll
#

Once concern @untold rover

wraith rapids
#

ItemStack::getI18NDisplayName*

#

it's on stack, not meta

glossy scroll
#

Your array is made of objects that all have the same start index? So theyre all gonna move upwards jn ghe inventory in the same column at the same time

untold rover
#

why do they have the same start index?

quaint mantle
glossy scroll
#

No

#

Right now your code has them at the same start index

wraith rapids
#

doesn't exist then

#

get fucked i guess

eternal night
#

Yeah it is getI18NDisplayName not i18

#

well

#

and I think paper only ?

wraith rapids
#

probably

#

spigot sucks

glossy scroll
#

@untold rover ugh im sorry

#

Keep reading it wrong cuz phone

quaint mantle
#

+_+

#

guys is the logger different in 1.16? Can't find the log4j classes that I need, I need to remove some spam

glossy scroll
#

Just try to cal player update inventory

#

And then see what happens

untold rover
#

not even the sout above the setitem is triggered

#

literally NOTHING happens

#

thats why I pinged NNY with the updated code, maybe he sees what I did wrong

glossy scroll
#

Oh

#

I didnt know thats what you meant

#

You call runTaskLaterAsync

#

You should call runTaskTimer, correct?

untold rover
#

oof 🤦‍♂️

wraith rapids
#

👀

glossy scroll
#

Also you should probably make sure your indexes start off screen. Right now it looks like they just start somewhere and move upwards?

#

And you also need a check to make sure youre not trying to put offscreen items in the inventory

untold rover
#

they start on their target location, and move to the left

#

column is up down row is left right

glossy scroll
#

row— moves upwards

wraith rapids
#

column-- moves left

#

as with most other on-screen coordinates, 0,0 is the upper left hand corner

glossy scroll
untold rover
#

yea ik

glossy scroll
#

Just make sure none of the negative indexes are put in the inv

wraith rapids
#

make a boolean method isOnScreen and do if (e.isOnScreen()) inv.setItem(...

#

and make the isOnScreen method check if row/column is negative, or exceeds the width/height

untold rover
#

this is getting frustrating... lets see if it works now, I have added column++ so it has a few ticks on screen before going offscreen and causing an exemption

glossy scroll
#

Or just if the index is negative or above max?

#

Nvm

wraith rapids
#

ig but that'd be cleaner

glossy scroll
#

You dont store inv size

woeful crescent
#

Can anyone help me with forming a regex to match any numbers in a string?

wraith rapids
#

\d+

glossy scroll
untold rover
glossy scroll
#

ok

odd gulch
#

What are you animating?

woeful crescent
wraith rapids
#

it matches any digit

#

from abcd1224eft
it would grab 1224

untold rover
glossy scroll
#

Ok well right now it seems the contents start in the inv and move offscreen

untold rover
glossy scroll
#

Ok

glossy scroll
#

It looks cool

wraith rapids
#

i don't see any point in it

untold rover
glossy scroll
#

If you like math related content

#

Allow me to flex

untold rover
#

and now teamcity is broken and won't compile properly ...

glossy scroll
merry kindle
#

What is the best way to do item a material system

glossy scroll
#

what

merry kindle
#

Like right now im using enums for materials i wanna do custom materials and items wondering the best way to do it. cause i feel like enums are not the best way at all

glossy scroll
#

Custom... materials?

untold rover
#

custom materials and items sounds like a forge mod

#

not like a plugin

#

I guess you can somewhat make custom items

glossy scroll
#

Custom items probably means items that have a certain meta

merry kindle
#

^

glossy scroll
#

I personally would just define items as a bunch of static fields

merry kindle
#

just like how hypixel has custom items and materials

glossy scroll
#

But idk what youre using them for

merry kindle
#

Im going to use them to craft and sometimes place down

fresh heath
#

Is anything wrong with this ?

Map<String, Integer> PlayerHits = new HashMap<String, Integer>();
            PlayerHits.put("howmanyhtis", 0);
            int howmanyhits = PlayerHits.get("howmanyhits");
            howmanyhits = howmanyhits + 1;
merry kindle
#

if you want to put howmanyhits back into the Hashmap you get to put it back in so like PlayerHits.put("howmanyhtis", howmanyhits);

glossy scroll
#

If you want to increase the integer in a hashmap

#

Use HashMap.merge(key, 1, Integer::sum)

#

Will also put a 1 as a default value if it doesnt exist

untold rover
#

I am just confused AF, I had debug code a while back, the debug code is gone I recompiled 20000 times and uploaded, but that debug is still appearing, but when I look at the jar, the debug is not there

fresh heath
quaint mantle
#

Still don't get why it is not filtering it ```java
public static void setupConsoleFilter(Logger logger) {
ConsoleFilter filter = new ConsoleFilter();
logger.setFilter(filter);
Bukkit.getLogger().setFilter(filter);
Logger.getLogger("Minecraft").setFilter(filter);
}

untold rover
#

I am so frustrated from this I need a beak, Martoph is it okay If I ping you or something once I get back to it?

glossy scroll
glossy scroll
#

I may not see it cus this chat is busy

#

Dm maybe?

untold rover
#

yea sure no worries

fresh heath
glossy scroll
#

I literally told you what to use

glossy scroll
#

Otherwise your solution is incorrect

odd gulch
glossy scroll
#

Hes realy close

#

Its just some nuances hes not added in yet

brittle nova
#

When I do p.sendMessage(String.valueOf(yml.getStringList("locations"))); It says [] although this stands in the file:

  '0':
    ==: org.bukkit.Location
    world: world
    x: 34.0
    y: 78.0
    z: -250.0
    pitch: 0.0
    yaw: 0.0```
#

Somebody know why it says [] and how I fix this

odd gulch
fresh heath
#

ok my code is incorrect how to use HashMap.merge(key, 1, Integer::sum)

untold rover
# odd gulch I can give it a crack if you want?

sure anything will help. so here is the newest code: https://paste.sentinalcoding.eu/XMIXv3E557 and the newest error is this: [16:57:00 WARN]: [JaHollDE-Core] Plugin JaHollDE-Core v1.0.0 generated an exception while executing task 7370 java.lang.ArrayIndexOutOfBoundsException: Index 54 out of bounds for length 54 at java.util.Arrays$ArrayList.set(Arrays.java:4356) ~[?:?] at net.minecraft.server.v1_16_R3.NonNullList.set(SourceFile:53) ~[patched_1.16.4.jar:git-Paper-416] at org.bukkit.craftbukkit.v1_16_R3.inventory.CraftInventoryCustom$MinecraftInventory.setItem(CraftInventoryCustom.java:108) ~[patched_1.16.4.jar:git-Paper-416] at org.bukkit.craftbukkit.v1_16_R3.inventory.CraftInventory.setItem(CraftInventory.java:99) ~[patched_1.16.4.jar:git-Paper-416] at de.jaholl.core.inventory.ClickInventory.setItem(ClickInventory.java:74) ~[?:?] at de.jaholl.core.inventory.AnimatableInventory.tick(AnimatableInventory.java:51) ~[?:?] at de.jaholl.core.inventory.AnimatableInventory$1.run(AnimatableInventory.java:39) ~[?:?] at org.bukkit.craftbukkit.v1_16_R3.scheduler.CraftTask.run(CraftTask.java:99) ~[patched_1.16.4.jar:git-Paper-416] at org.bukkit.craftbukkit.v1_16_R3.scheduler.CraftAsyncTask.run(CraftAsyncTask.java:54) ~[patched_1.16.4.jar:git-Paper-416] at com.destroystokyo.paper.ServerSchedulerReportingWrapper.run(ServerSchedulerReportingWrapper.java:22) ~[patched_1.16.4.jar:git-Paper-416] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?] at java.lang.Thread.run(Thread.java:834) [?:?]

Its missing some stuff, like checks so it doesn't go out of the inventory

#

I don't know why its trying to set something to 54 even though when I sout everything the highest I get is 53

odd gulch
#

Use this for inspiration. Threw it together in a min or two so definitely not too clean : )

        new BukkitRunnable() {
            private final List<ItemStack> itemStacks = IntStream.range(0, 54).mapToObj(value -> new ItemStack(Material.STONE)).collect(Collectors.toList());
            private int iterations = 9;

            @Override
            public void run() {
                for (int i = 0; i < 54; i++) {
                    final int row = i / 9;
                    final int slot = i + iterations;
                    final int slotRow = slot / 9;
                    if (row != slotRow) continue;
                    inventory.setItem(slot, itemStacks.get(i));
                }
                if (iterations-- == 0) {
                    cancel();
                }
            }
        }.runTaskTimer(this, 80, 10)```
quaint mantle
odd gulch
#

Yes

#

Haven't been following along too closely so I am not sure whether it applies to your exact use case.

untold rover
#

so basically I have an inventory, full of items they have specific slots, and instead of just opening the invs and the items are there I wanted to have a small animation

#

so they come in "rolling" from the right side

odd gulch
#

So I suppose your inventory items would be the itemstacks variable. You could swap that out for your own list of items.

untold rover
#

ah okay cool, I will save it and take a look in a sec

odd gulch
odd gulch
#

It is a configurationssection

brittle nova
#

what do I have to change?

compact haven
glossy scroll
fresh heath
#

I want to do if Player has hit entity 10 times he will gain strength

glossy scroll
#

But replace key with whatever key you want

cinder thistle
glossy scroll
#

And replace HashMap with whateber map object

fresh heath
#

yes I replaced the key with "hashitmanytimes or cant it be that

quaint mantle
cinder thistle
#

Well yes but

glossy scroll
#

lmao that looks sick

quaint mantle
#

also it's not my creation I was just saying that soon guis will not need inventories, I'm not that advanced into it currently

glossy scroll
#

Do you know how that works

#

Like what makes that screen

quaint mantle
#

yes, command block, custom textures, handling using a minecart

minor garnet
quaint mantle
#

don't ask me what is behind it command block wise as I am working on the same kind of stuff but using the spigot api

brittle nova
odd gulch
ornate heart
#

how would i get a list of all the passive mobs in the game?

quaint mantle
#

I mean you can get the livingentities from entitytypes and just remove the ones you don't want

wraith rapids
#

get entity types, get the entity class from the type, check instanceof Animals

sharp bough
#

how can i save a world in the config file? im currently using
code

        return (World) Main.get().getConfig().get("config.spawnEnderDragon.world");
    }```

Location spawnLocation = new Location(getWorldSpawn(),getXSpawn(),getYSpawn(),getZSpawn());
Entity enderDragon = getWorldSpawn().spawnEntity(spawnLocation, EntityType.ENDER_DRAGON);```

config file: https://paste.md-5.net/zacirexupe.makefile

wraith rapids
#

String cannot be cast to World

#

you are saving/reading a string

sharp bough
#

but how do i save the world

wraith rapids
#

save it as either World::getUID or World::getName

sharp bough
#

if i need to use it

#

it cant be a string

wraith rapids
#

and then retrieve it as either Bukkit.getWorld(UUID) or Bukkit.getWorld(getName)

sharp bough
#

cuz later on i have things like getWorldSpawn().getEntities()

wraith rapids
#

UUID is not human readable, but is more robust and accurate

#

and make sure to null check the return value

#

as worlds may not always be present

sharp bough
#

so i save the name of the world

#

in the config file

#

and then call it

#

but i need to cast it to a world

wraith rapids
#

no

sharp bough
#

public World getWorldSpawn(){
return (World) Main.get().getConfig().get("config.spawnEnderDragon.world");
}

wraith rapids
#

you do not cast it to a world

#

you can not cast a string to a world

#

if you save it as a string, you get it as a string

sharp bough
#

yea but then

wraith rapids
#

you need to convert the string into a world

sharp bough
#

for(Entity e : getWorldSpawn().getEntities()){

#

that doesnt work

wraith rapids
#

convert it

sharp bough
#

if i save it as a string

wraith rapids
#

convert the world name to a world

young knoll
#

Does spigot have support for defining custom Tags via code or should I just use a set

south onyx
#
@EventHandler
    public void onInteract(PlayerInteractEvent e) {
        if (e.getItem() == null || tracker == null) {return;}
        if (e.getItem() != tracker || !stalkers.contains(e.getPlayer().getUniqueId())) {return;}
        Player stalker = e.getPlayer();
        if (runner != null) {
            Player blockrunner = Bukkit.getPlayer(runner);
            CompassMeta compassMeta = (CompassMeta) tracker.getItemMeta();
            if (compassMeta != null && blockrunner.getWorld() == stalker.getWorld()) {
                compassMeta.setLodestoneTracked(false);
                compassMeta.setLodestone(blockrunner.getLocation());
            } else {
                stalker.sendMessage(ChatColor.LIGHT_PURPLE + "You cannot track the runner because he isn't in the same world as you!");
            }
            tracker.setItemMeta(compassMeta);
        } else {
            stalker.sendMessage(ChatColor.DARK_AQUA + "There is no runner to track!");
        }
        
    }
#

code isnt running

#

when i click the tracker compass

#

and i am in the stalkers list

wraith rapids
#

e.getItem() != tracker
this will never return false

#

e.getItem() is always a different item than whatever you've set as tracker

#

== tests reference equality

#

also known as object identity

#

a == b it will return true if and only if a is b

#

use Objects.equals(a,b) instead

#

or ItemStack::isSimilar

south onyx
#

oh ok

#

thx

vital ridge
#

yo, is it possible to change enchantment book enchantment levels to over bukkit ones aka to unsafe enchantment levels

#

like sharpness 500 enchantment book

wraith rapids
#

ignoreLevelRestriction - this indicates the enchantment should be applied, ignoring the level limit

left swift
#

How can i make snowball invisible?

wraith rapids
#

you can't

#

did you teleport the armorstand in the player move event

#

or only once every tick

left swift
left swift
wraith rapids
#

how much lag are we talking about

#

i remember seeing people doing this by teleporting the thing manually and it looked smooth enough to mistake as perfectly synchronous

#

are we talking like a few hundredths of a block or larger

torpid hemlock
#

i want to do that if someone clicks better with an item then i take that item from the player. i tried this but the server crashed. What could be the problem? /with translator, sorry/

wraith rapids
#

what

ornate heart
#

Is it possible to detect whether a player right clicks with nothing in their hand? The PlayerInteractEvent doesn't fire unless there's something in the player's hand

torpid hemlock
#

code:

#

public class Events implements Listener{
public static String effect;
public static int duration;
public static int level;
public static String display_name;
@EventHandler
public static void onRightClick(PlayerInteractEvent event) {
if (event.getItem() != null) {
if (Commands.requested_item) {
effect = Files.items.getString(Commands.arg_null + ".effect").toUpperCase();
duration = Files.items.getInt(Commands.arg_null + ".duration");
level = Files.items.getInt(Commands.arg_null + ".level") - 1;
display_name = Files.items.getString(Commands.arg_null + ".name");

            if (event.getItem().getItemMeta().equals(Commands.wand.getItemMeta())) {
                Player player = event.getPlayer();
                player.addPotionEffect(new PotionEffect(PotionEffectType.getByName(effect), duration, level));
                player.getInventory().remove(player.getItemInHand());
            //    player.sendMessage("asd");
            }
        }

    }
}

}

ornate heart
#

Don't know if that is directed at me, but the event doesn't fire at all when I have nothing in my hand so this wouldn't work.

wraith rapids
#

uuh

#

iirc it fires

#

but it's cancelled by default

#

if it doesn't fire, there probably isn't much you can do about it

#

the client probably just doesn't send any packets for it

ornate heart
#

Unlucky. Alright, then.

left swift
wraith rapids
#

well, if you can't get teleporting to work properly

vocal shuttle
#
29.04 13:23:20 [Server] INFO org.bukkit.plugin.InvalidPluginException: Unsupported API version 1.16.5
``` what does this mean
wraith rapids
#

you can hide the slime or whatever by filtering out the packets with protocollib

#

1.16.5 is not an api version

#

api versions don't include the minor/patch version number

#

use 1.16

vocal shuttle
#

ok thanks

left swift
wraith rapids
#

i'm sure a plugin like this exists already

#

maybe see if you can find an open source one and see what they did

#

i know at least one exists because I saw some screenshots about one on the paper discord a year or two back

left swift
opaque pendant
#

ik a bit off topic but whats the permission node to for a default player to tp somewhere

wraith rapids
#

a library mentioned in this thread

opaque pendant
#

yes

wraith rapids
#

which was the first google result for "show text over player name spigot plugin"

#

or something

opaque pendant
wraith rapids
#

permission nodes are managed by plugins

opaque pendant
#

yeah im using luck perms

wraith rapids
#

they are also interacted with by plugins

#

ask whoever wrote whatever plugin you're using for teleporting

opaque pendant
#

hmm but /tp is a default command by mojang

wraith rapids
#

that is like uh

#

minecraft.command.tp, maybe

#

i don't remember the format they use

opaque pendant
#

ok let me see but wouldnt they be able to then tp all the time anywhere

#

when theyll get the perms

wraith rapids
#

yes

#

that's what the minecraft:tp command does

#

if you want more accurate control over what the players do, get a plugin that provides a better teleport command

#

and give them the permission of that plugin

opaque pendant
#

Ok

#

roger that lol thanks

#

just realized u are not a mod why u helping then

wraith rapids
#

you are also in the wrong channel

opaque pendant
#

yeah ik but why u helping random people when u are not a mod

wraith rapids
#

99% of people who help people here are not mods

#

there are like 4 mods on this discord and they're active once every few weeks

opaque pendant
#

LOL thanks again u helped me before 2

olive lance
#

can we get other payment methods than shitty paypal on spigot

#

should be able to accept crypto for resources fr

vital ridge
#
if (i != null) {

                        if (i.getItemMeta() instanceof EnchantmentStorageMeta) {

                            System.out.println("It is!");

                            EnchantmentStorageMeta eMeta = (EnchantmentStorageMeta) i.getItemMeta();

                            Map<Enchantment, Integer> enchants = eMeta.getEnchants();

                            NamespacedKey bookKey = new NamespacedKey(main, "UUID");

                            if (!eMeta.getPersistentDataContainer().has(bookKey, PersistentDataType.STRING)) {
                                
                                System.out.println("Not multiplied yet");

                                for (Enchantment ench : enchants.keySet()) {

                                    int oldValue = enchants.get(ench);
                                    Enchantment oldEnchant = ench;
                                    
                                    System.out.println(oldEnchant + " " + oldValue);

                                    eMeta.removeStoredEnchant(ench);

                                    eMeta.addStoredEnchant(ench, oldValue * main.multiplier, true);

                                }

                                eMeta.getPersistentDataContainer().set(bookKey, PersistentDataType.STRING,
                                        UUID.randomUUID().toString());
                                i.setItemMeta(eMeta);

                            }
                        }
                    }

For some reason the for loop is not running (the debug message inside it is not working. I cant understand why is that. Enchanted book keySet type is still Enchantment right?

wraith rapids
#

it's probably empty

#

for loops run once for each element of a collection

#

if the collection is empty, it runs 0 times

quaint mantle
#

Could some1 help me with world guard on my server? maybe join and show me?

wraith rapids
#

ask the people in #help-server

unkempt ore
#

What does Material.getMaterial(String) accept

#

It "attempts to get" a material with the name, but that's quite vague

#

Is it different from its valueOf?

wraith rapids
#

is it nullable? if so, it probably just returns null rather than blowing up with an exception

unkempt ore
#

matchMaterial(String), too, what are these

wraith rapids
#

as for the exact semantics, dunno

#

i guess I could check the source

#
    @Nullable
    public static Material matchMaterial(@NotNull final String name, boolean legacyName) {
        Validate.notNull(name, "Name cannot be null");

        String filtered = name;
        if (filtered.startsWith(NamespacedKey.MINECRAFT + ":")) {
            filtered = filtered.substring((NamespacedKey.MINECRAFT + ":").length());
        }

        filtered = filtered.toUpperCase(java.util.Locale.ENGLISH);

        filtered = filtered.replaceAll("\\s+", "_").replaceAll("\\W", "");
        return getMaterial(filtered, legacyName);
    }
unkempt ore
#

Oh, I see

#

Does Material.toString() make it in ...:... format? I'll tias in a bit if you don't know

wraith rapids
#

and the javadoc for the getMaterial one is pretty self explanatory

#

This is a normal lookup, names must be the precise name they are given in the enum.

#

it just returns null instead of throwing an exception if there is no matching name

#

material doesn't override toString

#

so it just returns the enum constant name

severe zenith
#

what is sender.getName() when you execute from console?

sage swift
#

probably CONSOLE

#

you could try it

severe zenith
#

thx

wraith rapids
#

that you asked that is very dubious

#

you aren't trying to tell the difference between a console command sender and a player command sender by looking at their name, are you?

#

if you want to know whether the console sent it, if (sender instanceof ConsoleCommandSender)

mortal hare
#

^^^by 1000% he is correct

wanton cipher
mortal hare
#

that's a gui

chrome beacon
#

Yes

mortal hare
#

not a rankshop

vital ridge
#

anybody has any ideas how to play with the particle render distance?

#

There doesnt seem to be any render distance integer in spawnParticle

#

only spawnEffect

#

or playeffect

#

or whatever it was

mortal hare
chrome beacon
#

Listen to packets and cancel them if they're outside the range

mortal hare
#

they lack support from clientside to make them how you want them

chrome beacon
#

Make sure you've added customjoin to your plugin.yml

vital ridge
#

ive not worked

#

with particle packets

mortal hare
#

onEnable() -> 16 line. Value is null

vital ridge
#

and not with packets alot

chrome beacon
#

Have you worked with Protocollib before?

vital ridge
#

in general

#

nah

chrome beacon
#

Alright I'd recommend using that to make your life easier

vital ridge
#

kk wait

#

ill add it to my jards

#

jars

mortal hare
vital ridge
#

i want to decrease it

#

not increase

chrome beacon
#

It's not often you want to increase it

#

So I assumed he wanted to decrease

vital ridge
#

aight

#

I have it

#

So theres

#

A packetlistener

#

for particles there?

#

I mean the thing is

#

My plugin sets 1 player to generate permanent particle trail behind him

#

And there are followers who need to follow it

#

And if the particles are enough blocks away from whatever player

severe zenith
chrome beacon
vital ridge
#

then it wont render

#

to decrease the lag

#

client fps lag

chrome beacon
#

Does file size matter?

#

if not go grab PacketWrapper

vital ridge
#

no it doesnt

#

Aight

#

Idk how to exactly use them tho

#

so if you could give me an example

#

that would rly help

chrome beacon
#

I'll explain don't worry

#

Just get those dependencies installed

vital ridge
#

this one right?

chrome beacon
#

Yes

vital ridge
#

yea

#

got em

chrome beacon
#

Aight

wanton cipher
#

any1 can tell me how to make something like this?

chrome beacon
#

Are you coding or looking for a plugin

vital ridge
#

talking to me?

chrome beacon
#

no

ivory sleet
#

olivo 🆒

chrome beacon
#

Now do this to register your listener:

ProtocolManager manager = ProtocolLibrary.getProtocolManager();
manager.addPacketListener(new PacketAdapter(plugin, ListenerPriority.NORMAL, PacketType.Play.Server.WORLD_PARTICLES) {
    @Override
    public void onPacketSending(PacketEvent event) {
        Player player = event.getPlayer();
        WrapperPlayServerWorldParticles packet = new WrapperPlayServerWorldParticles(event.getPacket());
        //Handle the distance check and cancel etc
        
    }
});
#

@vital ridge ^^

vital ridge
#

Okay but

#

Gotchu

#

the code makes sense

#

and i understand it

#

but

#

Is this working for per player

chrome beacon
#

Yes

vital ridge
#

Gotchu

chrome beacon
#

It will be called for every particle packet sent

#

So don't do anything too crazy

vital ridge
#

I mean

#

I need to get the player

#

get the packet

#

or wait

chrome beacon
#

Yeah my example contains that

vital ridge
#

particle is the packet right?

#

yeah it is

#
WrapperPlayServerWorldParticles packet = new WrapperPlayServerWorldParticles(event.getPacket());
chrome beacon
#

Yeah use packet.getParticle()

vital ridge
#

Mhm thanks ill finish it

chrome beacon
#

You can also get x y z directly from the packet

#

I think you can solve the rest

languid crown
#

hey, would it possible to do this:

item that when used spawns a random structure infront of them, conditional to the world there in (if in overworld, possible structures would include: Village, Ruined portal, Pillager outpost, ocean monument, stronghold, ect. Nether structures would include: Nether fortress, Bastion, Ruined portal. End structures would include: End City.

chrome beacon
#

Yes that would be possible

languid crown
#

are there any forums on it that i could look at?

chrome beacon
#

Not that I know of

#

If this is your first plugin I'd recommend starting with something easier

languid crown
chrome beacon
#

oh

languid crown
#

ah

#

ty

chrome beacon
#

Might need some updating

languid crown
#

i will show this to the person

chrome beacon
#

?services

queen dragonBOT
severe zenith
#

can you make aliases in bungeecord?

hollow arch
#

Heya 👋 - Without using 3rd party software, is there no better way of checking if a player has entered a region other than listening on PlayerMoveEvent or something like that and checking if there are any worldguard regions?

#

Obviously PlayerMoveEvent would be reallly lagy

vital ridge
#

shouldnt it be ;?

chrome beacon
#

So the {} goes around the override

#

._.

#

You only extend your main class with JavaPlugin

#

Not every single class

#

Use Dependency Injection

ivory sleet
#

lmao

vital ridge
#

Okay its telling me

#

that my constructor is undefined

merry kindle
#

What is the best way to manage items and materials both custom?

vital ridge
#

somehow

#
public class ParticlePacket implements Listener {

    private FollowMe main;

    public ParticlePacket(FollowMe main) {
        this.main = main;
    }
    
    ProtocolManager manager = ProtocolLibrary.getProtocolManager();
    manager.addPacketListener(new PacketAdapter(main, ListenerPriority.NORMAL, PacketType.Play.Server.WORLD_PARTICLES) {
    @Override
    public void onPacketSending(PacketEvent event) {
        
        
            }
    
        });
    
    

}
ivory sleet
merry kindle
#

what you mean?

ivory sleet
#

what are those items and materials for

chrome beacon
#

and what do you want them to do

ivory sleet
#

what functionality categorizes them as custom

vital ridge
#

Olivo did you write your code in your IDE, cuz mine giving me lots of errors with parantheses

#

not lots but few

chrome beacon
#

I wrote it by hand directly in to discord

vital ridge
#

Yea well its telling be the packetadapter is undefined

chrome beacon
#

Starts Intellij to double check everything

merry kindle
#

materials for crafting, custom blocks to place down and get the materials, custom items like how hypixel skyblock has there items where you can right click and it does special stuff and things like that

ivory sleet
#

oh okay

chrome beacon
merry kindle
#

i wish spigot had multiple channels

chrome beacon
#

You can't just run code outside of one

vital ridge
#

I mean the packetevent thing

#

is also

#

a method

#

isnt it?

#

or its smthing different

#

that can be used

ivory sleet
#

Idk I mean just make a design which contains somewhat scalability ninjablader

vital ridge
#

Nvm

#

1 sec

#

now it worked

#

im just dummy

merry kindle
#

i mean ye but like what would that system be

ivory sleet
#

I would make some sort of registry for all the items/materials and then continue from that

vital ridge
#

@chrome beacon if i want to get the particles location, do i have to only work with x y z? Cuz i cant seem to find getlocation or smthing

ivory sleet
#

(Might be somewhat similar to an enum or just a pseudo enum (assuming you want some sort of generics involved which might not be a dumb idea to distinguish types))

vital ridge
#

i mean simply id do p.getlocation.distance(e.getparticle.getlocation)

#

but i assume this here is not that simple

#

and i didnt find the location method

chrome beacon
#

Create a new location with get x y z

#

and then compare that

vital ridge
#
Location particleLoc = new Location(p.getWorld(), packet.getX(), packet.getY(), packet.getZ());
#

just the packet confused me lil bit

#

didnt know if it takes the actual particle

grand cove
#

Hello! is it possible to open a 2x2 crafting inventory using a command?

#

(the one with the player's equipment)

chrome beacon
#

It's not possible

grand cove
#

D:

chrome beacon
#

Why do you want to open the 2x2 one

grand cove
#

Making a custom equipment system

#

for giving items to minions

vital ridge
#

Olivo, only calling my method now will start the particle event?

#

or it works like a normal one?

#

I mean i have it registered

chrome beacon
#

Once it's registered you're done

vital ridge
#

gotchu

chrome beacon
#

Every single particle will be sent through that

#

(Keep in mind there are some client particles that the server can't change)

vital ridge
#

I see

#

Im using redstone particles

#

and spawning them also with my code

#

so i should be fine

#

I need to have protocollib on my server also

#

right?

chrome beacon
#

Yes and PacketWrapper

vital ridge
#

@chrome beacon you sure only registering in main class is enough?

#

I added some debug messages

#

and the event seems to be not running

chrome beacon
#

Are you registering it

vital ridge
#

yes

chrome beacon
#

Put some debug messages and make sure the register method is run

eternal oxide
#

annotated?

vital ridge
#

i added debug messages

#

i registered the method

#

heres my code

#

the event*

#
public class ParticlePacket implements Listener {

    private FollowMe main;

    public ParticlePacket(FollowMe main) {
        this.main = main;
    }

    public void PacketListener() {

        ProtocolManager manager = ProtocolLibrary.getProtocolManager();
        manager.addPacketListener(
                new PacketAdapter(main, ListenerPriority.NORMAL, PacketType.Play.Server.WORLD_PARTICLES) {
                    @Override
                    public void onPacketSending(PacketEvent e) {
                            
                            System.out.println("true");

                            Player p = e.getPlayer();
                            WrapperPlayServerWorldParticles packet = new WrapperPlayServerWorldParticles(e.getPacket());

                            Location particleLoc = new Location(p.getWorld(), packet.getX(), packet.getY(),
                                    packet.getZ());

                            if (p.getLocation().distance(particleLoc) >= 10) {
                                
                                System.out.println("Loc true");

                                e.setCancelled(true);
                                
                                System.out.println("cancelled");

                            }
                        

                    }

                });

    }

}
chrome beacon
#

Aight now send the main class

vital ridge
#
public class FollowMe extends JavaPlugin {
    
    static HashMap<Player, UUID> playerToFollow = new HashMap<>();
    
    public static boolean eventStatus = false;
    
    public static Player p;
    
    public static UUID playerToFollowUUID;
    
    public static Location spawnLoc;
    
    public static Location trailLeaderDeathLoc;
    
    public static boolean confirmation = false;
    
    public static boolean bounceBackStatus = false;
    
    @Override
    public void onEnable() {
        
        PluginManager pm = this.getServer().getPluginManager();
        
        pm.registerEvents(new ParticleTrail(this), this);
        pm.registerEvents(new JoinEvent(this), this);
        pm.registerEvents(new PortalTravelEvent(this), this);
        pm.registerEvents(new DeathEvent(this), this);
        pm.registerEvents(new DamageEvent(this), this);
        pm.registerEvents(new ParticlePacket(this), this);
        
        getCommand("followme".toLowerCase()).setExecutor(new FollowMeCommand(this));
        getCommand("followme".toLowerCase()).setTabCompleter(new FollowMeTabCompleter(this));
        
    }

}
chrome beacon
#

Where are you creating the PacketListener

vital ridge
#

in my events package, ParticlePacket class

eternal oxide
#

No annotated event to register

mortal hare
vital ridge
#

merge my listeners?

vital ridge
vital ridge
chrome beacon
#

Create a new instance

#

of PacketListener

#

Now you're in basic java teritory

eternal oxide
#

PacketListener isn;t a Spigot event

vital ridge
#

ik

#

i need to call the method

#

under onenable

eternal oxide
#

You can't label it a Listener class and expect it to register as a listener

#

I'm going to assume its an event from Protocol lib

vital ridge
#

y

eternal oxide
#

Just guessing then add the annotation to PacketListener @EventHandler

vital ridge
#

Its still not doing sht

eternal oxide
#

Why do you have a method inside another method? onPacketSending is inside PacketListener . Makes me think you have it all wrong.

#

Does your IDE not have a warning on the overide of onPacketSending?

vital ridge
#

it doesnt

eternal oxide
#

Well for starters, you can;t have a method inside another method

#

Your IDE shoudl be throwing a fit

vital ridge
#

I know that, It's just made me think that there are exceptions or smthing

#

Using the protocollib api

#

Ive never used it before

#

Ik the basics tho, so that completely my fck up

warm raft
#

is there an event for when a dispenser places a block? i.e a skull

mortal hare
#

dispenser can place player heads?

#

😮

warm raft
#

yeah

#

I'm trying to make/implement an event for when creatures are "built" (hopefully pr'ing too)

#

so I'm trying to figure out how to go about it. Basically, I'm not sure how to deal with the fact both a dispenser and a player can "build" Golems and the wither

sage swift
#

CreatureSpawnEvent#getSpawnReason

warm raft
#

yes but I can't get the blocks transformed

#

the event i'm trying to add will preserve which blocks were changed into air

novel hornet
#

how do i give leather armor a special Hex code

sage swift
#

LeatherArmorMeta

wind grove
#

hello (sorry for my english), I just start to try plugin dev, and I saw tath inventory.getName() does not work anymore. But I also saw tath a lot of peopl say tath it's a bad practice to use getName() ( in order to check inventory) so what could I do in my case please ?

sage swift
#

use an InventoryHolder object

#

or store open inventories in a Map<UUID, InventoryView>

wind grove
#

I must learn about tath

#

thanks

sage swift
wind grove
#

oh thx !

torn oyster
#

hey

#

how would i make a random

sage swift
#

new Random()

torn oyster
#

no

#

make numbers more rare the higher they area

#

are

#

im making a levelling system on mobs

#

and i want lvl 1 -10 to be most common

#

and level 100 to be very rare

sage swift
#

gaussian

torn oyster
#

how would i use this

eternal oxide
torn oyster
#

i have this

#

int level = rand.nextInt(99) + 1;

#

what do i make it

#

instead

sage swift
#

hmm... theoretically, is there a max to nextGaussian?

torn oyster
#

wait so gaussian makes it like

#

1 most common

#

100 most rare

sage swift
#

(int) (Math.max(2, Math.abs(rand.nextGaussian())) * 50)

torn oyster
#

is that it

sage swift
#

i have no idea

torn oyster
#

so ill be seeing a lot more lvl 1s

#

instead of lvl 99s

#

and stuff

sage swift
#

looks like it'll work to me

torn oyster
#

cuz lvl 100 creepers have a 20 block explosion radius

#

and break shields basically instantly

sage swift
#

you could also make it max(4, Math...) * 25 for even more lower levels

torn oyster
#

this aint right

sage swift
#

sorry, min

#

not max

torn oyster
#

oh lol

#

bout to have lvl 100 creepers all around the place

#

does the game look good lol

viscid oasis
#

How can I give player item based on mysql query number? Like I want to do it async, but is there a something, that I can use to wait with giving the itemstack until the async query is done?

eternal oxide
#

no

#

You do whatever you need to do once the query is done

torn oyster
#

why is there lvl 100 lol

eternal oxide
#

you can;t stop or pause an event

sage swift
#

are you still using min(2,...) * 50?

#

you can change those to your liking as long as the replacements multiply to 100

viscid oasis
torn oyster
#

oh lol

#

well this is nice

sage swift
#

i suggest trying the 4 * 25

torn oyster
#

im doing * 20