#help-development

1 messages · Page 1077 of 1

mortal hare
#

it works

mortal hare
#

hmm weird

#

it seems that notchian server only sends Update Registry Data packet when player joins the server, so only Player join event is really needed

#

when you lets say disable a datapack it doesnt send another Registry Data packet to clear the previous data

#

lazy

runic pine
#

How do I make an item not stackable with the same lore/name?

mortal hare
#

but there might be better way rn

#

with customizable stack sizes idk

#

at least that's how it was done in 1.7/1.8 days

viscid carbon
#

^ still the only option

runic pine
#

unique way? @mortal hare

#

idk if uuid.randomuuid.hashcode is safe way

worldly ingot
#

Hash codes are not unique. Two differing UUIDs can have the same hash code

#

You should ideally use the UUID itself. Whether you want to store it as a string, as two longs, or as an array of four ints (like Mojang does), that's up to you

young knoll
young knoll
#

… 128 bits?

runic pine
river oracle
#

why

#

specifically as an int

worldly ingot
#

You need to?

runic pine
#

i using servernpc plugin

#

and api requires a int as id

slender elbow
#

xd

runic pine
#

i need relate the npc with a player

river oracle
#

1.8 problems man

runic pine
#

There is nothing to do because int is 32 bytes and uuid 128

young knoll
#

Couldn’t you use the players entity id

worldly ingot
#

Depends on whether or not it's temporary because the player's entity id will change when they relog

young knoll
#

Or does this need to be persistent

cinder abyss
#

Hello, do you think thatt would be possible adapting fabric api to run on spigot ?

chrome beacon
#

Could just use Citizens

worldly ingot
#

Both

young knoll
#

I mean, why does the NPC id need to be persistent

chrome beacon
#

See cardboard

young knoll
#

Couldn’t you just spawn a new NPC when the player logs in

runic pine
#

If it's a relog, I can't use this method because it's basically a sleeper system. If the player leaves, I create an NPC (ZzZzZz..) and when he enters, the NPC disappears.

cinder abyss
chrome beacon
#

Doing it as a plugin won't work very well due to how late they load

young knoll
#

I would just map the players uuid to the integer NPC id

#

You can then save that wherever as well

worldly ingot
cinder abyss
worldly ingot
#

Was going to suggest Coll's approach as well

#

The NPC's id doesn't really matter at all, it's just a unique identifier for the duration of the server. But it doesn't necessarily have to map to the player in some way

#

There's nothing stopping you from doing a Map<UUID, Integer> for instance

runic pine
#

only int

young knoll
#

… yea

#

Did you read the message you replied to

#

Map the uuid to an integer for the NPC

slender elbow
#

but coll

runic pine
slender elbow
#

the method takes an int

runic pine
worldly ingot
#

Just some arbitrary entity id. You could make a static integer that just increments each time you make an NPC

young knoll
#

You can just store a counter and increment it to get the next id

worldly ingot
#

The NPC's id is pretty meaningless and not persistent

young knoll
#

You can also save this wherever

worldly ingot
#

It's just temporary for the server's lifetime

runic pine
worldly ingot
#

It could be 5 in one instance but when the server restarts it might be 34

#

Okay, so 👀 You can either pull that from the server, or just make it some arbitrarily high number that won't get hit by the entity counter

#

There's a static method in (NMS) Entity I believe

#

getNextEntityId() or something

young knoll
#

Don’t you work with 1.8 now

#

You should know this!

runic pine
#

ok thx

worldly ingot
#

