#help-development

1 messages ยท Page 1256 of 1

ivory sleet
#

course work?

chrome beacon
#

Yeah

jagged thicket
#

too much audio and netoworking problems

manic delta
#

i wanted to use it for hosting redis and some databases

#

and maybe for a photo hosting

ivory sleet
#

its a bit of a flex to have a raspberry pi tho, def some aura to it

jagged thicket
#

True

chrome beacon
#

I haven't done too much programming recently

jagged thicket
#

i still have it somewhere

manic delta
#

sell it to me

jagged thicket
#

No

ivory sleet
jagged thicket
#

im starting uni soon so might use it there

chrome beacon
#

Yeah

ivory sleet
#

linear algebra, multivariable calculus etc?

echo basalt
#

don't the new arduinos also have web server capabilities?

#

robotics club at school uses em and they're pretty neat

#

sync over wifi, have a built-in led matrix

jagged thicket
#

idk i only had like crappy offbrand 2 dollar arduinos

#

i made a rc car, it hit a wall and brok

manic delta
#

i think ill buy a rasp 4

#

idk if it is good

chrome beacon
manic delta
#

i just want a random stuff hosting

ivory sleet
echo basalt
#

I just use a friend's whatever for that

chrome beacon
#

But ugh statistics and stuff

#

Not what I signed up for really

ivory sleet
#

probability and statistics?

chrome beacon
#

No not really

#

Well it's some of that ig

#

Vetenskaplig metodik och kommunikation inom data- och systemvetenskap is the course if you want to look it up

echo basalt
#

is that german

#

swedish close enough

ivory sleet
#

:,)

chrome beacon
#

๐Ÿ”ซ

echo basalt
#

ich vs och

ivory sleet
#

tbf tho, i didnt know that data science and data technology (or well, data engineering) were such different fields until very recently

chrome beacon
#

Hm? No

ivory sleet
#

well I think the substantial difference was mathematics, but that ofc impacts what u can study subsequently - since a lot of fields do require substantial math knowledge when u go in depth apparently

chrome beacon
#

Yeah that's true ig

ivory sleet
#

its annoying cuz the maths we study for example isnt even about numbers anymore- just symbols

chrome beacon
#

Yeah I've seen some

sly topaz
#

I missed the maven vs gradle convo ๐Ÿ˜”

#

my two cents is that maven is easier since it being declarative by default allows for a much more comprehensive documentation, and its plugin ecosystem as well as maven itself are much more stable. If you have a relatively complex gradle plugin, following along with gradle's whims is a pain in the ass due to how fast they move, they release a version each month and before you know the next major version is up removing API that was created a major version ago

#

gradle is a really cool piece of software for complex builds, but that's rarely ever necessary in the plugin development space

jagged thicket
#

but if u use paper

#

there isn't much choice (for userdev etc)

sly topaz
#

if you use paper then you shouldn't be discussing it here ๐Ÿ˜›

jagged thicket
#

that came up too (in the above discussion)

#

lol

slender elbow
#

declarative is definitely simpler, I can't wait for gradle dcl to be released and then have gradle have three different languages to write build scripts in!!!

jagged thicket
#

idk if most people (including me) would prefer dcl over kt

sly topaz
# jagged thicket there isn't much choice (for userdev etc)

realistically, it shouldn't be too hard to replicate userdev as a maven plugin, considering it is relatively stable right now, it'd just take decoupling the gradle bits of the current paperweight codebase, which may sound stupid considering it all works with gradle, but I don't believe it'd too hard to find maven API equivalent if necessary

#

sounds good for a pet project, if anything

jagged thicket
#

currently tho, if im forced to use maven i would just add the paper-server and dep

sly topaz
#

someone could create a monster and make paper work with specialsource

left jay
jagged thicket
#

@manic delta did u check the loginevent in spigot tho

#

is it working now

manic delta
#

yes

#

i think the problem was from

#

no premium servers

odd sentinel
#

is there a recommended gradle plugin to run a spigot server for plugin development?

jagged thicket
#

because the problem was for me atleast only in offline mode

manic delta
#

yea that

sly topaz
odd sentinel
#

I was looking at that but those steps weren't documented. I'll look again

sly topaz
#

they are not documented per se, you just have to figure it out lol

#

let me see if I can get it setup real fast so I can tell you exactly what you need to put in your build script

odd sentinel
#

that'd be great

#

well I tried posting a snippet of what I thought might work but this channel ate it

sly topaz
#

?img

undone axleBOT
#

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

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

odd sentinel
#

weird, verifications must expire. granted it's been a few years

odd sentinel
#

hmm well gradle refuses to find run-task, even though it's clearly published, I have the right name/version, I can see it on the gradle plugins repo, and gradle is searching that repo

#

but run-paper has worked fine for a while

sly topaz
# odd sentinel but run-paper has worked fine for a while
plugins {
    id("java")
    id("xyz.jpenilla.run-paper") version "2.3.1"
    id("xyz.jpenilla.resource-factory-bukkit-convention") version "1.2.0"
}

group = "me.javierflores"
version = "0.0.1"

repositories {
    mavenCentral()

    maven("https://hub.spigotmc.org/nexus/content/repositories/snapshots/")
}

dependencies {
    implementation("org.spigotmc:spigot-api:1.21.5-R0.1-SNAPSHOT")
}

tasks {
    runServer {
        minecraftVersion("1.21.5")
        legacyPluginLoading()
        serverJar(File("../Spigot-Sources/spigot-1.21.5.jar"))
        jvmArgs("-Dcom.mojang.eula.agree=true")
    }

    bukkitPluginYaml {
        main = "me.javierflores.st.SpigotTesting"
        apiVersion = "1.21.5"
    }
}

this seems to work fine for me

#

of course, you'd have to change the location of the spigot jar to wherever you have yours, mine points to where I normally run buildtools

odd sentinel
#

ok great, thanks

#

hmm, errors for me with Cannot set the property 'main' because the backing field is final.

blazing ocean
#

try main.set(...)

odd sentinel
#

that seems to work

#

I suspect it's because I'm using the de.eldoria.plugin-yml.bukkit plugin too. I had disabled that and still got the error though

blazing ocean
#

what line are you getting the error in

odd sentinel
#

it's fixed now, although I need to figure out the plugin.yml situation. I can't use both

#

it does boot spigot properly, so thanks for the help on that

sly topaz
#

it's the standard one

odd sentinel
#

ok thanks, good tip

#

ya its funny, even with the other yml plugin removed it still errors that fields are final. main.set works fine though. it gives the same error for all fields I try to define

#

hmm my groovy is a little rusty, how am I meant to access his enum PluginLoadOrder? I need to set the load property

#

had to get verbose xyz.jpenilla.resourcefactory.bukkit.BukkitPluginYaml.PluginLoadOrder.STARTUP

sly topaz
#

as for why assigning didn't work properly for you, it is probably because you're using groovy lol

#

nowadays everyone uses the kotlin dsl

#

I wish run-task provided an aikarFlags function for convenience lol, this looks ugly as hell

#

I guess I could read it from a file but still

#

hotswapping also works fine with JBR ๐Ÿ˜Ž

odd sentinel
#

ya I've seen the kotlin switch over for years but haven't done much java in that time and more critically am old and need to force myself to adopt

sly topaz
#

well, even though kotlin has become the default for gradle nowadays, groovy still works fine

#

