#help-development

1 messages · Page 632 of 1

young knoll
#

The scheduler isn’t bad

opaque scarab
#

Is there a way I can get the type of tool a block needs to be mined with, efficiently?

young knoll
#

You just need a plugin instance

inner mulch
lilac meteor
#

I only knew of sleep from when I messed w vanilla multithreading when I was in school

pseudo hazel
#

im assuming they mean efficient to write, not efficient for the computer

young knoll
#

There are tags which tell you which tool to use on a block

lilac meteor
#

didnt know Bukkit had such weird stuff going on when you use traditional multithreading

pseudo hazel
#

blame mc

young knoll
#

There’s also isPrefferedTool in the block class

opaque scarab
inner mulch
torn shuttle
#

@echo basalt

#

now that's what I call code

#

I'm ready to be paid by the character

young knoll
#

Paid by the byte

lilac meteor
#

okay.. so now im running into the issue of being able to pass in a plugin into the runTaskLaterAsynchronously function

#

since my handler is in its own class

flint coyote
#

?di

undone axleBOT
edgy crystal
#

anyone knows, how i can set the port on theholywaffel ts dependency?

config.setHost("000.00.000.00:0000"); (hiding mine)

config.setQueryPort(10011);
config.setFloodRate(TS3Query.FloodRate.UNLIMITED);

this doesnt work

steep scroll
#

I am trying to code a plugin that makes the last player to get hit or spleefed to get kill credit(I do not know where to start )

worldly ingot
ivory sleet
#

ru u making a web api?

#

where u use java for backend?

#

ah

#

s u're making a java wrapper lib

#

there are many ways to do this

#

well basically u wrap rest/graphql calls

#

make java representational classes of REST json objects

#

have u used jda?

#

yeah well u probably wna do sth similar to what they do

lilac meteor
#

I used the runTaskLaterAsynchronously function with a delay of 1
now its still occasionally happening, but it seems that on the occasions that it would ORIGINALLY function properly now throws an error

java.lang.IllegalStateException: Asynchronous block remove!
        at org.spigotmc.AsyncCatcher.catchOp(AsyncCatcher.java:14) ~[spigot-1.20.1-R0.1-SNAPSHOT.jar:3836-Spigot-3374045-08ec344]```
and the line of code from me that this is triggering on is the only one in this function

void replantCrop(Block blockBroken, Ageable targetCrop) {
blockBroken.setBlockData(targetCrop);
}

ivory sleet
#

no

#

but u wrap it

lilac meteor
#
    @EventHandler(priority = EventPriority.HIGHEST)
    public void BlockBreakHandler(BlockBreakEvent event) {

        //TODO: Add permissions for who can use the plugin
        Player actor = event.getPlayer();
        //get permissions
        //if not allowed, ignore

        //Allow user to ignore when pressing shift
        if (actor.isSneaking()) { util.debugMessage("Player sneaking, handler ignored"); return; }

        //If block is not a crop, ignore
        Block blockBroken = event.getBlock();
        BlockData blockData = blockBroken.getBlockData();
        if (!(blockData instanceof Ageable)) { util.debugMessage("Block is not a crop type"); return; }

        //Complete the final checks of when this handler will control the event
        Ageable targetCrop = (Ageable) blockData;
        int currentAge = targetCrop.getAge();
        int maxAge = targetCrop.getMaximumAge();
        if (currentAge < maxAge) { util.debugMessage("Crop was too young " + currentAge + "/" + maxAge); return; }

        //https://bukkit.org/threads/asynchronous-block-remove.202491/
        //SET PRIORITY TO LAST????

        //Cancel event as to prevent the block breaking after replanting
        event.setCancelled(true);

        //Drop the items that would normally drop
        dropAllItems(blockBroken.getDrops(), blockBroken.getLocation(), blockBroken.getWorld());

        //"Replant" the crop, really just setting the age back to 0 to look like
        targetCrop.setAge(0);

        //Need to wait a tick or two before replanting to let any break event misfires to pass
        Runnable replantSequence = () -> replantCrop(blockBroken, targetCrop);
        BukkitScheduler scheduler = Bukkit.getScheduler();
        scheduler.runTaskLaterAsynchronously(plugin, replantSequence, 1);
    }
lilac meteor
#


    void dropAllItems(Collection<ItemStack> AllItems,Location location, World world) {
        for (ItemStack item : AllItems) {
            world.dropItemNaturally(location, item);
        }
    }

    void replantCrop(Block blockBroken, Ageable targetCrop) {
        blockBroken.setBlockData(targetCrop);
    }
#

sorry for big code block, adding the async stuff is giving me even more grief than not delaying the replant

ivory sleet
#

whats so confusing

#

u fetch from the rest api

#

u get a json object

#

and then u turn that into a java object

quaint mantle
#

Hi , is good idea for make file scanner for making a simple anticheat ? a file scanner for cheat files !

quasi berry
#

Does someone know why this isn't properly saving to config.yml?

lilac meteor
ivory sleet
#

yes in simple terms

#

but then for instance jda is complex

#

because it provides caching alternatives

#

custom executors etc

#

i dont like jedis

#

its just good as a quick jedis java test setup

quaint mantle
# ivory sleet sure

but i think server spoofer can stop this so Can i make a file scanner without stopping by server spoofer ?

ivory sleet
#

lettuce is better

vapid grove
#
23.07 02:18:38 [Server] Server thread/WARN Task #15 for GooberPlugin v1.0.0 generated an exception
23.07 02:18:38 [Server] INFO java.lang.NoClassDefFoundError: Could not initialize class com.comphenix.protocol.wrappers.WrappedChatComponent
23.07 02:18:38 [Server] INFO at me.emerald.gooberplugin.Tab.lambda$runTab$0(Tab.java:25) ~[?:?]
23.07 02:18:38 [Server] INFO at org.bukkit.craftbukkit.v1_20_R1.scheduler.CraftTask.run(CraftTask.java:82) ~[spigot-1.20.1-R0.1-SNAPSHOT.jar:3810-Spigot-c62f4bd-b6b514b]
23.07 02:18:38 [Server] INFO at org.bukkit.craftbukkit.v1_20_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:415) ~[spigot-1.20.1-R0.1-SNAPSHOT.jar:3810-Spigot-c62f4bd-b6b514b]
23.07 02:18:38 [Server] INFO at net.minecraft.server.MinecraftServer.b(MinecraftServer.java:1257) ~[spigot-1.20.1-R0.1-SNAPSHOT.jar:3810-Spigot-c62f4bd-b6b514b]
23.07 02:18:38 [Server] INFO at net.minecraft.server.dedicated.DedicatedServer.b(DedicatedServer.java:388) ~[spigot-1.20.1-R0.1-SNAPSHOT.jar:3810-Spigot-c62f4bd-b6b514b]
23.07 02:18:38 [Server] INFO at net.minecraft.server.MinecraftServer.a(MinecraftServer.java:1198) ~[spigot-1.20.1-R0.1-SNAPSHOT.jar:3810-Spigot-c62f4bd-b6b514b]
23.07 02:18:38 [Server] INFO at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:1015) ~[spigot-1.20.1-R0.1-SNAPSHOT.jar:3810-Spigot-c62f4bd-b6b514b]
23.07 02:18:38 [Server] INFO at net.minecraft.server.MinecraftServer.lambda$0(MinecraftServer.java:304) ~[spigot-1.20.1-R0.1-SNAPSHOT.jar:3810-Spigot-c62f4bd-b6b514b]
23.07 02:18:38 [Server] INFO at java.lang.Thread.run(Thread.java:833) ~[?:?]
#

So, tryna make a tablist gui.

#

Not working.

#

Im using ProtocolLib, and everything ive tried wotn let it actually function, or show.

#

MC Version 1.20.1

vapid grove
#
public void runTab(){
        Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask(Setup.instance, () -> {
            ArrayList<Player> pList = new ArrayList<>();
            for(Player p: Bukkit.getOnlinePlayers()){
                pList.add(p);
            }
            for(Player p: Bukkit.getOnlinePlayers()){
                int[] time = Handlers.getHMS(Instant.now().getEpochSecond() - Setup.uptime);
                PacketContainer packet = new PacketContainer(PacketType.Play.Server.PLAYER_LIST_HEADER_FOOTER);
                packet.getChatComponents().write(0, WrappedChatComponent.fromText(ChatColor.RED + "" + ChatColor.BOLD + "Goober SMP"));
                packet.getChatComponents().write(1, WrappedChatComponent.fromText(ChatColor.RED + "Online Players: " + pList.size() + "\nPing: " + p.getPing() + "\nUptime: " + String.format("%02d:%02d:%02d",time[0],time[1],time[2])));

                try {
                    ProtocolLibrary.getProtocolManager().sendServerPacket(p, packet);}
                catch (InvocationTargetException ignored) {}
            }
        }, 0L, (5));
    }
#

heres the code im using for said tab

rare rover
#

are skip lists poor for performance?

#

i need a thread-safe list

ivory sleet
#

hmm

#

ttl isnt time based tho

#

its just to avoid endless circularity

#

no?

sullen marlin
#

Do you really need redis caching

#

Unless your API is slow and you have multiple servers it's pointless

#

Redis is just a complicated map

#

Honestly I don't you're at the scale where you need any caching

steep scroll
#

how to code spleef kill credit plugin

#

I want to check if a player is standing on a block that is broken by another player

sullen marlin
#

You probably don't need caching

#

Do your thing without caching

#

If you need it add it later

#

Why

#

How many is a lot

#

What does the API do

#

So 0.5/second

#

Your API can't handle 1 request every 2 seconds?

#

Sure

#

Or Guava cache

eternal oxide
#

I remember it was place not break that undoes.

quasi berry
#

Someone able to explain why this isn't working? It creates the config file but doesn't set the data

relevant main class:

    public void onEnable() {

        ConfigUtil config = new ConfigUtil(this, "syndicate-data.yml");
        getConfig().set("hello", "world");
        config.save();
    }```

