#help-development
1 messages ยท Page 1301 of 1
nope
damn
put it inside a <pre> tag
is this the main thing in mixins?
i have maps with values of different things, so having a way to use a factory as an annotation is really cool
idk what their code may be but a main component of using Mixins is the @Mixin annotation that takes in a class
ie. @Mixin(MinecraftClient.class)
I need partners ๐ญ
me too, ive been single for too long
I mean not like that wht
pair programming is for the weak
no it useful for my annotation config system
its been 45 minutes
and i cant figure it out
fucking bungeecord
on a lobby server i have enabled bungeecord.. i did all the steps through a tutorial and for them it works for me it doesn't
i cant show my plugins because i have +100 private plugins damn, i have some here but nothing special https://www.spigotmc.org/members/system32_.1530022/#resources
Make sure that you're connecting through the Spigot proxy, not the lobby server
Hi, i have a question regarding the MHF_ heads. I'm trying to add them to an custom GUI / Inventory using a helper function:
private ItemStack createHead(String owner, String displayName) {
ItemStack skull = new ItemStack(Material.PLAYER_HEAD);
SkullMeta meta = (SkullMeta) skull.getItemMeta();
if (meta != null) {
meta.setOwner(owner);
meta.setDisplayName(displayName);
skull.setItemMeta(meta);
}
return skull;
}```
But they stay Alex heads, i call this function like so:
```java
inv.setItem(46, createHead("MHF_ArrowLeft", plugin.getConfigManager().getLanguageManager().getMessage("previous_page")));```
meta.setOwnerProfile(player.getPlayerProfile());
Did it change?
Yes
But how can i get the player object of the MHF_ skin?
isnt that just the player name? aka Bukkit#getPlayer
try Bukkit.getOfflinePlayer("MHF_")
meta.setOwnerProfile(Bukkit.getOfflinePlayer(owner)); needs a UUID unfortunatly
then player.getPlayerProfile();
getOfflinePlayerExact?
do you have online-mode true?
Minecraft UUID and username lookup. Resolve, convert and view name history of any username/UUID today.
Where sorry? Its been a long time ;ร
Bukkit.getOfflinePlayer(UUID.fromString("f2e4249e-f79d-4da4-a5d4-2291f7927f25"));
server.properties
oh, didnt check could that be the issue?
or just get the player and do getUuid on it
no
Hmm cant get it to work, it keeps rendering the wrong head. Is it maybe broken in 1.20+?
the wrong head (not alex) indicates a wrong uuid or the player which the uuid does belong to changed their skin
So basically MHF_ArrowRight has been overwritten -_-
does anyone know about forbidden vanilla shader magic?
guide me please๐
how can i display players hand skin on a model
what would be the best way to remove all sort of armour from the game?
like crafting, wearing, mobs spawning with it, structure chests
Remove the recipes
Remove it from mobs in the spawn events
Remove it from loot in the loot generate event
yeah its fine it wasnt like that
as in
ur method is correct
tturns out its not what im doing
thanks though ๐
is there a /good/ way to modify the recipients of AsyncPlayerChatEvent?
What do you think is the bad way?
cancelling the chat event, and then manually calling sendMessage, idk
there is a getRecipients collection, but docs say it may be unmodifiable
and if it somehow errors you can still catch it and go back to the original approach
Does anyone know how I can get the tag on the client?
Are you writing a mod?
I think it's server-side only. Is there any way to detect an NPC on the client?
Yes
For what purpose
I want to modify the entity on the client only if it's an npc
whats the best way to hide players from the tablist?
without hiding the player from eachother obv
probably using PlayerInfoRemovePacket via ProtocolLib
idk they didn't say hiding oneself
fair enough
PostFlattenTagRegistrar is the only paper package that says it cant be found? im using the most current everything
import io.papermc.paper.tag.PostFlattenTagRegistrar;
you should ask these questions in the PaperMC discord, this channel is for Spigot help
designing a virtual economy system (because i hate myself and wont just use Vault + like some random Eco plugin), cant decide if i want to store and work with floating point numbers (and deal with potential FP errors ๐คจ), or store user balances as whole numbers, and do just basic integer arithmetic, and then only when the balance is displayed is when ill just รท 10.00 (possible point of failure ๐คจ)
or well, i guess i dont need to do math to show balance
i could just artificially create a string and populate empty space with zeroes
just use whole numbers
if your unit is a cent then for formatting you can do %d.%d where the whole part is balance / 100 and the decimal is balance % 100
but it really does keep the math really simple without fp inaccuracies
or you can just use a bigdecimal which that's what it does internally anyway, BigDecimal("123.45") is just value = 12345; scale = 2
Acktually โ๏ธ ๐ค , it uses a BigInteger for the unscaled value
but the essence is the same, so it isn't wrong per se
why the discrimination towards billionaires ๐
pasta, humidity is too high
well, maybe it doesn't matter if you aren't going to be the one doing it lol
(had it last week, just doesn't remember)
ill store it as a long ๐
hey i keep on getting an exeption NullPointerExeption: Name is null
heres the code that i think is the problem
are you checking for null values
sotty idk why the fuck it didnt sent the message with the code
?paste
Your message could not be delivered. This is usually because you don't share a server with the recipient or the recipient is only accepting direct messages from friends. You can see the full list of reasons here: https://support.discord.com/hc/en-us/articles/360060145013 bro what the hell i got this when i tried sending it
how can i remove this us16 box that shows up when trying to use the ๐ก๏ธ emoji?
How are you sending it
Are you using the raw character or a unicode string
unicode string, but i did try as a raw character and it did the same thing
thats a V.
๐ก๏ธ is an emoji, which contains both U+1F6E1 (which is a unicode shield symbol), AND Variation Selector-16 (U+FE0F).
Just dont use the emoji and use U+1F6E1
You copied 2 emoji remove one
in the end
what event do i use for left clicking an entity?
Player interact entity
EntityDamageByEntity
the entity that im clicking is interaction entity and im not sure it gets damaged when i click it
what entity type
What is your minecraft version
1.21
server version
1.21
Test damage event
?mappings
Compare different mappings with this website: https://mappings.dev/
If anyone needs help developing plugins dms me
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
๐คกbruh!
I was going to send them your discord link ๐ญ
aha ok ๐ญ๐
You have been so helpful
thank you โค๏ธ
hey guys i'm running into an issue, So the issue is i wanted to get my repository from github into intellij and i done this, After that any code that's related to spigot-paper-bukkit will give an error, and also pom.xml the same thing it's all errors
Hello, how can I spawn Item displays using ProtocolLib ?
I tried doing this : https://paste.md-5.net/enodihigaj.java but the item display doesn't seem to appear
Could you send your pom
you're never sending the packets?
oh fu my bad lol
thanks x)
still I know that they are correct because protocollib doesn't send errors lol
hum, now I get a weird error :
[16:05:16 ERROR]: Error sending packet clientbound/minecraft:set_entity_data
io.netty.handler.codec.EncoderException: Failed to encode packet 'clientbound/minecraft:set_entity_data'
at net.minecraft.network.codec.IdDispatchCodec.encode(IdDispatchCodec.java:62) ~[paper-1.21.8.jar:1.21.8-21-ed31825]
Caused by: java.lang.ClassCastException: class net.minecraft.network.syncher.SynchedEntityData$DataItem cannot be cast to class net.minecraft.network.syncher.SynchedEntityData$DataValue (net.minecraft.network.syncher.SynchedEntityData$DataItem and net.minecraft.network.syncher.SynchedEntityData$DataValue are in unnamed module of loader java.net.URLClassLoader @6433a2)
at net.minecraft.network.protocol.game.ClientboundSetEntityDataPacket.pack(ClientboundSetEntityDataPacket.java:23) ~[paper-1.21.8.jar:1.21.8-21-ed31825]
at net.minecraft.network.protocol.game.ClientboundSetEntityDataPacket.write(ClientboundSetEntityDataPacket.java:44) ~[paper-1.21.8.jar:1.21.8-21-ed31825]
with my code being : https://paste.md-5.net/satihuzece.java
do you know why ?
display entities are as cheap as they get, just spawn a real one
they do still shit up the entity tracker, so i wouldn't be spawning hundreds/thousands of them, but even then they are definitely one of the if not the cheapest server side entity you can spawn
honestly just use nms at this point
or like just spawn it as a real entity; just make sure to mark it as non persistent so if you lose track of it, it won't stick around
it doesn't seem like you're even making it visible/different on a per-player basis which is one of the few reasons you might want to do this with packets
Okay I see, thank you for your help
Hi I have a problem while working with packets
using protocol lib I try to send an 'Explosion packet', but I get a super wierd error
Code: https://paste.md-5.net/igasovaqeg.java
Error: https://paste.md-5.net/ehidumiqit.md
(I am coding for version 1.21.5)
Why are you using packets for that
I am experimenting with them and learning
and I wanted to try to show the explosion to only 1 player
You can use the API for that
sure, but any idea where the problem might be?
the problem is that you're trying to set fields in the packet that doesn't exist
what does that mean? sorry I am new to packets
basically you have the wrong packet format for the version you're on
I thought that putting these 3 is enough, do I need to specify all fields?
That's the protocol data
ProtocolLib is reflecting on the packet class itself
so you need to match Mojangs class
in this case those 3 doubles are stored as a vec3
(in modern versions)
which means you need to write a vector to the packet
where can I find the mojang classes?
?mappings
Compare different mappings with this website: https://mappings.dev/
Sorry if this sounds dumb, but these values listed here like vec3, float and boolean I should add into the packet
right?
boolean?
How do I prevent click spamming? Like a cooldown for event processing? Because when I use a flag, when an click is processed in the same tick, it will still bypass this restriction
The method/constructor needs that that is correct
those are the methods
this
2 vec3s (one of which is optional), the explosion particle and explosion sound
is this correct? I am sorry that I get it that slow
looks about right
see if works
I am so dumb
I was looking at a different explosion
now I am at the correct one
the time it took me to realize
...
ah wrong class
ehm ehm ...
does spigot have any rules about publishing gambling related plugins?
i think it does actually
I don't think anyone follows them if it does
spigot itself might not but minecraft does
so, realistically, only servers that don't mind being blacklisted can use that kind of plugin lol
remind me, are crates considered gambling in the tos
i mean most of the servers don't care because there are many ways to avoid the blacklist lol
gray area
technically yes but nobody sees it as damaging enough to enforce anything
I think there are specifically rules against premium gambling plugins
Donโt recall any for free ones
i'm sure i've seen premium crates plugins
are they older than the rule
i don't know, i can't remember any specific plugins off the top of my head, i'm just fairly sure i've seen some at some point
How do you give an elytra a different 3d model based on some nbt?
like some model or some custom model data
literally no examples on the web
1.21.4 changed up everything
yeah its the equip model i think
Though idk if that works for elytra
so a give @p elytra[custom_model_data={floats:[1]}] 1 wouldn't ever work?
no
custom model data
just replaces the items look
also dont use custom model data after 1.21.4
u use the item model component
and here is the one for equippables
/give @a cobblestone[equippable={slot:chest,asset_id:"myarmor:emerald_chestplate"}]
asset_id?
yeah thast for equippable
and here for item model;
/give @a cobblestone[equippable={slot:chest,asset_id:"myarmor:emerald_chestplate"},item_model="myarmor:emerald_chestplate"]
so the equippable model is the emerald_chestplate
then the item model is also the same
why's it a cobblestone
I see
should've used air
which one defines which
the item model is how it looks in ur hand
item model is in inventory?
I see
what path does it prefix it with
what
like
its a resourcepack
yes
assets>
minecraft>textures/models
myarmor>textures/models
so if u put ur armor in myarmor instead of minecraft
u would use myarmor:
the asset_id is a .png texture right?
no the asset id is a json
uh
so what does it say
.?
what ever ur model is ??
it's essentially a list of primitive shapes defined by points and rotations
dont talk to me anymore
simple 2d png
you'd do that by listing primitive shapes described by points and rotations
now how would you make it only appear in certain elytras
using the asset id probs idk
so you don't know how the json looks like?
yeah
obv
u need to overwrite the minecraft elytra json
so u can add ur version to it
then if u have a custom eltyra u need to add a model for that
so it's either this
{
"parent": "minecraft:item/generated",
"textures": {
"layer0": "minecraft:item/elytra"
}
}
{
"layers": {
"wings": [
{
"texture": "minecraft:elytra",
"use_player_texture": true
}
]
}
}
so this?
yeah i think soi
let me see
{
"model": {
"type": "condition",
"property": "broken",
"on_true": {
"type": "range_dispatch",
"property": "custom_model_data",
"entries": [
{
"threshold": 1000.0,
"model": {
"type": "model",
"model": "d1e4e01a-100b-4eaa-b146-86743263c24c:05d1ef37-9406-4e1e-a430-dd24313ef7a6",
"tints": []
}
}
],
"fallback": {
"type": "model",
"model": "item/elytra_broken",
"tints": []
}
},
"on_false": {
"type": "range_dispatch",
"property": "custom_model_data",
"entries": [
{
"threshold": 1000.0,
"model": {
"type": "model",
"model": "d1e4e01a-100b-4eaa-b146-86743263c24c:05d1ef37-9406-4e1e-a430-dd24313ef7a6",
"tints": []
}
}
],
"fallback": { "type": "model", "model": "item/elytra", "tints": [] }
}
}
}
and hten for custom model data;
{
"parent": "item/generated",
"textures": { "layer0": "item/elytra" },
"overrides": [
{
"predicate": { "custom_model_data": 1000 },
"model": "d1e4e01a-100b-4eaa-b146-86743263c24c:05d1ef37-9406-4e1e-a430-dd24313ef7a6"
}
]
}
uh huh
this is assets>minecraft>items>elytra.json
this is assets>minecraft>models>elytra.json
so no equipment >elytra.json?
which is this
u add ur own version
like my_elytra.json
then u would change it to texture: minecraft:my_elytra
to equipment/my_elytra.json?
u can also make custom tridents somehow now
no??
there is no equipment
that owuld go wherever u wanna put it
which would most likely just be inside of minecraft>models
I meant is in vanilla
not models/item?
what would that possibly change ?
the main folder matters
the folder inside that doesnt matter
just asking where this should be
either
assets>minecraft>models>
or
assets>mynamespace>models>
what u put inside the models> folder doesnt matter, the main thing is that the models folder
so u could also have models>elytras>
then u need teh elytra definiton files
so this with the custom model data
im not sure how that one works i dont excatly think u need that but yeah
thats for the
item in hand
still
this is the main definition im pretty sure
then u did it wrong
what exactly?
show this file
this
wdym this
thats the file that makes the actual elytra render as a custom one
.
it needs to be called elytra.json?
and what does this sha1 mean?
it will hack ur server
no it litearlly says model:
.
where does this go again?
models just need that self referencing 
composite models would go hard if they could just link to a separate model file
so into models/ ?
.
thats a minecraft file as well
not ur custom file
now it's also invisible in the inventory
/give @a elytra[equippable={slot:chest,asset_id:"minecraft:xes"},custom_model_data={floats:[1000]}] with
like that?
would you mind if I
sent you the rp?
also, other packs I haven't seen use a minecraft definition in the models folder
like elytra.json
good for u
So why would it still be invis?
ok sorry i messed up it wasnt the unicode it was the raw emoji, but even then i looked up the unicode character and when i pasted it in it made the same string: "\uD83D\uDEE1"
messed up, it was the raw character
Is there any existing function in spigotAPI I can call to see how much EXP is required to reach a certain level?
Would be to get the right amount of XP to remove from a player based on a certain level input, so they are deducted the EXP cost of X levels, not the literal levels themselves
or do I just need to use the level forumla to calculate it
formula it is..
sadness, formula it is
public static int getTotalExpForLevel(int level) {
if (level <= 16) return level * level + 6 * level;
if (level <= 31) return (int) (2.5 * level * level - 40.5 * level + 360);
return (int) (4.5 * level * level - 162.5 * level + 2220);
}
the formula is simple enough
you just have to remember to sum the value of Player::getExp * HumanEntity::getExpToLevel to that
haha just completed it myself after finding the source on the wiki and verifying it was accurate
But ty for the input
I'm not sure what you mean by this, could you rephrase?
well, in the case you want the total experience level necessary for a player to achieve that level, you'd need to take into account the amount of xp they already have towards the next level (aka progress/Player::getExp * exp needed for next level/HumanEntity::getExpToNextLevel = current progress in exp). However since you're trying to remove levels, I guess it doesn't matter?
I am a bit head empty right now to think about implications lol
Ohh yeah it doesn't matter in this case as this is simply to remove levels from a player
without removing the literal levels as the cost would get higher the higher their total level
So rather than removing the levels I would get total exp, then set total xp - total exp for level
just for clarity, on the 2nd and 3rd return you specify the return is an int, but on the first one you don't?
second and third have decimal numbers that need to be converted back
first one doesn't
how long does premium resources take for approval?
It's been 7 days ๐ญ
Following up on the earlier, would this be a sane way to achieve my goal of removing XP and making sure there's no desync on client side?
public static void removeLevelsFromPlayer(int level, Player player){
int experienceCost = (getTotalExpForLevel(level));
int playerTotalExperience = player.getTotalExperience();
int newPlayerExperience = (playerTotalExperience - experienceCost);
player.setTotalExperience(newPlayerExperience - 1);
player.giveExp(1);
}
public static int getTotalExpForLevel(int level) {
if (level<=16) return level * level + 6 * level;
if (level<=31) return (int) (2.5 * level * level - 40.5 * level + 360);
return (int) (4.5* level * level - 162.5* level + 2220);
}```
int playerTotalExperience = player.getTotalExpForLevel(); huh
oh u editted it
haha yeah I just saw it
I'm not in my usual environment so it auto-filled incorrectly
hang on, thats giving the total EXP needed to reach that level from 0, not the cost of gaining that many levels from current position, whcih is what i thought u were trying to do.
also its <16 and <31, not <=, because 16 and 31 are the bounds, not inclusive i dont tink
Yes, it's to remove the value of the levels from 0 rather than just removing the levels
it'd be <17 or <32 in that case, it is inclusive
~~removed fandom link ~~
okee well if the numbers are right then sur, good method.
no, dont go off the fandom
(example)
fandom can be like completely wrong
as I said literally below this, use the other, better wiki
there is an extension to replace the fandom links :D
okay in that case its right my bad, ur boundaries r good
sorry what wiki would that be
the minecraft.wiki one?
Info checks out there at least so all good, but ty for the feedback
and the wiki thing, idk why it wasn't the first result when I searched for it
steve gets paid to promote minecraft.wiki
shh
But just to circle back to this, would there be a better way to remove the exp and ensure the players client is updated to display the new exp value?
ten trillion years
if you donate to spigotmc, its reduced to 4 working days
total no brainer solution
You know you can just player.setLevel(player.getLevel() - levels)
You know that if you're level 300 and you subtract 100 levels, that's a LOT more exp than if you're level 105 and subtract 100 levels? The point of this is to subtract the Experience needed to reach that level from 0, not the absolute level value from the players total level
Players with hundreds of levels would be losing far more than those that are closer to the exact level needed
ye its make sense
it could be considered a feature
diminishing returns and whatnot
depending on the context where this is used, being able to spend xp on 3 things in a row could be much more powerful than being able to do the three individually with having to collect xp in between, so it would be reasonable to remove more xp for doing the former
tax the rich
eww
Hey, I want to become a Java Developer So please tell me where I can learn.
For Beginners:
Codecademy - Learn Java: Interactive Java programming course from basics to more advanced concepts. Perfect for absolute beginners.
https://www.codecademy.com/learn/learn-java
JetBrains Academy - Java Developer Track: Learn by doing with projects and challenges. It covers Java fundamentals to advanced topics.
https://www.jetbrains.com/academy/
Udemy - Java Programming Masterclass for Software Developers: Updated courses that cover Java 8 to Java 17 features. Suitable for those who prefer structured learning.
https://www.udemy.com/course/java-the-complete-java-developer-course/
For Intermediate to Advanced Learners:
Oracle Java Tutorials: The official guides by Oracle for Java programmingโgreat for understanding the depth of Java.
https://docs.oracle.com/javase/tutorial/
Baeldung - Learn Java and Spring: Focus on Spring Framework and modern Java technologies. Best for intermediate learners aiming to expand their knowledge.
https://www.baeldung.com/
Practice and Hands-on Learning:
Exercism - Java Track: Solve exercises and get feedback from mentors. Great for practicing coding skills.
https://exercism.io/tracks/java
LeetCode: Practice your coding skills and prepare for technical interviews with Java.
https://leetcode.com/
Free Resources and Documentation:
Java Programming and Documentation: A comprehensive collection of Java programming guides, tutorials, and API documentation.
https://docs.oracle.com/en/java/
Community and Support:
Stack Overflow: A vast community of developers. Great for getting help with specific problems or understanding concepts.
https://stackoverflow.com/questions/tagged/java
r/learnjava on Reddit: Join the community of Java learners and get advice, share resources, and discuss projects.
https://www.reddit.com/r/learnjava/
Remember: Learning to program takes practice and patience. Don't hesitate to experiment with code and participate in community discussions. Happy coding! ๐
how to fix this error?
java.lang.NullPointerException: Cannot invoke "com.comphenix.protocol.ProtocolManager.addPacketListener(com.comphenix.protocol.events.PacketListener)" because "this.protocolManager" is null
i tried many things but its not getting fixed
don't call addPacketListener() on this.protocolManager if it's null
bet 2 bux you're shading protocollib
๐
๐
tuff
how do i make a plugin that wont load chunks below y lvl 16 like the anti free cams
like in donut smp
?learnjava!
Here are some links to get you started on learning Java:
- https://www.codecademy.com/learn/learn-java
- https://www.sololearn.com/learning/1068
- https://www.learnjavaonline.org/
- https://programmingbydoing.com/
- https://docs.oracle.com/javase/tutorial/java/index.html
The last one is the only official one, however some of those concepts assume that you already know a bit about programming.
https://media.discordapp.net/attachments/694661573125472256/998143126373941248/6n0v4g.gif
like whats the mechanics
What what's the mechanics
probably making a custom ChunkGenerator
what's a donut smp
I think he wants to not send packets for x blocks below the player
Ex when you're standing at y 90 you can't see y0 with freecam
will be kind of annoying to do with a plugin, but with nms it should be somewhat doable
Ye, his description wasn't all to enlightening
doesnt sound very easy
i do something kinda sorta similar in my view distance extender, you basically end up copying the chunk data packet write logic and make it write only the chunk sections you want
Not sure how mc sends world packets, is it per block or an entire chunk at once?
Ah, so you'd have to catch the chunk packet modify it to only contain blocks in players view distance and then send
yeah and I guess catch all changes to those blocks and dont send those as well?
Yea
Probs an array or hashmap of the chunks the player has been sent and what blocks he needs updates for
Seems like it would fuck Performance tho
and then once the player changes their elevation, you'll have to re-send chunk packets with those omitted sections in them
@stark dirge solution to your question in the above messages, just learn Java and then you can implement it ;D
alternatively, if what you want is some kind of anti-xray thing, paper has that built in and on spigot you can use ore obfuscator or whatever it's called
True, still don't understand what donut smp is. Do they like have something special with donuts or??
no he said not showing it
nah they just got 20k players
Drop all the lower chunk sections in the outgoing chunk packets
And then resend them all I guess when the player goes below that level?
oh yeah doesnt chunks have Y level chunks as 2ell
Mhm
thats kinda crazy though
Though does that really help
Presumably I can just dig down and then freecam
that must help a lot with the world
ye but then u need to keep moving
its more for like elytra
How so
or horses
how does folia help with the world?
isnt that like the entire purpose of folia
Missed the folia message
well no, they said not loading it, which I think is up to interpretation
prople cant just run around finding bases
u gotta memorize every single bedrock in the world
to find them
well he just said what he thinks happens
i do wonder what 20k people do on donut smp
surely half of them is afk players
there is way more afk servers than smp servers
That would be wildly inefficient if you were to load half a chunk at a time tho wouldn't it?
well idk wtf donut smp is so that was a misunderstanding on my part
anyways im not dying on this hill
You canโt load half a chunk
Well I guess you could but ehh
But you can fairly easily send half a chunk to clients
Chunks are split in slices as far as I remember
i was confused with generating vs loading
Happens to the best
I guess an even better way would be to directly implement vertical view distance in ChunkMap
that's one of the parts in nms i refuse to touch with a ten foot pole because spottedleaf made an absolute mess of it
in paper at least
Sooo. I'm really struggling with potions and such in spigot.
I'm trying to make a menu to select an effect, and all of that's easy to display by iterating through the registry of potioneffecttypes, but... I can't seem to be able to get a name or id of the potion. getName() is depracated and points to getKey()... which is also deprecated and points to getKeyOrThrow()... which plain doesn't work. Whenever the code is exscuted on server, it says "method does not exist" or similar
?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.
for (PotionEffectType potion_type : Registry.EFFECT) {
ItemStack potion = new ItemStack(Material.POTION);
PotionMeta potion_meta = (PotionMeta) potion.getItemMeta();
if (potion_meta != null) {
potion_meta.setDisplayName("&" + potion_type.getColor().asRGB() + potion_type.getKeyOrThrow().getKey());
potion_meta.setColor(potion_type.getColor());
potion.setItemMeta(potion_meta);
}
pane.addItem(new GuiItem(potion, (event) -> {
effect.setPotionEffect(potion_type);
PotionEffectMenu gui = new PotionEffectMenu(effect);
gui.show(viewer);
}));
}
Error:
java.lang.NoSuchMethodError: 'org.bukkit.NamespacedKey org.bukkit.potion.PotionEffectType.getKeyOrThrow()'
and what version are you on?
1.21.4
and you're running Spigot
Spigot in code. Papermc on server
Test on Spigot
paper does not support that ^
if you are coding for 1.21.4 or later, paper hardforked there. So develop against the API you are using or switch to spigot
Ok, that's all cool if I were coding the plugin just for myself, but realistically, I want to support both.
I'll opt for the solution I waa making myself, and that's mapping everything myself lol
Yea probably easier than mapping everything manually
Is it lol? It's just 33 or so strings. 1 hashmap, and I have what I want
I haven't messed with reflection
33 or so strings this version
next version, one might be added, one might be renamed, another removed
the version after, 3 renames
who knows
Any references for reflections/multimodule? I've never touched that
Haven't had the need to
The general idea is that you create a bunch of interfaces that abstract your API dependant logic and then have a module imeplementing them via spigot API and one implementing them via paper API
Well no, only the bits that are not the same between spigot and paper
Gotcha. I'll see what I can come up with, but, still sucks =v=
Don't get the point of hard forking such a like, random thing
I mean, that commit was just after paper hardforked
so it just naturally did not get pulled anymore
wasn't like actively removed
I see. I'm not up to date on differences or, whatever has been going on. I just know a majority uses paper, but I code for spigot
Is there any code I could reference for a like, proper spigot/paper multimodule implementation? I get making an interface to abstract it, but it'd still be nice to see
interface ServerAPIBridge {
String getPotionEffectTypeName(PotionEffectType potionEffectType);
}
class PaperAPIBridge implements ServerAPIBridge {
@Override
public String getPotionEffectTypeName(final PotionEffectType potionEffectType) {
return PlainTextComponentSerializer.plainText().serialize(Component.translatable(potionEffectType));
}
}
class SpigotAPIBridge implements ServerAPIBridge {
@Override
public String getPotionEffectTypeName(final PotionEffectType potionEffectType) {
return potionEffectType.getKeyOrThrow().getKey().replaceAll("_", " ");
}
}
this would be like "the idea"
idk if spigot exposes a way to translate the potion effects translation key
you'd have them in separate modules (either maven or gradle) so that one of them can depend on the spigot-api, the other on the paper-api
you shade them into your final jar
and then instanciate the correct bridge depending on the server you run
so like ServerAPIBridge bridge = amIOnSpigot() ? new SpigotAPIBridge() : new PaperAPIBridge()
thats so much code, can you summarise it?
Sure! Here's a super simple explanation for someone who doesn't know anything about coding:
This code is like a translator that helps get the name of a potion effect (like "Speed" or "Invisibility") in Minecraft, but how it does that depends on what kind of Minecraft server you're using.
There are two kinds of servers here:
Paper server โ This one uses fancy text formatting tools to get the name of the potion effect.
Spigot server โ This one just grabs the potion effect's name and replaces any underscores (like in "WATER_BREATHING") with spaces so it looks nicer (like "WATER BREATHING").
In both cases, the goal is the same: give you a readable name for a potion effect. The way it gets that name just depends on whether the server is Paper or Spigot.
Aye. But is just adding paper as a dependency enough? And then using it? Or do I have to do some more set up?
Well, you cannot do that nicely in the same module
the spigot and paper dependencies will clash
I mean yea, you are basically developing a plugin for two different server softwares
Aye...
I'll have to do more research on this
For now, my map will work
But like
fair enough
Deffo have to fiddle with this
Yea, especially given every day spigot and paper merge API, they drift apart further
Hoped there was some example project I could see to like
Tear it apart and see
we'll always be family
speedy and angry or whatever
๐ถ its been a long daaaaaaaaay, without you my friend ๐ถ
:'c
I never realized how bad of a lane merge the white car made
It's pissing me off
what do the memory footprints of BigDec and BigInt look like
still trying to decide how i want to do currency, bc i could just use like... long and have more room for currency than ill ever need (bc id probably cap at max int lol), but ik BigDecimal is also made to handle arithmetic like that that needs low (basically 0) margin of error
depends if you need decimal points xD
useless to have a BigDecimal if you only give out gold coins
i plan on having something akin to US cents so i do end up w decimals ๐
if it was just single, whole coins id def just use int or long depending on what i wanted max bal to be
yee
ah, fuck, i gotta figure out how to [de]serialize BD
personally i'd just toString it and then use the string constructor, unless you specifically want to serialize it as binary
much nicer to work with in databases and such
nicer as in bin form is nicer or string form is nicer
so i did think about Object streams
object streams
ill have to test when i get home what that data looks like
but like, big decimal is a big int and a precision int (well and scale)
fwiw, sql just toString()s it
hear me out
ObjectOutputStream(ByteArrayOutputStream())
base64 encode the byte array
write base64 string to DB
Object stream is :( because it has terrible space efficiency
itll be fiiinneeee
oh it 100% would be
https://paste.md-5.net/jaheyujoda.diff how does this look for basic structure
is there a reason you aren't just using some existing economy plugin
i like reinventing the wheel
fair enough
and i hate myself just enough to do it
make sure to make all the method return completable futures because brr database operations
either that or setup a cache so that the get methods return from cache and then have retrieval methods or something
yeah i planned on lazy saving
like plugin shutdown or something
n loading would be (blocking?) from DB if exists beforehand
me when the server crashes and I had just made a million vbucks transaction so my money is just lost in the cache:
Ew blocking
True
What if my database is on the moon
i hope u got Fiber
I would have 3 levels of persistence
Just use sqlite at this point ๐ญ
I would have a sqlite database for local persistence and then another database on top for network-wide operations
But then I canโt put it on the moon!
i could have a periodic save that then also has a master save at the end of life
or i could set up async transacting
idk
I would recommend first try to figure out the infrastructure and the scope before going into the code
are you going to use a database, if so an embedded one like sqlite or something like postgres? Is it going to be necessary to worry about cross-server synchronization and if so, should you offer a way to hook into a distributed cache like valkey or hazelcast? Or just use a messaging pub/sub on something like RabbitMQ?
once you figure out these questions, then the design for the plugin itself should be more clear
not that these are the only concerns, but usually the primary ones, cache, persistence and synchronization methodology
hmm
i wont need to cross-sync balances between servers (itll just be a single mc serv) but i would like support for off-site databasing
oh no yeah this is gonna take me a while to even flesh out before i start writing the actual code
hell im still trying to figure out the data type i want to store the balance as LOL
this is part of a big update for my smp that im not even expecting to roll out until next year
i guess possible synchronization issues aside, does it at least look like a good way of structuring? @sly topaz
sure, doesn't ring any alarm bells for me so it sounds fine
yippee
https://github.com/Cutie-svg/SpleefPlugin.git
so the main issue is that my arena doesn't reset and my gamestate after finishing one game stays LIVE instead of RECRUITING
Someone help please
I am now sharing the plugin ๐๐ป
Tbf canโt even rmbr what it was
Oh
This one
Please focus on both the โendโ and the reset part for me
I cba to go look at the whole thing
Can u explain a bit?
Like what do i do with them
What did u do with them so far?
only place that looks like it'd hard stop the reset process seems to be the slimeWorld == null check
how are you terminating the game? Just using the terminate command on the arena?
It can be used in arena / lobby
like if x and y are playing a game and z has permission to run /terminate he can terminate the match of x or y from the lobby
Yeah but what I mean is, how did you test the reset logic
Why should it? My world isn't null
I don't know, but it is one of the few places where there's just a return and no output so if it happened to be the case and you wouldn't know then I would guess it might be there. Your logic looks solid as well so it doesn't smell like an issue with the plugin itself
if you want to know for sure, use a debugger. Should be easy to setup
Could it be cause i don't depend on ASP?
in plugin.yml
that shouldn't stop it from working if you have ASP in your server, it just makes it so your plugin disables if the dependency isn't there. You should add it though
oh, is there any chance spleef_arena world is the main world?
yeah no then just check with a debugger, my guess it is on the readWolrd returning null for whatever reason
Can you tell me how do i add a debuger?
I never added it lol
create a Remote JVM debug configuration in IntelliJ, copy the cmdline flags it shows you in the window, then put it in your test server's start script (make sure it is before the -jar flag). After that you can start your server and hit the debug button in IJ to start the debugger
Alright thanks
oh, also make sure to edit your timeout-time in the spigot.yml so that it doesn't automatically crash the server after 60 seconds of suspension (will happen when you hit breakpoints)
How much shud i edit it?
I usually set it to 9999 or something like that lol
alright thanks
any reason to use the bukkit schedular instead of CompletableFuture.runAsync for async stuff, aside from being able to cancel the bukkit stuff when the plugin shuts down?
personally using completablefutures or executors nowdays in everything
they are not mutually exclusive, you can use them in conjunction
you can even use CompletableFuture.runAsync to run something on the main thread
yeah, it depends on what you need them for
mostly useful if you have a CF chain and you need to hop to the main thread for a bit
good to know that you don't value your own time lol
Bukkit has a method to run something in the main thread
But it returns a future not a CompletableFuture
:(
CompletableFuture.supplyAsync(My::method, (task) -> Bukkit.getScheduler().runTask(plugin, task))
or if you're on paper,
CompletableFuture.supplyAsync(My::method, Bukkit.getMainThreadExecutor(plugin))
both work about equivalently
runasync without an executor parameter goes onto the common fork join pool, which, unlike the bukkit async scheduler thread pool, is bounded
this is generally better, as you won't end up blitzing through 500 threads
That main thread executor is not blocking
it just pipes the runnable to runTask
why would it be blocking? the whole point of executors is asynchronicity lol
๐คจ
In the case of futures it might not matter as much, depending on abstraction but for general tasks it might:
Let's say you have 2 impls of the executor
Non-blocking: (task) -> scheduler.runTask(plugin, task)
blocking: (task) -> lock -> scheduler.runTask(plugin, () -> {task(), unlock})
why on earth would you do that lmao
under that definition, every executor that isn't Runnable::run is non-blocking
which is a good thing
async -> sync -> async without callback hell
???
CF.runAsync(() -> not main thread)
.thenRunAsync(() -> main thread, mainExecutor)
.thenRunAsync(() -> not main thread)
runs perfectly as expected
let me reword that
skewing the definition of "sync" and "async"
the whole pipeline is async
yeah the more I think about this the more I think I'm stupid holup
the last runnable does not start all the way until the second runnable finishes
yeah my stupid ass thought the second runnable finishes when the executor.run finishes running
instead of just running a wrapper task that finishes after the scheduled runnable is actually called
you should be using reactive streams anyway :chatting:
15yo me felt so smart back then
you can also pass data and exceptions from a future to its dependents, e.g.
world.getChunkAtAsync(x,z)
.thenApplyAsync(chunk::getSnapshot, mainExecutor)
.thenApplyAsync(Skyblock::countBlockValueInChunk)
.thenAcceptAsync((Double value) -> islandManager.updateChunkValue(x,z,value), islandSingleThreadExecutor)
here we schedule the chunk load from the caller thread, then once it loads, we dip to the server thread to extract the chunk snapshot, then we iterate over the blocks or whatever on the common pool, and finally we go to the plugin's own executor thread to update the data for the island
.thenApplyAsync(chunk::getSnapshot, mainExecutor) :(
passing the main executor here is required if you call getChunk off-main, since if the chunk is already loaded, the future will be returned completed and you end up calling getSnapshot off-main which is haram
the previous future already completes on the server thread, plus it will remove the load ticket immediately after the callback so there is a chance for the chunk to unload between the rescheduling of the task and the getSnapshot call
causing a sync load :(
the behavior may have changed since 1.18, but at least back then, if you called getChunkAtAsync on a chunk that's already loaded, it returns a future that's already complete
and calling thenAccept on a future that's already complete runs the task on the caller thread
i.e. off main
idk about back then but today if the method is called off main, it will recall itself on main
so it always completes on main
neat
it was kind of ass before precisely because of that opportunity for the chunk to unload in between
although even then that's kind of racy now that i think about it
if the main thread completes the future in between you making the getChunk call and the thenAccept call, the task will run on the caller thread and not on the main thread
considering how long the server usually takes to get to its polls that is probably very unlikely to happen, but there's no guarantee for it not to happen
so passing the main executor is still mandatory in principle
alternatively use the Consumer method :) (or just call getChunkAtAsync from the main thread)
Hey so after adding a debugger and testing i can see that my reset() method doesn't get called
and checkec without debugger and added some syouts but still isnt getting called
..
Bro my ajleaderboard plugin stops working when I restart server and after putting another ajleaderboard plugin it works smoothly but as soon as I restart server it stops
Hey, is there any API with its help i can get the Skull of offline player becuase the bukkit version dont works for me
both are kind of awkward to use alongside with futures but yeah it looks like this is how you have to do it still
yeah i mean there isn't really a 100000% safe way if you call it off main and the future for whatever reason completes before you get to append to it, like glhf
at least not one that doesn't involve more hacks
CF.supplyAsync(() -> world.getChunkAtAsync(cx, cz), mainExecutor).thenCompose(Function.identity()) :nodders:
also it does look like in 1.18 it rescheduled back to main too
i just vaguely remember digging into chunkmap or something and seeing it return CompletableFuture.completedFuture() with the chunk if it was already loaded
which i mean is valid behavior and kind of preferable to scheduling a task to an executor to return an already loaded chunk
but as of moonrise i have completely given up making any manner of informed assumptions about how the chunk system works
to better aide in debugging, create a new parameter for your arena's to identify them all in your lists. IE an id of some sort that increments. Anytime anything happens in one of these arena instances, have it output its id and what its doing
are u sure that my dumb brain would understand
Well, I have a feeling that either it is an instance problem where things are not being applied to the appropriate instances or you have more then one manager instance which is causing the issues since you have no guard on ensuring only a single instance of the managers
the real fix here would be to bring back the chunk unload delay that was removed in like 1.13 or something so the chunk simply wouldn't get to unload before the scheduled ::getSnapshot runs
debugger should show the managers issue if that was the case, but it wouldn't help with the arena instance issue hence needing a way to identify them since you can have duplicate arena's
How can i get offline Players skull?
Hello, please tell me how to request this package and what the parameters should look like.
Packet 0x05 version 1.19.2
?protocol
Take a look at the wiki ^^
You mean this? https://hub.spigotmc.org/javadocs/spigot/org/bukkit/inventory/meta/SkullMeta.html#setOwningPlayer(org.bukkit.OfflinePlayer)
declaration: package: org.bukkit.inventory.meta, interface: SkullMeta
idk
i have tried everything and i dont works for offline players
import org.bukkit.Material;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.SkullMeta;
import java.util.UUID;
public class PlayerHead {
public static ItemStack getPlayerHead(UUID playerUUID) {
ItemStack skull = new ItemStack(Material.PLAYER_HEAD);
SkullMeta meta = (SkullMeta) skull.getItemMeta();
meta.setOwningPlayer(Bukkit.getOfflinePlayer(playerUUID));
skull.setItemMeta(meta);
return skull;
}
}
i had this code and it didnt work
If the player is offline i get a basic head like steve or alex
@chrome beacon
will this work for sure?
if it doesn't work directly call update on the profile first
should cause it to look up data from mojang
is there also a method to get a skull from a uuid?
have you checked that the offline player is actually a valid player with valid uuid
yes becuase when the player is online it loads his actul skin
is there a method to get a skull from the uuid cuz i dont see one
@chrome beacon
declaration: package: org.bukkit, class: Bukkit
Do you guys recommend using mojang or spigot mappings? When I would use mojang I would compile against spigot. What is more usefull to know? Since the names change depending on what I use.
I am new to nms. I know how it works, but I am new to reading the actual src code and understanding what each method does what I want to do
We also don't have names for most things anymore
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!
dumb question, but can a player receive potion effects while theyre dead?
id like to blind a player while theyre dead but idk if theyll receive the effect
why wouldnt they exist?
yeah, ill try when im home from work tn
Do I have to do anything else other than just using the mappings? Like some special arguments to convert back into spigot for building
I use gradle
Because when a player dies it doesn't just like set the state of the player entity to dead or anything, the player entity gets removed from the world entirely
https://github.com/patrick-choe/mojang-spigot-remapper
Will take care of what you need
oh i woudlve thought that it's different for players
Where do I find mojang remapped sources? Intellij doesn't index correctly, and I can't fined the sources.jar in plain spigot folder either. I have activated "generate sources" in buildtools though
yeah honestly I have no idea why that is the way it is
mojang strikes again
Do I have to use SpecialSource
Yes
SpecialSource doesnโt do source remapping
One thing you could try to do is manually compiling spigot with sources and then attaching the given source jar to IJ
is there an easy way to spawn a FireworkEffect as a clientside one or one that does no damage/knockback without having to catch the EntityDamageEvent?
do fireworks even do damage
as for the question itself, I don't think so, no
at least not without using internals
they can yes
i forget what u need crafting-wise, but people do make "rocket launchers" using fireworks as crossbow ammo
Any firework with a firework star
If you just use paper and gunpowder you donโt get a bang
sir, this is spigot
Iโm going to attach you to a firework 
๐คก we like having fun here
that's the new claude ai, opus 4.1
guess I'm not buying that 200/mo sub
paying for API access is literally cheaper
its also PAYG too
oh man what an annoying new strat
I'm getting discord bots that just post images
for scams
?jd-s
?stash
is there a documentation of the bungeecord protocol?
what specifically does the bungeecord say to the server?
Does it simply forward or it does something else?
Yes it just forwards packets, there's no special protocol
The only difference is it uses the hostname field of the login packet for IP forwarding if enabled
Otherwise it's 100% Vanilla
Ah, I so just act as a client then in bungeecord for the spigot server? (replacing the ip if forward is enabled etc)
Yes
Thanks a lot!
mr beast?
hmmmm
if I have a component in a class that gets extended, is it cleaner if the children access that directly or if the parent exposes methods from the component
From an encapsulation standpoint access methods. But itโs a lot more boilerplate
Really depends on what the component is and whether itโs methods need to be monitored
yeah for my models project that is primarily meant to be used as an api/library I went with the more verbose but easier to access route
but man it's a pain
also if you put actual functionality in there, then forget about it and bypass it you're in a world of hurt
Hi!
I see that libraries section of plugin.yml is marked as preview
Is it possible to enable it in a server and if not, which version will it be available from?
I spent a lot of time automating it and now I noticed it doesn't even work ;-;
it's been available and working since 1.17
not sure where you found it marked as preview ๐คทโโ๏ธ
I sees, ty ^.^
Does it download libraries into ./libraries? I didn't see my declared libraries there on 1.21.4
that article is outdated
This is a preview feature.
nvm comment instead of annotation ๐
anyways it works fine
you can use it
I think instead of using the plugin.yml you would usually just use the build system to declare the libraries right?
plugin.yml is to inform the Minecraft server about them and it can download them
this prevents duplicates of same library between plugins
I was looking in the wrong folder >.<
Is 1.17 the confirmed earliest version? Where can I read about when it was added?
I checked a bunch of versions and in javadocs it appears in 1.16.5
https://helpch.at/docs/1.16.5/org/bukkit/plugin/PluginDescriptionFile.html#getLibraries()
okie
oh i see
right just to make sure the library you're trying to use is on maven central?
Hey, I'm trying to work with packets in PAPER 1.21.8 using ProtocolLib. My goal is to change the yaw/pitch of a player (using packets). Whatever I tried, it either resulted in nothing happening or causing errors.
Could someone that has a little expertise in packet-related code join me in a call and show me so I can do these kind of things on my own.
Paper?
Does it make a diffrence when using ProtocolLib?
bruh
whut? Have you used ProtocolLib?
It's a plugin, open source, I haven't really heard of any community where you can get support for this kind of stuff
is there no support for it?
Packets, nms etc
that means its not a very good project then
Use packetevents
you get support for spigot, which is also free
Is there a community to ask questions in?
bro, still it is about packets
yeah packetevents has help channels
Alr, i'll look into it
Use imgur its better
alr thx
Do you guy know how to download the Bukkit referenced lib?
the what now
sounds like a gpt dream
Does anyone have code for calculating the width of a component?
I stole radsteve's but it's brokey and he gave up on the industry
adventure component or bungee
yes
for adventure id just say plaintext serialize it and length (probably wont work if you use client side translatables) and for bungee, convert to adventure components and do that step
bold and stuff changes the width
Bold makes the text block 1 pixel wider
soon(tm)
eventually
like ever xD
i think stand-alones also suffer from the approval system
can we post a paper fork as a premium resource on spigot LMAO
forum account ban speedrun any%
is it possible in spigot 1.8.9 to open a villager inventory with custom things to buy?
i see there is the InventoryType.MERCHANT but does it actually work?
how would i add items and what they cost
today i will do blocking IO for SQL queries
hannah
No
Premium resources must be plugins
doesnt add any new voids
so i guess its a normal inv?