you just have to make sure to adjust some things when copying stuff from the internet

#

it's kinda funny because it used to be the other way around back when the kotlin dsl was introduced, guess that's how much of an influence android has

rough ibex
#

DSLs ugh

#

XML ๐Ÿ‘

blazing ocean
#

no

odd sentinel
#

so the run-task still uses the run folder as a working directory (server files etc) but just reads the spigot jar from the ../Spigot-Sources/ in your example?

sly topaz
#

yes

#

you may change the working directory to somewhere else if you wish

odd sentinel
#

nah run is fine, I just was assuming incorrectly it'd use a different spot but then noticed it was using run

rugged hemlock
#

I have a question. If I'm creating BossBars with an event listener, should I be manually removing them after? or will GC remove them?

urban cloak
ivory sleet
chrome beacon
#

Yeah need to remove them

rugged hemlock
#

okay, thanks!

#

it's just plugin.getServer().removeBossBar(key); right?

chrome beacon
#

or just Bukkit#removeBossBar

#

but yes

#

also don't forget to remove the listener

#

(if you have one per bossbar)

rugged hemlock
#

I always forget about the Bukkit static methods

chrome beacon
#

so when you do getServer you can usually just do Bukkit instead

rugged hemlock
#

it's just a single listener creating boss bars for timers

rugged hemlock
eager ermine
#

Who wants to make a cpvp bedwars server with bedwars with like maces ect with custom plugins 32gb I fund

eternal oxide
#

No hookers and blow? I'm out

drowsy helm
#

If I had a penny for every bedwars server

young knoll
#

32gb of ram

#

Or storage

smoky anchor
#

I think that's payment, 32 Giga Bitcoins

young knoll
#

Or maybe cat pictures

#

Everyone knows the secret to a good bedwars server is 32gb of cat pictures

#

Thatโ€™s how hypixel does it

chrome beacon
#

just 32gb

jagged thicket
#

atleast bro funds

#

be like bro

wet breach
blazing ocean
#

if I had a penny for every player object that was ever stored in a collection and not cleaned up, I'd be a trillionaire

rugged hemlock
#

i probably made you thousands in my early days

mental frigate
#

can I somehow "concatenate" two NMS Components? (net.minecraft.network.chat.Component)

#

or does there exist some method like replace?\

smoky anchor
#

You mean like [{text:"Hello "},{text:"World"}] ?
Yes, that is possible somewhere

mental frigate
#

uh i guess? something like that

smoky anchor
mental frigate
#

I have two components, one with message "Hello" and the second one with "World" and i want to create one component from them "Hello World"

#

and how do i do this

smoky anchor
#

ok, gimme a bit

mental frigate
#

alr

smoky anchor
#

Can you just drop the code for your components ?

#

Ok, MutableComponent has method append(Component)
You can most likely use that

mental frigate
#
    private Component getMessage(Player player, ItemStack item, String slot) {
        Component message = Component.literal(this.plugin.getMessage("Messages.show-%s".formatted(slots.contains(slot) ? slot : "other")));

        Component itemName = getItemName(item);
    }

    private Component getItemName(ItemStack item) {
        net.minecraft.world.item.ItemStack nmsItem = CraftItemStack.asNMSCopy(item);
        return nmsItem.getDisplayName();
    }```
smoky anchor
#

Component.literal returns MutableComponent

#

So just replace Component message with MutableComponent and then you can use append

mental frigate
#

Ohhh

#

thank you so much

smoky anchor
#

np

mental frigate
#

you are literally my savior once again

#

@smoky anchor but there's no replace method, right?

smoky anchor
#

Doesn't look like it, why do you need replace ?
How do you want to use it ?
At worst, you can simply create a new MutableComponent and copy over the siblings (and modify them)

mental frigate
#

Okay basically I have a message, like this "Player {player} is holding {item} in his hand." and i want to replace the {item} with hoverable component

smoky anchor
#

So you're thinking about this wrong

mental frigate
#

uh, maybe..

smoky anchor
#

You would not "replace" anything
You would append each part

#

And each time create new component

mental frigate
#

so I split the String "Player {player} is holding {item} in his hand." and create component for each part?

smoky anchor
#

Correct

mental frigate
#

alr, thanks

thorn isle
#

since they're both jvm languages (and iirc kotlin script is compilable as well) couldn't we in theory first compile java and then decompile into kotlin script so you can have your build script written in java boilerplate? ๐Ÿคก

blazing ocean
#

kotlin scripts are evaluated directly and you can't really fetch the compiled output

#

it's due to the way their scripting hosts work

thorn isle
#

they aren't typically compiled since they're for scripting, but they are compilable, no?

blazing ocean
#

they do get compiled

mental frigate
#

@smoky anchor sorry for bothering you again but can I get rid od the square brackets? I get something like this.
Player indyy__ is holding [item name] in their hand.

#

and I'd like to have
Player indyy__ is holding item name in their hand.

smoky anchor
#

Show how you're constructing the text please

mental frigate
#
    private MutableComponent getMessage(Player player, ItemStack item, String slot) {
        String base = this.plugin.getMessage("Messages.show-%s".formatted(slots.contains(slot) ? slot : "other"))
            .replace("{player}", player.getDisplayName())
            .replace("{item}", this.plugin.getMessage("Messages.item-format")
                .replace("{amount}", String.valueOf(item.getAmount())));
        List<String> parts = List.of(base.split("\\{item}"));

        return Component.literal(parts.getFirst())
            .append(this.getItemName(item))
            .append(parts.getLast());
    }

    private Component getItemName(ItemStack item) {
        net.minecraft.world.item.ItemStack nmsItem = CraftItemStack.asNMSCopy(item);
        return nmsItem.getDisplayName();
    }```
smoky anchor
#

That's an interesting way of doing that, seems too complicated

mental frigate
#

uh..

smoky anchor
#

But I think I know why you have to do that

mental frigate
#

I don't really know a different way

mental frigate
smoky anchor
#

You have "Messages.show-%s"
Which I assume resolves to "Player {player} is holding {item} in their hand."

mental frigate
#

yes