relevant ConfigUtil class:
```public class ConfigUtil {
    private File file;
    private FileConfiguration config;

    public ConfigUtil(Plugin plugin, String path) {
        this(plugin.getDataFolder().getAbsolutePath() + "/" + path);
    }
    public ConfigUtil(String path) {
        this.file = new File(path);
        this.config = YamlConfiguration.loadConfiguration(this.file);
    }

    public boolean save() {
        try {
            this.config.save(this.file);
            return true;
        } catch(Exception e) {
            return false;
        }
    }
}```
ivory sleet
#

think u might have to create the file also

#

on disk

#

unsure how exactly save() worked

#

CHM works just fine, no?

quasi berry
#

Just doesn't add the hello: world

drowsy helm
#

what click event

#

inventory click or player interact

#

but pretty sure you will receive all 25

inner mulch
#

how do i add dependencies into my project (apis)

drowsy helm
inner mulch
#

maven

drowsy helm
#

the api should give you a maven dependency just copy paste it into your pom xml

inner mulch
#

it is red :(

#

errors

drowsy helm
#

show it

inner mulch
#

<dependency>
<groupId>com.lkeehl</groupId>
<artifactId>tagapi</artifactId>
<version>1.2.3</version>
</dependency>

#

errors

#

red :(

drowsy helm
#

the whole thing

#

and whats the error

inner mulch
#

idk thats why im here

lilac meteor
drowsy helm
#

how are you getting an error but dont know what the error is

inner mulch
#

it just is not a depency of the project

drowsy helm
#

show your full pom xml

inner mulch
#

its not that its copied wrong

#

the name is red

#

not the pom xml stuff

drowsy helm
#

have you relaod maven

inner mulch
#

i didnt know that i need to reload it :)

#

thank you

steep scroll
#

`@EventHandler
public void onPlayerMove(PlayerMoveEvent event) {
Player player = event.getPlayer();
Location playerLocation = player.getLocation();

    // Check if the player is standing on a broken block
    if (brokenBlocks.containsKey(playerLocation.getBlock().getLocation())) {
        UUID breakerUUID = UUID.fromString(brokenBlocks.get(playerLocation.getBlock().getLocation()));

        // Perform actions on detection, e.g., sending a message
        Player breaker = Bukkit.getPlayer(breakerUUID);
        if (breaker != null) {
            Bukkit.broadcastMessage(player.getName() + " is standing on a block broken by " + breaker.getName());
            lastHitMap.put(player.getUniqueId(), breaker.getUniqueId());
        }
    }
}`
#

I am trying to detect if a player go through an area that has been destroyed by another player

steep scroll
#

I converted it into UUID and it is not longer detecting the players going through the area

drowsy helm
#

show your full code

steep scroll
#
    public void onBlockBreak(BlockBreakEvent event) {
        Player player = event.getPlayer();
        Location blockLocation = event.getBlock().getLocation();

      
        brokenBlocks.put(blockLocation, player.getName());

    }

   @EventHandler
    public void onPlayerMove(PlayerMoveEvent event) {
        Player player = event.getPlayer();
        Location playerLocation = player.getLocation();

        // Check if the player is standing on a broken block
        if (brokenBlocks.containsKey(playerLocation.getBlock().getLocation())) {
            UUID breakerUUID = UUID.fromString(brokenBlocks.get(playerLocation.getBlock().getLocation()));

            // Perform actions on detection, e.g., sending a message
            Player breaker = Bukkit.getPlayer(breakerUUID);
            if (breaker != null) {
                Bukkit.broadcastMessage(player.getName() + " is standing on a block broken by " + breaker.getName());
                lastHitMap.put(player.getUniqueId(), breaker.getUniqueId());
            }
        }
    }```
drowsy helm
#

how can a player stand on something that isnt there

#

and you are using player name

#

and then trying to convert it to a uuid

steep scroll
#

yes

river oracle
#

so idk if you are aware

#

but

#

if a player has the name, "Bob", that is not a UUID

ancient plank
#

Ex.
My username is: Adelemphii
but my UUID is: 501b25af-98c7-4807-8f4f-7d257a75d55d

steep scroll
#

aaa

#

I see

#

just fixed it thx

lilac meteor
# sullen marlin Yes

I decided that when the event triggers and that the replant should be done, it adds the location to a list of locations, then if that event is triggered again, it checks if the location is in the list and cancels the second event and returns if that is the case

#

so in short, I mutex the location
and I call a function to unlock it 2 ticks later

weak meteor
#

BRO

#

HOW DIFFICULT IT IS TO MAKE A CONSOLE APP WITH JAVA

#

WHY IT IS SO DIFFICUKT

#

ive been 2 days and i cant make the jar open a terminal

slender elbow
#

what

steep scroll
#

How do I add a value to a dummy scoreboard?(from the /scoreboard Command)

#

I am trying to make a plugin that works with a data pack I have and I am using a score board for the points

clear panther
sterile breach
#

Hello, i want do a confirmation gui. How to do? When my player click on a button, Open the confirmation gui with callback ?

gritty cradle
#

hey yall can someone tell me how i can decrease the minimum height for fall damage using spigot api?

buoyant viper
#

u can probably? start setting their fall distance based off of ur own calculation @gritty cradle

#

like Player#setFallDistance or w/e iirc

barren oak
#

Hello. I want to make the building system where constructions is made out of multiply blocks, and contains various variables such as material and durability.
For example, when player places certain block, there will appear new construction, and when any of its block damaged, durability of entire construction will decrease.
Also i need it so player can upgrade the construction and demolish it.
How can i make it, with taking into account that there will be many of constructions, and they needs to be saved even on server restart?

#

i can provide an youtube video with example

gritty cradle
#

like for example just falling from 1-2 block height will give fall damage

hybrid spoke
barren oak
quaint mantle
#

Whats a good website to find chars to use for font files in resource pakcs

barren oak
#

thanks for response anyway

hybrid spoke
tacit drift
tender shard
#

List.add(...) returns true if the list was changed

#

instead get the list, add something, then set the list back

#
List<String> list = config.getStringList("Path");
list.add("new entry");
config.set("Path", list);
grim ice
tender shard
#

i'm using allatori, why?

tender shard
grim ice
#

allatori can be deobfuscated though

tender shard
#

everything can be deobcusfacted though

grim ice
#

yeah, but some are very hard to

#

e.g ZKM costs 250$, no one has ever deobfuscated it yet

#

currently

#

im not looking for the standard way of obfuscation

#

im trying to come up with a new method

#

something about linking the code to a user's device

#

in which the code wouldnt run if its in another person's device or something like that

pseudo hazel
#

what do you mean, on the MAC adress or somethin?

eternal night
tender shard
#

string encryptoin is completely pointless

tender shard
#

by giving everyone a unique .jar or what lol

grim ice
#

Yes

#

i can make a jar generating mechanism or something like that

#

still, im very lost currently

hazy parrot
#

Again this convo kekw

tender shard
#

it's useless

#

i just happened to have bought allatori anyway, so I use it, but it's literally pointless to invest any more time than just using whatever you already got

#

even thinking about your weird custom encryption is already a total waste of time you could better spend on adding some new features

grim ice
#

are the most annoying humans ever

tender shard
#

Then dont sell anything to them?

grim ice
#

you ever had a dedicated group of 200+ people just trying to make a copy of your work and give it away for free

#

out of spite

grim ice
#

💀

tender shard
#

Your plugin must be the best plugin ever made

eternal night
#

if you are going to deal with that group, your self made obfuscation or keylike checks are not going to stop them lol

grim ice
#

it isnt a plugin

grim ice
#

but still, this is reality

#

well its a mod

tender shard
#

I doubt that you can think of any better obfuscation than the people at allatori or other available obfuscators

grim ice
#

and its by far the biggest mod on the certain community im in

grim ice
#

but the thing is

#

what allatori and the other obfuscators did

#

just obfuscated the code

#

is there no possible way of like

#

ughh nevermind thats impossible

#

you cant have code being ran without the client seeing it

#

damn it

tender shard
#

PaaS lol

#

Sounds like a very bad idea

quiet ice
#

Packet analysis as a Service?

tender shard
#

Plugin

#

Or whatever

grim ice
#

its a client side mod

#

meaning it doesnt interact with the server

tender shard
#

I wouldn’t invest time into it

grim ice
#

so in short, its meaningless to pursue obfuscation any further?

tender shard
#

it doesn'T hurt to run allatori or similar on it if you have bought it already anyway

#

especially since you can tax deduct the cost of any available obfsucator

grim ice
#

i dont have allatori but there are so many free deobfuscators for it

quiet ice
#

Plugins as a service is doable but it is just about as easily reverse-engineerable in java space

tender shard
grim ice
#

aight

pseudo hazel
#

if you want code noone can see you shouldnt make minecraft addons

warm light
#

how can I set sound on skull with setNoteBlockSound?
anyone can give me an example code?

vivid lion
#

You need a block then check if block.getState() is instanceof Skull

#

If it is cast state to Skull

warm light
#

I am confused with NameSpaceKey

#

how to use that to setNoteBlockSound

tender shard
#

sounds use namespaced keys, e.g. minecraft:ambient.crimson_forest.mood

#

that'd be ```java
NamespacedKey.minecraft("ambient.crimson_forest.mood")

#

if you got sounds from a resourcepack, e.g. "mypack:some_sound" you'd do NamespacedKey.fromString("mypack:some_sound")

warm light
#

thanks

#

but where I can get the list?

tender shard
#

I just use /playsound and search through with tab completion

warm light
#

thanks again ;)

