#help-development
1 messages · Page 724 of 1
marketplace
this isnt for specific methods, so I'd rather do it like this
this isnt for the @EventHandler thing but for library classes
I'd rather not go through it with a comb
mans using java spring or what
That intellij warning is so fucking stupid
?
no im just splitting my code into two parts
@SuppressWarnings({"Unused"}) aint it either
seriously whats that annotation even doing
Disable that intellij warning
It really is the dumbest thing ever
Or your entire library wil just be suppress warnings hell
Is there some API that lets me alter a mobs ai?
For example, make it neutral instead of passive
See “Fixes” > “JDBC”
Driver was bumped from. .42 to .43 in this release but that’s one of the changes
Unsure why it’s “unsupported” when it worked before
this not be problem if i do so - private static final GaltapAutoMine instance = GaltapAutoMine.getInstance();
sonarList say this not good if i do getting plugin class in no-static metod (enable metod)
bc this static
Seems the reason why Statement#getGeneratedKeys() does not work is because it only ever returned one generated key even if more than one entry was inserted. So the solution is to use theRETURNING clause in SQLite statements to get all automatically generated values in a ResultSet as getGeneratedKeys() would have (theoretically) done before. So your statement becomes:
INSERT INTO player_vaults (contents)
VALUES ?
RETURNING *;
yet these plugins can't look at the context of the code which
is what I was talking about when I wrote that sonarList can be too demanding
i dont write the statement, hibernate generates it
Then your version of Hibernate needs an update
already using latest
Either way, forwarded to md to see if maybe he wants to revert the driver update and give developers a warning for 1.21 instead to start using RETURNING clauses for SQLite
I'm sure others are affected by the change as well
my IDE yells at me to use final lol
something something micro optimisation
just tested on 6.3.1.Final and it still errors, ill get coll to make a jira issue about it
or you can 😂
i cant english
Loops should not contain more than a single "break" or "continue" statement - sonarList - wth??
dev say this standard??
Can I manage the "popularity" system from villagers with a plugin?
I couldn't find anything
You'd probably need nms for that
It's to prevent overly complex code
hard to read
to be honest if you separate the code into methods you shouldn't feel the need for multiple breaks or continue
lol trust me this does not make it easier to read when interrupts are often needed
this should move it at the player location right?
BoundingBox boundingBox = player.getBoundingBox();
boundingBox.shift(player.getLocation());
i have to check if the bug is from somewhere else otherwise
That does depend on the code
You can use more than one and have readable code
It just seems to me that sonarLint was written by devs from the 90s
due to the fact that there are controversial recommendations that can cause harm today
or too perfectionists
what is sonarLint used for?
linting
that word is not in my vocabulary
Basic code analysis
oh
It gives recommendations on how to improve your code
is it better than intellij tho?
i guess intellij doesn't complain about 50 line methods
Think of it this way. It's the same reason IntelliJ is better at allowing you to write Java code than Notepad is
It's designed to do that
what will this return if there are no solid blocks in the distance (since its notnull)
air
Linters are designed to analyze your code. IntelliJ is not specifically designed to do that, it just does it as a feature
The block at the end of maxDistance
better, but you can say goodbye to good code readability
For me personally, var is inconvenient
so just air
i don't like var either
alr
I mean it could be non-air as well. Depends on what you put in your transparent block set
But yeah, generally air lol
SonarLint be like WHY ARENT YOU USING AN ENUMMAP
DO THIS YOU FUCKING WHORE' spits on you
for material i was use enum map sonarLint was say it
someone in here said enum map might not be that much better than a hashmap due to how many values it has
if you have like 5 materials enummap would have an array of the mat length anyway while hashmap will have 16? by default
internet say "enumMap better bc this for ENUM"
but sometimes it is better
Yeah but it won't be an enum one day
optimization etc.
I am thinking ahead
how ? you use enum class in key
the changes will be done in 2 separate classes for blocks and items
the material will stay for backward compatibility
you mean this for another minecraft version?
it's a pull request for spigot or something
adapt map for it?
wait, i think i understand you wrong, what do you mean?
this
yeah but it was debunked
the material class won't be the class that will be changed
good
so enamMap not good for frequently changing types
someone can just change class
i mean dem
yeah
dev
but so can anything else be changed and break stuff down the line
don't worry about it
spigotMC not accept plugins which do not support the latest version no?
there's nothing stopping you for making a plugin only for 1.8.8
but as i said, material will stay for backward compatiblity
I just read somewhere in the site rules
hi
i have a problem with znpcs
I want to make it so that when I click on the npc, the ches commands will open. I have already tried CMD (the command) but it won't let me
?lj
wait
my bad not directed torwards you im just seeing what it says
?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.
Hey, I'm trying to add a LuckPerms prefix onto my scoreboard with PlaceholderAPI and I have all of the expansions for it, but %luckperms_prefix% doesn't return anything at the moment except for when I do /papi parse Player %luckperms_prefix%
surf board
Are you making your own plugin?
Yes
?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.
Okay so
Pretty much I have this colorize(translateHexColorCodes(rank)) and this gets the rank formatted right if I just put it in the chat, but when I try to add it onto the scoreboard, it doesn't show anything in it lol
So uh are you actually translating the placeholder anywhere
-
colorize(translateHexColorCodes(rank))is my own way of getting the rank, but it doesn't show anything in it. -
%luckperms_prefix%shows%luckperms_prefix%in it lol.
Okay but are you using papi to parse the placeholder
Yes
where
player.getBOundingBox returns the player's bounding box at the player's location
oh it does?
What do you mean where?
yes
that's actually useful
Where in your code are you parsing the placeholder
I have PlaceholderAPI and the LuckPerms expansion in the server at the moment
and if you want to make it relative to 0,0,0 you just neg shift it
No where, but okay, forget the %luckperms_prefix% placeholder for the time being
Do you call PlaceholderAPI.setPlaceholders
What can be the problem for number one here?
So you aren't using PlaceholderAPI in your plugin and you're wondering why Placeholder API isn't working? Do I understand the issue
I'm getting the rank's prefix at the moment
Yes
Rephrase your issue because I'm struggling to understand it
You need to call the setPlaceholders method
Okay so forget LuckPerms entirely for the time being
I'll explain something else
- I have a scoreboard.
- This
colorize(translateHexColorCodes(rank))gets the rank's prefix.- It works on the scoreboard's title and in the chat.
- It doesn't work when I put it in one of the scoreboard lines.
So what exactly doesn't work
What are you assigning your rank variable to
Because I'm a solid 99.5% sure the problem isn't the scoreboard lines themselves
String rank = this.main.getChat().getGroupPrefix(player.getWorld(), this.main.getChat().getPrimaryGroup(player));
Have you tried printing out this value
Yes, this is the problem, it works all good in the chat
But not in one of the scoreboard lines
What happens when you use it on the scoreboard
Well the method's yours
If I add just rank onto the scoreboard, then it'll show the rank's prefix unformatted, but when I try to format on the scoreboard, it doesn't work
But when I format it in the chat, then it works all good
Make sure you're not reaching the scoreboard length cap
wouldn't really make sense but yes, it's real below 1.13
did someone say legacy versions
I'm making it on 1.20 at the moment
Alr then show your entire code
We don't have enough information to help
?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.
moment
Hastebin is a free web-based pastebin service for storing and sharing text and code snippets with anyone. Get started now.
This .replace("%rank%", colorize(translateHexColorCodes(rank))) is what doesn't work in it at the moment
If I’m storing a large amount of blocks in a chunk’s persistent data container, using a custom persistent data type, would it be bad to store block instances in a hashset, inside of this class?
ur doing what
THEY'RE STORING A LARGE AMOUNT OF BLOCKS IN A CHUNK'S PERSISTENT DATA CONTAINER
I heard you like chunks
Well first off, do block instances remain the same after a restart? I’m guessing they are instantiated when the chunk is loaded
So I put a chunk in your chunk
They do not
Since yknow
Ok, that’s what I thought
The JVM shuts down…
A new CraftBlock instance is created every single time you get a Block instance from the server. Blocks don't really exist
Blocks are purely a Bukkit concept
In reality, the server accesses blocks at an x, y, and z coordinate and map them to some state. There's only ever one instance of a state. Otherwise there would be like 65k or so instances of the same block state in a single chunk which will absolutely nuke the JVM's memory
Ur purely a bukkit concepr
@chrome beacon @echo basalt
Me?
No, choco
Send us what rank is
Oh
Yeah true LOL
The exact raw value
No way
Studies show all instances are lost when the JVM isn’t running
It’s so I can store custom data for a block
Store what you need in the chunk pdc mapped to the block location
?blockpdc
Learn about CustomBlockData here:
https://www.spigotmc.org/threads/custom-block-data-persistentdatacontainer-for-blocks.512422/
Unload and load the data as the chunks get loaded
It's something like this &#B300FF&lF&#A200FF&lO⎌FF&lUὀFF&lNE00FF&lDD00FF&lEC00FF&lR
This can handle most of it for you
homeboy copied his friend's message
I'm on my phone lol
link me them studies (University of Georgia doesn't count)
I had to lol
My name is Parker Hawke and I'm a software developer based out of Ontario, Canada. I make plugins for Minecraft servers and develop standalone games in my free time.
Math time 
Any ideas for it?
wtf did Georgia do to you?
I mean I get it
But wtf
just as simple as raytracing but yeah math!
raytraceEntities
getHitPosition
:)
Then you gotta do more math
Since the hitbox doesn’t perfectly match the player of course
I mean shit if you care about body part it's just some rotation and bounds checks
Wish that would work for me, but sadly it probably won’t. The whole thing here is this. I’m working on a system to show different blocks to different players. When a chunk packet is to be sent out, a channel duplex handler get the chunk instance, and gets persistent data from the chunk. This data contains a series of blocks to override the original blocks, corresponding to the player. Those overriding blocks then are sent to the specific players.
So what part doesn't work for you
that's a personal question !
Large file size?
Hmm 👀
I need to get data from the chunk, not a specific block.
The data is for information about blocks, but I need to access it from the chunk
track the data separately pls ❤️
So use the chunk pdc?
That’s what I’m doing
you don't need to store each state for each player for each chunk in the pdc
But yeah sounds like you might want to use smth else than pdc ^^
I mean all block pdc is actually on the chunk
and bitsets :)
Blocks don’t have pdc
yeah but the amount of data stored could be optimized
When I did client-sided blocks I basically just had my own chunk manager thing
Chunk2
Real blocks would be set as air to avoid collision issues and we'd just send fake blocks on top of the real stuff
depending on the amount it might be better to send block change packets instead of chunk packets
Make the entire server a void world
p sure it took like 60ms to read, update and send a chunk packet
And completely build the chunk per player
If you only want to remap entire types you can make it way faster
and cancelled packets and sent them later
By changing the palette instead
lot of pain
It's a lot easier to write your own copypaste thing with worldedit or bukkit's Structure
than to do the nms hackery
@chrome beacon @echo basalt Please let me know if you're going to be able to help me with it so I don't need to keep waiting if you're not going to help me with it, thanks
I was a bit neglectful for a period of like 2 years so I fucked around and found out
The whole story is I run a server that uses Geyser and Floodgate. I am adding custom blocks using noteblock block states and resourcepacks, but do to limitations, bedrock players can’t see these custom blocks. They just see the note locks. For them, I want to replace these custom blocks they can’t see with vanilla blocks that look similar, so it gives the same aesthetic
I feel like your getRank method is the problem rather than the way you display it
You should also split your code responsibility
make your own class for colorizing stuff
your code's a tiny bit unstable and I'm not THAT interested in resolving an issue I see as dumb
I should write a guide into debugging
Use the ChatColor class for Hex
Its format sucks tho
Do you mind telling me this, why does the get rank function work in the scoreboard title and in the chat, but not in one of the scoreboard lines?
(edited)
causation != correlation
debug your inputs by actually printing it out to the console
You could very much be translating and colorizing %luckperms_prefix% instead of the actual rank
Or use a real debugger
nah System.out.println does the job fine
and for memo leaks we just print out our collection sizes
Same
if that doesn't work we check for player / location / entity hard refs and if that doesn't work we make a VM for yourkit's 2 week trial 
Could you provide any documentation on pallets? Not heard of it because I’m clueless
basically chunks have this thing called "the palette" which just says
"when you see a 5 it means 13"
and both the server and client have a shared "global pallette" which says
"dirt is 1"
Instead of the old 13:18 system or whatever each state has its own id
It's basically just a huge list of singleton states
What you can do is loop through the pallette embedded in the packet and replace ids that match noteblocks
with ids that match your target blocks
So basically it just is, if you see dirt, make it clay?
yes
quite complex and you might need to read bits yourself
or you can cancel the packet, get the chunk position, wrap it around with some nms fuckery and change the nms pallette
now I get why ppl hate this
Yeah that’s my concern. Since I’m not changing huge amounts of blocks, just some here and there, I thought about doing it with player#sendMultiBlockChange()
Originally
Yeah it sucks
I guess you could remap it to custom blocks since bedrock supports those
No custom model data or blockstates
But that’s probably even harder
Yeah geyser has no api for custom blocks, even though bedrock has them. That would be insanely hard to get a Java plugin to communicate with a behavior pack LOL
That’s on Java clients though. Bedrock I don’t think has that issue
Viaversion has an api for that? I am using mojang remapped packets though. IDK if that would cause trouble
So do I just create a copy of the chunk, which I then edit with pallets, then send it to viaversion?
?paste
how can i synchronously process packets from protocollib BEFORE bukkit events that would use those packets are ran
using the bukkit scheduler (runTask) from a protocollib listener results in the code being ran after the event'
Hello. Recently I decided to study the REST API and therefore decided to write a small "banking" service, but I don't know how to better implement user registration.
The only thing that came to my mind was:
- Make a route (accessible only from localhost), say, "/register" and send a POST request to it when the player uses the command, say, "/bank createaccount".
- Use Discard OAuth, but then you will have to force players to link a Discord account, and not everyone uses it...
Can you suggest something?
sup lol
Well, we have a role play server with trading and so on. Now everything is simple on commands and GUI, so I decided to experiment 😂
why would you need registration for a bank in a minecraft server
tying it to account name should be enough
if you want to go way over the top add a password
integraring crypto into mc is aganist tos
TOS is just a suggestion!
its not a joke
rarely do you get terminated or blacklisted for that shit
most servers survive blacklists too they just don't gain players
is there a free way or anything to host a mongodb
I mean it's hardly "free" but if you purchase a host (shared or dedicated, whatever) you can always install and run a MongoDB instance alongside your server
I also thought so, but just then any user will be able to create accounts, even without playing on the server. Need some kind of confirmation
Technically free, but hosts are a bit more expensive than just a Minecraft server host
hi, do you know where I could find the images of all the blocks/items in 1.20.2?
I think some hosts will offer you SQL databases as well
free oracle vps
it's what I use
mongodb atlas?
no just make sure they've joined atleast once before doing something like that
That's the problem, I don't know how. I decided to write the backend separately, on golang. If I wrote REST as part of a plugin, there would be no problems
you could open up a socket internally to communicate with the server
for expressed purpose
nobody?
Hmm, I didn't remember about the sockets somehow... I thought it would be easier to create an additional route to send a POST request, because registration will take place on the server anyway. Thank you!
Like this? If yes, then you can look at the Minecraft wiki
it forces me to scrap to get the images back
I just want a damn .zip
Remembered. Try this: https://mc.nerothe.com. But I'm not sure about the quality
What happened?
sexual things actually
Huh?
1000 thanks
If I depend on a library via plugin.yml that is already included in spigot
Will the one from plugin.yml take priority
decompile the .jar
like
%appdata%/.minecraft/versions/1.20.2.jar
You’ll get the texture from that
But they won’t be in the form of block models, if that’s what they want
well, there's both
oh?
There isn’t
Nothing like this
I need a proof now 😭
Just the flat textures are in the jar
I think so
but I don't know how they render the texture afterwards
Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.3.0:resources (default-resources) on project ciroHub: Execution default-resources of goal org.apache.maven.plugins:maven-resources-plugin:3.3.0:resources failed.
What could be happening? pom.xml: https://paste.md-5.net/xatemikawu.xml
Post full error/log
prob EntityDamageEvent
Does that fire for non living entities
yes
p sure
not sure if item frames count get shot by bows
but there was something that def could
what would be the best way to check when a person clicks a certain block? i have a lot of blocks that people can click and each block has values with it, so whats the best way to go about this? i assume theres a better way then storing the location in a file along with any data
This is what it's supposed to be (This is sent in the chat)
This is what it is at the moment (This is in the scoreboard)
Fun
Now, are you translating colors before hex
or opposite way
and do scoreboards even support the §x bullshit or should you be using components
They do because if I put the FOUNDER text in the scoreboard title, then it'd work all good
What should I be doing?
I'll look into it
show scoreboard text pls
like where you set the lines
prob in your lib
Just like
is it using team names or team prefixes
that's the important bit
that's not the scoreboard code
still no
What?
looking for the actual bukkit scoreboard stuff
I remember you used a lib called aether for that
Yes
Is it foss, could you replace it with your own just to be sure
okay yeah it uses board text instead of like
fucking prefixes
use this, be haoppy
What's the difference in it?
SimpleBoard board = new SimpleBoard();
board.setTitle(TextUtils.color("&aJoe");
board.displayList(List.of(
"Hey",
"There"
));
board.display(player);
Uses team prefixes instead of obscure team names
It's also simple
you'll probably want to handle placeholders somewhere
Up to you how you use it
I see yours is simple, but I like the way the Aether API is setup at the moment, is there anyway I can fix it?
Make an impl simpler to aether
problem with aether is that it uses team names which don't support rgb colors
:)
That's literally it
How come it works in the scoreboard title?
Because the scoreboard title doesn't rely on teams
It's a bit complex and I don't fully understand it
But the scoreboard has "objectives" and "teams"
The idea is that we assign an objective to the scoreboard and every team has its own score for that objective
What we do here is just create a bunch of teams with legacy chatcolor names so the name is invisible
And we assign our colorful rgb stuff as prefixes and suffixes
Team names trip up if they have rgb colors for a reason
Titles aren't tied to the objective or any of the teams
They're tied to the sidebar
Hello !
I'm trying to make a custom villager exchange with a JSON,
But some "random" blocks, although well written in my json, don't appear. I have the impression that they are blocks from fairly recent versions (maybe not, spruce_lab, are not recognize too, so idk)
I'm on spigot 1.20.1
https://paste.md-5.net/jilahukoho.cs
Is your api-version set
Also, Material#matchMaterial() > Material#getMaterial() so you can use keys
Or, better yet, Registry.MATERIAL.match()
@worldly ingot cannot blame ppl for not using the registries
nobody knows they exist
because spigot got no official blog and md or contributors never care about writing wiki articles
we need an official news source
and NO; the changelog viewer is not enough
for example the PlayerProfile API, I have the feeling that my blog post is the only reason why people about it AT ALL
i suspect/hope (bukkit) registries will become a) more useful, and b) more known about after the enum eradication PR, but that solely depends on what "alternatives" to the Whatever.getByName etc the PR provides;; ideally, none, and it would just redirect you to the Registry interface
That's the plan
I'll take credit for it
oh okay
How would I use a hexcode for a chat color?
(ChatColor.RED + "Test") where ChatColor.RED is replaced with a hexcode.
ChatColor.of(“#123456”)
of is not a method of ChatColor.
net.md-5 package, not org.bukkit
Ah, gotcha.
org.bukkit.ChatColor is stinky
is the naming convention NMSVersion or NmsVersion
Matter of preference
I personally capitalize acronyms but others don't
You see it a lot with API vs Api
EVERYONE please take a look at this page and add the changes you noticed in "more or less recent" spigot versions to this list, please! thank you! https://www.spigotmc.org/wiki/spigot-api-changelog/?noRedirect=1
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
ONLY ADD MAJOR API CHANGES
I'm transfering a project to another PC. Everything was fine before, but now, I'm getting this InteliJ problem: "Dependency 'ca.bkaw:paper-nms:1.20.1-SNAPSHOT' not found" Reloading maven gives me this error: "ca.bkaw:paper-nms:jar:1.20.1-SNAPSHOT was not found in https://repo.papermc.io/repository/maven-public/ during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of papermc-repo has elapsed or updates are forced"
This is the maven plugin: https://github.com/Alvinn8/paper-nms-maven-plugin
Here is the dependency (directly from my pom.xml):
<dependency>
<groupId>ca.bkaw</groupId>
<artifactId>paper-nms</artifactId>
<version>1.20.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
If no one can help, that’s understandable as this is related to paperMC
do yo uonly have this one "nms paper" dependency?
or more than one?
did you declare the plugins repository like the readme shows?
easist solution would be to just properly use the official spigot specialsource plugin
?nms
No I have all of my required dependencies. I made a mistake with the JDK
so you solved it already?
Yeah just now
Thanks for the help everyone!
I did, but I made a mistake with the JDK
although we didn't do anything helpful, always welcome lol
although you should REALLY think about switching to gradle paperweight-userdev instead
it will save you much trouble in the future
spigot = maven
paper = gradle
the plugin you linked mention it in its readme too
Agreed! This is an older plugin I made, before I realized relying everything on a 3rd party was a bad idea
yeah well both the specialsource plugin for maven, as well as the e.g. the shadow or userdev plugin gradle is "third-party" sooo
but as long as you got it working now, that's great
By 3rd party I mean if that one guy decides to stop updating the maven plugin, my plugin can’t update. Userdev was made by the same developers as paperMC I’m pretty sure
Yeah! That’s a better way to put it
not really. what is my plugin then?
5th party
4th party?
It’s parties all the way down
https://plugins.gradle.org/plugin/com.jeff-media.fix-javadoc-plugin how many'th party ithis @young knoll ?
javadoc.exe = first hand
maven or gradle javadoc = second hand, I guess
so mine would be third hand?
3rd party: Spigot API / Paper API, 4th party: makes things that use and/or are for said APIs
unless your build file is severely cursed, your spigot api or paper api .jar would be a normal dependency just like the jdk itself is
That’s gotta be like 12 parties
yes, that is true
Maybe I’ve just been hallucinating the existence of gradle for all these years
Gradle is confusing
or as the gradle devs would call it it: !Booleans.FALSE!!
And whenever I mention it people just think I’m insane
it really is, at first glance
you need about one to two weeks to fully understand how it works
and after that you know exactly how it works and then you think "was this really worth it, or could I have just sticked to maven with the maven-versions plugin?"
and the answer is always "well"
Desert well
TL;DR: 99% of gradle users would be better off just using maven and the 1% of maven users who refuse to use gradle are at their own fault
gradle starts to become even slower than maven once you have javadocs task that depend on "each other"
I never really understood the reason why anyone would even need to "code" their build scripts
(which doesn't mean there is no valid use case, it just means I never encounctared any myself)
have you missed the last 4 weeks or what
I've kinda been in and out since the end of july tbh
ah ok
school nd all been kinda busy until recently now that I got going
yeah I have indeed learnt that i has many nice features that are missing in maven
but truth be told, maven 4 will be evaporating them all
on the other hand, people have been waiting for maven 4 since like, idk, 5 years now?
I will give a one sentence TL;DR:
Gradle is very powerful and it's not at bad at all, but if you want to code a minecraft plugin and you do not already know gradle by heart, then it's the worst build system you could choose
gradle is great for people who are geniuses and know EVERYTHING
i'm flattered
if you EVER had to copy/paste something from stackoverflow to make your gradle build work, you're not ready for gradle's power yet
if you EVER had to ask somewhere someone about gradle in the last 2 years, chances are high you're not stupid, but gradle devs are just too ignorant about actual users
maybe both is true? who knows
gradle is not bad. but gradle is not always the best tool to choose
my main complaint with gradle is I feel like the docs just weren't super useful when I was setting stuff up. I honestly just went back to maven for my project seeing as I was never like "oh I wish maven had/did this"
you do not use gradle
gradle uses you
gradle is 40 ton 8 axle truck. you can haul many cargo. but yo ujust wanna go on vacataion with your family? better take your normal car (maven) lol
main thing I don't get about gradle is how could it do something maven can't e.g. you can pretty much code some pretty insane maven plugin if you wanted
also gradle IS SLOWER for multi module projects that depend on each other if they have different interacting lifecycles
people always claim gradle is faster, which is not true
🥲 so true
it is faster 90% of the time (if you ignore the 30 seconds startup time)
but not always
whats 1.20.2 nms version ?
whats the nms version smh
he means the craftbukkit package
yes
dont say "smh" if you asked wrongly
No, you're Emily
gross you do it like that? I just convert everything into easy to read strings lol
i "smh" everyone cuz im a total badass
a certified one
by... my dad
anyways
yeah ok understandable. tbh I also don't know if CRAFTBUKKIT (!!!) has a new package name for 1.20.2, if you find out pls ping me and lemme know
because I'd also like to know
thanks
i guess i have to build it
wait I use NMS in my projects 😭 I have to copy and paste agian
the worst part about NMS is copy pasting all your code from one module to the other real shame
maybe you wont
There were significant internal changes, so yes
dya know what they changed?
I mean you can look at all the patch changes in that commit to see what changed at least with respect to CB lol
But there are obviously more non-patched files that were updated too
The new configuration protocol phase ended up changing a lot
RecipeHolder woh mojang
what now
you see it sounds so much more interesting than it is
oh its just the old IRecipe
it quite literally just holds a recipe 👍
ah shit
thanks
here we go again
Why packet require seed info for spawning players?
¯_(ツ)_/¯
Caused by: java.lang.NoSuchMethodError: 'java.lang.String com.mojang.authlib.properties.Property.getValue()' WHAT THE FUCk
Property is a record, so its just "value()"
well thats the Map, the Property is a record
hmm
i managed to fix it
btw does anybody know the new name of PacketPlayOutNamedEntitySpawn
players use the existing add entity packet now
how do you people deal with customers who have issues only with bedrock issues? do you blatantly tell them "no spigot/no java = not my issue, or just refund them instantly, or check out the problem and only refund if you notice they need bedrock support but it's not possible with just spigot api/ .... ?"
once I figured out the issue really only occurs for bedrock users, and I notice it's important for the buyer that they care about bedrock users not having issues, I just refund them, no questions, asked, even if their purchase is like >3 months ago. However this is getting annoying. why do server owners take it for granted that plugin devs have to care about geyser issues? 😢
note it in the plugin description
in some huge red font
how can i prevent tab complete for a player that don't have the permission to run the command?
CommandPreProcessEvent iirc, loop through the list and remove commands the player shouldn’t be able to tab
If they dont have the permission for the command then they dont have tab completion for the command as its not sent to them.
are protcollib listeners async always
Yes, packets are handled disjoint from spigots main thread
world.rayTrace will only returns result with a block OR entity, not ever both, right
It will stop at the first hitbox, yes
There are methods for tracing exclusively for blocks or entities
Still doesn't work fyi
people just skip all the relevant text
go to discord
and spam you there
Hello, I'm trying to generate a world without ocean biomes.
I have this custom ChunkGenerator :
public class CustomBiomeGenerator extends ChunkGenerator {
private final List<Biome> oceanBiomes = List.of(Biome.OCEAN, Biome.DEEP_OCEAN, Biome.COLD_OCEAN, Biome.DEEP_COLD_OCEAN,
Biome.FROZEN_OCEAN, Biome.DEEP_FROZEN_OCEAN, Biome.LUKEWARM_OCEAN, Biome.DEEP_LUKEWARM_OCEAN, Biome.WARM_OCEAN);
@Override
public @Nullable BiomeProvider getDefaultBiomeProvider(@NotNull WorldInfo worldInfo) {
final BiomeProvider vanilla = worldInfo.vanillaBiomeProvider();
return new BiomeProvider() {
@Override
public Biome getBiome(WorldInfo worldInfo, int x, int y, int z) {
org.bukkit.block.Biome biome = vanilla.getBiome(worldInfo, x, y, z);
if (CustomBiomeGenerator.this.oceanBiomes.contains(biome)) {
return Biome.PLAINS;
}
return biome;
}
@Override
public @NotNull List<Biome> getBiomes(WorldInfo worldInfo) {
return vanilla.getBiomes(worldInfo);
}
};
}
@Override
public boolean shouldGenerateNoise() {
return true;
}
@Override
public boolean shouldGenerateSurface() {
return true;
}
@Override
public boolean shouldGenerateBedrock() {
return true;
}
@Override
public boolean shouldGenerateCaves() {
return true;
}
@Override
public boolean shouldGenerateDecorations() {
return true;
}
@Override
public boolean shouldGenerateMobs() {
return true;
}
@Override
public boolean shouldGenerateStructures() {
return true;
}
}
The problem I encounter is that terrain generation is not only based on biome as you can see on this image, I got a plains biome but still have an ocean...
Do someone know how I can fix that?
getBiomes returns the biomes this world generator can return iirc, you probably want to return the vanilla biomes minus the oceans
First thing you should do is implement a proper class instead of an anonymous one. After that do what voodoo suggested.
That was the plan
Still doesnt work sadly
@Override
public @NotNull List<Biome> getBiomes(WorldInfo worldInfo) {
return vanilla.getBiomes(worldInfo).stream().filter(biome -> !CustomBiomeGenerator.this.oceanBiomes.contains(biome)).toList();
}
Yeah but we cannot remove biomes from registry
As older versions
if you call runTask from a bukkit event, will the task be ran later on the same tick?
also, when using runTask, will the tasks be ran in order of how the runTask method was called
No, the earliest point in time where scheduled tasks will run is the next tick.
I would love to get the code if so because I tried all yesterday and couldnt
The scheduler makes no guarantees regarding the order of scheduled tasks.
so what would be the difference between runTask and runTaskLater with a 1 tick delay
None
Already tried doesnt work
I deleted everything as it didnt work but i can code it again
are you trying to remove biomes from the vanilla registry ?
Yes
. . . Why is the registry private static final ?
The usual interact packet
Something may have changed but I believe the fields were accessible
try {
Field field = Biomes.class.getField("S"); //OCEANS
field.setAccessible(true);
field.set(Biomes.class, Biomes.PLAINS);
} catch (Exception ex) {
ex.printStackTrace();
}
Error :
That... is not how you edit the registry
Well i would love some help if it isnt the registry x)
I though that it was Biomes class
net.minecraft.world.level.biome
All the registries are in one class (probably Registries or Registry)
Then there is BIOME
You have to unfreeze the registry probably to edit it.
At least that is how I managed to add a block server side :D
If it reminds you something
I maybe found registry you talk
but still public static final
That is still a key
That is a resource key, not the registry
The only thing with Registry I found is this sadly
Compare different mappings with this website: https://mappings.cephx.dev
Only thing i can find with biomes in this class is this :
public static final Registry<Codec<? extends BiomeSource>> BIOME_SOURCE = registerSimple(Registries.BIOME_SOURCE, Lifecycle.stable(), BiomeSources::bootstrap);
I think that should be it
You have to unfreeze the registry and them remove the correct BiomeSource ig
BiomeSource does have possibleBiome fields but again final field
Compare different mappings with this website: https://mappings.cephx.dev
Mhh can you provide code, as I did show you i get an error
while modifying final fields
app updates are evil
i was update plugin for intelji now this plugin not free🥲
and when I was update intellij itself it began to freeze more often
org.bukkit.event.entity.ProjectileHitEvent has problem on 1_20_R2?
NBT_v1_20.java
HitEvent.java
This all can be done without nms and craftbukkit btw
https://streamable.com/cpxzfp , hi trying to fix this any idea?
Fix which is possible with this information:
Properly handle your inventory click events.
You are checking for v1_20_R1 instead of v1_20_R2
Some plugin does that. Items on the cursor dont get deleted randomly.
can it be because iam removing player inventory in some point?
https://github.com/NUTT1101/CatchBall/pull/15/commits/3a8db4e51d0813df46d542e7f33dc4fbf66e1b6b
but i changed all 1_20_R1 to 1_20_R2
Your code still tries to find R1 classes
whats new in minecraft 1.20.2
Villager trading fixed
thats it?
a shit load of technical stuff
i cant find it 😭
does craftbukkit changed somethings about CraftEntity in 1.20.2?
quick question
if i modify the playerInventory.getArmorContents array, will the armors be modified?
not feeling like trying
aight thx
it makes a craftbukkit copy every time the method is called
so yeah immutable
or well
defensive copy
whatev
yes but don;t assume it always will
if i lisen blockBreak event build flag can not worked in worldguard?ъ
i was testing this really not work
but idk this is bc i lisen event or not
What
Can someone explain why my IDE corrects a word A to word B then corrects word B to word A ?
Bezier -> bézier -> Bezier
Hi any idea?
hey how can i connect with my bot to a spigot plugin?
what is your bot
phyton?
i mean whats it for
i will server stop command and so
check status
etc
do you mean like a discord bot?
make sure to reuse these as much as possible
Hi, I have a very... specific question to ask. It's not that much about spigot, but I know you guys are always helpful. 🙂
So... I want to create a new minecraft server, that would use my own plugin(s). I want to ask, how I could hide some code from other devs. For example, I have a class file with all the "magic" in it and I want to make sure, that this class file can only be accessed through an interface. Is it possible to hide some class files somehow, but make the plugin still work properly?
Make it package private
Ohm... how exactly?
Don’t put a modifier on the class
Ye, I know this. But... how does this help to hide the source code from others?
Well it's worth noting that package privacy only allows you access within, as the name implies, the same package. So if you make a subpackage you won't be able to access it
If you're wanting to design an API you would probably want to create a second API module that consists primarily of interfaces which your plugin can then implement
API will be available at runtime but you can distribute a separate API artifact that contains only the interfaces
This is what Bukkit and CraftBukkit are
Yes. This is an example I wanted to say. How can I do that?
why though seems wasteful
yes
If you're using Maven or Gradle, create a new module for your API, and one for your implementation (your plugin code). Your plugin module should depend on your API module so that you can actually get the files. Your API should have some sort of primary interface that can be set by your implementation. Bukkit's primary interface is Server and you'll notice that the Bukkit class has a setServer(Server) method to drive the whole implementation
Then it's just a matter of making interfaces in your API and having your implementation actually implement those APIs, return them in the correct places, etc
Thanks for the clear explanation! 😄
It’s worth noting though that nothing in java will be truly hidden
You can look to Bukkit and CraftBukkit as a decent example of how to go about doing this
You can always access something if it’s loaded by the JVM
Yes. But Im not developing for microsoft. 😂
I've got a problem, here's my NPC's custom exchange (I used Registry.MATERIAL.match as you advised to set the items in the NPC's inventory)
Here's my method for custom exchanges with my NPC, for the deepslate items my debug tells me it's an AIR type block, and the method doesn't work on it, whereas if I do it on the old blocks, basic "diamond_ore" style, my method works perfectly, any ideas?
https://paste.md-5.net/cuvoroquke.cs
Hello Can i add Metrics to my bungeeCord plugin with gradle?
sure, why not
How i try but it don't work
I would recommend you look up guard clause (early return)
Will make your code more readable
shade and relocate
Did you set api version in your plugin.yml
the cursor item belongs to the player, not the inventory
We also asked this last time
Yes, i tried, mais i got error anytime i do this
i tried both , it send me the correct name of the item ,when i tried to debug it , but it does not add it
ty
I truc this but it don't work
Share the error
yep
this is what iam suffering from rn .. the item on courser is deleted once i close the inventory
thats not bstats
wait what kind of metrics are we talking about
I don't understand everything but i try to add bstats
bStats collects data for plugin authors. Get started now!
Hey I want to code a bot in java with my SpigotAPI plugin. However, I don't know how to do that, let alone how to import something into Maven
It's only for maven and i want gradle (or i don't understand something)
You can use it with gradle
How?
Bots are one of the most difficult things you can program in spigot.
You need to ton of experience with packets, nms and the protocol.
uff but phyton.......
And there is no best approach to this, so many ppl will give you different advice. This needs to be engineered solo in most cases.
There is also Prismarine and i believe also a Java based external bot application
because I don't want to learn a new language
Sooo i start a New plugin with maven and it's ok?
Fairly basic example that shades and relocates bStats
It does have some other stuff but yeah
If you know how dependency managers work, then it doesnt matter if you use gradle or maven...
*But maven has a much greater coverage. Especially in the spigot community.
Dont know how it work, Time to learn lol
I know what i have to do
@molten hearth
plugins {
id "com.github.johnrengelman.shadow" version "7.1.0"
}
dependencies {
implementation group: 'org.bstats', name: 'bstats-bukkit', version: '2.2.1'
}
shadowJar {
relocate 'org.bstats', 'me.jishuna.minetweaks.libs.bstats'
}
build {
dependsOn shadowJar
}
simplified
quantum computers are no more
ty choco
With the API version, it works half way, it doesn't remove the block from the player's inventory if it's a deepslate block, classic blocks like "diamond_ore" if it does remove it for me, but it works already better
i'm dumb, it's just work
thanks for the tips
also wtf, you used tabs and spaces in that build script and some lines have extra spaces at the end
What's up with that?
Uhh
It's 2 years old and I didn't have an eclipse plugin to format groovy stuff back then
I'll kotlin you
When Vault is not on the server, why
This code generates NoClassDefFoundError:
Supplier<Economy> factory = () -> null;
```But this code does not?
```java
Supplier<Economy> factory = new Supplier<Economy>()
{
@Override
public Economy get()
{
return null;
}
};
I believe lambdas will generate methods, and obviously having a method with the Economy return type will require it to be loaded, causing the NCDFE to be thrown. Though if you're creating an anonymous inner class that may not necessarily be the case because generics are not available at runtime
Caused by: java.lang.NoSuchMethodError: 'org.bukkit.persistence.PersistentDataContainer org.bukkit.inventory.meta.ItemMeta.getPersistentDataContainer()'
Why does this happen?
Get the bytecode!
Did it get updated
PDC was added in 1.14 so that error should only ever be thrown in 1.13 or lower
Most likely because your server version is too old and doesn't have the PDC API.

