#help-development

1 messages · Page 2124 of 1

quiet ice
#

🤦‍♂️

golden turret
#

you used your command and did /reload

harsh totem
#

And when the player is invalid I get no error message

                    try {
                        Player player2 = Bukkit.getPlayerExact(args[0]);
                        try {
                            int seconds = Integer.parseInt(args[1]) * 20;
                            player2.setFireTicks(seconds);
                        } catch (NumberFormatException nfe) {
                            player.sendMessage(ChatColor.RED + "That is not a valid number");
                        }
                    } catch (IllegalArgumentException e){
                        player.sendMessage(ChatColor.RED + "That is not a valid player");
                    }```
golden kelp
#

xd

harsh totem
#

???

golden turret
#

?jd-s time

undone axleBOT
eternal oxide
#

you can;t send a message to a null player

#

oh I see player2

#

the outer try will throw an NPE not an IllegalArgumentException

tardy delta
#

do a nullcheck

#

dont dare to catch npe's

harsh totem
shy wolf
#

does any one know how to rotate a beacon?

tardy delta
#

isnt that client side?

tardy delta
shy wolf
#

maybe

tardy delta
#

did you google it

shy wolf
#

i didnt found any thing

gusty gorge
#

So, I want to show an entity’s health as their name. I have gotten it all to work except that the name tag doesn’t update after taking damage, only after hitting it once more. Is there a fix for that?

golden turret
shy wolf
golden turret
#

yes

#

with code

shy wolf
#

what code

gusty gorge
#

Probably using a custom model

shy wolf
golden turret
shy wolf
#

onde?

#

did you mean code?

#

ok than what is the code

golden turret
#

idk 😭

#

everything could be serverside

shy wolf
#

i think its a custom model

#

i will try

#

to do it

golden turret
#

i dont think so

#

i searched a lot about beacons

#

and everything said

#

beacon beam is 100% clientside

#

hardcoded

shy wolf
#

yea

#

the textur

golden turret
#

you may edit the texture

#

but not the direction it goes

shy wolf
#

yea

gusty gorge
#

I think a possibility would be to set an item with the beam model as the head item of an armor stand

shy wolf
#

maybe

#

im downloading blockbench so i will model a think

#

idk

golden turret
#

it is not possible

#

or will use armorstands to simulate that?

#

if so, consider using the guardian beam

shy wolf
golden turret
#

use the guardian beam

#

it will be cool enough

shy wolf
#

is it entity?

#

or particle?

#

wait particle its not

#

my bad

#

oh textur

#

im dum

golden turret
#

5 seconds google answers that

#

guardian beam spigot

tardy delta
#

lookup spigot rotate beacon

#

very good responses

tardy delta
#

?ask

undone axleBOT
#

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

daring lark
#

did someone know gson well?

dire marsh
#

...read the above

daring lark
#

just ask it lol

dire marsh
#

yes

daring lark
#

ooo

#

i got it

brittle lily
#

How Can I send Message Only Admins? I found Bukkit.broadcast but doesnt work

tardy delta
#

dunno if being op has a permission but you could do it with a simple for loop too

tardy delta
#

i know

brittle lily
# tardy delta i know

What is wrong with it.. Its sending message just 1 op person. I tried Bukkit Broadcast too and It doesnt send anybody I think I enter permission wrong

tardy delta
#

Player staffs

#

smh

#

why returning true btw

safe notch
#

why is there a return true Inside 🤔

dark arrow
#

How to add cooldown on player interact event

tardy delta
#

map<uuid, epoch time>

#

there are some thread bout it

brittle lily
brittle lily
ivory sleet
#

broadcastMessage()

safe notch
brittle lily
#

oh okay thanks Im trying

ivory sleet
#

since that fills out a default permission for you contrary to just broadcast()

dark arrow
brittle lily
tardy delta
ivory sleet
#

nah

brittle lily
safe notch
ivory sleet
#

but permissions have default set to op

safe notch
#

oh

ivory sleet
#

hence why ops get most permissions

brittle lily
#

What Should I do rn

ivory sleet
#

anyway ARDA as said I'd suggest using Bukkit::broadcastMessage

brittle lily
#

oh okay then?

ivory sleet
#

if you're well... not creative to come up with a permission Ig

#

else

#

mye

brittle lily
ivory sleet
#

yeah but it'd mostly be to verify that your code actually goes that far

#

then just substitute it to the normal broadcast method

brittle lily
#

okay thanks

ivory sleet
#

I mean that perm node is set to true for everyone I believe

#

that unless you changed it

smoky oak
#

my solution is java AdminLog(string Message){ Bukkit.broadcastMessage(string, '*'); }

prisma needle
#

Where to start learning to make a plugin like dynmap

smoky oak
#

on a different topic can i access player statistics via a command?

ivory sleet
#

ideally you should use bukkit.broadcast.scradmin for administrative broadcasts

#

as thats also a regulated bukkit permission

smoky oak
#

whats that 'scr' short for?

brittle lily
#

I SOLVED!

steep rose
#

is there an event for blocks being broken by non player sources, e.g /setblock and /fill?
i don't think you can use BlockBreakEvent because according to IntelliJ e.getPlayer() != null is always truu

smoky oak
#

op is every permission tru i believe

tardy delta
#

op doesnt neccesarily have all permissions

#

dont know how to write that word lol

tardy delta
#

if the permissiondefault for it in FALSE that ops wont have it by default

supple elk
#

I've set up a listener for EntityDamageByEntityEvent

#

but it appears to be triggering on EntityDamageEvent

sharp flare
#

do a cast check

supple elk
#

sure, but why is it triggering in the first place?

tardy delta
#

casting where?

supple elk
#

When the consumer is cast

tardy delta
#

probs bcs of the generics

supple elk
#

it works for other things

dire marsh
#

entitydamagebyentityevent extends entitydamageevent

tardy delta
#

yeee

#

was trying to type that out

dire marsh
#

xd

sharp flare
#

and generics though

supple elk
sharp flare
#

its the superclass of that event it inherits some stuffs probably

dire marsh
#

yes

#

your class handling stuff is wrong somewhere

supple elk
#

hmmm

agile solstice
#

Question, is there any way I can let people make their own servers when on my server through a command and have it get automatically connected to my Server?

#

Through Bungeecord , btw

quaint mantle
#

Update on my issue: Its NOT because of interactionEvent.
It has something to do with the event itself, firing twice for 0 reason.

supple elk
#

I use the second constructor

midnight shore
#

?stash

undone axleBOT
supple elk
quaint mantle
#
public class RightClickItem extends Event {
    private static final HandlerList HANDLERS = new HandlerList();
    private final PlayerInteractEvent event;
    private final CustomStates type;

    public static HandlerList getHandlerList() {
        return HANDLERS;
    }

    public RightClickItem(PlayerInteractEvent event, CustomStates type) {
        this.event = event;
        this.type = type;
    }

    @Override
    public HandlerList getHandlers() {
        return HANDLERS;
    }

    public CustomStates getType() {
        return this.type;
    }

    public PlayerInteractEvent getMainEvent() {
        return this.event;
    }
}

Does anybody see a reason for my custom event (VIA Spigots EventAPI) to run twice?

#

Cause its only being called once, I just checked.

supple elk
supple elk
#

so the EntityDamageByEntityEvent class is definitely the class which is passed into the function which registers the listener

#

so it must be some internal weirdness with the events

sharp flare
supple elk
#

is my best guess

quaint mantle
smoky oak
#

one sec that happens to me every time

quaint mantle
#
@EventHandler
    public void clickEvent(PlayerInteractEvent event) {
        ItemStack item = event.getItem();
        Block block = event.getClickedBlock();

        if(event.getHand() == EquipmentSlot.HAND){
            if(event.getAction() == Action.RIGHT_CLICK_AIR){
                handleRightClickAir(event, item);
            }else if(event.getAction() == Action.RIGHT_CLICK_BLOCK){
                handleRightClick(event, item, block);
            }
        }
    }
#
private void handleRightClickAir(PlayerInteractEvent event, ItemStack item) {
        if(item != null){
            System.out.println("Hey!");
            Bukkit.getPluginManager().callEvent(new RightClickItem(event, CustomStates.AIR_ITEM_OFF)); //Air clicked by Item.
        }
    }
#

It calls the event, only once

#

Yet its running twice

supple elk
#

called for each hand

smoky oak
#

event.getAction() == Action.RIGHT_CLICK_BLOCK && event.getHand() == EquipmentSlot.HAND

quaint mantle
tardy delta
sharp flare
#

its called twice by default

smoky oak
#

forgetting either of those checks results in double event iirc

quaint mantle
supple elk
quaint mantle
#

you can see I did that check

#

what do I have to do it again in RightClickItem?

agile solstice
smoky oak
#

lemme check smth

undone axleBOT
#

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

smoky oak
#

well with that chek it only triggers once for me
granted i have a third condition checking the right clicked block but i reay doubt thats the issue

quaint mantle
#

So, the event itself is running Once

#

Any issue here?

#
@EventHandler
    public void onRightClickItem(RightClickItem event) {
        Player eventPlr = event.getMainEvent().getPlayer();
        ItemStack eventItem = event.getMainEvent().getItem();

        if(eventItem == null)
            return;

        PersistentDataContainer itemPerst = eventItem.getItemMeta().getPersistentDataContainer();

        if(itemPerst.get(NamespaceKeyList.getKey("coin"), PersistentDataType.STRING) != null){
            eventItem.setAmount(eventItem.getAmount() - 1);
            eventPlr.sendMessage(ChatColor.GREEN + "Gained 1 coin! Congrats!");
        }
    }
#

This is the only reason it would run twice now

desert musk
#

Guys i recently wiped one of my pcs and now i'm trying to transfer and existing github project to it and it comes with a lot of errors

#

i also have a working instance of the project on my laptop

#

but does anyone know how to properly bring projects from one device to another in IntelliJ?

#

if so please @ me

quaint mantle
tulip harbor
#

ello! i'm new to plugins, i was wondering how to "mark" a block (like a chest) so i can change it's nbt later, could anybody help me with this?

smoky oak
#

dumbest mistake of the week: int x = Location#getBlockZ()

smoky oak
#

alternatively store the location in a set somewhere

#

depending on if you meant to see later on if the block's marked (ie over restarts) or if you want it in some sort of temporary mechanic

quaint mantle
#

I fixed it.

#

I was generating the coin twice.

#

So it was running registerEvents twice

#

:P

smoky oak
#

thats why you use copious amounts of log messages

tardy delta
#

i would just do

abstract class CustomItem {
  // fields and stuff
  @EventHandler
  abstract void onRightClick(InventoryClickEvent event);
  // maybe even ::onLeftClick too
}```
#

