#help-development

1 messages · Page 2198 of 1

humble tulip
#

wdym?

humble tulip
#

oh wait ur just checking xz

tall dragon
#

yes i am an eggselent artist

humble tulip
#

i thought he was doing xyz

tall dragon
#

he was at first

#

but is that rlly needed

humble tulip
#

to not have bugs probably yes

tall dragon
#

why not loop xz, look for the first air block above

#

instead of highest

humble tulip
#

cuz if ur in a cave?

#

if ur in an arena with a roof above

tall dragon
#

if ur in area with roof above it will work fine

#

just put a limit of like 5 blocks

humble tulip
#

one sec

quaint mantle
#

y + 1?

tall dragon
#

ye but wait actually

#

i know something that will work better for u

humble tulip
tall dragon
#
    private void lightOnFireInRadius(Location origin, int radius) {
        outer:
        for (int x = (origin.getBlockX() - radius); x <= (origin.getBlockX() + radius); x++) {
            for (int z = (origin.getBlockZ() - radius); z <= (origin.getBlockZ() + radius); z++) {
                Location fire = new Location(origin.getWorld(), x, origin.getBlockY(), z);

                int counter = 0;
                while (fire.getBlock().getType() != Material.AIR) {
                    if (counter >= 5)
                    {
                        continue outer;
                    }
                    fire.add(0, 1, 0);
                    counter++;
                }
                fire.getBlock().setType(Material.FIRE);
            }
        }
    }

ig something like this

quaint mantle
#

Thx man, I'll try it out

tall dragon
#

or do you see any big flaws in this @humble tulip

humble tulip
#

nope

#

that's fine

tall dragon
#

though if it will work correctly with a nested loop like this

eternal oxide
#

@limber owl I'd actually run that Async, not sync

humble tulip
#

not the x loop

tall dragon
#

thats what i was thinking too yea

humble tulip
#

i was scrolling thru tiktok and was like WAIT, which loop did he continue

#

came back to check

tall dragon
#

@quaint mantle i think you need to move the outer: tag to the z loop instead of the x loop

tardy delta
#

tiktok

humble tulip
#

toktok

tall dragon
#

instagram better

tardy delta
#

^

tall dragon
#

all tiktoks get reposted on there anyway

#

u got the whole package

tardy delta
#

and not the chinese government spying on you

#

:p

quaint mantle
#

The one I made first

tall dragon
#

uhh no. your code would create a solid cube

tall dragon
quaint mantle
# tall dragon could you send that again then im confused which one
int r = 5;
 

for(int x = (r * -1); x <= r; x++) {
    for(int y = (r * -1); y <= r; y++) {
        for(int z = (r * -1); z <= r; z++) {
            
            Location b = new Location(o.getWorld(), o.getBlockX() + x, o.getBlockY() + y, o.getBlockZ() + z);
 
            
 
            if(b.distance(o) > r)
                continue; // Outside radius
 
            if(b.distance((o)) < r - 1)
                continue; // Inside radius - 1
 
            
            b.getBlock().setType(Material.GLASS);
        }
    }
}```
#

This one?

tall dragon
#

uhhh

#

i dont think this will work for creating a cage

quaint mantle
#

Like a sphere?

tall dragon
#

oh you want a sphere?

quaint mantle
#

Yes, so players can trap other players with it

tall dragon
#

okay i got something for that

#

but its not very performance friendly

#

?paste

undone axleBOT
quaint mantle
#

Would it be better to use FAWE api for this?

tall dragon
#

pretty likely

#

anyway

#

there methods are designed to return me a list of the blocks. but you can easily modify them to just place the blocks

quaint mantle
#

@lost matrix send your process load tick-spread thingy

quaint mantle
tall dragon
#

haha

quaint mantle
#

?workload

tall dragon
#

u should add a cmd for that

quaint mantle
#

?workdistro

#

nice

#

?workdistro

#

i love this bot

tall dragon
#

he loves you too 🙂

quaint mantle
#

?workdistro

tall dragon
#

nice

quaint mantle
tall dragon
#

be sure to look at the link we sent though

#

if you want to optimize it yourself

quaint mantle
#

Alright

next fossil
#

How do I find any new 1.19 docs for NMS?

iron glade
#

Is this the right way to retrieve the UUID saved as string in a PDC ?

                    if(playerHead.getItemStack().getItemMeta().getPersistentDataContainer().has(plugin.key)) {

                        UUID uuid = UUID.fromString(playerHead.getItemStack().getItemMeta().getPersistentDataContainer().get(plugin.key, PersistentDataType.STRING));

                    }```
humble tulip
#

Yh

iron glade
#

thx

humble tulip
#

Np

limber owl
misty current
#

i'm having a weird issue, i'm creating a new world and then teleporting players but for some reason some chunks don't appear

eternal oxide
#

all of those are deprecated. I just used your code as a base. As thats what you picked

#

what error?

humble tulip
misty current
#

i've put a scheduler for 5 ticks but the issue didnt go away

humble tulip
#

?paste

undone axleBOT
misty current
#

the console said the gen took 29ms

tall dragon
#

yea its prolly taking longer to load the world

misty current
#

it's a void world

tall dragon
#

still..

misty current
tall dragon
#

its not very good to just guess 5 ticks either

eternal oxide
#

um, chunks not appearing in a void world?

humble tulip
#

Maybe listen to a chunk load event in thebworld

#

Then u know the world. Is ready

humble tulip
misty current
#

pov from an account i relogged with

eternal oxide
#

ok, that makes more sense 🙂

misty current
#

this is the other one

subtle folio
#

is cafebabe made in jda?

misty current
#

there's a chunk boundary there as u can see

humble tulip
misty current
#

tried that, did nothing

#

i had to relog

#

if i step in the missing chunk the player fluctuates, kinda lagging back

humble tulip
#

Ah ye

#

Cuz block is there serverside

misty current
#

yup

humble tulip
#

Send chunk packet to players that u tp on load maybe?

tall dragon
#

how ru currently even tping them

#

u gen -> wait 5 ticks -> tp?

misty current
#

that sounds like a sloppy way to fix it and also even if I relog and then place new structures, a part of them is still missing

misty current
#

?paste