Get on it choco
To be fair...
Huh
🤔
Isn't this the opposite? The anonymous class explicitly declares the method with the Economy parameter while the lambda doesn't
It's a generic in the anonymous class
I don't think it's generic when the synthetic method is generated
I'm taking a guess tbh
Like I said get the bytecode
Would probably reveal more information, yeah
can comparable result in 'equal'
does anyone has 1.20.1 nametags API? cuz there is no PacketPlayOutScoreboardTeam packet
?Nms
?nms
Hey! I've been trying to make a item that changes when someone clicks it and im trying to use it as a vanish toggle. Can someone tell me what i did wrong here? @EventHandler public void OnRightClick(PlayerInteractEvent e) { Player player = e.getPlayer(); PlayerInventory inv = player.getInventory(); ItemStack vanish = new ItemStack(Material.LIME_DYE); ItemMeta vanishMeta = vanish.getItemMeta(); Action action = e.getAction(); if(player.getItemInHand().getType() == Material.GRAY_DYE && player.getItemInUse().getItemMeta().getDisplayName().equals((ChatColor.GRAY + "Vanish ei ole päällä"))) { if(action.equals( Action.RIGHT_CLICK_AIR ) || action.equals( Action.RIGHT_CLICK_BLOCK )) { vanish.setType(Material.LIME_DYE); vanishMeta.setDisplayName(ChatColor.GREEN + "Vanish on päällä"); vanish.setItemMeta(vanishMeta); staffMode.enableVanish(player); inv.setItem(0, vanish); } } else if ((player.getItemInHand().getType() == Material.LIME_DYE) && player.getItemInHand().getItemMeta().getDisplayName().equals((ChatColor.GREEN + "Vanish on päällä"))) { if(action.equals( Action.RIGHT_CLICK_AIR ) || action.equals( Action.RIGHT_CLICK_BLOCK )) { vanish.setType(Material.GRAY_DYE); vanishMeta.setDisplayName(ChatColor.GRAY + "Vanish ei ole päällä"); vanish.setItemMeta(vanishMeta); staffMode.disableVanish(player); inv.setItem(0, vanish); } } }
rn nothing happens but i want it to switch the item between lime dye and gray dye when the player right clicks it in their hand
Does the event fire
it did before
You're using getItemInUse() instead of getItemInHand() in your first if statement
ive tried both
Either way, PlayerInteractEvent should have a getItem() you can use directly instead
Makes things a bit easier
It can be null however
"org.bukkit.inventory.ItemStack.getItemMeta()" just noticed this in the console
That doesn't mean too much to use but it's probably an error and likely caused by the fact you're doing getItemInUse().getItemMeta() despite there being no item in use
Items in use are things like bows, or shields
Did you even registered the listener?
yes
they compile down to different things
Where there is no anonymous class for lambda basically
and then you use invokedynamic instead also
lambdas are amazing vs anonymous classes
nvm it just started working randomly
you can also change the existing itemstack instead of creating a new itemstack
Maybe because you use item display as checking.
InvokeDynamic is love
Yeah also what choco said, you get that reified generic in the anonymous class
getitemmeta gives you a copy sadly
which I mean, boop crash ehrgm
@EventHandler
public void OnRightClick(PlayerInteractEvent e) {
Player player = e.getPlayer();
Action action = e.getAction();
ItemStack item = e.getItem();
if (action != Action.RIGHT_CLICK_AIR && action != Action.RIGHT_CLICK_BLOCK) {
return;
}
if (item.getType() == Material.GRAY_DYE && item.hasItemMeta() && item.getItemMeta().getDisplayName().equals(ChatColor.GRAY + "Vanish ei ole päällä")) {
item.setType(Material.LIME_DYE);
ItemMeta itemMeta = item.getItemMeta();
itemMeta.setDisplayName(ChatColor.GREEN + "Vanish on päällä");
item.setItemMeta(itemMeta);
staffMode.enableVanish(player);
}
else if (item.getType() == Material.LIME_DYE && item.hasItemMeta() && item.getItemMeta().getDisplayName().equals(ChatColor.GREEN + "Vanish on päällä")) {
item.setType(Material.GRAY_DYE);
ItemMeta itemMeta = item.getItemMeta();
itemMeta.setDisplayName(ChatColor.GRAY + "Vanish ei ole päällä");
item.setItemMeta(itemMeta);
staffMode.disableVanish(player);
}
}```
I just had a brain off moment, but what choco posted is what I meant
That would work
Lambdas for quickly implment interface. Anonymous classes if lazy to create new class file.
Simplifies things a bit as well
Not really
Imo
You ideally only want to use lambda syntax for @FunctionalInterface annotated interfaces
i have mapped but that packet doesnt exist
🥄
If it's mapped that won't be the name
It will be ClientboundSomethingSomething
?mappings
Compare different mappings with this website: https://mappings.cephx.dev
Upper case in first character of method 😭
net.minecraft.network.protocol.game.ClientboundSetPlayerTeamPacket
That was what they had. I copy/pasted
1.20.1
Just recently
Right. It's meant to send tile state updates
Fair
Still doesn't let me do what I wanted tho, big sadge
This was a while ago
Working with Structures as their individual blocks/entities
Bukkit has a Structure api
You can break the structure down into BlockStates and entities
But neither of them will be bound to a world, and there is no way to do so
PDC would be in the BlockState
(If it's a tile entity)
No
There is no method to add an entity to a world, because bukkit expects them to always be in a world already
Basically I would need some kind of cloning support
And then a setLocation on BlockState and an addToWorld on Entity
Because the entity system is like
12 years old
Compare different mappings with this website: https://mappings.cephx.dev
Yeah there is
It's no problem with NMS but yknow
NMS
Would need a proper system for handling virtual entities
Which we have discussed but nothing has come of it yet
Entities that aren't in a world
It just exists
It gets added to a world separately
I just exist
smell
The main thing we discussed is having a isVirtual method
and then an addToWorld method
like coconuts
Just remake bukkit
what would this new ecosystem be named
in the club w my twin we be vibin
I got a problem and that is i have Citizens on my server and i also use it as a depency in one of my plugins and when the server loads i get a error message that Citizens is already initialized. How do i prevent this?
