#help-development

1 messages Β· Page 1038 of 1

river oracle
#

Well not data driven until monang says so but we'll be ready

radiant aspen
#

lets say I wanted to set a Block to bedrock from a location,

Location location....
location.getBlock().setType(Material.BEDROCK)

What would be the new way to do this?

hushed spindle
#

yeah i mean that

river oracle
#

We just nerd an api to add to registries kekw

young knoll
#

Some are interfaces

#

Some are abstract classes

#

Biome is an abstract class for example

young knoll
river oracle
# young knoll Get to work then :D

After inventories last night though was talking with lynx regarding a syncing bug I was having and turns out our drag system breaks ensuring inventories are synced

#

Which is just beautiful

young knoll
#

Yay

river oracle
# young knoll Yay

He said the only way to fix it is a breaking change apparently but idfk where I'd even start with a pr for that idk where the drag stuff is

#

All I can say is that eill be time consuming to fix

#

Considering I didn't even know this until yesterday

eternal night
inner mulch
#

guys is there an api for creating packet entities?

radiant aspen
inner mulch
#

thats not really api is it

radiant aspen
#

I mean it is, but Im guessing you mean with the spigot API

inner mulch
#

no i mean with a good api that has the entities implemented into classes, i dont want to write the packets myself

#

with this index stuff

young knoll
#

PacketEvents has something for it

inner mulch
young knoll
#

Yes

eternal night
robust ginkgo
#

How do I set the attributes to an empty list here? I have no clue what this input type is meant to be.

inner mulch
tepid turret
#

When trying to build plugin

#

"Unsupported class file major version 65"

abstract surge
#

witch jdk do u use

tepid turret
#

21 openjdk

abstract surge
#

and what version for the server

tepid turret
#

1.20.4

abstract surge
#

java*

tepid turret
#

it hasnt ran on the server

#

this is what happens when compiling plugin in intellij idea ultimate

tardy delta
#

ensure your project java version matches with your installed java version

tepid turret
#

It does

#

atleast i think

#

project structure sdk = 21.0.3 which is installed

robust ginkgo
#

looking at maven central, that version is a bit old

tepid turret
#

oh shoot whats the newest version

robust ginkgo
#

2.0.3

#

I got the version 60 error recently, and that one had to do with my maven shade plugin version.

tepid turret
#

yeap ur right

#

Haha this is what i get for trying to run old code lol

robust ginkgo
#

at least that didn't cause any other issues (I hope)

tepid turret
#

Eh it was broken code anyways haha

ashen ferry
#

Hi, I'll show you a link to this video where you'll learn how to use it, what the plugins and commands are, and also some tutorials on how the balloon moves in the air and how the earth rotates. Here is the link: https://streamable.com/ae543b

valid basin
#

Hey guys, I'm trying to make the packet entity using ProtocolLib, but I'm getting some strange errors. This is my code. If anyone is more familiar with Plib lemme know what I'm doing wrong. I've looked into docs and seems like I'm following the correct format. No idea what's wrong to be completely honest.

public class KnockbackEntity {
    @Getter
    private FixerPlayer fixerPlayer;
    private ArrayList<FixerPlayer> affectedPlayers = new ArrayList<>();
    private final int entityId;
    @Getter
    private Location lastLoc;
    private static final HashMap<Integer, KnockbackEntity> entities = new HashMap<>();

    public KnockbackEntity(FixerPlayer fixerPlayer) {
        this.fixerPlayer = fixerPlayer;
        this.entityId = (int)(Math.random() * 2.147483647E9D);
        entities.put(this.entityId, this);
    }

    public void updateLoc(Location loc, ArrayList<FixerPlayer> players) {
        if (Config.getBoolean(Config.HD_ENABLE_HITBOX_OPTIMIZER)) {
            ProtocolManager pm = ModernKnockback.getInstance().getProtocolManager();

            PacketContainer despawnPacket = new PacketContainer(PacketType.Play.Server.ENTITY_DESTROY);
            despawnPacket.getIntLists().write(0, Collections.singletonList(this.entityId));

            PacketContainer locPacket = new PacketContainer(PacketType.Play.Server.ENTITY_TELEPORT);
            locPacket.getIntegers().write(0, this.entityId)
                    .write(1, (int) (loc.getX() * 32.0D))
                    .write(2, (int) (loc.getY() * 32.0D))
                    .write(3, (int) (loc.getZ() * 32.0D));

            PacketContainer spawnPacket = new PacketContainer(PacketType.Play.Server.SPAWN_ENTITY_LIVING);
            EntityType entityType = EntityType.valueOf(Config.getString(Config.HD_ENABLE_HITBOX_ENTITY));
            Entity entity = this.fixerPlayer.getPlayer().getWorld().spawnEntity(new Location(this.fixerPlayer.getPlayer().getWorld(), 0.0D, 256.0D, 0.0D), entityType);
            WrappedDataWatcher watcher = WrappedDataWatcher.getEntityWatcher(entity).deepClone();
            entity.remove();

            spawnPacket.getIntegers().write(0, this.entityId)
                    .write(1, entityType.ordinal())
                    .write(2, (int) (loc.getX() * 32.0D))
                    .write(3, (int) (loc.getY() * 32.0D))
                    .write(4, (int) (loc.getZ() * 32.0D));

            spawnPacket.getDataWatcherModifier().write(0, watcher);

            PacketContainer metaPacket = new PacketContainer(PacketType.Play.Server.ENTITY_METADATA);
            watcher.setObject(0, (byte) 32);
            metaPacket.getIntegers().write(0, this.entityId);
            metaPacket.getWatchableCollectionModifier().write(0, watcher.getWatchableObjects());

            for (FixerPlayer fp : players) {
                if (!this.affectedPlayers.contains(fp)) {
                    pm.sendServerPacket(fp.getPlayer(), spawnPacket);
                }
                pm.sendServerPacket(fp.getPlayer(), locPacket);
            }

            for (FixerPlayer fp : this.affectedPlayers) {
                if (!players.contains(fp)) {
                    pm.sendServerPacket(fp.getPlayer(), despawnPacket);
                }
            }

            this.affectedPlayers = players;
            this.lastLoc = loc;
        }
    }