I don't have a eidetic memory of the entire server's code! :(

#

Over like 14 versions no less!

young knoll
#

Why not!

livid dove
#

I can recite all the code, off by heart, really fast.....

#

...

#

Wanna see me do it again?

worldly ingot
#

fuck that was impressive

plucky rock
#

  <repositories>
      <repository>
          <id>md_5-public</id>
          <url>https://repo.md-5.net/content/groups/public/</url>
      </repository>
      <repository>
          <id>sonatype</id>
          <url>https://oss.sonatype.org/content/groups/public/</url>
      </repository>
      <repository>
          <id>papermc-repo</id>
          <url>https://repo.papermc.io/repository/maven-public/</url>
      </repository>
      <repository>
          <id>spigot-repo</id>
          <url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
      </repository>


  </repositories>

  <dependencies>
      <dependency>
          <groupId>io.papermc.paper</groupId>
          <artifactId>paper-api</artifactId>
          <version>1.20.4-R0.1-SNAPSHOT</version>
          <scope>provided</scope>
      </dependency>
      <dependency>
          <groupId>LibsDisguises</groupId>
          <artifactId>LibsDisguises</artifactId>
          <version>10.0.21</version>
          <scope>provided</scope>
      </dependency>
      <dependency>
          <groupId>org.spigotmc</groupId>
          <artifactId>spigot-api</artifactId>
          <version>1.20.6-R0.1-SNAPSHOT</version>
          <scope>provided</scope>
      </dependency>


  </dependencies>
``` this is my pom.xml for repo and dependancys why do i get this error
#
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.268 s
[INFO] Finished at: 2024-07-24T16:29:04-07:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project RogueLonk: Could not resolve dependencies for project org:RogueLonk:jar:1.0-SNAPSHOT: The following artifacts could not be resolved: org.spigotmc:spigot:jar:1.16.1-R0.1-SNAPSHOT (absent): org.spigotmc:spigot:jar:1.16.1-R0.1-SNAPSHOT was not found in https://repo.md-5.net/content/groups/public/ during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of md_5-public has elapsed or updates are forced -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException```
#

i dont see a spigot 1.16.1 anywhere

young knoll
#

Might be a transitive dependency of libsdisguise

#

Also wtf paper and spigot api

livid dove
#

Man's poke pokemoning apis

#

Also funnily enough was just looking into libe earlier. I can quickly check the repo what version is itM

#

On phone so reading code outside paste bin hurts

plucky rock
young knoll
#

You can only use one

torn shuttle
#

(which is not to say there's not scenarios where using both might make sense)

slender elbow
#

yeah...

plucky rock
#

i needed spigot for yaml cause i dont think paper has it

torn shuttle
#

but then you're talking about platform dependent code

plucky rock
#

builtin yaml decoding

young knoll
#

Pretty sure paper still has yaml

livid dove
young knoll
#

Idk maybe @slender elbow ate it

plucky rock
#

ill look into it

torn shuttle
#

I did something similar at one point where I used paper's pathfinding api for a feature

#

I've since cooked my own

#

it was mostly just an early testing thing

livid dove
torn shuttle
#

the numbers keep going up

livid dove
torn shuttle
#

I do not like working on commands

#

yeah I heard about that one too, people have been asking me if I'm going to make my stuff compatible with that

livid dove
young knoll
#

Didn’t they drop that in like

#

A year ago

torn shuttle
#

not basically

#

that's exactly what I am doing right now

livid dove
torn shuttle
#

it's just this plugin was depending on cloudcommandframework

#

and I don't want that anymore

livid dove
#

Ooft

#

Well if it makes you feel better the moronic idea I'm trying once ingot my new pc running is making an XML markup for inventory menu creation, with the ultimate goal of making a "scene builder" like app so you can essentially make inv menus in the same way you can make JavaFX UI's

torn shuttle
#

lol

#

yeah let's not

livid dove
#

You can't stop my inner moron sir 🤣

torn shuttle
#

well it could be worse

#

it could be json

livid dove
#

Errr

#

Brother

#

Errrr

runic pine
#

basically when creating an npc (when the player leaves) it adds player.getuniqueid and player.getentityid as keys and also puts the key and value in the database. let's imagine that someone clicks on the npc (the npc is deleted from the cache and db of the npc plugin and removed from map<uuid,int id> and the corresponding database). Then if the player enters I will get the NPC from Map<UUID, int id> if there is one and if there isn't one I will get it from the database. if there isn't one in both, I deduce that someone clicked on the sleeping npc.

humble tulip
#

why don't you use entity uuid instead of entity id

runic pine
humble tulip
#

since entity uuids persist restarts

runic pine
humble tulip
#

Hold on let me read what you sent and try to understand

runic pine
humble tulip
#

Basically when players leave the server, you want to leave a sleeping npc behind until they rejoin?

#

And when someone clicks the sleeping npc it's removed?

runic pine
humble tulip
#

ah okay

runic pine
#

So what if the player enters and there is no sleeping NPC, it means they killed him and I have to clear the inventory

humble tulip
#

So the id that npc takes is irrelevant. Just give it the nextentityid from the nms method

#

You're gonna want a Map<UUID, UUID>

#

first uuid is player uuid second is npc

humble tulip
#

you may use a bimap

runic pine
livid dove
#

I swear you had this discussion like 10 mins ago lol

humble tulip
#

Sorry i did not read above

#

gonna just have a look myelf and will get back

livid dove
#

Oh nah its not u minion haha

humble tulip
#

ohhh heyy

#

i rem you

#

nbt stuff guy

livid dove
#

Lemme have a read right quick.

But to dumb all this stuff down, you wanna do rust yeah?

livid dove
humble tulip
runic pine
humble tulip
#

znpcs?

inner mulch
#

guys can you create npcs without packets?

river oracle
#

I miss you presence

humble tulip
#

OHHH you're using a lib

#

okay go on and do what you must

remote swallow
#

;

humble tulip
#

personally, i wouldnt use a lib for this but if you are

remote swallow
river oracle
livid dove
# river oracle whatever happened to you
  • 2 lecturers are work quit so my workload increased

  • Got 2 months wasted on SW (never take work with em, the cash just ain't worth it)

  • Had a cheeky menty B in April ish

  • Been so broke I sold my 2k pc for 200 quid due to loans + the aformentioned SW waste of time.

remote swallow
#

(whats sw)

#

also you sold a 2 grand pc for 200?!?

livid dove
#

Stoneworks

slender elbow
young knoll
#

South Wamerica

livid dove
humble tulip
#

damn

young knoll
#

On the bright side it’s only July

humble tulip
#

ok

young knoll
#

… on the less bright side it’s only July

humble tulip
#

i shall not laugh

remote swallow
#

july doesnt really mean anything atm

livid dove
#

Fuck that I'm laughing and it's 1am where I am rn

remote swallow
#

its been so wet it doesnt even feel anywhere near summer

remote swallow
livid dove
#

That's wild. It's also free healthcare o clock where i am

young knoll
#

It’s always wet

remote swallow
#

holy shit i get free healthcare o clock too

remote swallow
young knoll
#

Moist

livid dove
#

But yeah back to the poor Rust guy...

Why doesn't he just save the UUID of the player with the location of the NPC into the DB, create the NPC onEnable, and then just a map<UUID, UUID> that's initialised onEnable via the database rows?

#

If the npc is killed, mark it as dead in the DB, when the player logs in wipe inventory, delete row in db, bobs your uncles monkey

#

That way the db is literally one table that's UUID, x,y,z world, boolean for if its dead or alive

#

No npc int id shenanigans

#

Required

livid dove
livid dove
#

Unless some nutter logs off on top of another player..m

young knoll
#

It doesn’t need to be unique

livid dove
#

^

runic pine
livid dove
remote swallow
livid dove
#

And as coll says, it doesn't need to be.

So they log off same place? Cool... onEnable both npcs would spawn in that chunk

runic pine
#

I have to take care of all cases. The way I said is better to save the player's ID but I will not use player#getentityid but instead increment it myself

young knoll
#

They were roommates!

runic pine
#

Are you talking about this so you don't have to use the NPC lib? I only just understood that now

livid dove
#

Fair warning though I'm pretty sure this will cause some hefty ram usage based on chunks not deloading as the npcs would be referenced?

young knoll
#

Only their id should be referenced

livid dove
#

True but even then depending on its source... chunks... chunks are weird (seen several plugins really struggling tk get worlds, let alone chunks) to de load due to GC reference shenanigans

hard radish
#

?paste

undone axleBOT
livid dove
# runic pine Wdym

Entities are tied to worldsz so if entities are still loaded in memory, or fields referenced from an entity, then chunks have a tendency not to unload, its... its weirdm

hard radish
livid dove
#

When you say don't broadcast anything..m are you within 10 blocks?

#

Wait... String Value of a list of players? Am I reading that right or is 1:30 am brain got me?

kind hatch
#

Malfunctioning brain

#

But is anything within your 10 block radius?

hard radish
#

yes im on top of my textdisplay entities

#

other listeners can detect the textdisplay entites and armorstand

#

but only this one cannot

kind hatch
#

Have you confirmed the method works for display entities in another method?

hard radish
#

i have experimented with using just a command and it will display the entities within 10 blocks but for some reason inside this class this method doesnt work

#

yes

#

i also tried a listener class (playertogglesneaklistener) and it was broadcasting the entities as well

#

it might be a packetevents listener problem but i dont see why that could be a problem

runic pine
hard radish
#

it shouldnt be a list of players, its just the packetevent listener's event.getplayer basically but using packetevent api way of doing it lmk if i have errors.

kind hatch
#

Might need to be double the size.

hard radish
#

line 148 has the double

kind hatch
#

Also, not sure how it goes about detecting the entities, but display entities have no hitbox, so you might not be able to find them easily.

hard radish
#

i tried it with line 150 and it doesnt broadcast too

kind hatch
#

java.lang.IllegalStateException: Asynchronous getNearbyEntities!

hard radish
kind hatch
#

Don't do it async

young knoll
#

The 1 in the raytrace should expand their hitbox first

#

Which allows them to be detected

maiden geode
#

Hi, I'm not sure if spigotmc is a correct place to ask this question but maybe someone had the same issue.
Currently I'm working on a plugin which uses a custom world (Environment Nether), on my localhost everything is fine but whenever I start the VPS server (with exactly same files) it changes the environment of the world to normal and holograms are disappearing (it's "FancyHolograms" plugin if it matters). The plugin is checking whether the world exists and if not, it should create it and apply nether env. The host is Hetzner

torn shuttle
#

I'm having a lot of fun today

river oracle
#

@wet breach you were right making a classloader ain't half bad

river oracle
#

doing the merge class path stuff wasn't horrible either

#

just an easy boolean

#

now its time to make an algorithm to detect circular dependencies

#

lord save me

quaint mantle
#

In the protocol, when a player joins do they default to not be sprinting and them immediately send a Player command packet to start sprinting or can they join and sprint immeditly without sending a packet

inner mulch
#

they shouldnt be able to sprint without sending a packet

tender shard
#

why te hell does it think the middle "to" function is different to the block below o0

wet breach
#

Or two maps so you can show association or whatever.

#

As a precaution have like a timer that ends the checking if it takes longer then 5 minutes or something

#

In the event your checking is flawed somehow it will at least stop lol

floral drum
# tender shard

is there a significant difference between IFriendshipManager and IFriendsPayloadListener?

#

except by methods ofc

hybrid fable
#

Anyone who can help me replace blocks with worldedit api?

#

I got this atm:

        BlockVector3 pos1 = BlockVector3.at(-75.5, -40, 75.5);
        BlockVector3 pos2 = BlockVector3.at(75.5, -64, -75.5);
        try (EditSession editSession = Fawe.instance().getWorldEdit().newEditSession((com.sk89q.worldedit.world.World) Bukkit.getWorld("world"))) {
            
            Region region = new CuboidRegion(pos1, pos2);
            
            BlockType from = BlockTypes.SANDSTONE;
            BlockType to = BlockTypes.AIR;
        }
    }```
floral drum
#

first of all, that is not how you create the edit session by casting a bukkit world to a worldedit world

floral drum
#

for example

hybrid fable
#

yes got it

#

but now i dont know like how to replace it xd

humble tulip
#

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

torn shuttle
#

number go up

orchid trout
#

wowza

echo basalt
torn shuttle
echo basalt
#

less modified more added smh

torn shuttle
#

more deleted

#

modified became deleted

echo basalt
#

my gamemode branch at work has like triple the lines of code at main skullWazowski

#

pr about to go wacky

torn shuttle
#

man

#

the worst part is that this isn't even close to done

echo basalt
#

we got like 80 commits on main and my work branch has like 250

#

💪

torn shuttle
#

I have to redo all of the imports system as well

#

for all of my plugins

echo basalt
#

rip

torn shuttle
#

also all of the setup process

echo basalt
#

meanwhile I'm tryna figure out where I left my placeholderapi code on my minigame core

torn shuttle
#

have you checked inside your butt

echo basalt
#

ah yes lemme look in there

echo basalt
#

ok bro

torn shuttle
#

seriously is there anything duller than writing commands

#

I'm not sure there is

echo basalt
#

writing menus

nova notch
#

tweaking control points for bezier curves for an hour

#

change a number, restart, look at particles, repeat 200x

summer scroll
#

I have my own chat formatter and for some reason whenever I type just like percentage % it gives me UnknownFormatConversionException, how can I solve this?
https://paste.md-5.net/ofawavowof.cs

#

The format that I'm trying to set is at the top of the message.

summer scroll
agile anvil
#

It seems you already formatted the message. Why not using event.setMessage?

summer scroll
agile anvil
#

So you have to separate setFormat and setMessage

#

Or cancel the event and manually send format to everyplayer

summer scroll
#

I basically do what LPC is currently doing.

agile anvil
#

setFormat takes two placeholders

#

%s: %s

summer scroll
#

Ah, looking at the LPC source code, they replace % with %%

agile anvil
#

the first %s will be replaced by player name and the second with the message

agile anvil
summer scroll
#

Ah got it, it's basically like String.format right?

#

That seems to have solve the issue, thanks for the help!

sterile breach
#

Hey I am trying to a get something from async in main thread
I have don that but it don't wait the result how I can wait the result?

                        Entity entity = null;
                        BukkitTask bukkitTask = Bukkit.getScheduler().runTask(plugin, new Runnable() {
                            @Override
                            public void run() {
                                for (Entity e : p1.getNearbyEntities(50, 50, 50)) {
                                    if (e.getEntityId() == packet.getEntityId()) {
                                        entity = e;
                                        break;
                                    }
                                }
                            }
                        });
tardy delta
#

just have a callback, or return a future of some sort

blazing ocean
#

completable futures my beloved

#

(or coroutines)

echo basalt
#

withTimeout my beloved

polar topaz
#

it seems to be impossible to kick a join in response to a cookie at the moment?

    @org.bukkit.event.EventHandler
    public void onPlayerLogin(PlayerLoginEvent event) {
        var player = event.getPlayer();

        player.retrieveCookie(new NamespacedKey("josie", "transfer")).thenAccept((cookie) -> {
            // It seems the cookies are guaranteed to be received in the gap between PlayerLoginEvent
            // and PlayerJoinEvent, but there is no publicly-exposed way to kick the player at this point

            // doesn't work because the event has already been consumed
            event.disallow(PlayerLoginEvent.Result.KICK_OTHER, MiniMessage.miniMessage().deserialize("JWT signature invalid"));
            // doesn't work (and fails silently!) because https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/browse/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java?at=2c547495242ddc8019d8cbd4358bac90f6954659#480
            player.kick();

            // The fate is sealed at this point, the user will be let in the server
            // It would be perfectly valid in the minecraft protocol to send a disconnect
            // during this part of the configuration phase, but the API doesn't allow it
        });
    }
#

comments in the code have more info about the problem I'm running into

Edit: for anyone searching this discord for information -- yes, the cookie-based kicking issue is fixed now, using the same workaround I ended up patching into papermc manually (not ignoring kicks triggered during login phase) https://hub.spigotmc.org/jira/browse/SPIGOT-7876

torn shuttle
#

anyone remember off the top of their heads what the max resource size is in spigot

echo basalt
#

4mb

sterile breach
# blazing ocean completable futures my beloved

What mistake I did? completable future is never called

                        CompletableFuture<UUID> completableFuture = new CompletableFuture().thenAccept((id) -> {
                            System.out.println("1");
                            Player p1 = Bukkit.getPlayer((UUID) id);
                            RayTraceResult rayTraceResult = p1.rayTraceBlocks(4);
                            Entity entity = rayTraceResult.getHitEntity();
                            System.out.println(entity.getName());
                            if (entity instanceof Player p2) {
                                p1.sendMessage("test2");
                                ModInventory.action(p1.getItemInUse(), new PlayerInteraction(p1, p2));
                                System.out.println("bb");
                            } else {
                                p1.sendMessage("test");
                                ModInventory.action(p1.getItemInUse(), new PlayerInteraction(p1, null));
                                System.out.println("cc");
                            }


                        });
                        Bukkit.getScheduler().runTask(plugin, new Runnable() {
                            @Override
                            public void run() {
                                    completableFuture.complete(pid);
                            }
                        });

torn shuttle
#

4mb?

#

jeez

#

well

#

yeah I'm nowhere near

echo basalt
#

how close

torn shuttle
#

8.86

echo basalt
#

lil compression

#

minimize

torn shuttle
#

don't think it will matter anyway

#

a big part of it are the translation files

#

and those probably can't be compressed

#

yeah it's cooked

#

it's fine, was just wondering if moving away from cloudcommandframework would do the trick, guess not

echo basalt
#

what other obvious libs

torn shuttle
#

doesn't even really matter

echo basalt
#

Kotlin

#

my guy

torn shuttle
#

the top two are all me

#

oh why is that still in there

#

I deleted that

echo basalt
#

javax should also go

torn shuttle
#

I didn't even add it in the first place I smashed my keyboard so badly at one point it injected it into my project

echo basalt
#

javassist is also a sketchy one

#

if you're using lombok don't shade it

torn shuttle
#

reflections

echo basalt
#

bytebuddy my beloved

torn shuttle
#

eh

#

I might

echo basalt
#

maybe minimize it?

torn shuttle
#

I might switch out of javassist just because it has gotten such a bad rep

#

wait why do I have apache commons in two places

#

oh huh

#

seems like it's intentional, weird

barren fulcrum
#

haiiii! vault thingy seems to be not working,

        <groupId>com.github.MilkBowl</groupId>
        <artifactId>VaultAPI</artifactId>
        <version>1.7</version>
        <scope>provided</scope>
    </dependency>```
can anyone help?
rough ibex
#

do you have the repository

sterile breach
#

I am trying to get entity player look but entity is null ( yes I am looking an entity) I did i mistake in the code?

RayTraceResult rayTraceResult = p1.rayTraceBlocks(10);
Entity entity = rayTraceResult.getHitEntity();

mortal hare
#

am i the only who thinks multiversion support like this is just dumb?

#

why make more clunky code trying to support all versions instead of supporting specific version properly and porting things back (making version specific jars instead)

#

imagine if minecraft introduced some breakchanging code that cannot be expressed with current abstractions for a specific version of the game, but for all other versions of the game

#

sure you can fix it, but then it makes your code bloated af

proud badge
#

Is FireworkEffect.withColor stackable or nah?

#

Or if I want multiple colours do I have to make multiple FireworkEffect objects

rough ibex
pseudo hazel
#

yeah I dont like that at all

#

its fine if its other jars, but all versions in the same jar is just cursed to me xD

hybrid spoke
#

rather have everything in one jar and call it backwards compatible instead of having to maintain multiple jars

#

you typically have different modules for each version which you can just inject into your core and use the specific code for whatever you are doing

#

with your approach of having multiple jars for multiple versions you break that and in worst case have to maintain multiple projects

mortal hare
hybrid spoke
#

that happens with every release

#

you just have to hope to be lucky enough that they didnt change something at the code you are using

mortal hare
#

i mean in a way that your interfaces cant abstract the NMS away compatible with other versions anymore

hybrid spoke
#

in what scenario would that happen

#

that your abstraction is not enough anymore

mortal hare
#

lets say they revamp functionality how it works and there's new data being attached and old data is gone or not important anymore and you cant substitute it old interfaces anymore

hybrid spoke
#

you abstract the nms shit for your project, so you would have to do internal changes or extensions yourself to outplay your own abstraction

hybrid spoke
#

but typically you wrap it

#

so your interface is untouched, the only thing you would have to adapt is the wrapper

#

and if the changes are too blatant you can turn your wrapper into a basewrapper and split it in 2

undone yarrow
#

Anyone know if it's possible to change the mountheight of an armorstand or (Citizens) NPC? Trying to make vehicles, though I need to change the mount height. I have tried everything I can think of to no prevail

#

Right now I mount the player on top of an armorstand that's mounted on the npc. I thought it was possible to rotate/move the armorstand (And therefore the player as well) bcs someone told me that was possible. They didn't say how and I can't find any answer

hybrid spoke
#

what exactly are you trying to do and what have you tried so far?

undone yarrow
#

isn't that included in my msg?

#

Trying to make vehicles, though I need to change the mount height.

#

so, the player gets mounted at different heights...?

hybrid turret
#

i cant really find a good answer online tbh so imma ask here.

i have a table GUIOptions with the cols: action and option
where action is a key (command like ban or kick) and option is any string (pre-defined reasons for example for banning).

I want to cache this table in a ServerData object containing a Map<String, List<String>>.

How do I convert the table to the HashMap?

#

Example of the table content:

id,action,option
33,ban,This is a valid reason for a ban!
34,ban,This is a valid reason for a ban!_1
35,ban,This is a valid reason for a ban!_2
36,ban,This is a valid reason for a ban!_3
37,ban,This is a valid reason for a ban!_4
38,ban,This is a valid reason for a ban!_5
39,kick,This is a valid reason for a kick!
40,kick,This is a valid reason for a kick!_1
41,kick,This is a valid reason for a kick!_2
42,kick,This is a valid reason for a kick!_3
43,kick,This is a valid reason for a kick!_4
44,kick,This is a valid reason for a kick!_5
hybrid spoke
#

what exactly are you trying to do technologically to achieve that

#

what have you tried technologically to achieve that

#

what did not work with it

#

what do you wish for

#
  • code
hybrid turret
#

sqlite

#

but what difference does this make?

undone yarrow
# hybrid spoke what exactly are you trying to do technologically to achieve that

I'm using a different scripting language (a plugin based on java, called denizen), and it basically does everything java does. I was just wondering what things/concepts I could try, instead of asking for code. As of now I tried translating item/block displays, and mounting those. The player doesn't get translated the same way though, so that doesn't work.

drowsy helm
#

Are you using an orm or you want to manually parse jt?

undone yarrow
#

I thought of using different entities to mount, though that's not very accurate for mountheight, plus other entity NPCs don't automatically step over blocks which sucks. player npcs do work

hybrid spoke
hybrid turret
#

yea that's what i'm meaning to do

drowsy helm
#

You can just group by action then iterate over each

hybrid turret
#

i do have a method already but this one only gets the first entry lol

hybrid spoke
#

show us

hybrid turret
#

?paste

undone axleBOT
undone yarrow
#

1.20.4

#

Will update as soon as we can

hybrid spoke
#

you could use slimes

hybrid turret
#

dont laugh if it's too stupid lmaoo

#

why tf does it say js?

hybrid spoke
hybrid turret
#

whatever

hybrid turret
#

js

hybrid spoke
# hybrid turret https://paste.md-5.net/satopufewa.js
public Map<String, List<String>> getAllGUIOptions() throws SQLException {
    String url = "jdbc:sqlite:path_to_your_database.db"; // replace with your database URL
    String sql = "SELECT action, option FROM GUIOptions ORDER BY action DESC;";

    Connection connection = DriverManager.getConnection(url);
    Statement statement = connection.createStatement();

    Map<String, List<String>> allGuiOptions = new HashMap<>();

    ResultSet resultSet = statement.executeQuery(sql);

    while (resultSet.next()) {
        String action = resultSet.getString("action");
        String option = resultSet.getString("option");

        // Get the list of options for the current action or create a new one if it doesn't exist
        List<String> options = allGuiOptions.getOrDefault(action, new ArrayList<>());

        // Add the current option to the list
        options.add(option);

        // Put the updated list back into the map
        allGuiOptions.put(action, options);
    }

    statement.close();
    connection.close();

    return allGuiOptions;
}

thats what chatgpt gave me

hybrid turret
#

LOL

#

tbh guess i'll try it

hybrid spoke
hybrid turret
#

lol that worked. i should use chatgpt more ig

#

especially since i do have the paid model lmao

hybrid spoke
#

chatgpt for advice, gemini for visions

hybrid turret
#

did you feed it the code first or just tell it the variable names?

undone yarrow
hybrid turret
#

like "here's some code, make it work"

hybrid spoke
#

i just straight up copied everything you told us and fed it to gpt

hybrid turret
#

lol

#

fair enough, thanks

hybrid spoke
hybrid turret
#

yeah my brother got it and lets me use it for free

#

what's the big difference between the unpaid and paid model?

hybrid spoke
#

early access

hybrid turret
#

i mean duh

hybrid spoke
#

and you somehow can use plugins but idk where

hybrid turret
#

oh you cant in the normal GPT4?

#

damn

hybrid spoke
#

yeah and image generation and shit

hybrid turret
hybrid turret
#

whaa

hybrid spoke
#

didnt knew about that

hybrid spoke
#

they dont have DALL-E integrated

hybrid turret
#

it can for me (when i chose GPT-4)

hybrid spoke
#

yes but you have the paid-plan lmao

#

obv you have DALL-E

hybrid turret
#

i mean

hybrid spoke
#

regardless of the gpt you use

hybrid turret
#

i thought GPT-4 went free and GPT-4o came out as the paid version

#

i didn't know that (it shows i'm not the one paying lmao)

