#help-development

1 messages · Page 1182 of 1

remote swallow
#

or, we provide no support pre 1.18

#

bosh

blazing ocean
#

well it works fine on 1.21.3

blazing ocean
remote swallow
blazing ocean
#

like the patcher does it

#

try deleting the working dir

remote swallow
#

already done

#

now it works after deleting libraries

blazing ocean
#

i wanna PR to the java stdlib

#

ZipFile has close but doesn't implement Closeable smh

#

wait it does

#

what

lilac dagger
#

gzip is pretty cool

remote swallow
#

@blazing ocean figure out how i can add all the libraries and spigot to my run config classpath

#

thanks

blazing ocean
#

your run config classpath?

#

do you mean an IJ run config

#

that's just in the XML

remote swallow
remote swallow
blazing ocean
#

what is

remote swallow
#

well what ur seeing with no stdout

blazing ocean
#

okay

remote swallow
#

its going to log not console

#

that part ive just realised

blazing ocean
remote swallow
#

dam

#

no ty

blazing ocean
remote swallow
#

so yeah it has to be something here

blazing ocean
#

yea

remote swallow
#

im gonna say, we dont have spigots log4j2 config

#

idk what mojanks is

#

left is mc, rfight is spigot

blazing ocean
#

well it appends to stdout no?

#

apparently at least

remote swallow
#

okay so log4j2 isnt causing it

#

it has to be the dedicated server stuff

#

hold on i need to take my plate down and illt ake a better look

tepid crater
#

Hi guys, with the new 1.20+ attribute on items "item_name", how can i access this attribute via the api?

torn shuttle
#

... biome instance

#

what is a biome instance

#

new stuff?

#

is there finally an api way to check for custom biomes?

#

and actually tell them apart?

tepid crater
river oracle
#

Registry.BIOME

inner mulch
#

Arent value based hash implementations bad because once the objects values change, a hashmap doesnt point to its value anymore?

torn shuttle
#

can I check what name a custom biome has according to a plugin author

#

like if I make a biome and call it skibidi can another plugin detect the skibidi biome in the world via api?

young knoll
#

Nope

#

They are still an enum afaik

torn shuttle
#

they are not enums

young knoll
#

Oh wait no they are an interface now

sullen marlin
#

getKey()

young knoll
#

Then yeah maybe

torn shuttle
#

so the key can be arbitrary?

young knoll
#

Yes

torn shuttle
#

finally I can make the skibidi biome we've all been waiting for

#

that's great news then

young knoll
#

I must have missed them being moved out of an enum

#

Pog

torn shuttle
#

yeah it got most of my plugins to error so it was hard for me to miss

young knoll
#

How did they error

torn shuttle
#

I was initializing biome enums from config

#

they're not enums anymore

sullen marlin
#

Should still work unless you're doing something with reflection or something

torn shuttle
#

I was in fact doing exactly that

#

in a truly convoluted way too

#

it's called cursemaxxing

#

just trying to maximize weird bugs due to weird setups and trying to 100% every maven bug known to man

young knoll
#

Ah

#

I always just used namespaced keys

torn shuttle
#

hm so hang on if I am getting it from registry

#

I still need the appropriate key

young knoll
#

Yes

torn shuttle
#

defaults are keyed to...?

#

like the mc ones

young knoll
#

Idk whatever their key is

torn shuttle
#

for the namespace

young knoll
#

Minecraft

sly topaz
torn shuttle
#

ok so that's annoying

#

hmmmmmm

#

damn it

#

I need a custom format don't i

#

like minecraft:taiga

#

and coolplugin:skibidi

young knoll
#

What about it?

sly topaz
#

are custom ones like from datapack or plugins also in the minecraft namespace or their own?

young knoll
#

Their own

torn shuttle
#

well if I want it to be able to detect the biome correctly I still need to provide the right key in the namespace

#

and I can only do that if it is provided

sly topaz
#

the default one does because that's the only way to ensure different instances have different hashes, but you don't want that for the most part

inner mulch
#

ok

sly topaz
#

a hash code should be a representation of the object in question, that is the sum of its field + some arbitrary prime numbers for uniqueness sake

young knoll
#

This is why mutable objects don’t make the best map keys

unique shuttle
#

Is there a way to remove achievement messages from the chat for a specific player? For example, if I'm in vanish, I don't want my achievements to show up in the chat, like when I grab some armor from creative mode or similar scenarios

kindred sentinel
#

And it's impossible remove vanilla recipes without nms?

worldly ingot
#

Correct

#

Well you would be forced to use reflection anyways because those lists are private with no getters

kindred sentinel
#

Isn't it easier do with event?

strange barn
#

Hello, I have a small problem that I have had for days and I have not been able to, I have created a plugin that records your characteristics such as deaths, murders, your uuid, among other things, and everything is fine, when you enter it creates the row for each player, the problem is when updating the statistics, when you die it has to increase the deaths variable, but it does not, in the database it will always be 0

young knoll
#

?nocode

undone axleBOT
#

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

sly topaz
#

who comes up with these commands, they're actually quite useful

river oracle
#

Random helpers / mods usually

#

Conclure added a ton

strange barn
#
public static void savePlayer(Connection con, PlayerModel model) {
        try {
            PreparedStatement statement = con.prepareStatement("INSERT INTO player (uuid,name,deaths) VALUE (?,?,?)");
            statement.setString(1, model.getUuid().toString());
            statement.setString(2, model.getName());
            statement.setInt(3, model.getDeaths());
            statement.executeUpdate();    
        } catch (Exception e) {
            // TODO: handle exception
        }
    }```
#
public static PlayerModel getPlayerData(Connection con, UUID uuid){
         try {
                String query = "SELECT * FROM player WHERE uuid = ?";
                PreparedStatement statement = con.prepareStatement(query);
                statement.setString(1, uuid.toString());
                ResultSet resultSet = statement.executeQuery();

                if (resultSet.next()) {
                    
                    String name = resultSet.getString("name");
                  //  int deaths = resultSet.getInt("deaths");
//                    int asesinatos = resultSet.getInt("asesinatos");
                    
                        
                    return new PlayerModel(uuid, name);
                }
            } catch (SQLException e) {
                e.printStackTrace();
            }
            return null; // Si no encuentra los datos, retorna null
    } ```
#

I have a model class which is where the variable increases

#
public class PlayerModel {
    
    
    private UUID uuid;
    
    private String name;
    
    private int deaths;
    
    public PlayerModel(UUID uuid, String name) {
        this.uuid = uuid;
        this.name = name;
        this.deaths = 0;
    }

    public void incremeant() {
        this.deaths++;
    }
    
}```
#
public void onJoin(PlayerJoinEvent event) {
        Player player = event.getPlayer();
        
        PlayerModel playerData = SQLData.getPlayerData(plugin.getConnection(), player.getUniqueId());
        
        if(playerData == null) {
            playerData = new PlayerModel(player.getUniqueId(), player.getName());
            SQLData.savePlayer(plugin.getConnection(), playerData);
        } ```
#

When the player enters, his attributes are saved.

#

and when he dies the variable of deaths increases, but in one way it doesn't

