#help-development

1 messages · Page 592 of 1

quaint mantle
#

rearrange code i think actually

#

something like that

#

I recommend to read a book called “clean code”

onyx fjord
#

?

quaint mantle
#

just learn how to format it properly and then you don't have to use something to do it for you

#

¯_(ツ)_/¯

#

?

onyx fjord
#

if you have non standard formatting add .vscode folder and put your formatter changes in the settings there

quaint mantle
#

You can also use eslint and prettier for that

sturdy reef
#

stop dirt turning to grass?

#
@EventHandler
    public void onBlockChange(BlockPhysicsEvent event){
        if(event.getSourceBlock().getType()==Material.DIRT&&event.getChangedType()==Material.GRASS_BLOCK)
            event.setCancelled(true);
    }```
#

tried this and it didn't help

idle sparrow
#

event.getSourceBlock().getType()==Material.DIRT&&event.getChangedType()==Material.GRASS_BLOCK that formmating is wild

placid moss
#

are you sure blockphysics event is trggered

smoky anchor
idle sparrow
#

zero spaces lol

smoky anchor
#

exactly

idle sparrow
#

y muh code not wurk bruh

smoky anchor
sturdy reef
smoky anchor
#

one thing you can do is: put debug messages with the sourceBlock.type and changedType and go to an empty world to try and see what it prints

shadow night
#

is there an event for when a player has a new item in his inventory? Like, in any way, taken from a chest, picked up, crafted, given through commands, etc.

eternal oxide
#

no

shadow night
#

so, I will have to listen to all kind of events where the player can get an item through?

#

please tell me somebody has a library that does that

vivid cave
#

when does PrepareAnvilResult trigger ?
does it trigger following a client request to server ?
or does server find out by itself that the inventory has changed in the anvil ? and therefore prepare a new result
(i need a specific answer)

vivid cave
#

Can't think of anything else

shadow night
#

Hmm

#

Either I listen to event or I check every tick for inventory changes

vivid cave
#

it depends on what tracking level you want to be honest
If you agree to occasional misses/untracked items (for whatever reasons, like commands/plugin interferance), then prolly listen to events
Otherwise if it's of UPMOST importance that you don't miss a single one, go with the task ticking at every tick thinggie.
If you're going to do the task, I would advise to do it ASYNC.

lament plank
#

How do i launch a player Forward

#

Because it just keeps highlighting .setVelocity on red

eternal oxide
#

what are you passing to setVelocity?

lament plank
eternal oxide
#

setVelocity takes a vector

lament plank
#

vector is in red as well

eternal oxide
#

?nocode

undone axleBOT
#

It’s hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.

lament plank
eternal oxide
#

V not v on Vector

lament plank
#

the set velocity is till red

eternal oxide
#

Seriously?

lament plank
#

yh

eternal oxide
#

?basics

undone axleBOT
lament plank
#

woops

#

forgor

#

ty for pointing it out

#

ty for help

shadow night
shadow night
vast ledge
#

use an if statment

#

n inventory change or smth

#

on*

shadow night
#

yeah that's understandable but there is no event that is fired on any change of inventory, I need to listen to like 3 events

vast ledge
#

yea and?

#

the listen to 3 events

#

then*

shadow night
#

I will

vast ledge
#

ok

shadow night
#

I know how to do it, just that 3 events seems a lil too much

vast ledge
#

is there not an inventory change event?

shadow night
#

Seems like not

vast ledge
spare hazel
#

how to get the player location as a block location?

vast ledge
shadow night
#

InventoryAction is not an event

spare hazel
#

okay thanks

vast ledge
sterile breach
#

HI, its possible to set the tab completion for command of another plugin?

shadow night
#

Hmm, I think it is, but I don't know how

hazy parrot
#

Get it's JavaPlugin instance, getCommand and setTabCompleter on it

young knoll
#

There’s only 2 inventory events

#

Click and drag

eternal oxide
#

inventory can also change when interacting with armor stands

shadow night
#

So, player interact event?

young knoll
#

Oh are we talking any change?

#

Have fun then

vivid cave
shadow night
#

Maybe I should just t i c k

young knoll
#

PlayerInteractEntity

#

PlayerPickupItemEvent

eternal oxide
#

can't detect dropping items with Q either

shadow night
#

I'm just checking every tick, okay?

eternal oxide
#

I'd check slower

shadow night
#

Because I'm not listening twenty events

eternal oxide
#

every 5 ticks or every second

shadow night
#

That can not capture something, in theory

eternal oxide
#

you don;t need to detect a change faster than every second for your purposes

shadow night
#

Ok

pseudo hazel
#

listening to a few events is still better though

eternal oxide
#

just using events will miss changes

pseudo hazel
#

like what ones

eternal oxide
#

pressing Q

pseudo hazel
#

I mean maybe the give command

#

there are events for that

eternal oxide
#

nope

#

not unless it was added in teh p[ast month or so

pseudo hazel
#

PlayerDropItemEvent?

#

I have been using it for the past few years in 1.18+

#

so idk when it was added

#

but it exists 120% sure

eternal oxide
#

I can't test at the moment, but last time I tried tracking inventories Q was completely missed

pseudo hazel
#

maybe save for the /give command spawning items in your inv you can detect any other change in the player inventory

#

well I am actively using it in my plugin

young knoll
#

Internally minecraft has an event for inventory change

#

It’s used for advancements

#

It’d be nice to expose it one day

hushed spindle
#

is it fine to loop through the values() of an enum in a static method within said enum called on a static variable also in said enum or will that cause some initialization error

sorta like this

#

or would it be better to do that elsewhere

quaint mantle
#

What theme is that

pseudo hazel
#

I think thats fine

hushed spindle
#

one that i unfortunately got used to

#

eclipse dark theme

pseudo hazel
#

that theme is called eclipse im pretty sure

#

or not?

hushed spindle
#

yeah its eclipse

pseudo hazel
#

nice, my memory does not deceive me

hushed spindle
#

i like how varied the colors are because it somehow helps with dyslexia lol

pseudo hazel
#

I like colors too

hushed spindle
#

epic

opal juniper
#

it would be nicer if it was just like a lookup but, meh

quaint mantle
#

The colors are great

hushed spindle
#

a lot of people have been calling it an eyesore lol

#

which i sorta get

quaint mantle
#

I use light themes

spare hazel
quaint mantle
#

Why

charred blaze
#

hey can anyone share correct way to add players tab completion on bungeecord commands? Im currently listening to TabCompleteEvent and returning online players names

shadow night
pseudo hazel
#

well internally means you cant use it

#

only if you work at mojang

hazy parrot
tribal valve
#

so i have this:

if (args[1] != "*") {
  sender.sendMessage(FCore.prefix + ChatColor.RED + "Player is not online");
  return true;
}
``` and when i type * it still prints that the player is not on server
quiet ice
tribal valve
#

why

quiet ice
#

Trust me bro

#

I ain't going to explain OOP to you

tribal valve
#

i heard that when you use .equals it checks for the memory slot if its the same and not for the string itself

young knoll
#

You’ve got that backwards

#

== checks memory location

tribal valve
#

ohhh

#

but i use == and it works