hybrid spoke
#

nah gpt4o is just more advanced with more data and can even recognize images and voices and stuff

#

and search the web iirc

hybrid turret
#

ohhhhhhhh

hybrid spoke
hybrid turret
#

ic

#

lol nice

worn tundra
#

Any clue why doesn't Bukkit#craftItem nor Bukkit#craftItemResult modify the passed itemstack array? Not even in ItemCraftResult#getResultingMatrix?

The returned result item or recipe is correct, but both arrays are same (items aren't taken away). Here's an example of a crafting grid before crafting a button and after:

#

maybe I'm missing smth in the docs

tardy delta
worn tundra
# tardy delta

tbh hard to know what the further down methods do without more context

#

in the docs this is mentioned under getCraftingRecipe

sullen belfry
#

can someone help me figure out how im able to add world guard support to my plugins so my plugins don't override any other plugins such as world guard?

chrome beacon
#

Does depend on what you're doing

#

but you can hook the WorldGuard API

sullen belfry
tardy delta
sullen belfry
#

@chrome beacon I can't seem to find the API version anywhere

proud badge
#

Does anyone see what the issue is? I refreshed my build.gradle however the protocollib classes are still unknown

chrome beacon
sullen belfry
#

alright thanks

slender elbow
#

nice

west orbit
#

any idea why i cant drag the plugin to my plugins folder sometimes while the server is running?

#

used to be able to do it before, but just randomly asks for admin perms sometimes

dusty herald
#

is the server online?

proud badge
#

yes

west orbit
#

yes it is

dusty herald
#

try turning it offline

#

then try

west orbit
#

yeah while offline it works, but i was wondering if there was a way to do it while online? usually i just do /reload so it reloads the plugin

chrome beacon
#

are you trying to replace a jar that's in use

west orbit
#

and then it works fine, but suddenly it stopped letting me

eternal oxide
#

Don't replace jars with the server running

proud badge
#

new issue: the packet listener does not fire when the packet is fired (the consturctor is being fired)

eternal oxide
#

its unsafe

drowsy helm
west orbit
rapid nexus
#

what is damage type of player.damage()?

dusty herald
drowsy helm
#

If you REALLY need to, you can write a batch script which will override it

dusty herald
#

nah fuck that

#

be safe

west orbit
#

all good though, thanks for the answers

dusty herald
#

Turn the server offline then try deleting it, should work fine then

drowsy helm
#

Protocol lib sucks ass

eternal oxide
#

you are confusing using "offline"

proud badge
#

Packet events?

dusty herald
proud badge
#

how would I use packet events

dusty herald
#

@alpine urchin ^^

proud badge
#

or do you mean normal events

drowsy helm
#

By retrooper

dusty herald
alpine urchin
drowsy helm
#

It’s the go to now for cool people

dusty herald
#

PacketEvents is great when it works

river oracle
alpine urchin
#

guide WIP but should be enough for basics

proud badge
#

do I need to install the packetevents plugin on my server for plugins having packetevents to work

dusty herald
#

Nope :D

#

You could but you don't have to

alpine urchin
#

advised but not necessary

drowsy helm
#

You can shade it aswell

dusty herald
#

I like to just download the source files and drag and drop it into my project /s

quaint mantle
#

Does PlayerDeathEvent.getEntity() return Damager?

shadow night
dusty herald
river oracle
#

The same

alpine urchin
#

it misbehaves

#

its a bad boyy

drowsy helm
#

Repooper is here

#

He knows

dusty herald
#

Do some reading @quaint mantle

shadow night
#

how does it work when shaded my brain ain't understand

river oracle
#

Literally the same probably

#

You probably have to call a setup method

hard socket
#

how can I remove the slowness effect from honey and cobwebs

alpine urchin
#

very vague question, but if your plugins all depend on one instance, then everything is encoded once

quaint mantle
dusty herald
#

It's crazy how getEntity returns... an Entity...

alpine urchin
#

(saving performance)

quaint mantle
#

Attacker or Victim?

alpine urchin
#

yes

chrome beacon
dusty herald
#

That makes no sense it'd be the player that died.

chrome beacon
#

There doesn't have to be an attacker for a player to die

alpine urchin
#

the server attacked him

#

rip

#

. /j

dusty herald
#

All your questions are answered by reading the Docs™️

proud badge
#

ok whats the issue? com.github.retrooper is invalid (i refreshed)

quaint mantle
#

I need a event which can call attacker and victim and can be called when player death

dusty herald
quaint mantle
proud badge
#

yes

quaint mantle
#

I need attacker too

dusty herald
#

For handling player death events in SpigotMC, you can use the PlayerDeathEvent. This event is called when a player dies, and it allows you to get information about the death, including the player (victim), the cause, and the drops. You can also set the death message and control whether the player keeps their inventory or experience.

You can find the documentation for the PlayerDeathEvent in the SpigotMC API docs. Here’s the link to the documentation: https://hub.spigotmc.org/javadocs/bukkit/org/bukkit/event/entity/PlayerDeathEvent.html#getEntity(). This should provide you with all the information you need to handle player deaths in your plugin.

#

To get the attacker in a PlayerDeathEvent, you can use the getKiller() method, which returns the Player object of the killer. This method will only return a Player if the death was caused by another player.

proud badge
#

EntityDamageByEntityEvent

dusty herald
#

Wrong

#

He only wants player

shadow night
#

I feel like this counts as spoonfeeding and somebody needs a course on reading documentation

proud badge
quaint mantle
#

Should I do check Player and ((Player) e.getDamager()).getHealth() == 0 with EntityDamageByEntityEvent?

#

oh that allowed

#

thanks

dusty herald
#

💀

quaint mantle
#

❤️

dusty herald
#

read the documentation PLEASE

shadow night
#

Idk the technical term for that, but they should really just learn to read documentation instead of asking people in spigot about shit you can find on the first link in google

drowsy helm
#

Yeah, being a proficient googler is a big part of programming

#

Some people lack

dusty herald
#

bro it's crazy how that exact scenario has like 100+ threads on how to do it on the old bukkit forums

shadow night
#

I think that doesn't make sense

#

whatever I just said there

drowsy helm
#

Lol

dusty herald
#

crazy

drowsy helm
#

Wheres that website that types out a google search

shadow night
#

letmegoogleitforyou?

drowsy helm
#

Yeah lmao

shadow night
#

This gives me an idea

shadow night
drowsy helm
#

Lmao

#

My pet peeve is when I tell someone to download something and they ask for a link

dusty herald
#

honestly I do that lol

drowsy helm
#

Like bro im just gonna google the exact same thing you will

dusty herald
#

im lazy

#

I don't google anymore, I used Bing AI

shadow night
dusty herald
#

No :)

