#help-development

1 messages · Page 933 of 1

dawn flower
#

armorstands

#

mobs

#

arrows

#

etc

#
Entity nearestEntity = null;
double nearestDistanceSquared = Double.MAX_VALUE;
for (Entity entity : player.getWorld().getEntities()) {
    if (entity.equals(player)) continue;
    double distanceSquared = entity.getLocation().distanceSquared(player.getLocation());
    if (distanceSquared < nearestDistanceSquared) {
        nearestEntity = entity;
        nearestDistanceSquared = distanceSquared;
    }
}``` like this?
lost matrix
#

Yeah

proud badge
#

Is there a simple way to check if an enchantment is illegal (above vanilla value)

dawn flower
#

Enchantment#getMaxLevel

dawn flower
#

how do i make replenish and make it take 1 of the drops?

#

i cant find a way to remove drops and make it work with external auto pickup plugins

cinder abyss
#

Hello, I'm using com. github. Anon8281.universalScheduler. UniversalRunnable and with this code:```java
FallingLeaves.getScheduler().runTaskTimer(new UniversalRunnable() {
@Override
public void run() {
Location previousLocation = leaf.getLocation().clone();
Location nextLocation = previousLocation.clone().add(nextx, FALL_SPEED, nextz);

            if(nextLocation.getBlock().getType().isSolid()){
                leaf.remove();
                cancel();
            } else {
                leaf.teleport(nextLocation);
            }
        }
    }, 1L, 1L);```

I get this error: [22:30:33 WARN]: [FallingLeaves] Global task for FallingLeaves v1.0 generated an exception java.lang.IllegalStateException: Not scheduled yet at io.github.paulem.universalScheduler.UniversalRunnable.checkScheduled(UniversalRunnable.java:138) ~[dist-1.0.jar:?] at io.github.paulem.universalScheduler.UniversalRunnable.isCancelled(UniversalRunnable.java:23) ~[dist-1.0.jar:?] at io.github.paulem.fallingleaves.leaves.Leaf$1.run(Leaf.java:56) ~[dist-1.0.jar:?] at io.github.paulem.universalScheduler.foliaScheduler.FoliaScheduler.lambda$runTaskTimer$2(FoliaScheduler.java:65) ~[dist-1.0.jar:?] at io.papermc.paper.threadedregions.scheduler.FoliaGlobalRegionScheduler$GlobalScheduledTask.run(FoliaGlobalRegionScheduler.java:179) ~[paper-1.20.4.jar:?] at io.papermc.paper.threadedregions.scheduler.FoliaGlobalRegionScheduler.tick(FoliaGlobalRegionScheduler.java:37) ~[paper-1.20.4.jar:?] ...
I tried checking with isCancelled, but I can't find something to avoid this error

dawn flower
#

why not BukkitRunnable?

remote swallow
#

so it supports spigot, paper and folia

cinder abyss
#

exact

#

so, any idea?

#

I have searched everywhere but nothing helped me...

dawn flower
#

where is that code located?

remote swallow
#

im guessing its the cancel

cinder abyss
#
TextDisplay leaf = spawnLocation.getWorld().spawn(spawnLocation, TextDisplay.class, (display) -> {
    display.setBillboard(Display.Billboard.CENTER);

    display.setBackgroundColor(Color.fromARGB(0, 0, 0, 0));
    display.setText(finalColor + "🍂");
    display.setBrightness(new Display.Brightness(5, 5));
});

double nextx = SafeRandom.generateDouble();
double nextz = SafeRandom.generateDouble();

FallingLeaves.getScheduler().runTaskTimer(new UniversalRunnable() {
    @Override
    public void run() {
        Location previousLocation = leaf.getLocation().clone();
        Location nextLocation = previousLocation.clone().add(nextx, FALL_SPEED, nextz);

        if(nextLocation.getBlock().getType().isSolid()){
            leaf.remove();
            cancel();
        } else {
            leaf.teleport(nextLocation);
        }
    }
}, 1L, 1L);```
lost matrix
#

Dont create a runnable for each leaf. Just start a runnable when the server starts, and add leafes to the runnable.

cinder abyss
#

so it'll solve this?

dawn flower
#

Task#isScheduled

#

try adding that condition

cinder abyss
#

I already tried x)

cinder abyss
#

I'm trying to make my plugin the most optimized possible so it's perfect, thanks

dawn flower
#

you could also check try to run the code once before actually creating the timer, so it doesnt instantly cancel if it passes the condition

young knoll
#

Better write it in ASM then

cinder abyss
dawn flower
#

so run this