    public static KnockbackEntity getKnockbackFixerEntity(int id) {
        return entities.get(id);
    }
}```
tepid turret
tepid turret
#

make the index 0 instead of 1

tardy delta
#

use a set btw

quaint mantle
#

Is there any way to add optinal arguments to a BrigadierCommand?

river oracle
#

I'll figure it out later thougj

inner mulch
#

when using packetevents, how do i properly send a entity metadata packet, which makes the entity invisible? im dont really get the params i need

pseudo hazel
#

did you check on the protocol wiki? usually you can get a good idea of how the wrapper has been implemented by going there first

inner mulch
#

im there

#

but i dont really get it

#

new WrapperPlayServerEntityMetadata(int entityId, List.of(new EntityData(int index, EntityDataType type, Object value));

#

shouldnt there be more ?

#

index is 0, type should be byte, but then i should also be able to say its 0x20 and then the value to 1

#

right?

pseudo hazel
#

what mc version

inner mulch
#

1.21

pseudo hazel
#

did packetevents update?

inner mulch
#

not sure, but i think i got it now

pseudo hazel
#

I think this packet has changed in 1.21

inner mulch
#

only problem i dont know how to make it visible again

tepid turret
#

Error:
https://paste.md-5.net/imipakomib.bash

plugin.getSQL.getData()

public String getData(OfflinePlayer player, String query) throws SQLException {
        if (!playerExists(player)) addPlayer(player);
        if (sqlContains(query) != 1) return null;
        try (PreparedStatement preparedStatement = connection.prepareStatement("SELECT ?, uuid FROM Players WHERE uuid = ?")) {
            preparedStatement.setString(1, query);
            preparedStatement.setString(2, player.getUniqueId().toString());
            ResultSet resultSet = preparedStatement.executeQuery();
            if (resultSet.next()) return resultSet.getString(query);
            else return null;
        }
    }

msscu.claim() (ONly Relevant Section)
https://paste.md-5.net/uxejewewel.cs

#

For some reason it wont let me get the lang or any other column of a player

#

#1 was set to lang
#2 was set to "test"

#

This error has tortured me for ages

#

ping me with response please :)

wet breach
tepid turret
# wet breach what is the query
String lang = "en";
        try {
            if (player != null && plugin.getSQL().playerExists(player)) {
                lang = plugin.getSQL().getData(player, "lang");
            }
        } catch (SQLException e) {
            throw new RuntimeException(e);
        }
wet breach
#

as in, how was it setup?

tepid turret
#
statement.execute("""
                    CREATE TABLE IF NOT EXISTS Players (
                    uuid TEXT PRIMARY KEY,
                    name TEXT,
                    lang TEXT DEFAULT 'en',
                    boat1 VARBINARY,
                    boat2 VARBINARY,
                    boat3 VARBINARY
                    );
                    """);
tardy delta
#

varbinary?

tepid turret
#

yea

#

binary strings and other things

tardy delta
#

for an uuid?

tepid turret
#

no

#

its saving other data

wet breach
#

this shows lowercase for lang

#

nvm I am seeing stuff

#

anyways, are you sure its not converting the type in some weird way?

tepid turret
#

few i thought i really made a case error and was abt to jump off a cliff

wet breach
#

not even sure how you would test that

wet breach
#

sqlite will convert types in queries

#

based on some rules

#

normally shouldn't cause any issues, but it can if you specified your sqlite db to be strict

tepid turret
#

i dont know how to specify my sqlite db to be strict but πŸ€·β€β™‚οΈ

wet breach
#

how are you connecting to it?

tepid turret
#
public SQL(String path) throws SQLException {
        connection = DriverManager.getConnection("jdbc:sqlite:" + path);
        try (Statement statement = connection.createStatement()) {
            statement.execute("""
                    CREATE TABLE IF NOT EXISTS Players (
                    uuid TEXT PRIMARY KEY,
                    name TEXT,
                    lang TEXT DEFAULT 'en',
                    boat1 VARBINARY,
                    boat2 VARBINARY,
                    boat3 VARBINARY
                    );
                    """);
        }
    }
#

creation

wet breach
tepid turret
#
try {
            if (!getDataFolder().exists()) {
                getDataFolder().mkdirs();
            }
            sql = new SQL(getDataFolder().getAbsolutePath() + "/advancedboating.db");
        } catch (SQLException error) {
            throw new RuntimeException(error);
        }
robust ginkgo
#

Is there an easy way to split a string into lore sections?
Capping each line at a set amount of letters cuts off words;
Capping the word count per line can make it look horrible because some words are longer than others.

tepid turret
#

the file appears

#

it opens in datagrip and everything

#

lang appears

#

in the datagrip

shadow night
tepid turret
#

i'd split at spaces

#

get length of each one or whatever

wet breach
#

just hardcode the query for now to make it easier to do that lol

tepid turret
#

oh chill

wet breach
#

there is statement

#

its like preparedstatement except you can't build it, it needs to be constructed when its initialized

umbral ridge
#

what is statement

#

what is chicken

blazing ocean
#

chimken

wet breach
#

I just want to see if its preparedstatement doing something weird =/

#

sqlite isn't quite like MySQL

umbral ridge
#

mongoDB

#

tinyDB

wet breach
#

why are you giving out other db names?

umbral ridge
#

frostalfDB

tepid turret
#
    public String getData(OfflinePlayer player, String query) throws SQLException {
        if (!playerExists(player)) addPlayer(player);
        if (sqlContains(query) != 1) return null;
        try (Statement statement = connection.createStatement()) {
            ResultSet resultSet = statement.executeQuery("SELECT lang FROM Players WHERE uuid = '77e27de9-5c36-40b7-b793-013e2f2312ea'");
            return resultSet.getString("lang");
        }
//        try (PreparedStatement preparedStatement = connection.prepareStatement("SELECT ?, uuid FROM Players WHERE uuid = ?")) {
//            preparedStatement.setString(1, query);
//            preparedStatement.setString(2, player.getUniqueId().toString());
//            ResultSet resultSet = preparedStatement.executeQuery();
//            if (resultSet.next()) return resultSet.getString(query);
//            else return null;
//        }
    }
#

this doesnt return the error...

#

so preparedStatement is being weird

#

ffs

clear panther
#

guys is nbt usable for 1.8?

tardy delta
#

i dont think getData() should create the player though, seems like a design issue

young knoll
tepid turret
#

and its like that for defaults

wet breach
clear panther
young knoll
#

Sure

tepid turret
young knoll
#

But there is no PDC api in 1.8 so you'll need something like NBTApi or just NMS

wet breach
#

I had to look at the compiling of prepared statement in sqlite to even think it may be prepared statement XD

wet breach
#

just have to take extra care in regards to sanitizing if the inputs come from players directly

tepid turret
#

so i shouldnt have to worry?

wet breach
#

not if the players can't input anything directly

tepid turret
#
ResultSet resultSet = statement.executeQuery("SELECT " + query + " FROM Players WHERE uuid = '" + player.getUniqueId() + "'");
#

is this stupid code gonna work

wet breach
#

I am not sure what version of sqlite jdbc you are using either

#

but there was some bugs in one of the versions of sqlite 3

tepid turret
#

right makes sense

wet breach
tepid turret
wet breach
#

yeah

#

that is what preparedstatement is mainly good for

tepid turret
#

yea should be fine i hope

#

πŸ’€

wet breach
#

well

#

its what backups are for

tepid turret
#

if it comes to it how easy is it to switch to mysql

blazing ocean
#

kekw

wet breach
#

would take minimal effort to move to mysql, just pull the sql code for your current DB upload it to mysql

tardy delta
#

whats the diff again between

conn.prepareStatement(xyz)
ps.execute()

//and

conn.prepareStatement()
ps.execute(xyz)

former caching the statement?

wet breach
#

would be a shame if spigot has a version of sqlite that has the bugs

young knoll
#

hmm?

wet breach
#

currently that is

tepid turret
#

it doesnt

#

i dont think

wet breach
#

it does

eternal night
#

3.46.0.0

wet breach
#

oh well if you are on latest mc version for spigot you shouldn't really be having issues with sqlite =/

#

3.46 is quite a many versions away from the 3.14 series

tepid turret
#

oh im on 1.20.4

#

for reasons

#

πŸ’€

#

not my choice

young knoll
#

3.42 is used in 1.20.4

river oracle
#

Hi coll

#

I'm Miles aka Y2K_ I need help from staff

young knoll
#

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

river oracle
river oracle
#

?asc how craft heart

#

Hmmm I don't get ot

#

Inventory PR tho

#

You can't ban me

young knoll
#

My patches are borked

#

I blame you

river oracle
#

Or ill smack you

young knoll
#

Do trial spawners have an inventory

river oracle
#

No menu though

young knoll
#

Tf do they actually

#

the heck is in it

river oracle
#

I mean they probably do everything that contains items has an inventory

young knoll
#

It doesn't contain items

#

you spoon

river oracle
river oracle
#

The funniest inventory is probably the lectern tbh

young knoll
#

Are you thinking of the vault

#

Not the spawner

river oracle
#

I forgot they were different

young knoll
#

I think they vault just contains a loottable nbt tag

#

not sure

river oracle
#

Ever put a diamond in your lectern inventory before

#

It's a great time

quiet ice
#

why is that a thing?

river oracle
tardy delta
#

probably a great time to waste a diamond hmm?

river oracle
tardy delta
#

like that time someone on the spigot smp put an item in a vase and couldnt figure out how to get it back lol

upper hazel
#

how unban player

#

i have ofline plater obj

#

but i not find method for unbun

#

1.20

icy beacon
#

Try OfflinePlayer.getPlayerProfile().update() and use it for the player profile ban list

pseudo hazel
#

bukkit.getbanlist or smth

icy beacon
pseudo hazel
#

:yesway:

upper hazel
#

ban list not have unbun method

pseudo hazel
#

pardon()

upper hazel
#

wha

alpine urchin
#

unbun

pseudo hazel
#

should be a function called banlist.pardon

#

because vanilla command is /pardon im pretty sure

chrome beacon
#

^

tardy delta
#

pardon me my well established gentleman

upper hazel
#

void pardon(@org.jetbrains.annotations.NotNull T t);

#

what the t i need get from player profile?

chrome beacon
#

T is the player profile in this case

upper hazel
#

no

green prism
#

Hi there. Is creating a new inventory each time (with cached itemstacks) much more resource-expensive than updating it on the fly?

worthy yarrow
#

It cleans up inventory creation a lot

chrome beacon
green prism
worthy yarrow
#
public class Button {

    private final Material materialType;
    private final String displayName;
    private final List<String> lore;

    public Button(Material materialType, String displayName, String... lore) {
        this.materialType = materialType;
        this.displayName = displayName;
        this.lore = new ArrayList<>();
        for (String string : lore){
            this.lore.add(ChatColor.translateAlternateColorCodes('&', string));
        }
    }

    public ItemStack getItemStack(){
        ItemStack stack = new ItemStack(materialType);
        ItemMeta meta = stack.getItemMeta();
        meta.setDisplayName(ChatColor.translateAlternateColorCodes('&', displayName));
        meta.setLore(lore);
        stack.setItemMeta(meta);
        return stack;
    }```