instead of creating a custom class for it

fervent gate
#

What is the best way to add a delay to something like when I want to add time between messages in a dialog. I'm using Thread.sleep() but that is giving a lot of red errors.

supple elk
#

Back on the issue I was having before

#

I printed out the class being passed into the listener just to be sure

#

and it's definitely EntityDamageByEntity event

undone axleBOT
golden turret
#

^

smoky oak
#

minecraft is mostly single threaded

#

use delayed schedulers

supple elk
#

I set up some separate listeners for EntityDamageByEntity event and they won't being triggered on regular damage events

tardy delta
#

thread.sleep will freez the server very nicely 🤤

smoky oak
#

yep

golden turret
#

only if you are using multiple threads by any chance

supple elk
#

but for some reason this one does?

golden turret
#

like new Thread

fervent gate
#

Ok, I'll use scheduling, thanks

smoky oak
#

also take note that scheduling brings along its own issues, if you schedule too many things it ll cause issues

#

if you need to set long delays call one scheduler that then checks if something should be ctivatedby for exammple making it check over a set of objcts that contain a activation time field

steep rose
tardy delta
#

lmao

supple elk
#

Ok these are different

#

Event 1

#

Event 2

#

With EntityDamageByEntityEvent.class having been passed in as eventClass

#

why are these not identical??