#
if (args.length == 1) {}
``` this works
#

i used equals and still doesn't work

urban mauve
#

does GenericSpeed attribute change player's speed while he jumping? like slowness potion and jumping? is it will be same or player's speed will be same like he walkin'?

smoky anchor
tribal valve
spare hazel
#

how can i create a temp Minecart and make it invincible and invisible?

smoky anchor
#

invisible possible only with a resourcepack
invincible - probably cancel event on your "custom" minecart
But.. why do you need a minecart ?

urban mauve
smoky anchor
#

well yes

quiet ice
#

This seems really straightforward to me as you can just use the two bukkit methods for that

upper hazel
#

hi boys end gers

quiet ice
#

So ... What is the catch?

spare hazel
upper hazel
#

i bad speak english but i will use translate

smoky anchor
#

minecarts can not be given invisibility

quiet ice
#

That's stupid

smoky anchor
#

that can be invisible

upper hazel
#

Who knows what entity is used to create a plugin for the ball in the bukkit api?

spare hazel
smoky anchor
#

usually you would use an armor stand I believe

spare hazel
#

can u ride an armor stand?

smoky anchor
#

or snowball if you need a different trajectory

spare hazel
#

but wait

smoky anchor
#

with plugins, yes

spare hazel
#

gravity affects different enitities differently

quiet ice
#

I'd use bats but it all boils down to the same thing

upper hazel
#

can i spin the snall ball if i want? I just saw that when you hit the ball, it was spinning or is it such a texture pack?

quiet ice
spare hazel
quiet ice
#

Won't change anything, right?

spare hazel
#

it will

#

no gravity no velocity

quiet ice
#

Really?
God mc is dum

#

?jd-s

undone axleBOT
spare hazel
#

lemme just check how hypixel did it

quiet ice
spare hazel
#
public static Vector getVelocity(Location start, Location end){
        double flatDistance = Math.sqrt(Math.pow(end.getX() - start.getX(), 2) + Math.pow(end.getZ() - start.getZ(), 2));
        double Y = (flatDistance * 32) / 2;
        return end.clone().toVector().subtract(start.toVector()).add(new Vector(0, Y, 0));
    }

and the calculations here are broken can anyone take a look at them? they throw the player a few blocks off

#

and when i say a few i mean 20 blocks

spare hazel
eternal oxide
#

you can not throw a player beyond a certain distance. You have to do it incrementally

urban mauve
#

any solution like PlayerJumpEvent?

spare hazel
quiet ice
urban mauve
smoky anchor
#

player stat event > Jumps ?

urban mauve
quiet ice
spare hazel
smoky anchor
#

when they take damage ?

quiet ice
smoky anchor
#

also, don't trust player.isOnGround()
Controlled by client, can be spoofed

#

?image

#

?img

undone axleBOT
quiet ice
#

Yeah you'd need to get the block below the player and check the Y coord of the player feet

sterile breach
#

hello, I am trying to recover the face of a block (like south, op, down etc...) (when it is broken) how to do?

smoky anchor
#

player has base 1 damage

spare hazel
#

is there a way to change the hardness of a block withouth using protocollib and mining fatigue?

smoky anchor
urban mauve
smoky anchor
#

Don't tag me to ask "do I know"

#

If I did I would answer

shadow night
#

is having a for loop in a for loop in a for loop and doing that every second gonna impact performance heavily enough to be notable?

smoky anchor
#

depends on how often you do this, how much you iterate, what you do

shadow night
#

uh

#

every 20 ticks, loop through all players, loop through all their inventory items and loop through a list and do stuff

smoky anchor
#

well if you have to do this, then you can split the inventory interating for different players on different ticks

#

but yeah.. it does sound bad

shadow night
#

I need an event to know when the player has a new item

eternal oxide
#

no need to iterate the inventory, just use .contains

smoky anchor
#

create an advancement for every item

smoky anchor
eternal oxide
#

yes, but he was about to get teh contents and loop every item

urban mauve
smoky anchor
#

minecraft does not have double jumps ?

shadow night
eternal oxide
#

yes

shadow night
#

won't work for me

eternal oxide
#

why?

shadow night
#

diamond sword with custom model data with a shit ton of stuff that I'm not checking

urban mauve
smoky anchor
#

cause you can't jump if you're not touching ground ?

#

what are you trying to do

#

mid-air jumps are usually checked with "player wants to fly" thingie

urban mauve
brave lynx
shadow night
#

I wonder how many players are enough to make that cause any lag

eternal oxide
#

what effects are you applying with these items

upper hazel
#

how add image here

shadow night
#

I think I'm gonna do it in a different way

eternal oxide
#

you could tie these to enchants

#

so when x enchant is applied you do your thing

upper hazel
#

<dependency>
<groupId>com.sk89q.worldguard</groupId>
<artifactId>worldguard-bukkit</artifactId>
<version>7.0.5</version>
<scope>provided</scope>
</dependency>

#

so many vulnerabilities

shadow night
eternal oxide
#

as ItemStack enchants can be set to only activate when worn in a specific slot

shadow night
upper hazel
#

wth maven trush?

tender shard
upper hazel
#

Provides transitive vulnerable dependency maven:com.google.code.gson:gson:2.8.0 CVE-2022-25647 7.5 Deserialization of Untrusted Data vulnerability with medium severity found Results powered by Checkmarx(c)

#

Provides transitive vulnerable dependency maven:com.google.guava:guava:21.0 CVE-2018-10237 5.9 Allocation of Resources Without Limits or Throttling vulnerability pending CVSS allocation CVE-2020-8908 3.3 Incorrect Permission Assignment for Critical Resource vulnerability pending CVSS allocation Results powered by Checkmarx(c)

#

Provides transitive vulnerable dependency maven:commons-codec:commons-codec:1.11 Cxeb68d52e-5509 3.7 Exposure of Sensitive Information to an Unauthorized Actor vulnerability pending CVSS allocation Results powered by Checkmarx(c)

#

Provides transitive vulnerable dependency maven:org.apache.commons:commons-compress:1.19 CVE-2021-35515 7.5 Excessive Iteration vulnerability pending CVSS allocation CVE-2021-35516 7.5 Improper Handling of Length Parameter Inconsistency vulnerability pending CVSS allocation CVE-2021-35517 7.5 Improper Handling of Length Parameter Inconsistency vulnerability pending CVSS allocation CVE-2021-36090 7.5 Improper Handling of Length Parameter Inconsistency vulnerability pending CVSS allocation Results powered by Checkmarx(c)

remote swallow
#

you can ignore most of them

shadow night
#

yep

tender shard
#

why don't you update your worldguard dependency to latest

upper hazel
#

lol but this say this very bad

#

i use for 1.16.5

tender shard
#

7.0.8 and 7.1.0-SNAPSHOT both work on 1.16

#

also you're not shading any of those dependencies so transitive vulnabirilities don't matter at all for you

urban mauve
#

i made a custom PlayerJumpEvent, it works based on statistics
when the player presses the jump button 1 time, it works, but when he presses it twice in a row, it skips the jump. any ideas about this?

remote swallow
#

because they're already in the air

upper hazel
urban mauve
shadow night
#

somebody please create an inventory change event which is fired on any change of the player inventory, because wow this is fucked up

pseudo hazel
#

cancel the player move event

#

will kick players when in mid air though

#

atleast for me it did

upper hazel
#

guys, gentlemen, I would like to ask you something. I make my "good" plugin for the hologram, but the problem is (because the hologram is an armourstand) the hologram gets stuck and shifts to the side if it is in some kind of block (I make the plugin for airdrop and the hologram shifts because of the chest)

tribal valve
#

Is there a way to connect a discord bot to Minecraft plugin? Like a verification, you need to enter a "password" that bot sent you into a Minecraft command. So bot sent u a password, and you need to enter a /verify command on Minecraft server with the password as argument, and then the bot gives you roles etc.

upper hazel
shadow night
tribal valve
quaint mantle
#

bro what the hell

shadow night
#

I had the same issue

quaint mantle
#

how did u fix it

shadow night
#

apparently it was the mc dev plugin

upper hazel
shadow night
#

whatever you call it

quaint mantle
shadow night
#

you can work without it

tribal valve
quaint mantle
tribal valve
#

They locked me in a room, a rubber room, a rubber room with rats, and rats make me crazy.

shadow night
#

well, this is not the channel to be discussing that

tribal valve
#

Okay sr

remote swallow
quaint mantle
#

Crazy? i was crazy once. They locked me in a room. A rubber room. A rubber room with rats. and rats make me crazy.

stray trench
#

can someone help me i am trying to add 3 absoption hearts to an player but i can find any information online on how to do it

upper hazel
quaint mantle
upper hazel
#

wth how you add vidio ii not can

quaint mantle
#

verified

upper hazel
#

oh good

brave lynx
#

Hey, does anyone have any ways I can disable moving completely? I have managed to disable jumping & moving on land but if the place is in water or is submerged, the player moves freely

quaint mantle
#

i dont want you to be able to take out the items

#

from the other inventory

#

but u still can with double clicking the item on your own inventory

upper hazel
#

what this do

#

ah i see

quaint mantle
#

|| event.getClick() == ClickType.DOUBLE_CLICK || event.isShiftClick() i think this should help

shadow night
#

incase of event.getAction() == InventoryAction.COLLECT_TO_CURSOR, how do I know what slot it has been taken away?

shadow night
#

lol

#

I answered somebodies question with my question

quaint mantle
#

nvm it didnt work

shadow night
timid hedge
#

How do i make so if you write "test" on the first line of the a sign all the lines will be set to example "123"?

tender shard
#

ugh how am I uspposed to add the BSD license to my pom.xml and where do I even find the original text of it o0

worldly ingot
#

Depends on which one you want. There are multiple BSD licenses

tender shard
#

the one buildtools uses

#

bsd clause 3 IIRC

worldly ingot
#

Yeah, that's in that wiki page there

#

Verbatim text you can copy/paste and replace placeholders

tender shard
#

?paste

undone axleBOT
tender shard
#

i alöso don't really understand how someone is supposed to know that buildtools is BSD 3 when it's nowhere mentioned

tender shard
#

there also doesn't seem to be any official link to the bsd 3 license, at least I couldn't find any

stray trench
#

does anyone know how to set absorption hearts in 1.8

tender shard
#

guess I'll just go back to GPL3, at least they mention in their license text that it's GPL 3, unlike BSD3 which just mentions some things but doesn't even give its own license a name

shadow night
#

what inventory action could be when a player picks up an item in any way?

#

if the player shift clicks, what action is it?

worldly ingot
#

Well the idea is that the actions are all distinct lol

#

So you'll have to account for multiple actions

#

Or rather, probably more appropriately, you can check whether the current item is null and the clicked item is not (the first condition being optional if you want to include swaps)

pseudo hazel
#

shift click is inventory click event

#

pick up from the ground is entityPickupItemEvent or something

shadow night
#

Yeah something like that

#

I just have a shit ton of events rn just for simple shit

cinder abyss
#

Hello, my armor stand I don't have the text of the armor stand displayed, how can I fix this ?java ArmorStand stand = Objects.requireNonNull(location.getWorld()).spawn(location, ArmorStand.class); stand.setInvisible(true); stand.setInvulnerable(true); stand.setGravity(false); stand.setMarker(true); stand.setCustomNameVisible(true); stand.setCustomName(text);

quaint mantle
#

why in realmines it says you could write placeholder "%realmines_secondsleft_MINE%" and it doesn't work

#

/hd create beacon_count &fMine reset in: &u%realmines_secondsleft_BEACON%

pseudo hazel
upbeat fog
#

I need some help with a plugin. I created a custom mob which spawns randomly on block break and when I do get the boss, from the block it shows an error in the console, but the mob works perfectly fine.

upbeat fog
#

Caused by: java.lang.IllegalArgumentException: Plugin cannot be null
at com.dumbllama.hb.mobs.MiniSheep.<init>(MiniSheep.java:99) ~[?:?]
at com.dumbllama.hb.SpawnMobs.onBlockBreak(SpawnMobs.java:28) ~[?:?]

pseudo hazel
#

?whaterror

#

we need this command

upbeat fog
#

I made an instance in my main class, yet its still showing an error. However, this error doesnt appear when I use a command to spawn it.

#

Only when triggered by an event

#

I assume it has something to do with the instance, Ill try moving it into the main class

tender shard
#

show the stacktrace

pseudo hazel
#

I guess I should take time some day to just read all your blogs

upbeat fog
#

heres the whole error:

#

Caused by: java.lang.IllegalArgumentException: Plugin cannot be null
at com.google.common.base.Preconditions.checkArgument(Preconditions.java:145) ~[guava-31.1-jre.jar:?]
at org.bukkit.craftbukkit.v1_20_R1.scheduler.CraftScheduler.validate(CraftScheduler.java:464) ~[spigot-1.20.1-R0.1-SNAPSHOT.jar:3814-Spigot-64b565e-c1279f7]
at org.bukkit.craftbukkit.v1_20_R1.scheduler.CraftScheduler.runTaskTimer(CraftScheduler.java:196) ~[spigot-1.20.1-R0.1-SNAPSHOT.jar:3814-Spigot-64b565e-c1279f7]
at org.bukkit.craftbukkit.v1_20_R1.scheduler.CraftScheduler.runTaskTimer(CraftScheduler.java:187) ~[spigot-1.20.1-R0.1-SNAPSHOT.jar:3814-Spigot-64b565e-c1279f7]
at org.bukkit.scheduler.BukkitRunnable.runTaskTimer(BukkitRunnable.java:117) ~[spigot-api-1.20.1-R0.1-SNAPSHOT.jar:?]
at com.dumbllama.hb.mobs.MiniSheep.<init>(MiniSheep.java:99) ~[?:?]
at com.dumbllama.hb.SpawnMobs.onBlockBreak(SpawnMobs.java:28) ~[?:?]
at jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104) ~[?:?]
at java.lang.reflect.Method.invoke(Method.java:578) ~[?:?]
at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:306) ~[spigot-api-1.20.1-R0.1-SNAPSHOT.jar:?]
... 23 more

tender shard
pseudo hazel
#

will probably improve my code by like 20% xD

upbeat fog
#

}.runTaskTimer(plugin,500L,100L);

#

it has something to do with the instance

#

I dont get the error when I call the event in the main class

river oracle
#

just pass a reference into the constructor

tender shard
upbeat fog
#

I just used Main.getInstance()

ancient plank
amber vale
#

How can I detect a player attempting to break or take out the item from an item frame that is set as fixed? (You cant break fixed itemframes / take items out of them, and it doesnt trigger the EntityDamageEntity event when hit)

ancient plank
#

?jd-s (for me)

undone axleBOT
river oracle
#

?di

undone axleBOT
quaint mantle
#

why in realmines it says you could write placeholder "%realmines_secondsleft_MINE%" and it doesn't work
/hd create beacon_count &fMine reset in: &u%realmines_secondsleft_BEACON%

upbeat fog
ancient plank
#

@quaint mantle
1.) #help-server for server & non-development plugin help
2.) You'd probably be better off asking in the discord server for this plugin than in spigot.

tribal valve
#

What event is called when player leaves cuz there's no PlayerLeaveEvent there

#

I have implemented Listener

ancient plank
#

PlayerQuitEvent iirc

tribal valve
#

Ohh I'll try thanks

quaint mantle
ancient plank
#

On their plugin page

amber vale
#

How can I detect a player attempting to break or take out the item from an item frame that is set as fixed? (You cant break fixed itemframes / take items out of them, and it doesnt trigger the EntityDamageEntity event when hit)

urban mauve
dawn ledge
#

Hi,
I'm trying to modify a Block Display Entity to make its size or block displayed change. but I don't know how to do it. Can somebody help me ?

tribal valve
#
@EventHandler
    public void onPlayerDamage(EntityDamageByEntityEvent e) {
        if (e.getEntity() instanceof Player) {
            Player player = (Player) e.getEntity();
            //may add only add if damager is a player too (later/vote)
            this.cooldown.put(player.getUniqueId(), System.currentTimeMillis());
            Bukkit.getScheduler().runTask(FCore.GetInstance(), new Runnable() {
                @Override
                public void run() {
                    
                }
            });
        }
    }
``` how i can stop the task on some other event??
autumn cave
#

