#help-development
1 messages ยท Page 829 of 1
this is for reflection so it gives exactly whast is in the package name
Especially now with Mojang adding experimental content
what is this phenomeno m called
Shouldn't be breaking changes at least if we talk semantic versioninh
Mojang ๐ doesn't ๐ follow ๐ semver
They put breaking changes into patches frequently
That's interesting
I mean I work a lot with NMS but mostly through protocol lib and don't use version mapping most of the time
Yeah protocol lib handles that shit foe you
Mostly unless the packet changes
Idk if they provide compat for that
Nah not necessarily, protocol lib doesn't have everything mapped. Often I end up checking for mappings and use class member lookups
Or accessors as it's done
What exactly lol
the like 12 messages above that one
the var int thingy?
https://paste.md-5.net/zibatoduke.sql
so i 've been having this error with mostly minecraft 1.16.5 can't figure out what's causing it though can someone lend me a hand its a mc pluing
the 'google bad' thingy
Idk, I mean I use duckduckgo, google and bing :>
im so appaled by google doing that, so i just read books
well, I suppose there are those that just live under a rock at times :>
What did google do?
block other search engines and making its results worse by restructuring the way theyre ordered to favour paying websites even more than before
guys
why, after deleting the uid.dat and teleporting the player to the island, do the players not see each other?
yo where specifically do I put the ItemStack variable? (ItemStack itemInFrame)
alertComp.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_ITEM, itemInFrame));
Who knows how to help. Look, I'm making a skyblock:
When the player enters, a copy of the island is created for him (with the removal of the uid.data). If someone is added to the island, that player is teleported to the owner's island.
Problem:
After the player teleports to the island, the players do not see each other.
However, if the owner re-enters, then the players see each other.
And also, if the players teleport to another world, they see each other.
I don't use packages. Vanish, etc., is not present either. Simple spigot teleportation methods.
Version: 1.12.2 (paper)
because when copying the island, there is a discrepancy and there is a problem that the uid.dat somehow conflicts with the server. Therefore, we have to delete it.
declaration: package: net.md_5.bungee.api.chat.hover.content, class: Item
ok thx
bro answer me please
have you tried calling save on the world after you load it the first time?
yeah
when it's first loaded if there is no id it will be generated
sec, i will send
World originalWorld = Bukkit.getWorld("IslandCopy");
if (originalWorld != null) {
deleteUidDat(originalWorld);
copyWorld(originalWorld, copiedWorldName);
World copiedWorld = Bukkit.createWorld(new WorldCreator(copiedWorldName));
copiedWorld.save();
checkAndCreateIslandData(playerUUID);
teleportPlayerToOwnerUUID(playerUUID);
}
}
how certain are you that it's the missing id that causes this issue?
would it be possible to convert ItemStack to Item
I'm not sure. I've been trying to solve this problem for 2 weeks... But it doesn't work.. I've tried almost all the ways...
does the issue occur if you don't delete the id?
You should just copy everything except the id
been there done that about 4 years ago
you about it? uid.dat sorry xd
in this case, the island is not created... There is a confrontation
@echo basalt his issue is that players are invisible to each other when teleported to the new world.
I've only experienced block invisibility
Iirc Item is an Entity that exists somewhere, so you need a location for it
Player invisibility is a new one
So what should we do then? If it cannot be copied and deleted?
You can get an ItemStack from an Item, not the other way around
But you can spawn an Item and set its itemstack to be your desired itemstack
I have seen player invisible issues but it was LONG ago and actually a bug with world loading.
or chunk loading to be precise
but thats all changed since then
can you repeat the invisible issue on Spigot?
think my block invisibility issue was because of how fast ppl were tp'ing to their worlds
That is, players can break blocks, they can hear sounds, but they do not see each other
I've also had world corruption issues because IO is done async after the world saves
My solution to all of those issues was to just give up on using .mca files and have a world pool
I tryed it on spigot/paper... also problem...
If you can repeat this issue on Spigot we can look more into it, as paper and spigot world loading is different
And there was also such a problem, although 1 time, as soon as the players entered, they did not see them when breaking blocks
The problem is that the console itself does not give errors
is it possible to get an item inside of an item frame as an Item and not an ItemStack?
no
rip
And, I forgot to mention, when trying to teleport to the world through (multiworld /mw goto), it gives an error...
Item is a wrapper for a dropped ItemStack
eh... Idk where is a problem...
I forgot to say, as soon as the players become visible, they never become invisible again (i.e., when they re-enter, they see each other)
They're talking about Bungee item
used in hover component
ah
Can somebody briefly explain why Spigot is not allowed to distribute Spigot jars, but forks like Paper or Purpur freely distribute theirs without needing to run something locally?
Just realized this
isnt it that they just dont care about the copyright theyre breaking
?dmca
An unofficial explanation of the DMCA can be found here: https://www.spigotmc.org/wiki/unofficial-explanation-about-the-dmca/
I think I've read that at some point
But it didn't make it clear why paper on the other hand can do the distribution
Unless I didn't read it well enough
Ehh, maybe
That's weird then
paper doesn't either
paper distributes a paperclip jar
which does not include mojang code, it just contains a giant binary patch that is applied onto the vanilla jar (which is downloaded on the server)
Ohh, I see
That makes sense, basically an alternate buildtools but abstracted xD
Tyty
what is "Item"
is there a way to check if an interaction event is cancelled by another plugin
yes
cause it's cancelled if the vanilla behavior does nothing
Just check if event#isCancelled()
you can't detect if it was a plugin or vanilla
oh dam
What does that mean
only certain actions fire with a default cancelled though
Vanilla cancels event?
some event fire cancelled if the vanilla action would do nothing
idk
im making a custom item plugin
and i dont want items to trigger
if they're cancelled by like world guard or something
Why not just check if event is cancelled, I'm confused
yeah, just check in monitor if it's cancelled, if not run your code, but do NOT change anything in the event at monitor
Hello, How to import CraftBukkit in maven ?
?nms
Bootstrap Jar
The main spigot-1.18.jar is now a bootstrap jar which contains all libraries. You cannot directly depend on this jar. You should depend on Spigot/Spigot-API/target/spigot-api-1.18-R0.1-SNAPSHOT-shaded.jar, or the entire contents of the bundler directory from your server, or use a dependency manager such as Maven or Gradle to handle this automatically.
Please read the release notes for further information: https://www.spigotmc.org/threads/9-years-of-spigotmc-spigot-bungeecord-1-18-1-18-1-release.534760/#post-4305163
spigot not -api
Anyone know why "findSafeDismountLocation" is null none of the values โโused are null
@Override
public Location getSafeLocation(Player player) {
ServerPlayer entityPlayer = ((CraftPlayer) player).getHandle();
ServerLevel serverLevel = entityPlayer.serverLevel();
BlockPos blockPos = new BlockPos(entityPlayer.getBlockY(), entityPlayer.getBlockX(), entityPlayer.getBlockZ());
Log.info("entityPlayer: " + entityPlayer);
Log.info("serverLevel: " + serverLevel);
Log.info("blockPos: " + blockPos);
Vec3 vec3 = DismountHelper.findSafeDismountLocation(EntityType.PLAYER, serverLevel, blockPos, true);
if (vec3 != null) {
Location location = new Location(player.getWorld(), vec3.x, vec3.y, vec3.z);
Log.info("location: " + location);
return location;
}
return null;
}```
Can someone help me with the config.yml I made a bungeecord server and linked it to the rest of the servers as I do however when I try to join the server I am greeted with a message "readtimeout : null" please help me resolve this issue im sure this is a common issue?
BlockPlaceEvent is not triggered when I place water/lava, which event should I use?
bucket events
I try it but on eclipse, it deletes all errors
package de.eugaming.test;
import org.bukkit.ChatColor;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.AsyncPlayerChatEvent;
import java.util.List;
public class ChatFilter implements Listener {
private List<String> filteredWords;
public ChatFilter(List<String> filteredWords) {
this.filteredWords = filteredWords;
}
@EventHandler
public void onPlayerChat(AsyncPlayerChatEvent event) {
String message = event.getMessage();
System.out.println("Message: " + message);
for (String word : filteredWords) {
System.out.println("Word: " + word);
if (message.contains(word)) {
event.setMessage(message.replace(word, ChatColor.DARK_RED + word + ChatColor.RESET));
}
}
}
}
Anyone Know why it Doesnt Run the if satement? inside the for loop
System.out.println("Word: " + word);
this works fine tho
im sending one to one on of the words in the config
it doesnt detect it
but it reads the words out correctly
hello, would someone know how to boost the amount of ore per chunks in a world?
why not just increase the drops per block instead of messing with generation?
because thats not what i want to do
Sign sign = (Sign) block.getState();
String line1 = sign.getLine(0);
String line2 = sign.getLine(1);
String line3 = sign.getLine(2);
String line4 = sign.getLine(3);```
Any idea why these are empty when the sign I placed isnt in a SignChangeEvent? The event itself fires fine but these Line variables are empty
and i also want to boost caves sizes
it would achieve the same thing, and simpler
Datapack is your best option
do you know of any datapacks that i can use to boost caves and ore rates?
selfrole Add or remove a selfrole from yourself.
cleanup Base command for deleting messages.
embedset Commands for toggling embeds on or off.
info Shows info about CafeBabe.
licenseinfo Get info about Red's licenses.
mydata Commands which interact with the data CafeBabe has about...
set Commands for changing CafeBabe's settings.
uptime Shows CafeBabe's uptime.
findcog Find which cog a command comes from.
names Show previous usernames, global display names, and server...
userinfo Show information about a member.
listcases List cases for the specified member.
reason Specify a reason for a modlog case.
permissions Command permission management tools.
?whereami