tender shard
#

the name is usually the same as in the Sounds javadocs, except that for example ENTITY_ARMOR_STAND_HIT becomes e.g. entity.armor_stand.hit

warm light
#

got it :)

sterile breach
#

hello, if I have a player open an inventory when one is already open, will it call the closing vent?

sullen marlin
#

Yes

warm light
#

ambient is the sound that the mob made normally right?

onyx fjord
short raptor
#

In what situation could this produce null pointer exception?

#

Only if the UUID doesn't correspond to a valid player?

echo basalt
short raptor
#

Oh, okay

echo basalt
#

the .isOnline method on Player is somewhat useless as it's inherited from OfflinePlayer

short raptor
#

I misunderstood it, I thought it would return offlineplayers for any valid uuid

echo basalt
#

That's getOfflinePlayer

short raptor
#

Ok cool ty

mortal hare
undone axleBOT
placid moss
#

have you built the project

echo basalt
#

Yeah so you're running your project instead of actually building it

placid moss
#

why are the logs a jda bot

#

also are you using a build system? if not i recommend you use one (maven or gradle probably)

eternal night
#

you have to try-catch that

#

I mean, only really required around the .sleep call

umbral ridge
#

It's not recommended to throw exceptions within the try-catch block and it's not a good practice

kind hatch
#

What in the name of?

wet breach
#

do it the second time

echo basalt
#

wallah wtf

wet breach
#

not sure what that is for, but it seems just like an easy way to skip the first element

kind hatch
#

This is JDA's javadoc bot parsing code.

kind hatch
#

They have some weird element in their docs that they use to mark something. They must be skipping that one specifically.

wet breach
#

first setting, would be first element, the second one would move it to the next, and the loop would just advance it from there

wet breach
#

this is a common thing especially from the web develpment side of stuff

#

you would commonly skip the first elements lol

kind hatch
#

Don't know why they didn't just use :nth-child() instead.

#

Pretty sure JSoup supports those kinds of selectors.

wet breach
#

because that requires different method calls and would actually be slower

#

this is just one of those things where its a nice trick to skip the first one

#

its easy, doesn't hurt performance etc

kind hatch
#

Well my retrofitting hacks were working up till this point. :p
Guess I'm gonna have to rewrite this method since there is no weird elements in the spigot javadocs.