Location previousLocation = leaf.getLocation().clone();
Location nextLocation = previousLocation.clone().add(nextx, FALL_SPEED, nextz);
if(nextLocation.getBlock().getType().isSolid()){``` before creating the task
cinder abyss
#

yeah good idea

#

I have something similar but not the same code

#

Humm, I'll have to do some PDC

eternal oxide
#

no need to clone the location as its already a clone

ocean hollow
cinder abyss
ocean hollow
cinder abyss
lost matrix
young knoll
#

Only for air

ocean hollow
#

oh, thanks

cinder abyss
#

java.util.ConcurrentModificationException: ???

young knoll
#

Trying to remove from a collection while looping over it most likely

cinder abyss
#

ooh

young knoll
#

Use an iterator

cinder abyss
#

humm

#

in type or List#iterator ?

echo basalt
#

removeIf

cinder abyss
#

wow wow wo

#

what should I do? x)

#

Here is my code```java
getScheduler().runTaskTimer(new UniversalRunnable() {
@Override
public void run() {
for(Player player : getServer().getOnlinePlayers()){
if(!player.isFlying() &&
!player.isSleeping() &&
!player.isDead() &&
!player.isInWater() &&
!player.isInvisible()) {

                List<Block> leavesBlocks = LeavesUtil.getSomeLeaves(player.getLocation(), 10);
                if (leavesBlocks == null) return;
                for (Block block : leavesBlocks) {
                    Location spawnLocation = block.getLocation().add(0, Leaf.FALL_SPEED, 0);
                    if(!spawnLocation.getBlock().getType().isSolid()){
                        Leaf.createLeaf(spawnLocation);
                    }
                }
            }
        }
    }
}, 20L, 40L);

getScheduler().runTaskTimer(new UniversalRunnable() {
    @Override
    public void run() {
        for(TextDisplay leaf : registeredLeaves){
            double nextx = SafeRandom.generateDouble();
            double nextz = SafeRandom.generateDouble();

            Location previousLocation = leaf.getLocation();
            Location nextLocation = previousLocation.add(nextx, Leaf.FALL_SPEED, nextz);

            if(nextLocation.getBlock().getType().isSolid()){
                registeredLeaves.remove(leaf);
                leaf.remove();
            } else {
                leaf.teleport(nextLocation);
            }
        }
    }
}, 1L, 1L);```

(I removed Location#clone)

lost matrix
#

Make registeredLeaves a LinkedList and call removeIf instead of iterating

lost matrix
#
registeredLeaves.removeIf(leaf -> {
  if(isInvalid(leaf)) {
    return true;
  }
  // Do something with valid leaf
  return false;
});
cinder abyss
#

oh thanks

#

I replace is invalid by my condition?

#

Hummm```java
getScheduler().runTaskTimer(new UniversalRunnable() {
@Override
public void run() {
for (TextDisplay leaf : registeredLeaves) {
double nextx = SafeRandom.generateDouble();
double nextz = SafeRandom.generateDouble();

            Location previousLocation = leaf.getLocation();
            Location nextLocation = previousLocation.add(nextx, Leaf.FALL_SPEED, nextz);

            registeredLeaves.removeIf(leafToRemove -> {
                if(nextLocation.getBlock().getType().isSolid()) {
                    leaf.remove();
                    return true;
                }

                // Valid leaf
                leaf.teleport(nextLocation);
                return false;
            });
        }
    }
}, 1L, 1L);```
#

thanks, I'm going to try

cinder abyss
#

yeah

#

It's stopping the other leaves

lost matrix
#

removeIf iterates over all leafs

cinder abyss
#

hummm

#

so I replace for (TextDisplay leaf : registeredLeaves) by removeIf ?

lost matrix
#

Yeag

cinder abyss
#

okay thanks

#

Really interesting LinkedList

#

it seems powerful

#

Here we go again```java
registeredLeaves.removeIf(leaf -> {
// PDC enregistrer variables nextx et nexty + PDC spécifique pour dire que c'est une feuille, supprimer toutes les feuilles existantes au démarrage du serveur
double nextx = SafeRandom.generateDouble();
double nextz = SafeRandom.generateDouble();

                Location previousLocation = leaf.getLocation();
                Location nextLocation = previousLocation.add(nextx, Leaf.FALL_SPEED, nextz);


                if(nextLocation.getBlock().getType().isSolid()) {
                    leaf.remove();
                    return true;
                }

                // Valid leaf
                leaf.teleport(nextLocation);
                return false;
            });```
#

it's working! Thanks 😄

#

I learned a new java skill x)

twin venture
#

anyone can give me some advices or ways to improve it? about my plugin code base iam working on? iam gonna screen share if anyone interested :-:

twin venture
young knoll
#

It is

#

Honestly most things are

twin venture
#

iam trying to push my self to learn more advanced stuff

#

like better ways for data handling , data strcuture

#

etc

rapid vigil
twin venture
#

did

rapid vigil
#

nice

cinder abyss
#

I could then make more leaves in front of him and getting better performances

eternal oxide
#

not simple to do as you have to account for 1st/3rd person view

echo basalt
#

oops was reaching out for my phone

dusky wigeon
#

how spawn entity in spigot ?

eternal oxide
#

World#spawn

umbral ridge
#

why does my entire os freeze for like half a second, or a quarter, when i click start.cmd for my minecraft server

#

even my audio freezes XD

young knoll
#

The server likes to use as much resources as possible when starting

drowsy helm
umbral ridge
drowsy helm
#

the -Xmx flag

umbral ridge
#

Yea I have it at 6GB

#

That's for startup, right?

drowsy helm
#

its just max heap allocation

umbral ridge
#

Now it doesn't freeze my system anymore

drowsy helm
#

monitor the jar on startup, is it cpu or memory

umbral ridge
#

I've got 32gb of ram

young knoll
#

Is it dedodated ram

umbral ridge
#

dedicated?

#

It's a separate server I have at home yea XD

wet breach
#

-Xms6G -Xmx6G

#

Starting the server like this gives the server all the resources upfront and prevents some other issues with the heap when it starts out less then the max and then needs to increase its allocation

#

?flags

undone axleBOT
native nexus
remote swallow
#

How many dedicated wams do i need to run doom

vernal basalt
#

is there a better way to make something that applies to the player for x amount of time they are ONLINE?

#

my solution was log the amount of time they have played and check if it's been more than x time since

#

is that the best way to do it?

agile anvil
#

How do you log your player time? Do you have a loop that runs every tick or so and increase a counter ?

rough ibex
#

Can you further elaborate what should happen

vernal basalt
#

let's say I give a "curse" to a player and for x time they try to do cirtain things other things happen

#

like they can't eat or something

#

and yeah would I have to have a repeating task that checks if player curses are over?

agile anvil
#

Are the curse time limited or "numbers of actions" limited?

young knoll
#

Store a timestamp of when the curse ends

#

Then check that when needed

vernal basalt
wet breach
vernal basalt
#

1.12.2 😭

wet breach
#

No need for external saving of this data

wet breach
vernal basalt
#

yeah

ancient jackal
#

Is there a recommended inv gui library out of the many out there

native nexus
#

InventoryFramework

ancient jackal
#

That XML looks powerful

blazing ocean
upper hazel
#

Is it possible to change the required level to receive enchantments from the enchantment table for a specific player by lowering it, for example, from level 30 to 15?

warm mica
native ruin
rotund ravine
round solar
#

the cpu is going to 107%/100%, just wanted to ask why is the cpu load so much and what can i do to reduce it?

drowsy helm
#

100% isnt really much, depends what cpu the server is using

pseudo hazel
#

100% means the cpu is fully utilized

#

if you dont get lag its perfect

lost matrix
drowsy helm
#

they're most likely using a panel like ptero, which would be fully dockerized

#

doubt they would have other apps running on the container

lost matrix
#

@round solar

#

Decrease view distance, entities etc

clever lantern
#

how can i make a wall of barrier blocks to make player not enter certain area?
currently i am doing Location blockLocation = playerLocation.clone().add(playerLocation.getDirection()); but idk how to make a wall out of it

lost matrix
#

What do you know about the geometry of the wall?

drowsy helm
#

if its just a square use a bounding box and iterate the axis

clever lantern
#

currently i am taking move event and if its in area (rectangle) i am placing a block in front of a player

lost matrix
#

Do you want to actually place wall blocks or do you want only one player blocked.
Because placing a barrier block will prevent any player from going through.

clever lantern
#

i am using send block change

#

to block only one player

lost matrix
#

A hacked client can just walk right through fake blocks

#

Because they dont exist on the server

clever lantern
#

so just cancel player move event?

drowsy helm
#

would be glitchy

#

you could apply a velocity in the other diretion to shove them

lost matrix
#

I would just double up. Place barrier blocks and create a smaller area which throws the player back when he tries to enter (as a backup)

#

Tricky part is deciding when to place the wall.
Do you just send the entire wall to the player?

clever lantern
#

currently i wanted to place like 9 blocks in front of a player when he tries to enter the area

#

every time he tries to enter using player move event

wet breach
#

you could have 2 cores at 50% and that is still 100%

warm mica
#

Didn't know it's my issue if things are called wrong

umbral ridge
#

my entire windows freezes

slate surge
#
package net.jamnetwork.fireballfight.listeners;

import org.bukkit.block.Block;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockExplodeEvent;
import org.bukkit.event.entity.EntityExplodeEvent;

import static net.jamnetwork.fireballfight.SpigotPlugin.placedBlocks;

public class EntityExplodeListener implements Listener {


    @EventHandler
    public void onBlockExplode(EntityExplodeEvent event) {

        // Iterate through the exploded blocks
        for (Block block : event.blockList()) {
            // Check if the exploded block's location is in the placedBlocks list
            if (!placedBlocks.contains(block.getLocation())) {
                // If the block is not in the placedBlocks list, cancel the event to prevent its destruction
                event.setCancelled(true);
                System.out.println("Cancelled event");
            } else
            {
                // If the block is in the placedBlocks list, remove it from the list
                placedBlocks.remove(block.getLocation());
                System.out.println("Passed event");
            }
        }
    }
}
#

the "passed event" is getting printed but the block in game is not getting destroyed

#

any solutions?

umbral ridge
#

Did you ai generate this..

#

no wonder it doesn't work

eternal night
#

statically importing a field named placedBlocks is crazy skully

slate surge
slate surge
# umbral ridge Did you ai generate this..

now it works i thought that cancelling the event would work but it didnt xD

updated scripts XD

List<Location> removableBlocks = new ArrayList<>();
        event.setCancelled(true);
        // Iterate through the exploded blocks
        for (Block block : event.blockList())
        {
            // Check if the exploded block's location is in the placedBlocks list
            if (placedBlocks.contains(block.getLocation()))
            {
                placedBlocks.remove(block.getLocation());
                removableBlocks.add(block.getLocation());
            }
        }

        for (Location location : removableBlocks)
        {
            location.getBlock().setType(org.bukkit.Material.AIR);
            removableBlocks.remove(location);
        }
smoky anchor
#

this will not work, what
it has to throw concurrent modification exception

slate surge
#

works!

#

btw i am on 1.8.8

smoky anchor
#

doesn't matter, you can't remove/add stuff to a list if you're iterating over it like that
(also, you don't have to if the removableBlocks list is within the event method)

slate surge
#

uh oh

#

missed on that

smoky anchor
#

how the fuck can that run

slate surge
#

yeah forgot i am everytime creating that list

#

it works like a charm

smoky anchor
#

and it does not throw a single error ?
am I the one who is wrong here ?

#

guys pls help, I'm questioning my whole existance over this

valid burrow
#

whats the problem

slate surge
slate surge
smoky anchor
valid burrow
valid burrow
slate surge
#

plugin main class

event class

package net.jamnetwork.fireballfight.listeners;

import org.bukkit.Location;
import org.bukkit.block.Block;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.entity.EntityExplodeEvent;

import java.util.ArrayList;
import java.util.List;

import static net.jamnetwork.fireballfight.SpigotPlugin.placedBlocks;

public class EntityExplodeListener implements Listener
{
    @EventHandler
    public void onBlockExplode(EntityExplodeEvent event)
    {
        List<Location> removableBlocks = new ArrayList<>();
        event.setCancelled(true);
        // Iterate through the exploded blocks
        for (Block block : event.blockList())
        {
            // Check if the exploded block's location is in the placedBlocks list
            if (placedBlocks.contains(block.getLocation()))
            {
                placedBlocks.remove(block.getLocation());
                removableBlocks.add(block.getLocation());
            }
        }

        for (Location location : removableBlocks)
        {
            location.getBlock().setType(org.bukkit.Material.AIR);
        }
    }
}
round solar
#

what plugin can i use to spawn players at the same place they left at?

valid burrow
slate surge
#

ok nvm

#

i didnt saw console

valid burrow
#

xd

slate surge
valid burrow
#

this code wont work and even if it would theres a lot of improvment

#

dw though we can help you

slate surge
#

nah

smoky anchor
#

ok, good, I am not crazy

slate surge
#

XD

valid burrow
#

what exactly are u trying to do broski

#

remove certain blocks from the explosion?

slate surge
#

when i not added the removableBlocks.remove(location); it worked and when i added it i didnt tested it

#

so i tested it with and without it

#

with it throws error

#

and without no errors

slate surge
valid burrow
#

oh thats simple

#

but

smoky anchor
#

can't wait for players to place water and lava to make (cobble)stone

slate surge
#

they wont be able to

valid burrow
#

you should definitely use OOP cause u are making a gamemode

slate surge
valid burrow
#

you should have Instances of a game class

#

to seperate each session

slate surge
#

hmm

#

when the game finishes i made so the server would restart

valid burrow
#

well anyways jusr make a list IN THE EVENT CLASS

slate surge
#

and on one server

umbral ridge
#

you can use PDC on blocks that are placed by players and add a NamespacedKey...

slate surge
#

only one game can run

valid burrow
umbral ridge
#

in explosion, enumarate though the list, check PDC, etc..

smoky anchor
slate surge
#

plus when game shuts down i will loop thru the list and remove all blocks

valid burrow
#

just make a Arraylist in the evnt class @slate surge

umbral ridge
valid burrow
#

and make 2 listeners

#

one for placing

#

one for explosion

#

oh and one for manual breaking

slate surge
#

yeah

#

i have that

valid burrow
#

no

umbral ridge
valid burrow
#

your lists are in your main class

slate surge
#
@EventHandler
    public void onBlockPlace(BlockPlaceEvent event)
    {
        if (event.getPlayer().getGameMode() == GameMode.SURVIVAL)
        {
            Location location = event.getBlock().getLocation();
            placedBlocks.add(location);
        }

    }

    @EventHandler
    public void onBlockBreak(BlockBreakEvent event)
    {

        if (event.getPlayer().getGameMode() == GameMode.CREATIVE)
        {
            return;
        }

        Location location = event.getBlock().getLocation();
        if (!placedBlocks.contains(location))
        {
            event.setCancelled(true);
            placedBlocks.remove(location);
            event.getPlayer().sendMessage(getFormattedMessage("&4 You can only break blocks placed during the game!"));
        }
    }```
slate surge
#

ok so ig i will move the session based configuartion to a seprate class

valid burrow
#

just make ur lists of breakable blocks in the event class

#

and then make it private

#

and static

slate surge
#

i want to access the class thru multiple classes

valid burrow
#

then make a getter

slate surge
#

nah

#

its not gonna be a public plugin its gonna be only on my server

#

and nowhere else

valid burrow
#

so you just wanna do stuff wrong on purpose

#

ig so

slate surge
#

no

#

idc if its shit coded or not

#

if it works

#

it works

valid burrow
#

and it wont work if its shit coded

slate surge
#

it will

valid burrow
#

or it will be very inefficient

slate surge
#

the amount of shit coding is too much

#

in my plugis

valid burrow
#

all of your code is possible in like 40 lines in 1 class

slate surge
umbral ridge
#

for a starter any code is good DrVosss

slate surge
slate surge
valid burrow
#

but so it be

umbral ridge
#

yeah that's ok, you'll learn through mistakes like we all do

valid burrow
#

its your plugin

umbral ridge
#

no its my plugin

#

XD

valid burrow
#

whut

slate surge
#

XD

slate surge
#

i making it from scratch

valid burrow
slate surge
#

XD

smoky anchor
#

If you do plan on making more stuff, you better start learning good practices early
It might be hard to re-learn how to do stuff the right way

valid burrow
#

event class:
placed blocks
3 listeners for modifying everything
public shutdown method to remove all blocks <- called from main on disable
getter for blocks if still necessary

#

thats it

rapid vigil
#

Hello, If I want to make a system that does a specific thing when you for example kill a certain amount of zombies, am I forced to manage zombie kills for each player in order to do that? (Getting kills, setting kills and saving kills of zombies ofc)

young knoll
#

Yes

#

Well, I think statistics keep track of kills for each mob type, but it’s probably better to manage it yourself

wet breach
rapid vigil
umbral ridge
wet breach
rapid vigil
smoky anchor
#

No, I mean the minecraft feature, idk how to access those from the API

rapid vigil
young knoll
#

It's in the api

rapid vigil
#

how do I access it

worldly ingot
young knoll
#

The statistic would be KILL_ENTITY

rapid vigil
#

ooh I didnt know you can provide an entity, tysm :D

calm lichen
#

hello hello

smoky anchor
#

once is enough
/j

calm lichen
#

i have a quick question regarding the VaultAPI. basically i found a plugin project that one of my close friends had sent me years ago that had implemented the VaultAPI, and i spent pretty much all night just looking over all the code, reformatting, cleaning it up, etc, but for whatever reason the pom.xml file was missing so I made a new one and tried to implement the API myself however I am getting an error that basically says the 1.7 API isnt found. I cant seem to figure it out on my own whether it be due to exhaustion from staying up, just being dumb, or if it has something to do with the API itself.

umbral ridge
smoky anchor
#

no

lost matrix
young knoll
#

Isn't 1.7 gone

#

Since DMCA

worldly ingot
#

CraftBukkit is, yes

worldly ingot
umbral ridge
#

that sucks

calm lichen
#

I'm using IntelliJ, made sure that I have maven installed and fully setup and everything before I started, it's been a hot minute since I've worked on anything so I just hopped onto this as a sort of refresher.

young knoll
#

Statistics are persistent

#

You can manually reset them tho

umbral ridge
#

So what now... do they reset on death or no

calm lichen
umbral ridge
#

what do you mean by persistent

young knoll
#

Like PDC

umbral ridge
#

Then that's perfect

lost matrix
young knoll
#

They persist restarts and all that

lost matrix
#

*He is speaking about Vault v 1.7 not spigot 1.7

umbral ridge
smoky anchor
#

it does im sure, probably used instead of placed ?

calm lichen
#

and then taking the result out of the target folder

#

once its generated

young knoll
#

Yeah block placement is handled by USE_ITEM

rapid vigil
worldly ingot
# worldly ingot No statistics are reset on death

Maybe my phrasing was a bit confusing because a single comma changes the whole meaning of the sentence lol. What I meant (and correctly wrote) was "There are no statistics that get reset on death"

smoky anchor
#

"time since last death"
that would "reset" upon death :D

rapid vigil
lost matrix
# calm lichen I was just running the main package that has all the files in it

If you want to use maven, then you should never manually add any jars to your project.
Every dependency should only be added to your pom.
After that you can only compile with the maven goals and not by "running the project" because this builds artifacts
on default, which ignores the pom.xml

so

  1. Make sure to not have any dependencies added to the project
  2. Check if your pom has all dependencies
  3. Run the maven goals clean and then package (IJ has buttons on the top right for that)
umbral ridge
molten hearth
#

has anyone seen some packet visualizer like pakkit thats updated for 1.20.4

rapid vigil
umbral ridge
#

all about the BLOCK I can find is:

rapid vigil
umbral ridge
#

so it's all combined?

#

drinking, eating, blah blah blah

#

"USE"

smoky anchor
#

look it up on wiki, but yes

calm lichen
umbral ridge
#

Well that sucks even more XD

smoky anchor
#

I mean, you can only place blocks, you can't eat them

rapid vigil
#

p.getStatistic(Statistic.USE_ITEM, Material.BONE_BLOCK); maybe something like this

umbral ridge
rapid vigil
#

Not sure tho, i havent actually used it before iirc

calm lichen
smoky anchor
rapid vigil
smoky anchor
#

so effectively, it is "BLOCK_PLACE" stat

twin venture
#

Hi uhh , i have a problem i use CompletableFeature for my user loading

#

but its not loaded..

#

becuase when i try to grab the user :

#

it tells me null

smoky anchor
#

race condition ?
the loading completes after the PlayerJoinEvent gets fired would be my guess
but idk how completablefeature works

lost matrix
twin venture
#

ok so i should not use CompletableFeature in AsyncPlayerPreLoginEvent

lost matrix
#

Correct

#

But if you have a CF, then you should .join() it on the current thread

rapid vigil
shadow night
#

Lol

shadow night
young knoll
#

Yeah it's fine to use if you just .join it

twin venture
#

i think if i join it , there will be more bugs?

#

and some users won'e be loaded?

young knoll
#

Nah should be fine

#

Join just blocks until it's done

twin venture
#

would'nt that make it lagging a bit?

lost matrix
#

The AsyncPlayerPreLoinEvent is async. It doesnt run on the main thread.
You could just Thread.sleep() for a second there and the server wouldnt notice.

shadow night
umbral ridge
#

On a separate thread

shadow night
#

What about we sleep the netty thread

umbral ridge
#

Not recommended

twin venture
#

yeah iam not doing that

#

now it works

#

it load the user

wet breach
young knoll
#

Pretty sure it runs on the netty thread

lost matrix
#

On one of the netty threads

young knoll
#

mhm

umbral ridge
#

Yeah but using a netty thread... not a good idea... unless if you need to do some weird shit XD Just use the spigots AsyncPlayerPreLoginEvent as it also runs on the same thread as netty so..

eternal night
lost matrix
eternal night
#

The login events run in the auth thread pool

lost matrix
#

Dont want to use the netty thread? Use the netty thread in the AsyncPlayerPreLoginEvent

lost matrix
shadow owl
#

Does anyone know of a good tutorial or library for creating packet-based holograms? I’m used to armorstand entities but heard packets are more efficient

eternal night
#

(I even opened spigot for you, that is how much I mean this)

lost matrix
#

Bold to call that a thread pool

eternal night
#

Yea sorry I wrote this when I looked at a proper server software

eternal night
lost matrix
#

lol

young knoll
#

PR it for us

#

kthx

eternal night
#

not my patch kekwhyper

young knoll
#

Are you not Steinborn

#

smh

eternal night
#

actually, Alfie Cleveland <alfeh@me.com> created the initial patch for dat

#

back to studying I go Sadge

calm lichen
#

im so close man 😭

umbral ridge
#

sus

calm lichen
#

import net.minecraft.server.v1_8_R3.*;
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
how do i get these to work ^? im pretty sure once i get these working all the errors will be gone

echo basalt
#

Let's start by doing it ourselves so we can learn a little

echo basalt
#

You might need to run buildtools

calm lichen
echo basalt
#

Are you using maven/gradle or are you importing the dependency directly?

calm lichen
#

maven 🙂

echo basalt
#

Show me your pom.xml

calm lichen
#

i cannot verify my spigot account because i dont have access too the email I used and it wont let me use my other account so I cannot post images unfortunately, what would be the best way to send it your way

echo basalt
#

?paste

undone axleBOT
echo basalt
#

If that doesn't work you can use other bins

calm lichen
echo basalt
#

Yeah you're importing spigot 1.20.4 and you're trying to use 1.8 nms

calm lichen
#

yea this code is really old, i attempted to update to "import org.bukkit.craftbukkit.v1_17_R1.entity.CraftPlayer;" instead

echo basalt
#

That's still 1.17

#

You want 1_20_R3

#

For craftbukkit

#

And the rest is obfuscated

#

?mappings

undone axleBOT
echo basalt
#

You can search the mojang equivalent here

#

Or map your pom.xml to use mojang mappings if you want to write NMS without a hassle

sterile flicker
echo basalt
#

?remap

#

hm

eternal oxide
#

?nms

echo basalt
#

Yeah that one

dawn flower
#

how do u get all configuration sections in a FileConfiguration

echo basalt
#

Loop through every key, get object, see if is section

#

And maybe recurse if needed

dawn flower
#

how do i loop through every key

echo basalt
#

getKeys

dawn flower
#

true or false for param

sterile flicker
# echo basalt No, I've worked with that author before

The fact is that I have such a problem custom NMS entity sometimes, if you go far away, appears in a suspended state at the player's position and then disappears when moving somewhere (that is, loading another chunk)? the fact is that I spawn a zombie and replace it with an id for an id npc while the player receives the PacketPlayOutSpawnEntityLiving packet. this way I get an NPC with AI, but if I move away, I sometimes see afterimages of the NPC, it strangely changes its position, maybe I should add handling of the npc unloading event this line java if (controller.isVisible(event.getSource(), getTrackerFor(zombie)) == BooleanResult.TRUE) { that uses Ocelot api did not fix the problem java @EventHandler public void onPlayerChunkLoad(PlayerChunkLoadEvent event) { for (CraftHusk zombie : manager.getZombiesInWorldChunk(event.getSource().getWorld(), event.getX(), event.getZ())) { if (controller.isVisible(event.getSource(), getTrackerFor(zombie)) == BooleanResult.TRUE) { System.out.println("zombie"); FakePlayer fakePlayer; try { fakePlayer = FakePlayer.create("", "", event.getSource().getWorld(), event.getSource().getLocation()); } catch (IOException e) { throw new RuntimeException(e); } event.getManager().showTo(event.getSource(), fakePlayer.getBukkitEntity(), zombie.getEntityId()); } } }

dawn flower
sterile flicker
#

code

dawn flower
#

nvm it's in FileConfiguration as well

#

👍

echo basalt
echo basalt
#

That can cause issues

#

Try it out

echo basalt
#

As it's a sort of root section

sterile flicker
#

Well, I'm confused about the positions

#

here's what I'm doing, how do I get the npcs to be destroyed?

calm lichen
peak jetty
#

how do i fix this? i want my plugin to work on both 1.20.1 and 1.19.4

[15:38:19 ERROR]: [ModernPluginLoadingStrategy] Could not load plugin 'FastNick-1.0.jar' in folder 'plugins'
org.bukkit.plugin.InvalidPluginException: Unsupported API version 1.20
        at org.bukkit.craftbukkit.v1_19_R3.util.CraftMagicNumbers.checkSupported(CraftMagicNumbers.java:382) ~[paper-1.19.4.jar:git-Paper-550]
        at io.papermc.paper.plugin.provider.type.spigot.SpigotPluginProvider.createInstance(SpigotPluginProvider.java:119) ~[paper-1.19.4.jar:git-Paper-550]
        at io.papermc.paper.plugin.provider.type.spigot.SpigotPluginProvider.createInstance(SpigotPluginProvider.java:35) ~[paper-1.19.4.jar:git-Paper-550]
        at io.papermc.paper.plugin.entrypoint.strategy.modern.ModernPluginLoadingStrategy.loadProviders(ModernPluginLoadingStrategy.java:116) ~[paper-1.19.4.jar:git-Paper-550]
        at io.papermc.paper.plugin.storage.SimpleProviderStorage.enter(SimpleProviderStorage.java:39) ~[paper-1.19.4.jar:git-Paper-550]
        at io.papermc.paper.plugin.entrypoint.LaunchEntryPointHandler.enter(LaunchEntryPointHandler.java:36) ~[paper-1.19.4.jar:git-Paper-550]
        at org.bukkit.craftbukkit.v1_19_R3.CraftServer.loadPlugins(CraftServer.java:431) ~[paper-1.19.4.jar:git-Paper-550]
        at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:273) ~[paper-1.19.4.jar:git-Paper-550]
        at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1104) ~[paper-1.19.4.jar:git-Paper-550]
        at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:320) ~[paper-1.19.4.jar:git-Paper-550]
        at java.lang.Thread.run(Thread.java:833) ~[?:?]```
eternal night
#

Define api-version as 1.19

lost matrix
lost matrix
eternal night
#

I am waiting on the printer to print my three paragraphs of the hgb

lost matrix
#

lol

peak jetty
lost matrix
dawn flower
#

raytrace or getTargetBlock?

#

?

peak jetty
#

it happened when i changed from 1.20 to 1.19

chrome beacon
#

Trying to run 1.20 nms code on 1.19

#

that won't work

lost matrix
# peak jetty why is this happening?

Because you are using nms. NMS and Craftbukkit are not compatible for multiple versions.
Thats why Spigot exists in the first place. Its compatible with multiple versions.

peak jetty
#

the error is happening in this meathod at EntityPlayer watcher = (EntityPlayer) ((CraftPlayer) target).getHandle();

lost matrix
peak jetty
rough drift
peak jetty
lost matrix
sterile flicker
#

how do I get NPCs in an unloaded chunk through manager or tracker(ocelot) in 1.16.5 if an NPC with the same ID as a zombie was spawned to display zombies as an npc with AI?

#

I can't figure out how to send the destroy packet

lost matrix
sterile flicker
peak jetty
# lost matrix With ProtocolLib probably

i have protocollib, i just dont know how to get the same function as EntityPlayer watcher = (EntityPlayer) ((CraftPlayer) target).getHandle(); without using craftbukkit

sterile flicker
#

I can't get zombies in a chunk

#

which is unloaded, and accordingly I cannot get the ID of the NPC

sterile flicker
#

can you look at getZombiesInWorldChunk method?

lost matrix
#

That class is not even close to a manager

sterile flicker
dawn flower
#

(item.hasItemMeta() && item.getItemMeta().hasDisplayName()) ? item.getItemMeta().getDisplayName() : item.getType().toString().replace("_", " ");

is this the best way to get the name of an item even if it's not named like Oak Planks? or is there a way to get the capitilizations correctly as well?

wind blaze
#

yo guys. Does anyone know if there’s an easy way to make an old plugin (1.7) usable for higher versions? 1.12 and up

lost matrix
inner mulch
#

you have some math operations in there that shouldnt be there

inner mulch
lost matrix
wind blaze
#

Oh sorry mistake on my side I meant mod like zip for own mod folder

sterile flicker
#

I still haven't figured out what to add to track of the NPCs and what should I do to make my class called "manager"?

sterile flicker
inner mulch
#

it doesnt make sense there

sterile flicker
inner mulch
#

you can make it an outer class

#

i shouldnt be in your manager

sterile flicker
glad prawn
#

If it is used in another class, you should separate it

inner mulch
#

npcs, right?

sterile flicker
summer scroll
#

How can I check if a player can has access to (break blocks, interact, etc) in specific location with PlayerInteractEvent respecting other plugins?

#

I found Player#breakBlock(boolean) but, it will actually break the block.

inner mulch
# sterile flicker custom zombies

I'd make a custom entity class add the show, hide methods into the custom entity (if you want to make them packet based) then you can extend to make a custom zombie and you create a customentitymanager managing whatever you need to manage there

peak jetty
lost matrix
# sterile flicker what can I do to improve it?

Sumeru why do you insist on writing this from scratch? I feel like you simply need more experience with writing spigot plugins
as well as general programming experience to pull this off. You are running against a wall for months now while continuing to
run into similar issues every day. There are libraries you can use which solved the hardest part for you already and let you focus
on writing content instead of building a system like that. Im 99% sure that what im seeing here will not work properly in the end
and will cause massive lags and instabilities for any server that tries to run this code.

Thats why im not answering to your "what can I do to improve it" questions anymore because ive tried giving you the fundamentals
weeks ago.

analog mantle
#

how can I convert &#FFFFFF into &x&r&r&g&g&b&b ?

lost matrix
summer scroll
lost matrix
shadow owl
#

Is there a quick maven shade filter I can setup to exclude all other dependency plugin's plugin.yml's but still keep mine? I tried this but it removes my plugin.yml as well:

<filter>
    <artifact>*:*</artifact>
    <excludes>
        <exclude>module-info.class</exclude>
        <exclude>META-INF/MANIFEST.MF</exclude>
        <exclude>plugin.yml</exclude>
    </excludes>
</filter>
wet breach
lost matrix
summer scroll
wet breach
#

but even if it does, doesn't mean everything in it doesn't work

shadow owl
wet breach
#

not necessarily

shadow owl
#

especially if the JAR im adding is a marketed as a shadable API?

wet breach
#

some plugins are not designed to run without their main class lol

lost matrix
#

In >95% of cases you will make the plugin you are shading completely useless

wet breach
#

not sure if its that great, I mean most of the time the plugin instance being passed in plugins doesn't need to be specific to which plugin

dawn flower
#

wouldn't shading a plugin cause issues since you're loading the plugin twice if there's 2 shaded plugins?

wet breach
#

since they are not making use of plugin specific things

wet breach
dawn flower
#

ah

lost matrix
#

Probably more like 98% honestly. I cant imagine a single plugin which works without their onEnable

dawn flower
shadow owl
wet breach
young knoll
#

Yeah idk why it says that

dawn flower
young knoll
#

You aren't meant to shade it

lost matrix
shadow owl
stiff vine
#

Hi, I have a question with protocollib. So i search a way to force player to dl a texture pack with a custom prompt (for now i found only this to do what I need). I found a packet named "SEND_RESOURCE_PACK" with no infomation on the wiki.vg and on internet. Did you have information on this packet ???

stiff vine
#

ye ok but when i want to use this packet i can't

lost matrix
lost matrix
#

Why do you want to use a packet in the first place?

#

Spigot has an API for this

stiff vine
#

i just can't. my IDE don't show me this packet and when i decopile protocollib i found another packet

peak jetty
#

what game version is CraftBukkit v1_20_R1 for? like 1.20, 1.20.1, 1.20.2, what

stiff vine
lost matrix
stiff vine
#

ty so much

peak jetty
peak jetty
# lost matrix

so how do i replace a CraftPlayer with the spigot way of doing it?

lost matrix
#

Spigot has no API for intercepting packets. You need to use ProtocolLib for that.

analog mantle
#

This method looks really ugly.
What should I do to make it look more clean?

private List<String> getStrings(DangerUpdateEvent event, ItemMeta m) {
    final List<String> lore = new ArrayList<>(m.getLore() != null ? m.getLore() : List.of());
    if(m.getLore() == null) {
        lore.add(0, "Dangerous Item! Danger level: " + event.getNewDanger());
    } else {
        if (m.getLore().get(0).contains("Dangerous Item!")) {
            lore.set(0, "Dangerous Item! Danger level: " + event.getNewDanger());
        } else {
            lore.add(0, "Dangerous Item! Danger level: " + event.getNewDanger());
        }
    }
    return lore;
}
rough drift
#

invert if statements and return instead of using else

analog mantle
#

To be clear, Intellij automatically generated that method because it was along the lines of 'extract thing from long surrounding method'

inner mulch
analog mantle
#

alright

inner mulch
#

use guard cluases

#

it makes it more readable

analog mantle
analog mantle
#

is this good?

private List<String> getStrings(DangerUpdateEvent event, ItemMeta m) {
    final List<String> lore = new ArrayList<>(m.getLore() != null ? m.getLore() : List.of());
    
    if (m.getLore() != null) {
        if (!m.getLore().get(0).contains("Dangerous Item!") && !m.getLore().get(0).contains("\uD83D\uDDE1")) {
            lore.add(0, "\uD83D\uDDE1 " + event.getNewDanger());
            return lore;
        }
        lore.set(0, "\uD83D\uDDE1 " + event.getNewDanger());
        return lore;
    }
    
    lore.add(0, "\uD83D\uDDE1 " + event.getNewDanger());
    return lore;
}

(I refactored the string to a simpler one)

icy beacon
#

For readability rename m to meta, that's my two cents

eternal night
#

If only one could store information in a form that wasn't lore on items Sadge

icy beacon
#

Valid

analog mantle
inner mulch
icy beacon
#

I'd probably need more context and try to do something else because it does kinda look ugly I agree

#

But I'll leave that to somebody else

inner mulch
icy beacon
#

Wait true though

analog mantle
icy beacon
#

Not good for storing data

inner mulch
#

?pdc

icy beacon
#

?pdc

inner mulch
#

dont compare strings, use pdc

icy beacon
#

And especially don't compare inventories by titles btw lol

analog mantle
icy beacon
#

Why do you check for info with lore then

analog mantle
icy beacon
#

"i", "m", "j" PLEASE don't do that

#

I feel like I'm reading decompiled code

#

Invert this statement

if (m != null) {
    // do
}

Into this

if (m == null) {
    return;
}
// do
#

You'll have less intended code if you use these guard clauses in your code and it'll become more readable

quiet ice
#

it is a code style really

icy beacon
icy beacon
#

I mean kinda yes you're right but like

quiet ice
#

E.g. at my school I am kinda banned from using break, continue and return unless there is no other way out. So you generally get a stupid amount of useless helper vars and stuff

icy beacon
#

Wtf

quiet ice
#

Mind you that most of my peers haven't programmed a lot of java. Hell, they wouldn't even know that hashmaps exist

icy beacon
#

That's on them lol

quiet ice
#

Yeah, but by extension teachers won't be able to understand more advanced programming paradigms because a person programming java in their free time for more than a year is a once in a lifetime event

acoustic pendant
#

How can i show a number like this: 3b, instead of the whole number?

icy beacon
#

Why wouldn't the teacher teach those who are not versed in Java yet

#

And be the experienced ones be

quiet ice
acoustic pendant
quiet ice
#

Though when there are no style rules that apply I do use continue, break and return rather frequently; but I wouldn't discourage from people using nesting.
More often than not, nesting is not a problem. These days we do not write code on paper, nor print it out on paper. With IDEs being able to scroll (I surmise that eclipse is even able of automatically scrolling), there really isn't a readability concern outside of reading github code or screenshots - but with code being generally a "write once, read never" affair, fanatic style guidelines are not necessarily a requirement.

acoustic pendant
#

i'll try that

quiet ice
acoustic pendant
#

double

quiet ice
acoustic pendant
#

it does

icy beacon
#

You are right in the manner that IDEs do a lot of heavylifting for us, they allow us to see the start/end of a block, thus mitigating the problem of nesting for the most part

quiet ice
#

The only maintained code I really write are APIs, where there are more stringent rules - yes.

acoustic pendant
icy beacon
#

But I also like reading my code with eyes, sometimes not using a mouse or anything

acoustic pendant
#

Double.toHexString didn't work

icy beacon
#

And when there's zero, one or, well, two indents in a function, it is much easier to read than if it is 10

quiet ice
acoustic pendant
#

Like, 500k, 5m or 10b

#

is that posible?

quiet ice
#

Should've specified it a bit further.
But no, there is no method that does it in java ready-made

acoustic pendant
#

I can do it checking the value I guess

quiet ice
#

You'll probably end up using a method such as

    public static String formatNumber(int number) {
        if (number < 1000) {
            return String.valueOf(number);
        }

        int exp = (int) (Math.log(number) / Math.log(1000));
        char unit = "kMBT".charAt(exp - 1);
        return String.format("%.2f%c", number / Math.pow(1000, exp), unit);
    }

(though this one is for ints [but easily portable to doubles] and not really efficent [e.g. constants could be cached], but at least it was an example I had easily at hand)

twin venture
#

Hi i need help with some Date and TimeUtils :L

icy beacon
#

That's a cool solution, I'd probably just do something like stringify and see the length

#

But this is more fancy (and probably faster :D)

twin venture
#

when i claim the pacakge it should say :
24 hour , 59m .. and go down :

ocean hollow
#

how can I read this?

#

chat GPT gave me that

wind blaze
#

Does anyone know how I can make older mods work for newer versions?

icy beacon
#

Try getMapList("nether_effects")

quiet ice
icy beacon
#

And work from there

quiet ice
#

or long - whichever applies best

icy beacon
#

Yep

lost matrix
ocean hollow
wind blaze
empty temple
#

is there any plugin that add dinosorus and dragons like rlcraft ???/

short plover
dawn flower
#

how to set block

#

just get the block at that location and execute setType?

empty temple
short plover
dawn flower
#

ok

twin venture
#

getTime is : enum for diffrent types

#

the one i have is daily , so it should be 24h

dawn flower
#

what's the difference between getX and getBlockX?

icy beacon
# ocean hollow like that?

I suggest you just run getMapList("nether_effects") and print the results (do the same with getConfigurationSection(..)) just to see what you get when running these and to know how to work with them

icy beacon
dawn flower
#

ah

icy beacon
#

getBlockX is a whole number specifically denoting the X of the block

twin venture
quiet ice
#

and what is the problem here? Same as last time?

twin venture
#

yes the time is incorrect , and it dose not decrease

golden turret
#

how do i make intellij not generate .iml files?

quiet ice
twin venture
#

no it does not do that , i was thinking about making a runnable for all online / offline players and it will decrease 1 second from it ..

#

but that's bad

icy beacon
#

I think you should save the timestamp of then the time should end and compare against it instead of saving its duration

#

If I understand your problem correctly

rough ibex
lost matrix
#

The only cool thing ive seen so far from v22 is JEP447
The rest is meh

dawn flower
#

is there a template for docs for ur plugin? (not javadocs)

#

like advancedenchantments' docs

rough ibex
#

AE doesn't use javadocs I think

dawn flower
#

yeah

#

i said not javadocs

rough ibex
#

they use gitbooks

dawn flower
#

gitbooks?

rough ibex
#

yes

dawn flower
#

oooooo

#

how do i make one

twin venture
#

i tried to do this when i claim it :

#

but it only add it up to 20..
not 24h

rough ibex
rough ibex
#
lost matrix
#

I usually go for just-the-docs

rough ibex
#

this is written in rST for Sphinx

dawn flower
#

wait

#

so i have to read the docs to make docs

rough ibex
#

yes

dawn flower
#

then what did the person that made the docs that ill read to make the docs read

lost matrix
#

For just-the-docs you just have to write markdown.
Sphinx is built with python iirc

dawn flower
#

how do i even setup one before doing anything

rough ibex
#

sphinx uses python but is agnostic

#

for example linux uses it

lost matrix
dawn flower
#

👍

lost matrix
#

Its auto hosted on github

dawn flower
#

forever?

rough ibex
#

pretty much, as long as your repo exists

#

pages is static & free

dawn flower
#

...

#

thats sick

rough ibex
#

I use sphinx+rST but you can use anything

#

you can then later link to actual javadocs

dawn flower
#

i dont think i need coding

#

im legit just building it

#

clicking stuff

#

oh god do i really have to write out the entire syntax im using

#

this is gonna be pain

rough ibex
#

what's your syntax?

dawn flower
#

..

#

just

#

abunch of actions

#

that i barely remember

peak jetty
#

whats the best version to develop for spigot atm?

shadow night
#

Latest maybe

dawn flower
rough ibex
#

latest ideally

dawn flower
#

it depends

#

there's no "best" version

#

but most likely 1.20.4

rough ibex
#

1.20.4 is the best

dawn flower
#

1.8.9 community rn:

rough ibex
#

1.8.9 should be dead

sullen canyon
#

can't even listen to PacketType.Play.Server.CHAT to get messages from a player before sending it to others

dawn flower
sullen canyon
#

it's just broken asf

rough ibex
#

... events?

sullen canyon
rough ibex
#

nevermind

lost matrix
echo basalt
#

Parts of hypixel run on 1.19 iirc

rough ibex
#

and 1.14

#

(build battle)

rough ibex
#

it's an amalgamation

young knoll
#

If only we had a way to confirm

#

kek

dawn flower
#

hypixel uses a fork of spigot at least

#

they have spigot-like stuff

young knoll
#

Well yeah

echo basalt
#

Was it spigot at the time?

rough ibex
#

a heavily modified fork of spigot

shadow night
#

They probably have rewritten minecraft already

young knoll
#

But it's been modified so much it's barely spigot anymore

lost matrix
rough ibex
#

I think /about used to say it.

dawn flower
#

hypixel gonna migrate to 1.20 anyways pretty sure, at least skyblock will

sullen canyon
blazing ocean
#

packetevents may be helpful

blazing ocean
young knoll
#

Does the event not fire before its sent to others

sullen canyon
sullen canyon
#

so, when a player texts something to a chat, it's checked and if the message is not appropriate it's not shown to other players who marked some words they don't want to see in the chat

blazing ocean
#

AsyncPlayerChatEvent

lost matrix
#

Sounds like you should just use the chat event

sullen canyon
#

tbh does not make any difference

blazing ocean
#

a lot simpler

sullen canyon
peak jetty
#

does this only save config.yml?

blazing ocean
#

yep

peak jetty
#

how do i save messages.yml as well?

blazing ocean
#

pretty sure theres a save method

lost matrix
#

saveResource

sullen canyon
lost matrix
#

The packet doesnt contain any String fileds

blazing ocean
#

is this plib

worldly ingot
#

I'm unsure why you're using a packet listener for this at all

#

The chat event's recipients list is mutable. You can remove recipients

#

You may completely destroy chat signing if that's the case, but I can't imagine you care much if you're hiding chat from specific users anyways

peak jetty
blazing ocean
#

if it should replace the current file

worldly ingot
#

It will always overwrite the existing file on disk, yes

lost matrix
peak jetty
#

so if a player makes a change it wont let them?

worldly ingot
#

Pretty much

blazing ocean
#

on plugin load , yeah

peak jetty
#

oh so its gotta be false right?

worldly ingot
#

It will copy whatever values you have set in your plugin's binary

blazing ocean
#

usually yeah

sullen canyon
worldly ingot
#

Yeah, that's fine. You can still adjust the recipients list

blazing ocean
#

in my case (very inefficient) i just cancel the event and broadcast the message to the players that can see it

peak jetty
#

how do i get the value of this from my messages.yml file?

blazing ocean
#

get()

worldly ingot
#

getString("prefix") :p

#

Does nobody have access to Javadocs or an IDE today?

blazing ocean
#

oh lmao

#

i actually dont

quaint mantle
#

Can someone tell me why this doesn't work in spigot 1.8.8?

        String actionBarMessage = ChatColor.RED + "" + currentHealth + "/" + maxHealth;
        player.spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(actionBarMessage));
    }```