#

I'm guessing it's something to do with the generics but how??

coarse finch
#

i am trying to use https://github.com/dejvokep/boosted-yaml and have the following code to shade it but i get the error groovy.lang.MissingMethodException: No signature of method: build_98ejwwytx8c7e1j7kkucfbrye.shadowJar() is applicable for argument types: (build_98ejwwytx8c7e1j7kkucfbrye$_run_closure3) values: [build_98ejwwytx8c7e1j7kkucfbrye$_run_closure3@3d2ecc65]

shadowJar {
    relocate('dev.dejvokep.boostedyaml', 'me.kidneybean.generalutils.shadowed') {
        include(dependency('dev.dejvokep:boosted-yaml:1.1'))
    }
}```
#

i think i got it

supple elk
#

Also it's triggering on a player interact event???

#

Anyone have any ideas?

#

I've somehow made a listener which listens to multiple events at once

tardy delta
#

kek

#

magic

#

new feature

supple elk
#

what have I donneeee

#

fourteen brush plz hellppp

#

How are these situations not identical >_>

tardy delta
#

idk lol i barely touched generics in java

supple elk
#

fffffffffff

tardy delta
#

i guess entitydamagebyentityevent extends playerinteractevent

#

have fun to read that

supple elk
#

but why does it trigggerrr

#

how does it listen to MULTIPLE THINGGSSS

#

I am literally shaking and crying rn

#

there

#

I have simplified it

#

so it is easy to see what is going on

#

and how you can see how these things are literally the same

smoky oak
#

thats because entityDamageEvent is part of EntityDamabeByEntityEvent. Every EntityDamageByEntityEvent also is a EntityDamage envent and triggers it

supple elk
#

Yes but I am listening to entitydamagebyentity event

#

not the other way around

#

So EntityDamageEvent should not trigger EntityDamageByEntity event

#

look

#

both are registered for EntityDamageByEntityEvent

#

I print it

#

in the class of the abstract listener

#

why the things extend

tardy delta
#

an entity being damaged by an entity calls a damage event and an interact event

supple elk
#

so why does one pick it up and the other doesn't??

#

If I punch a chicken

#

both events fire

#

but if something just gets hurt

#

like I jump off a cliff

#

ONLY event 2 fires

#

but they are identical??

#

both are passed the EntityDamageByEntity event when they fire

supple elk
#

so how tf

#

have I managed to make one of them listen to multiple events

#

I

#

do

#

not understand

smoky oak
#

seriously? Fall damage triggers EDbE?

supple elk
#

no

#

it triggers an EntityDamageEvent

smoky oak
#

there you have it

supple elk
supple elk
#

only event 2 is fired

smoky oak
#

the entityDamageeEvent gets fired whenever something takes damage

#

on top of that EDbE gets fired whenever its an entity damaging another entity

supple elk
#

I am listenting to entity damage entity event

#

They are both the same

tardy delta
supple elk
#

ok I'm gonna rename my messages to listener rather than event so it is clearer

#

I jump off a cliff

#

I punch a chicken

#

first time, just the second listener triggers

#

second time, both listeners trigger

#

the listeners are listening to the same event

tardy delta
#

does EntityDamageByEntityEvent#toString provides anything good for debugging?

echo basalt
#

why reload

supple elk
#

the same

tardy delta
#

because lazy

supple elk
#

you can see they are registered for the same event here

#

which is printed in the constructor of the abstract listener

sharp flare
#

I guess you gotta handle the event yourself once casted, maybe try doing damageCause checks?

tardy delta
#

ye

supple elk
#

lets check

tardy delta
#

dunno if it has an impl

supple elk
#

why do some events trigger for one and not the other?

sharp flare
#

probably cuz ur using generics

supple elk
#

I hurt myself

#

I punch chicken

#

Printing event reveals nothing

supple elk
#

so why would they fire in different cases?

shy wolf
#

does any one know why I don't see the guardian Laser?
I see just the water (I'm using guardianbeam)

supple elk
#

and the generics are not causing an issue for Listener number 1

sharp flare
#

yeah cuz ur passing a specific event there

supple elk
#

Am I not in the second case?

#

at runtime the registerEvent() function recieves the same value

#

for both

#

How can there be a difference here?

sharp flare
#

is the abstract listener triggered everytime you get hit or damaged?

supple elk
#

the second one is

#

the first one is not

#

Even though they are registered under the same EntityDamageByEntityEvent

supple elk
#

triggers when any entity is hurt by another entity

#

the second one is misbehaving

#

and triggers on any damage event

quaint mantle
#

How would I create a custom textured block? I already have the texture pack btw

#

And no: I do not wish to have to sacrifice block data, or any of that.

sharp flare
#

and you have an overloaded constructor there so every time u get hit it registers a new event?

supple elk
#

I do not overload the constructor

#

I overload the trigger function

#

I am using the second constructor

#

which registers a listening for the provided class, and will execute the trigger function when fired

sharp flare
#

oh anonymous

supple elk
#

If anyone has any ideas that would be very helpful

sharp flare
#

if i can test this myself properly but then nah

#

it needs proper testing

shy wolf
#

@sharp flarecan you help me pls?

#

and sorry for ping

sharp flare
#

with?

sharp flare
#

no idea sorry

#

I barely have any experience with dealing guardians

#

cuz I dont spend most of the time in the ocean when I used to play minecraft

shy wolf
#

oh ok

eternal oxide
sharp flare
#

if its related with particles disabled then check it out

#

same with fabric sodium

shy wolf
eternal oxide
#

disable the shaders

supple elk
#

Elgar, any idea on the issue I'm having?

shy wolf
#

oh wait

#

i know what is the prablom

#

i think

#

nvm

eternal oxide
shy wolf
#

also everything is on

chrome beacon
#

Try without Optifine

shy wolf
#

wait its working

#

i dont know what i did

#

but its working

quiet ice
#

You might have invalid handler lists @supple elk but really I do not have an idea

versed plover
#

What event is being called when travelling in a minecart?

chrome beacon
#

BukkitAdapter

safe notch
#

com.sk89q.worldedit.world.World adaptedWorld = BukkitAdapter.adapt({world});

supple elk
#

Basically I have this class

#

which registers an event under the class passed to it, which will execute the trigger function when the event fires

#

That works

chrome beacon
native falcon
supple elk
#

The first one fires when it's supposed to, only on entity damage entity events

#

second one fires on any entity damage event

supple elk
#

do not know why

versed plover
#

I can't reset them, because that will upset the community

chrome beacon
#

You can track start and exit and see the change

supple elk
# supple elk

they are both being regisered under the same event, that's printed in the constructor of the AbstractListener

native falcon
versed plover
supple elk
#

anyway that's the run down @eternal oxide

versed plover
#

I find it strange that PlayerMoveEvent doesn't handle minecart movement, but does handle boat/horses/all other vehicles

supple elk
chrome beacon
quiet ice
supple elk
#

Is the registerEvent() function not passed the exact same thing?

supple elk
#

maybe it's the function which is passed to the registerEvent function?

#

The fact that's it's generic??

versed plover
supple elk
#

but then why would the other one work ;-;

chrome beacon
supple elk
#

Olivo perhaps you could take a quick look and see if you can shine light on the issue?

chrome beacon
#

I haven't read your conversation

#

What's the issue?

supple elk
quiet ice
#

What events are passed?

supple elk
quiet ice
#

the listener the recieves all events

supple elk
#

Any EntityDamage event

#

it's registered under EntiyDamageByEntiy event tho

eternal oxide
#

as the Cancelled state is from the parent event

supple elk
#

well, this is meant to be part of a more generic system

#

where I have a function which needs to take the class of something which is both an event and cancellable

#

but I shall try it

eternal oxide
#

Yes, but at teh moment you are stuck on finding where your issue comes from

supple elk
#

yup

native falcon
supple elk
quiet ice
supple elk
#

ok, now trying this

quiet ice
native falcon
#

Maven

supple elk
#

EntityDamageEvent

#

I think I might have seen an EntityDamageByBlock at one point?

supple elk
#

still fires

#

even without cancellable

eternal oxide
#

odd indeed

quiet ice
# native falcon Maven

        <dependency>
            <groupId>com.sk89q.worldedit</groupId>
            <artifactId>worldedit-core</artifactId>
            <version>7.3.0-SNAPSHOT</version>
            <scope>provided</scope>
            <exclusions>
                <exclusion>
                    <groupId>*</groupId>
                    <artifactId>*</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
supple elk
#

I suspect it's to do with the lamda on line 20?

quiet ice
#

You could just filter out invalid events, but this should be done by bukkit, not you

supple elk
#

that's the only difference I could see between them

supple elk
#

it's strange that one listener works fine

#

but not the other

#

I punch chicken and hunky dory

#

but other any EntityDamage event and 2nd triggers but first doesn't

#

second also triggers on damage by block

#

somehow I have created a listener which listens to multiple events

#

or maybe it's listening to any entity damage event

#

but why if the registerListener() function is passed the same class in both cases

eternal oxide
#

Your second Listener is triggering on all subclasses of EntityDamageEvent

supple elk
#

mhm

#

but it the registerListener() is passed the same thing

#
  • possibly the lamda
#

oh

quaint mantle
#

How would I make a spawner, that has a armorstand as its spawn, and has an item model on its head.
The spawner wont spawn anything, and the armorstand doesnt spin.

supple elk
#

another weird thing

#

I get this error message every time an event is triggered which isn't an entitydamagebyentity event

#

which is saying it can't cast

#

on the line when it tries to pass to lamda

#

but then the lambda code still runs??

#

still prints the event

eternal oxide
#

so yes its your Lambda, Its registering a type erased event

supple elk
#

but then why does it work for the first one?

eternal oxide
#

No clue why though

supple elk
#

and not the second?

eternal oxide
#

if you only register the second event do you still get the cast errors?

supple elk
#

I believe so

#

will double check now

eternal oxide
#

find which of them is throwing the cast error

supple elk
#

it's def the second

eternal oxide
#

its not both?

supple elk
#

oh snap

#

wait nvm

#

second does not through cast error

#

the first does

#

shit

#

that is wack

eternal oxide
#

So the second is ONLY being called when it is an EntityDamageByEntityEvent ?

#

or sub class

supple elk
#

no

#

second is called all the time

#

but doesn't through a cast error

eternal oxide
#

it can;t be called for every event and not have a cast error

supple elk
#

they are both called all the time

supple elk
eternal oxide
#

it will only accept EntityDamageEvent and its sub classes

supple elk
#

no error

supple elk
#

every sub class of entity damage

eternal oxide
#

yep

supple elk
#

so the first is also being called on all sub classes

eternal oxide
#

so its your first Listener thats firing on ALL events

supple elk
#

no

eternal oxide
#

Some of which are not children of EntityDamageEvent

supple elk
#

both fire on all sub classes of entity damage event

eternal oxide
#

yes

supple elk
#

they fire on the same events

#

no more or less

#

but the first one generates a casting error

#

the second one doesn't

eternal oxide
#

but the cast error is from an event which is not an EDE or a sub class

supple elk
#

which is why you see the message produced by the second

#

and not a message from the first

supple elk
#

cause it's trying to cast to entity damage by entity event

#

they are both registered to listener to entity damage by entity event

#

are triggering on any sub class of entity damage event

eternal oxide
#

You can cast and EDBEE to an EDE

supple elk
#

which is why is triggers the casting

#

but they are registered to only listen to an EDBEE

eternal oxide
#

um

#

casting those sub to super should not cause a cast error

supple elk
#

I only want EDBEE

#

that is the event class being passed into the registerListener() function

#

EDBEE

supple elk
#

however

#

they are triggering on any EDE

eternal oxide
#

yep. Type erasure on teh lambda

supple elk
#

This then causes the first one to cause a casting error when it tries to cast to EDBEE

eternal oxide
#

but I don;t see why

supple elk
#

the second one does not create casting error

#

and also why the difference between the two?

#

Java is fucking weird

#

why is type erasure a thing i hate it

#

how do I fix this 🤔

quaint mantle
#

how would I make a block with CustomModelData?

eternal oxide
#

No clue on this one

supple elk
#

doing a third test

#

just made a third listener

#

no error

#

only triggers on required event

#

that uses the first constructor

#

and registers it in a differnt way

#

and relies on the trigger function being annotated

eternal oxide
#

Yep, so Bukkit correctly scans the annotation

supple elk
#

However this does not allow me to create a listener by passing in an event class to a function

#

cause I then have to manually create it

#

the idea is I can call a function and pass in an event class, creating the same listener for a different event each time

coarse finch
#

how can i convert a string like "&3String" to show as colored in the chat?

blissful pumice
#

ChatColor.translateAlternaateColorColdes('&', text);

static hollow
#

Weird null

eternal oxide
#

Bukkit will likely fubar

blissful pumice
supple elk
maiden thicket
#

blocks dont have custommodeldata

#

iirc

supple elk
#

no changes

#

makes no dif

eternal oxide
#

a shame

#

I believe with the current way Bukkit registers event listeners you are out of luck using generics

supple elk
#

fnweinfwegewgeg

eternal oxide
#

Bukkit is just not designed for it

supple elk
#

so I just have to make a listener for every event

#

or

#

I could use the first listener

#

and manually check cast

maiden thicket
#

u can use eventexecutor

supple elk
supple elk
supple elk
#

what I've been trying

#

second constructor

#

type erasure bones it

quiet ice
#

the lambda is already the event executor @maiden thicket

mellow edge
#

can I get the item dropped in blockbreakevent

maiden thicket
#

implement eventexecutor

blissful pumice
#

Listener

maiden thicket
#

as well as listener

#

no, both

rough drift
#
for(int i = 0; i < list.size(); i++)
  list.set(i, list.get(i) + something);
#

that won't error right

blissful pumice
#

if something exist, it will work

supple elk
maiden thicket
#
public interface CustomEventExecutor<E extends Event> extends EventExecutor, Listener
{
    void invoke(E e);
    static <T extends Event> void createEvent(Class<T> clazz, CustomEventExecutor<T> executor, EventPriority priority)
    {
        Bukkit.getServer().getPluginManager().registerEvent(clazz, executor, priority, executor, plugin);
    }```