#

That and the structure is different between JDA & Spigot.

mortal hare
#

can someone explain why bukkit configuration api loads the file into deserialized string type

#

and then parses it through snakeyaml?

#

snakeyaml Yaml object allows you to read from input stream via Yaml.load()?

kind hatch
#

Probably because spigot was using a really old version of SnakeYAML for the longest time. They only recently updated it to something relatively newer.

lilac dagger
#

i've noticed it too, they added comments 😄

near mason
#
@Override
    public void onEnable() {
        ProtocolManager manager = ProtocolLibrary.getProtocolManager();
        manager.addPacketListener(new PacketAdapter(this, PacketType.Play.Server.NAMED_ENTITY_SPAWN) {
            @Override
            public void onPacketSending(PacketEvent event) {
                PacketContainer spawnEntity = manager.createPacket(PacketType.Play.Server.SPAWN_ENTITY);
                WrapperPlayServerNamedEntitySpawn playerPacket = new WrapperPlayServerNamedEntitySpawn(event.getPacket());
                WrapperPlayServerSpawnEntity spawnPacket = new WrapperPlayServerSpawnEntity(spawnEntity);
                
                spawnPacket.setUuid(playerPacket.getPlayerId());
                spawnPacket.setX(playerPacket.getX());
                spawnPacket.setY(playerPacket.getY());
                spawnPacket.setZ(playerPacket.getZ());
                spawnPacket.setType(EntityType.SPIDER);
                spawnPacket.setId(playerPacket.getEntityId());
                
                event.setPacket(spawnEntity);
            }
        });
    }

it gives me java.lang.NoClassDefFoundError: error

echo basalt
#

The packet wrappers aren't included in protocollib and you'd need to shade them

near mason
#

wdym

#

i added it to pom.xml

#

do i add it to plugin.yml's depend?

quaint mantle
#

Fat jar

young knoll
#

You need to use the maven shade plugin

near mason
#

Failed to create shaded artifact, project main artifact does not exist.

wise pumice
onyx fjord
#

@near mason packetevents has wrappers built in

near mason
tender shard
#

mvn clean package should work fine

#

but why did you disable the dependency-reduced-pom?

#

also you gotta shade PacketWrapper

#

i think

quaint mantle
# near mason

Remove provided scope from com.comphenix.packetwrapper

young knoll
#

Isn’t packetwrapper like

#

Really outdated

tender shard
#

I'd also update maven-compiler-plugin to 3.11.0 and maven-shade-plugin to 3.5.1

tender shard
onyx fjord
#

it is outdated so i recommend packetevents instead

#

or making your own wrappers

#

but thats meh

tender shard
#

or just use NMS

remote swallow
#

okay so mojank are fuckin dicks and have 3 sounds to one namespace, how can i guarantee its always the 2nd sound

eternal oxide
#

3 to 1? explain

carmine mica
#

you have to specify the same seed for the sounds

stray nacelle
#

how to send image 💀

tender shard
mortal hare
tender shard
#

variants

#

whatever its called

gray talon
#

is there anyway to send chiptune to the client

#

used noteblock and its terrible

onyx fjord
young knoll
#

You would need a resource pack to do anything more fancy than noteblocks

onyx fjord
#

i hate using nms

gray talon
#

making a gameboy emulator

#

but lacking sound because yes

tender shard
remote swallow
tender shard
onyx fjord
#

i know everyone loves having 10 modules

remote swallow
#

normally packets wouldnt be an issue except this plugin is for 1.18 upwards and has configurable sounds so i would need to have a field for it

#

so fun

tender shard
young knoll
#

Do we not have api for the sound index

onyx fjord
#

but with a library you dont need to give up on older versions

tender shard
#

also who cares about older versions

onyx fjord
#

yes ofc lmao

tender shard
#

where?

#

spigot says "1.17 native, tested up to 1.19"

remote swallow
#

why does the uk own this tiny part of land

young knoll
onyx fjord
eternal oxide
#

The Falklands Isles

onyx fjord
#

not builds

tender shard
# onyx fjord

where is that from? on github the latest is also 1.19.4

onyx fjord
#

CI

upper hazel
#

Using abstract classes and the "strategy" pattern, I'm trying to find a way to effectively manage textures that distract the player from teleporting in the game. These classes have similar logic, but in some ways they are different. I have created an abstract rtp class and an rtpManager class which contains all the classes that inherit the abstract rtp class. However, one of the rtp variants has its own unique check, and the manager does not know which class it is working with. I need advice on how to solve this efficient problem.

bitter rune
tender shard
#

and it's nowhere to be found "officially", the jenkins also says "latest is 1.19"

remote swallow
onyx fjord
#

ci is official

#

wdym

tender shard
#

i'd just use NMS, it's like one line

remote swallow
#

not down by brazil

eternal oxide
onyx fjord
remote swallow
#

british empire was great

onyx fjord
#

build for 1.20 is cleared i think

remote swallow
#

can we get it back

tender shard
# onyx fjord ci is official

it says "recommended versions 1.19.4" and you only find out that a 1.20 version is available if you manually go through the latest builds until you find the one that has "1.20.1 support" in its changelog

bitter rune
#

And USA has Alaska

onyx fjord
#

that version is recommended for 1.8-1.19.4

#

i dont see what you dont understand

tender shard
#

so how does one find out that it supports 1.20? by going to the jenmkins page, then manually click on build 661, read it, go back, read build 660, go back, etc, until you find the build that mentions 1.20?

young knoll
#

You could just download the latest one and try it

bitter rune
#

You could probably just Google 1.20.1 protcollib and Google will direct you there

gray talon
#

why even bother to use protocollib

tender shard
#

yeah but why would I even try to download something that mentions both on the jenkins page and on the spigot page that the recommended version does not support latest

tender shard
gray talon
#

just make your own

#

it took less than 15 minutes

onyx fjord
#

seems like people have no issues finding it

#

i use packetevents because i can shade it

gray talon
#

spend 30 more minutes and you have a decent library

onyx fjord
#

idc about a megabyte bigger jar

onyx fjord
#

but you dont even need nms

#

you can do it purely with netty

gray talon
#

this is just netty

#

i mean i dont say i use netty whatsoever

#

at the end a server is just a ping pong machine

mortal hare
young knoll
#

1.8 was defeated long ago on bStats

gray talon
#

but the reality is

#

for classic minigames server

#

1.8 is no brainer

young knoll
#

Meh

mortal hare
young knoll
#

Just use old PvP in new version

onyx fjord
gray talon
#

minestom is not plugnplay

#

if there is one then most of the functionalites are missing

#

and exploit vary from one to another implementation

grim ice
gray talon
#

and 1.13+ scaling is absolute horrible

#

most performant server still relies on 1.8 or even a heavily modified version of 1.7 (hypixel)

young knoll
#

You know you can just

#

Remove the stuff you don’t use from modern versions

gray talon
#

sound easier said than done

#

you remove one and another one breaks

gray talon
#

budget gamers still play on 1.12-

young knoll
#

Good for them

gray talon
#

1.12 imo is the best non 1.8 version

tender shard
#

the best non 1.8 version is 1.20.1

grim ice
#

I personally dislike 1.8 pvp and 1.20 crystal pvp

young knoll
#

You can just remove crystal PvP

tender shard
#

what even is crystal pvp lol