lost matrix
#

?1.8

undone axleBOT
lost matrix
#

?notworking

undone axleBOT
#

"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.

rough ibex
#

1.8 does not have an actionbar

#

because 1.8 is old

quaint mantle
lost matrix
#

It has an actionbar. Show us more code

rough ibex
#

Is the actionbar available in 1.8 API though?

#

I don't remember it

young knoll
#

Don't think so

rough ibex
#

that would make sense then

quaint mantle
#

Uh I can't send my entire code.... I don't have discord nitro

blazing ocean
#

?paste

undone axleBOT
quaint mantle
#

And I can't post files either

heavy inlet
#

We're having a problem on our server where we take more damage when specificaly falling in lava with armor on. And if we die, we keep all items but lose our levels. We do not have keep inventory on, and it's the only circumstance where it happens. We notice that the HP drains quickly instead of doing tick damage. And it's only when being in lava not on fire. All armor does the same. Does anyone know a fix or have anyone experianced something similar?

rough ibex
#

unless youre making a plugin that has this problem

quaint mantle
peak jetty
#

how can i do the same thing for messages.yml?

glad prawn
#

custom config?

peak jetty
quaint mantle
lost matrix
quaint mantle
sullen canyon
#

thanks, you saved my day

quaint mantle
#

This is my own one that I'm making and I kind of need to use the actionbar