#
Messages:
  non-player-executor: '&cYou can only perform this command as player.'
  no-permission: "&cYou don't have permissions to use this command."
  player-not-found: '&cPlayer &7{player} &cnot found.'
  invalid-slot: '&cInvalid slot. &cUsage: /show [hand|offhand|head|chest|legs|feet|<slot>] [<player>]'
  empty-slot: '&cThe slot {slot} is empty.'
  show-hand: '&aPlayer &7{player} &ais holding &r{item} &ain their hand.'
  show-offhand: '&aPlayer &7{player} &ais holding &r{item} &ain their offhand.'
  show-head: '&aPlayer &7{player} &ais wearing &r{item} &aon their head.'
  show-chest: '&aPlayer &7{player} &ais wearing &r{item} &aon their chest.'
  show-legs: '&aPlayer &7{player} &ais wearing &r{item} &aon their legs.'
  show-feet: '&aPlayer &7{player} &ais wearing &r{item} &aon their feet.'
  show-other: '&aPlayer &7{player} &ais holding &r{item} &ain their inventory.'
  item-format: '&7{amount}x &r{item}'```
smoky anchor
#

Which is not exactly compatible with this append way of doing the components

#

oh hell no, you're not mixing legacy colors with components

mental frigate
#

oh..

#

um yea..

smoky anchor
#

I mean, keep it
It's fine, you're not updating anyways
Just... ๐Ÿคฎ :D

mental frigate
#

uh, how should I do this?

#

because I assume it's a bad practice, right?

smoky anchor
#

No, keep it as it is
Back to your problem. I think nmsItem.getDisplayName() returns the [] as well
Instead, just use the bukkit ItemStack to get the display name

smoky anchor
smoky anchor
#

By mojang, the support for ยง2 as green will be probably removed in some version

slender elbow
#

mojang will remove the rendering of legacy formatting in the client

mental frigate
mental frigate
mental frigate
smoky anchor
mental frigate
smoky anchor
#

As I said, it's fine. You don't have to worry about it if it works.

slender elbow
#

I mean on bukkit ItemStack#getDisplayName() is not a thing, if you mean the one in ItemMeta instead, that's just the custom_name component directly

mental frigate
# smoky anchor Oh...

hmm, maybe I should get the display name from bukkit, retrieve name and styles separately, format the name how I like and create new component and just add the styles?

mental frigate
slender elbow
#

so the way you get display names in bukkit is a different way than the nms ItemStack#getDisplayName(), this one colours the text based on rarity, if it's enchanted, it will include itemstack hover event etc

smoky anchor
#

That would be a way. But I'm fairly sure you can somehow do that with NMS normally too. Just don't know how now.

mental frigate
slender elbow
#

yeah just get the custom_name/item_name component :thinksmart:

eternal night
#

would be really cool if there was an API for this Sadge

blazing ocean
#

keep dreaming lynx

mental frigate
#
    private Component getItemName(ItemStack item) {
        net.minecraft.world.item.ItemStack nmsItem = CraftItemStack.asNMSCopy(item);

        Component displayName = nmsItem.getDisplayName();
        String name = displayName.getString();
        Style style = displayName.getStyle();
        
        name = name.substring(1, name.length() - 1);
        
        return Component.literal(name).withStyle(style);
    }```
smth like that, ig?
smoky anchor
#

If it works :D

mental frigate
#

it works perfectly!

smoky anchor
#

Happy to hear

mental frigate
#

thank you so much steve and emily

eternal night
#

for dealing with components

mental frigate
#

oh yea..

rugged fern
#

Does anyone know the packets for spawning, removing etc. A fake player for npcs?

chrome beacon
#

player info update, add entity and remove entities

rugged fern
#

Thankss

white crescent
#

Can someone help me how to add minecraft attributes to code?

smoky anchor
white crescent
smoky anchor
#

And version ?

white crescent
#

1.21.4

rugged fern
#

What am i missing? the protocol documentation is confusing me, packetListener.send(new ClientboundAddEntityPacket(npc.getId(), npc.getUUID(), location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch(), npc.getType()));