Hey, so Sign block state now has two sides (FRONT and BACK), so getLines() is deprecated in favor of getSide(...).getLines(). But Player::sendSignChange still sends only lines, not sides. Is this because lines should be in a certain order? Or its because it was forgotten in the update or is there now another way to send Sign Change update packet to the player? Thx

urban mauve
remote swallow
#

?conventions

ancient plank
remote swallow
#

theres a food convention happening in my mouth atleast 3 times a day

ancient plank
#

yum, food

river oracle
#

I have a Set<Chunk> of an area is there a good way to make a bounding box from that

#

I need a BoundingBox because I'm filtering with #getNearbyEntities which takes in a BoundingBox nvm solved I store everything i need to make a bounding box

tribal valve
#

how i can cancel task inside the task?

            Bukkit.getScheduler().scheduleSyncDelayedTask(FCore.GetInstance(), new Runnable() {
                @Override
                public void run() {
                    if (System.currentTimeMillis() - cooldown.get(player.getUniqueId()) >= 5000) {
                        if (bossBars.get(player.getUniqueId()) == null) {
                            Long TimeLeft = System.currentTimeMillis() - cooldown.get(player.getUniqueId());
                            String title = "ANTY-LOGOUT: " + Long.toString(System.currentTimeMillis() - cooldown.get(player.getUniqueId()));
                            BossBar bar = Bukkit.createBossBar(title, BarColor.RED, BarStyle.SEGMENTED_20);
                            bar.setProgress(TimeLeft);
                            bar.addPlayer(player);
                            bar.setVisible(true);
                        } else {
                            BossBar selectedBossbar = bossBars.get(player.getUniqueId());
                            Long TimeLeft = System.currentTimeMillis() - cooldown.get(player.getUniqueId());
                            String title = "ANTY-LOGOUT: " + Long.toString(System.currentTimeMillis() - cooldown.get(player.getUniqueId()));
                            selectedBossbar.setProgress(TimeLeft);
                            selectedBossbar.setVisible(true);
                            selectedBossbar.setTitle(title);
                        }
                    } else {
                        Bukkit.getScheduler().cancelTask(); //How to get the task id
                    }
                }
            });