undone axleBOT
tall dragon
#

u could also gen -> listen to WorldLoadEvent -> tp

misty current
humble tulip
misty current
#

i missed a part at the end but the delay is 5 ticks

tall dragon
humble tulip
#

Keep spawn in memory pls

misty current
tall dragon
#

as u can see this gets called when a world is loaded

humble tulip
#

Since ur already putting stuff at 0,0

misty current
#

aight

humble tulip
#

And maybe load the chunks before u tp the players

misty current
#

i might try moving the structure from 0, 0 too because chunks near it are weird

#

there's a 1 wide chunk slice or something

limber owl
#

@eternal oxide a s**t ton of errors just showed up

misty current
#

i'll try if keeping spawn in memory helps

#

oh yea that seems to help

#

lemme do some more generations

humble tulip
#

Ask epic said tho best way is to probably listen to worldloadevent

misty current
#

yep that fixed the issue

#

doesn't world creation run sync?

humble tulip
#

no

misty current
#

uh interesting

#

aight then i'll listen for the event

#

thanks

lost matrix
misty current
#

so there's no need to listen for the event since the main thread is blocked

lost matrix
#

I just joined so i have no idea what this is about XD

tall dragon
#

well 7smile7 you've got your own command 😮

#

?workdistro

lost matrix
#

lul nice 😄

tall dragon
misty current
lost matrix
# misty current im creating a world and immediately teleporting players and someone suggested to...

The problem is not the world but the actual chunk the player is teleported to.
If you fetch the chunk first then you can safely teleport the player.
In paper you can even do something like this:

    fun safeTeleport(player: Player, location: Location) {
        location.world.getChunkAtAsync(location).thenAccept { player.teleport(location) }
    }

Means you request the chunk async and when its loaded you teleport the player.
In Spigot you would do the same thing just blocking or by using a CF fed by the BukkitScheduler.

misty current
#

oh yea i was looking for something like this but i'm not noticing any issues rn as i'm teleporting the player in the spawn chunks that are always loaded

lost matrix
#

Blocking:

    fun safeTeleport(player: Player, location: Location) {
        location.chunk
        player.teleport(location)
    }
lost matrix
misty current
#

i have noticed the increase in time and that kinda bothers me

misty current
#

thanks

tardy delta
#

kotlin's such a funny language

misty current
lament swallow
tall dragon
#

xp sound

#

😄

clever grotto
#

"Internal Exception: io.netty.handler.codec.DecoderException: java.lang.IndexOutOfBoundsException: readerIndex(10) + length(1) exceeds writerIndex(10): PooledUnsafeDirectByteBuf(ridx: 10, widx: 10, cap: 10)"

lament swallow
#

amongst Sound.[sound_name]

clever grotto
#

any solution?

lament swallow
#

yea but there is no "xp sound"

#

is it level up?

misty current
tall dragon
#

try Sound.ENTITY_EXPERIENCE_ORB_PICKUP

lament swallow
#

i'll try

clever grotto
#

I'm trying to get into my spigot 1.19 server and I'm getting this error

carmine valley
#

hey guys, how can I detect if the player pressed the space bar? they will be midair so it can't be the normal jump event. I'm trying to make a multiple jumps plugin

tall dragon
#

you could use PlayerToggleFlightEvent which is called when the player double clicks spacebar

carmine valley
#

I can't use PlayerToggleFlightEvent because that requires two space bar hits

lament swallow
tall dragon
desert tinsel
granite owl
carmine valley
carmine valley
tall dragon
#

pretty sure it is yea

granite owl
#

u just need to keep their Y coord in memory

#

well

#

why do u need that anyway

carmine valley
#

multipe jumps plugin

granite owl
#

hm?

carmine valley
#

on each space bar hit they would jump a bit higher

#

kinda like flappy bird

granite owl
#

not trying to be this guy since i avoid using paper

#

and stay with spigot

#

but

#

if u really need it

#

paper has this event

#

for quite some time now as it seems

misty current
carmine valley
#

but would that event be called if the player wasn't grounded?

carmine valley
misty current
#

when they toggle flight mode, make them not fly anymore and do what you need to do

carmine valley
#

if flight was enabled on the server

#

then pretty much any shitty fly hack would work

#

I haven't started developing an anti-cheat but I figure that would make it harder

granite owl
#

ive literally just given you the answer

#

bukkit and thus spigot has no native jump event support

#

paper does

misty current
#

that event is only called if you jump from the ground

#

not if you press the spacebar midair

granite owl
#

which is exactly what he wanted

#

or not

misty current
#

he wants to detect for spacebar pressed midair

#

to make double jumps

carmine valley
#

^

tall dragon
#

i dont think thats possible though

misty current
#

only othert thing that comes to my mind is putting something like a boat exactly under the player so they can jump off that

tall dragon
#

detecting a double click midair is possible

#

but one click i think not so much

granite owl
#

well to be fair keystroke detection is super anoying but also

#

even IF

#

you acomplish this

#

keep in mind that movement is happening async

#

but the event would be sync

#

means that the response time for the second jump would be much higher than the vanilla first jump

carmine valley
#

yeah I should probably just stick to using double spacebar strokes

granite owl
#

ur double jump movement delay will be bound to ping

tall dragon
#

that all doesnt matter tho because the client will not send a packet if its not grounded

#

so you cant detect it

misty current
#

or you could make hand swaps count as double jump

#

or something

carmine valley
#

hmmmm yeah, maybe space bar is the most intuitive but maybe I can use a totally different event

granite owl
#

interactevent ClickType.AIR_RIGHT or so

#

xD

humble tulip
#

Make then double tap spacebar

#

And listen to toggle fly event and cancel it

tall dragon
#

i also feel like double clicking spacebar is the best way for this

carmine valley
#

but wouldn't that disable creative flight and essiantials /fly ?

tall dragon
#

its how every other double jump plugin does it as far as i have seen

granite owl
#

tbh i would prob avoid doing those things alltogether

tall dragon
#

so just check for that

humble tulip
#

If creative return

carmine valley
#

yeah I hear ya

tall dragon
#

orrrr

#

player.isFlying();

carmine valley
#

so that essntianls /fly also works

#

thanks for the heads up

granite owl
#