For all my buttons, which turns itemstack creation into a one liner: new Button(material, "name", lore...);
worthy yarrow
#

Creation being a player opening the gui

green prism
# worthy yarrow Creation being a player opening the gui

oh well... I'm actually recreating it from scratch each time:

    public void generateInventory() {

...

        // Parsing details

        // Required details
        int size = guiDetails.getInventorySize();
        InventoryType type = guiDetails.getGuiType()
                .toInventoryType();

        // Optional details
        Component title = guiDetails.getInventoryName();

        // guiDetails.setTempPageElements(new HashMap<>()); // reset temp

        // Generating inventory

        Inventory inventory;

        if (type != InventoryType.CHEST) {
            inventory = Bukkit.createInventory(this, type, ComponentsUtil.serialize(title));
        } else {

            // We cannot extract to specify
            // the size of the inventory

            inventory = Bukkit.createInventory(this, size, ComponentsUtil.serialize(title));
        }


        // Populating inventory
        this.populateInventory(
                inventory
        );

        this.inventory = inventory;
    }
upper hazel
#

"cant resolve"

#

server.getBanList(BanList.Type.PROFILE).pardon(offlinePlayer.getPlayerProfile());

worthy yarrow
# green prism oh well... I'm actually recreating it from scratch each time: ```java publi...

That was something I was toying with as well, the generalization of inventory creation was very hard and I ended up just sticking with something like this:

private static final Button BACK_BUTTON = new Button(Material.RED_STAINED_GLASS_PANE, "&cBack", "&7Click to go back to the previous menu!");
    private static final Button BORDER = new Button(Material.GRAY_STAINED_GLASS_PANE, " ");
    private static final Button REMOVE_SINGLE_APPLE_BUTTON = new Button(Material.RED_WOOL, "&c [-] &f: &4Apple", "&7Click to remove one apple from your purchase!");
    private static final Button REMOVE_16_APPLES_BUTTON = new Button(Material.RED_WOOL, "&c [-] &7<&c16&7> &f: &4Apples", "&7Click to remove 16 apples from your purchase!");
    private static final Button ADD_SINGLE_APPLE_BUTTON = new Button(Material.GREEN_WOOL, "&a [+] &f: &4Apple", "&7Click to add one apple to your purchase!");
    private static final Button ADD_16_APPLES_BUTTON = new Button(Material.GREEN_WOOL, "&a [+] &7<&a16&7> &f: &4Apples", "&7Click to add 16 apples to your purchase!");


...

/**
     * Money To Apple Conversion Menu
     *
     * @param appleAmount The amount of apples to display.
     * @param cost The cost of how many apples.
     * @param player We get the player here to display their balance.
     * @return Returns the created inventory.
     */
    private Inventory moneyToAppleConversionMenu(int appleAmount, double cost, Player player){

        Inventory appleConversionMenu = Bukkit.createInventory(null, 27, ChatColor.translateAlternateColorCodes('&', "&4Buy Apple Menu"));
        NumberFormat numberFormat = NumberFormat.getInstance();
        Economy economy = NormalConversions.getEconomy();

        Button appleAmountButton = new Button(Material.APPLE, "&4Apple : &f" + appleAmount);
        Button appleConversionRateButton = new Button(Material.ENCHANTED_BOOK, "&cApple &fConversion Rate:", "&7[ &f1 : %appleRate% &7]".replace("%appleRate%", numberFormat.format(conversionRates.getMoneyToAppleConversionRate())));
        Button buyButton = new Button(Material.GREEN_STAINED_GLASS_PANE, "&cClick To Buy!", "&7 [ &c%cost% &7] ".replace("%cost%", numberFormat.format(cost)));
        String playerBalance = "&cYour balance &f: &7<&f %playerBalance% &7>".replace("%playerBalance", String.valueOf(economy.getBalance(player)));
        Button playerBalanceButton = new Button(Material.PAPER, ChatColor.translateAlternateColorCodes('&', playerBalance));

        appleConversionMenu.setItem(11, REMOVE_16_APPLES_BUTTON.getItemStack());
        appleConversionMenu.setItem(12, REMOVE_SINGLE_APPLE_BUTTON.getItemStack());
        appleConversionMenu.setItem(13, appleAmountButton.getItemStack());
        appleConversionMenu.setItem(14, ADD_SINGLE_APPLE_BUTTON.getItemStack());
        appleConversionMenu.setItem(15, ADD_16_APPLES_BUTTON.getItemStack());

        // Gives us a border like appearance surrounding the other buttons.
        for (int i = 0; i < appleConversionMenu.getSize(); i++){
            if (i < 10 || i > 16){
                appleConversionMenu.setItem(i, BORDER.getItemStack());
            }
        }

        // Set the buttons after the border buttons are placed, as these buttons are placed in spots of borders.
        appleConversionMenu.setItem(4, appleConversionRateButton.getItemStack());
        appleConversionMenu.setItem(22, buyButton.getItemStack());
        appleConversionMenu.setItem(26, BACK_BUTTON.getItemStack());
        appleConversionMenu.setItem(8, playerBalanceButton.getItemStack());
        return appleConversionMenu;
    }
#

I've got my reusable buttons at the top

#

and populate the inventory I guess what you could say "normally"

green prism
worthy yarrow
#

Sure, but I suppose thats why we have javadocs eh?

green prism
worthy yarrow
#

Javadocs to explain why we do what we do I meant kek

#

"I was too lazy to make this abstract enough so I hardcoded it"

worthy yarrow
green prism
#

@chrome beacon Sorry to tag you, but you've been in this field for decades. I trust your skills, haha. Do you think this approach is overkill?

young knoll
#

Just create an inventory object, add stuff to it, and then hold it in a variable somewhere?

chrome beacon
#

A map with a string key for the inventory name is fine

worthy yarrow
#

Bruh ok

#

I did that and was thinking it was so hacky

young knoll
#

I generally only have global inventories be cached

green prism
chrome beacon
#

Probably not that expensive

young knoll
#

Anything with contents that pertain to a specific player I make on the fly

green prism
#

and by resetting, I mean

inventory.setItem(cacheEntry.getKey(), cacheEntry.getValue())

chrome beacon
#

but a map lookup is faster than recreating the entire inventory

green prism
#

Thank you all! Amazing help πŸ™‚

river oracle
#

Resetting each element is meh it's just a for loop but the conversion of bukkit item stacks to jms stacks can be heavy if you do it often but it really depends in your frequency

green prism
#

I see

#

Thank you!!

worthy yarrow
#

Otherwise they're all shared

winged crater
#

ANyone else has the problem with /spawn ?
It says "no permissions" but I have the perms in LPB

dense oracle
#

Can u send us the class of the command?

worthy yarrow
tardy delta
#

is there like an api way to start a zombie siege in a village?

timid spear
#

Heya

#

What is the new way of doing b.getType()).bukkitSound()?

warm mica
#

It summons herobrine

timid spear
icy beacon
icy beacon
#

Wtf is elevatorwhooshdown

timid spear
#

xd

icy beacon
#

This is a genuine question

#

And what does get return

timid spear
#

sound that gets played when player is sneaking, which triggers a teleportation

rough pumice
#

anyone know how to solve these 2 errors? They occur when after a while once I've unloaded a world using Bukkit.unloadWorld and then deleted the world folder.

java.nio.file.NoSuchFileException: .\void_active_1718736968389\data\raids.dat
``` ```
[20:00:54 ERROR]: Failed to save level .\void_active_1718736968389
java.nio.file.NoSuchFileException: .\void_active_1718736968389\level14083239363489905074.dat
icy beacon
timid spear
#

Yessir

icy beacon
#

Uhh sounds may have been moved into registries

#

Look into Bukkit.getRegistry(Registry.SOUND) (see if that exists)

kind hatch
#

Probably BlockData#getSoundGroup()#whateverSoundYouNeed()

icy beacon
#

I'm not sure

dense oracle
rough pumice
dense oracle
#

Ill have to start my pc rq

dense oracle
rough pumice
#

yeah thats all working fine

dense oracle
#

Nice c:

grim hound
#

does Player#isOnGround work?

dense oracle
#