eternal oxide
#

um

maiden thicket
#

thats how i did mine

#

but yk extra curly brace

eternal oxide
#

extends two classes?

maiden thicket
#

yeah mb

#

its an interface

coarse finch
#

i get this when i try to load my gradle changes in intellij ```Could not find spigot-api-1.18.2-R0.1-SNAPSHOT.jar (org.spigotmc:spigot-api:1.18.2-R0.1-SNAPSHOT:20220408.234706-30).
Searched in the following locations:
https://hub.spigotmc.org/nexus/content/repositories/snapshots/org/spigotmc/spigot-api/1.18.2-R0.1-SNAPSHOT/spigot-api-1.18.2-R0.1-20220408.234706-30.jar

Possible solution:

supple elk
#

like so?

maiden thicket
#

it can extend more than one

supple elk
maiden thicket
maiden thicket
supple elk
#

ah

maiden thicket
#

not an eventhandler

supple elk
maiden thicket
#

ah i left out a part

#

sec

#

@Override
default void execute(@NotNull Listener listener, @NotNull Event event)
{
// try catch needed for events with super classes of other events
try {
E castedEvent = (E) event;
this.invoke(castedEvent);
} catch (ClassCastException ignored) { }
}

#

but yk change the default word

supple elk
#

ah

fallen agate
#

how do I make a skull have an owner using a value and signature? like when setting a skin, I don't want it to be UUID dependent, only value and sig

coarse finch
#

do i need to exclude spigot api when shading?

maiden thicket
#

yeah iirc

supple elk
maiden thicket
#

coarse finch
maiden thicket
#

pretty sure i got that code off the spigot forums

maiden thicket
coarse finch
#

gradle

supple elk
maiden thicket
#

are u using the shadow plugin

supple elk
#

rather than tryng to cast to T

#

can I cast to the passed eventClass?

coarse finch
glossy venture
supple elk
maiden thicket
glossy venture
coarse finch
#

well i get this when i try to load my gradle changes in intellij ```Could not find spigot-api-1.18.2-R0.1-SNAPSHOT.jar (org.spigotmc:spigot-api:1.18.2-R0.1-SNAPSHOT:20220408.234706-30).
Searched in the following locations:
https://hub.spigotmc.org/nexus/content/repositories/snapshots/org/spigotmc/spigot-api/1.18.2-R0.1-SNAPSHOT/spigot-api-1.18.2-R0.1-20220408.234706-30.jar