drowsy helm
#

Only valid if they on a phone

proud badge
#

will modifying WrapperPlayServerSystemChatMessage modify the packet being sent too?

drowsy helm
#

Typing anything more than 10 characters on a phone one handed is hard lol

proud badge
#

ok nice

dusty herald
drowsy helm
#

Are you right handed by any chance

dusty herald
#

I am

#

"How's it hanging?" "To the left."

drowsy helm
#

U nastyyyy

dusty herald
#

wdym

drowsy helm
#

What ur other hand doing

dusty herald
#

using my mouse??

drowsy helm
#

Ah

#

I was not thinking that

dusty herald
#

you're nasty

shadow night
#

I wanted to type "based" but I somehow ended up typing "by sex",

pale bear
#

Does anyone know how firework.setAttatchedTo(enitity) works?

Player p = e.getPlayer();
Firework fw = (Firework) p.getWorld().spawnEntity(p.getLocation(), EntityType.FIREWORK_ROCKET);
fw.setAttachedTo(e.getPlayer());

Because the code above doesn't boost the player, but it does spawn the firework.

pale bear
#

thank you!

sterile breach
#

whats the best way to prevent null pointer expression?

chrome beacon
#

Don't call methods on null values

drowsy helm
#

Assume parameter inputs are always bad and have guard clauses