blazing ocean
quaint mantle
#

?img

undone axleBOT
#

Can't send images? That's because you're not verified! Use !verify to complete verification.
Alternatively, you can upload screenshots to any image hosting site and share the link.

Here's some screenshot utilities that you can use to upload images.
Lightshot: https://prnt.sc
Imgur: https://imgur.com/upload
Flameshot: https://flameshot.org

quaint mantle
#

This is the IDE error

blazing ocean
#

you used two arguments

#

for a one argument function

#

please learn how to debug error mesages

lost matrix
#

I thought it was a runtime problem

quaint mantle
blazing ocean
#

yeah

#

you should still be able to tell what an argument error means

quaint mantle
#

How do I use the actionbar then? Like hypixel uses it

#

Smh

rough ibex
#

likely not through the API

young knoll
#

NMS

#

Or some old third party api

blazing ocean
#

1.8.8 nms

#

fun

lost matrix
#

Working with software thats almost a decade old is masochistic

blazing ocean
#

i dont get why ppl still use that

quaint mantle
#

Is 1.20.4 easier to work with?

blazing ocean
#

yes

quaint mantle
#

alrighty

blazing ocean
#

and supported

quaint mantle
#

I make 1.8.9 forge mods and it works fine

slender elbow
#

and you can make plugins for 1.8.8 and they can also work fine