Possible solution:

supple elk
#

we did discuss that but were trying to find a way to get it to work without 'cheating' it

coarse finch
#

i have it like that

glossy venture
#

and implementation for the shaded stuff

maiden thicket
#

u dont have rhe maven repo added

supple elk
#

cuase bukkit should do the checking

supple elk
coarse finch
#

and it worked before

maiden thicket
maiden thicket
#

i believe it has a method called cast

supple elk
#

casting to T will cause type erasure

#

there we go

maiden thicket
#

u'd want to cast it to T probably

#

not passedClass

#

or that works

supple elk
#

do not want to cast to T

maiden thicket
#

i hope

glossy venture
#

ay tf is this

#

keeps popping up

#

repeatedly

supple elk
maiden thicket
#

mm ic aight

maiden thicket
#

for ssl purposes isk

#

idk

glossy venture
#

i rejected it

supple elk
#

ok hallelujah

#

it works

glossy venture
#

doesnt pop up anymore

maiden thicket
glossy venture
#

so good

maiden thicket
supple elk
#

doesn't really solve the underlying issue with it though lol

#

pretty hacky

#

very hacky infact

maiden thicket
#

eventexecutor be hacky

supple elk
#

but if it works it works

glossy venture
#

u sure its not caused by using /reload

maiden thicket
maiden thicket
#