Docs saying: java public ClientboundAddEntityPacket( int var0, java.util.UUID var1, double var2, double var4, double var6, float var8, float var9, net.minecraft.world.entity.EntityType<?> var10, ?? int var11, ?? @NotNull net.minecraft.world.phys.Vec3 var12, ?? double var13

smoky anchor
#

And where did builder come from ๐Ÿค”

white crescent
#

oh yeah, it isnt thank you

smoky anchor
#

Smells a bit like ๐Ÿ“œ

#

No, better, AI ? :D

white crescent
#

it actually is

smoky anchor
#

Ye, outdated knowledge
And you don't even know how to fix this easy bug
First actually learn java

#

without AI

chrome beacon
#

Open the class and see what it does with those params, or find where the server is using that constructor and see what they pass it

smoky anchor
#

?mappings

undone axleBOT
smoky anchor
chrome beacon
#

Yeah that's also an option

rugged fern
# smoky anchor

alright how do i get the entity data because i just got a SynchedEntityData from npc.getEntityData() for example

smoky anchor
#

Why do you think I would know lol

blazing ocean
#

just set it to zero and then send entity metadata packets, easier

chrome beacon
#

Entity metadata is a different packet

#

I forgot to mention that you need it as well if you want skin layers etc

#

as for the data see the protocol page

#

?protocol

undone axleBOT
blazing ocean
#

๐Ÿฅฃ

blazing ocean
tight root
#

is there a way to set a painting itemstack's variant using the spigot api?

vanilla command example: ```
/minecraft:give @s painting[entity_data={id:"minecraft:painting",variant:"minecraft:<id>"}] 1

#

i think its possible to set a painting entity's art but id rather have it on the item itself

chrome beacon
#

I don't really see an API for that

tight root
#

hmm alr thanks ill check that out

#

i found this package de.tr7zw.nbtapi that lets you modify nbt data

#

im gonna try that out

chrome beacon
#

Yeah that works too

rugged fern
#

why do i get null when trying to spawn the npc? Caused by: java.lang.NullPointerException: Cannot invoke "net.minecraft.server.network.PlayerConnection.k()" because "var0.f" is null

Code for initializing the server player: ```java
ServerPlayer npc = new ServerPlayer(server, level, gameProfile, ClientInformation.createDefault());
npc.setPos(location.getX(), location.getY(), location.getZ());

        ServerGamePacketListenerImpl packetListener = serverPlayer.connection;
        packetListener.send(new ClientboundPlayerInfoUpdatePacket(ClientboundPlayerInfoUpdatePacket.Action.ADD_PLAYER, npc));
        packetListener.send(new ClientboundAddEntityPacket(npc.getId(), npc.getUUID(), location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch(), npc.getType(), 0, Vec3.ZERO, npc.yHeadRot));```
manic delta
#

better use entitylib

blazing ocean
#

a noop impl

young knoll
#

Noop

odd sentinel
#

is there any api for building Tags programmatically?

young knoll
#

Donโ€™t think so

odd sentinel
#

bummer, wish there was

sly topaz
#

if that's the case, you're better off disguising a different entity as a player

blazing ocean
#

eh not really

sly topaz
#

I mean, implementing either solution sucks, but by disguising at least you get more freedom

#

then also just spawned another entity for pathfinding

sly topaz
blazing ocean
#

haven't tested that

sly topaz
#

you could just add the fake player to the PlayerList but that'd also mean it'd get treated the same as a regular player

#

hence why the person on that post decided to extend ServerPlayer instead

pale garnet
#

guys, i wanna make a toggle message command for my friend's server, how would i go about doing it

sly topaz
#

also, are you a developer or are you looking for a plugin to do it? Because this channel is for the former

thorn isle
#

personally i'm still of the mind that depending on citizens/libsdisguises is the most hassle-free and robust option to player npcs

sly topaz
#

citizens API is ass, libdisguises sounds fine though

thorn isle
#

citizens does come with a lot more baggage than most plugin devs or server admins really need, yeah

#

libsdisguises is pretty lightweight solution and gives you full control over the ai and other handling

umbral ridge
#

hey

#

once the server restarts, does it load all the world chunks that have been explored and loaded? or chunks where the entities spawn? how do entities spawn? kinda need to understand the whole system on chunks if I want to answer the question i guess...?

#

im trying to check if block at location is loaded or not

sly topaz
#

do you have the location only?

#

if so, you can just bit shift the x and z by 16 and then check World#isChunkLoaded

umbral ridge
#

yes, I have the x y z and the world name, ignoring the pitch and yaw from the player's view

sly topaz
#

ig you could also just do Location#getChunk#isLoaded

umbral ridge
#

how does isChunkLoaded work? is it loaded when there are nearby entities? does it unload if there are no players nearby? do chunks load specifically for players or all entities, also is there a limit of how many chunks can be loaded at the same time?

sly topaz
#

does whatever you are doing depend on the chunks being loaded or what exactly? That sounds like a leading question to your actual issue

#

if whatever you're doing requires the chunk to be loaded, you can use chunk tickets to keep them loaded as necessary

umbral ridge
#

yea

#

i think isLoaded will be ok

#

ty xd

thorn isle
#

it's loaded when the chunk status is FULL

sly topaz
#

what determines whether a chunk is loaded is a hard question to answer as there are levels to a chunk being loaded, it might be completely unloaded if there's nothing in it, it might not be completely unloading to allow for entity tracking, among other things

young knoll
#

Chunks only load around players

thorn isle
#

see the minecraft wiki for chunk loading

young knoll
#

Unless itโ€™s force loaded via a ticket / command

#

Or the spawn chunks

thorn isle
#

bukkit only considers entity-ticking chunks (the highest load level) as loaded

#

there are other load levels as well, like block ticking or border

young knoll
#

And the only limit to how many can be loaded is your ram

umbral ridge
#

so chunks are unloaded after n ticks or as soon as players leaves the range.. that is sufficient for chunks to stay loaded

thorn isle
#

sort of except sometimes but usually yes

#

the wiki will provide a much more comprehensive answer

umbral ridge
#

alright

umbral ridge
#

I need to upgrade to 64 soon

#

already at 51... not good XD

sly topaz
#

you're barely using half of it, why do you need more

umbral ridge
#

uwu ๐Ÿ˜‚

sly topaz
#

RAM is meant to be used, it being full means your system is taking good use of it

#

if you have leftover ram that means you just have too much RAM

umbral ridge
#

my cpu is sitting at 1% too

blazing ocean
sly topaz
blazing ocean
#

well I was using 100% of the ram

#

so, fair

#

(and no, not just cache)

sly topaz
#

you probably didn't have swap setup properly, it should never just crash on you

thorn isle
#

you should run your server entirely on swap

blazing ocean
#

well it didn't crash but freeze and then become irresponsive and crash at some point

#

but I did set up 8GB of zram

remote swallow
#

unused wam is wasted wam

blazing ocean
#

dedodated wam

sly topaz
blazing ocean
#

how to age your disk by 101 years*

sly topaz
#

I am still doing fine with 8gb of RAM

blazing ocean
#

wait till you're running 5 IJ instances, 2 MC servers, one proxy and 2 MC instances

sly topaz
#

one thing I hate is that I get OOM crashes when I have IntelliJ, Minecraft and a minecraft server open in linux even though that didn't happen to me in windows

blazing ocean
#

that's when it starts to get fun

sly topaz
blazing ocean
#

because I have to work on multiple parts of one codebase

#

that is not just a monorepo

remote swallow
#

rad do you not have workspaces

odd sentinel
#

if I'm releasing a major new update to a plugin that's effectively a new plugin I assume I should really create a new spigotmc entry for it?

blazing ocean
#

their gradle integration is horrid

sly topaz
#

it's one of the things I wish Jetbrains just stole from Visual Studio, just let me have a bunch of solutions all over my project tree ๐Ÿ˜”

thorn isle
#

don't you need to install IJ into multiple different directories if you want multiple concurrent instances? or are we just talking about multiple open projects/windows

blazing ocean
#

multiple open projects

remote swallow
sly topaz
#

because if it is still doing the same thing as base, I'd just release it as a new update - rewrite done

odd sentinel
#

I don't want to confuse people, especially if I release a minor update for the old one

sly topaz
#

why would it be minor if it is a rewrite

#

well, technically it could be if it didn't break anything but you said it doesn't support the old one, so I imagine you broke something

odd sentinel
#

no I'm saying that if the old one gets a minor update for future spigot updates, I don't want a mixed history of both

#

people won't switch overnight to the new one so I'll update the old one a while too

sly topaz
#

people don't really care honestly, they'd just complain that things aren't working as they used to

#

internals are something for you the developer to care, not the end user

#

so, if you decide to post a new plugin that does the same, while valid, I think it'd just be better to deprecate the old one if anything

odd sentinel
#

I think that depends but I think mainly I need to split this up

#

although fair, the old one has been mostly dead a while

sly topaz
#

just release an update saying if you're still using this, use x plugin now redirecting to your new plugin kek

young knoll
sly topaz
#

some modpacks suck so that doesn't surprise me

young knoll
#

It was worse a few versions back

sly topaz
#

no care for base mechanics whatsoever, just keep all chunks loaded for my rlcraft machine

young knoll
#

Modern ones seem to behave a bit better

thorn isle
#

i've always wanted to run a modded server but it seems like nobody writes mods with scalability in mind

#

they tend to crash and burn even in singleplayer, let alone with a dozen concurrent players

sly topaz
#

even if they were made for scalability, it'd be a hard sell considering most mods don't try to augment the experience in a meaningful way, or change the perspective of the game in ways that make it compelling to play more than a day before it gets boring

#

you could add a thousand machines, give me a smartphone or make me able to throw kamehamehas but if that doesn't devolve into an actual mechanic I can mess around with, novelty alone isn't going to keep players around

pale garnet
sly topaz
#

usually you'd just have to set the recipients in the AsyncPlayerChatEvent

paper viper
#

I feel my wrists hurting...

remote swallow
#

add everything to the code config and use that to generate the default config

paper viper
#

Copilot is starting to hallucinate with these autocompletions

#

wont be too long before i start to too

pale garnet
#

more like a normal chat message only a specified person can see

young knoll
#

Thatโ€™s just a /message command

pale garnet
young knoll
#

Cast meta to EnchantmentStorageMeta

#

And addStoredEnchantment

deep herald
#

thats what it does

young knoll
#

Then whatโ€™s the question

chrome beacon
#

^

deep herald
#

nvm ig

flat lark
sly topaz
#

same with the version

flat lark
sly topaz
#

what does your pom look like

flat lark
#
            <!-- Shader Plugin -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.2.4</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <createDependencyReducedPom>false</createDependencyReducedPom>
                            <minimizeJar>false</minimizeJar>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
sly topaz
#

what scope do you have for the dependency in question

flat lark
#
      <dependency>
            <groupId>de.freesoccerhdx</groupId>
            <artifactId>EnchantmentsAPI</artifactId>
            <version>1.0.0</version>
            <scope>provided</scope>
        </dependency>
sly topaz
#

provided dependencies won't get shaded

#

just remove the scope and it should be good

flat lark
#

Got it

sly topaz
#

if it complains about there being multiple META-INFS, you can just add a filter for that

#

for licenses and/or notices there's specific transformers which merges them accordingly though

quaint mantle
#

running buildtools thru gui btw

jagged thicket
#

During login are the initial chunks in the view distance pre loaded and sent unlike other chunks?

sly topaz
#

they're loaded like any chunks I believe, you just don't see them loading in as it often happens fast enough for it to be covered by the loading terrain screen

#

not always though, if you have enough latency, you'll see them loading

jagged thicket
#

it is actually a weird thing

#

wait

#

leme show

sly topaz
#

discord's player sucks so bad

sly topaz
#

wait, it isn't discord's fault, that's a damn 217mb recording lol

sly topaz
#

that's 314mb

#

are you not applying any encoding whatsoever? Lol

jagged thicket
#

Thats not me btw

sly topaz
#

well, whatever you're using to record, it sucks

jagged thicket
#

me and System32_ were testing it yesterday

#

it is his footage

sly topaz
#

tbf it is probably just a fault of their screen being too big or something and it having to record in 4k

#

orange do you speak spanish

jagged thicket
#

no

sly topaz
#

I am not sure what I was supposed to see there

sly topaz
#

at the end it spawns ORANGE

paper viper
#

I took AP spanish

#

but now

jagged thicket
paper viper
#

after months of not speaking

#

I forgot it all

sly topaz
#

packet is probably not resent as it stays on the client's cache

sly topaz
#

I find it hard to keep my japanese level the same, as I don't have anyone to practice it with

jagged thicket
sly topaz
#

does the same happen if you keep a chunk force loaded and relogin there

#

it might just be becuse those are spawn chunks

jagged thicket
#

not a spawn chunk issue

#

already confirmed that

sly topaz
#

but the player load chunk event should still be sent tho, I don't get it

jagged thicket
#

yeah its kinda weird

#

if the chunk is unloaded and re loaded it works again

#

only during login the event isn't called

sly topaz
#

can you check if the packet is sent

#

I mean, it should otherwise you wouldn't be able to see the chunks

#

it is probably something wrong with where the player chunk load event gets called

jagged thicket
#

the packet is recieved but the event is not fired

#

otherwise the chunks won't be visible no?

sly topaz
#

yeah

#

do you have your IDE and a server open

#

you can just debug it by placing a breakpoint on the instantiation of the PlayerChunkLoadEvent class

jagged thicket
sly topaz
#

well actually not on instantation but on the sendChunk method of PlayerChunkSender class

jagged thicket
#

i was looking at the PlayerList Source and it seemed to call chunk loading earlier

#

wait leme show

sly topaz
#

you'll probably need paperweight userdev in order to place breakpoints on paper code though

sly topaz
jagged thicket
#

line 373

sly topaz
#

what does getChunkSource return?

jagged thicket
#

ServerChunkCache

sly topaz
#

does addEntity manually send a ClientboundLevelChunkWithLightPacket anywhere?

#

I'll just compile paper and check myself lol

jagged thicket
#

alr

#

im trying not to make a code wall here lol

#

was trying to paste only the specific parts

left jay
#

question, how is the data of vanilla weapons stored? like the attack damage / speed

sly topaz
#

though, both can be modified with an attribute

left jay
#

alr cool,

#

ill probs deal with that after i sleep tho, thanks for the answer

manic delta
manic delta
jagged thicket
#

in a seperate plugin

#

so debug can be easier

thorn isle
#

they can't not be sent, the client only sees sent chunks and the local chunk cache gets erased when disconnecting

#

i'm also fairly sure the client doesn't keep spawn chunks locally cached if they go out of the view distance

manic delta
hardy cairn
#

the version is 1.21.1

#

would really appreciate the help

manic delta
#

The difficulty is in pacific?

thorn isle
#

check whether the entity instance returned by spawn isValid; if it isn't, some plugin (e.g. worldguard) is cancelling the spawn event

#

you can use eventdebugger to see which plugin cancels the event

#

you can also have your own (pre)entity spawn listener that sets cancelled to false on HIGHEST for your own spawn events

#

if some plugin is removing the entity after the fact rather than cancelling its spawn event, figuring out which plugin that is and stopping it from doing it will be more difficult

#

if the entities are monsters (which wither skeletons are), you probably also want to call setRemoveWhenFarAway with false, to prevent them from despawning if no players are nearby

slender elbow
#

that is not even released yet

worldly ingot
#

Development builds

#

And the red warning above that says "do not use in production"

nova cloud
#

thanks!

manic delta
#

What

nova cloud
vast ledge
#

If you bought the plugin in spigot, you should be able to download it on spigot

vast ledge
#

God knows

pale garnet
#

someone ideas for vanilla enhancing commands/utilities for my custom plugins? i already have togglemsg plugin and inventoryutils plugin that has sethealth, sethunger, duplicate

#

all made on my own

thorn isle
#

define "enhancing"

left jay
#

ok question, i have a method that removes the damage attributes of an item
but im wondering if theres a way to remove the toolip from the item that says "while in main hand" without straight up hiding all the attributes

public void removeAttributes(ItemStack item) {
        if (item == null || item.getType().isAir()) {
            return;
        }

        ItemMeta meta = item.getItemMeta();
        if (meta == null) {
            return;
        }

        AttributeModifier damageModifier = new AttributeModifier(new NamespacedKey(plugin, "no_damage"), 0.0, AttributeModifier.Operation.ADD_NUMBER, EquipmentSlotGroup.ANY);

        meta.removeAttributeModifier(Attribute.GENERIC_ATTACK_DAMAGE);
        meta.addAttributeModifier(Attribute.GENERIC_ATTACK_DAMAGE, damageModifier);
        item.setItemMeta(meta);
    }```
thorn isle
#

removing the weapon item component might fare better, although i'm not sure if bukkit itemmeta lets you override the default item components like that

#

afaik there is no way to hide a specific attribute modifier from an item tooltip since it's per item component, and all attribute modifiers are in one single item component

left jay
#

ah jeez well

cunning elk
#

hello, im searching for a RaidingOutpost plugin (1.8)

rough ibex
#

1.8...?

#

what are you looking for it to do, 1.8 doesnt have raids

blazing ocean
#

backport 1.14 to 1.8

cunning elk
rough ibex
#

what are you talking about

#

what is RaidingOutpost

cunning elk
#

no raid in 1.8

#

?

rough ibex
#

yeah. Its 1.8

#

ancient

blazing ocean
#

?howold 1.8

undone axleBOT
rough ibex
#

of course it doesnt have a 1.14 feature

chrome beacon
#

10 years ๐Ÿ’€

rough ibex
#

for 1.8.0

cunning elk
#

1.8.9

chrome beacon
rough ibex
#

Not much better

cunning elk
#

bro?

rough ibex
#

yes?

cunning elk
#

didnt you play 1.8 faction server ?

rotund ravine
#

When it was new suee

#

Sure

blazing ocean
#

sigh

chrome beacon
#

So you're not talking about minecraft raids

#

but faction raids

cunning elk
rough ibex
#

yeah outposts and raids = pillager

chrome beacon
#

?nocode

undone axleBOT
#

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

round finch
#

Lmao then someone says my code don't work provides nothing besides that

urban cloak
#

hello

#

i got a question

sly topaz
#

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

manic delta
#

guys my code don't work

jagged thicket
#

lol

sly topaz
jagged thicket
#

smth wrong with how your plugin handles it probably

#

even during login all chunks are sent

#

even the 4*4

sly topaz
#

did you teleport multiple times on login to check

jagged thicket
#

wdym

#

the blocks are fake blocks

#

so they reset on logout

sly topaz
#

I thought the issue was that chunks that weren't previously loaded don't trigger the PlayerChunkLoadEvent on login sometimes

jagged thicket
#

oh yeah how do i check that

sly topaz
#

and System32 seemed to teleport to various random places on login to test that

sly topaz
#

though ig the join event is too late

#

maybe PlayerSpawnLocationEvent?

jagged thicket
#

it seems to still work properly

sly topaz
#

no idea then what the issue was with System's plugin

manic delta
#

maybe bcs using 1.21.1?

jagged thicket
#

that was 1.21.4

manic delta
#

oh sure

jagged thicket
#

check if the event works

#

in a seperate plugin

manic delta
#

ok

sly topaz
#

I am starting to think it's just something wrong with your plugin

manic delta
#

can you both give me your emails?

#

i dont want my code to be public lol

#

is for a server

sly topaz
jagged thicket
manic delta
#

or g username

#

ty

sly topaz
#

you just made me share my email

#

what if someone hacks me!!!

jagged thicket
#

lol

manic delta
#

haha

jagged thicket
#

so i could make email@orang3i.com but i will probably forget to renew the domain and loose the access

sly topaz
#

is your name read orangel or orangei

jagged thicket
#

orange

manic delta
#

sent!

jagged thicket
#

its short for my old youtube name orange(infotainment)

sly topaz
#

I'll read it oran-gay

jagged thicket
#

LOL

#

its orang3i because someone owned orangei

jagged thicket
manic delta
#

damn

#

forgot to add gitignore

#

lol

sly topaz
#

I understand everything now

manic delta
#

pushed

#

haha

#

reload it

sly topaz
#

kotlin ๐Ÿ˜ฉ

manic delta
#

yea sorry

#

the thing about chunks is on PetManager

sly topaz
jagged thicket
#

at a glance it looks nothing weird

#

idk why the 4*4 isn't triggering the event

manic delta
#

Yes, I literally spent 2 days looking for what was wrong

sly topaz
#

I think the issue could possibly be your map keys

manic delta
#

and that's why I put ChunkKey thing

jagged thicket
#

wait try placing blocks on each loaded chunk to mark the chunks loaded

manic delta
sly topaz
#

yes

manic delta
#

just with that

jagged thicket
manic delta
#

yea

sly topaz
#

you're creating a new object and using that to retrieve the chunk, and I don't know if kotlin's data class hashCode implementation is consistent enough to just be creating new objects and expect same result

jagged thicket
#
        // Place a gold block at the center top of the chunk
        int centerX = chunk.getX() << 4 | 8;
        int centerZ = chunk.getZ() << 4 | 8;
        int y = chunk.getWorld().getHighestBlockYAt(centerX, centerZ);

        Block block = chunk.getWorld().getBlockAt(centerX, y, centerZ);
        block.setType(Material.GOLD_BLOCK);
    }```
#

just call this function

manic delta
#

ok ok

#

let me try

jagged thicket
#

and pass the event.getChunk()

sly topaz
jagged thicket
#

but its consistently ingoring the 4*4 radius

#

tho

manic delta
#

yea thats weird

sly topaz
#

add a println before and after the return there just in case tho

#

or rather, set a breakpoint if you do know how to use your IDE's debugger

manic delta
#

ye i know how to use it

jagged thicket
manic delta
#

yep ill do that

#

my ram is going on fire

#

๐Ÿ”ฅ

sly topaz
#

why lol

#

do you have a mc instance, ij and a server open

manic delta
#

16gb are not enough

sly topaz
#

that hurts my processor more than it does my ram

#

I do wonders with 8gb, you'll do fine with 16

jagged thicket
manic delta
#

what processor do you have

sly topaz
#

Celeron N4020 on this laptop

jagged thicket
#

ryzen 5 3500x

manic delta
#

i have a amd ryzen 5 5600 H

#

damn

jagged thicket
#

lol laptop?

sly topaz
#

yeah, government gifted

manic delta
sly topaz
#

I got an amd athlon 320ge on my desktop but I usually use the laptop more as I have more things setup here

jagged thicket
#

weird combo

#

you were talking about getting a new cpu right @sly topaz

manic delta
jagged thicket
manic delta
sly topaz
manic delta
#

let me record

sly topaz
#

I got this desktop just because I knew the motherboard had an am4 socket and a chipset that'd support it

manic delta
#

wtf

#

wait

#

it is weird

jagged thicket
manic delta
#

the blocks doesnt place at the first

#

but after some seconds yeah

#

i think

#

idk

jagged thicket
#

show recording yeah

#

i think the code i sent you places permanent blocks

#

so you should try in new world ig?

#

so check again

sly topaz
#

would your PC explode if you just shared screen on a voice channel

manic delta
jagged thicket
#

alrr

jagged thicket
manic delta
#

see wtf

manic delta
#

only if i do it with 4k

#

wait the video size is 274 mb lol

sly topaz
#

4k is not necessary dw lol

sly topaz
manic delta
sly topaz
#

why is discord's bandwidth for downloading videos so ass

manic delta
#

oh wait im recording with 120fps

#

lmao

sly topaz
#

35 Mbps should be fine for 4k

#

do your fans go brr with these settings lol, my laptop would catch on fire

jagged thicket
#

that video is still downloading for me lol

sly topaz
#

same, discord's bandwidth is ass

manic delta
#

damn

#

sorry

#

haha

jagged thicket
#

whaat it is so weird for you

manic delta
#

yea

jagged thicket
#

for me it places on every chunk

manic delta
#

i really DONT UNDERSTAND WHY

manic delta
jagged thicket
#

LOL

#

you are doing on chunk unload event

#

not chunk load

manic delta
#

oh

#

makes sense

#

lmao

jagged thicket
#

Do the opposite

manic delta
#

yea mb

#

i have too many events on that class

#

it works here

#

but why not with my code

#

i dont understand why

jagged thicket
#

then smth wrong with how your code handles spawning ig

manic delta
#

I did a println for each chunk in the event using my normal code and the 4x4 ones didn't go through there, I put it before all the code

sly topaz
#

put a higher priority to your event?

jagged thicket
#

and try

manic delta
#

ok

sly topaz
#

though it isn't cancellable so it shouldn't be the case that you aren't receiving the event

manic delta
#

mmm weird

#

ill try

#

HIGHEST?

sly topaz
#

it's in reverse

#

lowest gets called first

#

highest last

manic delta
#

oh really?

jagged thicket
#

The event does work here tho so even in the 4*4

manic delta
#

i did not know that

sly topaz
#

yeah, the logic is that if your event handler has the highest priority, then it should be the last to run so that whatever changes you do to the event are the ones that persist

#

then lower priority event handlers would get overriden in that scenario

#

I'm still convinced it is about the map keys having inconsistent hashcodes

#

ah but you did say you put a print before all code and it still wasn't called

jagged thicket
#

to test that one

manic delta
#

trying that

manic delta
#

The block should be set when I enter, because the chunk is supposed to pass through the event, but it doesn't, but if I move away and come back, it does.

sly topaz
#

your video is playable through discord's player now lol

manic delta
#

nice

sly topaz
#

what does your code look like now?

#

just send a screenshot if you don't want to push it to the repo

manic delta
sly topaz
#

what happens if you put markChunk before the assignment of pets variable

manic delta
#

it marks every chunk

sly topaz
#

then it is what I mentioned

#

don't use ChunkKey as key, use something with a consistent hash code

manic delta
#

like what?

sly topaz
#

what type is a chunk x/z, integer or double?

manic delta
#

int

mental moon
#

Coming straight here since the Bundle API is still pretty new.
I'm making an inventory GUI and I have the thought of making the scrolling selection of items in a bundle into their own Icons that a player could click, however from within the InventoryClickEvent and BundleMeta I can't seem to find the item that was selected from scrolling through the Bundle at the time of the event firing.
Anyone here know more about this than me?
I have a video showcasing how the rest of my Icons work, and the Lore on the Bundle describes my desired functionality.

jagged thicket
sly topaz
manic delta
#

let me try

sly topaz
#

long packed = ((long) x << 32) | (z & 0xFFFFFFFFL)

jagged thicket
#

or this ^

manic delta
#

wtf

#

ive never seen that

sly topaz
#
int x = (int) (packed >>> 32);
int z = (int) packed;

to unpack it

jagged thicket
#

we also need to store world name

#

right

sly topaz
#

you can just have a map per world tbh

manic delta
#

well he will use one world anyway

jagged thicket
#

so yeah then try longs

sly topaz
#
// packing the X/Z values
val packed = (x.toLong() shl 32) or (z.toLong() and 0xFFFFFFFF)
// unpacking them
val x = (packed shr 32).toInt()
val z = packed.toInt()

this is how you would do it in kotlin apparently

sly topaz
#

creative tends to make inventory events wacky

mental moon
sly topaz
#

just the part that accepts and denies should be fine

#

oh wait, are you having trouble with that part in of itself?

#

the selected item should be the cursor, technically speaking

mental moon
manic delta
jolly maple
#

?paste

undone axleBOT
jolly maple
#

https://paste.md-5.net/jibudehoci.makefile

Hello, I currently am making a minecraft plugin and I want to publish it into my maven local and when I do the publishInMavenLocal task, it works fine and it creates folder but I can't import it anywhere...

sly topaz
mental moon
jagged thicket
#
    fun onLoadChunk(event: PlayerChunkLoadEvent) {
        val key = ChunkKey(event.chunk.world.name, event.chunk.x, event.chunk.z)
        val pets = petsByChunk[key] ?: return

        for (pet in pets) {
            if (pet.exist()) continue
            pet.spawn(fromLocation(pet.getData("last_location")))
            if (pet.hasData("behavior")) {
                val fromData = PetBehavior.valueOf(pet.getData("behavior"))
                pet.behavior = fromData
                if (fromData == PetBehavior.SIT) {
                    pet.sit()
                }
            }
        }
    }

is it not pushed for me yet

mental moon
sly topaz
#

let me try make something similar real fast and see if it works for me ig

mental moon
#

That part is intended since the event is canceled upon click.
I don't know if the API has a way to get to that selected item.

sly topaz
#

I mean, the selected item technically goes to the cursor, but that's before cancellation

#

maybe try getting the cursor before cancelling it

#

do make sure to be in survival as the cursor on creative is completely client-sided and will throw you for a loop

jagged thicket
#

i think this has to fix the issue

#

otheriwse smth is cooked

manic delta
#

ill try it tmr

#

im sleeping

jagged thicket
#

alr

sly topaz
#

tbf I only gave it a quick glance so it could be anything, but it marking all chunks after putting the function before the return statement validating the map makes me believe it is indeed that

#

I can give a more in depth look afterwards, there's some thing I might offer might unsolicited advice on as well

mental moon
sly topaz
#

I don't believe the client tells the server anything about the bundle inventory, but I could be wrong

mental moon
fresh mesa
#

Trying to implement adding custom food items to spigot 1.21, how to create also custom models?
any idea?

blazing ocean
#

resource packs

fresh mesa
#

No any possible way without it?
I hate making them wait for that screen..

blazing ocean
#

no

#

the resources have to come from somewhere

#

I will never understand the hate against using resource packs

fresh mesa
#

Can you give me links for tutorials how to create custom items or foods and blocks with models?

fresh mesa
blazing ocean
# fresh mesa Can you give me links for tutorials how to create custom items or foods and bloc...

https://youtu.be/Cw8PPPEl_IQ if you're using 1.21.5 and above, the custom model data section doesn't apply anymore, but the rest is still the same

A huge thank you to Violet for teaching me all of this: https://twitter.com/violxiv

A stream where I make hats: https://www.youtube.com/watch?v=PfHN7cO87sc

Minecraft commands, particularly around NBT values have changed from 1.20.5 so I've updated them below for those who need it :)

00:00 - Intro
00:50 - Creating your model
06:49 - Texturing ...

โ–ถ Play video
fresh mesa
#

Thanks!

sly topaz
#

only technically because Spigot has no API for it and the behavior itself is apparently broken on Spigot or so people have said before

smoky anchor
fresh mesa
smoky anchor
#

lmao
give the item the block reach attribute, but negative
So player literally can not interact with any blocks and thus can only eat the item XD

cursive kite
#

What is the best way to reference a boss entity, using LivingEntity breaks once the unchunk unloads

smoky anchor
#

UUID would work

cursive kite
#

I considered that but what is the best way to pull it again, expensive to loop all entities in the world when I need to grab the health

fresh mesa
smoky anchor
#

Add the food and consumable components

chrome beacon
#

There's a getEntity method that takes a uuid

cursive kite
#

Ah is it within World object

snow kelp
#

Hey in my Mod when I click the Bar I my Minecraft Crashes. Im on Mac, for my friend on windows everything works fine. Can someone please help me and check the crash report?

drowsy helm
#

or do you mean plugin?

snow kelp
#

I mean mod, but maybe heres a modder who can help me. ๐Ÿ˜ฆ

#

I can pay if someone wants.

thorn isle
#

nuh

smoky anchor
thorn isle
#

get an actual computer
based

flat lark
thorn isle
karmic mural
#

Wanting to store custom data on the entity itself. I've usually used PDC but is there something else I should consider? I'd be storing a couple integers and datetime objects

smoky anchor
#

PDC works perfectly for this, I do not believe spigot provides anything else
And there should not be any reason to reinvent the wheel for a few values

thorn isle
#

pdc is the intended facility for this yes

blazing ocean
#

no, the pdc is the best option

thorn isle
#

well, the only exception is if you need to access the data while the entity is unloaded

karmic mural
#

Cheers, just wanted to make sure I wasn't completely out of date as it's been a while since I made any plugins

thorn isle
#

in that case you might want to consider a database or some such

jolly maple
eternal oxide
#

?whereami

primal stirrup
#

I am currently working on an plugin and trying to set an items lore in an GUI but somehow it does not work/wants to set the lore in the GUI, anyone that knows about such an issue?

young knoll
#

?nocode

undone axleBOT
#

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

primal stirrup
#

There should be an lore

rotund ravine
#

hasLore

primal stirrup
#

Yes it has an lore check that as well

#

Otherwise if it would be null it would put "no lore"

young knoll
#

Where are you actually making the item

primal stirrup
#

In the GUI creation where it sets the lore of the item

#

This sets the lore in the item meta so it should be set and it is set but not displaying in the GUI which I am opening

rotund ravine
#

I feel like Iโ€™m missing a few things.

primal stirrup
#

Which part would you like to see?

#

The append lore just calles this method to set the lore

chrome beacon
#

How are you making that itemstack

#

Like all of the calls on it

primal stirrup
#

So I am creating an CustomItem and set the ItemStack

chrome beacon
#

Any item flags?

primal stirrup
#

Nope,

#

That is all done later with Item Meta which is only called when needed.

chrome beacon
#

So no item flags on that skull?

primal stirrup
#

Basically the whole item with the lore gets retrieved correctly only the moment it should display the lore it does nothing

#

I even created just an new GUI with nothing in it still the same issue

chrome beacon
#

So you're not adding any item flags?

primal stirrup
#

the lore underneed it should be the same as the other button

chrome beacon
#

Still haven't gotten an answer

primal stirrup
#

No, only the Item Meta and than the lore field

rotund ravine
#

So u got some lore methods issues, or concurrency issues / object instance

chrome beacon
#

item flags are part of the item meta

#

I'm just making sure that you did not put the hide lore item flag

chrome beacon
#

that would not be the first time I've seen that happen if so

rotund ravine
#

I hope not

primal stirrup
#

No I did not, but I will investigate

rotund ravine
#

Try setting the item back in the inventory after rrunning ur modifications

primal stirrup
#

btw I have also an button with the command block which shows an default lore

chrome beacon
#

Some people just went addItemFlags(ItemFlag.values()) and then the lore went away

#

wondering why ๐Ÿ’€

chrome beacon
#

It is different from your regular lore

#

For safety reasons

worldly ingot
#

It should only show up if it has a command in its NBT though

#

A standard command block should be fine, I think?

primal stirrup
#

Yea the lore is client side, I am currently checking all flags.

worldly ingot
#

Also, yes, technically it's not NBT anymore lol

primal stirrup
#

Okay I made sure that all flags are not there but it still somehow does not show up

#

I double checked if the lore it empty but its not the false false are checks for the hasEnchantments and Item info

quartz gull
quartz gull
robust helm
#

chat should i use postgresql or mariadb?

quartz gull
robust helm
#

i have zero experience in sql databases

#

or like

#

1 hour of struggling with both of them

quartz gull
#

its not very hard

#

hold on

robust helm
#

whats more popular in companies?

quartz gull
quartz gull
robust helm
robust helm
#

that elephant does look nice

#

its decided!

primal stirrup
chrome beacon
#

Still haven't showed us how that item is created

#

so we cannot try and recreate the issue

chrome beacon
#

If you don't want to share your code make a minimal reproducable example

smoky oak
#

how does buildtools decide what to put under latest? its still saying 1.21.4 for me

chrome beacon
#

It will be changed to 1.21.5 when it's considered stable

primal stirrup
#

Okay this is where the button is called/created from the place in the GUI until the sending to the player.
So the menu extends an class called GUI which has an construct method where the button creation is in see first image, than in the button creation it sets the material and adds the lore in the other shown images.
The CustomItem is an class which basically holds the ItemStack and its properties, than in the GUI class it creates the full GUI including the button assigning.

That is from where the button is created until the button is set (exactly like I showed before)

chrome beacon
#

oh no detecting inventories by name

mortal hare
#

I wonder how good is to use final keyword on methods in java. While this might sound counter intuitive usually to make methods not overrideable but you can setup for example abstract classes which act like in a sense immutable classes/records with which you guarantee from design perspective that data will be always immutable and safe no matter what the implementation is:

public abstract class Foo {
  private final int data1;
  private final int data2;
  private final int data3;

  public Foo(int data1, int data2, int data3) {
    this.data1 = data1;
    this.data2 = data2;
    this.data3 = data3;
  }

  public final int getData1() {
    return this.data1;
  }

  public final int getData2() {
    return this.data2;
  }

  public final int getData3() {
    return this.data3;
  }

  public abstract void DoSomething();
}


public class Bar extends Foo {
  public void Bar(int data1, int data2, int data3) {
    super(data1, data2, data3);
  }

  public void DoSomething() {
    System.out.println("Doing something");
  }
  // Cant override immutable getters good, its unsafe. Also if you override existing getters, are you sure you're writing good code anyways?
}

sure this is kinda annoying from modders perspective, but imo it could allow for bugprone code since you cant override immutable data, just like you can if you've implemented interface or overriden class methods without final keyword.

what do you guys think? Ik not everybody would like this, but you know me guys i like to experiment with OOP design overall so im thinking how to utilize things properly to ensure bugprone code

chrome beacon
primal stirrup
mortal hare
#

you.. can?

chrome beacon
#

^^ you can

spare marsh
#

How to avoid your GUI being use to dupe wit UI Utils?

#

How does UI Utils even work?

chrome beacon
#

It simply skips sending the inventory close packet to the server

#

causing the inventory close event to not be fired

primal stirrup
primal stirrup
#

Hey

chrome beacon
#

if it hasn't been closed

mortal hare
#

honestly why dont we have abstract records

spare marsh
primal stirrup
#

aaaa how you doing

spare marsh
#

Doing good.

primal stirrup
spare marsh
chrome beacon
#

hm? what part

spare marsh
#

All of it Haha

#

Like I'm looking on how to avoid duplications with it

#

with UI Utils

chrome beacon
#

A normal client will tell the server that they closed their inventory. What tools like that do is skip that part allowing you to exit the inventory without the server knowing. When a player then opens the inventory again you recreate the inventory with new items causing the dupe

#

Since the saving items that were removed happens in the close event which isn't fired

spare marsh
#

Ohhhh

primal stirrup
# mortal hare I wonder how good is to use `final` keyword on methods in java. While this might...

Here is an example of how you could use it:

public abstract class Foo {
    private int data1;
    private int data2;
    private int data3;

    public Foo(int data1, int data2, int data3) {
        this.data1 = data1;
        this.data2 = data2;
        this.data3 = data3;
    }

    public final int getData1() {
        return this.data1;
    }

    public final int getData2() {
        return this.data2;
    }

    public final int getData3() {
        return this.data3;
    }

    public abstract void doSomething();
}

public final class Bar extends Foo {
    public Bar(int data1, int data2, int data3) {
        super(data1, data2, data3);
    }

    @Override
    public void doSomething() {
        System.out.println("Doing something");
    }
}```