It should

#

Just try it :)

alpine urchin
#

lol

#

are you working with packets

#

because the combination of bukkit and packets doesn’t always yield the most accurate reaults

#

results

#

i mean it will work but if being (i think) one tick off bothers you

#

you then you might have to reconsider

young knoll
#

It’s client controlled

timid spear
#

uuhh

#

How to make it not abstract anymore? xd

tardy delta
#

elevatorWhooshDOWN πŸ’€

timid spear
#

πŸ˜„

hazy parrot
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! πŸŽ‰

river oracle
#

CraftCrafterView is such a silly class name

real lagoon
quaint mantle
#

CraftCraftingTable

dawn flower
#

how do i make this animation https://youtu.be/Yw4iA8sVVko?t=279

we thought we completed it but pretty sure we didn't do the last bit so don't think its a completion, really interesting boss tho! teammate got fifth master star lol, my job was pretty much keeping the tank alive

Discord - https://discord.gg/TqjM76T
β–¬β–¬β–¬β–¬β–¬β–¬β–¬β–¬β–¬β–¬β–¬β–¬β–¬β–¬β–¬β–¬β–¬β–¬β–¬β–¬β–¬β–¬β–¬β–¬β–¬β–¬β–¬β–¬β–¬β–¬β–¬
Texture Pack / Shaders - Just ask me in comments with timestamp...

β–Ά Play video
eager pier
#

Hello guys ! I'm facing a problem with the HumanEntity.discoverRecipe method. It seems it only work during a PlayerJoinEvent ... when I try to use it anywhere (after cmd, etc..) it doesn't work ... Have you already saw that ?

inner mulch
#

it should work everywhere

eager pier
#

It should yes ^^

inner mulch
#

and it does, there is no such thing in java to cancel methods depending on the place they are called

eager pier
#

I totally agree

#

that why I'm so confused

inner mulch
#

are you returning at some point?

#

when you call the method

#

are you making sure it even reaches that point?

eager pier
#

No I'm using method before and after this one and they all execute without error

#

I'm using it in a scheduleSyncDelayedTask, do you think it could me it not working ?

inner mulch
#

i dont think this would affect it

eager pier
#

ok so I have no clue ^^

#

my method is used in a scheduleSyncDelayedTask and in the PlayerJoinEvent and it's only working on this last one

tardy delta
native nexus
inner mulch
#

when using packets how can i unset a value again from the index 0? as far as i know i can only send with the byte and no true or false with it?

eager pier
jovial orchid
#

?interactevent

undone axleBOT
#

The PlayerInteractEvent may be called once per hand. If you only want code to be executed once, you can check the result of https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerInteractEvent.html#getHand(), then decide functionality.

For example, only executing code if the main hand was used:

@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
    if (event.getHand() != EquipmentSlot.HAND) { // * if the hand used is NOT the main hand:
        return; // do not progress past this point  |
    }
    // provide functionality
}
robust ginkgo
#

What's the proper way to set a yaml value to an empty dictionary?

jovial orchid
#

?

eternal night
#

I guess just empty map

#

tho the representation of that is kinda up to snakeyaml

robust ginkgo
real lagoon
robust ginkgo
digital nova
#

Would there be any way for me to create a world that simply saves nothing on the disk, I have a custom world format to provide chunks from and save changes to that I want to use

real lagoon
digital nova
river oracle
#

pressing f3 on material is one of the top worst things to happen to me today

slender elbow
#

f3?

river oracle
#

I decompiled it

#

Does WrittenBook have WritableBookMeta or BookMeta

#

Its BookMeta

slender elbow
#

xdd

warm mica
rotund pebble
#

is there any way for spigot to use the server's CommandDispatcher?
i wanna make commands in a spigot plugin that mcfunctions can use

late sonnet
carmine mica
#

you could use the brig API recently added to paper with the bootstrap system to register commands before mcfunction parsing happens

rotund pebble
#

?whereami

rotund pebble
#

js grabbed this ss from the top left rn actually

#

this is literally papermc

real lagoon
#

But...

#

What is discord?

nova notch
#

If it was my name wouldn't be BananaRobot29498

rotund pebble
#

your name is "Stasis, The Shattered" ???

nova notch
#

Not here because it made me link it to some account with an Xbox randomly generated ass username

rotund pebble
#

lmao

real lagoon
#

Lol

golden turret
#

how do i play the block break particles? i forgor πŸ’€

#

i need to play the full block break effect, specifically

#

because i am manually breaking the block in the code

topaz cape
#

should I treat Level class (moj mappings nms) as autoclosable or should I just ignore that

void drum
#

Ignore that

topaz cape
#

thank god, been ignoring it since long ago and now i feel relieved

torn shuttle
#

got a new kind of malware spammer, someone linking to a github project telling people to run some shady program because they're getting an error with it

#

seems like it's a crypto miner

torn shuttle
real lagoon
#

But, which is the best way to get one?

eternal oxide
#

visit porn sites with adverts enabled

torn shuttle
#

based on how you're asking this I'm guessing you probably have a few regardless

real lagoon
#

Maybe

#

But i have windows defender

torn shuttle
#

Oh I take that back then, you definitely have a few already

real lagoon
eternal oxide
#

to tell the truth all I have is Defender + adblock.

#

no viruses and Im even on Win7 πŸ˜„

real lagoon
#

Windows 7 is the best

agile anvil
eternal oxide
#

yep

#

well

#

also be aware of what sites you visit

#

Virus payloads in adverts/JS has been one of the most used way to infect computer.

agile anvil
#

But is it still possible nowadays?

eternal oxide
#

yes

agile anvil
#

...

real lagoon
drowsy helm
#

can steal you identity

eternal oxide
#

but they hacked your computer adn recorded you watchign porn.

drowsy helm
#

and take loans out in your name

eternal oxide
#

I keep gettimg those emails

#

I don;t have a camera

real lagoon
slender elbow
celest wadi
#

anyone here good at trigonometry

#
pub fn calc_view_angles(&self, dest: &Entity) -> Vector2 {
    let delta_x = dest.head_position.0 - self.head_position.0;
    let delta_y = dest.head_position.1 - self.head_position.1;
    let angle = delta_y.atan2(delta_x);
    let yaw = angle * (180.0 / f32_consts::PI) + 90.0;
    let delta_z = dest.head_position.2 - self.head_position.2;
    let angle = -(delta_z / delta_y).atan();
    let pitch = angle * (180.0 / f32_consts::PI);
    Vector2(yaw, pitch)
}
#

something about my math is wrong

#

like it works sometimes but then i start aiming at the sky lmfao

floral drum
#

what language is that

celest wadi
#

rust

#

learn it thank me 5 years from now when u understand lifetimes

floral drum
#

Just confirming

echo basalt
#

I believe you're negating both deltaZ an deltaY

#

while you only want to negate deltaZ and keep deltaY positive?

#