or craftskullmeta

supple elk
#

passing EntityDamageByEntityEvent

fallen agate
supple elk
#

meant the listener triggered on any entity damage event

maiden thicket
supple elk
#

you should not have to manually check the cast

#

bukkit should be doing that part

maiden thicket
supple elk
#

casting to T also meant the cast worked when it shouldn't in sometimes cause of type erasure somehow

#

which then meant the event of a wrong type was passed to a lamda and was somehow executed regardless

#

which sounds dangerous

#

any hacky solution W

maiden thicket
#

truetrue

quiet ice
supple elk
#

hey geol 🙂

glossy venture
#

its gone now no idea what that was

supple elk
#

we 'fixed' it :p

quiet ice
#

I saw

serene juniper
#

I think this will help so much members

distant basalt
#

Hello guys
how do I place player head in a location?
player head of a specific user
the api unfortunately lacks the architectural design documentation

glossy venture
#

is this how to make a mapa in groovy

distant basalt
golden kelp
#

Didn't mean to be rude

distant basalt
#

I googled it and all of them talk about "giving to players i.e. itemStack" not setting block types

golden kelp
#

^^

safe notch
tender shard
distant basalt
#
            blockSign.setType(Material.OAK_WALL_SIGN);
            Directional blockSignData = (Directional) blockSign.getBlockData(); 
            blockSignData.setFacing(BlockFace.WEST);
            blockSign.setBlockData(blockSignData);

#

this is what I did for the sign

#

I don't want to change the direction

undone axleBOT
safe notch
delicate lynx
#

that is deprecated

safe notch
#

wut

distant basalt
#

This is only api documentation, it doesn't explain how "Blocks" are structured and changed

undone axleBOT
safe notch
#

wait nvm they want to do direction not changing skin

distant basalt
#

which is the code =-=

safe notch
quaint mantle
#

I'm trying to make command filter, if the command is specific in array list, I will be executable. One problem is that it's not work );

distant basalt
#

Bruh

tender shard
#

get the block's state, cast it to skull, then use Skull#setOwningPlayer(OfflinePlayer)

delicate lynx
safe notch
#

ig skullMeta its deprecated

golden kelp
tender shard
#
  1. SkullMeta is not deprecated
  2. Using String's for player names is deprecated though
  3. SkullMeta isn't helpful to place skulls in the world
safe notch
quaint mantle
golden kelp
distant basalt
#

in org.bukkit.block there are many files

quiet ice
#

?jd-s

undone axleBOT
golden kelp
distant basalt
#

am I supposed to do something like:
Skull head = new Skull(new Location(...))?

quiet ice
#

Heck no

#

Those are all blockstates, not blocks themselves

tender shard
quiet ice
#

Set the block to the skull type you wish, and then get it's block state and cast it

tender shard
#

np

tardy delta
#

imagine unwrapping an optional

#

thats not how it works

quiet ice
#

huh

#

Is there something I missed

sterile grotto
worldly ingot
#

Plugin configs are cached

#

No slowing down at all

#

It's all loaded into memory on startup

quiet ice
#

Well hashmaps have some performance slowdowns, but it is incredibly marginal

worldly ingot
#

You're not going to see any significant improvement whatsoever

quiet ice
#

Yeah

steel swan
#

hey, how can i get an item using its id?
for istance, crafting table's id is 58
I want smth like
ItemStack item = new Itemstack(Material.getID(58))
player.getInventory.addItem(item)
And it would give a crafting table

worldly ingot
#

Doesn't exist anymore

sterile grotto
worldly ingot
#

If you want to get a Material by its id, Material#matchMaterial(String)

quiet ice
#

Why do people still think that IDs make sense

#

Int ids that is

steel swan
worldly ingot
#

Numerical IDs have never been public API and post-1.13 they most certainly never will be

distant basalt
#

what is the difference between rotatebale and directional?

worldly ingot
#

Rotatable is a sign for instance, directional can only be a cardinal direction, like a log

#

So, 8 directions vs 6 directions