grim ice
#

1.8 pvp is legit just buying a good mouse and developing Arthritis

tender shard
#

or a macro

young knoll
#

End crystals do a lot of damage

river oracle
kind hatch
grim ice
#

1.20 crystal pvp is disgusting, simply put, you most definitely are obese or stinking, or a child molester if not all of the above if youre main goal in life is 1.20 crystal pvp

gray talon
#

hypixel uses 1.7.2 and never left for a reason

young knoll
#

1.7.10

gray talon
#

because newer version is a bloat

river oracle
#

Yeah

gray talon
#

BIG bloat

young knoll
#

And that reason is they have too many patches to update

river oracle
#

It's impossible to fucking upgrade a monolithic system

grim ice
young knoll
#

They would have no trouble removing any bloat

grim ice
#

hypixel is planning to move to 1.20

#

sometime in 2024

river oracle
#

They patched so fucking much upgrading is impossible

gray talon
#

they DONT

#

they just add support for it

grim ice
#

💀 if thats what u wanna hear

tender shard
#

imagine playing an 8 year old version that's missing all the new features

young knoll
#

They have talked about moving skyblock to newer versions

gray talon
#

they can add custom protocol

young knoll
#

But only skyblock

river oracle
#

I love when people point out hypixe like they wanna be on 1.7.2

grim ice
#

barely anyone plays anything other than skyblock except bedwars

gray talon
#

you see, the entire minecraft server and client is just a ping pong machine

#

the server send a packet

grim ice
#

so its basically 50% of the playerbase moving to 1.20

gray talon
#

the client receive it

#

and see

young knoll
#

Yes that’s how multiplayer games work

grim ice
#

💀

gray talon
#

they add 1.20 support by explicitly disallowing older version

#

and add packets corresponding to 1.20 client

grim ice
#

the reason hypixel didnt move completely to 1.20 isnt because they love 1.8 lmao

gray talon
#

you cannot merge a huge codebase to a newer version without breaking the entire system

grim ice
#

its because they have already built so much in 1.8

gray talon
#

1.7.10

#

NOT 1.8

grim ice
#

and its gonna take a long time to move to 1.20

gray talon
#

they never use 1.8

onyx fjord
#

idk why people praise velocity so much

gray talon
#

hypixel IS 1.7

river oracle
#

Im losing braincells

onyx fjord
#

most major servers use bungeecord with not issues

grim ice
onyx fjord
#

wynncraft, hypixel

ivory sleet
gray talon
ivory sleet
#

they have migrated over time to newer software

kind hatch
#

Can someone please provide proof as to where someone on the hypixel team said what version they are based on?

ivory sleet
#

ask any of their admins lol

#

like their smps for instance

onyx fjord
#

hypixel smp is a joke

ivory sleet
#

maybe

onyx fjord
#

instead of paying for rank just buy some cheap hosting

river oracle
#

Hypizel smp iS funny

onyx fjord
#

at least you wont have 100+ ping

river oracle
#

I love it xD it makes 0 sense and that's why it sso good

ivory sleet
#

agentk did bring it up at some point

gray talon
#

here

young knoll
#

Difference is you only need to pay once to use hypixel smp

gray talon
#

this is the proof

#

this is from hypixel discord server

#

you can search it too

#

they would do the same thing to support 1.20

#

disallow older version

#

and stuff newer stuff in

ivory sleet
kind hatch
gray talon
#

cecer used to be a hypixel admin

grim ice
#

hypixel works on 1.8.9

#

if you think otherwise, youre severely mistaken

gray talon
#

because they protocol hack

grim ice
#

They updated to 1.8 long ago

gray talon
grim ice
#

The misconception that Hypixel is built on 1.7.10 may have come from the fact that the server was originally released in 2013, when 1.7.10 was the latest version of mc

gray talon
#

im p sure this message is not 8 yearsold

tender shard
gray talon
#

as i said

kind hatch
#

They must go through hell to support the newer versions if they are based off of 1.7.

gray talon
#

look it up on hypixel official discord server

young knoll
#

Not really

tender shard
#

but who cares which version they run anyway? what difference does it make whether they use 1.7.4 or 1.8.8 or 1.12 or whatever lol

gray talon
#

armorstand and custom skull textures dont exist on 1.7

#

they still managed to add them in and use them frequently

#

on all minigames across the platform

river oracle
gray talon
#

if you are a skywars veteran

#

you will remember once there is a specific NCP 1.7.x bug

#

that kills you for fall damage on slime blocks

#

they're a company

#

merging a 6 figure codebase to a completely different platform without knowing if it will blow up or not is not something a company would do

#

they never used any standard bukkit API

young knoll
#

That part is false

gray talon
#

keyword "standard"

young knoll
#

Even if they heavily modify the server they do still use the api for some things

gray talon
upper hazel
#

who know russ help pls

onyx fjord
#

russ?

gray talon
#

russian

warm mica
#

ian

narrow flare
#

Hey i've question on Hypixel Server the custom heads are big how did they do it? the heads I put on my armorstands are small

gray talon
#

thats just the armorstand head

#

try to put your character head near it

#

it will fit roughly

kind hatch
#

ArmorStands are dead.
Long live Display Entities.

narrow flare
#

What can I do?

kind hatch
# narrow flare What can I do?

If you use display entities, you can apply a transformation that scales the block to whatever size you need it to be.
If you use armorstands, you could try ArmorStand#setSmall()

inner mulch
#
    public void onJoin(PlayerJoinEvent event) {
TextDisplay entity = (TextDisplay)       player.getWorld().spawnEntity(player.getLocation(), EntityType.TEXT_DISPLAY);
            entity.setCustomName("Hello, I am a text display!");
            entity.setCustomNameVisible(true);
            entity.addPassenger(player);

        }```
why doesnt the entity apear / entity name apear above the player head?
chrome beacon
inner mulch
#

oooh

#

wait let me test the reverse

chrome beacon
#

Also use the spawn method that takes a consumer

#

And modify the text display there

#

Right now you're spawning the text display and then changing it's values

#

instead of setting the values and then spawning it

inner mulch
#

ok, but it still doesnt apear to be in the player

stray nacelle
inner mulch
#

i have never used packets

chrome beacon
#

No need for packets

stray nacelle
#

don't try it, i write my message for rofl

fluid river
#

jree

#

fava

stray nacelle
#

uj

chrome beacon
#

Since it's a text display

fluid river
#

fr

#

guy changing name instead of text

green prism
#

Has an API been developed for configurable inventories that allow the addition of predefined actions to Inventory GUI elements through configuration?

fluid river
#

999 apis

green prism
#

wdym

fluid river
#

oh you mean spigot api

green prism
echo basalt
#

yeah so

#

What I showed you was my own

green prism
#

I know, don't worry, I was asking if they ever created something similar public lmao

echo basalt
#

uhh no clue

#

That's why I wrote my own

fluid river
#

then yeah

#

just google some

#

i'm sure there are lot's of apis for that exact purpose

quiet hearth
#

ow do I make an ender dragon perch to a specific location?

green prism
# echo basalt That's why I wrote my own

I just created it actually but I don't like the system I used of Reflections, I think it's too heavy

heaviest class (in my opinion):
https://paste.md-5.net/lugacugode.java

How it works:

@LabAnnotations.Inventory(inventoryName = "example")
public class ExampleMenu extends CustomInventory {

    public ExampleMenu(InventoryHandler inventoryHandler) {
        super(inventoryHandler);
    }

    @LabAnnotations.ClickAction("example_action")
    public void onExampleAction(InventoryClickEvent event) {
        // Define what happens when the player clicks an item with the action "example_action"
        event.getWhoClicked().sendMessage("You clicked an example item!");
    }

}
echo basalt
#

Yeah there's no need for reflections

#

In my case I just have everything as a "menu element"

#

And those elements can have click handlers associated to them

#

There's also a main Menu#click where you pass the event and it gets whatever element was clicked on and runs the click tasks

green prism
#

Annotations seemed to me the easiest and most intuitive method (unfortunately heavy)

echo basalt
#

getElement("example_action").onClick(event -> {});

#

lambdas

inner mulch
#
    public void onJoin(PlayerJoinEvent event) {
TextDisplay text = (TextDisplay) player.getWorld().spawnEntity(player.getLocation(), EntityType.TEXT_DISPLAY);
            text.setText("test\n2test\n3test\n4test");
            text.setBillboard(Display.Billboard.CENTER);
        }```