And for your "yaw" (which is minecraft's pitch because you only have a single axis) you might want to use sin instead of atan?

#

Just doing loose conversions here

floral drum
#

I think it's acos right?

#

oh it might be asin tbh

echo basalt
#

acos / asin just reverses the cos/sin process

#

I wouldn't pass angles there

floral drum
#

honestly what if you just convert the code from minecraft to make an entity look at a player into this...

#

that should work right?

echo basalt
#

angle == acos(cos(angle))
angle == asin(sin(angle))

floral drum
#

yea

#

try this maybe?

pub fn calc_view_angles(&self, dest: &Entity) -> Vector2 {
    let pi_2 = f32_consts::PI * 2;
    let normalized_delta = (dest.headposition - self.headposition).normalize();
    let delta_x = normalized_delta.0;
    let delta_y = normalized_delta.1;
    let delta_z = normalized_delta.2;
    let theta = delta_y.atan2(delta_x);
    let yaw = (theta + (pi_2)) % (pi_2);
    
    let delta_x_squared = x * x;
    let delta_z_squared = z * z;
    let delta_xz_sqrt = (delta_x_squared + delta_z_squared).sqrt();
    let pitch = (-delta_y / delta_xz_sqrt).atan();
    Vector2(yaw.to_degrees(), pitch.to_degrees())
}```
#

that's basically minecraft's code in rust ig

#

@celest wadi

#

misplaced a parenthesis

#

not sure if there's a PI_2 in rust so I just did PI * 2

celest wadi
#

its a little bit off 😭

floral drum
#

the code I sent?

celest wadi
#

yea

#

imma try illusions method now

floral drum
#

aight

#

honestly maybe the vector need to be normalized

#

I edited it, just incase there's a normalize function for that vector type

#

or maybe even try remove the to_degrees calls

celest wadi
echo basalt
#

it's wack

floral drum
#

sheesh

#

math is weird

echo basalt
#

had to help a friend out with trig like 3 days ago

#

re-learned the basics there and then

celest wadi
#

well almost

#

a little rough at times but way better than what i had

#

no more random spinning at least

echo basalt
#

replace the sin with a cos maybe

#

who knows

celest wadi
#

shii i like your ways

echo basalt
#

actually what's your current code

celest wadi
#
let delta_x = dest.head_position.0 - self.head_position.0;
let delta_y = dest.head_position.1 - self.head_position.1;
let delta_z = dest.head_position.2 - self.head_position.2;

let angle = delta_y.atan2(delta_x).cos().acos();
let yaw = angle * (180.0 / f32_consts::PI) + 90.0;
let angle = -(delta_z / delta_y).sin().asin();
let pitch = angle * (180.0 / f32_consts::PI);
Vector2(yaw, pitch)
echo basalt
#

brother .sin.asin does nun

#

I was showcasing the funky math concept

celest wadi
#

mf im copyin and pastin

#

give me truth or give me lies and you give me lies

#

i failed my math classes and still passed this aint my fault

#

blame the system

echo basalt
#

delta_x.asin()
-delta_z.atan2(delta_y)

celest wadi
#

crashes my game

floral drum
#

honestly I forgot my trig shit

echo basalt
#

lmfao wot

floral drum
#

wtf

echo basalt
#

basically the equivalent of
yaw = toDeg(asin(deltaHeight))
pitch = toDeg(atan2(-deltaLength, deltaWidth))

floral drum
#

wait I think I see what I did wrong..

celest wadi
#

you dont gotta write it in rust btw pseudocodes fine

blazing robin
#

hey guys, I'm trying to make custom recipe like, 4x4 in the inventory

 @Override
    protected void onClick(InventoryClickEvent event) {
        int slot = event.getSlot();
        Inventory inventory = event.getInventory();

        ItemStack[][] test = getRecipeItems(inventory);


        System.out.println(event.getAction());

        plugin.getServer().getScheduler().runTaskAsynchronously(plugin, () -> {
            for (CraftingItemRecipe recipe : craftingRecipeRegistry.getRecipes()) {
                if (recipe.matches(test)) {
                    ItemStack resultItem = recipe.getResult();
                    inventory.setItem(RESULT_SLOT, resultItem);
                    break;
                }
            }
        });
    }

Ive tried this :

but even when I fit the recipe the result item won't set in the RESULT_SLOT, but I clicked again somewhere in inventory, the resultItem just appear how can I check if the inventory's recipe fit or not ?

celest wadi
#

maybe we should move to like #bot-commands so i dont ruin this guys chances of getting a response

floral drum
# celest wadi you dont gotta write it in rust btw pseudocodes fine
pub fn calc_view_angles(&self, dest: &Entity) -> Vector2 {
    let pi_2 = f32_consts::PI * 2;
    let delta = self.headposition - dest.headposition;
    let delta_x = delta.0;
    let delta_y = delta.1;
    let delta_z = delta.2;
    let theta = (-delta_x).atan2(delta_z);
    let yaw = (theta + pi_2) % pi_2;
    
    let delta_x_squared = x * x;
    let delta_z_squared = z * z;
    let delta_xz_sqrt = (delta_x_squared + delta_z_squared).sqrt();
    let pitch = (-delta_y / delta_xz_sqrt).atan();
    Vector2(yaw.to_degrees(), pitch.to_degrees())
}```
#

maybe that?

floral drum
floral drum
blazing robin
drowsy helm
blazing robin
drowsy helm
#

why are you evaluating it manually

blazing robin
#

hmm i thought it just only work when 3x3 recipe

drowsy helm
#

no

#

2x2, 3x3 and shapeless

blazing robin
#

it works in the other inventory?

drowsy helm
#

yep

blazing robin
#

oh wow

#

but

#
{
    "recipes": [
      {
        "id": "kimchi_pancake",
        "recipeType": "hidden",
        "pattern": [
          "ABC",
          "D# "
        ],
        "key": {
          "A": {"itemsadder": "pepper"},
          "B": {"itemsadder": "eggplant"},
          "C": {"material": "ROTTEN_FLESH"},
          "D": {"material": "WHEAT"},
          "#": {"itemsadder": "parsley"}
        },
        "result": {"itemsadder": "kimchi_pancake"}
      }
    ]
  }

I have to add special item like, in itemsadder or customfishing

#

so I made it own myself

drowsy helm
#

if it requires special things you can listen to CraftItemEvent then check the items again

#

it's far less buggy and error prone to manually evaluating the inventory

blazing robin
drowsy helm
#

yes

blazing robin
#

oh

#

and can I use .json for recipes files?

drowsy helm
#

sure, thats up to you

blazing robin
#

oh I've gotta consider that your recommend thank you

blazing robin
drowsy helm
#

No clue

#

check their wiki

#

its probably just pdc

blazing robin
#

but if there's no way to get id from itemstack then how can I check the recipe immediately ?

drowsy helm
#

there is a way i just don't know how, I don't use ItemsAdder

#

look at their api docs and you will find out

tepid turret
#

How would i make sqlite change to mysql

#

well

#

how do i update the sqlite im running

torn shuttle
#

can someone remind me what the link was to see old versions of the api docs

drowsy helm
torn shuttle
#

just found it thanks

tepid turret
#

(MCCSU) Claim Function
https://paste.md-5.net/ecefumaquj.cs

plugin.getSQL().updateData()

    public void updateData(OfflinePlayer player, String query, byte[] data) throws SQLException {
        if (!playerExists(player)) addPlayer(player);
        if (sqlContains(query) != 2) {
            return;
        }
        Bukkit.getLogger().info("Why tf? 2");
//        try (Statement statement = connection.createStatement()) {
//            statement.executeUpdate("UPDATE Players SET " + query + " = " + data + " WHERE uuid = '" + player.getUniqueId().toString() + "'");
//        }
        try (PreparedStatement preparedStatement = connection.prepareStatement("UPDATE Players SET ? = ? WHERE uuid = ?")) {
            preparedStatement.setString(1, query);
            Bukkit.getLogger().info(query);
            preparedStatement.setBytes(2, data);
            Bukkit.getLogger().info(String.valueOf(data));
            preparedStatement.setString(3, player.getUniqueId().toString());
            Bukkit.getLogger().info(player.getUniqueId().toString());
            preparedStatement.executeUpdate();
        }
    }

Output Error:
https://paste.md-5.net/qawalilohu.cs

#

Was previously having this error with preparedStatement and sqllite

#
    <dependencies>
        <dependency>
            <groupId>org.spigotmc</groupId>
            <artifactId>spigot-api</artifactId>
            <version>1.20.4-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.spigotmc</groupId>
            <artifactId>spigot</artifactId>
            <version>1.20.4-R0.1-SNAPSHOT</version>
            <scope>provided</scope>
            <classifier>remapped-mojang</classifier>
        </dependency>
        <dependency>
            <groupId>net.kyori</groupId>
            <artifactId>adventure-platform-bukkit</artifactId>
            <version>4.3.2</version>
        </dependency>
        <dependency>
            <groupId>net.kyori</groupId>
            <artifactId>adventure-text-minimessage</artifactId>
            <version>4.16.0</version>
        </dependency>
        <dependency>
            <groupId>com.tchristofferson</groupId>
            <artifactId>ConfigUpdater</artifactId>
            <version>2.1-SNAPSHOT</version>
        </dependency>
        <dependency>
            <groupId>me.clip</groupId>
            <artifactId>placeholderapi</artifactId>
            <version>2.11.5</version>
            <scope>provided</scope>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.xerial/sqlite-jdbc -->
        <dependency>
            <groupId>org.xerial</groupId>
            <artifactId>sqlite-jdbc</artifactId>
            <version>3.46.0.0</version>
        </dependency>
    </dependencies>
drowsy helm
void drum
#

What's the best way to handle receiving a packet on a server? It's a custom packet, if that's relevant, so of course only clients that know it exists will send it and that's fine

drowsy helm
tepid turret
#

the column already exists i know that for certain

#

looking at the table in datagrip it shows up

void drum
tepid turret
#

and running that query using datagrip its functional

drowsy helm
drowsy helm
#

you'll have to do a lot of research yourself

#

look into protocol lib's packet listener, I think they use it

void drum
#

will d,o thank you

pale siren
#

hello, I have a doubt, I downloaded a project that is made in eclipse and I want to know if I can transform it to a maven project in intellij, is it possible?

drowsy helm
#

Yes definitely

#

So it’s not a maven project at all yet?

pale siren
#

nope

drowsy helm
#

Change it over to maven in eclipse

#

Then it should move over to intellij without any changes

pale siren
#

ok i'll try, thank you!

torn shuttle
#

real quick did material names change for 1.21?

drowsy helm
#

I feel like a tool that just lists every enum in spigot for each version to comparw would be nice

#

Bit niche but would come in handy for specific things

torn shuttle
torn shuttle
#

what is the current recommended way of getting a potion effect type from name or key?

void drum
#

who knew sending packets would be the hard part..

quiet ice
#

Should've used the right library

void drum
#

Trying not to use any library right now, funnily enough

#

just spigot and NMS

#

believe the issue's because it's a custom packet though, and something is trying to cast it to DiscardedPayload

quiet ice
fringe dagger
#

can someone help me with something in vc?
it about spawn rate in server problem

agile anvil
#

VC?

shadow night
#

Voice chat prob

fringe dagger
#

yea

#

i meant voice chat

sullen canyon
#

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

void drum
sullen canyon
#

?xyproblem

#

?xyzproblem

shadow night
#

?xy

undone axleBOT
sullen canyon
#

ty

torn shuttle
#

elitePotionEffect.getPotionEffect().getType().getKey().getKey() for when you really, really want that key

zealous osprey
#

damn

meager sage
#

Is it possible to make World.strikeLightningEffect(loc) silent? I know there are no other arguments but would it be possible with something like reflection?

meager sage
tender shard
#

Client side

#

Lightning = sound

#

Cant be prevented

torn shuttle
#

actually I 1-upped myself entry.getKey().getKey().getKey().toLowerCase(Locale.ROOT)

#

I REALLY want that key boys

remote swallow
astral pilot
#

does Bukkit.unloadWorld() deletes the world?

pseudo hazel
#

no

astral pilot
#

weird

pseudo hazel
#

how so

astral pilot
#

nvm i did smth wrong xd

#

thanks anyways

vernal halo
#

any protocol experts? i have no clue why its not working

            WitherSkeleton witherSkeleton = player.getWorld().spawn(player.getLocation(), WitherSkeleton.class);
            GameEntity.setOwner(player, witherSkeleton);

            PacketContainer packet = ProtocolLibrary.getProtocolManager()
                    .createPacket(PacketType.Play.Server.ENTITY_METADATA);
            packet.getIntegers().write(0, witherSkeleton.getEntityId());

            WrappedDataWatcher dataWatcher = new WrappedDataWatcher();
            dataWatcher.setEntity(witherSkeleton);
            dataWatcher.setObject(new WrappedDataWatcher.WrappedDataWatcherObject(6, 
                    WrappedDataWatcher.Registry.getChatComponentSerializer(true)), Optional.of(WrappedChatComponent.fromText("Test")));
            
            packet.getWatchableCollectionModifier().write(0, dataWatcher.getWatchableObjects());
            ProtocolLibrary.getProtocolManager().sendServerPacket(player, packet);
#

i get kicked for Failed to encode packet 'clientbound/set_entity_data'

wet breach
#

pretty sure protocollib has their own discord. Pretty sure they are the experts of their plugin

#

if not using that plugin, which I just assumed. Then the error is simple, you didn't encode the packet

vernal halo
#

at least i couldnt find one

wet breach
#

I thought they had one πŸ€”

wet breach
# vernal halo they dont have a discord

well while you wait for someone to help I guess, you could ensure you are using an appropriate ProtocolLib version for whatever version of MC you are using

pseudo hazel
#

what mc version is this

vernal halo
#

1.20.6

#
Caused by: java.lang.ClassCastException: class net.minecraft.network.syncher.DataWatcher$Item cannot be cast to class net.minecraft.network.syncher.DataWatcher$c (net.minecraft.network.syncher.DataWatcher$Item and net.minecraft.network.syncher.DataWatcher$c are in unnamed module of loader java.net.URLClassLoader @65b3120a)
pseudo hazel
#

hmm

#

all know is 1.21 added more stuff to entity metadata format

vernal halo
#

all i want is to send a unique custom name to specific players

#

i have no idea why it wants to cast $Item to $c

quaint mantle
#

Am i the only one that has issues with arrows being deflected by shield and shot from bows or crossbows? This instantly kills the server

#

Mc 1.21

#

Spigot with bukkittools

pseudo hazel
#

on latest?

icy beacon
#

run /version to make sure you are running the latest version, if not then run buildtools and try again
if the error still persists with no plugins on the server, report it to jira

quaint mantle
#

Im kinda new here, any link to jira?

icy beacon
#

?jira

undone axleBOT
quaint mantle
#

Ill update mine and see if the error persists. It throws an error in console

pseudo hazel
#

yeah

icy beacon
#

just run /version to see if it says something like "you are running the latest version" or "you are X versions behind"

#

and make sure that the error happens with no plugins on the server

quaint mantle
#

Okidoki

pseudo hazel
#

I think right now there are new versions like twice a day so make sure you actually have latest haha

quaint mantle
#

Wow great effort for the coders

icy beacon
#

my fucking kotlinx.serializable class is serializing transient fields 😭 wtf is going on

pseudo hazel
#

wtf is transient

icy beacon
#

Marks this property invisible for the whole serialization process, including serial descriptors. Transient properties must have default values.

pseudo hazel
#

so thats a fucking lie

flint coyote
#

Transient properties can be serialized in special cases

icy beacon
#

it's not a property in this case though it's just a field

flint coyote
#

Well exact cases depend on the library. But jackson for example serializes everything that has a function called "get<Name>"

icy beacon
#

well i'm using kotlinx.serialization

flint coyote
#

Today I learned this is an interview question

icy beacon
#

i don't think this fits my problem unfortunately

flint coyote
#

Could it be about the default getters created by kotlin? Although i'd doubt that on a kotlin lib

icy beacon
#

uhh maybe but i haven't had this problem like ever idk

#

i'll change var to val

#

perhaps that helps

flint coyote
#

Did you use the correct annotation? Correct package?

icy beacon
#

yes

#

i think that var is the problem because it vaguely matches the description of "should implement readObject() & writeObject()

#

and i don't need it to be a var anyway it's fine as a val

pseudo hazel
#

kotlin moment

rapid vigil
#

var = variable
val = valiable?

icy beacon
#

var - mutable
val - immutable

#

val - value (immutable) var - variable (can vary)

flint coyote
#

valiable xD

pseudo hazel
#

const

rapid vigil
icy beacon
#

value

flint coyote
# icy beacon nope

maybe throw your class in chatgpt and ask why that field is serialized.
I know it's a gamble but it's worth a try

pseudo hazel
#

why not

flint coyote
#

maybe a minimal sample of it? If you don't wanna "publish" the code

icy beacon
#

i want to solve the problem myself and not try to employ shitgpt that won't even understand my problem

icy beacon
pseudo hazel
#

well asking us is not different

icy beacon
#

you are not shitgpt you have a brain

torn shuttle
#

there is literally no difference between asking here or asking chatgpt

#

for all you know the people answering you are using chatgpt

icy beacon
#

yes there is lol

pseudo hazel
#

skill issue

flint coyote
#

If it gives you a direction and it helps you finding the problem it doesn't really matter if it understood the problem

icy beacon
#

unless you are a language model

torn shuttle
#

and the average person seeking support here is far worse at programming than chatgpt regardless

pseudo hazel
#

ofc I am, we are just way better than chatgpt about things we do know

icy beacon
#

i'm not going to try again

flint coyote
#

Yeah I had those cases, too

pseudo hazel
#

but the things we dont know, πŸ€·β€β™‚οΈ

flint coyote
#

Most of the time actually. But for some things it was useful so when I'm at a dead end I might aswell try

pseudo hazel
#

and you have tried google?

icy beacon
pseudo hazel
#

wtf does that mean

#

no way as in you havent

#

or no way as in you have but there was not solution

icy beacon
#

as in this is the most fucking obvious thing you could've suggested

#

the only worse is "did you try turning it off and then on again"

torn shuttle
#

what a fun thing you're here doing, asking for support and then shitting on the people trying to help you

pseudo hazel
#

it usually works though

icy beacon
#

if you don't go to google first to resolve your problem, you need some other form of help anyway

pseudo hazel
#

yeah I agree

#

but sadly not a lot of people think the same way

flint coyote
#

Alright I have one more idea: Go debug if it's actually the kotlinx library that is serializing your class.
If there's multiple libs that can serialize, they might ignore your annotation when the wrong one is used

torn shuttle
#

chatgpt seems to give a plausible response when I ask it but I don't use kotlin so I am not inclined to fact check if it works

pseudo hazel
#

what does it say then

icy beacon
#

i don't think i did though

#

lemme see

#

wow you're spot on lmao

#

ty i'll fix that

torn shuttle
flint coyote
#

πŸ™Œ

icy beacon
torn shuttle
icy beacon
#

ion need to see all that code

pseudo hazel
#

thats bacause you dont know how to ask

icy beacon
pseudo hazel
#

yes

#

I know

torn shuttle
#

if you want it to explain the code principles behind it instead you can just say that

icy beacon
# torn shuttle if you want it to explain the code principles behind it instead you can just say...

i don't even need that 😭 i know how to use fucking kotlinx serialization. i had a problem that looked like a bug, which is a field with @Transient being serialized (and fields with @Transient are NOT supposed to be serialized and there's NOTHING in the docs that says that there is any case under which it would be serialized). for chatgpt to properly point out my problem, i'd have to specify that i'm using ktor, which i could, but obviously it wouldn't be my first idea, because at first glance the problem seems to be inside of kotlinx.serialization and not the fact that i commented out one singular line in my serialization configurtaion