Because the variables are already private they can't be changed in the other classes. So if you create an method that does something with the values you can retrieve them with the get methods or create static `.setData1(int data1)` to set the data.
This allows you to control which data is modified if needed.
chrome beacon
#

have a fallback

mortal hare
#

java pls port this from c#:

public abstract record Foo(int data1, int data2, int data3) {
  public abstract void DoSomething();
}

public record Bar(int data1, int data2, int data3) : Foo {
  public override void DoSomething() {
    Console.WriteLine("Doing something");
  }
}
chrome beacon
#

Problem is records already extend a class

#

so if you try to extend a record with another record it'd be extending two classes

mortal hare
#

RecordClass or smth

spare marsh
mortal hare
#

oh well that would break ABI with current impl of records

#

๐Ÿ™‚

chrome beacon
#

record Bar(int c) extends Foo, Record

#

wouldn't work

chrome beacon
mortal hare
#

record Foo(int c) extends RecordClass
record Bar(int c) extends Foo
would but that would break applications which rely on current impl of records

#

unless JVM would convert that bytecode somehow

chrome beacon
#

Yeah you can do that but it would require a change in spec

spare marsh
#

Basically if I have an inventory that is only a menu with clickable options, it doesn't affect that one because you don't modify anything on there

chrome beacon
#

and how the system works

#

doable ig ๐Ÿคทโ€โ™‚๏ธ

spare marsh
#

Got it, thanks!

chrome beacon
#

I do wonder if that causes it to leak memory though

#

I'm not sure how the server handles that tbh

chrome beacon
mortal hare
#

what a difference in terms of how much to write lol

#

no hate i love java