#help-development
1 messages ยท Page 1256 of 1
Yeah
too much audio and netoworking problems
i wanted to use it for hosting redis and some databases
and maybe for a photo hosting
its a bit of a flex to have a raspberry pi tho, def some aura to it
True
I haven't done too much programming recently
i still have it somewhere
sell it to me
No
ah, I assume u guys also the a ton of maths and other goofy courses?
im starting uni soon so might use it there
Yeah
linear algebra, multivariable calculus etc?
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
idk i only had like crappy offbrand 2 dollar arduinos
i made a rc car, it hit a wall and brok
Not math, I made sure to stay away from that
i just want a random stuff hosting
oh woaw, u get to pick? :o
I just use a friend's whatever for that
probability and statistics?
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
:,)
๐ซ
ich vs och
tbf tho, i didnt know that data science and data technology (or well, data engineering) were such different fields until very recently
Hm? No
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
Yeah that's true ig
its annoying cuz the maths we study for example isnt even about numbers anymore- just symbols
Yeah I've seen some
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
if you use paper then you shouldn't be discussing it here ๐
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!!!
idk if most people (including me) would prefer dcl over kt
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
currently tho, if im forced to use maven i would just add the paper-server and dep
someone could create a monster and make paper work with specialsource
it was very delicious eye candy i can tell ya that
is there a recommended gradle plugin to run a spigot server for plugin development?
it works in offline mode too now right
because the problem was for me atleast only in offline mode
yea that
not particularly, you can just use run-task by jpenilla and enable legacy plugin loading as well as changing the classpath so that it runs a spigot server if you'd like
I was looking at that but those steps weren't documented. I'll look again
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
that'd be great
well I tried posting a snippet of what I thought might work but this channel ate it
?img
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
weird, verifications must expire. granted it's been a few years
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
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
ok great, thanks
hmm, errors for me with Cannot set the property 'main' because the backing field is final.
try main.set(...)
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
what line are you getting the error in
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
you should use jpenilla's resource-factory instead
it's the standard one
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
you should be able to just import that constant
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 ๐
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
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
no
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?
nah run is fine, I just was assuming incorrectly it'd use a different spot but then noticed it was using run
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?
Why tf do you need aikar flags for testing ๐
If I remember correctly, you may wanna remove them after
Yeah need to remove them
or just Bukkit#removeBossBar
but yes
also don't forget to remove the listener
(if you have one per bossbar)
I always forget about the Bukkit static methods
for reference the Bukkit class is a wrapper around the server
so when you do getServer you can usually just do Bukkit instead
it's just a single listener creating boss bars for timers
good to know, thanks :)
Who wants to make a cpvp bedwars server with bedwars with like maces ect with custom plugins 32gb I fund
No hookers and blow? I'm out
If I had a penny for every bedwars server
I think that's payment, 32 Giga Bitcoins
Or maybe cat pictures
Everyone knows the secret to a good bedwars server is 32gb of cat pictures
Thatโs how hypixel does it
just 32gb
you would be broke
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
i probably made you thousands in my early days
can I somehow "concatenate" two NMS Components? (net.minecraft.network.chat.Component)
or does there exist some method like replace?\
You mean like [{text:"Hello "},{text:"World"}] ?
Yes, that is possible somewhere
uh i guess? something like that
That would be a snbt representation of two literal text components
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
ok, gimme a bit
alr
Can you just drop the code for your components ?
Ok, MutableComponent has method append(Component)
You can most likely use that
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();
}```
Component.literal returns MutableComponent
So just replace Component message with MutableComponent and then you can use append
np
you are literally my savior once again
@smoky anchor but there's no replace method, right?
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)
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
So you're thinking about this wrong
uh, maybe..
You would not "replace" anything
You would append each part
And each time create new component
so I split the String "Player {player} is holding {item} in his hand." and create component for each part?
Correct
alr, thanks
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? ๐คก
kotlin scripts are evaluated directly and you can't really fetch the compiled output
it's due to the way their scripting hosts work
they aren't typically compiled since they're for scripting, but they are compilable, no?
they do get compiled
@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.
Show how you're constructing the text please
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();
}```
That's an interesting way of doing that, seems too complicated
uh..
But I think I know why you have to do that
I don't really know a different way
what do you mean?
You have "Messages.show-%s"
Which I assume resolves to "Player {player} is holding {item} in their hand."
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}'```
Which is not exactly compatible with this append way of doing the components
oh hell no, you're not mixing legacy colors with components
I mean, keep it
It's fine, you're not updating anyways
Just... ๐คฎ :D
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
it does
Yeah, legacy colors are well.. legacy and most likely to be removed
wdym removed?
By mojang, the support for ยง2 as green will be probably removed in some version
mojang will remove the rendering of legacy formatting in the client
but bukkit getDisplayName from bukkit ItemStack returns only the name, without formatting
oh jeez, how will colors be handled then in configs
Oh...
yea..
I doubt that will change, only internally they will be handled in the Mojang way. I can't see ppl ever leaving & at least for spigot
oh, so whats the problem with using it then
As I said, it's fine. You don't have to worry about it if it works.
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
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?
ye, but we all know what he meant
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
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.
me neither, so I guess I will do it this way for now, thank you for your help!
yeah just get the custom_name/item_name component :thinksmart:
would be really cool if there was an API for this 
keep dreaming lynx
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?
If it works :D
it works perfectly!
Happy to hear
thank you so much steve and emily
api for what?
for dealing with components
oh yea..
Oh gosh
Does anyone know the packets for spawning, removing etc. A fake player for npcs?
player info update, add entity and remove entities
Thankss
Can someone help me how to add minecraft attributes to code?
Yes, show us what you have so far
And version ?
1.21.4
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
Pretty sure it's no longer GENERIC_
And where did builder come from ๐ค
oh yeah, it isnt thank you
it actually is
Ye, outdated knowledge
And you don't even know how to fix this easy bug
First actually learn java
without AI
That's not really docs, just the decompiled and remapped constructor signature
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
?mappings
Compare different mappings with this website: https://mappings.dev/
Yeah that's also an option
alright how do i get the entity data because i just got a SynchedEntityData from npc.getEntityData() for example
Why do you think I would know lol
just set it to zero and then send entity metadata packets, easier
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
๐ฅ ๐ซ
๐ฅฃ
in this case it's best to use citizens, and providing support for stuff like this is just pretty annoying tbh
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
I don't really see an API for that
If you want you can use this Unsafe API https://hub.spigotmc.org/javadocs/spigot/org/bukkit/UnsafeValues.html#modifyItemStack(org.bukkit.inventory.ItemStack,java.lang.String)
declaration: package: org.bukkit, interface: UnsafeValues
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
Yeah that works too
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));```
better use entitylib
you need to set the player's connection to something
a noop impl
Noop
is there any api for building Tags programmatically?
Donโt think so
bummer, wish there was
are you trying to spawn a NPC
if that's the case, you're better off disguising a different entity as a player
eh not really
I mean, implementing either solution sucks, but by disguising at least you get more freedom
https://www.spigotmc.org/threads/649605 there's someone who implemented the one with the connection for fall damage and what not
then also just spawned another entity for pathfinding
eh this works fine for me
that doesn't seem to handle spawning the NPC when they come into tracking distance tho
haven't tested that
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
guys, i wanna make a toggle message command for my friend's server, how would i go about doing it
toggle message as in, disallowing people from chatting? Or like, not receiving DMs?
also, are you a developer or are you looking for a plugin to do it? Because this channel is for the former
personally i'm still of the mind that depending on citizens/libsdisguises is the most hassle-free and robust option to player npcs
citizens API is ass, libdisguises sounds fine though
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
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
do you have the location only?
if so, you can just bit shift the x and z by 16 and then check World#isChunkLoaded
yes, I have the x y z and the world name, ignoring the pitch and yaw from the player's view
ig you could also just do Location#getChunk#isLoaded
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?
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
it's loaded when the chunk status is FULL
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
Chunks only load around players
see the minecraft wiki for chunk loading
bukkit only considers entity-ticking chunks (the highest load level) as loaded
there are other load levels as well, like block ticking or border
And the only limit to how many can be loaded is your ram
so chunks are unloaded after n ticks or as soon as players leaves the range.. that is sufficient for chunks to stay loaded
sort of except sometimes but usually yes
the wiki will provide a much more comprehensive answer
alright
ah damn, it doesn't embed
you're barely using half of it, why do you need more
๐
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
I used to get OOM crashes back when I had 16 gigs
average linux experience
you probably didn't have swap setup properly, it should never just crash on you
you should run your server entirely on swap
well it didn't crash but freeze and then become irresponsive and crash at some point
but I did set up 8GB of zram
unused wam is wasted wam
dedodated wam
how to age your disk by 10 years 101
how to age your disk by 101 years*
I am still doing fine with 8gb of RAM
wait till you're running 5 IJ instances, 2 MC servers, one proxy and 2 MC instances
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
that's when it starts to get fun
why would one be running more than one instance of IJ
because I have to work on multiple parts of one codebase
that is not just a monorepo
rad do you not have workspaces
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?
their gradle integration is horrid
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 ๐
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
multiple open projects
entirely up to you, if its still the same concept you could just release an update
is it a new plugin as in, it does something completely different, or as in the internals have changed completely
because if it is still doing the same thing as base, I'd just release it as a new update - rewrite done
it's the same concept but the internals are completely rewritten and it doesn't support the old one
I don't want to confuse people, especially if I release a minor update for the old one
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
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
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
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
just release an update saying if you're still using this, use x plugin now redirecting to your new plugin kek
Meanwhile some modpacks take that just to run
some modpacks suck so that doesn't surprise me
It was worse a few versions back
no care for base mechanics whatsoever, just keep all chunks loaded for my rlcraft machine
Modern ones seem to behave a bit better
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
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
toggle message as one player can toggle direct messages with another, where if toggled then it will redirect all their normal chat messages to the selected player as if they used /msg <selected player> but without needing to do it every time
im developing
so like channels, I see
usually you'd just have to set the recipients in the AsyncPlayerChatEvent
add everything to the code config and use that to generate the default config
Copilot is starting to hallucinate with these autocompletions
wont be too long before i start to too
does it work as a vanilla /msg
more like a normal chat message only a specified person can see
Thatโs just a /message command
yeah i wanna do it automatically with a command toggle
how do I get a specific enchanted book as an ItemStack?
I know how to use the regular meta methods that we have now, but I need to know how to change an item in hand from a book (or spawned in 403 (enchanted...
Then whatโs the question
^
nvm ig
I tried to search up how to install local dependencies but issue is I've tried generating one but throws a error.
put the group id inbetween quotes
same with the version
Also, I have it generated and put it in my pom.xml
I get a NoClassDefFoundError: https://paste.md-5.net/hexexayini.bash ? Do I have to put a use a repo for its location or is the because some sort of shading issue
shading issue most likely
what does your pom look like
<!-- 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>
what scope do you have for the dependency in question
<dependency>
<groupId>de.freesoccerhdx</groupId>
<artifactId>EnchantmentsAPI</artifactId>
<version>1.0.0</version>
<scope>provided</scope>
</dependency>
Got it
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
running buildtools thru gui btw
During login are the initial chunks in the view distance pre loaded and sent unlike other chunks?
what do you mean
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
discord's player sucks so bad
wait, it isn't discord's fault, that's a damn 217mb recording lol
yeah look at this
Thats not me btw
well, whatever you're using to record, it sucks
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
no
Do you speak spanish
I am not sure what I was supposed to see there
I think my name makes it pretty clear
at the end it spawns ORANGE
Ok see, the cat is spawned on PlayerChunkLoad event which is a paper specific event but that spawn doesn't happen during login because the 4*4 is pre loaded i believe
it isn't preloaded, it is just never unloaded for the player
packet is probably not resent as it stays on the client's cache
happens with any language tbf
I find it hard to keep my japanese level the same, as I don't have anyone to practice it with
is it only for the initial 4*4 chunks?
it shouldn't be, no
does the same happen if you keep a chunk force loaded and relogin there
it might just be becuse those are spawn chunks
but the player load chunk event should still be sent tho, I don't get it
yeah its kinda weird
if the chunk is unloaded and re loaded it works again
only during login the event isn't called
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
the packet is recieved but the event is not fired
otherwise the chunks won't be visible no?
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
@manic delta try this later!!
well actually not on instantation but on the sendChunk method of PlayerChunkSender class
i was looking at the PlayerList Source and it seemed to call chunk loading earlier
wait leme show
you'll probably need paperweight userdev in order to place breakpoints on paper code though
does it call PlayerChunkSender#sendChunk anywhere, because that's where the PlayerChunkLoadEvent gets called
what does getChunkSource return?
ServerChunkCache
does addEntity manually send a ClientboundLevelChunkWithLightPacket anywhere?
I'll just compile paper and check myself lol
alr
im trying not to make a code wall here lol
was trying to paste only the specific parts
question, how is the data of vanilla weapons stored? like the attack damage / speed
they're stored in data components
though, both can be modified with an attribute
actually i have a 4k screen
Should I do that in the paper code?
first can u just verify if the 4*4 chunks are even sent through packets / the event
in a seperate plugin
so debug can be easier
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
Okay I'll see after uni
heys guys i need some help, i am spawning some wither skeletons but they are getting immediately removed when thye are spawned https://pastebin.com/cKMik2QG
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
the version is 1.21.1
would really appreciate the help
The difficulty is in pacific?
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
that is not even released yet
thanks!
What
I bought the plugin in spigot, can I have it reflected on my account in https://phoenixdevt.fr/?
If you bought the plugin in spigot, you should be able to download it on spigot
And why do you mention me?
God knows
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
define "enhancing"
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);
}```
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
ah jeez well
hello, im searching for a RaidingOutpost plugin (1.8)
what are you talking about
?howold 1.8
Minecraft 1.8 is 10 years, 7 months old.
of course it doesnt have a 1.14 feature
10 years ๐
for 1.8.0
1.8.9
Minecraft 1.8.9 is 9 years, 4 months old.
Not much better
bro?
yes?
didnt you play 1.8 faction server ?
sigh
So you're not talking about minecraft raids
but faction raids
Time to head over to #help-server
yes iam
yeah outposts and raids = pillager
?nocode
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.
Lmao then someone says my code don't work provides nothing besides that
?ask
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!
guys my code don't work
lol
is it still that code that spawns cats on playerchunkload or something completely different
@manic delta @sly topaz the event works properly https://paste.md-5.net/egayomemat.java
smth wrong with how your plugin handles it probably
even during login all chunks are sent
even the 4*4
did you teleport multiple times on login to check
I thought the issue was that chunks that weren't previously loaded don't trigger the PlayerChunkLoadEvent on login sometimes
oh yeah how do i check that
and System32 seemed to teleport to various random places on login to test that
just teleport the player randomly in the join event ig
though ig the join event is too late
maybe PlayerSpawnLocationEvent?
no idea then what the issue was with System's plugin
yea it does
wtf but why for me no :sadge:
maybe bcs using 1.21.1?
oh sure
ok
send your code here
I am starting to think it's just something wrong with your plugin
ill open a repo
can you both give me your emails?
i dont want my code to be public lol
is for a server
lol
haha
i own orang3i.com currerntly
so i could make email@orang3i.com but i will probably forget to renew the domain and loose the access
is your name read orangel or orangei
orange
sent!
its short for my old youtube name orange(infotainment)
I'll read it oran-gay
leme see
I understand everything now
kotlin ๐ฉ
yea sorry
https://github.com/system32developer/TestPlugin/blob/381454a4364111049de08a05b525a2967557306b/src/main/kotlin/com/system32/schooldaysPets/Pet.kt#L70-L117 this code is on testing so dont blame me if it sucks
the thing about chunks is on PetManager
don't be, I am just old and stuck in my ways but kotlin is usually a fine choice
yes
here to be exact
Yes, I literally spent 2 days looking for what was wrong
I think the issue could possibly be your map keys
and that's why I put ChunkKey thing
wait try placing blocks on each loaded chunk to mark the chunks loaded
petsinchunks map?
yes
ill try without the code logic
just with that
try even with code logic first
yea
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
// 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
and pass the event.getChunk()
even less so considering it is based on the property values and ChunkKey has a String as property
yea thats weird
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
ye i know how to use it
but yeah remove this logic temporarily and place blocks with markChunk first
16gb are not enough
that hurts my processor more than it does my ram
I do wonders with 8gb, you'll do fine with 16
for me 16gb its fine for that maybe its the cpu yeah
what processor do you have
Celeron N4020 on this laptop
ryzen 5 3500x
lol laptop?
yeah, government gifted
yes
I got an amd athlon 320ge on my desktop but I usually use the laptop more as I have more things setup here
this clock speed is good but core count is low
weird combo
you were talking about getting a new cpu right @sly topaz
i should see something like this right
yea
ok so my code is not the issue
yeah, a 5080xt3d or whatever it is called
let me record
I got this desktop just because I knew the motherboard had an am4 socket and a chipset that'd support it
also show code snippet
show recording yeah
i think the code i sent you places permanent blocks
so you should try in new world ig?
so check again
would your PC explode if you just shared screen on a voice channel
if i restart the server with intellij run buttom everythings rollback
alrr
yeah share screen lol
see wtf
nope
only if i do it with 4k
wait the video size is 274 mb lol
4k is not necessary dw lol
set whatever recording software you use to record at 1080 or 720 smh
i think im using 1080
why is discord's bandwidth for downloading videos so ass
why 120, just do 60 and set a lower bitrate
35 Mbps should be fine for 4k
do your fans go brr with these settings lol, my laptop would catch on fire
that video is still downloading for me lol
same, discord's bandwidth is ass
whaat it is so weird for you
yea
for me it places on every chunk
i really DONT UNDERSTAND WHY
and thats literally all the code
Do the opposite
yea mb
i have too many events on that class
it works here
but why not with my code
i dont understand why
then smth wrong with how your code handles spawning ig
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
put a higher priority to your event?
now also do the pet logic along with block placement
and try
ok
though it isn't cancellable so it shouldn't be the case that you aren't receiving the event
oh really?
The event does work here tho so even in the 4*4
i did not know that
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
OK then can we iterate through the mapkeys and place blocks
to test that one
trying that
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.
your video is playable through discord's player now lol
nice
what does your code look like now?
just send a screenshot if you don't want to push it to the repo
what happens if you put markChunk before the assignment of pets variable
it marks every chunk
then it is what I mentioned
don't use ChunkKey as key, use something with a consistent hash code
like what?
what type is a chunk x/z, integer or double?
int
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.
val key = Pair(chunk.x, chunk.z)
val pets = petsByChunk[key]
try smth like this?
you could just pack them in a long then
let me try
long packed = ((long) x << 32) | (z & 0xFFFFFFFFL)
or this ^
int x = (int) (packed >>> 32);
int z = (int) packed;
to unpack it
you can just have a map per world tbh
well he will use one world anyway
so yeah then try longs
// 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
did you try in survival
creative tends to make inventory events wacky
Yeah, still points to the Bundle itself rather than any item selected within it
what does the code look like
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
Let me see if it's on the cursor.
It's a bit of a cluster, but here's my EventListener anyways
https://pastebin.com/NzWp1a8L
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
check the repo, is the implementation ok?
?paste
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...
yeah looks fine to me
Can confirm it never touches the Cursor.
The event it canceled as soon as it sees that it's within one of my menus.
in survival?
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
Yes, no matter the gamemode.
let me try make something similar real fast and see if it works for me ig
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.
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
nvm i was on a diff branch lol
i think this has to fix the issue
otheriwse smth is cooked
alr
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
Moved it to before cancellation to the same effect.
I'm confident I could get it if I waited a tick, but the Menu only works if the event is canceled.
I'm remembering theres some kind of scroll event related to the hotbar, I'll snoop there
I don't believe the client tells the server anything about the bundle inventory, but I could be wrong
This is unfortunately what I'm seeing too.
No way that I can see to get the scoll index to even reference the bundle's ItemStack[] contents and pull it there.
Trying to implement adding custom food items to spigot 1.21, how to create also custom models?
any idea?
resource packs
No any possible way without it?
I hate making them wait for that screen..
no
the resources have to come from somewhere
I will never understand the hate against using resource packs
Can you give me links for tutorials how to create custom items or foods and blocks with models?
no, i get it, i Just thought it possible without, but now it makes sense
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 ...
Thanks!
in recent versions you can technically send the resource pack on the configuration phase so it isn't too bad
only technically because Spigot has no API for it and the behavior itself is apparently broken on Spigot or so people have said before
Alternative is heads
But those may have the issue of being placeable
I tried, but there is no much what to do with it..
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
What is the best way to reference a boss entity, using LivingEntity breaks once the unchunk unloads
UUID would work
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
But there is no animtion of eating how can it be appetizing?
Add the food and consumable components
Don't need to loop
There's a getEntity method that takes a uuid
Ah is it within World object
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?
Spigot doesn't have anything to do with mods
or do you mean plugin?
I mean mod, but maybe heres a modder who can help me. ๐ฆ
I can pay if someone wants.
nuh
- Do not crosspost
- Wrong server completely
- No, don't pay someone for that wtf
- Your issue is Mac, get an actual computer
- Depending on mod loader, go to their server, find the right channel or one closest to it and post all info you can
get an actual computer
based
https://paste.md-5.net/tijigaliru.java
Im using InvUI (https://docs.xenondevs.xyz/invui/). I am not sure how I can create like a confirm system within the ui due to the fact the only function it gives you is when the input changes.
no clue what a confirm system is but presumably you'd use handleClick or some derivative like it's used to increment/decrement a count here
https://docs.xenondevs.xyz/invui/basics/#__tabbed_4_2
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
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
pdc is the intended facility for this yes
no, the pdc is the best option
well, the only exception is if you need to access the data while the entity is unloaded
Cheers, just wanted to make sure I wasn't completely out of date as it's been a while since I made any plugins
in that case you might want to consider a database or some such
can someone help me on this :)
?whereami
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?
?nocode
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.
There should be an lore
hasLore
Yes it has an lore check that as well
Otherwise if it would be null it would put "no lore"
Where are you actually making the item
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
I feel like Iโm missing a few things.
Which part would you like to see?
The append lore just calles this method to set the lore
So I am creating an CustomItem and set the ItemStack
Any item flags?
So no item flags on that skull?
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
So you're not adding any item flags?
the lore underneed it should be the same as the other button
Still haven't gotten an answer
No, only the Item Meta and than the lore field
So u got some lore methods issues, or concurrency issues / object instance
item flags are part of the item meta
I'm just making sure that you did not put the hide lore item flag
๐ซ
that would not be the first time I've seen that happen if so
I hope not
No I did not, but I will investigate
Try setting the item back in the inventory after rrunning ur modifications
btw I have also an button with the command block which shows an default lore
Some people just went addItemFlags(ItemFlag.values()) and then the lore went away
wondering why ๐
That lore is clientside
It is different from your regular lore
For safety reasons
It should only show up if it has a command in its NBT though
A standard command block should be fine, I think?
Yea the lore is client side, I am currently checking all flags.
Also, yes, technically it's not NBT anymore lol
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
are you sure your config contents are being retrieved correctly
assuming this is retrieving information from the config
chat should i use postgresql or mariadb?
purely preference on your part. I like to use postgresql
i have zero experience in sql databases
or like
1 hour of struggling with both of them
whats more popular in companies?
postgresql is better i guess. however each have their own use cases. So to each their own
hm ill prob look into the syntax first then. thank u!
Yes I am sure, so in the image show it shows the buttons being set. The lore is retrieved its not empty, but it does not show the lore.
It might be the p.updateInventory() but I wouldn't assume it is as it works for 1.21.4 and lower.
Still haven't showed us how that item is created
so we cannot try and recreate the issue
(you've only showed incomplete parts)
If you don't want to share your code make a minimal reproducable example
how does buildtools decide what to put under latest? its still saying 1.21.4 for me
It will be changed to 1.21.5 when it's considered stable
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)
oh no detecting inventories by name
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
Time to make a minimal reproducable example
You can't make the private variables final if you set them in the contrsuctor.
You can how ever make the get..() method final.
This will ensure that you can't modify the values
you.. can?
^^ you can
It simply skips sending the inventory close packet to the server
causing the inventory close event to not be fired
So the weird thing is that the moment it is set the meta data returns the lore but it doesn't show all the properties are there so thats the weird part.
Hi Greez
Hey
Track your inventory instance and reopen it instead of making a new one
if it hasn't been closed
honestly why dont we have abstract records
I'm java4life
aaaa how you doing
Doing good.
No idea
I'm still a bit confused on how that works
hm? what part
All of it Haha
Like I'm looking on how to avoid duplications with it
with UI Utils
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
Ohhhh
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.
in short, don't rely on the InventoryCloseEvent
have a fallback
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");
}
}
Problem is records already extend a class
so if you try to extend a record with another record it'd be extending two classes
make a new class then
RecordClass or smth
So like it won't even inventories that you can't modify?
Not sure what you mean?
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
Yeah you can do that but it would require a change in spec
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
yeah then it doesn't matter
Got it, thanks!
I do wonder if that causes it to leak memory though
I'm not sure how the server handles that tbh
It diffidently could on your end if you track the instance and don't clean things on player quit
in java
in c#
what a difference in terms of how much to write lol
no hate i love java