not sure why you would ask this here?
would you guys know how to put a datapack on a world before generation? cuz i have a datapack that changes the world generation
or maybe you meant to infer something else, in which case do note spigot came before paper by a long margin ๐
maybe you could register it as a world generator?
however I am not quite familiar with that since I never bothered with it much, but there should be somewhere in the configs to do such things
Nope you gotta load it and then restart the server
what i mean is in the code how do i put the datapack in the world
like here is where i generate my world
do i need to put the datapack after the generation?
Datapacks have to go in the main world
Can someone look into this issue
user error
Does that mean that's an error at my end?
If so would you willing to help me resolve it?
more then likely yes or its a plugin interfering either of those two are pretty much 90% of the reason
so do i get the folder and add in the datapack?
if you do have plugins, maybe try removing them and see if the problem persists
if it does, then its the way you configured
yes
No plugins new server completely fresh
But the server must be restarted after you add the datapack
then the problem is most likely in your configuration. Is the server home hosted? a dedi? a vm?
It's on a server hosting service
one i do the world.getWorldFolder() how do i access the datapack folder
I assume one of those panel hosts that don't really let you control the server right?
that isn't what I meant
Then wym
are you able to change the OS of the server for example?
if the answer is no, then its a panel host that limits your control
you hardcode it
new File(worldFolder, "datapacks")
you are trying to run a server and you don't even know what an OS is?
ok but I think you are missing the point of the freedom of control
once i have the folder, how do i get the datapack and add it ?
So ur saying they should let the change it at any point of time?
sure why not? its a vm
Yea they let me do that
there is vm hosting providers all over that provide that since before these panel hosts existed ๐
I can configure that whenever I want
well if they give you that freedom then, then I doubt its anything to do with the hosting provider
so that leaves either you misconfiguring something in the OS itself or in the server configs
I suppose we can start with the configs though as that would be easier to diagnose
Can you provide a list of thing I should change in the "config.yml" as to my knowledge I added the servers and changed the connection trottled to -1 and set bungeecord to true in all the linked server is there any thing else I need to do
how am I to provide a list if I don't know what it is you currently have?
the default is perfect only requiring like couple lines of addition
Ok then, do I send a copy past of config here?
?paste
omg that didnt work
so....you chose to not use the link
not sure what that has to do with the link
no im saying my browser isint functioning properly
therefore i am unable to open the link
but that issue is unimportant
shit thats the wrong config.....
il change it
ccan u del the link
๐
o.O
interesting
wonder if the issue is just your system then
probably should fix it
no one cares about ip's and they are not private anyways, but if you are that concerned just replace them with fake ones
like make one just all ones
another 2's to differentiate what it is you are doing
I don't read DM's to put it more simply
screw it
this is the config from today after i changed the configurating a little bit
i troubleshooted my browser
Hey i need help, With the Spigot 1.10.2 API and ProtocolLib and JavaI'm looking to make a command called /checkvelocity, which is used to detect if a player has anti-knockback, during the check I'd like to block packets to the targeted player in order to put him as a spectator and give him velocity but I want the other players to be able to see the player still in front of them as if nothing had happened and once the check is complete, to be put back on life support and get his packets back. i heard that we can block with ProtocolLib the packet but i don't know anything about packet
T
you have multiple hosts?
yes im using skynodes for the other servers and another host for bungeecord
is that an issue because ive tried that in the past
idk what skynodes are
its just a server hosting service
anyways have you tried connecting to those servers directly?
ok
when i join with bungeecord on false it lets me in however when i put bungeecord on true it says that i need to conect with the bungeecord IP
but when i use the dumb bungeecord IP it connection timed out no further info
Scenario:
There's an add to faction command that gets called when players join, and also when a player creates. I want to implement additional things if it's the case where a player is creating and then joining (like adding them as a leader, giving special perm levels, etc)
Should I add another parameter to the addToFaction() to check if it's a join or create, or make an entirely different special add function for the case of a faction creation?
ssh into the server, and ping your mc server
im sorry.....what does that mean?
i really need to gain some knowledge ๐
do you not know how to get to the terminal of your server?
ok....well you are going to need an ssh client. I assume your hosting provider has some documentation on connecting to your server via ssh
unless you really don't have unlimited control over it
is 20.4 currently considered stable?
we shall find out ๐
il figure it and get back
ok well the hosting service ppl say i cant ssh into the server
ah and so we discover that no you don't have unlimited control
welp no unlimited control ig
anyways, I don't really see anything wrong with your config. The issue is most likely stemming from the host or ip you have but I can't determine that if you don't have the ability to self diagnose the host to begin with
hence me wanting you to ping from the bungee host to the mc server one
would i say the hosting serive sucks if isaid i cant do that either
indeed
as I said earlier there is plenty of vm providers that let you have unlimited control
and they are cheap too, and provide better specs
when I say vm providers they are also known as VPS's
or you can go with a dedicated server box
depends on your budget
does somebody know if a lot of data in a pdc, and i mean a lot can cause the chunk corruption glitch, or other problems? (im on 1.20.2 mc)
you can get quite a decent dedi for like $70/m
have you tried it?
no, but i want to know if this can happen or if anyone has experience and advice in stuff like this
and just so you know, the chunk doesn't get corrupted either
welp guess il just buy another one i just bought this cus it same with a sql package but whatevr. Thanks for your time trying to troubleshoot with me
do you know why a chunk becomes unloadable when there is too much data?
no
you do know chunks are in region files correct?
not really
well yes, but its also important to understand why the chunk becomes unloadable
so you know how to avoid it or fix it
anyways, region files hold something like 1024 chunks
the server loads these region files by memory mapping
unlike most api methods in Java, memory mapping actually invokes OS api
therefore the files are loaded into memory via the OS and are outside of Java's memory
this is important because the key here is the file is loaded into memory
the entire file
so, if the file is say 6gb large
then its going to consume 6gb of ram
if you don't have the memory for it, it just doesn't load
and this counts for pdc as well i guess?
I am not entirely sure because I am not sure if the pdc contents are stored directly in the chunk or if they are in a separate file
if they are in a separate file, then its not really an issue
hmm i hope they are then
otherwise, if its stored in the chunk, then potentially it could cause the chunk to not load
its in the chunk file iirc
but, you would need a lot of data though because as far as I am aware pdc just stores strings
? pdc stores nbt
Yeah its just a wrapper around nbt
And is saved/loaded with its parent holder basically
so big pdc can be big problem?
eventually
im currently saving a customitem object to an itemstack, which is created with the item's pdc data, should i just use the data from the pdc directly or is a lot faster having it stored in a object?
if speed is your concern just store binary data yourself in your own file
use memory mapping for it
should be plenty fast
as I have told others in how fast this can be, well you can load 20mil blocks of information in 6 seconds and save it in 3
okay thats quite fast
if you need faster, probably should start looking into DB software at that point
i know how to create dbs
I was about to mention that and your concerns for storage become less worrying
so you guys think i should save every custom item in a database?
personally i thought this isnt good because players could create an infinite amount of them and tracking which of them are destroyed by lava or something else would be kinda not fun
with pdc the server would only know about the items that are there and in use, right?
you dont put every spawned in item in a database
can do the same with a DB
load the items you want to track for the players online
if anything you would just store the info used to create the item
You can make it so those custom items can't be taken out of the inventory. I think we need a bit more context on what you want the custom items to be and how they are utilised
i do, the items arent pre defined, every item can have enchants
therefore be unique
what again was the issue with PDC here ? ๐
why do you put them in a database
what kind of madness are you planning on storing the a PDC
they can if they want. MySQL can handle literal millions of queries a second and these days storage is cheap and doubt they will manage to fill terrabytes of info in any meaningful time frame
i was worried about chunk overload
I guess
I would just rely on mc to store the items for me
people writing 60 pages of utf-8 garbage into books is a lot more deadly than you storing a couple strings and bytes in a PDC
currently 30 different stats that can be a float
Yea, that seems perfectly fine
but there will probably be more
I will admit it is convenient but if the data is going to be large, it is typically not ideal to mix your custom data with game data and conflating files unnecessarily
just use /data on any hand item, that already has a ton of existing variables and its fine
yea, I would not worry about a couple floats lol
yes that may be true
okay, so pdc it is ?
I'd go with PDC.
The alternative is pretty much always a slapped UUID into the PDC and then all that data in a DB
if your only issue is overloading chucnks, then yeah, just use pdc
while it may be a couple of floats, I suppose it depends how many items end up getting stored in a single chunk
I mean, sure ?
but you can do that with or without PDCed items
the floats are not like a 10x on the item size lol
how do people usually "store" players' options, for example, if a player disabled public chat feature how do u save that
I'll write you a couple of nice mandarin character filled books
smack them into a chunk
and youll be at the same end
I usually save per-player settings in the player's pdc
for small stuff like that
more in-depth systems probably warrant a database to track that stuff
if you are going to have multiple servers, a database would be the way
but if something warrants a single bool for each player, im not gonna bother with a whole databsae
they tend to be easier and nicer to work with in terms of organizing the data too ๐
cast teh returned BanList
thats not a cast
what am i supposed to cast it to then?
neither of those work
sec
this is all caused by enums
it can't return the correct type cause the type is an enum
how would I check if a block would change a noteblock instrument to BASS
I just tested and it's just casting
ProfileBanList bans = Bukkit.getBanList(BanList.Type.Profile);
bans.addBan(Bukkit.createPlayerProfile("test"), null, null, null);```
Or just casting java ((ProfileBanList)Bukkit.getBanList(BanList.Type.Profile)).addBan(Bukkit.createPlayerProfile("test"), null, null, null);
such unsafe API. cause that compiles, but here is also what compiles.
BanList<ItemMeta> banList = Bukkit.getBanList(BanList.Type.PROFILE);
and that at runtime by itself won't throw any exceptions
ofc you will get an error when you try to ban an instance of itemmeta at runtime cause it can't be cast to PlayerProfile
What do it means with this Represents a choice of multiple matching Materials. in the javadoc for MaterialChoice?
In-game it does not behave as I think it does.
And also ExactChoice is little confusing Represents a choice that will be valid only one of the stacks is exactly matched (aside from stack size). Only valid for shaped recipes do you not want all items to match when use exact beside metadata?
how would that work? how would any itemstack match both an itemstack with 2 durability and an itemstack with 3 durability?
I mean both this methods don't work if you put in more than 1 item then the recipe is null. It is ways around this but create more overhead.
ignores massive not code block or pastebin
it checks if any of the stacks in the exactchoice match the stack input in the crafting table
if I create an exact choice with a oak plank with a special name and a spruce plank with a special name, then either one of those works for that recipe choice
yes but only checks first match then the event #.getRecipe() returns null when you add correct next item.
well its only 1 recipechoice, it can only match against 1 input
you have to add another recipe choice instance if you want your recipe to take multiple ingredients
even if both methods supports array of items?
the arrays of items are for matching against 1 input
can you have more than max 3 rows when you set the shape?
no? its a 3x3 grid
each choice represents 1 of those 9 slots
or well it can match multiple if you specify the shape with duplicate chars
Yeah what I see is you can't make the shape bigger than 3, so you can only have 3 instances of choice?
shaped recipe with shape "# #", " ", "# #"
set # to be materialchoice(OAK_PLANK, SPRUCE_PLANK)
means I can put either oak or spruce planks in those 4 corner slots
no, you can have up to 9 instances of choice for a 3x3 shaped recipe
cause you can't have more than 9 ingredients
I talking about this check in shape.
Preconditions.checkArgument(shape.length > 0 && shape.length < 4, "Crafting recipes should be 1, 2 or 3 rows, not ", shape.length);
yeah, its a string
the shape I have matches that
its 3 strings so > 0 < 4
each string is > 0 chars < 4 chars
why would it need to be bigger then 3?
So I can have 3 strings like this below and it split it up to all 9 slots?
023,456,789
alright it is why shape use string and not char then, that clears up 1 or 2 things. Thanks for the help.
yeah. I think it would be more clear if the parameter was char[][], but ๐คทโโ๏ธ
Yeah, but that could be less user-friendly way, is the downside I think ๐
I finally found the answer with chat GPT
ChatGPT says nothing useful most of the time lol
That time, it gave an answer better than human
He uses anwser from human
Yes, but he chooses the more coherent answer among human answers so it's better
That is truely how large language models work 
How do I make players unable to take damage from a certain rocket that was created by the code and make it not create flash?
when I say flash I mean this:
its only better in the sense when it works you are not searching for someone who has the answer that you understand
why are the methods in MapPalette deprecated? what should I use instead?
I want to send map data through packets and need to send an array of byte
would that be the index of the color palette, like how MapPalette stores it?
you can still use deprecated methods
Check the javadocs
I'm playing around with the 1.19.4 text display entities and I want to be able to set the color of the text, how do I do that?
ChatColor ?
I want to be able to set color via a hex code
ChatColor.of(..)
that worked :)
do blocks have any way to store data in them?
?blockpdc
Learn about CustomBlockData here:
https://www.spigotmc.org/threads/custom-block-data-persistentdatacontainer-for-blocks.512422/
i see this and my mind goes 'factorio pollution'
is there a difference in speed between sending packets and using spigot?
public static void main(String[] args) {
int[] numbers = new int[1000];
for (int i = 0; i < numbers.length; i++); {
numbers[i] = i + 1;
}
for (int i = 0; i < numbers.length; i++); {
System.out.println(numbers[i]);
}
}
}```
i cant put in ,,i,,
why?
java: Symbol nicht gefunden
Symbol: Variable i
Ort: Klasse main
that code should compile
what
Oh I see
You have a trailing semicolon after your for loop header
So your code would basically compile to (if you were able to compile it)
public class main {
public static void main(String[] args) {
int[] numbers = new int[1000];
for (int i = 0; i < numbers.length; i++) { /* EMPTY BODY */ }
numbers[i] = i + 1;
for (int i = 0; i < numbers.length; i++) { /* EMPTY BODY */ }
System.out.println(numbers[i]);
}
}
Since the for loops would be de-facto NOPs in their entirety, you'd effectively get
public class main {
public static void main(String[] args) {
int[] numbers = new int[1000];
numbers[i] = i + 1;
System.out.println(numbers[i]);
}
}
And here you can see why i cannot be found
TL;DR: You don't need to put a ; at the end of your loops lol
Well need is a rather weak word, you ought not do so
what
There is a ; between your ) and {
// What you have
for (int i = 0; i < numbers.length; i++); {
numbers[i] = i + 1;
}
// What you SHOULD have
for (int i = 0; i < numbers.length; i++) {
numbers[i] = i + 1;
}
Why? There's a valid reason to do it sometimes
dose anyone know how i can remove all the defualt achevements in minecraft with a plugin?
how u guys make code with colors here?
That is why I didn't say must. But until you know when you are relatively safely allowed to do so, you shouldn't.
as in completely removing them in 1.8
```language
your code here
```
any open source plugins with a good implementation/framework for commands I can study? thank you in advance.
public class main {
public static void main(String[] args) {
int[] numbers = new int[1000];
for (int i = 0; i < numbers.length; i++); {
numbers[i] = i + 1;
}
for (int i = 0; i < numbers.length; i++); {
System.out.println(numbers[i]);
}
}
}```
Need a new line after your "java", but yeah
It needs to be on the same line
ye
yay
ACF seems popular?
Not entirely sure whether that is what you want though
no, that's good
this is a first one trully using annotations
I'm thinking about brigadier but with annotations, or something in-between
incendo's cloud
Cloud might be a tad bit overengineered, but knock yourself out I suppose :p
cloud >>>>>>
im ngl I just see too much appeal in incendo and lucko projects
like they're overengineered to some but you can make them do quite a bit since its so extensive and abstract
is it complicated to create custom items?
that's true, but I'm only looking for code-snippets, mostly, to study how should I implement it myself
are you trying to make a command framework or am I just misunderstanding
it certainly isn't the easiest thing - though it depends on what you consider as custom
no and yes. making? no, trying? yes
I just trying to see what else I can find that doesn't look like a monster in my code. that's all
I guess a simple CommandNode<> that does all the stuff didn't kill anyone
an new chestplate that gives u extra health speed prob ...
and pickaxe taht miney 3x3
The first one might be semi-easily possible, the second one is more difficult.
guess what, the best solution to a problem is usually the easiest one
https://hub.spigotmc.org/javadocs/spigot/org/bukkit/command/Command.html
And then when i cheated my way through that anticheats
Ah yeah, block permissions isn't fun
I eventually settled on supporting each and every plugin individually, but I soon stopped (https://github.com/Geolykt/EnchantmentsPlus/tree/4xx/src/main/java/de/geolykt/enchantments_plus/compatibility/nativeperm)
I faked the break event
That will cause exploits with other plugins
But then suddenly anticheats and stuff got mad
Notably, McMMO
Then i had to exclude specific plugins from my faked events
Skill issue on their part
Was a whole 1 hour issue
I do support both systems though, just in case.
At least you don't need to fake a break event anymore
how much it can costs to ask some1 to make it?
like 5$ or 50$?
Depends on who is making it
lol
Depends on the quality. You easily could get it made for either pricetag
Iโll do it for 150$
no ty
Although yes, it also depends on who makes it
It isn't super duper hard, it just requires you to have a little bit of minecraft-specific knowledge
could i make it with 0 experience with it
i mean, depending on how you do the mining thing it can be done quite quickly
pickaxe probs yes, chestplate probs not imo
Settings attributes and doing stuff with the PDC should be the most challenging task
13$ and it will work?
'it will work' is not something you utter in it
For me it regularly works on the 1st try, but there are a few bugs that I only uncover months afterwards
Well most of my code works on the first try, itโs just the middle parts of the code that sometimes messes up. Breaking everything
can this make custom items?
half my bugs are typos anyway lol
If you never find the bugs then do they really exist
True
I mean, noone will report them so I guess /shrug
i need an java dev to make custom items right?
not necessarily
well, it depends how much pain you want to put yourself through
With a k
do i need this: https://mcstacker.net/
๐คฎ
i found it in some tutorials
Tom
yes?
We donโt do much the vanilla way here
yea we do it through four different layers of api :kekw:
that means
But sure you can use it though to get ur custom items
hmm okay
Anyone know anything (or a place where I could find documentation for) about the automatic saves that servers do?
welllll no
Hush
4 apis?
the way it works is that some people took vanilla and made modifications to it
that gives you bukkit
then some people thought 'we can do better but this is a nice starting point' and did the same thing to bukkit, resulting in spigot
people did the same thing again to spigot, resulting in paper
and then they did it again to spigot to create a multi-threaded executable named folia
Specifically, Iโd like to be able to save a list of blockstates between restarts
so bukkit paper spigot and folia?
i never heard of foila
Folia is not for you Tom
uh
time like 1 year 2 years ...
java? 10 years
skill? about 3 years
*paper
?whereami
Iโd like to be able to destroy blocks in an explosion, have the server autosave, and then regenerate them after a server crash
Fail
?xy
Asking about your attempted solution rather than your actual problem
is tehre an spigotapi i only heard of paper api
well yea i put a \ in front of it
and are the 2 different?
Please donโt xy me when I am correct
api is just what we use to 'talk' to the server
lord I'd hope so ๐ฅฒ
What the fuck is a spigot
A tap for dispensing a fluid
its the thing in the wall
Coll with his midlife crisis
so if i wanna learn plugin makeing i have to learn spigot or paper api?
ah true
Learn Java
kotlin
im doing it rn
Good
I recommend java so that you know what kotlin is doing once you use it
Gj
but waht i have learn to make plugins
What about Scala
mostly overrides lol
paper api?
er well, no
if you wanna learn about paper and it's api this is not the place
i wanna make plugins
Anyone got any ideas for this
Or resources
idc how
like i mentioned above, an api is just the thing between what you make and what the server does with it
it provides easy access
I have literally made worldedit schematics of the destroyed areas
But that seems
Inefficient
so with normal java i cant make plugins what i need to do it
so what you learn is not a specific api, but how to make use of apis in general
Well you can convert a block into a string that has its entire state
hmm why am i getting this error (Im using mojang mappings):
at me.outspending.biomestest.registry.BiomeResourceKey.<init>(BiomeResourceKey.java:16) ~[Biomes-Test-1.0-SNAPSHOT-dev-all.jar:?]
at me.outspending.biomestest.Main.onLoad(Main.java:16) ~[Biomes-Test-1.0-SNAPSHOT-dev-all.jar:?]
at io.papermc.paper.plugin.storage.ServerPluginProviderStorage.processProvided(ServerPluginProviderStorage.java:59) ~[purpur-1.20.2.jar:git-Purpur-2095]
at io.papermc.paper.plugin.storage.ServerPluginProviderStorage.processProvided(ServerPluginProviderStorage.java:18) ~[purpur-1.20.2.jar:git-Purpur-2095]
at io.papermc.paper.plugin.storage.SimpleProviderStorage.enter(SimpleProviderStorage.java:39) ~[purpur-1.20.2.jar:git-Purpur-2095]
at io.papermc.paper.plugin.entrypoint.LaunchEntryPointHandler.enter(LaunchEntryPointHandler.java:36) ~[purpur-1.20.2.jar:git-Purpur-2095]
at org.bukkit.craftbukkit.v1_20_R2.CraftServer.loadPlugins(CraftServer.java:528) ~[purpur-1.20.2.jar:git-Purpur-2095]
at net.minecraft.server.dedicated.DedicatedServer.initServer(DedicatedServer.java:310) ~[purpur-1.20.2.jar:git-Purpur-2095]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1102) ~[purpur-1.20.2.jar:git-Purpur-2095]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:320) ~[purpur-1.20.2.jar:git-Purpur-2095]
at java.lang.Thread.run(Thread.java:840) ~[?:?]
Caused by: java.lang.ClassNotFoundException: net.minecraft.resources.ResourceLocation
at org.bukkit.plugin.java.PluginClassLoader.loadClass0(PluginClassLoader.java:199) ~[purpur-api-1.20.2-R0.1-SNAPSHOT.jar:?]
at org.bukkit.plugin.java.PluginClassLoader.loadClass(PluginClassLoader.java:166) ~[purpur-api-1.20.2-R0.1-SNAPSHOT.jar:?]
at java.lang.ClassLoader.loadClass(ClassLoader.java:525) ~[?:?]
... 11 more
I wish I could just serialize blockstates ugh
plugins work by using a small piece of code provided by the api to 'hook' themselves into the server
But that wonโt have tile-entity data
What!
When was this
Oh
Yeah
I need both
@Getter
public final class BiomeResourceKey {
private final ResourceLocation resourceLocation;
public BiomeResourceKey(@NotNull String key, @NotNull String name) {
this.resourceLocation = new ResourceLocation(key.toLowerCase(), name.toLowerCase());
}
}```
hmm i dont rlly understand i can select what plugin iwanna make spigot or paper
what i have to select
Paper
no
paper is faster
Ultimately it doesnโt matter too much tho
Paper isnโt that much better than spigot
Itโs like 10% better
i personally use purpur but
wdym ,,better,,
Saves better dances better jumps better sings better
Iโll change my mind if you can fix my coding problem @clear elm
but is it in general the same to code?
Yes they all take Java plugins
bro i started learrning java 1 week ago
Argh
paper or spigot gives more
paper right?
Paper
and how can i learn paper api
ik ik first learn normal java how to learn paper api than
and how to learn spigot after this
can u send
No
No
.
You should learn by doing
Heโs wrong
Code a simple plugin that like
Just says a word
If idk how
If you donโt know any Java, learn Java
I only know system.out.println
We donโt want to be your teachers when you stumble upon simple issues a java course could have taught you. ๐ฅฒ
I wouldnโt avoid it
Ig I watch some plugin make tutos on yt
๐ด
Also learning one step at a time is important
Probably
Like start with something really simple
I do think doing is the best teacher though
Yeah something without Spigot
what is "normal java"
Start with the basics then you can move to Spigot
@carmine mica console
Weโll start with either I guess lol
Take your pick
I started coding with spigot, never did any Java beforehand, and I was fine
reveals that his face is half melted off
so i've been trying to make the player use /config but it won't appear can someone see if i did something wrong? https://paste.md-5.net/uxuxobelut.java
๐
Many of us have made that mistake
You have half your face melted off, too?
Any errors?
no the /config won't appear let me show ya the command section for it
Also you're registering the executor twice
32 & 38
can that cause an issue?
Depends on how your command code works
ah i see what about making custom join sound do you maybe know anything of that?
There's an add to faction command that gets called when players join, and also when a player creates. I want to implement additional things if it's the case where a player is creating and then joining (like adding them as a leader, giving special perm levels, etc)
Should I add another parameter to the addToFaction() to check if it's a join or create, or make an entirely different special add function for the case of a faction creation?
does someone know how ould i fix this ?
[00:38:06 ERROR]: Error occurred while enabling LiquidREST v0.1.0 (Is it up to date?)
java.lang.IncompatibleClassChangeError: Class org.eclipse.jetty.util.ArrayTernaryTrie$Growing does not implement the requested interface org.eclipse.jetty.util.Index$Mutable
at org.eclipse.jetty.webapp.ClassMatcher$ByPackage.add(ClassMatcher.java:223) ~[LiquidREST-0.1-all.jar:?]
at org.eclipse.jetty.webapp.ClassMatcher$ByPackageOrName.add(ClassMatcher.java:314) ~[LiquidREST-0.1-all.jar:?]
at org.eclipse.jetty.webapp.ClassMatcher$ByPackageOrName.add(ClassMatcher.java:286) ~[LiquidREST-0.1-all.jar:?]
at org.eclipse.jetty.util.IncludeExcludeSet.include(IncludeExcludeSet.java:131) ~[journeymap:?]
at org.eclipse.jetty.webapp.ClassMatcher.add(ClassMatcher.java:596) ~[LiquidREST-0.1-all.jar:?]
at org.eclipse.jetty.webapp.ClassMatcher.add(ClassMatcher.java:566) ~[LiquidREST-0.1-all.jar:?]
at org.eclipse.jetty.webapp.ClassMatcher.add(ClassMatcher.java:71) ~[LiquidREST-0.1-all.jar:?]
at java.util.AbstractCollection.addAll(AbstractCollection.java:336) ~[?:?]
at org.eclipse.jetty.webapp.ClassMatcher.addAll(ClassMatcher.java:680) ~[LiquidREST-0.1-all.jar:?]
at org.eclipse.jetty.webapp.ClassMatcher.setAll(ClassMatcher.java:671) ~[LiquidREST-0.1-all.jar:?]
at org.eclipse.jetty.webapp.ClassMatcher.<init>(ClassMatcher.java:517) ~[LiquidREST-0.1-all.jar:?]
at org.eclipse.jetty.webapp.WebAppContext.<clinit>(WebAppContext.java:171) ~[LiquidREST-0.1-all.jar:?]
at wtf.justmammtlol.plugins.LiquidREST.Rest.start(Rest.java:28) ~[LiquidREST-0.1-all.jar:?]
at wtf.justmammtlol.plugins.LiquidREST.LiquidREST.setupWebServer(LiquidREST.java:46) ~[LiquidREST-0.1-all.jar:?]
at wtf.justmammtlol.plugins.LiquidREST.LiquidREST.onEnable(LiquidREST.java:85) ~[LiquidREST-0.1-all.jar:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:273) ~[forge:?]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:335) ~[forge:?]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:479) ~[forge:?]
at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugin(CraftServer.java:502) ~[forge:7e29f765-296df566-9fb885e8]
at org.bukkit.craftbukkit.v1_16_R3.CraftServer.enablePlugins(CraftServer.java:414) ~[forge:7e29f765-296df566-9fb885e8]
at net.minecraft.server.MinecraftServer.func_240787_a_(MinecraftServer.java:427) ~[?:?]
at net.minecraft.server.MinecraftServer.func_240800_l__(MinecraftServer.java:347) ~[?:?]
at net.minecraft.server.dedicated.DedicatedServer.func_71197_b(DedicatedServer.java:227) ~[?:?]
at net.minecraft.server.MinecraftServer.func_240802_v_(MinecraftServer.java:768) ~[?:?]
at net.minecraft.server.MinecraftServer.func_240783_a_(MinecraftServer.java:267) ~[?:?]
at java.lang.Thread.run(Thread.java:840) ~[?:?]
[00:38:06 INFO]: [LiquidREST] Disabling LiquidREST v0.1.0
[00:38:06 INFO]: Disabled LiquidREST```
Hello! I'm "beginner" and the spaces and # go away when the config load on the server, can semeone help me ? Ty
Make sure to not save the config, that gets rid of the comments
Not in modern spigot
Olivo is right, learn the basics of oop, then learn the basics of java, then go and try APIs such as Spigot, or if you want to go to a next level, Spring (don't, just use node or smth)
You could use BoostedYAML for configs, they are much easier to set up and you can put comments in the config.
Or just use spigots api for it
since they do provide api for it which calls snakeyaml, which on its own hand does support comments nonetheless :D
how amazing
ill believe you when you can give me an answer to my earlier question ;p
ur corpse after im done with u
elaborate
Shove the block into one of Mojangs NBT serializers are store the output
so, find this mojang nbt serializer, use that on the nbt data, and save the block type
then just set the block type and deserialize the nbt data onto it?
Yes
You can probably pass the entire block into the serializer
Convert it into snbt or somethin
If not then just the tile entity
@quaint mantle the tick api got merged
You'll believe me when you notice the code of the plugin is against all the java conventions and is the worst optimized
Anyway, which was the question?
Too lazy to scroll up
@quaint mantle
"Hello everyone.
I would like some advice on how to save blocks.
I have a plugin I have designed which blows blocks up in a sphere (replaces them with air, spawns falling blocks that go flying everywhere, the whole shebang), and saves a worldedit schematic of the area to a folder just before the explosion happens. This schematic is then used to regenerate the area some time later. This works very well because, even in the event of a crash after an autosave has transpired, my plugin scans through a folder where all the schematics are stored and uses their file names (in which Iโve stored location information) to place those schematics in the world and thus fill the holes left by the explosions.
However, I have a nagging suspicion that this is a shit way of doing this. My worldedit system is even just saving a cube of terrain containing the explosion, and doesnโt even save a sphere or some smaller unit of space!
Do you have any suggestions for how I can duplicate this functionality in a way that is faster and better for my server?
Any thoughts would be appreciated, please and thank you"
I was making a minigame plugin, and I made my own schematic system to make arenas.
I just stored the block position, its type and its serialized NBT data (which the spigot API allows you to load later)
You could just do that (I'm not a very fan of WE, but I think WE just does the same with the difference it allows you only to store squares and polygons)
You will need to store those blocks in a file (in my case json)
Then you can read that json later and load the data
{
"blocks": [
{
"world": "<uuid>",
"x": 0,
"y": 0,
"z": 0,
"nbt": "AAA=",
"type": "SOMETHING"
}
]
}
You can ignore storing AIR blocks
Again, if you choose to store your own "schematic" file, you can make it so you store the blocks you want, and not every block (and entity) in the area
Because I think WE schematics also store entities
ugh
JsonArray array = new JsonArray (); //Using google gson
for () {... /*iterate on the blocks in the sphere areea*/
JsonObject object = new JsonObject();
Block block = /*current block in the spherical radius*/;
Material type = block.getType();
if (type.isAir()) continue;
object.addProperty("world", block.getWorld().getUID());
object.addProperty("x", block.getX());
//Same for Y and Z
object.addProperty("nbt", Base64.getEncoder().encodeToString(block.getBlockData().getAsString().getBytes())); //Store block data in base64
object.addProperty("type", type.name());
array.add(object);
} //end for
Np
okay FINE he was right all along
learn oop, then c, and then daisy, and only then can you learn java
You can skip C and daisy part
I would also recommend you to learn a bit about clean code
It will help you
yeah my code is super messy
also
@quaint mantle ill take a crack at this and get back to you if there are more question if that's okay, haven't used encoders and the lik ebefore
or
np, but I'm going to sleep rn, so I will probably answer later
lmao
https://www.baeldung.com/gson-save-file
I used to use this guide when I didn't even know what Json was
hm
i think i wont store it
like you said though
i think i'll probably store it in a database
probably
but obviously, i will still encode it into a string first
hm
First of all, make you this question "Do you really need a database"?
If you can store it in a single file, you don't
actually, it occurs to me this wont work for tile entities, since blockdata doesnt include the tile entity
You can modify the code I've write to include entities
Again, I recommend you to start learning the basics of oop, then you can go straight to the basics of java
eurgh
this actually means i need to figure out how to merge a block and a tile entity
No, that means you need to figure out, how to modify the code I've write to allow also entities
no, i mean for placing
the blocks
that is easy
the thing you just said
the placing of the blocks will be hard
modifying your code is as easy as
Oh, the gson library allows you to iterate through the elements of the json array
You can read the values you need
for (JsonElement element : array) {
if (!element.isJsonObject()) continue;
JsonObject object = element.getAsJsonObject();
String worldUUIDRaw = object.getAsString("world");
UUID worldUID;
try {
worldUID = UUID.fromString(worldUUIDRaw);
} catch (IllegalArgumentException ex) {
//This means the "world" value is not a world UID
continue;
}
World world = Bukkit.getWorld(worldUID);
if (world == null) continue; //That means the world is not loaded or does not exist
int x = object.getAsInt("x");
//... the rest here
}
just do this
but with the current unhidden nms
probably
if only i knew what a_ mapped to
Avoid using NMS and OCB
hm
@quaint mantle storebukkitvalues and readbukkitvalues perhaps
they both use a compound nbt
ill test tomorrow i suppose
is it possible to register custom items?
like I can get my custom items with /give command
so the command will be like this: /give @p PLUGIN:ITEM
are you saving the items anywhere?
like a list or anything
You could intercept the PlayerCommandPreprocessEvent, and then check if it's the /give command and give the item if the player requested it.
Pretty sure it does something called "completeExceptionally"
But using a try catch would probably solve the issue
Show us the code you're using if this doesn't help
thanks
I'm not used to intelij, but google works ๐
how do I make so when you try to break a block then it says the block to you ```
@EventHandler
public void onBlockDamage(BlockDamageEvent e) {
e.getPlayer().sendMessage("e.getBlock()");
e.setCancelled(true);
}```
do you know java
?paste
you are close but your java is lacking
help please I am trying to learn
remove " and " then add .getType()
"and"?
remove both "
"e.getPlayer().sendMessage("e.getBlock()");
e.setCancelled(true);" ?
do you also not understand what remove means?
yes but should I remove these?
you didn;t remove, you added
now Im confused should I remove them from the code? (the lines)
where should I add .getType()
I really can't tell you any other way
I don't understand whether not I should remove something or add something and if add something then where
if a host refuses to add a flag -Dpaper.useLegacyPluginLoading=true is there another easy way to fix this issue
Circular plugin loading detected!
MythicMobs -> Multiverse-Core -> SuperiorSkyblock2 -> ShopGUIPlus -> ExecutableItems -> SCore -> MythicMobs
?fork
SpigotMC maintains the Spigot server. If you are using a fork of Spigot (such as Paper, Airplane, Purpur, or other derivative works), you should seek support in the appropriate Discord servers.
but it's reflection, it shouldn't need remapping ```public static Class<?> getNMSClass(@Nullable String packageName, @Nonnull String name) {
if (packageName != null && supports(17)) name = packageName + '.' + name;
try {
return Class.forName(NMS_PACKAGE + name);
} catch (ClassNotFoundException ex) {
throw new RuntimeException(ex);
}
}```
Class<?> serverEntity = getNMSClass("server.level", "ServerEntity");
Your coding Mojang mappings but server is not mapped that way
how do i fix this?
For reflections you need to use the obfuscated mappings
so do i need to change the name of the class to the obfuscated one?
And it looks like you are not caching your reflective Objects.
This can cause serious performance issues as reflections tend to be pretty slow.
Hi , i have a question , what would be the best way to make a hologram chest system what i mean by that is :
- when a user click on a chest [after game start and he spawned] , it will open the chest and create hologram
- that hologram will have a timer .
- would i need to create a runnable for each chest clicked?
this is my current code , didn't finish it
this is the impl of the update && create hologram
i just want to know what will be best , to create a seprate runnable for each chest opned?
or make a 1 runnable with a list , and when a user click on that chest add it , and check in the runnable if the chest is there or no . ?
Create one runnable which ticks all holograms.
with a list , and when user click on the chest , add it to the list and check it in the Runnable right?
does anyone have EnumPlayerInfoAction translated to non-gibberish?
in ClientboundPlayerInfoUpdatePacket
I personally would add this as part of my hologram API as ticking holograms
is needed quite often.
Do you mean an explanation for each entry?
Yes. My answer doesnt change. I would personally add ticking holograms as part of my hologram API.
I mean I only found this
so there's no info on previous versions
Just look at the protocol for earlier versions ๐
๐ค
i already have the hologram part done , with nms for each version
oh thanks
the Holo Manager Looks like this :
and this is how theHolo Looks like :
anything else i need to implmement?
Nice. Then you just need to add a bit more logic and create a UpdatedHologram with an
public abstract void update();
public abstract int getUpdateDelayTicks();
In your HologramManager you simply check if your hologram is an instance of UpdatedHologram
and add it somewhere to be ticked.
Just make sure to remove it again, when the HologramManager removes the Hologram.
You could also write this without abstraction and simply have two fields like
private final Consumer<Hologram> updateAction;
private final int updateTickDelay;
@twin venture
I don't think you were supposed to ping me
Woops
Thanks!
public Holo createUpdatedHologram(String name, Location location, int tickDelay, Consumer<Hologram> action) {
}
That could be one method of your manager for example.
But there are quite a few other approaches as well ๐
PS: Cooldowns should not be done by bukkit runnables. Timestamps should be preferred and the runnable just checks how
far the timestamp is away from the current time.
alright thanks . i will try to finish it today
Hello, Im kind of stuck here, i want to make my player not be able to join two queues at the same time but they still can even though my code doesnt allow it? Here is my code: ```public void onPlayerClickSign(PlayerInteractEvent event) {
Player player = event.getPlayer();
if (event.getClickedBlock() != null && isSign(event.getClickedBlock().getType())) {
Sign sign = (Sign) event.getClickedBlock().getState();
if (event.getAction() == Action.RIGHT_CLICK_BLOCK) {
handleRightClick(sign, player);
} else if (event.getAction() == Action.LEFT_CLICK_BLOCK) {
handleLeftClick(sign, player);
}
}
}
private boolean isSign(Material material) {
return material == Material.OAK_SIGN || material == Material.OAK_HANGING_SIGN || material == Material.OAK_WALL_SIGN;
}
private void handleRightClick(Sign sign, Player player) {
String signKey = getSignKey(sign.getLocation());
removeFromQueue(player);
setSignLine(sign, LIGHT_PURPLE + "Crystal 1/2");
playerQueueMap.put(player.getName(), signKey);
player.sendMessage("Joined the current queue. Current queue: 1");
}
private void handleLeftClick(Sign sign, Player player) {
removeFromQueue(player);
setSignLine(sign, GREEN + "Crystal 0/2");
player.sendMessage("Left the current queue. Current queue: 0");
}
private void removeFromQueue(Player player) {
String oldQueue = playerQueueMap.get(player.getName());
if (oldQueue != null) {
playerQueueMap.remove(player.getName());
}
}
private void setSignLine(Sign sign, String line) {
sign.setLine(0, line);
sign.update();
}
private String getSignKey(Location location) {
return location.getWorld().getName() + ":" + location.getBlockX() + "," + location.getBlockY() + "," + location.getBlockZ();```
I cant seem to find whats incorrect...
Whats the type of playerQueueMap?
Its a Map<String, String>
What kind?
Are you sure the player is in 2 queues simultaneously and it's not due to something else
Because that's not possible
hmmmm thats weird...
You have one map and put overrides the entry for key k
So you don't even need to remove the player, you can simply just do playerQueueMap.put
Ok so this
private void removeFromQueue(Player player) {
String oldQueue = playerQueueMap.get(player.getName());
if (oldQueue != null) {
playerQueueMap.remove(player.getName());
}
}
Does exactly the same as this
private void removeFromQueue(Player player) {
playerQueueMap.remove(player.getName());
}
You can just replace the method.
Next: You cant put the same key in a map twice.
If you add the same key, then the old key:value pair is simply overridden.
Which means
private void handleRightClick(Sign sign, Player player) {
String signKey = getSignKey(sign.getLocation());
removeFromQueue(player); // This line is useless because put always overrides
setSignLine(sign, LIGHT_PURPLE + "Crystal 1/2");
playerQueueMap.put(player.getName(), signKey);
player.sendMessage("Joined the current queue. Current queue: 1");
}
Oh okay thank you so much imma look into it ๐ Thanks
Yeah this
The thing is the way your sign works is probably the issue
@tribal rivet
You update it manually on a click, but not in removeFromQueue
So if a player joins a second queue you override the map, but don't update the queue sign of the queue that the player left
What you can do is extend your removeFromQueue and keep it as is, you simply force a sign update on removal
Okay thanks have a great day
Can someone tell me how to get all LOG** type (OAK, BRICH, JUNGLE, ect.)?
I tired using Material.LOG and returns Error "Cannot resolve symbol 'LOG'
how can i register a command from another file that is not my main file like in commands/gamemode
Operator '==' cannot be applied to 'org.bukkit.@org.jetbrains.annotations.NotNull Material', 'org.bukkit.Tag<org.bukkit.Material>'
What?
heppp
Well at the very least it probably is a different nest unit
package atlasrs.realisticsurvival;
import org.bukkit.Tag;
import org.bukkit.block.Block;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.Listener;
import org.jetbrains.annotations.NotNull;
import java.util.Objects;
public class TreeBreakingLogic {
public void breakTrees(PlayerInteractEvent event) {
Block block = event.getClickedBlock();
if (block.getType() == Tag.LOGS) {
}
}
}
retruns error "Operator '==' cannot be applied to 'org.bukkit.@org.jetbrains.annotations.NotNull Material', 'org.bukkit.Tag<org.bukkit.Material>'"
can someone help me?
read the javadoc on Tag
that is not how you use it
declaration: package: org.bukkit, interface: Tag
Tag.LOGS.contains(block.getType()) is likely the right method, but your IDE should help you out there
Spoiler: Actually it isn't the right method. But the idea remains the same
public class TreeBreakingLogic {
public void breakTrees(PlayerInteractEvent event) {
Block block = event.getClickedBlock();
assert block != null;
if (Tag.LOGS.getValues().contains(block.getType())) {
return;
}
}
}
I figured it out, maybe like this lol
I am new to Java so yeah
The proper approach would be .isTagged(), but it is the same
doesn't exist ๐
In that case some advice: The equality operator == is used to compare whether two values are identical to each other. Two different objects will never be identic to each other, hence the compiler complains about your use
Javadoc (and your IDE's suggestions) is your best friend for the very first months. After that you will start to build up a feel on how methods might be named, but as you just saw even then guessing is not very reliable
Are entity IDs used only in networking?
pretty much i think
Makes sense ig
Anyone know why "findSafeDismountLocation" is null none of the values โโused are null
@Override
public Location getSafeLocation(Player player) {
ServerPlayer entityPlayer = ((CraftPlayer) player).getHandle();
ServerLevel serverLevel = entityPlayer.serverLevel();
BlockPos blockPos = new BlockPos(entityPlayer.getBlockY(), entityPlayer.getBlockX(), entityPlayer.getBlockZ());
Log.info("entityPlayer: " + entityPlayer);
Log.info("serverLevel: " + serverLevel);
Log.info("blockPos: " + blockPos);
Vec3 vec3 = DismountHelper.findSafeDismountLocation(EntityType.PLAYER, serverLevel, blockPos, true);
if (vec3 != null) {
Location location = new Location(player.getWorld(), vec3.x, vec3.y, vec3.z);
Log.info("location: " + location);
return location;
}
return null;
}```
Console:
```cmd
[INFO]: entityPlayer: EntityPlayer['wilmer100101'/135, l='ServerLevel[world]', x=24.18, y=103.74, z=-28.81](wilmer100101 at 24.181414046555776,103.73580524503404,-28.810632492203087)
[INFO]: serverLevel: ServerLevel[world]
[INFO]: blockPos: BlockPosition{x=103, y=24, z=-29}
In the class "Structure" what does the "palette" mean in the "place" function?
place(Location location, boolean includeEntities, StructureRotation structureRotation, Mirror mirror, int palette, float integrity, Random random)
and also what does integrity mean
Hey,
in which class is the "Player" Interface implemented? Because I want to extend the class to add custom Methods to the implemented Player class.
declaration: package: org.bukkit.structure, interface: Structure
public interface Player
extends HumanEntity, Conversable, OfflinePlayer, PluginMessageRecipient
Ah okay, thank you
oops forgot that the javadoc also included that
Okay, thanks for the advice
If I use the md_5 plugin in my pom.xml for nms, one then takes and makes a new NMS version for each new version of minecraft, so: 1.17, 1.18, 1.19, 1.20. Or do you do it for every subversion, example, 1.20.1, 1.20.2, 1.20.3 or how does it work?
every nms version you want to support would have its own module
So one module per subversion then?
yup
But why do plugins usually change to have 1_20_R3, 1_19_R2, etc.? Does it only support subversion 3 or 2 then?
it depends onwhat the nms version covers