lost matrix
#

Undecided if this is increases readability or not. (Instead of having condition || condition || condition)

slender elbow
#

doesn't mean you'll get much help around a decade old version

blazing ocean
rough ibex
#

Bitwise OR?

blazing ocean
#

idt that increases readability

rough ibex
#

Permission bitflags

blazing ocean
#

just adds complexity

rough ibex
#

i understand what its doing from the names

quaint mantle
blazing ocean
#

yet

quaint mantle
#

Still has 1.4 years

#

Until it's a decade old

young knoll
#

?1,8

#

?1.8

undone axleBOT
blazing ocean
#

?1.8

undone axleBOT
blazing ocean
#

ah

lost matrix
#

?1,,,8

blazing ocean
#

¿1.8

young knoll
#

I will send all of you to the shadow realm

quaint mantle
#

I literally copy and pasted my code from 1.8.8 that didn't work and now in 1.20.4 it works 💀

blazing ocean
#

why does this matter

quaint mantle
#

Just asking lol

lost matrix
quaint mantle
lost matrix
#

Ah...

blazing ocean
#

right

quaint mantle
#

German to the max

blazing ocean
#

question is: whos more german? me or smile

lost matrix
#

Well.. my cover is blown. Time to exile into argentina.

blazing ocean
#

erm what