tribal valve
#

there's no cancel function

remote swallow
#

use BukkitRunnable

tribal valve
#

idk what that is

urban mauve
#
BukkitTask task = new BukkitRunnable() {
     @Override
public void run() {
// code
}
}.runBlaBla();
hashmap.put(key, task); // you can now call cancel(); inside ur runnable and everywhere you want just with this hashmap
tribal valve
#

oh okay now there is cancel

#

thanks

restive mango
#

@ancient plank

#

what is the

#

god damn

#

packet

#

for

#

clicking the leave bed button

ancient plank
#

u ask me as if I have done anything with packets

green prism
#

How can I spy which Plugin is changing my GENERIC_MAX_HEALTH Attribute?

#

(On join)

young knoll
restive mango
#

It's not entity_action, not use_item, not client_command, not window_clickk, not use_entity, not struct, not close_window

young knoll
restive mango
#

that's not an option for me...

#

@young knoll

#

does 5.0.0 not have that?

young knoll
#

5.0 of what

restive mango
#

com.comphenix.protocol

young knoll
#

Okay so protocollib

#

Idk what their name for it is

restive mango
#

maybe CLIENT_COMMAND

#

i'll try that

#

wait

#

i already tried it

#

FUCK

quaint mantle
#

i have a client side block and I cancel the event for when they do it

Is there a packet I need to send back to the client because when they break it, it disappears

class PacketListener : PacketListenerAbstract(PacketListenerPriority.HIGHEST) {

    override fun onPacketReceive(event: PacketReceiveEvent?) {
        if (event == null) return

        if (event.packetType == PacketType.Play.Client.PLAYER_DIGGING) {
            val wrappedPacket = WrapperPlayClientPlayerDigging(event)

            Bukkit.broadcastMessage("Received a packet digging.")

            // TODO: we may need to send a block Ack packet (Agnowledge)
            if (BlockTracker.isPacketBlock((event.player as Player).uniqueId, wrappedPacket.blockPosition, (event.player as Player).world.name)) {
                event.isCancelled = true
            }
        } else if (event.packetType == PacketType.Play.Client.PLAYER_BLOCK_PLACEMENT) {
            val wrappedPacket = WrapperPlayClientPlayerBlockPlacement(event)
            
            if (BlockTracker.isPacketBlock((event.player as Player).uniqueId, wrappedPacket.blockPosition, (event.player as Player).world.name)) {
                event.isCancelled = true
            }
        }
    }
}
restive mango
#

@young knoll where does it actually say it is player_command?

cinder abyss
#

?nms

cinder abyss
#

(for me)

restive mango
#

i mean

#

i would love to use nms

#

for this

#

but

#

the issue is i can't listen to nms packets

opaque scarab
#

I am creating a custom creature using a resource pack and display entities. I need to give it a pathfinding algorithm. Should I run the pathfinder asynchronously?

young knoll
#

I mean if you can do that sure

#

But it's not easy

hybrid spoke
remote swallow
#

coll is pathetic

hybrid spoke
#

i dont doubt that

zenith gate
#

how can I set a bee's flying speed? setting the attribute flying speed does nothing, should I use vectors instead?

young knoll
opaque scarab
#