tardy delta
#

why do you have Since on a transient field?

icy beacon
#

my Since is my own annotation

#

just to show in which version of my plugin i added some field/variable

#

not some lib's annotation

torn shuttle
icy beacon
#

quite literally this

torn shuttle
#

or given you debug steps

quaint mantle
#

Bungeecord permissions can be set when joining a server with a PermissionAttachment?

torn shuttle
#

chatgpt has a 130k context size

tardy delta
#

why does it have a default value lol

icy beacon
#

xd

torn shuttle
#

you can probably feed it your entire plugin and it won't blink

#

though it's less if you're on the free version

icy beacon
tardy delta
#

only 130k

torn shuttle
#

and you say it's open source huh

acoustic pendant
#

Why isn't this dealing extra damage?

            Entity entity = e.getEntity();
            if (!(entity instanceof LivingEntity livingEntity))
                return;
            double damage = e.getDamage();
             new BukkitRunnable() {

                    @Override
                    public void run() {
                        if (livingEntity != null && !livingEntity.isDead()) {
                            double additionalDamage = damage * 0.75;
                            livingEntity.damage(additionalDamage, player);

                            System.out.println(livingEntity.getHealth());
                        }
                    }
                }.runTaskLater(plugin, 2);
            }```

Do someone know?
icy beacon
torn shuttle
icy beacon
#

i don't want it to be used soullessly as a means of teaching some ai though

#

i'm not forbidding it

#

i just don't want it

#

am i allowed to not WANT something done with my code?

#

what the actual fuck

torn shuttle
#

yeah so you'll just allow it to do it, but not take any benefits from it doing it

icy beacon
#

copilot is benefitting me

#

i'm not using chatgpt however so i don't want it to also yank my code

flint coyote
#

but I would suggest you just use .setDamage() instead

torn shuttle
#

chatgpt has definitely yanked code from github in the past and it will definitely do it again in the future

acoustic pendant
#

can do that

tardy delta
#

and use the scheduler instead of creating random bukkitrunnables :|

icy beacon
torn shuttle
#

brilliant attitude

icy beacon
#

something wrong?

tardy delta
torn shuttle
#

not at all, I think it completely befits you

icy beacon
tardy delta
#

163 results on "scheduler"

torn shuttle
flint coyote
tardy delta
flint coyote
#

Although it does mention the scheduler

tardy delta
#

on the bottom

#

πŸŽ‰

torn shuttle
#

hm does intellij have any kind of ai refactoring for stuff like this

#

it's definitely possible to do

tardy delta
#

extract function maybe?

#

wouldnt know

torn shuttle
#

I mean project wide

#

actually it might be possible just with a find replace no?

tardy delta
#

regex maybe

torn shuttle
#

ah no the format is too different for a simple fix

#

I do it 106 times in my project lol

tardy delta
#

how cruel

torn shuttle
#

I use schedule 17 times

pseudo hazel
#

i have static functions to schedule tasks in my plugin class khajiit

torn shuttle
#

I maxed out the rowing machine today, shit's heavy

flint coyote
#

Thanks for reminding me to drink my protein shake

flint coyote
pseudo hazel
#

why is that

tardy delta
#

doesnt aikars taskchain have that?

flint coyote
#

possibly, never heard of it

pseudo hazel
#

why use an extra library

#

who is aikar

#

so many questions

tardy delta
#

that acf dude

icy beacon
#

or that startup flags dude

pseudo hazel
#

youre acting like I know things

icy beacon
#

he did quite a lot of things

icy beacon
pseudo hazel
#

oh acf is for commands

topaz cape
pseudo hazel
#

I like making my own things so yesh I never really look for libraries unless I need something I cant be arsed to do myself like packetevents

#

how does folia support even work

small current
#

Hello
this code is in 1.19.4 ServerPlayer

    protected void defineSynchedData() {
        super.defineSynchedData();
        this.entityData.define(DATA_PLAYER_ABSORPTION_ID, 0.0F);
        this.entityData.define(DATA_SCORE_ID, 0);
        this.entityData.define(DATA_PLAYER_MODE_CUSTOMISATION, (byte)0);
        this.entityData.define(DATA_PLAYER_MAIN_HAND, (byte)1);
        this.entityData.define(DATA_SHOULDER_LEFT, new CompoundTag());
        this.entityData.define(DATA_SHOULDER_RIGHT, new CompoundTag());
    }

in https://wiki.vg/Entity_metadata#Living_Entity, i can't find the index for DATA_PLAYER_MODE_CUSTOMISATION. is it the same thing as skin parts?

topaz cape
#

a whole diff scheduler

pseudo hazel
#

oh then im in luck

torn shuttle
#

a folia scheduler I guess

topaz cape
#

there is no "sync" in there

flint coyote
#

folia support is likely a pain either way

topaz cape
#

there is no "ticks" for delay, they use TimeUnit

tardy delta
#

is folia that regionized ticking thing?

torn shuttle
#

yeah I don't really care to support folia tbh

#

there's so much behavior that would be questionable it's not even funny

pseudo hazel
#

seems like once again static is the way to go πŸ’€

torn shuttle
#

I was thinking about centralizing my scheduler assignment tbh

flint coyote
#

can we not abuse static? :(

pseudo hazel
#

im using static

#

there is a difference

flint coyote
#

there's a slim line between using and abusing static

pseudo hazel
#

the line is how much effort you wanna put in

torn shuttle
#

there's a very wide and generous line between using and abusing static

pseudo hazel
#

too bad that this line is very different for each person

flint coyote
torn shuttle
#

people decrying static abuse end up causing the complete inverse problem where things that should blatantly just be static get overengineered

pseudo hazel
#

yes

astral pilot
#

how do you serialize org.bukkit.Location into ByteArray

flint coyote
#

I don't mind static lib classes - but then pls don't forget the private constructor

torn shuttle
#

that's what I get sonarlint to yell at me for

#

though I might have to find a different one soon, it's been completely glitching out lately

remote swallow
#

sorry

#

BOOS

torn shuttle
#

it's spelled BBNO$

flint coyote
#

and don't make classes that can be instantiated and have a static state.
Looking at you DateFormat / SimpleDateFormat

pseudo hazel
#

lmao

#

99% of my static stuff us just in the plugin class

tardy delta
#

just take a ByteBuffer and write longs and floats to it :/

remote swallow
astral pilot
tardy delta
#

how isnt it straightforward

astral pilot
#

i checked google however it seems like you have to make your own serializable class

quaint mantle
#

could someone help me over at help-server please?

pseudo hazel
#

toString().toByteArray()

astral pilot
tardy delta
#
ByteArray b = new ByteArray() // or smth
b.putLong(world.getUid().getMsb())
b.putLong(world.getUid().getLsb())
b.putFloat(loc.x)
b.putFloat(loc.y)
b.putFloat(loc.z)
b.toBytes()
pseudo hazel
#

idk

torn shuttle
#

is there a better linter than sonarlint ? I've not been keeping up

pseudo hazel
#

what else is there to save besides position and world name

tardy delta
#

nothing

#

save the uuid instead of the name though

pseudo hazel
#

the only ways I have serialized location is by letting the file configuration do it

astral pilot
#

well I just want to save whole Location so its easier to teleport the player back in once the world is loaded again

tardy delta
#

object output stream uses reflection, dunno how it would handle a weakref to a world

#

maybe transient already

#

or does it use ConfigurationSerializable? idk i prefer doing things myself

pseudo hazel
#

it does

#

but iirc it saves the world name

#

not 100% sure though

#

I know it crashes when trying to deserialize when loading a world that doesnt exist

#

and idk how to change that

torn shuttle
#

is anyone keeping up with wg right now, have any idea of how far along into the 1.21 update they are?

#

I'm kinda waiting on them

pseudo hazel
#

wg?

torn shuttle
#

worldguard

pseudo hazel
#

oh

#

idk xD

#

do they not have discord

torn shuttle
#

lmao

#

just checked

#

they released the first beta 2 hours ago

#

perfect because I'm also ready

pseudo hazel
#

lmao nice

mellow edge
#

do buildtools decompile the whole vanilla jar , apply patches, recompile it? if yes, I wonder how they do that without a bunch of errors from decompilation

shadow night
#

Yeah exactly how it works

mellow edge
#

how can that be possible, when I decompile vanilla jar with or without mojang mappings I get a TON and I mean A TON of errors

#

with like 5 different decompilers

shadow night
mellow edge
#

fernflower, vineflower, forgeflower, cfr

shadow night
#

Β―_(ツ)_/Β―

mellow edge
#

also tried with help of enigma

shadow night
#

"decompileCommand": "java -jar BuildData/bin/fernflower.jar -dgs=1 -hdc=0 -asc=1 -udv=0 -rsy=1 -aoa=1 {0} {1}"

#

How buildtools does it

mellow edge
#

where did you find that?

shadow night
#

BuildData repo, info.json

#

Contains decompilation and remapping commands as well as some useful links

mellow edge
#

I still don't get it, it automatically decompiles vanilla jar and applies patches without any errors at all and then simply recompiles it

shadow night
mellow edge
#

I know that decompiling vanilla jars and patching it with my code is useless for the most part because I can use mod and plugin APIs but still I want to do it for myself because using plain fernflower and other decompilers gives you a lot of errors

shadow night
#

Well, look at how buildtools does it and do the same step by step

mellow edge
#

ok

#

I can still use ASM if I give up

twin venture
#

Hi , i need help with the Desirlizer

#

Caused by: java.lang.NullPointerException
at org.yaml.snakeyaml.external.biz.base64Coder.Base64Coder.decodeLines(Base64Coder.java:211) ~[patched_1.8.8.jar:git-PaperSpigot-445]
at org.skywars.api.utils.BukkitSerialization.itemStackArrayFromBase64(BukkitSerialization.java:184) ~[?:?]

hazy parrot
#

First time seeing Gmail for package name xd

twin venture
#

it was not a bug from the class :-:

young knoll
#

We do have to fix a decent amount of decompile errors

mellow edge
#

then @shadow night I don't know exactly what you meant, if they have to fix errors. Buildtools indeed decompile, apply patches, recompile into spigot jar, but if they have to fix errors, there is a step missing or something that I don't understand

young knoll
#

The decompile error fixes are in the patches

atomic niche
#

All the packages for all minecraft plugins were scraped a while ago

hazy parrot
#

What

atomic niche
#

A list of old bukkit plugins with invalid package IDs:

#

gmail, github, etc. are only the start

clear panther
#

i used nms in 1.8 and i got this error
org.bukkit.plugin.InvalidPluginException: java.lang.NoClassDefFoundError: net/minecraft/server/v1_8_R3/NBTBase
at org.bukkit.plugin.java.JavaPluginLoader.loadPlugin(JavaPluginLoader.java:135) ~[spigot.jar:git-Spigot-c3c767f-33d5de3]
at org.bukkit.plugin.SimplePluginManager.loadPlugin(SimplePluginManager.java:329) ~[spigot.jar:git-Spigot-c3c767f-33d5de3]
at org.bukkit.plugin.SimplePluginManager.loadPlugins(SimplePluginManager.java:251) [spigot.jar:git-Spigot-c3c767f-33d5de3]
at org.bukkit.craftbukkit.v1_8_R1.CraftServer.loadPlugins(CraftServer.java:291) [spigot.jar:git-Spigot-c3c767f-33d5de3]
at net.minecraft.server.v1_8_R1.DedicatedServer.init(DedicatedServer.java:152) [spigot.jar:git-Spigot-c3c767f-33d5de3]
at net.minecraft.server.v1_8_R1.MinecraftServer.run(MinecraftServer.java:505) [spigot.jar:git-Spigot-c3c767f-33d5de3]
at java.base/java.lang.Thread.run(Thread.java:833) [?:?]
anyone know how to fix this or something?

wispy junco
#
lol```
chrome beacon
#