#
        Player player = event.getEntity();
        
        PlayerModel playerData = SQLData.getPlayerData(plugin.getConnection(), player.getUniqueId());
        
        if(playerData != null) {
            playerData.incremeant();
            player.sendMessage("las muertes han subido");
            SQLData.savePlayer(plugin.getConnection(), playerData); ```
sly topaz
#

?codeblock

undone axleBOT
#

You can use the discord code block format to display code or just text in a more pleasing way:
```java
public class MyPlugin extends JavaPlugin {
@Override
public void onEnable() {

}

}```
Becomes:

public class MyPlugin extends JavaPlugin {
    @Override
    public void onEnable() {

    }
}```
young knoll
#

Oof ow my main thread database interaction

strange barn
#

I'm sorry I didn't know that

sly topaz
#

I was about to comment, yeah

strange barn
#

Does anyone have any idea why my deaths variable isn't increasing?

young knoll
#

You’re using an insert statement to save the data

#

Which is probably creating a new row or throwing an exception because of a duplicate key

#

Use an update statement or the ON DUPLICATE KEY function

#

Also do your database interactions async

sly topaz
#
  1. DON'T do sql queries in the main thread as Coll said
  2. Use a try-with-resources for those prepared statements
young knoll
#

You also may want to close the connection after using it

#

I don’t remember the standard for MySQL since I normally use HikariCP

sly topaz
#

OR REPLACE INTO for sqlite

#

or if you want a "SQL-standard" there's merge into apparently, not sure how is the support for that tho

wet breach
young knoll
#

SQL is always everything but standard

strange barn
#

What do you mean by that queries should not be made in the main thread? sorry for my ignorance

young knoll
#

It’ll cause the thread to stall until it’s conplete

#

Normally you’d use something like a completablefuture

sly topaz
#

and you don't want to stall the main thread, since it handles all the server logic, inclduing loading chunks and among other things

strange barn
#

Could you give me an example of how a query would be made?

#
 import org.bukkit.Bukkit;
import org.bukkit.scheduler.BukkitRunnable;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

public class DatabaseTask extends BukkitRunnable {

    private MySQLConnection mysqlConnection;

    public DatabaseTask(MySQLConnection mysqlConnection) {
        this.mysqlConnection = mysqlConnection;
    }

    @Override
    public void run() {
        Connection connection = null;
        PreparedStatement statement = null;
        ResultSet resultSet = null;

        try {
            // Obtener la conexión
            connection = mysqlConnection.getConnection();
            
            // Crear y ejecutar una consulta
            String query = "SELECT * FROM tabla_ejemplo WHERE columna = ?";
            statement = connection.prepareStatement(query);
            statement.setString(1, "valor"); // Reemplaza con el valor que necesites

            resultSet = statement.executeQuery();

            while (resultSet.next()) {
                // Procesar los resultados de la consulta
                String dato = resultSet.getString("columna");
                Bukkit.getLogger().info("Dato: " + dato);
            }
        } catch (SQLException e) {
            e.printStackTrace();
        } finally {
            try {
                if (resultSet != null) resultSet.close();
                if (statement != null) statement.close();
                if (connection != null && !connection.isClosed()) connection.close();
            } catch (SQLException e) {
                e.printStackTrace();
            }
        }
    }

    public void start() {
        // Ejecuta la tarea en el hilo principal de Spigot
        this.runTaskAsynchronously(YourPlugin.getInstance());
    }
}```
#

would it be something like this, in a task?

sly topaz
#
private CompletableFuture<Void> savePlayerAsync(PlayerModel model) {
    return CompletableFuture.runAsync(() -> {
        try (PreparedStatement statement = databaseConnection.prepareStatement(
            "INSERT INTO player (uuid, name, deaths) VALUES (?, ?, ?) " +
            "ON DUPLICATE KEY UPDATE name = ?, deaths = ?")) {
            
            statement.setString(1, model.getUuid().toString());
            statement.setString(2, model.getName());
            statement.setInt(3, model.getDeaths());
            statement.setString(4, model.getName());
            statement.setInt(5, model.getDeaths());
            
            statement.executeUpdate();
        } catch (SQLException e) {
            throw new CompletionException(e);
        }
    });
}

this is how your savePlayer method would look if done off the main thread

strange barn
#

aaa, so it is not necessary to create a separate class?

sly topaz
#

not necessarily, no

strange barn
#

The same method is executed in another thread

#

thanks bro for taking the time thanks

sly topaz
#

I just made claude generate an example so no worries lol

#

for anything that returns something, you'd use supplyAsync instead of runAsync btw

strange barn
#

Thank you very much bro, seriously

#

oka

young knoll
#

Claude deciding to concat 2 strings for the query is kinda weird

#

But at least it didn’t make up new methods

worldly ingot
#

text blocks PES_SadGePray

slender elbow
#

i'll block your texts

worldly ingot
#
PreparedStatement statement = connection.prepareStatement("""
    INSERT INTO player (uuid, name, deaths) VALUES (?, ?, ?)
    ON DUPLICATE KEY UPDATE
        name = ?,
        deaths = ?
    """);
#

My beloved Kreygasm

sly topaz
#

and then to actually use the result, you'd use:

// put this somewhere in your plugin
public static final Executor MAIN_THREAD_EXECUTOR = task -> 
        Bukkit.getScheduler().runTask(YourPlugin.instance(), task);

savePlayerAsync(playerModel)
    whenCompleteAsync((result, exception) -> { // the result is Void in this case so we don't really use it
        if (exception != null) {
            getLogger().severe("Failed to save player: " + exception.getMessage());
        } else {
          getLogger().info("Player data saved successfully: " + playerModel.getName());
        }
    }, MAIN_THREAD_EXECUTOR);

this is how you'd use the result of whatever query you may use

#

in java 23 with previews I could just use _ for that result 😔

slender elbow
#

no preview since 22

young knoll
#

But those aren’t LTS :(

slender elbow
#

and?

young knoll
#

Therefor they are bad

#

Or something

slender elbow
#

that doesn't mean anything until a new version comes out

remote swallow
#

whats next lts

slender elbow
#

and the same case applies to LTS, just, a larger time scale

slender elbow
young knoll
#

25

#

Also doesn’t java 23 break some things for spigot

#

Or is that solved now

worldly ingot
young knoll
#

I mean, basically

sly topaz
young knoll
#

Hmm, to cache everything in memory or not

#

That is the question

sly topaz
#

I do that, it is good 💯

#

just let it OOM™️

young knoll
#

I mean idk how much space ItemStacks take up

#

I guess it depends on how complex they are

worthy yarrow
#

What makes an itemstack complex?

worldly ingot
#

their degree in philosophy

worldly ingot
#

and the fact that item stacks are notorious wine connoisseurs

sly topaz
#

I think the max amount for an item was like 8mb or something

sonic goblet
#

The torn relationship between them and their father

sly topaz
#

or was it 32 uncompressed? I don't remember

young knoll
#

Oh god

sly topaz
#

but that's the max, for like a shulker box full of written book stacks with a bunch of shit on them

young knoll
#

I don’t expect to have any chests full of chests full of chests full of chests

sly topaz
#

I calculated it once, but it is on the paper discord and I am not there anymore lmao

young knoll
#

It’s for dungeon loot, so I expect some fancy weapons at most

sly topaz
#

the average item stack is no more than 32kb so don't worry too much about it

#

32kb is already huge for a single item stack

remote swallow
#

i love book banning people

young knoll
#

Alternatively I could just load them as needed

#

But then I need to deal with a database :(

sly topaz
#

I'd just dump them in memory honestly

young knoll
#

Need to decide the same for mobs

#

Not gonna load all the room schematics into memory, I’ll grab those as needed

sly topaz
#

depends on how big the schems are

#

they can't be more than a few mb

#

well, ig uncompressed they do take a bit of mem

young knoll
#

Main issue is any tile entities

#

They could potentially have a bunch of extra data

sly topaz
# drowsy helm u guys dont use ORMs?

ORMs are annoying with plugin dev, you got to do the set classloader thingy and if you don't know SQL, it is better to use it raw to actually learn what goes behind

drowsy helm
#

It isn't that hard to setup

sly topaz
#

it is just annoying, and for something as simple as this, I'd just go for raw sql queries anyway

#

for something mildly complex I'd consider it more

barren peak
#

quick question
for enchanted books, are their enchantments not stored like item enchantments (EX: sword)? if not how are they stored

young knoll
#

EnchantmentStorageMeta

barren peak
#

ok thanks

worldly ingot
#

It's a different component because people figured out you could use them as items enchanted with that enchantment lol

#

e.g. a Sharpness V book would have Sharpness V

young knoll
#

No more free grass :(

barren peak
#

is there an easy way to check if an enchant type goes on an
item?
EX: if its a pickaxe then Efficiency would return true and unbreaking would return true but Sharpness would return false.

worldly ingot
#

Enchantment#canEnchantItem(ItemStack)

barren peak
barren peak
#

onProjectileLaunch event when you throw an egg, how can you get the item since it could be thrown from the offhand or mainhand

slender elbow
#

that's the cool part, you don't, unless you add a manual check, but that isn't really guaranteed to yield proper results

barren peak
#

so its just not possible?

slender elbow
#

not reliably

#

(on spigot anyways) runs

young knoll
#

👀

#

Has anyone seen an Emily around here

#

You see I have this hammer…

barren peak
# slender elbow not *reliably*

since you can only launch projectile from offhand if there is not a projectile in mainhand could you possibly use that to check?

young knoll
#

Yeah

#

Should be mostly reliable?

barren peak
#

is there a way of checking if an item is a projectile?

slender elbow
#

pretty sure there's an edge case where if you're using the last projectile the used hand will be empty in the event

young knoll
#

Ah I figured it was before that since the event is cancellable

#

Womp womp

slender elbow
#

i might be wrong

barren peak
slender elbow
#

let me check

#

on my totally unmodified spigot source, not spigot fork, i would never

barren peak
#

bc I can throw last projectile and it still says item in hand

young knoll
#

I’ll uhh

#

Hit you with the Ban Fork™️

slender elbow
#

no you wouldn't

#

because i would not fork spigot

young knoll
#

Ah yes only spoon

barren peak
#

ok so is there a way to check if an item is a projectile just from itemstack?

slender elbow
#

this code is a mess

young knoll
#

I think you can just hardcode some materials

#

Not ideal but I don’t think there’s a tag for it or anything

barren peak
young knoll
#

I mean what is throwable

#

Egg snowball splash potion trident

#

Uhh

barren peak
#

charge, arrow

young knoll
#

Wind charge, lingering potion

#

Arrows have a better event

slender elbow
#

okay so it seems that the item is not yet consumed in that event

#

or, i guess it depends on the item

#

for eggs at least

barren peak
#

eggs seem to work so its working for me

young knoll
#

Wonder how hard it would be to pass the item to the event

slender elbow
#

eggs, snowballs and ender pearls seem to bne available

#

i cba to check every item zzz

kind hatch
#

What about exp bottles?

slender elbow
#

zzzzzz

#

too

barren peak
#

do fishing rods count

young knoll
#

There’s a separate event for that too

barren peak
#

yeah but won't it trigger both events?

young knoll
#

Idk

#

I don’t know if the game considers you “launching” the bobber

barren peak
#

wait new idea: can I just replace the projectilelaunchevent with a playerinteractevent?

#

i guess it would fire at the start of the launch even if you cancelled it for things like tridents & bows. but for eggs it should work right?

young knoll
#

Yes

#

But it won’t give you access to the projectile

barren peak
#

yeah I just thought of that\

#

😦

#

petition for spigot to add a .getItem() to projectilelaunchevent

kind hatch
#

I wonder if that could even be done

sly topaz
#

ah you already thought of that

#

you'd have to save the item in interact within a map or something and check for it in launch event

#

kinda annoying but it is what it is

young knoll
#

Ideally we could expose the shooter, item, and hand to the event

#

But I’m not familiar with what the internal code looks like in this case

kind hatch
#

I am looking at it currently and it does not look like you would expect it to.

#

CraftEventFactory is quite the class

sly topaz
#

can't you just cast it to ThrowableProjectile and getItem on it

young knoll
#

We love CraftEventFactory

young knoll
#

But I could be wrong

sly topaz
#

it stores the item

#

not sure if it is linked to the item in the inventory at all or it is a clone, but it does give you an ItemStack instance

young knoll
#

Exactly

wet breach
sly topaz
#

wouldn't it be air in that case

sly topaz
#

I guess giving you the hand is good enough

slender elbow
#

in the few cases I checked the event is fired before the item is consumed

summer scroll
slender elbow
#

that's more for stuff like bows and crossbows iirc

#

not snowballs and such

sly topaz
#

EntityShootBowEvent, yeah

slender elbow
#

does that expose the arrow item used?

summer scroll
#

Yes iirc

sly topaz
#

yeah it has getConsumable

wet breach
slender elbow
#

i mean, it will spawn the entity after the event is called

#

so if you alter the itemstack it'll use the altered one

#

(which sounds stinky)

#

or

#

err

#

no

#

the entity is already spawned

#

the whole thing stinks

wet breach
#

Lol

young knoll
#

Could just expose a read only copy of the item

wet breach
young knoll
#

How does the bow event handle things

#

Afaik it exposes the arrow item even though the arrow entity is already spawned

sly topaz
#

if it is a read only copy then there's no difference between that and ThrowableProjectile#getItem no?

young knoll
#

Depends if that actually contains the data of the held item

summer scroll
#

Could we just check ProjectileLaunchEvent get the shooter get item in main hand?

wet breach
young knoll
#

Or if it’s just a basic copy of the held item

summer scroll
#

Or that

young knoll
#

You can throw from both

#

Iirc the offhand takes priority? Idk

slender elbow
#

yea

#

no

#

main hand is checked first

summer scroll
#

To get the data you know and then apply pdc to the projectile

young knoll
#

Okay then main hand first

#

Do you only throw one if both hands are holding a throwable item

summer scroll
#

Yes I think

wet breach
#

Reason the bow returns an itemstack is because the arrow is in the inventory when you fire a bow.

summer scroll
#

Main hand first

young knoll
#

Well then assuming the event is always called before the item is removed that should be reliable

#

A little awkward but it works

wet breach
#

So you fire the bow, projectile is spawned then arrow removed

young knoll
#

This is about directly throwable items

worthy yarrow
#

dawg

young knoll
#

But it appears they also function that way, so exposing the item should behave the same as the bow event

worthy yarrow
#

wait

wet breach
#

I know, just explaining how its different for bows lol.

#

With throwables the code is swapped for when item is removed and entity spawned. If i recall

worthy yarrow
#

Is there some sort of bow.getCharge() that returns a vector object perhaps?

wet breach
#

I could be wrong been a while since i have looked at it in depth

worthy yarrow
wet breach
#

But it gives a float

worthy yarrow
#

I can work with that

wet breach
#

0-1 I believe is the range for that float

worthy yarrow
#

how did I never think of the bow charge mechanic for ndg throwing mechanics

#

I must be dumb 😦

wet breach
sly topaz
#

getItem returns a copy with count 1, shame

young knoll
#

A copy with no meta data?

#

Or a full copy

sly topaz
#

full copy

#

just count defaulted to 1

young knoll
#

Ah

#

Well that’s convenient

#

No need to check the hand or anything

sly topaz
#

projetile launch is an entity spawn event so I don't know how you would pass down the actual item all the way down from ItemEgg#use and the like tbh

minor otter
#

Do skyblock servers generate a world for every players island? Or are they in the same world but separated by distance? Like hypixel skyblock

summer scroll
#

Hypixel might be different server for each island

young knoll
#

They have a few worlds per server usually

sly topaz
#

ig you could containerize the hell out of an instance, but then you run into noisy neighbor issues and it is eh

wet breach
#

And given its just a single region file the most amount of space that world could in theory take up is no more then a few hundred megs as well

#

Well the theoretical maximum is like 1tb but i doubt any player will manage to occupy 1024 chunks and fill it completely

sly topaz
glossy laurel
#

Hold up, does that mean languages are like APIs and compilers are implementations?

lilac dagger
#

not quite

#

language are human readable tokens

#

while a compiler converts it into machine readable code

#

a human has trouble understanding that 010 000 means i want to move to the position in the next 3 bits

#

and that is position 0

#

but a computer just knows this

#

a human has an easier time with goto first; to see what it means

toxic ledge
#

Is there a way to check if a player has Allow Server Listings enabled?

smoky anchor
#

Try checking the docs yourself first for next time

#

?jd

undone axleBOT
toxic ledge
#

F me. I somwhow only looked for all posisble way this could be named in the docs. then figured out the settings name and did not try searching that. my bad

smoky anchor
#

all good

sly topaz
sage patio
#

hey, i've a PublicBukkitValues while serializing an itemstack, any idea why?

eternal night
#

thats the PDC

sage patio
#

i don't use any, this is a compass i just pick from creative inventory

#

is it normal?

eternal night
#

well "gcore" seems to use it

sage patio
#

GCore is my "Library" plugin

#

stores Kotlin and some extra stuff

#

doesn't do anything at all, it doesn't even have an onEnable

eternal night
#

I mean, something is setting that PDC value

sage patio
#

hmm

eternal night
#

i mean, just search for the if-uuid string

#

if both are your plugins

sage patio
#

they are

#

lemme search

#

only 1 found which it's the file it self

eternal night
#

I guess check the Gcore too then?

sage patio
sage patio
eternal night
#

hm

sage patio
#

should i search packetevents too?

eternal night
#

I'd be surprised if packet events randomly uses your plugins namespace to set a pdc value

sage patio
smoky anchor
#

Maybe some dependency does some sus stuff ?

sage patio
#

lemme check

#

on every item? why

ivory sleet
#

identification prob

smoky anchor
#

oh my hunch was correct, it is IF :D

eternal night
#

I guess it makes sense for if to use your namespace?

#

bit weird

sage patio
#

i'm gonna ask on their support channel

young knoll
#

Kinda weird it needs to use it at all

eternal night
#

Yea sounds a bit weird that all items get that

hushed spindle
#

while holding the compass you're saving

#

or when you get it back

sage patio
hushed spindle
#

yup, weird

#

seems excessive

#

anyway, apparently BlockDispenseLootEvent doesn't actually know about the loot table the block is spitting out. is there a way to get the loot table actively dispensed from a vault block?

#

vaults dispense multiple drops which can variate in loot table, but there doesnt seem to be an event that actually associates each drop with their respective loot table

smoky anchor
#

The loot table is stored in the block. Can you not get the block and then the loot table ?
I might be misunderstanding you.

hushed spindle
#

its not stored in the block because vaults/trial spawners can spawn from several loot tables

#

they spawn a couple drops from the "common" loot table and then maybe some extra drops from "rare" and "unique"

#

so theres not 1 loot table

young knoll
#

Is it stored in the vault

hushed spindle
#

the vault block data does not have a loot table

#

or was that changed in 1.21.3 specifically

young knoll
#

It’s in the tile entity

hushed spindle
#

its not in the tilestate either

young knoll
#

It seems we don’t expose it in the api

#

Guess that’s a PR to be made

hushed spindle
#

dicks

#

nms it is then

echo basalt
sage patio
#

it is some sort of library

#

containing Kotlin, JetBrains Exposed, IF and ...

sly topaz
#

no wonder it is 15mb

sage patio
#

xd

#

its better than extra 2mb per plugin for kotlin

echo basalt
#

lib at work is like 30mb

#

and my code alone is like 800kb

sage patio
#

lol

hushed spindle
#

nms is confusing as hell

echo basalt
#

nah

hushed spindle
#

so everything i need can be gotten from VaultConfiguration, makes sense
how to get it? no clue
there's a similar thing for TrialSpawnerConfiguration, makes sense because both blocks have similar functionality
trialspawnerconfiguration can be accessed through the TrialSpawner class, makes sense
theres no Vault class

echo basalt
#

watch me

hushed spindle
#

how'd i miss that i literally looked at it 5 minutes ago

echo basalt
#

Cool you got VaultConfig.DEFAULT and some other stuff on VaultBlockEntity

echo basalt
#

and you can get the block entity from craftbukkit's Vault

#

it's a tile entity basically

sage patio
echo basalt
#

no

#

I like default

sage patio
#

i like this one D:

#

IntelliJ default Dark Theme + SayanTheme color scheme

echo basalt
#

I like using the old color theme

#

also ew manual itembuilder

#

couldn't be me

sage patio
#

what's the "coolest thing" you made in ur opinion?

echo basalt
#

depends on how you define cool

#

for example lately I work a lot with bedrock at work and most networks just use custom player skins with geometry for custom mobs

#

I made a system that through packet manipulation + a lot of fuckery I can have true custom entities for geyser players

#

With properties, custom width and height etc

#

Without forking geyser

#

That's one of the things I'm proud of

sage patio
#

nice

echo basalt
#

the entity component system at work is also clever

sage patio
#

yea that's what i meant

echo basalt
#

We can make entities hold data and stuff

#

Attach "templates" to entities that apply components in case we want persistent components

#

there's a whole ecosystem around entities and it's pretty much all I made for the past 6 months

sage patio
#

cool

quaint mantle
#

Someone here have ever used moshi to parse http requests? I'm having some issues to parse the data

sage patio
echo basalt
#

we use uh

#

that kotlin one

#

sometimes

quaint mantle
echo basalt
#

ktor

quaint mantle
#

If u wanna check it out

sage patio
#

ow

#

i'm using jackson's one

#

lemme find it

smoky anchor
quaint mantle
#

I mean, i'm not using kotlin but I guess I have to be doing something wrong

echo basalt
#

ah yes I love my Function16

smoky anchor
#

Hell yeaah!

#

mhmm curry

errant halo
#

I NEED HELP

smoky anchor
#

First calm down

#

second:

#

I don't know the command actually, I blanked out

#

?help

undone axleBOT
#
CafeBabe Help Menu
*Red V3*
__**Admin:**__

selfrole Add or remove a selfrole from yourself.

__**Cleanup:**__

cleanup Base command for deleting messages.

__**Core:**__

embedset Commands for toggling embeds on or off.
info Shows info about CafeBabe.
licenseinfo Get info about Red's licenses.
mydata Commands which interact with the data CafeBabe has about...
set Commands for changing CafeBabe's settings.
uptime Shows CafeBabe's uptime.

__**Downloader:**__

findcog Find which cog a command comes from.

__**Mod:**__

names Show previous usernames, global display names, and server...
userinfo Show information about a member.

__**ModLog:**__

listcases List cases for the specified member.
reason Specify a reason for a modlog case.

__**Permissions:**__

permissions Command permission management tools.

smoky anchor
#

?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!

smoky anchor
#

There

quaint mantle
glossy laurel
#

Guys how do I use gson or whatever it was called

smoky anchor
#

To do what exactly

worldly ingot
#

Man, what a terrible class and a great justification for variadic templates

glossy laurel
#

Like integers

#

And string

#

And doubles

#

And byte arrays

smoky anchor
#

cool, how many more data types can you name out...

glossy laurel
#

Longs

#

Floats

#

Uuids

#

Thats about it

blazing ocean
#

This is why people hate DFU

smoky anchor
#

I mean, I don't care how it's written, it does its job well
Fairly easy to write the codecs

worldly ingot
#

When Java doesn't have variadic templates, this is what you have to resort to lol

errant halo
#

i hate code

acoustic pendant
#

Hey!

blazing ocean
#

hi

acoustic pendant
#

I'm trying to serialize an itemstack into base64 but i'm getting some errors

#

Let me send them

#
    public static String itemStackToBase64(ItemStack item) throws IllegalStateException {
        try {
            ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
            BukkitObjectOutputStream dataOutput = new BukkitObjectOutputStream(outputStream);

            dataOutput.writeInt(1);

            dataOutput.writeObject(item);

            dataOutput.close();
            return Base64Coder.encodeLines(outputStream.toByteArray());
        } catch (IOException e) {
            throw new IllegalStateException("Unablwe to save item stack.", e);
        }
    }


    public static ItemStack itemStackFromBase64(String data) throws IOException {
        try {
            ByteArrayInputStream inputStream = new ByteArrayInputStream(Base64Coder.decodeLines(data));
            BukkitObjectInputStream dataInput = new BukkitObjectInputStream(inputStream);

            ItemStack item = (ItemStack) dataInput.readObject();

            dataInput.close();
            return item;
        } catch (ClassNotFoundException e) {
            throw new IllegalStateException("Unable to decode class type.", e);
        }
    }```
quaint mantle
acoustic pendant
#

What am I doing wrong?

smoky anchor
#

idk what any of that is, but you're writing a 1
which I don't think the read code likes

blazing ocean
#

?whereami paper even has methods for that btw...

acoustic pendant
worthy yarrow
#

hi @blazing ocean

acoustic pendant
acoustic pendant
#

thanks

worthy yarrow
blazing ocean
blazing ocean
worthy yarrow
#

I was waiting for so long

past vector
#

I have implemented guns, but when doing a quick rotation the tracers get spawned at an offset previous rotation. Does spigot smooth out the player rotation?

blazing ocean
#

I was doing the hard work of searching up something in the javadocs for them

worthy yarrow
#

That is hard work

#

It's ok

#

I forgive you

blazing ocean
#

thanks

acoustic pendant
blazing ocean
#

why do you wanna store an item inside of an items pdc

#

or any other pdc for that matter

#

you can just encode those bytes with b64 btw

acoustic pendant
#

Oh nvm

#

There is a Persistent ByteArray

acoustic pendant
acoustic pendant
acoustic pendant
echo basalt
#

me when he writes an int but doesn't read it

acoustic pendant
#

💀

past vector
#

I have implemented guns, but when doing a quick rotation the tracers get spawned at an offset previous rotation. Does spigot smooth out the player rotation?

worthy yarrow
#

Perhaps playerMoveEvent takes into account rotations in this way?

slender elbow
#

base64 is expanding the byte array to a smaller subset of possible values so it'll be larger

lilac dagger
#

^

#

i don't really like base64 anymore, there's very few reasons i can think of where it would be useful

past vector
errant halo
worthy yarrow
quaint mantle
#

I guess idk

worthy yarrow
quaint mantle
barren peak
#

how do you apply fall damage to a player that has canFly

past vector
#

with ground distance

#

I made it so that it disables flight when falling higher as some float and then re enables flight

#
                // Perform ray tracing to check distance to the ground
                RayTraceResult rayTraceResult = player.getWorld().rayTraceBlocks(
                        player.getLocation(),
                        new Vector(0, -1, 0), // Straight down direction
                        10, // Maximum distance to check
                        FluidCollisionMode.NEVER,
                        true // Ignore passable blocks like grass
                );

                // If ray trace hits the ground, check the distance
                if (rayTraceResult != null && rayTraceResult.getHitBlock() != null) {
                    double distanceToGround = rayTraceResult.getHitPosition().distance(player.getLocation().toVector());

                    // Check if fall speed and distance indicate fall damage
                    if (fallSpeed > 0.15f && distanceToGround <= 5 && distanceToGround >= 3.25f) {```
#

You can remove the fall speed tho and it would work with distanceToGround depending on your needs.

hushed spindle
past vector
#

the smoothing is real

sly topaz
#

you need to use the packet directly if you want to avoid it

past vector
#

ahh

#

I get what you just said. My tests makes now sense

#

Because of the rate-limiting the server indeed uses smoothing. Good to know

past vector
#

I'm currently making a "medkit" which the player can use to spawn a predict redstone block, a marker where to shoot (Similar to a GTA V mission where you need to shoot a jet down). I'm currently using the Velocity and latency to measure this out. Tho it's just multiplied by a factor which is very inaccurate.
To make it accurate i need to understand more of it tho

past vector
tired cedar
#

Hi, does NBT data change from one version to another?

#

Like does it vary from version

eternal oxide
#

sometimes, but rarely

tired cedar
#

Trying to include NBT in resources for a plugin, but I get this in result

#
Malformed NBT file:
Unexpected tag id found: 31.
#

in IntelliJ

chrome beacon
#

What version was the NBT file created for

#

and what are you running on

tired cedar
#

1.15 I think, and trying to get it working on 1.19

chrome beacon
#

What is the file storing?

tired cedar
#

Like a structure to generate

#

I believe

eternal oxide
#

do you have it working in any version?

tired cedar
#

They had it working in 1.15

young knoll
#

I don’t think the NBT format has changed in a long time

#

The contents inside it might no longer be valid, but the file format should still be fine

tired cedar
#

It could be encoded wrong, or maybe Maven doesn't know what to do with it

eternal oxide
#

No format change in Structures that I can remember

chrome beacon
#

Try disabling filtering on the file in your pom

#

if you haven't already

eternal oxide
#

Yeah compression breaks in resources if shaded with filtering

tired cedar
#

I'll try that now, thank you

#

Nah it's doing the exact same thing now sadly

#

It's a 1.15 plugin with NBT resources, made with Apache Ant

#

I've got it running and compiling in 1.21 with Maven (in IntelliJ), works mostly alright

eternal oxide
#

?paste your pom

undone axleBOT
tired cedar
eternal oxide
#

I'd remove the resources plugin

#

not needed

timid berry
#

how can I do stuff with events if the file is not the main file?

chrome beacon
#

src.dir is also not needed

timid berry
#

like autosmelt.java is not the main file

#

only events in the mail file work

#

*main

chrome beacon
#

and shade plugin is outdated (3.6.0 is latest)

tired cedar
#

making changes as you type

chrome beacon
#

also you should relocate the dependencies you shade to prevent conflicts with other plugins

tired cedar
#

I know I know, just trying to nurse an old plugin back to life at the moment

#

then we'll clean it up if it does work

young knoll
#

?eventapi

undone axleBOT
timid berry
#

yes

#

but how do i not do it in my main file?

blazing ocean
#

?di

undone axleBOT
timid berry
#

i know how to work with events

young knoll
#

That wiki page directly shows you how

#

It’s literally the first section

tired cedar
#

thanks for all your help by the way, making the changes and then I'll report back

timid berry
blazing ocean
#

...

tired cedar
#

Make a separate class for your listeners

timid berry
#

oh

#

what

#

there

#

like this?

tired cedar
#

What is it you're trying to do?

timid berry
#

I want it to

#

listen on the block break event

#

and do something

#

on event

#

in the autosmelt java

young knoll
#

You didn’t read the page did you

timid berry
#

no

young knoll
#

Didn’t think so

#

Since it literally has code snippets that could be copy and pasted

timid berry
#

I copied and pasted

tired cedar
#

make a new class MyListener.class or whatever you'd like to call it


public class MyListener implements Listener {
    @EventHandler
    public void onBlockBreak(BlockBreakEvent event) {
      // code here
    }
}

timid berry
#

okay what im trying to do is

#

have like multipe files

#

all listening on block break

tired cedar
#

then in your main class, onEnable, run getServer().getPluginManager().registerEvents(new MyListener(), this);

#

Why not just have one file listen to the block break and run conditional code there

tired cedar
#

(it's something about the way NBT is being included)

timid berry
#

its like an enchanting plugin

#

each enchant has a file

#

and each file checks on block break

#

like in an enchant called autosmelt

#

on block break event, smelt item broken

#

etc

tired cedar
#

Are you trying to run different code depending on the enchantment?

#

so like if I have a specific enchantment on a tool, and break a block, something will happen?

sly topaz
# timid berry

unrelated to your issue but use UpperCamelCase for class names please

tired cedar
#

oh yeah please do that too

blazing ocean
timid berry
#

theres legit no point

#

unless someone

#

decompiles

#

and decides to code review forwhatever reason

#

no performance nor effiency effect

blazing ocean
sly topaz
timid berry
#

how

sly topaz
#

you'll have methods with the same names as classes at some point, and when you go back to that code to make a fix later you'll think to yourself, what the heck was I smoking when I wrote this

blazing ocean
#

and it's literally unreadable

timid berry
#

ill just

#

not mix things up?

blazing ocean
#

especailly for people trying to help you

tired cedar
#

there's no point being a contrarian about this kind of thing

timid berry
#

how are names like

#

applytooleffect

#

unreadable?

blazing ocean
#

all lowercase

#

and not even what that method does

#

that method is an event handler

#

and should not do that itself

tired cedar
#
    @EventHandler
    public void onBlockBreak(BlockBreakEvent event) {
        Player player = event.getPlayer();

        ItemStack itemInUse = player.getItemInUse();
        
        if (itemInUse != null) {
            // here you can use itemInUse.getItemMeta().hasEnchant()
        }

    }
#

Is this what you mean by the way

timid berry
#

yes

#

if it has the enchant

blazing ocean
#

and especially if you wanna be working with other people in the future

sly topaz
#

welp, I'm telling you in the nicest way possible since I know it isn't easy forming those habits in the beginning

blazing ocean
#

you cannot be doing that

timid berry
#

okay

tired cedar
#

I'm no good with how enchantments work with Spigot, but you can figure it out

native nexus
#

Everyone has their own way of doing things but when it comes to Java, you must follow the rules in ways things are written and constructed. This makes it much easier for developers to read your code.

#

You won’t get hired if you do not know how to follow coding conventions, that’s for sure lol

sly topaz
#

but in the end you'll find people that will bully you into oblivion for having bad naming practices or unorthodox formatting overall. It just gets in the way of people actually trying to help you if you go against these practices that are well in-grained in programming for no specific reason

#

hell, even md_5 gets made fun of due to his formatting preferences lol

blazing ocean
#

it's similar to saying that I'll now say dates in md/my/dyyy format

native nexus
#

We are not saying this to put you down btw, we really want you to improve and be the best programmer you can be 🙌

worldly ingot
blazing ocean
#

they are

tired cedar
#

some companies use really weird formatting though, like Valve

#

I think Valve do something weird like also including the type in the actual name

native nexus
tired cedar
#

this is probably C++

#

or C

chrome beacon
native nexus
#

No way it’s C

tired cedar
#

think I saw a screenshot at some point

blazing ocean
#

they mostly use C++ (and rust in proton)

#

wait nvm?

tired cedar
blazing ocean
#

I thought @vagrant stratus said proton used rust smh

native nexus
#

Roff lnfao

sly topaz
#

hungarian notation? It isn't that weird, more useful in loosely typed languges if anything

worldly ingot
blazing ocean
#

I like LSP's C++ formating ngl

tired cedar
#

honestly it would probably help me out a lot, but IDEs do a good job at keeping me sane

chrome beacon
tired cedar
#

I've only ever done one major C/C++ project and it was/is a nightmare

chrome beacon
#

but many older projects still use it

native nexus
#

I remember coding windows api in c, you would have to use a very heavily nested switch statement to change windows 😳

tired cedar
#

Windows API is disgusting

timid berry
#

how can i get the information of the person who broke the block?

native nexus
#

I used the PlayStation 4 api to code in c++

blazing ocean
#

you are using he wrong event

sly topaz
tired cedar
#

event.getPlayer()

blazing ocean
#

my t key is not keying

sly topaz
#

they're good at not breaking user-space part, if anything

tired cedar
#

Microsoft have put a bad taste in my mouth haha I'm an Apple user at heart

sly topaz
#

it just looks disgusting since they preserve backwards compat to extreme points

tired cedar
#

the worst microsoft programming is the custom events for PowerPoint and stuff

#

VisualBasic

native nexus
#

I think both apple and windows are good in their own ways.

blazing ocean
native nexus
#

And bad in their own ways.

timid berry
tired cedar
#

I use my Windows computer for writing my plugins, but my Mac for server and webapp stuff

blazing ocean
#

BlockBreakEvent or BlockPlaceEvent

sly topaz
blazing ocean
#

depending on what you want

tired cedar
#

man I showed you it's BlockBreakEvent

sly topaz
#

BlockEvent is the superclass for all block events

timid berry
timid berry
#

thx

blazing ocean
tired cedar
#

I've never had the pleasure of working with them but hopefully an opportunity will present itself soon

#

need to use the Linux ecosystem more

blazing ocean
#

like you won't get this for free and open source anywhere else

sly topaz
#

that looks disgusting

blazing ocean
#

what does

#

the plugin UI is great

sly topaz
#

that UI

blazing ocean
#

carla's UI sure is

#

but the plugin UI sure isn't

tired cedar
#

all VST UIs will make your head hurt

sly topaz
#

who thought putting a thousand knobs together was a good idea

blazing ocean
#

lol

#

wait till you have to use a thousand knobs

sly topaz
#

I'd have an easier time navigating an airplane

tired cedar
#

mad respect to anyone who can use a DAW day in day out

#

I'd just go insane

blazing ocean
#

Some DAWs are just

#

too much

#

working with any DAW is just ADHD-inducing

tired cedar
#

I'm an Ableton x Logic kind of guy but only because they're the simplest

blazing ocean
#

I have Cubase Elements lmfao

#

I use REAPER and Ardour sometimes when I'm on Linux

#

and Carla as my VST host

tired cedar
#

My dad likes Reaper

#

Idk Cubase for much but some insane vocaloid producers use it for crazy tracks

#

that's all I know

timid berry
#

how can I run the code in my autosmelt file?

blazing ocean
#

?learnjava! at this point

undone axleBOT
sly topaz
blazing ocean
sly topaz
#

I see that there's people who understand me

blazing ocean
#

Like dude I NEED a lot of those knobs

tired cedar
#

Hahaha

sly topaz
#

use a damn slider

blazing ocean
#

I have physical knobs and sliders hooked up to my PC :3

sly topaz
#

well that's more understandable but still

tired cedar
#

@timid berry Why are you using Customenchantattempt2 31 times in the project

tired cedar
#

Change it to CustomEnchantAttempt2

#

It says 31 usages

#

to the right

timid berry
#

yes

#

31 usages

#

because i used it

#

31 times

tired cedar
#

How are you using it?

timid berry
#

oh i should probably use this

#

instead

tired cedar
#

actually don't worry I misinterpreted what counts toward usages sorry

blazing ocean
tired cedar
#

still though, I wouldn't have your JavaPlugin implement the Listener

#

separate it into a new file

wet breach
blazing ocean
#

true 😔

#

I only have a large 105 key one

tired cedar
#

I've got one very embarrassing AKAI LPK25

blazing ocean
#

and probably getting a midi controller soon™

tired cedar
#

which does the trick

wet breach
#

so I have concluded its vital to have 3 of them uwu

blazing ocean
#

what if I use one and change instruments 🤔

wet breach
#

idk, just saying if you want to produce a hit song and become famous that is one of the requirements it seems

timid berry
#

how can i acess e.getblock()
in my autosmelt file?

blazing ocean
#

okay yeah that's just a

#

?learnjava moment

undone axleBOT
#

For Beginners:

Codecademy - Learn Java: Interactive Java programming course from basics to more advanced concepts. Perfect for absolute beginners.
https://www.codecademy.com/learn/learn-java
JetBrains Academy - Java Developer Track: Learn by doing with projects and challenges. It covers Java fundamentals to advanced topics.
https://www.jetbrains.com/academy/
Udemy - Java Programming Masterclass for Software Developers: Updated courses that cover Java 8 to Java 17 features. Suitable for those who prefer structured learning.
https://www.udemy.com/course/java-the-complete-java-developer-course/

For Intermediate to Advanced Learners:

Oracle Java Tutorials: The official guides by Oracle for Java programming—great for understanding the depth of Java.
https://docs.oracle.com/javase/tutorial/
Baeldung - Learn Java and Spring: Focus on Spring Framework and modern Java technologies. Best for intermediate learners aiming to expand their knowledge.
https://www.baeldung.com/

Practice and Hands-on Learning:

Exercism - Java Track: Solve exercises and get feedback from mentors. Great for practicing coding skills.
https://exercism.io/tracks/java
LeetCode: Practice your coding skills and prepare for technical interviews with Java.
https://leetcode.com/

Free Resources and Documentation:

Java Programming and Documentation: A comprehensive collection of Java programming guides, tutorials, and API documentation.
https://docs.oracle.com/en/java/

Community and Support:

Stack Overflow: A vast community of developers. Great for getting help with specific problems or understanding concepts.
https://stackoverflow.com/questions/tagged/java
r/learnjava on Reddit: Join the community of Java learners and get advice, share resources, and discuss projects.
https://www.reddit.com/r/learnjava/

Remember: Learning to program takes practice and patience. Don't hesitate to experiment with code and participate in community discussions. Happy coding! 🎉

wet breach
timid berry
#

done?

tired cedar
#

Event is way too generic, you're to be using BlockBreakEvent

wet breach
#

you are using Event not blockevent or which ever event object you are looking for

tired cedar
#

I'd maybe follow a YouTube tutorial on how to do a simple plugin to get started

#

Java you can pick up on the way

blazing ocean
#

you need to know java basics to make a plugin

tired cedar
#

Yeah the fundamentals, but everything else can be learnt as he works

timid berry
#

is this a good way to do it

tired cedar
#

It's better than before but what's the value in sending across the entire event?

#

maybe just extract what you need and then send that across

timid berry
#

then i might as well handel everything in one file

tired cedar
#

It'll become a nightmare of files with thousands of lines if you keep doing it that way

#

It's good to separate things out

#

Think it's decomposition or some computer science principle like that

nova notch
#

why do you still not know how to name classes and methods

blazing ocean
nova notch
#

but something as simple as naming shit is not even that hard

#

its like this guy is going out of his way to not name things properly

#

Ignoring the capitalization, what the fuck is "doit"? Do what?

blazing ocean
young knoll
#

Can we automatically ban people after they get 5 ?learnjavas

eternal night
#

?learnjava

undone axleBOT
#

For Beginners:

Codecademy - Learn Java: Interactive Java programming course from basics to more advanced concepts. Perfect for absolute beginners.
https://www.codecademy.com/learn/learn-java
JetBrains Academy - Java Developer Track: Learn by doing with projects and challenges. It covers Java fundamentals to advanced topics.
https://www.jetbrains.com/academy/
Udemy - Java Programming Masterclass for Software Developers: Updated courses that cover Java 8 to Java 17 features. Suitable for those who prefer structured learning.
https://www.udemy.com/course/java-the-complete-java-developer-course/

For Intermediate to Advanced Learners:

Oracle Java Tutorials: The official guides by Oracle for Java programming—great for understanding the depth of Java.
https://docs.oracle.com/javase/tutorial/
Baeldung - Learn Java and Spring: Focus on Spring Framework and modern Java technologies. Best for intermediate learners aiming to expand their knowledge.
https://www.baeldung.com/

Practice and Hands-on Learning:

Exercism - Java Track: Solve exercises and get feedback from mentors. Great for practicing coding skills.
https://exercism.io/tracks/java
LeetCode: Practice your coding skills and prepare for technical interviews with Java.
https://leetcode.com/

Free Resources and Documentation:

Java Programming and Documentation: A comprehensive collection of Java programming guides, tutorials, and API documentation.
https://docs.oracle.com/en/java/

Community and Support:

Stack Overflow: A vast community of developers. Great for getting help with specific problems or understanding concepts.
https://stackoverflow.com/questions/tagged/java
r/learnjava on Reddit: Join the community of Java learners and get advice, share resources, and discuss projects.
https://www.reddit.com/r/learnjava/

Remember: Learning to program takes practice and patience. Don't hesitate to experiment with code and participate in community discussions. Happy coding! 🎉

eternal night
#

@young knoll ^

young knoll
#

We’ll just force people to add the name to the command and then track it

#

So if I did ?learnjava @lynxplay 5 times he would automatically be permanently banned with no appeal

#

And uhh, his computer would explode

nova notch
#

surely this could not be abused in any way whatsoever

young knoll
#

Do you really think that would happen

nova notch
#

yeah, by me

young knoll
#

People on the internet abusing something solely to be negative towards an individual?

eternal night
#

I'd be a bit depressed if I was banned on here coll 😦

young knoll
#

Impossible!

random pagoda
#
    public void playerchangeworld(PlayerChangedWorldEvent event) {
        Player player = event.getPlayer();
        World lobby = player.getWorld();
        if (lobby.getName().equalsIgnoreCase("world")){
            player.sendMessage("world");
            for(PotionEffect effect:player.getActivePotionEffects()){
                player.removePotionEffect(effect.getType());
            }
        if (lobby.getName().equalsIgnoreCase("lobby")){
            player.addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION, Integer.MAX_VALUE, 10, false, false, false));
                }
        }```  Hello why when I use /mv tp lobby or use my lobby command. The PlayerChangedWorldEvent don't detect this. For the world "world" with /(essentials)spawn. I don't have problem?
rough drift
#

if that still doesn't work try using PlayerTeleportEvent

random pagoda
#

I tried after if is lobby

#

But 0 message

rough drift
#

like first line

random pagoda
#

Yes in the if

#

I tired

#

tried

rough drift
#

no

#

BEFORE

#

the if

#

outside the if

random pagoda
#

ok

#

No print with /lobby but /spawn yes. I will add my effect during the teleport in command /lobby for fix that

#

Do u know why this problem exist?

rough drift
#

are the words always the same?

tired cedar
wraith delta
#

Is it possible to reset the players unlocked recipes, priority? Basically I removed custom recipes but for players they have an error on join. Is it possible to clear all the recipes before the server sees it?

young knoll
#

Well you could edit the data files

#

Or just ignore the message

wraith delta
# young knoll Or just ignore the message

Complex story but I’ve put 10k+ player data files onto a new world and they need to start fresh with no unlocked recipes. Unless of course yes there’s a tool that could loop over 10k files to reset it

sly topaz
#

there is no such tool but it shouldn't be hard to make one

young knoll
#

You can also just do it when they first join

wraith delta
#

I’m ok with doing it on first join, I just wanted to ask if I should put it on prelogin event or will on join be sufficient in resetting it before a error occurs

sly topaz
wraith delta
young knoll
#

Join -> clear recipes -> set PDC tag so you don’t do it again

wraith delta
#

Will give it a try. Thnx.

sly topaz
young knoll
#

It’s just NBT

wraith delta
sly topaz
#

yeah but I want to look at it with ImHex to see if it'd be hard to parse

young knoll
#

NBT parsing is easy

#

There are several libraries for it

river oracle
#

I have JNBT posted on my repository

sly topaz
#

I've looked at them before but they all seem to be lacking some support for the new chunk format among other things

young knoll
wraith delta
#

But i wouldn’t bother looping over 10k files when i can reset it on first join

young knoll
#

Yeah mine doesn’t support the new chunk format either

#

Because it has compressed NBT data inside compressed NBT data

river oracle
#

Oh my

kind hatch
#

NBT seems pretty straightforward. But yea, you could just update stuff onjoin

young knoll
#

Each chunk is compressed and then the entire region is compressed

sly topaz
#

wonder if they do that on purpose

#

I doubt just layering compression algos like that has much benefit lol

wraith delta
#

My question tho was to prevent the error from coming up, assuming recipes are read on join, how would you reset that before it’s read 🤷‍♀️

kind hatch
#

What's the error you are getting?

#

An actual error, or one of those console warnings?

young knoll
#

It’s not really an error

#

The game just complains about an unrecognized recipe and then removes it

wraith delta
#

Tried to load unrecognized recipe: ResourceKey[minecraft:recipe

#

i know i can ignore it but i minus well be able to reset them before the error shows because i need ppl to start fresh anyways

young knoll
#

Then just remove the player data files?

wraith delta
young knoll
#

Why do unlocked recipes matter

wraith delta
young knoll
#

Yeah but unlocked recipes don’t actually do anything

#

Unless you are using doLimitedCrafting

kind hatch
#

They show up in the recipe book. :3

sonic goblet
#

^

young knoll
#

Yeah that’s just useful

#

Idk why unlocking them needs to be a thing

#

¯_(ツ)_/¯

wraith delta
#

bugged with hundreds of custom recipes from a old plugin, some ppl have stats like 1000levels, score, health.

#

easy to reset on first join.

young knoll
#

Also fun fact

#

Advancements are used to unlock recipes

#

Which means the game has 100s of invisible advancements

kind hatch
#

They unlock recipies??

young knoll
#

Mhm

kind hatch
#

I thought they just give rewards

wraith delta
#

its a new world i didnt transfer advancements

young knoll
#

They can do a lot of things

#

I keep forgetting the official game has a Bukkit reference

wraith delta
#

Besides making a loop to undiscover them all, is there a more performant method?

kind hatch
#

Probably not. You'd have to iterate over your entries anyways considering it's a list.

wraith delta
#

ok np

young knoll
#

undiscoverRecipes(getDiscoveredRecipes)

wraith delta
#
Set<NamespacedKey> knownRecipes = player.getDiscoveredRecipes();
player.undiscoverRecipes(knownRecipes);
```yea i did similar like this
young knoll
#

Idk if that’s actually more performant internally

#

But it’s less code to write