If I did do the heavy weight piece of the algorithm async, I was thinking of having a synchronous runnable check the locations of blocks and store it, then have the async algorithm review the stored blocks and their locations, then pathfind around them. Does this seem like a good idea to keep things less intensive on the server?

hybrid spoke
#

you really dont want to dive into that pool

#

also to switch to sync, then fetch the blocks and locations aka. the chunksnapshot, on which you can operate async btw, then go back to async to use that information is inefficient as hell

hybrid spoke
opaque scarab
#

So I should just pathfind entirely sync? Should I have the pathfinder run every tick, or have it run periodically, updating the path every few ticks?

hybrid spoke
#

what? no

opaque scarab
#

Then what seems like a good solution to minimize lag?

hybrid spoke
#

to do it right and async lol

opaque scarab
#

You just said going back in forward between async and non-async is isn’t efficient LOL

hybrid spoke
#

because it isnt

opaque scarab
#

But it’s still the best solution?

hybrid spoke
#

never said that

hybrid spoke
#

especially at our snapshotmanagers which do the magic to go fully async

#

and dont forget to leave a star

fluid river
#

self PR detected

#

same as everyone here

hybrid spoke
#

just helping out ¯_(ツ)_/¯

fluid river
#

same bruh

#

jree fava

quaint mantle
#

Is it possible to set a block in your inventory to be completely unplacable?

I know you can use the PlayerInteractEvent and cancel the event but is it possible to just remove the ability of getting that little animation before the block gets removed in full?

opaque scarab
#

If I was to pathfind async, won’t I need to check the surroundings sync?

fluid river
hybrid spoke
fluid river
#

hehe

hybrid spoke
fluid river
#

you can try PlayerAnimationEvent tho

quaint mantle
hybrid spoke
#

could be a packets thing

fluid river
#

maybe you can cancel it from anim event

quaint mantle
#

would BlockPlaceEvent stop the animation

hybrid spoke
fluid river
#

you need to catch both

quaint mantle
#

gocha

fluid river
#

cancel block place and cancel right hand anim

hybrid spoke
fluid river
#

@ivory sleet add jree fava

#

😉

opaque scarab
hybrid spoke
autumn cave
fluid river
#

yes?

autumn cave
#

👍

#

Is GitHub down?

fluid river
#

no

dull goblet
#

Is it worth learning kotlin for plugin development if i already know java?

fluid river
fluid river
#

less people would help you there

echo basalt
ancient plank
#

Kotlin is a preference

echo basalt
#

With kotlin maybe 10

hybrid spoke
#

kotlin sucks

fluid river
#

cuz it's harder to read kotlin for guys who spent years on java

autumn cave
dull goblet
#

Okay yeah thanks

hybrid spoke
dull goblet
#

i'm used to languages like java, c#, typescript

opaque scarab
fluid river
#

ping md_5 🙂

#

nojoke

hybrid spoke
hybrid spoke
fluid river
#

for free

#

once

hardy minnow
fresh timber
#

Is there an event for when a player's main hand item changes. Not like JUST when they swap with offhand but ANY time that the main hand of the player changes to a different item?

fluid river
#

i don't remember event like this

dull goblet
zenith gate
quaint mantle
#

Can I update to jdk +16 using spigot 1.8?

remote swallow
#

1.8 has to use java 8

opaque scarab
quaint mantle
remote swallow
#

cast it

