#help-development
1 messages ยท Page 1100 of 1
who? tell em to change it
Can't really
1200 bytes in UTF-8
that token is safer than sha256 ๐
xD
can these people join a discord server and send the token there?
That's a whole friggin' kilobyte
if yes use jda
Sounds like command block gui is the best
be takin 10x heat death of our universe until that shit be brutefor ed
Okay
I wonder if we have command block screen api
Yep
so players would need to paste it and then press save
Yep
do we atleast have API to open the command block screen
I'm still gonna do it with packets
i dont think so either
that's... disappointing
yea
Do you guys know
i mean, i wanted to contribute but i seem to stupid to understand what excactly i gotta do to make sure it gets approved
Whether I can at least modify the ui's text?
Resourcepack?
Couldn't find it
Ye
you want to use a ressourcepack with custom lang file
Ye
you can basically copy the lang file from given version and modify that to fit your needs
Even the text?
but text
no not that
that depends on the lang, which can be modified
Maybe because they consist of a textfield and 5 buttons?
Not much you could softcode here tbf
iirc the buttons are still default textures ๐
yea
Where tf is it fetching shit from
i just realised
That might be illogical
well ive tried lmao
Give me a minute, I'm gonna check the code
they might've changed it in some version? not sure
as the language file can modify the text, you could use a custom font to create custom backgrounds for the cmdblock ๐ฎ
i tested back in like 1.20.2
well that has to be in the default font
which you should never do unless for stuff like that and you need to be 100% sure the users cant paste it in game
this.redstoneTriggerButton = this.addDrawableChild(
CyclingButtonWidget.onOffBuilder(Text.translatable("advMode.mode.autoexec.bat"), Text.translatable("advMode.mode.redstoneTriggered"))
.omitKeyText()
.initially(this.autoActivate)
.build(this.width / 2 + 50 + 4, 165, 100, 20, Text.translatable("advMode.triggering"), (button, autoActivate) -> this.autoActivate = autoActivate)
);```
that was back when they added sprites so maybe they just hadn't added it in there
private static final ButtonTextures TEXTURES = new ButtonTextures(
Identifier.ofVanilla("widget/button"), Identifier.ofVanilla("widget/button_disabled"), Identifier.ofVanilla("widget/button_highlighted")
);```
i like that, even tho minecraft has so much hardcoded and sh*t
its still really customizable
shaders
It's way better these days
true
With all the coreshaders and data driven shit
i love shaders so so fucking much
Back in the days we had no datapacks, only texturepacks and a barely working forgemodloader without mixins
me still hoping for the modding api
Modding API?
mojang
Please no
but they scrapped it as there were enough community made ones
I don't wanna write js code for my mods
it would be even jankier
back in my day playing multiplayer was a privilege
Probably more similar to bukkit
but it wouldnt have required you to restart the game
Where they don't show any internals, only API
instead you could have different mods for different worlds etc and maybe even a mod workshop ingame and stuff
but as they scrapped it
We can do everything with mods these days
With a few (not so) simple mixins we can create more than mojang ever will
hot reloading:
or... Do you?
Freezing and unfreezing registries has been a common practice always
With mixins we can do anything
Including dynamically enabled and disabled mods (and possibly mixins)
It was always possible
my idea is to just make a spigot-like API but with the power of fabric mods, I'm cooked ๐
Just nobody wanted to do it
Hi, I have a question let us say my configuration file looks like this:
Pets:
Cat:
-Data about this pet
Dog:
-Data about this pet
How would I go about getting a String[] which contains the names of those pets, in this case it would be: {Cat,Dog}
thats what the official api wouldve been like
that's kinda what I'm working on tbh
I'm using yaml configuration BTW idk what's the difference
I just have too little time this month to make a proper release ๐ญ so it's a bit half assed
Imo an API currently is completely unneeded
wym
Everything works by basing on minecrafts internals, besides bukkit ofc, that's a special case
my goal is to kinda make a universal API, I am like 3 classes away ๐ญ
It would allow you to take the same jar and run it on a spigot server, a fabric server, a forge server, a fabric client, a forge client
And that gives way more abilities than layering through a layer of API
We have already done this with having a common subproject and then a lot of subprojects for every loader
Well, the plan is to allow custom rendering, entities, items, blocks, etc
use any org.bukkit class and you're already cooked
it is much more effort to do that than use a standardized API
It is a pretty cool idea but it's just too hard to keep such an API and all its 20 impls updated
Until that API doesn't have one loader-specific feature so you have to reinvent it
i love the bukkit api and hate it at the same time
Honestly, not really, most of it can be abstracted even further from minecraft
Same
wym
explain
declaration: package: org.bukkit.configuration, interface: ConfigurationSection
it's so restrictive imo
like, no async? 
that is a mc problem not bukkit
you can do some vanilla stuff async
fair
Thnx!
When mc always runs multithreaded it would be a hella lot faster i believe
(if done properly)
honestly mc has a glaring issue that nobody talks about that would substantially speed up, well, everything in the game with a "small" rewrite
Hard to explain
Only because you can doesn't mean you should
I was writing a big ass text but got bored and deleted it
:)
ctrl+z
send it
I want to know
I'm on phone kek
Libraries
okay, what do you mean with libraries?
yea, just a "simple rewrite"
PM: Lets assigm like 5 story points to it, i want it done next week ๐
lmao fr
no it would take a while
but much less than multithreading
and would be HUGELY more performant
I'm talking about
ensuring memory locality ๐
there are 3 arrays in mc
that are
so fucking sparse
it's sad
Unless libraries get ported to work with your API or your API starts featuring the same features as libraries, users may not have tbe ability to do something specific. And then there are also mixins
lets do a dev project where we invite anyone who wants to participate into that rewrite, then send it to microsoft and wait for a billion dollar copyright claim while they steal the code
it is meant to provide every library under the sun, and provide the tools to make one yourself much more easily.
oh well, it is actually very easy to do if I can find that class again
man I want to do that now
An API wrapping around a system will always be atleast a bit restrictive
It has a Packet API that stays up to date with mc, you have access to the raw packets, it's not restrictive
it lets you do anything
It's always restrictive to some degree
the minimal amount, to be honest
Does it let me mixin into the FogRenderer and change some values in a certain method call?
It will expose those values for you in a nice and handy documented API
And how many decades are you planning to spend on developing such an API?
honestly, not many at all
There is always some scenario which you just can't think of
I wouldn't even know that the FogRenderer class existed if I didn't have to write a mod that mixined into it
FogRenderer on the server, gg
lmao
And then you'll have to work on some god damn API for the rest of your life adding features like "add newly added method removeShit(World world) to ShitManager"
not really, it's OS anyone can contribute lmao
okay, but who will? Are you sure that there will be more than 3 people willing to use it?
Sponge moment
A fuckton of mod devs will never quit their ancient ass forge or their beloved fabric (or for the femboys, quilt)
I am going to assume so, once I get out of my exams I'll begin adding the "fun" stuff
Eh I wouldn't be surprised if you aren't the first one to make something like that
I'm even pretty sure it has been done before, to some degree
^
Is this the case tho?
it would be what bukkit tried to do, but more modern
And hey, it is a fun project. Yea, chances are it'll die as a brick disguises as a wheel, but it's always a learning.
Eh, the bukkit approach is kinda meh imo
And maybe it will actually be a wheel
Out of brick
There is a possibility, like everything
Not like you loose anything attempting
The bukkit approach is actually great imho.
Wellll
Well, time is worth a lot
Depends
I prefer the fabric approach
Obscures internals and doesn't let people fuck with them
hey, it brings me joy to work on it, instead of using my time to like idk play videogames I use it for this
it's a learning experience that may do something useful
Both approaches have their merit
Fabric fails in some spots that paper doesn't and the other way around
also I can literally add mixins if you want lmao
I personally would prefer to waste my time WoT rather than that type of project, but do whatever brings you joy!
And watch them break on bukkit?
Adding mixin support is pretty easy
Remapping, mixins would be handled by the framework itself eitherway
"remapping" ???
Hot take chat but spigot switches to mojmaps???
Maybe remove CB relocation???
spigot has different names for a lot of things
Indermediary!
That would be crazy
Yet another hot take
That's not an issue
I have done remapping countless time
Would be so sick, some forks should try it
I can add that into my framework
Lol lemme PR quick tonight kekw
Mixins break on bukkit because
- Bukkit makes some private methods/fields public
- Bukkit does not support mixins
automatically converts to the relocated packages
you can manually add mixins
Laughs in ignite
hell my friend literally got them running on spigot
CVN handles remapping and cb relocation too, Paulem did it, Idk how ngl
Yet that is some extra trouble for the user
well, I'll show you
I'll implement it and you'll see what I mean
granted it'll take a while
?learnjava
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! ๐
Okay I'll wait
first version is nowhere near my goal for a first version at ALL
#bot-commands
Pretty simple
It's just mapping
Mixins work until you realise you just gave the equivalent of a nuclear powered hammer to someone that has ~3 months of coding experience
Yeah some asm shit
Indeed
Lol true
Sorry dude. Mixed the channels thanks for directing
It's just a loop
For loops go crazy
ASM is glorified for loop just look at commodore 
I always considered the upside of the Bukkit approach and a stable API that is is a lot harder for plugins to fuck each other up
https://github.com/SpigotCVN/CVN/blob/main/src/main/java/io/github/spigotcvn/cvn/asm/AsmWriter.java here's whatever paulem did
I've never real had a plugin compatibility nightmare like I have with mods
Incompatibility between projects becomes a lot easier when one project just casually replaces the entire method logic
True
I should inform all the people who use redirect and overwrite in mixins that that is a bad approach and causes lots of incompat
no
Emily (idiot staff)?
Paper is meeh
How dare they patch my tnt duping
Or whatever
Add mixins to paper and eat your words
anyone know how i get like animal heads in 1.8 because i cant setOwningPlayer on a playerhead
I wonder if I'm allowed to contribute to it
That PR was closed by our god and saviour kennytvn
No way
๐ช๐๐ฅ
You could not use 1.8 and instead use latest!
my server is 1.8?
why
factions
Ok
Factions?
Then figure it out yourself
@slender elbow do you have a ready to use set and get nbt class for 1.8 for me
Thanks
yea
Why should anybody here help with a version of the software that is almost a teenager
aight bro chill out
Hey it just happened to turn 9
legit just asking
We still got 4 more years
shit's fucked when your audience is younger than the minecraft version
That's very soon
Yes
Lol
Google is a pretty good place to ask too :)
i have
This version released 3 years before you were born kid
lots
Then you have done it wrong?
Thanks 
not everything on google is true bro trust me ive tried
Using 1.8 and not making your own fork is wild
ion know what a fork is
Checks out
@blazing ocean aren't you using your own fork even tho you aren't on 1.8
If you have a server and have in-house developers you should probably run your own fork and upstream performance patches
Just sayinnn
..yes?
Also, I have taken part in atleast 2 factions servers that were running on 1.20.4
No idea why you'd run 1.8
Upstream performance patches? What's that
upstream? what's that
you'd also figure that if you're gonna run 1.8 you should know what you're doing but you'd be surprised by the amount of people that run unpatched spigot/paper 1.8 that are absolutely littered with exploits
tfw people crash their server within 4 packets:
I would make some it's just you know
I'm not good enough to notice lag
I don't have enough friends to cause lag either
use offline mode and a botting tool :)
Fix opening player inventories instead
OFFLINE MODE?!
fix commodore
We just got the issue on paper
By removing it?
There is no saving
asycn will fix everything
make vanilla async
Async class loading 
hey lynx how about ya'll upstream some patches
async cow movement paper fork when
Nah I think we are good
bro does NOT want components
I do not want paper's components ew ๐คฎ
why
I thinking bringing components and API improvements to your common smp plugin Dev would be a bit overwhelming
nah, it's just that they're overly shit
Mhm, for sure
Truely terrible abstraction over mojangs used text representation
Gimme those incomplete dataloosing legacy strings babyy
We love strings :(
I want something actually good that isn't... well, whatever ya'll have going on
?
genuinely
Good is different to everybody sadly
wtf is wrong with adventure
if it just were so easy
Adventure component API is as close of a representation of internals as it gets
You can build formats or whatever you want on top of it
you are free to write something thats actually good
I'm trying but given the fact that I'm overwhelmed by so much stuff right now I barely have the time to
sadge
it's on my todo list to actually do that, which will probably happen in a bit
Well let us know once you abstracted Mojang internals into an API that isn't components but allows all the same things
mm is not components
it's just a string representation of a component just like json is, you still need a java object and api to represent them
i mean dont get me wrong, adventure is cool and all that, even so I think its a bit over engineered at times for example implementing the examinable api (its been with adventure for a long time so its understandable, would be hard to just rip it out), ofc examination has its use cases but still
Yea, some of the non component parts go places
i'm not a fan of the api and i think it's overhyped how many people in paper discord say "it's the most significant and valuable change paper does" like okay lmao sure
i mean it is pretty important
also adventure itself carries quite its own legacy crux and half the methods are deprecated because brr breaking changes
soonโข
it is important, but many make it seem like the single most important change, far beyond everything else
Well, I guess you can kinda get that impression because spigot has 0 support for any component stuff outside messages
So it isn't really adventure that is the best change it's the "any way to do components"
What broke it ๐
Oh it's other player inventories
Oh my god ๐ญ fucking hate that you can do this
He did I still need to look at why
Given that the spigot inventory expert refuses work
My guess is craft container botch or something

Me having a full time job be like ๐ญ
It's been around d since 1.18.2 so it's not super high on my todo was planning to look into that and craft merchant this week
The issue is that the player inventory is bigger than MenuType 9x4 but also
Switching it to 9x5 might cause issues for existing plugins
Later stages of inventory PR should fix if you use MenuType but like blegh
Opening non openable containers is tough
Well at least I'll finally make it home to my beloved setup in like 2 hours
is there any way to make my own variable
Object myVariable = null
Lol
I have a geniusly stupid idea
What if we mix NotNull/Nullable annotations with Optionals and get: Nullable<T>, NotNull<T>
๐
Basically, optionals but shitty
And then force them on all spigot users
Good idea?
lgtm
?learnjav
?learnjava
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! ๐
what about one relating to the player
like players amount of something
Thatโs held within their inventory
Use the Vault API
Thatโs held with like vault / essentials
ok thanks
Is there an npc guide?
just use the citizens api
^^
Why would a configurationSection be always returning null if its not?
public User(UUID playerUUID, FileHandler fileHandler) {
this.playerUUID = playerUUID;
this.fileHandler = fileHandler;
if (this.fileHandler.getConfig().contains("Rank")) {
this.playerRank = fileHandler.getConfig().getString("Rank");
} else if (this.fileHandler.getConfig().contains("Allowed-homes")) {
this.allowedHomes = fileHandler.getConfig().getInt("Homes.Allowed-homes");
} else if (this.fileHandler.getConfig().isConfigurationSection("Homes")) {
this.playerHomes = fileHandler.getConfig().getConfigurationSection("Homes").getKeys(false);
}
}
Homes:
home:
==: org.bukkit.Location
world: world
x: 6.485744877474398
y: 105.0
z: 10.694169240023918
pitch: 67.80005
yaw: -67.95006
Where the error is coming from
if (!user.getFileHandler().getConfig().contains("Homes") || user.getPlayerHomes().isEmpty()) {
send(sender, "&4You don't have any homes!");
return true;
}```
What's the error
at me.arkallic.core.commands.homes.HomeCommand.onCommand(HomeCommand.java:29) ~[?:?]```
oh ok thanks
so is playerHomes just a list of Strings?
no, its a ConfigurationSection.
The home is also a ConfigurationSection with the data inside
Then that code would give a compile error
.contains() only works for Stringlists?
You're assigning playerHomes to a list of Strings
only sigmas would understand
smh?
no where 
ok buddy
thats mine ๐ he stole that from me
based?
Is it fine to store a MongoDB document in memory for every online player or should I only get their active profile from the document and dump the rest since they can have multiple profiles
Depends how much data you're dealing with. In most cases I'd say that's completely fine. Though I wouldn't store thw BSON document I'd turn it into something meaningful first
If a player can have multiple profiles only storing their active profile is good
Alright thanks, cause I turned the active profile into something meaningful already and I thought I could just save the document for when the player switches profiles but I will just get it from the database async
if (!kingdoms.isEmpty()) {
Configurable config = kingdomsConfig.getConfig();
if (config != null) {
for (Map.Entry<String, String> kingdom : kingdoms.entrySet()) {
if (!kingdoms.containsKey(config.getNode(kingdom.getKey()).toPrimitive().getString()) || !kingdoms.containsValue(config.getNode(kingdom.getValue()).toPrimitive().getString())) {
config.set("kingdoms." + null, null);
} else {
config.set("kingdoms." + kingdom.getKey(), kingdom.getValue());
}
}
}
config.save();
}
for some reason this removes all players from the kingdoms node whenever i execute the /k leave <kingdom> command
kingdomsConfig.getConfig() is just defining where the config should go in the server files
Why is that looking so complicated
๐คทโโ๏ธ
It would be way easier to debug if you introduced some more variables
Instead of chaining 50 calls
if (!kingdoms.isEmpty()) {
Configurable config = kingdomsConfig.getConfig();
if (config != null) {
for (Map.Entry<String, String> kingdom : kingdoms.entrySet()) {
boolean configContainsKingdomKey = kingdoms.containsKey(config.getNode(kingdom.getKey()).toPrimitive().getString());
boolean configContainsKingdomValue = kingdoms.containsValue(config.getNode(kingdom.getValue()).toPrimitive().getString());
if (!configContainsKingdomKey || !configContainsKingdomValue) {
config.set("kingdoms." + null, null);
} else {
config.set("kingdoms." + kingdom.getKey(), kingdom.getValue());
}
}
}
config.save();
}```
"kingdoms." + null?
dont know how else to remove the person from the kingdom
but it removes everyone from the thing
Save it as a string list
wdym?
And then get the list, remove the player, and save the list back to config
ill work on it then send here once i think ive figured it out
declaration: package: org.bukkit.configuration, interface: ConfigurationSection
what would the path be?
Is that a member list or what is it?
The Configuration API is a set of tools to help developers quickly parse and emit configuration files that are human readable and editable. Despite the name, the API can easily be used to store plugin data in addition to plugin configuration. Presently only YAML configurations can be used. The API however was designed to be extensible and allow ...
the problem is im using a custom config class
not bukkit
Hey i'm using a scoreboard and the placeholder from spigot and when i try to configure how much entity "modded" is kill seems like no recognize the entity, there is a way to find the entity ?
Hey i'm very new to plugin dev so sorry if stupid questions. what is the correct way to log inside another package as the way i'm trying is giving me an IDE warning. It works but I feel there is a butter way.
fun creatureSpawnEvent(event: CreatureSpawnEvent) {
Bukkit.getLogger().info("Tried to spawn " + event.entity.name)
event.isCancelled = true
}```
this gives a yellow line under .getLogger()
how can i update the light of a chunk? I ||took the code from nms||wrote a method to place blocks faster than Block#setBlockData but that does not update the light. 1.20.1
yall know why BlockGrowEvent -> getBlock -> getType returns AIR for SUGAR_CANE?
I think you have to look if its the type you want
i have a listener like this:
@EventHandler(ignoreCancelled = true)
public void onGrow(BlockGrowEvent event) {
System.out.println(event.getBlock().getType());
}
i have a sugarcane growing and this returns AIR
wtf
Try this
public void onGrowEvent(BlockGrowEvent event){
if(event.getBlock().getType() == Material.WHEAT_SEEDS){
Bukkit.getServer().broadcastMessage("Test");
}
}
the issue is sugar cane never appears tho
when sugar cane grows on the server air prints
Hmm
ill do a loc check
Try
event.getNewState().getBlock().getType()
oh interesting
ill look into that
nah, but ill just use relative faces to get bottom block for air
In IntelliJ does anyone know how to output a JAR to another folder when building the JAR?
gradle
does anyone here know brigadier?
?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!
I want to make a command directly
but I'm not sure how it works
specifically, the redirect index
and child indicies
not sure how that one works
Yea
Im out w my dog but I could probably help after that ^^
ok
Can the dog help
is it possible to make it so when a player takes damage it is as if they have a different armor set on (like the damage they take)? accurate explosion damage is important so a basic multiplier wont work
I found a way: I have to call the ThreadedLevelLightEngine#relight(Set, Function, IntConsumer) method. The method has an async check, but you can copy the code and remove that
Hey, I am having an issue with YAML. For some reason, when I try to access buttons as an integer list, it is always empty, which means that it is null. Does anyone know why this is?
alt-menu:
title: "<green>My Epic Menu</green>"
rows: two
buttons:
- 0:
item:
type: diamond_sword
amount: 3
name: "<green>Ultra <bold>SWORD</bold></green>"
- 1:
item:
type: netherite_leggings
amount: 3
name: "Gucci Leggings"
"buttons" is a list of objects
how can I make it a list of integers?
or is that not something i could do in this situation
buttons:
- 0
- 1
- 2
Or
buttons: [0, 1, 2]
oh, so it cannot have sub-categories if it is a list of integers?
Keys are strings
A list of integers will always be a list of integers and a list of objects will always be a list of objects.
I have no idea what sub-categories for integers are.
What are you trying to do? Maybe a List isnt the right choice here.
This for example would be a Map<String, Object> or even Map<Integer, Object> if read correctly:
buttons:
0:
item:
type: diamond_sword
amount: 3
name: "<green>Ultra <bold>SWORD</bold></green>"
1:
item:
type: netherite_leggings
amount: 3
name: "Gucci Leggings"
Then pass it to
declaration: package: org.bukkit.configuration, interface: ConfigurationSection
Hey, I am still having a little trouble:
alt-menu:
title: "<green>My Epic Menu</green>"
rows: two
buttons:
- 0:
item:
type: diamond_sword
amount: 3
name: "<green>Ultra <bold>SWORD</bold></green>"
for some reason, the key at alt-menu.buttons.0.item.type is null. I have a feeling that it is not formatted correctly though
is this YAML? You have a list in that, which you can't go into via the string key
alt-menu:
title: "<green>My Epic Menu</green>"
rows: two
buttons:
0:
item:
type: diamond_sword
amount: 3
name: "<green>Ultra <bold>SWORD</bold></green>"
that would be the format you want which would match the key
I'm actually not sure if just a number is a supported key, but if it is, then thats it
oh i see what it means now, thank you
private final Map<String, Map<String, FactionBoost>> factionBoosts = new HashMap<>();
This is essentially a Map<String, Map<Identifier, Boost>>
Boosts that are applied may be effects that applies to all players in the faction. I'd like to make some of the boosts temporary. What are some ways I can go about doing so cleanly?
I was thinking save the endtime and timertask scheduled to run at endtime of the boost into a Map<String(Faction ID), Map<BoostName(String), Pair<TimerTask,Long>>>. If a boost is manually cancelled beforehand, i remove it from the map and cancel the timertask
This does seem a bit convoluted so if anyone has a cleaner solution, please lmk. ping when repsonding please
5 ticks
PATH IS: alt-menu.buttons.0
SLOT IS: 0
PATH IS: alt-menu.buttons.1
SLOT IS: 0
This is a sample configuration:
buttons:
0:
item:
type: diamond_sword
amount: 3
name: "<green>Ultra <bold>SWORD</bold></green>"
1:
item:
type: netherite_leggings
amount: 5
name: "Gucci Leggings"
The issue is that I am trying to get the slot based on the path, using ConfigurationSection#getInt, however, it is returning 0 and I am not sure why.
can you show the code where you try to access it
you need to get the Config Section for buttons
Then do getKeys(false)
That'll return a set<string>
public Button getButton(final String path) {
int slot = getInt(path);
System.out.println("PATH IS: " + path);
System.out.println("SLOT IS: " + slot);
}
for (String key : section.getKeys(false)) {
Button button = getDisplayButton(path + ".buttons." + key);
addButton(displayButton);
}
This is what I have
Which contains {0,1,2} etc
whats in getDisplayButton?
that is same as getButton basically
You're doing something wrong
Are you calling integer.parseInt anywhere?
No..
That's the issue
Oh, so it reads it as a string?
ah ok i see
And it's the section name
Yep
org.bukkit.plugin.InvalidDescriptionException: Invalid plugin.yml```
Okay yeah but weird. I am building and exporting the JAR to plugin directory within Intellij it must not be including the plugin.yml and I dont know why
what are you building it with?
Bump
building it as an artifact within Intellij
Ew
use maven or gradle
But when i used to do that, you have to specify the resources that gets put in the jar file
ohhhhhh
you should have some unified FactionData class per faction
then you wouldn't need a nested map
then you can just do Map<Boost, Long>
I haven't coded in a while
being boost applied, and expiration time
Is the timer task idea a good one?
But i dont wanna keep checking all boosts for expiration time, hence the timertask
yeah, you can have one iterating every few ticks to check expiration
multiple tasks will be less efficient then one iterating over expirations
Okay ty
I would probably make my own event scheduler thing for this. This way you know when a boost has been cancelled and if you want to do anything etc. a bit more code to setup but in the long run beneficial and makes things easier
Custom events are a thing you can do
public class SpawnListeners implements Listener {
@EventHandler
public void onPlayerDeath(PlayerDeathEvent e) {
Plugin plugin = Main.getPlugin();
Player p = e.getEntity();
Location bedSpawnLocation = p.getBedSpawnLocation();
if (bedSpawnLocation == null) {
double x = plugin.getConfig().getDouble("spawn.x");
double y = plugin.getConfig().getDouble("spawn.y");
double z = plugin.getConfig().getDouble("spawn.z");
float pitch = (float) plugin.getConfig().getDouble("spawn.pitch");
float yaw = (float) plugin.getConfig().getDouble("spawn.yaw");
String worldName = plugin.getConfig().getString("spawn.world");
if (worldName != null) {
Location spawnLocation = new Location(Bukkit.getWorld(worldName), x, y, z, yaw, pitch);
p.setBedSpawnLocation(spawnLocation, true);
p.sendMessage("You have no bed spawn point set! You have been teleported to the spawn");
} else {
World world;
world = Bukkit.getWorlds().getFirst();
p.setRespawnLocation(world.getSpawnLocation(), true);
}
}
}
}```
I've been trying this code to do the following:
1. On player death, if no bed respawn point set, teleport them to the set spawn with a message
2. Else, if there is no set spawn set, enable natural spawning
Problems:
1. If I set the spawn and delete the config, and restart the server to remove the set spawn data. It still somehow sends the player to that spawn on death. Minecraft probably caches it somewhere
*Tried at the paper server, they couldn't help. You guys are my last hope ๐ญ
i mean yeah that makes sense, you're setting the player's bed spawnpoint whenever they die and don't already have one
bed spawnpoints are saved in player nbt
this would probably work better in a PlayerRespawnEvent
if they don't have a bed spawnpoint, tp them to the location in the config
you might have to wait a tick before doing that im not sure
actually nvm it has a #setRespawnLocation method
so you dont even have to tp
i tried that, it found the death event easier
ok lemme try that
@worldly ice its not even tp'ing me to the spawn even when there is a setspawn
send code
package me.lolnypop.myplugin.plugins.SpawnPlugin;
import me.lolnypop.myplugin.Main;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerRespawnEvent;
import org.bukkit.plugin.Plugin;
public class SpawnListeners implements Listener {
@EventHandler
public void onPlayerRespawn(PlayerRespawnEvent e) {
Plugin plugin = Main.getPlugin();
Player p = e.getPlayer();
Location bedSpawnLocation = p.getBedSpawnLocation();
if (bedSpawnLocation == null) {
double x = plugin.getConfig().getDouble("spawn.x");
double y = plugin.getConfig().getDouble("spawn.y");
double z = plugin.getConfig().getDouble("spawn.z");
float pitch = (float) plugin.getConfig().getDouble("spawn.pitch");
float yaw = (float) plugin.getConfig().getDouble("spawn.yaw");
String worldName = plugin.getConfig().getString("spawn.world");
if (worldName != null) {
Location spawnLocation = new Location(Bukkit.getWorld(worldName), x, y, z, yaw, pitch);
p.setRespawnLocation(spawnLocation, true);
//p.setBedSpawnLocation(spawnLocation, true);
p.sendMessage("You have no bed spawn point set! You have been teleported to the spawn");
}
}
}
}```
and you're getting the message in chat?
yea
i get the message sometimes, but sometimes it says the regular minecraft dialouge, You have no home bed or it was obstructed
because, i need to check if the player has a bedspawnlocation or not, if not teleport them to spawn
might be a paper issue, it looks like they added extra params to the setRespawnLocation method
i think you should be able to use #isBedSpawn to check that
instead of p.setRespawnLocation i used e.respawnLocation it should work now
THIS THING EXISTS?
oh i didn't even see that
curse you 1 letter variable names
xD
like this?
}```
dont make me link you to #help-development message
or i could just use the location object
oh yeah and on the topic of that message, i would use a guard clause instead
if (e.isBedSpawn()) return;
// rest of code
owh thats neat
but lets see if it works first, then we can make the code more better and efficient
yessirrrr setting it to e.setRespawnLocation worked
hooray
now lemme check if it still enables regular spawning if there is no /setspawn
fr sometimes it would get so nested it would go outside of my monitor
i'd have to scroll horizontally to look at it
a lot of my old code came from eclipse ( ๐คฎ ) and lemme tell you it was a sight for sore eye
thats so bad
reminds me of some decompiled mc code
omg yes yes yes yes yes, when there is no setspawn it turns on regular spawning parameters
spigot thank you
i think i was doing something with entity attributes and the entire class is just one unmodifiable map that got initialized with every single entity all on a single line
??????
jesus christ
that's the case for every developer, you could look at your code now like 1 year later and also hate it
oh my god
i tried getting help from the paper server but to no avail
fr
what does it do tho
yeah we dont talk about the project that im working on rn that just has a gigantic enum with all my custom items ๐
its fine i'll move to like a registry eventually
imagine if hypixel stored it in the same way
had someone for one of my uni projects write this last year
dang i did not realize it was that many
thats actually crazy
wtf is this
man you dont even need a helper function for that ๐ญ
fr
https://github.com/1lolplayer1/IDE-A
here lol my first project I don't even remember what I have here but ik that it's bad
@worldly ice
look,
When I set my bed spawn and then break it, killing myself afterwards. Instead of sending just the "You have no bed spawn point! Teleporting you to spawn", it also sends the minecraft "You have no home bed or respawn anchor, or it was obstructed". Both of them together at the same time
am i trippin or is that python, js and c++ in one code
sheeeeeeeeeeeeeesh :(
c++
ah
stupid naming convention
shitty syntax aside, it's a great language
thats why i used death event lol, but that came with its own problems
super powerful, but i wouldn't recommend it for most projects
yeah but i've been learning rust the past like year or two and it seems to be able to do anything i would need c++ for
ah yeah rust>>>> any day
real ive been doing like everything in rust now
gotten to that point when im searching up mc servers written in rust
lmao
3 abandoned projects is a graveyard?
dear lord
datasian do you know any methods to cancel any events that says "You have no home bed or respawn anchor, or it was obstructed" from the game code. Like disable it
its a new metric
"yeah how many graveyards do you have?"
"10"
idk, that message might even be client-sided
dear lord you have a cemetary at that point
fr
damn, so i can't really change that then
funny how both rust players and rust coders are same sweats
yeah its a bit jank but i dont see why that won't work
im adding that to my dictionary
along with room temperature iq
it happens when i set a bed respawn point and break it, and then kill myself afterwards
then it prints the message
half brained and lil brained
https://www.spigotmc.org/threads/disable-no-bed-message.467865/ found this thread, it includes some packet manipulation
if you wanna go that route
he tried setting the player's bed respawn location as of respawn location
and i used that too and i faced problems like if you remove the setspawn, it will still send you to that spawn location even though its not there
im more talking about the beginning of the thread
alr im really not gonna go that route, ive been working on this for hours lets just move on haha
thats advanced level stuff
as i said, im half brained lmao
then what potato said would probably be easiest
setting the bed spawn for 1 tick so you never get the message
wai wai so set the players bed spawn location but only for a moment
so it wont get saved in the nbt data either
yes
i mean if it works it works
me trying to justify my thousands of lines of spaghetti code:
it should
i mean unless the bed spawn location is obstructed
then i think you'd also get the message
yeah..
im sure it'll be fine
huh now im curious as to how the server knows your bed was destroyed
right exactly
so then setting the bed spawnpoint wouldn't work?
but they've tried that before and im assuming they didn't get the message
yeah this makes no sense to me
i love mojank code
how on earth do i use setTeleportDuration to smoothly move a display entity from one location to another?
for context, im trying to spawn a display entity in the middle of an open shulker, and move it towards the player's eye-location. nothing i do ends up as a smooth movement, but rather just a single teleport:
ItemDisplay itemDisplay = shulkerBox.getWorld().spawn(shulkerBox.getBlock().getLocation().clone().add(.5, .5, .5), ItemDisplay.class);
itemDisplay.setItemStack(new ItemStack(Material.DIAMOND));
itemDisplay.setTeleportDuration(59);
itemDisplay.teleport(player.getEyeLocation());
do you have to tp? or could you just use translate
wdym
you can change the translation of an item display
and change its like smoothing
i forgor word
interpolation
there we go
so what do i use that in conjunction with?
change interpolation and translation of the display
iirc translation has to be set a tick later
declaration: package: org.bukkit.entity, interface: Display
let me try this with my current code
declaration: package: org.bukkit.entity, interface: Display
then i'll try interpolation + translation
oh yeah was gonna also recommend that
but generally you should be using translations on display entities rather than tping them
yeah, even this approach doesn't work.
ItemDisplay itemDisplay = shulkerBox.getWorld().spawn(shulkerBox.getBlock().getLocation().clone().add(.5, .5, .5), ItemDisplay.class);
itemDisplay.setItemStack(new ItemStack(Material.DIAMOND));
itemDisplay.setTeleportDuration(59);
new BukkitRunnable() {
@Override
public void run() {
itemDisplay.teleport(player.getEyeLocation());
}
}.runTaskLater(this, 1L);```
just confused how setTeleportDuration is supposed to work
let me try your suggestion now
oh i think i know why
when creating entities like that all changes are made a tick after they spawn
meaning even with the runnable you're still changing its tp duration and its location during the same tick
would here be the place to look for a developer to hire?
?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/
ohh tyty
you should use the method with the consumer to have changes be made before its summoned
i tried that initially
but i didn't add the runnable
let me try that
do you mean something like this?
ItemDisplay itemDisplay = shulkerBox.getWorld().spawn(shulkerBox.getBlock().getLocation().clone().add(.5, .5, .5), ItemDisplay.class, spawnedDisplay -> {
spawnedDisplay.setItemStack(new ItemStack(Material.DIAMOND));
spawnedDisplay.setInterpolationDuration(50);
new BukkitRunnable() {
@Override
public void run() {
spawnedDisplay.teleport(player.getEyeLocation());
}
}.runTaskLater(this, 1L);
});```
ah wait
np
do you know why this upper limit exists?
not sure, probably a mojang limitation?
although i have found instances where spigot's api causes more limitations than mojang
really? darn you a genius, you and datasianboi
my fair guess would be something to prevent too many intervals but interpolation doesn't seem to have this upperbbound
yeah i was about to say
if you really need a longer duration then id just do multiple tps (or just use translations wink wink)
datasianboi thanks so much for helping me, i tried asking for help in the paper server and as much as i got mad at them for telling me to go learn java instead of helping me with this simple spigot-api related code problem, i also think to myself... im half brained i really should learn java
yeah np
spigot community > paper community
imposter syndrome really hitting you hard
idk why they tell me to go learn java even if its not that java related
like asking should i use if(isBedSpawn) return; or if(p.getBedSpawnLocation == null). And they say go learn java instead of saying use isBedSpawn
dang yeah that's barely java related
and even then that's more of a stylistic choice imo
exactly haha
but i get it, sometimes i do ask random stupid questions because i do not know java, like i once asked what is a stacktrace and the gentleman just said "learn java"
another gentleman explained what it is
okay sure
i mean there's a difference between someone who is willing to learn more about java and someone who wants to quickly put something together without putting any effort into it
i might have to go in a while though, ill start implementing the method now
its mostly the latter that people have problems with
what happens if you Integer.parseInt a double string
numberformatexception?
ok
idk dont quote me on that
im willing to learn java, im weird and half brained thats why i shuffle between spigot tutorials and java tutorials. I started java tutorials first and learnt the basics then i started spigot tutorials and im gonna go back to java to learn the more nitty gritty
yeah im saying you're more of the type who is willing to put in the effort
so real
actually i never really "learned" java
i just do alot of projects to "learn"
yeah, i'm a self taught programmer ๐
that was so cringe
im in aura debt
lost so much from that
i made the mistake of learning modded first before plugins
all my java projects
only 2 aren't abandoned lmfao
woah, i guess people expects me to learn java fully and become a PhD holder on it and only then i can learn spigot haha
my "Other" folder in my java projects folder is so filled with crap and abandoned projects
Proceeds to make unscalable code with static abuse
i have like at least 60 projects overall (including other languages and deleted projects)
so im trying to make a server basicly from scratch and i have been working on it with gpt for the past week. and i was thinkning about letting my buddy make a smp server also. but like im not sure whats the newest best bungee cord type plugin for that but i think i need to understand what i should do in the future. so in the future should i just use something like velocity to connect everything or what ever is like that but good. and just make a smp server. and then a skyblock server. and then a lobby server? cause in the future im going to be buying the servers and running it through something like shockbyte. but have everything linked... im not sure how to go about doing these things lol. i just want to get a solid game plan down and figure things out in the future. cause when things are all like done with bungee and stuff like that doesnt there plugin folders only work when they are in that server?
dear lord
first half of the first sentence and im already scared
:pepehands:
if someone needs more info on what im trying to do lmk lmfao
are you asking what proxy software to use
wait do you mean like server protocol or server as in you just have a spigot server with no other plugins
or ig in your case a bungee network
what does tldr stand for
too long didnt read
why is he still typing
its over
chatgpt
right now i have one single spigot server. and ive made a plugin that makes people spawn on a "Lobby" world and they can do a /is create command and it makes a world based off a template and i have teams set up and shit like that. but i was going to add a smp game mode so it isnt just skyblock and i realized all the gamemodes will share plugins cause of how it is setup
but it has puncutation
Go to #help-server
you do bring up a fair point
@blissful crow
if (worldName != null) {
Location spawnLocation = new Location(Bukkit.getWorld(worldName), x, y, z, yaw, pitch);
e.setRespawnLocation(spawnLocation);
Bukkit.getScheduler().runTask(plugin, () -> {
p.setBedSpawnLocation(spawnLocation, true);
Bukkit.getScheduler().runTaskLater(plugin, () -> {
//cancelling the event here after two ticks?
}, 2L);
});
p.sendMessage(ChatColor.YELLOW + "Teleporting you to spawn... You do not have a home bed set");
}```
I know im half brained but is this how you do itt?
remove the first task
you want the bed spawn location to be set before you actually respawn
Its impossible to cancel the event after tick
and then just change the timeout from 2 to 1
oh yeah instead of cancelling just set the bed spawn location back to null
dang
beat me to it
fr
okie
if (worldName != null) {
Location spawnLocation = new Location(Bukkit.getWorld(worldName), x, y, z, yaw, pitch);
e.setRespawnLocation(spawnLocation);
p.setBedSpawnLocation(spawnLocation, true);
Bukkit.getScheduler().runTaskLater(plugin, () -> {
//cancelling the event here after two ticks?
p.setBedSpawnLocation(null);
}, 2L);
p.sendMessage(ChatColor.YELLOW + "Teleporting you to spawn... You do not have a home bed set");
}```
looks good
whats lgtm
ok
dang you were not joking with the hivemind comment
owhh i dont really know all these internet idioms or abbreviation lul
what is gloop
these bukkit schedulers are really confusing
i never really used them, kind of my first time hehe
do i still set the event's respawn point?
hi, is there a way to get all blocks id list into spigot? (not item id, block id) getId is deprecarted
haha, it cancels itself anyways
?xy probably?
This reflection Java tutorial describes using reflection for accessing and manipulating classes, fields, methods, and constructors
to identifie blocks the client use block id, its hardcoded in minecraft client and I need it to send packets abouts blocs
Material.class.getEnumConstants() then iterate. Push into list if material is block
do you guys use java beautifier? i do and it helps a lot defeating pyramid codes
how are you sending packets?
packet events
spigot has a sendblock method in its api pretty sure
why spigot deprecated getId method?
because its legacy
Paper api?
I am sending multplie send block
no, spigot
what is the default Player#getMaximumAir?
so send multiple block changes?
not sure why you arent be able to use api to solve this
no Im just loking for a way to get Id from material
but im saying you might not even need a block id
?tas ig?
maybe wiki has something about it
it's 300
good to know
https://wiki.vg/Protocol#Update_Section_Blocks
it speak about Id
using nms might be easier for this?
not sure how packetevents works ive never used it
but id assume they have some sort of way of converting a Material to an id
idk what a block state id is
it's simple with Material.getId but it has been deprecated without rasion but I can still use it or I make my own method, how to delete deprectation warnning? @supresswarning?
yeah
what should I put in args?
@SuppressWarnings(here)
deprecation or something?
I want to delete deprecation
if you're using intellij you can automatically suppress it
it'll auto-generate the annotation
ah good, how to do it?
without reason
doesn't support any modern blocks
checks out
it only supports blocks with legacy ids
i cant give very good instructions dont have ij open rn
well thats a problem
again, packetevents should have something builtin that turns materials into their ids
or just use nms
because packets blocks expect an id, they must all exist for all blocks somewhere no?
something something registries
I'm trying not to use it in this project
its accessible using reflection?
very annoyingly yeah
๐คท you could also just add nms and use it directly
^^
you'd have to navigate through obfuscated code
which'll make it even more of a hassle
yes I can
i can look into how PE does it rq, haven't worked with it in a good while
whats PE?
Iโm back at it again with my data handling stuff.
The following paste contains my BanListener and my PlayerDataListener.
Now the console tells me that data is null (dont have the log rn :( )
I already set the EventPrioritiesโฆ. Does it even make sense to load the PlayerData if the Player is banned? Should I have a List of playerUUIDs on my serverdata instead, which is loaded upon enabling the plugin?
packet events
I didn't read all context, perhaps this class might be useful to you @sterile breach : https://packetevents.github.io/spigot/io/github/retrooper/packetevents/util/SpigotConversionUtil.html#fromBukkitMaterialData(org.bukkit.material.MaterialData)
declaration: package: io.github.retrooper.packetevents.util, class: SpigotConversionUtil
For converting types from Bukkit to PacketEvents and vice versa
There's MaterialData if you want legacy support, and BlockData offered for modern versions
iirc monitor fires last, no?
LAST?? It has the highest priority iirc
this is exactly what I was looking for thank you ๐
it has the highest priority, meaning it has the final say as to whether, for example, an event is cancelled
Yes, that's how the priority system works @hybrid turret
im pretty sure
last event handler has last say over the event
Oh wait what
yeah yeah
OHHHH
MONITOR is used to see the result of the event.
yep
Alright thank youuu
Yep, but that means other plugins likely can easily modify your result.
or you can just be at NORMAL if none of this matters
Oh
Hmm
I mean it would be kinda stupid if someone would use another plugin that includes eg a ban system in it if mine already has it, no?
yeah thats sorta the server owners problem atp
And well if it only matters for the result it only matters for the BanListener, no?
Bc in the other event i only load data
And the result is set by the banlistener
So i could leave the banlistener on highest and put the playerdatalistener on lowest
This helps a lot, ty
When I change a skin using the GameProfile (or similar ways like the integrated PlayerProfile), do I see the skin myself?
https://paste.md-5.net/otizirifuw.cs
so uh, i got this code and i have this thing called "target". for example if you want to send a message then the "target" would be a player
but this creates an issue because targets might require a target
example: if the target is the player's held item
how would i make parseTarget recursive?
so if the target was {@event-player} @held-item it would parse event-player first then parse @held-item with the target of the parsed event-player
god why am i so bad at explaining
Hi, I'm confused by the PlayerInteractEvent spec right now.
There is a function where a person whose GameMode is Adventure changes the text of the standing signboard when he or she hits the signboard while sneaking.
When I run this, PlayerInteractEvent is called twice for some reason.
In the non-sneak state and other GameModes, it is called only once.
Is this a bug? Is it possible to make it so that it is called only once in the case of specifications?
The text was created using translation software, so please ask again if you have any questions.
?interact
hmm
idk the command, but
the interact event is fired once per hand
so you just have to check the hand and return if its the offhand for example
?interactevent
The PlayerInteractEvent may be called once per hand. If you only want code to be executed once, you can check the result of https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerInteractEvent.html#getHand(), then decide functionality.
For example, only executing code if the main hand was used:
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
if (event.getHand() != EquipmentSlot.HAND) { // * if the hand used is NOT the main hand:
return; // do not progress past this point |
}
// provide functionality
}
ah there it is
When I just checked with those words, it seems that the event call has occurred three times.
The contents of event.getHand() are HAND, HAND, OFF_HAND
It seems that the events occur in this order.
moment