just dont get disappointed when ur double jump wont work

humble tulip
#

does anyone know how textures for skulls work?

granite owl
#

on a live server that isnt on ur local machine

carmine valley
tall dragon
humble tulip
#

i mean, i apply the texture

crisp steeple
humble tulip
#

but like

granite owl
#

its being drawn from the hashed version of the players skin

humble tulip
#

it's a link

#

one sec

#
    public static void applyTexture(SkullMeta skullMeta, String url) {
        GameProfile profile = new GameProfile(UUID.randomUUID(), null);

        byte[] encodedData = Base64.getEncoder().encode(String.format("{textures:{SKIN:{url:\"%s\"}}}", url).getBytes());

        profile.getProperties().put("textures", new Property("textures", new String(encodedData)));

        try {
            profileField.set(skullMeta, profile);
        } catch (IllegalAccessException ex) {
            ex.printStackTrace();
        }
    }
#

this is my method

#

why tf does it work

#

does it need to make a request to get the texture?

#

or is the texture data in the url itself?

crisp steeple
#

just encoded

humble tulip
#

so the data is encoded in the url?

granite owl
# carmine valley why wouldn't it work?

because like ive said before, movement happens client sided usually. however with ur double tap the 2nd jump will be issued by the server causing a delay as big as your ping. 30ms might not sound much but ur vanilla jumps response time i less than 1ms. so compare a <= 1ms response time to >=30ms

crisp steeple
#

the texture is gotten from mojang servers

#

from the texture property

humble tulip
#

so i should set the texture async?

next fossil
#

Guys what is PublicProfileKey?

crisp steeple
#

maybe

next fossil
crisp steeple
#

it already does it async though i believe

tall dragon
humble tulip
crisp steeple
#

since it’s done by the client

humble tulip
#

ohh

carmine valley
humble tulip
#

so the server tells the client what the texture is and the client loads it

nova sparrow
#

What does spigot do with empty slots when you use the Inventory#getContents() or Inventory#getStorageContents()

granite owl
#

imagine some guy having 150ms

crisp steeple
#

just change the players velocity

granite owl
#

even that is server sided

crisp steeple
#

yes?

#

changing someone’s velocity doesn’t cause the server to lag

granite owl
#

no but its inconsistent based on ping

#

which is still inline with what ive previously stated

crisp steeple
#

well yeah, you might be flying for a couple milliseconds on the client if you’re laggy but other than that it works alright

carmine valley
crisp steeple
#

it’s really not noticeable usually

humble tulip
#

how can u tell a player to time their jumps right

granite owl
humble tulip
#

it's not a bug, just time ur jumps right

carmine valley
humble tulip
#

then it's a design flaw

carmine valley
#

it's a flaw that can't be worked around

crisp steeple
#

bad ping is going to give a disadvantage, that’s just a general rule

tall dragon
#

yea my plugins never contain bugs either, they are eastereggs

granite owl
#

xD

crisp steeple
#

unless someone has REALLY bad ping it is not that noticeable

granite owl
crisp steeple
#

i have played on servers with this mechanic and i have pretty high ping, it’s never really been a problem

granite owl
#

youre coupling a client sided async task to ping

humble tulip
#

@tall dragon yk acrobat kit from anni?

tall dragon
#

yes

humble tulip
#

they used playertoggleflightevent

#

now looking at the code

tall dragon
#

ninja too

humble tulip
#

was messy to handle tho

crisp steeple
tall dragon
humble tulip
#

yeah

granite owl
tall dragon
#

?paste

undone axleBOT
crisp steeple
#

i think having a mindset of "well since a couple of really laggy players might not be able to use this mechanic great, so i shouldnt add this feature" is a pretty bad one to have when making games

tall dragon
humble tulip
#

sec

#

lemme get the anni repo opened

#

i'll look for the code

granite owl
limber owl
#

@eternal oxide you can just do this:

        if(Bukkit.unloadWorld(Bukkit.getWorld(worldName), true)) {
            try {

                FileUtils.deleteDirectory(worldFile);
            } catch (IOException e) {
                Bukkit.getLogger().log(Level.SEVERE, e.getMessage());
                if(plugin.getConfig().getBoolean("debug"))
                    e.printStackTrace();
            }
        }
stiff dune
#

The method ChatColor.of() for hex colors is deprecated in 1.18. What method should be used now?

crisp steeple
granite owl
#

the server checks for illegal movements and resets those actions

crisp steeple
#

many many games on servers usually have some sort of mechanic that alters movement

#

im not sure what you're talking about

humble tulip
#

@tall dragon

crisp steeple
#

even just something like tnt or knockback is technically "bound to the server"

carmine valley
#

I know this sounds stupid but is there an event to get grounded players? :P

tall dragon
granite owl
carmine valley
granite owl
#

just get the block of their location y - 1

#

depends on when you want to check

#

🤣

carmine valley
#

at all times

granite owl
#

runnable

crisp steeple
#

you could use playermoveevent

granite owl
#

bukkit*

carmine valley
granite owl
crisp steeple
carmine valley
#

yeah that works

#

great, thx

granite owl
#

we've literally talked about the movementevent like 5mins ago

#

nvm

subtle pecan
#