river oracle
quaint mantle
quaint mantle
remote swallow
#
if (something instanceof somethingelse) {
    somethingelse else = (somethingelse) something
quaint mantle
#

so I just cast and done

river oracle
#

I forget how taskTimer always works. does delay mean it delays the timer for x amount of ticks every x period

remote swallow
#

delay is before it runs, period is how long between runs

river oracle
#

ok

#

so setting delay at 0L is just fine

#

since I don't really need a inital delay

restive mango
#

I would like to listen to that packet so when a player is /lay ing

#

They can click the leave bed button

#

And actually stand up

#

Rn they just have to use the command again

remote swallow
#

look at how gsit does it

river oracle
remote swallow
#

yeah

river oracle
#

ugh the wording in the docs always confuse the shit out of me

remote swallow
restive mango
remote swallow
fresh timber
#

I registered event and everything

#

but when I scroll through hotbar the event does not trigger

opaque scarab
fresh timber
hybrid spoke
#

?paste

undone axleBOT
fresh timber
#

those methods dont fire at all

quaint mantle
fresh timber
hybrid spoke
#

you are

fresh timber
#

nah

fresh timber
#

yea

#

i think the tick that the block is there has to happen

opaque scarab
fresh timber
#

yea thats what they all say

remote swallow
fresh timber
#

so event shouldnt

#

oh yea ur right

hardy minnow
#

I fixed it btw

fresh timber
#

its a static event

#

which normally works

#

fine

#

idk why i did that tho

remote swallow
#

u aboos static

#

what did static do to you

amber vale
#

What event gets called when an item frame breaks from being inside a block?

opaque scarab
pseudo hazel
#

you can place a block against a blockface that has an itemframe

#

then the itemframe will break

opaque scarab
amber vale
#

Yeah

#

The only way to cancel that I have found is to make it unbreakable by players in survival, which makes it so I can't get an EntityDamageEntity of it when a player hits it to do the functionality I want to, so that isn't really an option.

opaque scarab
river oracle
#

Is there any way when translation back to the chunk I can get the opposite edge I'm getting right now? basically I'm getting these to points, but I really want the ones on the opposite side of the chunk

fluid river
echo basalt
#

HangingBreakEvent

amber vale
amber vale
amber vale
echo basalt
echo basalt
#

think it was just adding 16 in each direction and %= 15

#

or adding 15 and %= 16

#

something like that

amber vale
#

I have been at this for hours and tried to work with that event and it was that simple

#

Or I hope it works now atleast

orchid gazelle
echo basalt
#

Doesn't matter for enums

amber vale
#

I feel very dumb

#

lol

orchid gazelle
amber vale
#

Thanks

echo basalt
#

Don't stress it 😛

orchid gazelle
amber vale
#

I'm aware, it comes from when I was like "hmm, what would be a good username... I'm really dumb sometimes, let's throw "Noob" into google translate and see if something nice sounding comes out... Ooh Novato that sounds smooth"

pseudo hazel
#

that extra comma is good actually

#

mostly for version control reasons

#

since then you only have to edit 1 line to add a new constant

echo basalt
#

So.. redundant

pseudo hazel
#

yes

#

but in a good way

#

I think its either a comma or a semicolon

#

unless its not needed

echo basalt
#

I'd expect it on the material enum not in some obscure event

restive mango
#

Though

#

It doesn’t put you in a bed view

#

Like in an MC bed

#

With the leave bed button

remote swallow
#

type /lay on a bed

wispy jasper
#

hey I have a question!
I want to make a command, which is only accessable for players with a specific tag. is that possible?
Or what else do I do?

restive mango
#

So it doesn’t handle that

remote swallow
restive mango
#

Yes…

flint coyote
restive mango
#

I want to listen to the leave bed button packet

#

wispy jasper
#

its a server where you have different classes. I want to make a command for Fairys so they can fly and only players with the tag fairy can use it

echo basalt
#

Yeah so break it down

flint coyote
#

Make a fairy permission group and add them to the group when they chose the class. That would be the easiest.
You can however use the PlayerCommandPreProcessEvent to cancel command executions if you prefer that

echo basalt
#

That's just overcomplicated

#

make a command, couple checks to see the player's tag

#

if it's not fairy, throw an error message

flint coyote
#

that still makes the command show up for autocompletion since they have the permission

wispy jasper
#

yeah but idk how i do that xD you see i just started with this haha

flint coyote
#

Not that hard to run a command that adds them to a permission group once they pick the class

#

oh so the class plugin is not yours then?

wispy jasper
#

there are no commands to add me to the class yet. i just have some datapacks that give me custom team name and stuff if my ingame tag is like fairy

opaque scarab
#

Is running this asynchronously safe? world.getChunkAt(0,0).getChunkSnapshot()

orchid gazelle
#

What does #getChunkSnapshot even do

orchid gazelle
#

Huh can I just access it async and then process things with Chunk-Data?

flint coyote
# wispy jasper there are no commands to add me to the class yet. i just have some datapacks tha...

Well in that case you have to work with that. I thought you made the datapack before.
You use the https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/event/player/PlayerCommandPreprocessEvent.html
and inside of it call #getPlayer() and check the tags. If they match you cancel the event

flint coyote
wispy jasper
#

k thx

orchid gazelle
opaque scarab
# flint coyote yes

If I’m creating an async pathfinding algorithm, should I use this to iterate through the blocks to determine pathfinding? Would that be a good method?

flint coyote
#

I think read operations are fine to be done async

#

So you don't need the snapshot

flint coyote
orchid gazelle
#

Thats great

echo basalt
#

Snapshot's read only

#

snapshot's a read-only copy that's fine with async

flint coyote
#

I meant that you can do async checks on world.getBlockAt() as long as you don't modify it

echo basalt
#

pretty sure you can't

opaque scarab
echo basalt
#

create a snapshot

#

for each chunk you're processing

#

And then you can check that snapshot's blocks async

opaque scarab
#

Thanks

slow dagger
#

Does anybody know how I can get a TrimMaterial/Pattern by inputting a String?

Example:
I have the String AMETHYST and want to get the corresponding TrimMaterial. How would I do it?

orchid gazelle
#

Imma do that with all important chunks on boot, thats great

shadow night
#

why does the event not fire

    @EventHandler
    public void onPlayerPickupItem(EntityPickupItemEvent event) {
        if(!(event.getEntity() instanceof Player player)) return;
        Bukkit.getPluginManager().callEvent(new PlayerItemAcquireEvent(player,
                event.getItem().getItemStack(),
                player.getInventory().first(event.getItem().getItemStack()),
                event.isCancelled()));
    }```
flint coyote
echo basalt
#

ehh

#

icky then

flint coyote
#

Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> System.out.println(Bukkit.getWorld("world").getBlockAt(0, 60 ,0).getType()));

#

this does work

#

and it even updates (I run it in the BlockBreakEvent)

echo basalt
#

something tells me you're running a funky paper fork

flint coyote
#

oh true, the server is based on paper since it boots up faster. Lemme check spigot

opaque scarab
# flint coyote I just checked. It does work

Still might not be the best idea to work on something actively changing. Creating a snapshot allows you to work with a copy, without tampering with the original chunk itself.

flint coyote
echo basalt
#

Shouldn't be that heavy

flint coyote
echo basalt
#

That flood-fill code I posted managed to do like 300k blocks per second

#

single-thread was like 20k

shadow night
#

wait, the event does not fire for some reason and I dunno why

echo basalt
#

Are both listeners registered

opaque scarab
shadow night
echo basalt
#

It's the kind of thing where you do both and make a graph

shadow night
#

here the other listener

#

being registered

echo basalt
shadow night
#

it should but it does not

dim shell
#

I really know nothing about coding plugins, but I have a little experience with datapacks, and I'm wondering if anybody can help me figure out how to make a custom plugin?

echo basalt
#

Let's say your distance between A and B is like 4 blocks

#

Making a whole snapshot can be wasteful

#

if at the end you only need to pathfind those 4 blocks

shadow night
#

I swear, spigot events are cursed

echo basalt
#

b o t pls

#

?learnjava

undone axleBOT
echo basalt
#

There ya go

flint coyote
shadow night
#

what could be missing

dim shell
# echo basalt There ya go

I know how to code java lmao, that doesn't tell me anything about integrating it with minecraft and plugins

echo basalt
#

Ah

opaque scarab
#

Keep in mind, the pathfinder is running async

echo basalt
#

I'd start by reading the wiki

dim shell
#

and it doesn't help most plugin tutorials on youtube barely show anything more in depth past just responding to a certain phrase in chat

echo basalt
#

Well

#

That's.. the event system which is a good starting point

flint coyote
#

can't decide on building vehicles and start with a spaceship I guess

echo basalt
#

There are tons of events and the chat one is quite intuitive

#

So we start with the chat one

#

You can then just pick another event and play with it

#

Maybe get multiple listeners working together.. That's why youtubers make entire series

flint coyote
# shadow night what could be missing

lemme just check the async thing on spigot then we can hop in a voicechat and check if you want to. Probably has to be a private call since no screenshare is allowed on spigot (for whatever reason)

opaque scarab
echo basalt
dim shell
#

Yeah that's fair, I'm trying to make one that I can't imagine not being fairly simple

echo basalt
#

Start slow and work your way up

#

I did try to make minigames at the 1 year mark and it just went poorly

#

And then again at the 3 year mark, slightly less worse

dim shell
#

Fair, I'm trying to make one that bares resemblence to the lifesteal plugin, but is pretty different

flint coyote
#

hearing "years" must really make people feel unmotivated but it's kinda true. Programming is a looong process

echo basalt
#

I've been coding for 12 years and making plugins for the past 6

zenith gate
#

i think hearing decades is worse lol

shadow night
#

oh gosh, spigot is cursed

flint coyote
#

Yeah I'm coding for 8-9 years now. Started with plugins like a year after. I did have breaks from spigot and coded other stuff though

echo basalt
#

Only now I decided to start touching minigames and making really really fancy particle effects

#

But once you have a good structure, things will flow smoothly

#

I made TNT tag in like an hour last night :p

flint coyote
shadow night
#

nope

#

just events not working for me like casual stuff

echo basalt
#

Add souts everywhere

shadow night
#

I'm doing that rn

flint coyote
#

it does work on spigot, too @echo basalt

echo basalt
#

odd

shadow night
flint coyote
#

Why wouldn't it? It's a read-only operation

shadow night
#

maybe I should try it in a different

#

way

echo basalt
#

try reading at an unloaded chunk

quaint mantle
flint coyote
#

Just like with files you can also have infinity threads reading it but only one can write

opaque scarab
flint coyote
echo basalt
#

And maybe less spiking

echo basalt
#

And sets the block as air internally

opaque scarab
echo basalt
#

You can send the block back if you want, or just do whatever

quaint mantle
#

Don't I so spigopt never gets any packets related to those blocks

flint coyote
shadow night
#

this worked ._.

#

cursed stuff

flint coyote
#

I mean ofc you have to register both

echo basalt
#

It's a packet sent from the client -> server

#

cancelling it just means the server won't process it

quaint mantle
#

Yeah so spigot should never set it to air in theory?

echo basalt
#

When you cancel an event, it sends packets reverting the action

quaint mantle
#

yeah what packet do I need to send to revert them breaking a block?

echo basalt
#

This is what we did at work

shadow night
remote swallow
flint coyote
#

a static function should work as long as it's called from the onEnable

echo basalt
remote swallow
#

yeah

echo basalt
#

Not my fault

cinder abyss
shadow night
echo basalt
#

I only wrote the packet stuff, everything else was made by someone else and I didn't have time to DI everything

#

but honestly I already had an instance so idk

flint coyote
#

Weird thing that an asynchronous operation does a synchronous chunk load to access data. Still better than an error I suppose

echo basalt
#

maybe I'm just dumb

shadow night
#

what funny thing can I do in my onDisable

remote swallow
#

print out random millis that stuff take

flint coyote
#

wdym by funny?

remote swallow
#

eg, how long it took to register listeners, how long startup too, how long an event lasts, literally just a random amount of millus

shadow night
echo basalt
#

"You telling me that this server is stopping without a crash?"

shadow night
flint coyote
#

"You dare to shut me down?!"

echo basalt
#

or just generate some random numbers and claim it's a memory leak

shadow night
#

and also print it in a random sequence

echo basalt
#

"Data sent to the chinese government: 28.4TB"

shadow night
#

LMAO

#

I should do that

remote swallow
#

throw an exception every second on a new thread for the entire shutdown

echo basalt
#

just do new Throwable().printStackTrace

shadow night
#

that's cursed

#

I should make an error which will basically be "Server is shutting down, Error code: 0"

remote swallow
#
for (int i = 0; i < Integer.MAX_VALUE; i++) {
    new Throwable().printStackTrace();
}
flint coyote
#

Or you just add a random "common password list" and do some interesting fact aka "Did you know that McDonalds123 is a pretty common password?"

#

Gotta teach safety on disable

shadow night
twilit roost
#

okay so I have a center location
I want to find every block (EMERALD) with underlaying block (DIAMONDBL) connected to the center

what algorithm should I use to make it the most efficient?
Flood Fill?>

flint coyote
flint coyote
cinder abyss
# flint coyote what command did you use to launch? It just builds latest for me when launching ...
@echo off
title SpigotMC BuildTools Builder
IF NOT EXIST BuildTools (
    mkdir BuildTools
)
cd BuildTools
curl -z BuildTools.jar -o BuildTools.jar https://hub.spigotmc.org/jenkins/job/BuildTools/lastSuccessfulBuild/artifact/target/BuildTools.jar
set /p Input=Enter the version: || set Input=latest
set /p Java=Java 8 or Java 16 (for 1.17.1 only) or Java 17? || set Java=17
if %Java%==8 "C:\Program Files\Zulu\zulu-8\bin\java" -jar BuildTools.jar --rev %Input%
if %Java%==16 "C:\Program Files\Java\jdk-17\bin\java" -jar BuildTools.jar --rev 1.17.1
if %Java%==17 "C:\Program Files\Java\jdk-17\bin\java" -jar BuildTools.jar --rev %Input%
if NOT %Java%==8 if NOT %Java%==17 if NOT %Java%==16 echo "Please rerun the .bat file and input 8 or 17 or 16 in java version"
echo "Done!"
pause```
shadow night
#

yeah

#

my math is suffering

#

ohh this is hilarious

flint coyote
#

Does 1.16.5 even support java 8?

shadow night
#

it does afaik

flint coyote
#

yup seems so

cinder abyss
flint coyote
#

did that script work before? Did you try calling
C:\Program Files\Zulu\zulu-8\bin\java -jar BuildTools.jar --rev 1.16.5 directly?

#

might need the quotes around the path, not sure.
In that case
"C:\Program Files\Zulu\zulu-8\bin\java" -jar BuildTools.jar --rev 1.16.5

shadow night
#

hehehe

opaque scarab
#

Next question of the day. How can I make an entity pathfind to a specific location?

flint coyote
#

hmm did you try using another network? E.g. mobile data?

#

Also make sure to not use any VPN

cinder abyss
#

(and using wifi)

flint coyote
#

That probably won't change anything. Try using your phones data, if you have that

flint coyote
#

weird, good for your though xD

cinder abyss
flint coyote
#

maybe an ant inside your ethernet cable is eating all the packets

shadow night
#

interesting theory

remote swallow
#

sorry it just tastes so godo

shadow night
#

yummy packets

twilit roost
#

what is the most efficient way to check if player stepped on a block of some type?

flint coyote
#

Probably an early return PlayerMoveEvent

#

Just make sure to use e.getTo() instead of player.getLocation()

twilit roost
#

oh right
tysm

mellow pebble
#

Hi guys so im making TablistManager which will just be used to put on header and footer to players tablist and most likely just put prefix to the players tablist so yeah i need ChatComponent type which comes with net.minecraft.server... so i had to add my server.jar as dependency to my project right and im using intellij and i went in project structure i found where my module is and i went in dependencies tab and added my server.jar as dependency but it seems not to be working for some reason i mean it is not loading as dependency so i cant use it in my project any help maybe if someone is familiar ?

quaint mantle
fluid river
#

not a .jar dependency

#

also isn't component part of api already

#

oh it's paper shit

#

you can use adventure then

spare hazel
#

Just looking for the javadocs

#

?jd-s

undone axleBOT
mellow pebble
fluid river
#

?nms

fluid river
#

part of adventure

fluid river
quaint mantle
#

Does anyone know what this packet is called ?

mellow pebble
#

PlayerAction myb

quaint mantle
#

I already tried that

#

Which is why I am asking

mellow pebble
buoyant viper
#

unless ur trying to send it to other players uhhh idr

quaint mantle
#

oh shit u right it is Serverbound

mellow pebble
#

silly

quaint mantle
#

Do you know what the name is on packet events?

tender shard
#

mojang name is ServerboundPlayerActionPacket

#

does packet events not use the proper names?

quaint mantle
# echo basalt This is what we did at work

When you call the updateIniduvually how did you get that to work?


        (player as CraftPlayer).handle.connection.send(
            ClientboundBlockUpdatePacket(BlockPos(blockPosition.x, blockPosition.y, blockPosition.z), block!!)
        )
            Play.Client.PLAYER_DIGGING -> {
                val wrappedPacket = WrapperPlayClientPlayerDigging(event)

                if (!wrappedPacket.action.name.contains("DIG")) return

                Bukkit.broadcastMessage("Received a packet digging.")

                // TODO: we may need to send a block Ack packet (Agnowledge)
                if (BlockTracker.isPacketBlock((event.player as Player).uniqueId, wrappedPacket.blockPosition, (event.player as Player).world.name)) {
                    event.isCancelled = true

                    RenderHandler.updateSingle(event.player as Player, wrappedPacket.blockPosition, (event.player as Player).world.name)
                }
            }
wet breach
quaint mantle
wet breach
#

not sure what you mean on packet events then, assumed maybe you wanted to know what it was in the api

tender shard
#

packetevents is a lib like protocollib

quaint mantle
#

using a bukkit like event system for packets

#

Im just tryna figure out why it is not stopping a block from being mined client side and not reppearing

wet breach
#

well there isn't much that can be done on the client side as the client still has predictive code

#

so it really depends

quaint mantle
#

but I send a block update to the client when they try and break the block?

#

do I need to be delaying by a tick or smth?

wet breach
#

if you don't want to deal with code for stopping a block from being mined

#

you could always set the NBT tag for it

quaint mantle
#

No I would like to deal with stopping a block from being mined

wet breach
#

but there is api methods though in spigot to stop such things, which is the blockbreakevent

onyx fjord
#

is there an event for new day in the world?

quaint mantle
#

yes but my blocks arent real

wet breach
#

so not sure why you are attempting to do this from the NMS at the packet level

quaint mantle
#

they are per player packet blocks

#

so spigot doesn't know that the blocks exist

quaint mantle
#

hmm thats the exact same thing im doing for the most part

wet breach
#

I know your issue then

#

there is like 5 or so packets you are going to need to deal with then

quaint mantle
#

I deal with block place and dig

wet breach
#

any updates to the chunk or blocks need to be intercepted

quaint mantle
#

yes

#

Im gonna do that later im tryna get this issue fixed rn

wet breach
#

if any of these packets makes it to the client, the client will realize your blocks are fake and remove them

wet breach
quaint mantle
#

it is not

#

oh

#

actually it might be

wet breach
#

chunk updates for example

#

there is 2 packets for that

quaint mantle
#

minecraft sends the whole chunk? when u break block/

wet breach
#

yes

#

but not only that

quaint mantle
#

i see

wet breach
#

the server sends neighboring chunk updates too

#

so if you break a block in 1 chunk, it could send updates for 4 other chunks too

#

but chunk packets are not the only things that cause the client to update either

#

there is a few other packets which I don't remember them all

quaint mantle
#

ty for that I will skim wiki.vg for the others

#

I didnt even think that this would break this exact issue

quaint mantle
#

since only I know this block exists

wet breach
#

the client sometimes requests

#

so you have to listen to both inbound and outbound

river oracle
#

I'm still trying to figure this out. How the hell do I correct for the coordinates being off from what I want at chunks in a predictable manner.

(1215, -895) reduces into (75, -56) [this is intended]
(75, -56) expands into (1200, -880) [this is not intended]
I need to find a solution to get (1200, -880) to become (1215, -895)
(1168, -848) reduces into (73, -54) [this is intended]
(73, -54) expands into (1168, -863) [this is not intended]
I need to find a solution to get (1168, -863) to become (1168, -848)

this is the code I'm using to get into a bounding box

    public BoundingBox asBoundingBox() {
        final World world = Bukkit.getWorld(this.corner1.getWorld());
        if (world == null) {
            throw new IllegalStateException("The world of this area is not loaded");
        }

        Location lc1 = corner1.asLocation(world.getMaxHeight());
        Location lc2 = corner2.asLocation(world.getMinHeight());
        return BoundingBox.of(lc1, lc2);
    }```
```java
    public Location asLocation(final int y) {
        final World world = Bukkit.getWorld(this.world);
        if (world == null) {
            throw new IllegalStateException("World of location is not present");
        }

        return new Location(world, this.x << 4, y, this.z << 4);
    }
echo basalt
#

probably something to do with lowest possible corner

upper hazel
#

who know c++ help me

river oracle
#

wait

river oracle
#

before there was a bug in my code causing it to be off even more, so I just noticed

upper hazel
#

how to scammer cpp folder through visualStudio cpp files it doesn't see

river oracle
echo basalt
#

add 15

river oracle
#

works in some cases and not others no?

#

I mean in one of my examples its only off by 15, the other one is off by 15 in each direction

#

wait

#

yeah no I'm still stumped

#

I mean if its different in each scenario idk what to do

echo basalt
#

wait so is it still that opposing corners thing

river oracle
echo basalt
#

just add 15 in the relative X and Z axis and %= that by 16

#

Basically just

#
int relX = x - chunkX * 16
int relZ = z - chunkZ * 16

int oppositeX = chunkX * 16 + ((relX + 15) % 16);
int oppositeZ = chunkZ * 16 + ((relZ + 15) % 16);
#

don't ask why it works

#

might cause weird issues actually

river oracle
twilit roost
#

I start where the red block is
I want to get blocks that connected in someway to the main location and are Emerald blocks

this is my current run on the Flood-Fill, but it results in absurt big results:

https://paste.md-5.net/qodesafewu.cpp

echo basalt
#

yeah sure

river oracle
#

lest hope it works

echo basalt
twilit roost
#

oh my
tysm

echo basalt
#

It's optimized for large areas

#

pretty sure I ran it on areas that were a few million blocks in volume

#

You'll also need a main thread executor

twilit roost
#

ye thats not a problem

#

since u know the code better
how could I adapt it to also check the block below the upper block and only add if it's Diamond Block?

wet breach
timid hedge
#

Why am i getting so many errors with this?
It dosent understand: e.getAction(), e.getClickedBlock(), b.getType(), b.getType and b.getState

    @Override
    public void onSignChange(SignChangeEvent e){
        if (e.getAction() != Action.RIGHT_CLICK_BLOCK) {
            return;
        }

        Player p = e.getPlayer();
        (!(isPlayerInGroup(player, "admin") || isPlayerInGroup(player, "h-admin"))) {
            Block b = e.getClickedBlock();
            if (b.getType() == Material.SIGN_POST || b.getType() == Material.WALL_SIGN) {

                Sign sign = (Sign) b.getState();
                if (ChatColor.stripColor(sign.getLine(0)).equalsIgnoreCase("[WARP]")) {
                    if(sign.getLine(2) != null && !sign.getLine(2).equals("")) {

                        String warp = ChatColor.stripColor(sign.getLine(2));
                        Bukkit.dispatchCommand(p, "warp " + testWarp);

                    }
                }
            }

        }
    }
tender shard
#

because none of those methods exist

#

(for the event, that is)

tender shard
#

they also don't exist in 1.8

river oracle
echo basalt
#

ye

river oracle
# echo basalt ye

I don't know that kind of but, the code you gave does have a side affect which is beneficial an idea

upbeat fog
#

I have an issue again with this plugin, so what I wanted to do was when a player has a certain helmet on, it gives a 10 percent change to give double drops. But it doesnt recognize that I have the helmet on or doesnt run the code thru.

tender shard
upbeat fog
#

PDC tags?

tender shard
#

you could just store a boolean in your item, e.g. "is-my-custom-helmet"

private isMyHelmetKey = new NamespacedKey(myPlugin, "is-my-custom-helmet");

// Save tag on item
ItemMeta myItemMeta = myHelmetItemStack.getItemMeta();
myItemMeta.getPersistentDataContainer().set(isMyHelmetKey, PersistentDataType.BOOLEAN, true);
myHelmetItemStack.setItemMeta(myItemMeta);

// Check if its your custom helmet
if(myItemMeta.getPersistentDataContainer().has(isMyHelmetKey, PersistentDataType.BOOLEAN)) {
  // It is my helmet!
}
#

nobody there uses "getAction()" or "getClickedBLock()" on a SignChangeEvent

timid hedge
twilit roost
echo basalt
#

modifying is at your own discretion ¯_(ツ)_/¯

upbeat fog
#

@tender shard still nothing lmao

tender shard