distant basalt
#

ok

quiet ice
steel swan
worldly ingot
#

You can get a random Material if you want

#

It's an enum, so a random number between the ordinal values

#
Material[] materials = Material.values();
Material randomMaterial = materials[ThreadLocalRandom.current().nextInt(materials.length)];```
steel swan
worldly ingot
#

Bear in mind that that may not return you an item. Material#isItem() should be checked. do/while is your friend here

tender shard
#

just do sth like

Material mat = Material.values()[ThreadLocalRandom.current().nextInt(Material.values().length)];
quiet ice
#

Do note that Enum#values creates a clone to the array, so you should prefer to cache it

worldly ingot
#

Enum#values() already caches afaik

quiet ice
#

I do not think so given that arrays are never immutable

quiet ice
#

Unless the JDK is smart enough

worldly ingot
#

Mmm, right. Frozen arrays aren't added yet

golden kelp
#

Copy the content

quaint mantle
#

AllowedCommands:

  • 'tell'
  • 'ban
#

Also the result

worldly ingot
#

getMessage() contains the slash iirc

golden kelp
#

Print getMessage ans things will be clear

#

Does anyone know how to use breakpoints with spigot plugins

tender shard
#

for random obtrainable materials, i'D just do sth like this

private static final Material[] obtainableMaterials = Arrays.stream(Material.values()).filter(Material::isItem).toArray(Material[]::new);
    
    public static Material getRandomMaterial() {
        return obtainableMaterials[ThreadLocalRandom.current().nextInt(obtainableMaterials.length)];
    }
tardy delta
#

getMessage is the prefix too ye

worldly ingot
tardy delta
#

so running the server in the intellij thing?

#

i once did that

worldly ingot
#

Yes

distant basalt
kind hatch
#

You could, but it would be a lot of setup. Plus it may not work as expected.

echo basalt
#

I legit use breakpoints to highlight lines that can be problematic

worldly ingot
#

You have to re-set the state

echo basalt
#

whenever dealing with an exception I just highlight it to keep organized lol

golden kelp
sterile grotto
tender shard
tardy delta
#

well i just tried it out and it worked

#

dunno whats the point of it

#

probably debugging from within ij

golden kelp
#

I saw a IJ plugin

#

Which made it simple to run ur server + plugin for debugging etc

tardy delta
#

it isnt a plugin its just a run configuration

glossy venture
#
processResources {
    // replace placeholders for epicness
    // (and streamlining) but mostly epicness
    // (and other processing)
    filesNotMatching([
            // media
            '**/*.png',
            '**/*.ogg',
            '**/*.wav',
            '**/*.mp3',

            // compiled
            '**/*.jar',
            '**/*.class'
    ] as Iterable<String>) {
        // expand placeholders
        expand([ 'carbonProjectVersion': project.version ])
    }
}
``` why is this not expanding it in the source files?
#

no errors

#

it works in the plugin.yml

#

or does it only do it for the resources

#

and literally nothing else

golden kelp
worldly ingot
#

If you're trying to process source files, yeah that won't work

glossy venture
#

bruuuuuh

#

is there a way to make it work?

worldly ingot
#

but if you're trying to get your plugin version, what's wrong with plugin.getDescription().getVersion()?

#

Assuming you're already injecting that version into the plugin.yml, yeah?

glossy venture
#

i have it public static final

#

id like to keep it like that if possible

kind hatch
#

Y tho?

glossy venture
#

i could read it from a file lol

worldly ingot
#

Probably would have to read it from your plugin.yml manually, yeah

glossy venture
#

but i also dont want them to have the instance

#

so yeah

#

public static final makes the most sense

worldly ingot
#

Can read from the plugin.yml's input stream

kind hatch
#

Oh my bad I thought it was just static

glossy venture
#

oh

worldly ingot
#

getResourceAsStream(), or just getResource(), whichever you prefer

glossy venture
worldly ingot
#

(will likely have to make a method to one-line it)

glossy venture
#

yeah

#

ill just put it in a file

quaint mantle
#

Do playerheads have access to PersistentDataContainer

kind hatch
#

If you can obtain ItemMeta from it then yes.

#

SkullMeta should also have it.

quaint mantle
#

Placed