Spigot 1.19 (first build, don't know if there have been updates since) sends action bar messages to chat instead. Is this already known and/or where would be the correct place to report such issues?

chrome beacon
#

Make sure you're up to date

#

Updates usually happen quite quickly after a new release

#

If you are up to date report it on the Jira

#

?jira

undone axleBOT
stiff dune
#

Is there also a maven dependency?

#

for 1.19?

chrome beacon
#

Yes

#

Do you want NMS or just API?

stiff dune
#

later maybe nms

#

still build local?

#

or is there another way

chrome beacon
#

Building the jar with BuildTools is the only official way to get the Spigot jar

stiff dune
#

Yes, I mean for nms

chrome beacon
#

Yeah you need BuildTools for NMS

stiff dune
#

well

#

Do u know whats the new method for using hex color codes is? ChatColor.of() is deprecated

#

Already in 1.18

tardy delta
#

heh is it

stiff dune
#

Isnt there a new method? But why deprecated?

chrome beacon
#

It's not deprecated though?

stiff dune
#

huh Im confused

#

i see...

chrome beacon
#

Are you using Paper as a dependency by any chance

stiff dune
#

dont know what ive seen haha

iron glade
#

Any ideas why I'm still getting this in the lore?

    public ItemStack createGuiItem(int amount, Material mat, String displayName, String... lore) {

        ItemStack itemStack = new ItemStack(mat, amount);
        ItemMeta itemStackMeta = itemStack.getItemMeta();
        itemStackMeta.getItemFlags().add(ItemFlag.HIDE_ATTRIBUTES);
        itemStackMeta.getItemFlags().add(ItemFlag.HIDE_POTION_EFFECTS);
        ArrayList<String> metaLore = new ArrayList<>();
        metaLore.add("");
        metaLore.addAll(Arrays.asList(lore));
        itemStackMeta.setLore(metaLore);
        itemStackMeta.setDisplayName(displayName);
        itemStack.setItemMeta(itemStackMeta);

        return itemStack;
    }```
midnight shore
#

whats wrong here?

tall dragon
#

you should probably use Class<? extends Projectile>

#

though idk what ur tryna do

humble tulip
#

what's a nice sound for not enough money to play to the player?

iron glade
#

low bass note

tall dragon
#

Villager_angry

midnight shore
humble tulip
#

k ty

midnight shore
tall dragon
#

well for one getClass() is a method in Object

humble tulip
tall dragon
#

so probablydont use the same name

tardy delta
#

when are people going to use Arrays.asList or Collections.singletonList for their lore lol

humble tulip
#

cuz ur return type is calss

#

u have to return the class type

#

so if ur class is Projectile

midnight shore
humble tulip
#

or extends projectile, make ur method return a projectile

midnight shore
#

but still not working

midnight shore
tall dragon
#

that too yea

humble tulip
#

same thing

tardy delta
midnight shore
#

nice but still error

tall dragon
#

no u understood minion wrong

#

ur still trying to return a class

#

while ur actually returning an instance of the class

tardy delta
#

you are trying to apply a method reference

#

trying to return an object one a place where it returns a class

midnight shore
tardy delta
#

and that methods throws exceptions

midnight shore
tardy delta
#

whats wrong with aC.newInstance()

humble tulip
#

also use getConstructor.newInstance

midnight shore
#

why is it deprecated anyways?

tardy delta
#

iforgot

humble tulip
#

cuz they want u to use the constructor

midnight shore
#

like this?

humble tulip
#

no wtf are u doing

#

getThisClass.getCOnstructor.newInstance

#

and return WilloProjectile

tall dragon
#

angry minion PES_Inception

humble tulip
#

u also gotta try catch

midnight shore
#

a lot of exceptions there 🤐

tardy delta
#

getclass.new.getclass doesnt make sense

humble tulip
#

dont return the calss

#

asdjasdkajdn

#

return WilloProjectile

tall dragon
#
    Class<? extends Projectile> proj = Arrow.class;
    
    public default Arrow getArrow() throws NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException {
        return (Arrow)proj.getConstructor().newInstance();
    }

example

humble tulip
#

and yes there's a ton of excetions

midnight shore
humble tulip
#

it's because youre using reflection

tardy delta
#

throws Exception bruh

humble tulip
#

why are u even using reflection for this?

midnight shore
midnight shore
humble tulip
#

with this ur class cant have a constuctor else there's gonna be an exception

tall dragon
#

it can. but it requires an empty one

midnight shore
lethal python
#

https://i.imgur.com/TsKQd3d.png i am starting with NMS and the tutorial has this import, so i put 1.18.2 instead but maven doesn't like it, and i've tried reloading the maven thing to make it find it

tall dragon
#

why dont you tell us what ur trying to make with this @midnight shore we might have a better solution?

humble tulip
midnight shore
#

well a lot of custom projectiles

tall dragon
humble tulip
#

and just yk new CustomWilloProjectile(args);

lethal python
#

i was told it does

tall dragon
#

uhhh

#

not that i know of

midnight shore
#

for example Fire Projectile has its own class and actually i think i will do a system for adding a sort of constructor using method concatenation

#

so like FireProjectile().setFirePower(15).setDamage(new WilloDamage(base:150, multiply:yes); and so on

tall dragon
#

im pretty sure you can also just use a Supplier

#

?java

#

oop

#

?paste

undone axleBOT
tall dragon
#

for example ^

humble tulip
midnight shore
#

different by themselves

#

sorry but i'm not of english origin

tall dragon
#

ye well better than using reflection

#

you know that is very close to exactly the same thing

#

Functions just take an input as well

humble tulip
tardy delta
#

afaik yes

humble tulip
#

i saw u used for h2 so i assume its possible

tall dragon
#

pretty sure u can yes

tardy delta
#

just set jdbc url or driver class name

humble tulip
#

ohh u need absolute path

#

i always provided path only

tardy delta
#

for the file?

#

yes

#

atleast i didnt get it to work with relative

humble tulip
#

do yk how i can download apache commons io

#

all downloads i see online are zipped

#

it's for 1.8 support which doesnt have it

tardy delta
#

shade it into your maven thing?

humble tulip
#

nah dont wanna shade it since it'll increase file size

#

and it already exists in later versions

tardy delta
#

idk then

humble tulip
#

https://repo1.maven.org/maven2/commons-io/commons-io/2.11/commons-io-2.11.jar

#

think this is it

paper viper
#

Does anyone know what happened to PacketPlayOutChat?

arctic moth
#

where can i find a list of all vanilla structure namespaced keys

eternal night
arctic moth
#

or all loaded structures idc

tender shard
#

has anyone else expeirenced this weird bug that action bar messages gets send to the chat in 1.19?

    public static void showActionBarMessage(Player player, String message) {
        if(message!= null) {
            player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(message));
        }
    }
#

this just sends a normal chat message

tall dragon
#

yep

tender shard
#

fuck

tall dragon
#

pretty sure its been reported to jira

tender shard
#

was it already reporetd on jira?

#

ok good

#

thanks

tardy delta
#

i always do new TextComponent(message)

paper viper
#

im too lazy to remap right now

tall dragon
#

this is handy

paper viper
#

thanks

eternal night
#

mini mappings hasN#t been updated in a while

tender shard
#

com.mojang.blaze3d.DontObfuscate

#

lmao

#

and it still got obfuscated

eternal night
#

we recommend screamingscandals iirc

arctic moth
#

how do i get a list of all loaded structures

tender shard
paper viper
#

fuck they changed the chat packet so much

tender shard
#

yeah even action bar messages are broken in plain spigot

eternal night
#

well

#

chat is signed now

#

which

#

right now that is a complete clusterfuck

paper viper
#

Yeah

#

im very confused

eternal night
#

give spigot time

#

before properly implementing API and server layer for signatures

dapper harness
#

Is there a simple way of detecting when a player puts an item in their ender chest or do I have to check all the different click types and compute what they do ?

arctic moth
#

even if i do StructureManager.getStructure(StructureType.SOMESTRUCTURE.getKey()) it returns null

dapper harness
#

annoying

tender shard
#

yeah

#

indeed

dapper harness
#

why isn't there get from and get to in inventory click event 😭

tender shard
#

feel free to PR it 😛

arctic moth
#

oh its just getStructures

dapper harness
#

pr ?

tender shard
#

pull request

#

like "add it yourself and propose the changes into spigot"

#

i'd also love to see this happening

#

noone added it yet so it's not a thing right now

arctic moth
#

for some reason placing structures is giving me jigsaw blocks

humble tulip
#

mfnalex

#

i need help

sly elk
#

🧪

arctic moth
#

or getStructures() is returning structures with jigsaw blocks

humble tulip
#

wtf is that

tender shard
#

idk, paste it into some XML validator

humble tulip
#

stackoverflow says it's a problem with a curropted dependency

arctic moth
#

getStructues() gets the pieces of structures, how do i generate an entire structure

#

oops

humble tulip
#

oops indeed

arctic moth
#

anyways

#

how do i generate a full structure

#

not just the little pieces

humble tulip
#

how do i know which versions of spigot has commons io

#

i saw that some dont

tender shard
#

but in 1.16 I think they updated it

#

does someone have the jira link for the "action bar messages get wrongly sent to normal chat" thing? I couldnt find it, maybe probably I am blind

#

nvm I found it

tall dragon
#

ah

#

was about to send it

arctic moth
#

wtf does this mean

tender shard
granite owl
#

for anyone doubting that i can delta time 2 block break events with greater accuracy than 50ms

#

ive set my anticheat to 5ms, and it just triggered

#

🤔

#

any idea if thats a bug?

#

apparently the affected blocks are fern

tender shard
#

and 1000/20 is 50

granite owl
#

iknow

#

still

#

my friend triggered my anticheat with breaking fern

#

which ive testfully primed

#

to delta time block break events to 5ms

#

and then trigger if the time difference is <= ms

tender shard
#

it's easily possible to get 2 block break packets within one tick

#

for example if the player has a bad ping

granite owl
#

because the server processes all pending packages

#

at once

#

in one tick

tender shard
#

yeah well packets are processed in a queue-like thing

eternal oxide
#

It should be impossible as its single threaded TCP

winter fog
#

What is the 1.19 version for the Spigot depandancy?

tender shard
tender shard
winter fog
#

tsym

tender shard
#

that should not happen

#

oh

#

now they removed their message

#

RIP

versed tide
tender shard
#

makes sense

granite owl
#

i suspect ur using a host provider

#

@versed tide ?

#

or local machine

misty current
#

can you modify the entities in a Structure without using NMS?

#

if not, how can I get an nbtcompound from an Entity?

chrome beacon
misty current
#

what about the opposite?

misty current
#

is there a load method?

eternal oxide
chrome beacon
#

Yeah

tender shard
chrome beacon
#

Can't remember exactly what it is though

misty current
tender shard
misty current
#

i thought there was some way to set the entities of a structure without nms and incase you couldn't, i had already (kind of) figured out how to do it with nms and that involved nbt compounds

tender shard
#

so if anyone ever decides to have a bad time by trying to code an anti cheat, you always have to take into account that packets may come in at "random" times

misty current
#

there's an EntityInfo list that holds all the entities and it is constructed with an nbtcompound, a vec3d and a blockposition

#

so time to do some digging

eternal oxide
#

Kind of. However being TCP they are always passed in order. Missed packets are re-requested, and other packets are held until the correct order is received

tender shard
eternal oxide
#

Yep, not a good method

tender shard
#

coding anti cheats is probably the most annoying kind of spigot plugins lol

#

I wouldn't waste my time on that

humble tulip
#

Yes it is

#

100% agree

winged anvil
misty current
#

construct an entity object to call the method on it?

chrome beacon
#

I believe so

misty current
#

oh there's a method in EntityTypes that returns an entity if you provide a world and the compound

tender shard
#

IIRC there's a method that takes an ItemStack[] and returns the proper crafting result, if there's any

tender shard
#

mb

#

I wonder why it asks for a world

shadow gazelle
#

Is there any way that I could make this work if one slot had more items than the other?

        } else if ((slot0 != null && slot0.isSimilar(new ItemStack(Material.GOLD_INGOT, 1)))
                && (slot1 != null && slot1.isSimilar(new ItemStack(Material.SOUL_SAND, 1)))) {
            int slot0Amount = slot0.getAmount();
            int slot1Amount = slot1.getAmount();;
            ItemStack output = soularium();

            if (slot0Amount == slot1Amount) {
                inventory.setRepairCost(6 * slot0Amount);
                if (output.getAmount() > 1) output.setAmount(slot0Amount);
                event.setResult(output);
            }
        }
#

I tried doing it before, but it ended up eating items

glossy wren
#

quick question, is it possible to allow sprinting while not having any saturation?

shadow gazelle
tender shard
shadow gazelle
#

gold + soul sand makes a custom item that's used in the crafting of an item for something that my plugin adds

tender shard
#

why don't you just add a normal recipe instead of using the event?

shadow gazelle
#

Anvil recipes aren't a thing

tender shard
#

hm

#

I don't think that you can do anything about it consuming the whole itemstack

#

you should either only allow using 1 item, or use a runnable and "give back" the remaining items one tick later or sth like that

shadow gazelle
#

hmm

#

Would probably just be less confusing to limit it to matching amounts until I figure out a way to fix it, then

tender shard
#

yeah probably

quiet garden
#

Was Persistent Data Container introduced in 1.13 or 1.14?

tender shard
#

1.14.1

quiet garden
#

alr

tender shard
#

for entities, itemmeta etc

#

for chunks in 1.16.3

#

for worlds in 1.18 or sth

quiet garden
#

ty

tender shard
#

np

#

what do you need it for?

quiet garden
#

nah was just wondering if I could remove using nbt for 1.13

tender shard
#

oh ok

#

but tbh

#

noone uses 1.13 anymore

#

just check bStats

#

do you actually have illegal entities at that position?

#

e.g. itemframes without a supporting block?

#

hm then I don't know too

quiet garden
tender shard
quiet garden
#

yea

tender shard
#

should work fine. spigot should be able to load itemstacks from older versions just fine. or did you experience any problems with this?

knotty gale
#

anyone know how to check if an arrow was shot by a dispenser?

tender shard
quiet garden
tender shard
#

I am afraid you'll have to deal with that yourself, since 1.13 changed all the material names

quiet garden
knotty gale
#

is my real question

tender shard
#

e.g. a red stained glass pane isn't just "GLASS_PANE" anymore but now indeed a "RED_STAINED_GLASS_PANE"

quiet garden
#

yea

chrome beacon
#

You can use the XSeries library

tender shard
#

I mean XMaterial and XBlock exist

chrome beacon
#

^

quiet garden
tender shard
#

but not sure if those can handle parsing a ConfigurationSection that represents a block

tender shard
#

I only started doing MC plugins when 1.13 came out

quiet garden
#

I only need to store the materials not the full stack

quiet garden
#

I suppose Ill experiment with that

tender shard
#

yeah maybe you're lucky, i really don't know

quiet garden
#

how would you even set a red stained glass pane in code?

#

like the material would still be Stained_glass_pane

#

material data I'd assume

humble tulip
#

RED_STAINED_GLASS_PANE?

#

or are u using 1.8-1.12?

#

use setDurability

#

or u can use setData

knotty gale
#

is there an event that detects when a redstone lamp turns on?

humble tulip
knotty gale
#

I did 💀

crude cobalt
#

If I use lists to store player data, will there be a memory leak?

knotty gale
#

and found nothing

humble tulip
#

If u don't remove it on leave

#

And maybe use maps

#

Map uuid, data

#

For quick lookups

tender shard
#

POG md5 is my man, already fixed the "actionbar" issue

restive mantle
#

so has GameProfile been replaced by something in NMS

humble tulip
#

Nah idts

fossil lily
#

If I use .getDisplayName() on a default item, will I get the actual name?

humble tulip
#

Not sure

tender shard
#

it's non-NMS and part of the API

#

and has been since 1.18.1

humble tulip
#

Pretty sure the defult names are handled clientside by the language

restive mantle
#

but I need to extend ServerPlayer to create an NPC which requires a GameProfile?

humble tulip
#

If u wanna create a npc u still need to use nms gameprofile I'm pretty sure

restive mantle
#

Ok but my current issue is that the remapped jar doesn't have the GameProfile in it

humble tulip
#
        <repository>
            <id>minecraft-repo</id>
            <url>https://libraries.minecraft.net/</url>
        </repository>
        <dependency>
            <groupId>com.mojang</groupId>
            <artifactId>authlib</artifactId>
            <version>1.5.21</version>
            <scope>provided</scope>
        </dependency>
restive mantle
#

oh its seperate now?

humble tulip
#

idk if u need that but i use it for skulls

#

idk

#

i use that to get gameprofile for skulls

lethal coral
#
        <dependency>
            <groupId>com.mojang</groupId>
            <artifactId>authlib</artifactId>
            <version>1.5.25</version>
            <scope>provided</scope>
        </dependency>

and this should be the most updated dependency

lethal coral
humble tulip
#

Ah ok

#

I use it in a project i dont use nms in

sage patio
#

How I can register a command like this one (in another class)

river oracle
#

gross static access also don't name your main class Main. Anyways its really easy just instantiate the object of the listener class

humble tulip
#

u need plugin, command string, and commandexecutor

#

Why u passing the plugin when u have main.getInstance

#

I'm confusion

sage patio
#

i didn't understood yet how to do it, but thanks for useful tips

humble tulip
#

Don't create a method like that to register listenerz

#

Or commands

#

Do it the regular way

sage patio
dusty herald
#

hello static abuse

tender shard
#

joch wassuuup

#

imajin and me are playing 1.19 survival, you should join too lol

tender shard
sage patio
tender shard
#

registering commands (imho at least) should be always doe in your main class

tender shard
sage patio
#

its a util for easier use, like that example in screenshot

sage patio
tender shard
#

what type does "yourInstance" have?

#

if it's a JavaPlugin, then it definitely has that method

sage patio
tender shard
#

you definitely can use "getCommand" on that

sage patio
tender shard
#

yeah you declared getInstance to return "Plugin"

#

make it return "JavaPlugin" instead

sage patio
#

can i change public static Plugin plugin; to public static JavaPlugin plugin; ? (line 11)

tender shard
#

yes

sage patio
#

again

river oracle
#

Why are you using the generic JavaPlugin 🤔

tender shard
#

show your getInstance() method again

#

it should return a JAVA plugin

sage patio
#

plugin

tender shard
tender shard
sage patio
tender shard
#

when you declare a method you always have to define WHAT it returns

#

and you set it to Plugin

#

but it should be JavaPlugin

river oracle
#

wouldn't it be easier to just teach them Dependency Injection right away might as well considering its the best habit

tender shard
#

if we'd just tell them to replace "Plugin" with "TheirMainClassName" they will never actually realize what it does or why it suddenly works now

sage patio
#

but this is returning the JavaPlugin

#

ow

tender shard
sage patio
#

i got it

tender shard
#

You say that it returns "Plugin"

#

but you should instead either return "JavaPlugin" or your main class

sage patio
#

yes nice

tender shard
#

yeah you see? "Plugin" does not have any "getCommand" method, but "JavaPlugin" does. Ideally your "getInstance()" method shold also not return JavaPlugin but the actual class of your plugin

#

for example like this

public static MyPluginClass getInstance() { return instance; }
sage patio
#

thanks, this is the reason my brain is not working right

tender shard
#

someone who wants to get your instance will never want to get a generic JavaPlugin, they want to get the concrete class of your plugin

#

if they just wanted a generic javaplugin instance they'd just use Bukkit.getPluginManager.getPlugin(String)

#

so yeah make "getInstance()" return your main class' instance

#

e.g. like this

@DoNotRename
    public static Drop2InventoryPlugin getInstance() {
        return instance;
    }
sage patio
#

ow, so with this i do not need to create a JavaPlugin too

tender shard
#

whut

#

no

#

you need to understand how classes and instances work

#

you can easily return your "MyPlugin" object by declaring a method that returns a "Plugin". But obviously your "MyPllugin" object has some additional methods that "Plugin" does not have. So you'd either have to cast the "Plugin" instance to "MyPlugin" or just directly declare that the method returns "MyPlugiN" instead of a generic "Plugin"

#

this is one of those things that are awesome in java but confusing to people who are new to java and come from other, not-so-strictly typed languages

#

when you declare a method to return a "Plugin" you can only use methods on that object that come from the "Plugin" class

#

So if you want people to be able to use any methods that are from a "lower" scope (JavaPlugin, or your concrete plugin instance), then you should tell everyone that "getInstance()" doesn't just return a plugin, but that it indeed does return a JavaPlugin. Or exactly your plugin. I hope you understand what I mean lol. If not feel free to ask again

tender shard
shadow gazelle
#

Can someone check this for me? I'm not sure if I'm still sane after working on this.

EntityDamageByEntityEvent damageEvent = (EntityDamageByEntityEvent) deadEntity.getLastDamageCause();
            Player killer = (Player) damageEvent.getDamager();
            PlayerInventory killerInventory = killer.getInventory();

            if (!event.getDrops().isEmpty() && killerInventory.getItemInMainHand().containsEnchantment(TELEKINESIS)
                    && (!plugin.getConfig().getBoolean("use-enchant-permissions")
                    || killer.hasPermission("nce.enchant.telekinesis"))) {
                Iterator<ItemStack> drops = event.getDrops().iterator();

                while (drops.hasNext()) {
                    ItemStack nextItem = drops.next();
                    Map<Integer, ItemStack> addItems = killerInventory.addItem(nextItem);

                    if (!addItems.isEmpty() && !addItems.containsValue(nextItem)) drops.remove();
tender shard
#

it's like 3 meters away

tender shard
shadow gazelle
#

No, I'd rather know if I made some stupid mistake before running it and spending another 30 mins trying to figure out what that is

tender shard
#

hm that's stupid imho

#

you should test it yourself

#

and if something doesn't work, then feel free to ask again

#

I mean were not here to review your code and tell you wether it works or not. you should just try it yourself, and if something indeed doesn'T work, then feel free to tell us what exactly doesn't work and then someone will happily answer and try to help you

shadow gazelle
#

I'm trying to make sure I didn't do something semi-obviously wrong

tender shard
#

it looks good to me on first glance

#

but noone's gonna spend more than 20 seconds into reviewing code that you haven't even tested yourself

#

you can probably understand that lol

shadow gazelle
#

I can

tender shard
#

just run it and see what happens :3

#

there are no obvious mistakes from what I see

shadow gazelle
#

A glance is all was really asking for, basically if there's anything that clearly makes zero sense because half of my brain cells are fried

tender shard
#

the order is like this:

  1. try it yourself
  2. if it fails, go to spigot discord
    lol
vocal cloud
#

If it fails google error first. Then ask when you've tried everything

tranquil viper
#

Is there a way to get the type of arrow shot in EntityShootBowEvent

tender shard
#

getConsumable()

tranquil viper
#

oh dope

#

thanks

tender shard
#

np

quaint mantle
#

balls

tender shard
quaint mantle
#

el huevo

tranquil viper
#

What is Potion#fromItemStack() replaced by?

#

I guess I could do event.getItem().getType() == Material.SPLASH_POTION huh using PlayerInteractEvent

#

Also anyone know why my IntelliJ started randomly freezing every 10 minutes?

#

Never had this before, and my pc should be more than capable of running a project with 50 lines of code

humble tulip
#

ivalidate and restart

winged anvil
#

we def need a DI blog post

eternal night
#

?di

undone axleBOT
nova sparrow
#

what happens if you use the Inventory#getItem() method and that slot of the inventory doesn't have anything

#

does it just return null?

winged anvil
#

still never figured out the glowing btw

shadow gazelle
#

partially

tender shard
#

if it's annoted with NotNull then it will return an AIR itemstack. if not, it'll probably return null

shadow gazelle
#

Oh 🤦‍♂️

#

well, I'm not checking null

tender shard
shadow gazelle
#

if (!addItems.containsValue(nextItem)) drops.remove();

winged anvil
#

nah ur good

shadow gazelle
#

Do mob drops not drop if you modify them?

nova sparrow
#

The javadocs simply state that the itemstack found in that slot is returned

nova sparrow
#

This is the response for the response I got to the question

#

sorry

#

that I asked

shadow gazelle
#

oh

#

mb

lethal coral
#
            Vector forwards = Movement.getVector(player, Movement.Direction.FORWARDS);
            final Location initialLocation = player.getLocation();
            final boolean[] isCancelled = {false};
            final World world = initialLocation.getWorld();
            world.playSound(initialLocation, Sound.ITEM_CROSSBOW_SHOOT, 3f, 0.75f);
            for (int i = 0; i < 15; i++) {
                int finalI = i;
                new BukkitRunnable() {
                    @Override
                    public void run() {
                        System.out.println("running");
                        if(isCancelled[0])
                            System.out.println("cancelling - " + finalI);
                            cancel();
                        Location loc = Movement.getLocation(initialLocation, forwards, finalI);
                        world.spawnParticle(Particle.BLOCK_CRACK, loc, 15, Material.CHAIN.createBlockData());
                        world.playSound(loc, Sound.BLOCK_CHAIN_BREAK, 2f, (float) (0.5 + (double) finalI /10));
                        System.out.println("played chain stuff");
                        for(Player entity : loc.getNearbyPlayers(1.5)){
                            System.out.println("checking players");
                            if(entity != player){
                                System.out.println("entity isn't player should be pushing now (" + entity + " ~ " + player + ")");
                                isCancelled[0] = true;
                                Movement.pushEntity(entity, Movement.fromLocations(entity.getLocation(), player.getLocation()), 1.5, true);
                                player.playSound(player.getLocation(), Sound.ENTITY_ARROW_HIT_PLAYER, 2f, 1f);
                                return;
                            }
                        }
                        System.out.println("checking block");
                        if(world.getBlockAt(loc).getType() != Material.AIR){
                            System.out.println("material isn't air let's go chief push the player");
                            isCancelled[0] = true;
                            Movement.pushEntity(player, Movement.fromLocations(player.getLocation(), loc), 1.5, false);
                        }

                    }
                }.runTaskLater(this, 1 + i);
#

I'm not quite sure what this error means

shadow gazelle
#

The value it's getting is infinite

lethal coral
#

how

#

the radius is 1.5

fossil lily
#

anyone know what the heck this is? Using LocaleLib.

shadow gazelle
#

What's on line 325*

lethal coral
#

the get players in radius

shadow gazelle
#
                        for(Player entity : loc.getNearbyPlayers(1.5)){
                            System.out.println("checking players");
                            if(entity != player){
                                System.out.println("entity isn't player should be pushing now (" + entity + " ~ " + player + ")");
#

???

lethal coral
#

I don't get the confusion

shadow gazelle
#

There's no getNearbyPlayers in Location, for one

lethal coral
#

there is

tranquil viper
#

Is there an event for when an end crystal explodes

nova sparrow
#

I think it might be a part of the paper api

#

but not the spigot one

tranquil viper
#

Oh fr

nova sparrow
#

oh wait sorry

#

it was answering hexicDragon2

shadow gazelle
tranquil viper
#

oh ok nws

lethal coral
shadow gazelle
#

bruh

#

Paper has a Discord server with a channel for it's API

lethal coral
#

sure but this one method isn't going to change anything

#

I guess I'll seeya though

shadow gazelle
#

I have no idea how that's returning an infinite number

#

oh, wait

#

Is it a float trying to convert to a double?

ornate patio
#

other than EntityDeathEvent, what ways can a horse "disappear"? I'm keeping a cache of all horses on the server and I want to make sure I'm removing any horses that do not exist

shadow gazelle
#

Could be that

lethal coral
#

should I cast to double

shadow gazelle
#

Yes

ornate shore
#

qq

shadow gazelle
#

Numbers with decimals default to floats, I think

lethal coral
tranquil viper
#

getNearbyLivingEntities

#

instead of getNearbyPlayers?

shadow gazelle
tranquil viper
#

getNearbyPlayers will only return player objects, not entities

lethal coral
#

I only want players

ornate shore
#

This is my first time here. Do you know if the spigot came out?

shadow gazelle
#

what

lethal coral
tranquil viper
lethal coral
#

I suppose I should've used p

tranquil viper
lethal coral
#

sir

tranquil viper
#

Oh wait

lethal coral
#

that's what I want I just didn't name the variable well

shadow gazelle
#

@lethal coral other than Java converting it wrong, I'm not sure what it could be other than some weird thing with Paper's API

tranquil viper
#

So if you want nearby players then just use the built in method? Not sure what your problem is

ornate shore
#

Will someone answer me? :((

shadow gazelle
#

Your question makes no sense

#

Natreg

tranquil viper
delicate lynx
#

I mean spigot is out

ornate shore
#

This is my first time here. Do you know if the spigot came out?

delicate lynx
#

not sure what you mean by that

shadow gazelle
tranquil viper
#

If you mean 1.19? I don't think there are any stable builds

tranquil viper
shadow gazelle
#

yes

ornate shore
#

I need a spigot core at 1.19

tranquil viper
#

then use the snapshot

shadow gazelle
#

wait until it's updated

tranquil viper
#

he just sent

#

1/2 a second ago

#

or wait

shadow gazelle
#

unless you want to use the snapshot

tranquil viper
#

simple as that

delicate lynx
#

use buildtools

shadow gazelle
#

or just use Paper if you're looking for the software

lethal coral
#

still got the error though

tranquil viper
#

despawn I believe

shadow gazelle
ornate patio
shadow gazelle
#

EntityDespawnEvent?

ornate patio
#

oh

#

alright thanks

shadow gazelle
#

that isn't right lol

#

it was a guess

ornate patio
#

oh

shadow gazelle
#

I wonder if EntityDeathEvent handles despawn, too

#

there's no despawn event for entities other than item entities as far as I can tell

tranquil viper
#

You can listen to chunks being loaded and then store all the horses in the chunk

shadow gazelle
ornate patio
tranquil viper
#

Just add it to a list when they load

ornate patio
#

yeah

ornate patio
shadow gazelle
#

Then it's probably not a thing

ornate patio
#

i think im just gonna have to like have a cron job every hour or something

shadow gazelle
#

You could track entity IDs and check them in a loop

ornate patio
#

to reset horse chache

lethal coral
tranquil viper
#

Override horse spawning from the get-go 👀

ornate patio
#

also one more question, is it possible to use pathfinding features on NMS horses in unloaded chunks?

ornate patio
#

i am using custom horses

tranquil viper
#

Well if you are using custom horses that means you can interact with them already, no?

ornate patio
#

wdym interact with them

tranquil viper
#

Like you already know if they exist or not

#

And you have a list of them

ornate patio
#

yeah I have a list of wrapper instaces for the NMS horse

tranquil viper
#

I guess the only way they can disappear is entity death event

ornate patio
#

yeah

#

well

#

how do i simulate despawning an entity so i can test it

ornate shore
#

Where can I download a ready-made spigot kernel

river oracle
#

what the hell

undone axleBOT
tranquil viper
#

Is there an event that tracks when a respawn anchor explodes?

quaint mantle
#

im still new to java, I have a method which creates an item in another class, how can i get that item in a different class?

#

how do i get verifyed

#

nvm

#

im just verifyed stupid ha ha ha

river oracle
#

Google is your best friend for simple shit