zealous osprey
#

Wouldn't be surprised if half the discord would be german XD

lost matrix
#

Dont fr me distilldowo im old and grumpy about this chinese spy app lingo

blazing ocean
#

lmaoo

zealous osprey
#

Awww, you want a Maultasche or Bratwurst with Ketchup to calm down?

blazing ocean
#

do you want a currywurst?

zealous osprey
#

Döner?

zealous osprey
#

rad and me just putting a whole feast together

blazing ocean
#

real

lost matrix
zealous osprey
#

old

quaint mantle
inner mulch
#

At what point does iterating over all placeholders hurt perfomance?

blazing ocean
#

am i allowed to say "boah alter" now?

zealous osprey
peak jetty
#

i know its just a java question but how do i access this is another class? sorry for the basic question

blazing ocean
#

static

zealous osprey
inner mulch
undone axleBOT
peak jetty
blazing ocean
#

just use kotlin /j

#

static in java is not very fun

inner mulch
lost matrix
# inner mulch :(

Placeholders should have a unique symbol to determine their content.
Example:
#placeholder#
After that you parse all placeholders in a text. In this case the result would be placeholder.
This content can then be used for a hash lookup.

sterile flicker
#

https://imgur.com/a/cyACWNK what could be the reason for this result, as can be seen in the screenshot, the chunk in which the entity was spawned at certain coordinates was not loaded at the start of the plugin, but everything works fine when I call through the command