why doesnt the entity apear / entity name apear above the player head?
green prism
# echo basalt getElement("example_action").onClick(event -> {});

So "simply" you created an "Element" class that contains all the item stack values and the action value for an element, like this one:

@Data
@Builder
public class Element {

    private Material material;
    private String displayName;
    private List<String> lore;
    private String action;

    // more stuff

    private int amount;
    private int customModelData;

And then on click you check what element was clicked and if it has an action?

echo basalt
#

Ideally element would be an interface

#

And instead of all of that crazy stuff you just pass an itemstack and a Consumer<InventoryClickEvent>, as well as any placeholders you'd want

green prism
echo basalt
#

There's no specific action value in the config, I just link it to the "item name"

#

When reading the config each item is given a name

#

Which is the name of the section where the item is defined

#

So I make an element with that item and put it in a map

icy beacon
#

in ACF, how do i get the previous argument in command completions?

commandManager.commandCompletions.registerAsyncCompletion("culture-level") { context ->
  val previousArgument = ???
  val someValueBasedOnPreviousArgument = ...

  return@registerAsyncCompletion someValueBasedOnPreviousArgument
}
green prism
#

right?

echo basalt
#

The char is the identifier

green prism
#

Oh, WOW! That's great!

echo basalt
#

anyways I forgot how mongo codecs work

#

ah it's in the client settings

tender shard
icy beacon
green prism
# echo basalt

Then you simply split any string in the List<String> by spaces, right?

#

To find elements

echo basalt
#

uhh

#

it's a bit convoluted

tender shard
echo basalt
#

but you can do it without spaces as long as the string is 9 characters long

#

and split it by each character

#

so I do have checks and support both

#

It's some icky code

#

but it works

quaint mantle
#

I can't find org.bukkit.OfflinePlayer.getLastSeen() in the docs

#

what does it return?

echo basalt
#

paper method maybe

quaint mantle
#

any examples?

echo basalt
#

yeah it's paper

#

probably an epoch

tender shard
green prism
echo basalt
#

¯_(ツ)_/¯

fluid river
#

imlusion gives free bukkit lessons fr

quaint mantle
#
OfflinePlayer offlinePlayer = getServer().getOfflinePlayer(username);
if (!offlinePlayer.hasPlayedBefore()) {
                res.status(404);
                return "Invalid";
}
res.type("application/json");
Map<String, Object> playerData = new HashMap<>();
playerData.put("username", offlinePlayer.getName());
playerData.put("last_seen", offlinePlayer.getLastSeen());
``` hmm im not importing any paper stuff here
echo basalt
#

I hope that's async

remote swallow
#

because its added to the bukkit class

#

they patch it

echo basalt
remote swallow
#

just because you dont import anything paper doesnt mean you dont use anything paper

icy beacon
#

this is 1.19.4 and it's indeed paper

#

albeit being in bukkit class

tender shard
quaint mantle
#

hmm alright

fluid river
native gale
#

Is there a way to run something as soon as server shuts down, but while all plugins are still enabled?

fluid river
#

onDisable()

#

tho not all plugins

#

but some of them

#

ig

fluid river
#

insert malware

#

😉

icy beacon
tender shard
#

why don't you insert the malware during startup

#

that's how I always do it

wet breach
#

if whatever you decide to run, takes too long the server will force shutdown

native gale
# tender shard what are you trying to do?

I noticed some weird behaviour on restarts, if people are logged in while server shuts down, some plugin data isn't stored correctly. I want to forcefully kick everyone right before plugins start to disable themselves, so the data isn't corrupted

flint coyote
#

Just ask Carlos to insert the malware

fluid river
icy beacon
fluid river
fluid river
#

fr

icy beacon
native gale
echo basalt
#

someone's not joining their futures onDisable

flint coyote
icy beacon
#

but you kinda should, if some plugin is faulty you should find out which one is

wet breach
#

the problem is more then likely instead of saving data when the server is stopping, they are saving data only at predefined times instead

fluid river
native gale
icy beacon
#

then replace the plugin

flint coyote
#

If I were to be reported such an issue I'd fix that within 1-2 days

icy beacon
#

if a plugin is faulty why use it?

#

you want a high quality server, not a hackishly built one, i reckon?

#

?ask

undone axleBOT
#

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

native gale
flint coyote
#

Are we talkin about some niche plugins?

native gale
#

I don't know yet which plugin causes the problem

icy beacon
#

find out

wet breach
flint coyote
#

So you know the data isn't stored and that causes issues but you don't know which data?

icy beacon
#

remove half of them, then if it didn't help, remove the other half, etc

icy beacon
wet breach
#

I don't use any of that stuff

flint coyote
icy beacon
wet breach
native gale
#

Okay, the question was "how to run something before plugins start to disable themselves" and the solution you propose is to "debug every plugin I use"

#

I don't care right now, I want to implement a quick fix

wet breach
#

but its strange you know data is missing, just don't know who owns that data

flint coyote
#

Even in the onDisable() his plugin is not guaranteed to be unloaded first

wet breach
#

if all you need to do is kick players before shutdown, then why not make a plugin that does this then

#

it doesn't need to happen during the shutdown

native gale
wet breach
#

just kick all players, and set whitelist temporary

#

then you are free to shutdown

#

I typically have scripts that handle my shutdowns, but there isn't really a command you could do and get its output easily from script

#

so at minimum, just make a plugin that has a command to kick all players

#

and then you can run that command from script and then the shutdown

#

but as I said earlier your issue is one of the reasons I have all custom plugins. Very rarely do I run a plugin that isn't under my control

flint coyote
hallow jackal
#

Is there any chance of Player.getLocation().getWorld() returning null? IntelliJ says it may produce NullPointerException but i'm guessing that would only happen if, for example, I were to do something like (new Location(null, 0, 0, 0)).getWorld(). Is this correct?

flint coyote
#

All IntelliJ does is listen to the @Nullable annotation

hallow jackal
#

Awesome, thank you!

wet breach
#

as well as if there is any issues you can update it at will

#

not all plugins are open source either

echo basalt
#

There are some plugins that are huge lifesavers but there is also a lot of filth that needs a proper rewrite

#

There's no need to reinvent the wheel but you should always engineer your own solutions if the current ones available are below your standards

wet breach
#

because I run custom plugins, its not like I have a million of them and usually end up having overall less plugins needing to be loaded

#

and they work together more seamlessly instead of some cobbled together system XD

wet breach
#

I don't use anything where I have to wait for some outside entity to fix and then even if I could fix it, it creates issues when it comes time they decide to update

#

since the solution is a fork of those that are open source I may as well just make my own

narrow flare
clear panther
#

?paste

undone axleBOT
clear panther
remote swallow
#

ur fine to ignore those warnings

quaint mantle
#

only way to get value from mysql with java is sql codes ?
is there any other way?

onyx fjord
#

huh

#

you mean sql statements?

quaint mantle
#

i mean

remote swallow
#

you want to get sql out of mysql, without sql

quaint mantle
#

i tried to use mongodb

#

and mongodb has custom api

remote swallow
#

correct

quaint mantle
#

so i can do that

onyx fjord
#

oh you want something like that for sql?

quaint mantle
#

db.getvaule("money")

onyx fjord
#

thats called an ORM

quaint mantle
#

but mysql works only sql codes

onyx fjord
#

google java ORM

quaint mantle
#

i mean i create custom objects at mysql

onyx fjord
#

its a type of library that makes working with SQL easier in object oriented languages

quaint mantle
#

but depends mysql ?

#

idk

#

wait

#

i will explain this

#

brb

onyx fjord
#

hibernate is widely used and ive seen people use ormlite

undone spindle
#

when i try building or installing i get this error

remote swallow
#

do you compile with utf8

mortal hare
charred blaze
#

java.util.ConcurrentModificationException: null

undone spindle
remote swallow
#

ur missing a bracket

quaint mantle
remote swallow
#

( n t(() -> {}))

quaint mantle
charred blaze
#

[13:48:44] [Friends Pool Thread #186/ERROR]: Task BungeeTask(sched=net.md_5.bungee.scheduler.BungeeScheduler@5c92166b, id=9988, owner=net.multylands.friends.Friends@3725471, task=net.multylands.friends.events.JoinListener$$Lambda$1251/0x0000000801707438@53f7440e, delay=0, period=0, running=true) encountered an exception
java.util.ConcurrentModificationException: null

mortal hare
timid hedge
mortal hare
#

or you're running code in multiple threads which is not threadsafe

charred blaze
remote swallow
#

thats what you need

#

you have 1 missing

charred blaze
#

ProxyServer.getInstance().getScheduler().runAsync(plugin, task);

#

like this

undone spindle
mortal hare
#

what's inside of that task?

#

give us some code

charred blaze
remote swallow
charred blaze
#

it fails on plugin.saveConfigIntoData();

#

which is method i screenshoted above

mortal hare
#

i believe underlying implementation of snakeyaml that bukkit configuration api uses is not threadsafe

#

afaik

undone axleBOT
charred blaze
#

so just i cant use asnyc?

undone spindle
#

hey i was wondering if someone could help me with what this error is.

charred blaze
#

uh ok

mortal hare
#

im not sure if it would work but try wrapping plugin.saveConfigIntoData() inside

synchronized {}
``` block
charred blaze
#

hm

#

ill try to

#

but

#

i dont have many opportunities to test the code

#

is there anyone who can confirm that will work

remote swallow
#

?paste the method

undone axleBOT
charred blaze
#

maybe errors were printed when attack was ongoing

mortal hare
#

i would say dont touch the async part if you dont know what youre doing

charred blaze
#

and that caused some thread things

mortal hare
#

it would lead to fatal corruption

#

of the data

#

if you dont handle it properly

charred blaze
#

ok ill not use async

#

i dont think its necessary when saving config

remote swallow
#

just the method

icy beacon
#

?jd-b for me

#

what is it

remote swallow
#

?jd-bcc

remote swallow
#

?jd-bc

icy beacon
#

ty

eternal oxide
#

?jd-bc

mortal hare
#

do you call save() method inside main thread?

fathom basalt
#

I am implementing a plugin that wants to use the API of the EssentialsX plugin but not fail if EssentialsX is missing. At the moment I'm getting a NoClassDefFoundError because the Essentials class is not on the classpath. Are there examples of how this can be done gracefully?

mortal hare
#

or just in this runnable?

charred blaze
remote swallow
mortal hare
#

do you call saveDataInConfig() outside of the runnable?

grim ice
eternal oxide
#

^ will prevent yrou plugin loading if no Essentials

charred blaze
#

in the same event listener? no

mortal hare
#

anywhere

#

not in the listener also

charred blaze
#

yeah i use it in some command classes

remote swallow
#
    private void activitySwitcher() {
        (new Thread(() -> {
            scheduler.scheduleWithFixedDelay(new Runnable() {
                int previousIndex = 0;

                @Override
                public void run() {
                    Random random = new Random();
                    int index = 0;

                    while ((index = random.nextInt(activities.length - 1)) == previousIndex) {
                        System.out.println(index);
                    }

                    shardManager.setActivity(activities[index]);
                    previousIndex = index;
                }
            }, 0, 10, TimeUnit.SECONDS);
        }.start()
        );
    }
mortal hare
#

wtf

charred blaze
#

is it problem?

mortal hare
#

it should throw ConcurrentModification exception

#

probably

charred blaze
#

and if it does then what

mortal hare
#

you know where's the problem

charred blaze
#

and?

#

how can we fix it

#

i mean

#

error is already there

#

in logs

mortal hare
#

the runnable that you're calling is on the separate thread from the main thread, and if you're using the same configuration object inside the main thread and the separate thread you need to synchronize the method you need do synchronization

#

try adding the synchronized keyword on saveConfigIntoData()

charred blaze
#

uhhh

mortal hare
#

public void synchronized saveConfigIntoData()

charred blaze
#

this is getting very far

#

ah

remote swallow
#

it worked for me

mortal hare
#

that way if you calling this method from separate thread, another thread will wait till it executes

icy beacon
#

i think context is lacking

charred blaze
#

can i just remove async from the code? i dont think saving config will impact that much server's performance

icy beacon
#

maybe you missed a bracket before or after this function

remote swallow
#

oh i did miss one ```java
private void activitySwitcher() {
(new Thread(() -> {
scheduler.scheduleWithFixedDelay(new Runnable() {
int previousIndex = 0;

            @Override
            public void run() {
                Random random = new Random();
                int index = 0;

                while ((index = random.nextInt(activities.length - 1)) == previousIndex) {
                    System.out.println(index);
                }

                shardManager.setActivity(activities[index]);
                previousIndex = index;
            }
        }, 0, 10, TimeUnit.SECONDS);
    }.start()
    ));
}
mortal hare
#

you can, but if you have hard drive with big latency or you're saving lots of data, it could take a hit

#

usually hard drives are kinda slow to save data

#

so you can have some spikes

#

but it depends actually

undone spindle
charred blaze
#

error was literally spamming btw

#

alots of time

mortal hare
#

try adding synchronized as i already said

#

or remove async

charred blaze
#

ok.

mortal hare
#

from runnable

charred blaze
#

so like this?

mortal hare
#

yes

charred blaze
#

ok thanks

mortal hare
#

try it and see if that solves it

charred blaze
#

will try it tomorrow. cant restart rn

mortal hare
#

im not really good at multihreading stuff but im quite sure i know what's going on but without much of a code i cant do much so

#

if error persists you can contact me

#

tomorrow

#

but its really not safe to keep this running

#

on the server

charred blaze
mortal hare
#

trust me, you can ruin your data

mortal hare
#

data race happens and boom, concurrent modification exception

remote swallow
#

thats something ur end then

mortal hare
#

because two threads try to modify something they couldnt do at the same time

charred blaze
remote swallow
#

why are you even creating a thread just to do stuff in a runnable in the first palce

#

place

tender shard
#

Show your code

undone axleBOT
tender shard
#

Why are you creating a runnable in a thread lol

mortal hare
charred blaze
#

its just friends plugin data

#

i dont care much about it

mortal hare
#

good to know

charred blaze
#

thanks for trying to help ❤️

mortal hare
#

i suggest saving things on the database tbh

#

that way multiple platforms can access your data (web forums can read your game data, etc)

remote swallow
#

?learnjava! moment

undone axleBOT
modest bolt
#

I want to create a listener in response to an event, then handle said event

#

so for example a player hits another player

#

that triggers an onDamage event, then the main listener creates more listeners to apply the effects

#

I want to somehow run the onDamage handler for the secondary listeners

#

how can I do that?

chrome beacon
#

Sounds like you want one listener that does a couple of method calls

modest bolt
#

well yeah, but I don't want to write an interface

#

as the result would look very similar to the Listener interface that already exists

eternal night
#

you 100% do not want to dynamically register new listerns during the runtime

eternal night
#

the server has to rebake the entire handlerlist when you register a listener which, doing that every time a onDamage happens is pretty not smart

modest bolt
#

i see

#

so how can I call the onDamage event of this secondary listener

#

for context im trying to implement custom enchantments

#

and on a damage event, ill parse out the item lore of the sword

remote swallow
#

have an interface or an abstract class with a handle method that takes the event as aparam

icy beacon
#

bungeecord question: is there any way to get the player's uuid in PreLoginEvent? according to the docs, This will NOT contain many attributes relating to the player which are filled in after authentication with Mojang's servers. Examples of attributes which are not available include their UUID.. or can I use another event, that has the player's uuid, to prevent the player from joining?

modest bolt
#

then instantiate the corresponding custom enchantments and run their onDamage events

#

but ofc it doesn't have to be ondamage

modest bolt
hazy parrot
chrome beacon
#

Login Event is cancellable

hazy parrot
#

Cool then, just cancel it

icy beacon
#

are you sure that it's just cancelling? for example, in bukkit for AsyncPlayerPreLoginEvent you can do Event#disallow

#

and also there does not seem to be an uuid in LoginEvent

narrow flare
#

I have a question about hypixel the box is a customHead on an armorstand?
I made a custom head on an armorstand and it is smaller than the hypixel custom head why?

icy beacon
#

that was my initial thought too, but there's also PendingConnection in PreLoginEvent, which does not supply an UUID, which means that PendingConnection's UUID is something else

#

am i wrong?

#

i just started with bungee lol

chrome beacon
#

The connection uuid can be empty

icy beacon
#

ohh, that makes sense

#

alright, thanks!

eternal oxide
#

You can get the UUID from the connection in Bungee LoginEvent.
You register an intent in the LoginEvent, get all your processing doen, including db access, then set the cancel state and reason (if banned) then completeIntent

neon elk
#

I stucked when I was running BuildTools (#160) I want to get JAR file for 1.8.8 Spigot, I used jdk1.8.0_271. Everything is ok at first, it extracts, decompiles but when it is starting to patch, I'm getting this error. I tried to handle that but i can't find a solution about that. I want to solve it. These are outputs

Git version which i used: 2.41.0

icy beacon
#

an intent?

neon elk
#
Applying CraftBukkit Patches
Patching BiomeTheEndDecorator.java
Patching Block.java
Exception in thread "main" java.lang.RuntimeException: Error patching Block.java
        at org.spigotmc.builder.Builder.lambda$main$2(Builder.java:676)
        at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184)
        at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175)
        at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
        at java.util.Iterator.forEachRemaining(Iterator.java:116)
        at java.util.Spliterators$IteratorSpliterator.forEachRemaining(Spliterators.java:1801)
        at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:482)
        at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:472)
        at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
        at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
        at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
        at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418)
        at org.spigotmc.builder.Builder.main(Builder.java:627)
        at org.spigotmc.builder.Bootstrap.main(Bootstrap.java:27)
Caused by: difflib.PatchFailedException: Incorrect Chunk: the chunk content doesn't match the target
        at difflib.Chunk.verify(Chunk.java:86)
        at difflib.ChangeDelta.verify(ChangeDelta.java:78)
        at difflib.ChangeDelta.applyTo(ChangeDelta.java:44)
        at difflib.Patch.applyTo(Patch.java:43)
        at difflib.DiffUtils.patch(DiffUtils.java:70)
        at org.spigotmc.builder.Builder.lambda$main$2(Builder.java:664)
        ... 13 more
narrow flare
icy beacon
#

so in between registration and completion i can get the uuid from pendingconnection?

eternal oxide
#

if you don't need to do any db access you don;t need to register an intent

icy beacon
#

i do

eternal oxide
#

intent is to make it wait

icy beacon
#

alright, cool

eternal oxide
#

then register an intent and pass the event off to whatever code you need to run

mental moon
#

Is there a way to force trigger a PlayerItemConsumeEvent to make them eat an item instantly?
I'm trying to do this without NMS and without making a giant map of materialtypes and hunger restore.
I tried new PlayerItemConsumeEvent(player, itemstack, EquipmentSlot.HAND)
and it doesn't seem to do anything.

icy beacon
#
event.registerIntent(plugin)

// :snip:

event.completeIntent(plugin)

correct?

eternal oxide
#

The Event will not continue until all intents are completed

icy beacon
#

ok maybe i'm a bit confused, how exactly do i execute my code after registering an intent then?

eternal oxide
#

you can do it in the event, or pass the event off to a future

eternal oxide
#

so long as you tidy up when your code finishes or your future returns

#

yes

remote swallow
icy beacon
#

alright then, thx! i'll wrap it into a future

eternal oxide
#

its already async so you probably don;t need to use a future

neon elk
remote swallow
#

yeah, its a bug for 1.8

neon elk
#

how that can be unsolveable

modest bolt
#

is there a way to run something every tick?

abstract sorrel
chrome beacon
undone axleBOT
remote swallow
neon elk
remote swallow
remote swallow
#

i didnt write buildtools

neon elk
#

because when i used wsl it worked for once

neon elk
kind hatch
neon elk
#

or 7

kind hatch
neon elk
#

from openjdk

#

but wait ill take a look again

remote swallow
#

java 8 202 worked for me a while ago

abstract sorrel
neon elk
remote swallow
#

2.37.0.windows.1

abstract sorrel
neon elk
#

im not thinking caused bc of that

#

but it worked on wsl for once

#

that means

eternal night
#

have you even shared the error

quaint mantle
eternal night
#

I wonder if you got some fucked git config playing around

#

tho eh

#

just use WSL kekw

neon elk
inner mulch
#

?paste

undone axleBOT
inner mulch
#

?picture

remote swallow
#

?img

undone axleBOT