Why are you running such an old version ._.

#

If you really have to use 1.8 at least use 1.8.8

wispy junco
young knoll
#

1.8_R3 is 1.8.8

#

But R1 is like 1.8.0

mellow edge
#

so if I understand this is how buildtools work:
1.) they download craftbukkit repo, bukkit repo, builddata repo,
2.) download vanilla jar, copy it into new one, remove META-INF/MOJANGCS.RSA,MOJANGCS.SF files
3.) loads mappings, run some maven?
4.) firstly use specialsource to apply mappings
5.) decompile vanilla jar
6.) apply bukkit patches, those are .patch files that contain fixes, not whole class files
7.) create bukkit jar?
8.) apply spigot patches differently
9.) compile spigot jar

clear panther
young knoll
#

Decompile before remap afaik

clear panther
#

so?

chrome beacon
young knoll
#

Uhh

#

Idk

chrome beacon
#

Sounds like an odd way to go about it

young knoll
#

Can you remap the raw binary files?

wispy junco
# clear panther so?

im sure you can help me to make hosting i also got some custom plugins i've made

mellow edge
#

I think that it firstly applys maps, see:

#

but honestly I didn't know that is possible

#

to first map

#

so in patches you basically fix errors and put bukkit and spigot code?

young knoll
#

Yes