glossy venture
#
    public static Version readFromResource(Class<?> ref, String path) {
        try {
            if (!path.startsWith("/"))
                path = "/" + path;
            InputStream is = ref.getResourceAsStream(path);
            Version ver = of(new String(is.readAllBytes(), StandardCharsets.UTF_8));
            is.close();
            return ver;
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }
kind hatch
quaint mantle
#

Which, to be fair, is a bit dumb

#

But what can I do about it :P

worldly ingot
#

BlockStates have PDC, but yeah if you want just any block, you can either use that resource or you can use Chunk's PDC

#

(which is what that resource does too)

quaint mantle
#

Sure thing.

#

My last question: Ill be generating the area from a ore catalyst, by generating a circle in the area its placed, and converting it to stone.

#

How would I detect blocks that have a space above it that is open?

tender shard
worldly ingot
#

Yeah you knew what I meant 😛

kind hatch
tardy delta
#

chunks have a pdc too

quaint mantle
#

For 1 block above

kind hatch
#

+1

quaint mantle
#

Alright lol

quaint mantle
#

Or should I quit developing plugin XD

quaint mantle
#

how did you manage to

#

do that

quaint mantle
safe notch
#

what are you trying to make?

coarse finch
mellow edge
#

I've been really struggeling placing a bed with both bottom and upper part

coarse finch
#
Searched in the following locations:
    https://hub.spigotmc.org/nexus/content/repositories/snapshots/org/spigotmc/spigot-api/1.18.2-R0.1-SNAPSHOT/spigot-api-1.18.2-R0.1-20220408.234706-30.jar

Possible solution:
 - Declare repository providing the artifact, see the documentation at https://docs.gradle.org/current/userguide/declaring_repositories.html
```i get this when i try to reload my gradle changes in intellij, but it builds fine.
mellow edge
#

in 1.8

safe notch
# quaint mantle

Im confused why its a loop like you can have a list and use contains() right

kind hatch
#

Didn’t mean to reply to that.

quaint mantle
#

contains() need to be string

glossy venture
#

tf

kind hatch
#

What does getMessage return?

safe notch
#

returns command with /

quaint mantle
#

so if i use toString it will be like "[/tell, /ban]"

kind hatch
#

An actual command or the string representation of it?

kind hatch
coarse finch
#

i get this error org.bukkit.plugin.InvalidPluginException: java.lang.NoClassDefFoundError: dev/dejvokep/boostedyaml/dvs/versioning/Versioning when i start my server

midnight shore
#

How can I disable the /plugins command?

quaint mantle
coarse finch
kind hatch
midnight shore
#

Since it’s not connected to permissions

dull whale
#

I'm trying to see if player's eye direction and the direction he's moving towards the same and java p.getLocation().getDirection().setY(0) == new Location(p.getWorld(), packet.getX(), 0, packet.getZ()).subtract(p.getLocation()).getDirection().setY(0) didn't work how can i do that

midnight shore
kind hatch
#

Negate it for the default permission group then?

safe notch
#

^

cyan compass
#

Okay so i have a boss bar that counts down from 15 (changeable) So what i do is i do 1.0/countdownTime and when i change the boss bar i do bar.getProgress()-devidedTime (not exact code but doesn't fully matter) But of course when my countdown is at 1 then the bar is fully empty and i'm wondering how i can have the bar still have 1 count worth of progress at 1

glossy venture
#

why is it throwing this error?
its erroring when processing my plugin.yml, which looks like this:

# Main Properties
name: Carbon
main: net.orbyfied.carbon.bootstrap.Carbon1182Bootstrap
version: ${carbon.project.version}
...
cyan compass
#

But where

quaint mantle
cyan compass
# cyan compass But where

Cause i can't add 1 to the boss bar since that would be about 1.06 currently and that causes an error

glossy venture
midnight shore
#

What’s the permission node then?

glossy venture
#

do i need to change it to '${...}'

coarse finch
#

i get this error org.bukkit.plugin.InvalidPluginException: java.lang.NoClassDefFoundError: dev/dejvokep/boostedyaml/dvs/versioning/Versioning when i start my server

safe notch
coarse finch
safe notch
#

lemme write some code wait

glossy venture
#

its failing to parse a template script

kind hatch
glossy venture
#

i dont think thats my file, i think its a gradle thing

glossy venture
#

i tried it

#

still not work

small current
#

Send the full yml

coarse finch
#

i get this error org.bukkit.plugin.InvalidPluginException: java.lang.NoClassDefFoundError: dev/dejvokep/boostedyaml/dvs/versioning/Versioning when i start my server

safe notch
#

@quaint mantle

glossy venture
#

istg why tf is paper updating every 2minutes or something

coarse finch
safe notch
glossy venture
#

yeah

#

nah

#

plugin with nms

#

mojang mapped

safe notch
#

ohh

coarse finch
#

i get this error org.bukkit.plugin.InvalidPluginException: java.lang.NoClassDefFoundError: dev/dejvokep/boostedyaml/dvs/versioning/Versioning when i start my server

steel swan
#

hey, i made this code that should make an entity spawn whenever a block breaks. Any idea why it doesnt work?

@EventHandler
    public void onBeak(BlockBreakEvent event){
       Block block = event.getBlock
            EntityType[] mobs = Arrays.stream(EntityType.values())
                    .filter(type -> type.getEntityClass() != null && Mob.class.isAssignableFrom(type.getClass()))
                    .toArray(EntityType[]::new);
            EntityType randomMob = mobs[ThreadLocalRandom.current().nextInt(mobs.length)];
            event.getBlock().getWorld().spawnEntity(event.getBlock().getLocation(), randomMob);


    }
quaint mantle
#

but onBeak

#

id do onBlockBreak

steel swan
#

yeah that was just for testing

quaint mantle
#

ah

#

well i cant see anything wrong tbh

#

How do I generate a circle btw, and get the blocks inside it

#

im an idiot ok

chrome beacon
coarse finch
quaint mantle
coarse finch
#
shadowJar {
    relocate 'dev.dejvokep.boostedyaml', 'me.kidneybean.generalutils.shadowed'
}```
quaint mantle
#

Let me show rq

#
plugins {
    id 'java'
    id 'com.github.johnrengelman.shadow' version '7.1.2'
}
#

Use johnrengelmans shadow

quaint mantle
#

Then, inside the build thingy

coarse finch
quaint mantle
#

run as shadowJar

quaint mantle
#

How would I make a sphere, and get blocks inside it?

#

AKA: Place a block, make a sphere at the location, get all blocks

brave sparrow
#

Math

quaint mantle
#

Including a square.

tardy delta
#

wait why do i see someone handling the cmd preprocess event?

safe notch
quaint mantle
#

There was an entire function to make a square or sphere.

#

That can get blocks inside of it.

#

I litterally did it before, I cant remember the name.

#

Thats the issue.

safe notch
#

use worldedit api maybe

quaint mantle
#

No that wasnt it.

safe notch
#

by function you mean in spigot itself?

quaint mantle
safe notch
#

there is a getRelative() that gets a block relative to the current block

quaint mantle
#

I KNEW WHAT I WAS TALKING ABOUt

#

BOUNDINGBOX

#

But... Thats not a sphere.

safe notch