sterile breach
#

i am calling a rayTraceResult.getHitEntity() but I am not sure that there is an entity

drowsy helm
#

Use an if statement and see if the outcome is null

blazing ocean
#

kotlin ?. my beloved ❤️

drowsy helm
#

No

blazing ocean
#

it's starting to become a lot more like kotlin

sterile breach
blazing ocean
drowsy helm
#

Pretty sure it breaks their simplicity guidelines

blazing ocean
drowsy helm
#

I might be wrong but java is cery anal

sterile breach
blazing ocean
#

😳

#

damn

drowsy helm
#

Yur

#

And they are shit lol

blazing ocean
#

what does that mean here 😭

drowsy helm
#

Anal just means up tight

blazing ocean
#

i know what anal is i just don't get what it means in this case

#

EW

drowsy helm
#

Js and python do string templates so well

shadow night
#

I'm okay with my C-like "%s", var

#

imo that looks shit

drowsy helm
#

Better than what it is

#

Java also needs operator overloads

#

But they said they will never add that

#

At it makes code “too complex”

shadow night
#

tf are operator overloads

#

java needs unsigned numbers

drowsy helm
#

Like being able to define how classes interact with operators (+, -, *, etc)

shadow night
#

ah

#

would be neat

#

maybe some interface for that or something