river oracle
#

Pretty sure it's faster to do it that way

young knoll
#

Fair

river oracle
#

I remap the binary for Vineyard

mellow edge
#

maybe it also causes less errors than the other way around but not sure

shadow night
mellow edge
#

props to the guy that created buildtools

blazing ocean
#

raydan

#

no

shadow night
#

It's not made by a single person

blazing ocean
#

please never talk about mappings here

shadow night
#

And it's pretty shit

blazing ocean
#

kekw

shadow night
blazing ocean
#

as long as it's yarn you can talk about it

young knoll
blazing ocean
#

i bet he could

shadow night
shadow night
blazing ocean
#

do it

#

integrate it into the masstester

shadow night
#

lmao

blazing ocean
#

write it in kotlin

dense oracle
shadow night
#

1.8 mojang mappings? Lol

blazing ocean
#

kekw

#

i wish

dense oracle
mellow edge
blazing ocean
#

(i don't use 1.8)

dense oracle
#

what?

blazing ocean
#

they said they use 1.8 .-.

dense oracle
#

oh, im blind x3

blazing ocean
#

and it says that in the logs too..

shadow night
# blazing ocean i wish

I think yarn can be ported to 1.8, mojmaps only theoretically, but could partially be migrated

torn shuttle
#

and done

#

got a public dev build for 1.21

#

beeg

#

yuuge

young knoll
#

Noice

dense oracle
torn shuttle
#

beeg update

young knoll
#

I was able to just CTRL c CTRL v my NMS

torn shuttle
#

look at all them removals

young knoll
#

Granted I don’t have much atm

torn shuttle
#

can you tell I'm doing some spring cleaning lol

river oracle
#

Most updates very little changes

#

Thanks to item components the amount of code I need to maintain went down

pseudo hazel
#

dropping legacy lets go

atomic niche
#

We dropped NMS... it was amazing.

pseudo hazel
#

thats what its all about

#

using mc versions as an excuse to drop legacy bs

atomic niche
#

Even when you are using modern versions though, for anything overly complicated, there are basically two options:

  1. spending countless hours fiddling with nms
  2. spending countless hours trying to get replacements for the nms pr'd upstream.
#

A while ago we suceeded with number two, and were able to abandon our nms implementations

river oracle
#

I love fiddling with nms

#

That's why I make prs :3

mellow edge
river oracle
#

I mean yeah or you can just look on stash

#

He has downloads to latest special sources and special source 2 on there