inner mulch
young knoll
#

Smile is now writing an essay on big O notation

blazing ocean
#

im scared

lost matrix
# inner mulch Thanks, one question do you know what O(?) means and some numbers? I heard hashm...

The big O notation is used to describe time complexity of algorithms and data structures.
Its not a total description about how long something takes, but how well it scales with n (the number of elements).

For example a .contains() check on an ArrayList is O(n)
Meaning if
n = 1 -> 2ms
then
n = 20 -> 40ms
n = 100 -> 200ms
and so on.
So the time linearly scales with the number of elements in the list.

Hash structures usually have an average of O(1) meaning constant time.
n = 1 -> 2ms
n = 20 -> 2ms
n = 100 -> 2ms
This means it doesnt matter how many elements you have in the structure.

young knoll
#

Deprecated has runtime retention

#

So it should be visible

shadow night
#

What Big O does this have

inner mulch
blazing ocean
#

jesus reflection looks painful

sterile flicker
shadow night
lost matrix
blazing ocean
#

imagine #ifdef but in java/kotlin

#

no i really dont

worldly ingot
shadow night
#

If I ban a player and they try to log in, will AsyncPreLoginEvent or whatever it was called still fire?

blazing ocean
#

probably does, as that event gets called before ban validaiton AFAIK

young knoll
rough ibex
#

You should ban yourself, now!

blazing ocean
shadow night
blazing ocean
#

imagine not

lost matrix
young knoll
#

😩

#

How will I micro optimize now

tardy delta
#

by learning c

young knoll
#

C minecraft server when

tardy delta
#

google a repo

shadow night
#

I think you should write a minecraft server implementation using nothing but Unsafe because yes

lost matrix
blazing ocean
#

bash mc server is better

shadow night
young knoll
#

On second though C isn’t good enough

#

Hand optimized assembly server

shadow night
#

True

#

Compile it from C to asm, then manually optimize the asm to ensure maximum optimization