drowsy helm
#

But they say if you wanr to figure out how two classes interact with eachother it makes it too complex

#

Which is fair enough ig

shadow night
#

that doesn't look good

slender elbow
#

not anymore

#

they removed the proposal entirely to reevaluate the syntax, lol

drowsy helm
#

As of when?

shadow night
#

what's the next LTS java version

slender elbow
#

like, many moons ago

drowsy helm
#

If they’re not gonna do it well id rather not at all

#

Because once the shit syntax is implemented, they’re not gonna change it

slender elbow
#

they removed all of the code related to the feature and are redesigning most of the process from scratch

shadow night
#

njhjjhnhhjbhjhjbhjb

slender elbow
#

specifically, they realised that you don't need to introduce new syntax for the STR."foo" at all

drowsy helm
#

Just use diff quotation marks like js

#

So much better

shadow night
#

yeah sounds good

slender elbow
#

just.. a function call, e.g. String.format("foo bar %.2f\{someFloat}")

#

so there would me a String.format(String) and a String.format(StringTemplate)

shadow night
#

can we get an annotation processor that would automatically change "foo bar ${var}" to "foo bar " + var

drowsy helm
#

Yeah I dont see why lombok cant add it as a pre processor

slender elbow
#

APs can't really do that

shadow night
slender elbow
#

that's just how it is

drowsy helm
#

Whack

river oracle
#

It's a mailing list

#

It's not supposed to be fancy

shadow night
#

how tf does lombok do what it does but then this can't be possible

slender elbow
eternal night
#

BONK when StringTemplate

slender elbow
eternal night
#

I need it like yesterday

drowsy helm
#

Lombok is a compiler plugin?

river oracle
#

Kekw

eternal night
#

no

#

kotlin string templates are ass

#

the java proposal is awesome

slender elbow
#

string templates are so much more powerful that basic string formatting

river oracle
eternal night
#

kotlin string templates evaluate to String no?

drowsy helm
#

Java also needs auto getter/setters like c#

eternal night
#

Yea, they do

#

hence, ass

drowsy helm
#

Thats why I love lombok so much

#

Saves like 40% code space per class

river oracle
slender elbow
#

i don't understand why people have so many issues with getters and setters, i very rarely find myself writing code that requires them at all lmao

#

peak encapsulation

river oracle
drowsy helm
#

I encapsulate almost everything

slender elbow
river oracle
#

I love kotlin

#

But I also love java

#

Using dsl with kotlin makes me feel euphoric

drowsy helm
#

Is kotlin worth learning

#

Ive never touched it

river oracle
eternal night
#

idk, java string templates (at least what was floated in the mailing list) would be op as fuck

river oracle
#

It really doesn't require much learning

eternal night
#

I think TypeScript hsa them too? the java-like string templates don't evaluate to string but to an intermediate format

quaint mantle
#

Nope

slender elbow
#

uh

#

sure

#

and java is like rust where you have to put semicolons

shadow night
#

I've been saying that all this time and nobody listened

eternal night
#

assembly is like python when you squint your eyes a lot

slender elbow
#

for the most part, unless it has a NotNull/NonNull annotation

shadow night
#

my methods can always return null because yes

#

if(ThreadCurrentRandom.current().nextInt(100) == 99) return null; hahaha

river oracle
#

It assumes it's nullable unless it's specified

orchid gazelle
#

Kotlin is like Java but without readability

#

;)

#

It's that easy

shadow night
#

it does the exact opposite

quaint mantle
#

It automatically does getters and setters for you

blazing ocean
mortal hare
#

INTELLLIJJJJ

shadow night
#

lmaoo

#

you need to cast the enchantability to float or double I believe

mortal hare
#

and intellij does this :/

shadow night
#

lmao

shadow night
#

I think you can Math.floorDiv then

river oracle
#

Kotlin makes them automatically for public fields

#

You specify if you don't want them

river oracle
blazing ocean
#

wdym don't want them

drowsy helm
blazing ocean
drowsy helm
#

It’s already an int

orchid gazelle
#

It was horrible

blazing ocean
#

did you really tho

orchid gazelle
#

Yes

blazing ocean
#

you probably didn't use it correctly

#

knowing you

river oracle
blazing ocean
#

when was "back then"?

orchid gazelle
#

It was like 2 years or sth ago where I had to use it

blazing ocean
#

kotlin 1.0?

orchid gazelle
#

And it was horrible

blazing ocean
#

likelyhood is that you just used it terribly wrong

orchid gazelle
#

And I still think it's horrible language design

orchid gazelle
river oracle
#

DaFeist probably hates modern languages

#

Where inference is the standard

orchid gazelle
#

No I like dart

blazing ocean
#

you can use java terribly wrong

orchid gazelle
#

In a syntax way - not really

#

Syntax is Syntax

shadow night
blazing ocean
orchid gazelle
#

There is a difference between semantical garbage and syntactical garbage

#

For me, kotlin is straight up syntactical garbage

blazing ocean
#

sounds like you're either ignorant or blind then

orchid gazelle
#

How's that? This is a matter of subjective preferences

blazing ocean
#

it's not syntactical garbage

#

it's just a language

orchid gazelle
#

For me it is

blazing ocean
#

i'm surprised you didn't say that about odin then

orchid gazelle
#

I have never looked at odin

blazing ocean
#

#general?

orchid gazelle
#

That was literally like 3 lines of code

blazing ocean
#

you just saw some

#

yeah

orchid gazelle
#

I cannot rate a syntax with 3 lines of code

blazing ocean
#

it does sound like you would

orchid gazelle
#

I need to read a simple program, or at least like 100 lines

#

Which I did with kotlin - and that gave me the opinion that I hate the language's syntax, so I shit on it

blazing ocean
#

what did you do with it then

orchid gazelle
#

I wrote a plugin with it

#

Well, parts of one

blazing ocean
#

if it gives you that shitty syntax you're likely doing something wrong

orchid gazelle
#

And then I translated a library to Java to not have to use it anymore

blazing ocean
#

💀

orchid gazelle
#

Well it was technically not a library

#

It was like a major feature with tons of Util classes

viral shell
#

Hi, i was trynna make an alert system when i just noticed that it bugs depending on the first player to join the server, how can i fix this?

worldly ice
#

you're returning if one player doesn't have that permission rather than continueing

chrome beacon
#

^^

patent patrol
#

guys how do i stop essentials /back from warping to a specific world?

tawdry shoal
#

Hey, please tell me how can I implement the corpse of a player after his death? this should be some kind of hitbox, when pressed, it opens the gui, armor stands are excluded

quaint mantle
#

Can the server force a player to steer and stop crouching

patent patrol
floral drum
brazen badge
#

The question I will ask now is quite unusual. What are the things a good Minecraft plugin dev needs to know? And what are the most advanced concepts of minecraft plugin programming?

chrome beacon
#

Are you sure it would do what you want

tardy delta
#

anyone knows if you can have a git submodule thats set to a local path for testing purposes?

blazing ocean
#

you just wanna set a submodule to a local path?

#

yeah

floral drum
# brazen badge The question I will ask now is quite unusual. What are the things a good Minecra...
  • Clean code - You will need this if you get hired someplace, it will allow other developers to easily maintain and read your code
  • Abstraction - Good knowledge on abstraction and where to do it is good, as it allows features to be created and implemented faster than before
  • Databases - Knowing multiple database types such as: MongoDB, MySQL, PostgreSQL, etc will allow you to store data anywhere the client needs.

Getting advanced

  • Cross-server communication - Using stuff such as Redis Pub/Sub, RabbitMQ, or any others. It will allow you to have multi-instanced servers with synced data across them, creating a better experience for the users.
  • Packets - Knowing how to work with packets, knowing how the networking works, and send data to the client, is a good step in the career of plugin development. It allows more customization like per-player holograms, fake entities, entity movement, custom tabs, per player scoreboard handling, etc.
#

This is just a few

tardy delta
#

i did that, synced and updated, and it bricked the submodule to some state that isnt even close to how it looks rn

blazing ocean
#

may i say

#

gg?

tardy delta
#

actually..

#

its quite interesting, i have a submodule that depends on itself

#

so now just trying url = .

floral drum
brazen badge
jolly solstice
floral drum
#

The next 2 are just bonuses, which can advance your career, and allow you to strive to become a better developer, and get better work opportunities in the development space.

jolly solstice
#

Even if you don't work with databases, the concept of knowing how they work and how to store data efficiently is super useful knowledge

jolly solstice
floral drum
#

Eyy me too

#

I'm 20 now

#

I'm so old

jolly solstice
#

+10 here

#

:^)

brazen badge
#

It's quite funny as a thing, but I've read books, I've watched videos, I've asked people in the industry. But I still cannot find the use of abstract classes or interfaces useful.

jolly solstice
floral drum
#

Basically think of it like this

#

I'll send you a project I made

jolly solstice
#

What am I supposed to say

floral drum
#

If you look in that, you will see the use of abstract classes

#

Inside "strategy"

river oracle
floral drum
#

I mean you need to make your code maintainable if you're working in a server with other developers imo

pseudo hazel
#

yes

#

clean code is important

#

but noone seems to agree on what it actually looks like

floral drum
#

I mean just following proper java design patterns is important

pseudo hazel
#

since its also part subjective and part different per context

floral drum
#

I usually make fields and variables final wherever they need to be

#

I use this. when referencing class fields

alpine urchin
#

some people overdo it

#

adding it to arguments and whatnot

#

makes it less readable then

pseudo hazel
#

adding what to arguments

alpine urchin
#

final

pseudo hazel
#

oh

#

yeah

#

I usually just do that with the events

#

but its not really needed

floral drum
#

like this:

public class Test {
    private final String temp;

    public Test(String temp) {
        this.temp = temp;
    }

    public String getTemp() {
        return this.temp;
    }
}```
river oracle
alpine urchin
#

welcome to records

jolly solstice
# river oracle Meh the whole clean code manifesto is stupid, I think it is indeed important to ...

If you never code anything public and don't give a single thought about the future and you know you will probably always be the only person ever touching that code and you have a perfect memory and remember everything even years later and are perfectly fine with your and only your coding style - sure, you won't need any "clean code" guide lines 😛
For everyone else, they make sense to follow.

alpine urchin
#

kinda passive aggressive

#

lol

pseudo hazel
#

private final is a joke imo, making it public doesnt change anything

tardy delta
#

oh wonderful i ended up with a recursive submodule

floral drum
river oracle
jolly solstice
#

The "clean code" manifesto is basically just the result of many years of different things being tried and reduced to the most common things people do and are easy to follow.

#

If you feel more comfortable with deviating from them, heck, you are free to do that - they are just recommendations.

warm mica
floral drum
river oracle
#

People will always disagree on what is and isn't maintainable and clean

floral drum
jolly solstice
slender elbow
#

there isn't such thing as "ultimately clean code", you can follow practices that will make your code easier to maintain in certain aspects but you are likely trading that off for something else; the way i see it, easily maintainable code is code that is easy to refactor, that has little refactoring "friction" so to speak, but this will wildly depend on what your application or library or framework does

shadow night
slender elbow
#

"can't print on tuesdays" bug

river oracle
# slender elbow "can't print on tuesdays" bug

When you're writing code you should lean into striving for good abstractions and writing somewhat efficient code rather than starting with the goal of clean code. It wastes time especially when heading towards a MVP

floral drum
#

lmaooo

shadow night
jolly solstice
#

Fun fact: clean code in one language might look absolutely messy in the syntax of another language 🙂

blazing ocean
jolly solstice
#

So this fact alone tells you, there is no "one for all" guidebook

floral drum
#

gotta love how microsoft copied java by creating C# but they decided.
OuR cOdE stYlE is MetHoDs shOuLd StaRt wiTh CapItaL LetTeRS

blazing ocean
warm mica
floral drum
#

oh god

floral drum
#

their code style is just...

jolly solstice
blazing ocean
warm mica
floral drum
#
public class Test : SuperClass 
{
    public void ThisIsAMethod(bool condition)
    {
        if (!condition)
        {
            return;
        }

        // Code here
    }
}
valid echo
#

I have a bit of issue, how would i check if the block a player is looking at is a sign? The Material.SIGN i used in earlier minecraft versions seems to not be working

shadow night
obsidian drift
#

imagine not being motivated because of a code style

#

silly

jolly solstice
remote swallow
#

signs are seperate items per type now

jolly solstice
#

That's kind of why I love and hate Python at the same time

shadow night
#

Python when you indent wrongly: 😡

valid echo
eternal oxide
#

Material is still useable (update IJ) but you should switch to Registries

valid echo
#

I did manage to get something alike with getTargetBlock then check the getState if its an instance of Sign

jolly solstice
#

Maybe this helps you

eternal oxide
tardy delta
#

either way we have @(private) and @(private="file") for package and file visibility, can even leave the () away

mint cairn
#

Hi. I am trying to make beautiful information about the exception, but I met such a problem:
There is no support for multiple lines in a message. I use 1.21

Here is the code:

targetPlayer.kickPlayer("test\ntest2\ntest3\ntest4\ntest5");
slender elbow
chrome beacon
#

x2

clear elm
#

I have some wierd issus. I have 1 hashmap and 1 list and i save the list and the hashmap when i stop the server in a yaml file and i load them when the server starts and the wierd problem is when i remove a key from the hashmap and from the list it gets removed but when i stop the server the hashmap entry appears again idk why

#

idk where this hashmap entry is from when is stop the server and it safes it because i removed it and the hashmap which gets saved dont has the entry

tardy delta
#

or save your config

harsh ruin
#

hello, I'm new to this field, I'm looking to create my server with original gameplay. I started to develop a plugin but I discovered problems that I had difficulty solving. my plugin allows with a command to harvest a wheat field, then in a personalized gui, we can upgrade the harvest speed, the verification radius, etc. for this I use a pig then I will use display_blocks with an animation using a datapack in order to create a tractor. now I would like all the players to spawn on a personal world with each one their progress in the game, if someone can help me to make the improvements specific to each player, I am currently using multiverse core, but it has having trouble integrating the datapack.

harsh ruin
tardy delta
#

yes

mint cairn
slender elbow
shadow night
slender elbow
#

if you're using viaversion try without it I guess idk

chrome beacon
mortal hare
tardy delta
#

someone likes spans

brittle geyser
#

How to use gradle variables here in plugin.yml?

mortal hare
#

guys where do you use records

slender elbow
mortal hare
#

i've starting using it everywhere where i meet immutability but kinda afraid when i would need to refactor it could be kinda messy

pseudo hazel
#

same for me but I did not have to refactor anything

floral drum
#

I never use records 🤔

pseudo hazel
#

like the records are still working fine

mortal hare
#

records are kinda better for jvm

pseudo hazel
#

I have a minigame plugin and the settings for the game are stored in a record

slender elbow
#

I use records for anything I need to represent data

pseudo hazel
#

I have a builder that can make this object, which is used when the admin wants to change something

slender elbow
#

e.g. sql records, configs and such

mortal hare
#

should manager class be a record in your opinion?

slender elbow
#

no

pseudo hazel
#

no

mortal hare
#

why though if its immutable

pseudo hazel
#

a record might the thing it manages

slender elbow
#

records are for data
a manager/repository isn't data

pseudo hazel
#

how is a manager clas immutable

#

then it might aswell be a list

slender elbow
#

DAOs and DTOs etc

mortal hare
#

its more like a holder class

#

maybe its bad name

#

its more like a service class

slender elbow
#

do you happen to have an example

mortal hare
#
public record EnchantmentManager(Registry<String, EnchantmentType> typeRegistry)
    public List<Item.EnchantmentProbability> calculateProbableEnchantments(Item item, EnchantmentType knownEnchantmentType, int tableLevel);
#

it basically only holds references

#

for retrieval

slender elbow
#

also, a record inherently exposes the data it holds (that's the point, they are transparent data carriers)
in a repository or manager class, I don't want to expose the internal details and data it uses, but rather methods that present invariants on how to operate on the manager with the data

tardy delta
#

havent we convinced you to join the kotlin cult?

mortal hare
#

but decided for this project to stick to java