#help-development
1 messages · Page 1191 of 1
no
can i prevent block particles like cherry tree leaves
Like when breaking blocks? No. Those are spawned on the client. The amount of bandwidth that would be required for the server to send those particles to the client is crazy
I have enough
Send more packets 
Also just realized you gave a specific example of cherry tree leaves. I assume you mean the ambient ones. Similar to the spore blossom. Those also are client-sided for the same reason. Lots of bandwidth (and really the server doesn't need to know about that tbh)
DDOS via Cherry Blossom Particle 💀 xD
That would be crazy
do you guys know why this isn't working?
public void onShootArrow(EntityShootBowEvent event) {
if (event.getProjectile() instanceof Arrow) {
event.getEntity().sendMessage("Shot an arrow");
event.getProjectile().setMetadata("pickup", new FixedMetadataValue(SiegePlugin.plugin, 2));
}
}```
It seems to set the data properly if I get it right after that, so maybe it's being reset? but how?
What version are you on?
1.20.4
Attach PDC tags instead
does this let you change nbt on the item?
no
thats what I need to do
no?
you just need to attach data
which is exactly what the PDC does
it just doesn't allow you to edit NBT directly
The metadata API does not change the nbt tag
e.g. you cannot use this to edit like the display name
If you want to change the pickup status there's api methods for that https://hub.spigotmc.org/javadocs/spigot/org/bukkit/entity/AbstractArrow.html#setPickupStatus(org.bukkit.entity.AbstractArrow.PickupStatus)
declaration: package: org.bukkit.entity, interface: AbstractArrow
oh cool, I will just use that thanks
Question; I am making /msg and /reply to chat in private messages. I am able to do /msg but i cant do /reply, it always says theres no one to reply to. I have my classes here, maybe its backwards?? https://paste.md-5.net/zezewudobe.java
Spigot has a conversation API you can use
Explain please
Actually might no be very relevant if all you want is commands
Yeah the conversations API is for something completely different 😅
Yeah I missremembered 😓
You have your values flipped in /msg
Sounds like more of a bug that it didn't before
Not sure about cancelling it though
can someone help me figure out what to add to my plugin? or does it need anything else? https://github.com/literal-gargoyle/get
plugin.msgRequester(target.getUniqueId(), player.getUniqueId()); flip these two?
you don't need to include target/ in the repo
allow the user to change the hastebin url
I would put it behind a permission
also /get is vague and doesn't tell the user what it does
If you want something to do, add the reverse: safely get and serialize the item back from pastebins
i see thnx, i used the wrong method name ur right on that too
is there any way to apply item components like consumable without NMS in 1.21.4?
Not all of them but some
declaration: package: org.bukkit.inventory.meta, interface: ItemMeta
Hi, why boolean isEmpty() from player.getNearbyEntities() doesn't work? Help me, please.
Theoretically player shouldn't be an entity from nearby entities?
Wouldn't suprise me if it was
hi all
Player will be included there
i need some help with a slab i made custom slab i want it to grow crops and have snow but i dont know what the code is
Is it? Ok, thanks, I'll test my thing later.
I think there is a event, that is checking is player or entity on slab. You can check it through an event and make logic there. I'm a weak coder, but that's how I would make.
Maybe it's PlayerMoveEvent
has someone encountered this kind of problem? https://prnt.sc/kUtRLlKIGM1V https://prnt.sc/6_6d87Ptf9e8
I try to open a server.jar (spigot 1.8.8, linux ubuntu) using java 11 but there are many errors in the console and it does not create any server files also
have u tried running with java 8 instead of 11
on the same server there is another 1.8.8 spigot server running with java 11
idk why it does not work with in this case
just try with java 8
how can i make my custom entity target players of a specific condition, for example, if they are in one of my built in factions?
using goals
you could create or extend a target
or if a normal entity, you'd just add your condition on the EntityTargetEvent I guess
do u have any examples
also im not sure why but when i try to get the world of said Location to save on server shutdown, it returns as null
context is that this location represents the "home" of a faction aka where /f home will take you to, and it works as intended but when i try to debug and print it out when i am saving, it returns as null, not a World UUID
public Kingdom(String name, UUID leader, Location home) {
this.name = name;
this.description = "";
this.open = false;
this.leader = leader;
this.ID = UUID.randomUUID(); // Change this later when we save kingdoms
this.members = new HashSet<>();
this.home = home;
Constructor sample
where is this location being created
i want to watch some one code a coustem item plugin so i could gain knowledge
i want to know when what class to use in spigot class
i have so many doubts any proffetional is hear
plz some one make me as a coding friend
ermmm
ok so on the actual kingdom creation the player's location is passed in as well to set the default spawnpoint of the kingdom
and that's what i save as a variable
instance variable per kingdom
but when i try to save that location to the DB, the coordinates save but the world UID does not it returns null
i do have a theory, could it be that by the time i'm saving (on plugin shutdown) you cant access the world UID anymore? That would make a bit more sense but it's weird because I can still access the X Y Z coords
ie
statement.setString(9, Objects.requireNonNull(kingdom.getHome().getWorld()).getUID().toString());
statement.setInt(10, kingdom.getHome().getBlockX());
statement.setInt(11, kingdom.getHome().getBlockY());
statement.setInt(12, kingdom.getHome().getBlockZ());
well at this point i'm trying to save it to db
on plugin shutdown
You mean onDisable ?
between the ,getUID().toString());
no, they got it right
hmm
@smoky anchor it's not an async thing since it blocks before server shutdown is complete and everything else saves
@smoky anchor can we chat in personal i have some doubts about this code
i was debugging in game and when i print the world UID of the kingdom home while the server is loaded, it returns the intended UID
I don't do DMs
We can chat here
thoughts? i think it's litearlly just cuz it happens on shutdown logic
@Override
public void onDisable() {
// Plugin shutdown logic
Bukkit.getLogger().info(ChatColor.RED + "Disabled " + this.getName());
DatabaseUtils.saveAll();
if (databaseManager != null) {
databaseManager.disconnect();
}
Bukkit.getScheduler().cancelTasks(this);
}
Objects.requireNonNull simply throws null if the argument is null
otherwise it returns the argument
so we can basically ignore it, in which case that line of code is kingdom.getHome().getWorld().getUID().toString()
Which is correct
within saveall's scope is where we call the getWorld.getUID()
my mind is blowing i am new to spigot boooom
is the onDisable event happening too late, ie after the world is gone already?
Ye, I don't think I can help with this
My only thought is that the world unloads before you save the location
Which you can get around by just storing the raw data of the location, xyz & world uuid
I don't think it should
then i suppose i could just fix this by storing the UID as its own variable for the home world
so we wont be getting it directly from the Location
Is it a vanilla world, like overworld/nether ?
Do you use multiverse or manage the world yourself ?
it just gets the world ID of the kingdom's home, it could be anywhere
overworld
by the way where can i learn spigot plz can anyone tell me i wanna learn i watch several youtube videos but they dont tell me when to use a specfic class and its function in spigot i have some trouble with this
and use chatgpt too if you want, it helps with common questions. Take care in using it to generate entire code but using it to generate snippets for examples is fine
ok thanks
A lot of development is just flicking through forums to see what others have done
or reading the docs
i am asking some one to code and i will watch their code and learn something is it usefull
like some one building a project
like a coustem item plugine
the thing is i know java i am expert in it but i need alll the classes list
ok i feel like something's off in my actual constructor for my Location
Provided x y z and world UUID, how do you make a new Location object?
oh shoot i got it
i get it now
Location requires a World Object so Bukkit.getWorld(id) and pass to Location constructor
the getWorld I was referencing was taking in a String because I never casted my home_world_id back to a UUID that it's supposed to be
it all makes sense now omg
what a debugging victory
Location home = new Location(
Bukkit.getWorld(UUID.fromString(resultSet.getString("home_world_id"))),
resultSet.getInt("home_x"),
resultSet.getInt("home_y"),
resultSet.getInt("home_z")
);
this works now
How come I get a cannot find symbol error for getString in this context, I am trying to update a plugin from 1.20.1 to 1.21.1
public static String getItemName(ItemStack head){ try{ Object refItemStack = MinecraftReflection.getMinecraftItemStack(head); return LocaleLanguage.a().a(((net.minecraft.world.item.ItemStack) refItemStack).y().getString()); } catch (ClassCastException e) { e.printStackTrace(); return ""; } }
Update nms version in your pom or gradle build script
^
why not use mapped?
Can I make my primary key a group of things to check against? kind of like a custom .equals checking for X Y Z to match
INSERT OR UPDATE?
interesting, minecraft spells bassdrum wrong
what exactly are you trying to do
thats an XY issue
Just have a unique composite key
yeah i did that
it's all fixed prob shouldve mentioned
all i needed to do was make a composite key bundling the differentiating things together
on the other hand
UUID fromKingdomUUID = kingdomManager.getKingdomByChunk(fromChunk);
UUID toKingdomUUID = kingdomManager.getKingdomByChunk(toChunk);
Bukkit.getLogger().info("fromKingdomUUID: " + fromKingdomUUID);
Bukkit.getLogger().info("toKingdomUUID: " + toKingdomUUID);
if (fromKingdomUUID != toKingdomUUID) {
.............
this isn't correct equality checking for two UUIDS, but what would it actually check for?
use .equals
yus of course
== checks for reference equality
ye
neato
based rum
Interesting. I'd always thought it was base drum. So I've been wrong for a long time
saying its having any impact on gameplay is just wrong
It’s annoying tf outta me because I have to have a random ass if statement in my code for this bs lol
wdym
mc is full of that shit anyways
just look at the advancement names, they are all very unintuitive and different from the english translation
More so that the bukkit name is spelled correctly so I cant just do .name() on the enum
thats more of a bukkit issue then xD
i just wish there was like a method that converts it from a namespace or whatever into the enum constant
They don’t have namespaces for note block instruments iirc
It’s also an enum internally
did item#setCustomModelData change with 1.21.4?
seems like my model stuff is broken
and I see they documented a couple of things about it but I don't see a change in the api
Idk if the api has been updated
Yes, custom models are now incredibly powerful.
Now you can make them even without any conflicts.
In fact, you don't need CMD if you want only a simple model, just change the item_model component on an item
how do you avoid conflicts and how are yo usupposed to tell clients which model to use in the first place
yes
yes!
Item components are neat
Dude, read the changelog for this.
I only got around to the changelog today
You can have different model on item based on real time
Using composite, you can have any angle you want (there is a blockbench plugin by Godlander to auto generate the model definitions)
Custom tinting
Many more.
ok so through the api what sets that item_model field?
setItemModel
so the old way of having multiple numbers in the resource pack for, say, diamond swords is completely deprecated?
You can still do something similar, but why
just trying to figure out backwards compatibility
that is non-existant
just adds pointless complexity, simply update to latest :)
when was this changed, 1.21.4 only?
use poisonous potato, remove the food/consumable components
add custom components
idk about the RP, I think like this you would need one model file and one item model definition file (which would simply refer to the model, if you don't have any fancy logic/tints/idk)
(this item specifically, without the food/consumable components, does not do anything, is not used anywhere, nobody wants to trade it or anything, it's a perfect "dummy" item)
Damn, mojang really is cooking
why would you use a poisonous potato
-# read message below
that's an interactable item
You can remove the components and it will not be
has crafting recipe
you'd have to remove those or make an event to check for your custom item to not craft
yes you can ?
all it does is check for the item type
recipes don't care about components
you can use the popped chorus fruit to craft the blocks
ohh you meant that
ye, my bad, I should have said it better
Yes, if you're not making vanilla compatible plugin
Ye, but you don't have to
I guess this is a matter of preference here.
But in datapacks, you don't really have that choice, so that potato it is.
just don't overuse datapacks like that
guys
i need some advice
doing this Inventory gui = Bukkit.createInventory(null, 36, "test"); player.openInventory(gui); is there a way not to open the player inventory with the gui at same time ? "i want only be server side"
Do you mean you only want the top side ?
Then no
its weird
I guess you could have some "workarounds" That would hide "hide" the bottom inventory.
some plugin did it
Show us :)
Can't send images? That's because you're not verified! Use !verify to complete verification.
Alternatively, you can upload screenshots to any image hosting site and share the link.
Here's some screenshot utilities that you can use to upload images.
Lightshot: https://prnt.sc
Imgur: https://imgur.com/upload
Flameshot: https://flameshot.org
!verify
Usage: !verify <forums username>
sure
#bot-commands
My guess will be a resource pack that uses font magic to hide the bottom inventory.
And clearing the items client-side so no hover thing happens.
i dont have idea, its only a plugin and no resourcepack.rar
i will show
omg
effect mandela
yeah, you right
i was like I certantly sure it was standalone gui
i wanna die
☠️
although ,sorry for my misbehave :C , could teach me how to import the net.minecraft, please. :3
I used setCamera packet in survival mode. but InventoryClickEvent didn't work.
Is it impossible to detect inventory click after camera packet sent?
how can the camera be moved if you are in an inventory
We can use NMS to send setCameraPacket
So I made the survival player spectate armorstand.
I'm pretty sure the client just doesn't send inventory packets when in camera mode
hi i make plugin for my private server with friends and i ned help
Yes I thought that so, but I checked some server detect inventory clicking in other camera.
Theoretically is it impossible?
so someone can help me?
?ask
If you have a question, please just ask it. Don't look for staff or topic experts. Don't ask to ask or ask if people are awake or available. Just ask the question to the channel straight out, and wait patiently for a reply. Make sure you use the right channel regarding the topic of your question. Create a thread in case the channel is already in use!
so wait can this specific command be run on actual custom models because I'm not really getting it to work
Yes, should be
Your model definition is not correct
you need two files, item model definition and the model file
but the item model definition restricts me to a specific item right
random example
on a mace
what would I even need to type to make it spawn with the model
because I can do it with a completely different command
this one works
Sorry I can't really respond well at this moment, playing coop game :D
take a look into your clients console, maybe the RP has some errors
the model works
with that specific command
but only for the mace
hence me asking if this means I can only use these if they have a file in minecraft/items and a json specific to the item type that they are being applied to
you can use any model definition on any item
how would I use that specific model definition on a diamond sword
or using the command you posted
the item model tag takes in an item model definition's identifier
why would an item_model component allow for other models?
wdym
anything in the client logs?
why specify models is what I mean
what command should I even be running to try it
/give @p diamond[item_model=elitemobs:bronze_axe] iirc
nothing that would really make me think the rsp is wrong
and does it look correct in game?
interesting
I mean the docs don't lead me to think it would necessarily be impossible to do this but...
why would it give missing texture error
I can't even get this command to work with anything other than minecraft defaults
well, is the texture defined correctly?
yes
show your model definition
I mean I showed it earlier
it works with the other command
I don't see why it would work with one and not the other
well
you would need to remove those predicates
if you add predicates so it only works if those are fulfilled, you obviously won't get it when they aren't
?paste
this one has custom_model_data and the recent command has item_model
also you misspelled bronze to broze
what's this one?
i'm still not even sure of whether it would even be possible to have a model definition for one item type apply to different item types via commands or api
that's another one I was testing
a random mace I edited
look here's the pack
that might be easier
I know it's a mess, I was in the middle of trying to figure it out
I think I'm going to give up on using item_model, it just doesn't seem to work for non defaults and I guess we'll have to make a model definition per item type we need
you're def doing something wrong, I'll take a look at it once I have time
You're misunderstanding how the model system works now
The item model component pulls from assets/<namespace>/items, not from assets/<namespace>/models/item. There's a difference between the two
As an example, take the fishing rod. There's a assets/minecraft/items/fishing_rod.json, and that model file points to either assets/minecraft/models/item/fishing_rod.json or assets/minecraft/models/item/fishing_rod_cast.json based on a predicate if the item has its fishing_rod/cast property set to true
If you want a very simple model without any conditions or anything like that, all you need is a model file to point to your model definition
assets/elitemobs/items/bronze_axe.json
{
"model": {
"type": "minecraft:model",
"model": "elitemobs:item/bronze_axe"
}
}
assets/elitemobs/models/item/bronze_axe.json
{
... your current model definition ... this can honestly stay as you have it currently
}
then the wiki is wrong ig https://minecraft.wiki/w/Data_component_format
Data components, or simply components, are structured data used to define and store various properties. They are used on items, where they are referred as item components or item stack components, and block entities, partially replacing NBT format.
Data components are used in various places, including the player's inventory, container block enti...
well it says its based on assets/models/item pretty explicitly
yeah, alright thanks for clarifying
Wiki should be updated now
The best reference you can use is vanilla's assets directory. Look at assets/minecraft/items/fishing_rod.json and its referencing files in assets/minecraft/models/item
And then look at a simple model like assets/minecraft/items/apple.json and its companion in assets/minecraft/models/item/apple.json
I guess I should cc @torn shuttle because it's been a while, but your explanation is above #help-development message
argh
and then you should be able to use this command to verify it? /give @p mace[item_model="bronze_axe"]
elitemobs:bronze_axe, but yes
holy shit
it worked
thanks bae
I knew I called off that hitman when you didn't add the pathfinding api for a reason

this pointless adding redacting object params if they resets after reloading config
?
you what
Most of the settings depend on the config that the player can reload and reset params. Is it worth adding the ability to change settings via api?
I know that you can add some kind of modifications like with attributes in bukkit api but not for all knows
it depends. Do you think it will be useful addition to your API? If yes add it. If no don't add it
i want what you think obaut it
or i can add smth like reload event?
oh since they changed a bunch of stuff about rsps
did they change the fonts file
can we now have a different way of doing spacing?
I haven't looked at it in years
either sth like https://github.com/AmberWat/NegativeSpaceFont or shaders
what's the better solution for more compatibility with other plugins?
seems like negative space font "fixes" things by just coming up with a ton of possible spaces
Yeah if it's applied to the server other plugins can use it?
more like other plugins have to use it
if they apply their own font logic it will break
like right now my plugin would probably be breaking that negativespacefont thing
and the problem is that if I start using it then every other plugin will break it
(potentialy)
https://github.com/fifazak/PluginMinecraft plis can someone can repair this ?
not if we don't have access to it
sr now is public
I forgot the command again, but please tell us what is wrong with it as well
"pls fix" is useless if we don't know what broke
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
One thing I don't like is the way you do commands
Just make 3 separate classes
You have 3x the same method isInGuildRegion
Make some util class for this instead.
yeah I don't see a good alternative for negative space
well
not an easy one at least
Q: how exactly can plugin break negativespacefont ?
by having their own default font file with different values that use the same unicode
default ?
As in replacing the vanilla font ?
yes
You should use a custom font
yeah I was trying to see how a custom font can be used
wasn't really finding much
do I just create a font file and name it something else? how do I refrence it later?
This is a custom font
its a bit hard to use a custom font esp for stuff like inventory titles in spigot
Yeah you’d need some NMS
then why does it have a minecraft/font/default.json file full of custom spacing
Oh does it
yeah
why say it isn't
I thought it used its own namespace
this overrides the vanilla font
if you haven't seen it
for characters that arent used
You can just rename the font file
then back to what I just asked
And move it to your own namespace ideally
how do I then tell it to use that spacing for, say, an inventory title
or a chat message
For a chat message you can use bungee components
paper
And just set the font value to yournamespace:font_name
apparently it's this easy to make a negative space font since some version ?
I was also looking at that
but it still falls prey to the exact same issue I am talking about
which is why this font is probably using the default too xD
since 1.16 iirc
what do you mean with negative font?
I'm not that invested in getting this to work right now, was just checkign in on the latest meta since some stuff had to change anyway
negative spacing
"writing to the left"
didn't read that
space towards the left
-# would be nice if spigot got out of the stone age
Choco’s PR is still open
for this?
For everything component
why is it still open, is it because he's dum
Because MD hasn’t merged it yet
how long has it been open for?
adventure's integration into the api is 99% of the reason im using paper api
please dont ban
A year
Does someone know how i can place red carpet instead of the default white? I'm Developing on java 1.8 so i can't use the RED_CARPET like this it trows an error. So i'm using the legacy item but don't know how to change the color of it....
Location startLocation = placedBlock.getLocation().clone();
for (int x = -CARPET_RADIUS; x <= CARPET_RADIUS; x++) {
for (int z = -CARPET_RADIUS; z <= CARPET_RADIUS; z++) {
if (x == -CARPET_RADIUS || x == CARPET_RADIUS || z == -CARPET_RADIUS || z == CARPET_RADIUS) {
Location loc = startLocation.clone().add(x, 0, z);
Block block = loc.getBlock();
if (block.getType() != Material.AIR && block.getType() != Material.valueOf("CARPET")) {
while (block.getType() != Material.AIR && block.getType() != Material.valueOf("CARPET") && block.getY() < placedBlock.getWorld().getMaxHeight() - 1) {
loc.setY(loc.getY() + 1);
block = loc.getBlock();
}
}
if (block.getType() == Material.AIR) {
block.setType(Material.valueOf("CARPET"));
}
}
}
}
}```
setTypeAndData iirc
setTypeAndData is not working for me. I'm using, maybe this is the issue?
import org.bukkit.block.Block;
i only can use, but idk how i should use this if could:
setblockdata(BlockData blockData) or setblockdata(BlockData blockData, boolean b)
You should get the docs
What is the website that has all the information on packets on it?
i forgot the link
it's dead
ah
It’s on the wiki now
There is currently no text in this page. You can search for this page title in other pages, or search the related logs, but you do not have permission to create this page.
Jeez, get it right rad
😔
I swear the wiki vg website was easier to use than this
do i really need to scroll all the way down?
Does anyone know how can I get the names and values of a preexisting scoreboard objective by name. I already have tried this but it gets all the names and scores from every existing objective
ScoreboardManager manager = Bukkit.getScoreboardManager();
Scoreboard board = manager.getMainScoreboard();
Objective objective = board.getObjective(scoreboard_points);
for (String entry : objective.getScoreboard().getEntries()) {
Score score = objective.getScore(entry);
Bukkit.broadcastMessage(entry+" :"+score.getScore());
}
it seems to be very important! I hope someone helps you!!!!!
does anyone know what they changed the name of the ClientboundAddPlayerPacket to in 1.21?
There is text on that page
can anyone help me with my problem
Yes, but if I do that i get this weird error:
why are you trying to use it with a bytebuf
I'm not
im passing the ServerPlayer object
it doesn't look like you are
and what type is npc
No:
incompatible types: net.minecraft.server.level.ServerPlayer cannot be converted to net.minecraft.network.RegistryFriendlyByteBuf
idk why its trying to convert to that
its because you're not passing in the rest of the args
public ClientboundAddEntityPacket(
int entityId, UUID uuid, double x, double y, double z, float pitch, float yaw, EntityType<?> entityType, int entityData, Vec3 velocity, double headYaw
)
how do I get those values from a ServerPlayer?
that constructor is not the one usually used lol
i've usually used that one
yea but just not the one used by mojang
I think I figured it out
public void createNPC(MinecraftServer server, ServerLevel level, UUID uuid, String name) {
ServerPlayer npc = new ServerPlayer(server, level, new GameProfile(uuid, name), null);
ServerEntity entity = new ServerEntity(npc.serverLevel(), npc, 0, false, packet ->
{}, Set.of());
for (Player player : Bukkit.getOnlinePlayers()) {
ServerGamePacketListenerImpl connection = ((CraftPlayer) player).getHandle().connection;
connection.send(new ClientboundPlayerInfoUpdatePacket(ClientboundPlayerInfoUpdatePacket.Action.ADD_PLAYER, npc));
connection.send(npc.getAddEntityPacket(entity));
}
}
You can create the packet outside of the for loop so you’re not creating the same packet over and over for each player
So I am using Bukkit#getOfflinePlayer(UUID) to generate player skulls, however if the player isn't online it generates a steve head. What can I do?
You should use PlayerProfile instead
can I do that with just uuid?
oh that's good, ty!
But you’ll probably need to call complete() on it
should I do that async?
oh nvm it's async anyway
ty!
still a steve..
so there's times where the player is a steve but then there's times where the head loads (like 1/5)
How long?
Usually that never happens with me. What’s your method like?
Could be a rate limit thing
Nah doubt it.
it isn't async
you have to call complete in a different thread
wha, complete is a paper thing I guess
Ah it’s update()
private List<GuiItem> getGraphItems(Duration timeAgo) {
List<GuiItem> items = new ArrayList<>();
for (int i = 0; i < this.values.size(); i++) {
if (i == 0) continue;
String color = "green";
float value = this.values.get(i);
if (value < this.values.get(i - 1)) {
color = "red";
if (this.row > 0) {
this.row--;
} else {
if (this.startRow < 4) {
this.startRow++;
}
}
} else if (value > this.values.get(i - 1)) {
color = "green";
if (this.row < 4) {
this.row++;
} else {
if (this.startRow > 0) {
this.startRow--;
}
}
}
if (i == 1) this.row = 2;
items.add(this.getGraphItem(color, value, timeAgo));
timeAgo = timeAgo.minus(CryptoHistory.UPDATE_INTERVAL);
}
this.row = this.startRow;
Bukkit.getLogger().info("Graph items: " + items);
return items;
}
This code is meant to make graphs so like the green goes up and the red goes down.
The red works fine it goes down but the green? The green just stays in the same spot
Example
Is there an ovbvious flaw, Ai wasnt able to figure it out
problem Might be here aswell
private void getItemPlaceRow(Material material) {
if (material.equals(RED_MATERIAL)) {
if (this.row < 4) this.row++;
} else if (material.equals(GREEN_MATERIAL)) {
if (this.row > 0) this.row--;
}
}
- is named get
- doesn't get & return anything
Marek getting a 99% salary cut tomorrow
Hes already long gone lmao
void is nasty work bro
nah there was worse code in here written by him
my man's a magician getting voids out here
show show show show
we've already refactored most but maybe I can find it
let me check git history
so the issue is the green never goes up?
yeah
idk why
red goes down fine
you could refactor this so badly
for (int i = 0; i < this.values.size(); i++) {
if (i == 0) continue;``` 🤮
kk
literally start from 1
oh yeah cool
some comments would be really nice
instead of trying to see the implementation in my head
is UPDATE_INTERVAL a static field
sorry man
i'd love for that to be a config value
yeah defo will be
but for in dev ok
noted that thsx
can I have the rest of the implementation
yeah
ie. values
like the whole class?
?paste
oh okay thats fine
so it wont matter
aight its 324 lines but istg most of it can be ignored
its just for the buttons or whatever
is that like annotations for not null n shi
yes
im not in control of that but ill suggest it
you can just @NullMarked all of it and it's great
is nullmarked = notnull?
go ahead and refactor it and see if something shakes out
Yeah good plan
Nearly fixed it
idk why its still slightly messing up
actually nah idk wtf is even that result
how is red going up
🤦♂️
I think you have an if statement backwards lol
is there a way to make bungeecord send an FML handshake to a player to be able to see the player's forge mods (i am aware this can be spoofed) or just help me understand the documentation
yeah ngl it was nearly that
operations were wrong
its nearly fine now
if you are doing a plugin on the proxy, ProxiedPlayer has information about the mods
declaration: package: net.md_5.bungee.api.connection, interface: ProxiedPlayer
alr thanks
@ivory sleet hai
Can HikariConfig be configured to save the db file locally?
You mean just using sqlite?
squeal lite
isnt hikari for pooling? and whats the point of pooling if ur using sqlite anyways?
eh, hikari makes it easier to handle concurrent queries if anything, though it is definitely true that a database like sqlite would benefit from just having a single connection open
I do wonder how that changes when it comes to wal/wal2 mode
Exactly
you can't have connection pooling with sqlite nor is there a connection. Sqlite uses a file handle.
if you use hikari with sqlite, it just returns a file handle so at least nothing bad happens in that regards but at that point you might as well not use the lib since its just unnecessary dependency lol
There isn't unless you are setting up your plugin to work with other sql DB's other then sqlite for users and making it easier by having a centralized connection point regardless of which is used.
Ah that makes sense, so I imagine they were asking if they could use Hikari as an edgecase for their existing implementations, gotcha.
Thanks, always appreciate a chance to learn @wet breach

you can have connection pooling
even if it is just a file handle as you say, you save on the setting up and creation of of the connection object, which doesn't only imply instantiating the object, it's a series of system calls that needs to be done each time
besides, there's also the aspect of concurrent reads, though I doubt anyone here would care about that so whether it matters for this scenario is questionable
hows everyone xd
wc but good
these are some pretty neat code practices, they teach them in college too and in style guides for jobs (varies)
@echo basalt
public class MyManager {
private final Map<UUID, PlayerData> playerData = new HashMap<>();
public void setPlayerData(UUID uuid, PlayerData data) {
playerData.put(uuid, data);
}
public Map<UUID, PlayerData> getPlayerData() {
return Map.copyOf(playerData);
}
}
```This is unnecessarily slow, you should use
```java
public class MyManager {
private final Map<UUID, PlayerData> playerData = new HashMap<>();
private final Map<UUID, PlayerData> playerDataView = Collections.unmodifiableMap(this.playerData);
public void setPlayerData(UUID uuid, PlayerData data) {
playerData.put(uuid, data);
}
public Map<UUID, PlayerData> getPlayerData() {
return playerDataView;
}
}
One's a snapshot and one's a view
fair enough I forgot about that lmao
I am way too tired to make suggestions
but yeah depends on what you want
Importing info from other plugins
They save their info using Hikari
this update is pretty cool and also a pain in the ass
I like the new model stuff
hate having to update my code
You mean using SQLite?
Did you not read what I said? I meant Hikari is kinda fruitless with SQLite.
👍
As frost said. There’s literally no reason to just use Hikari on its own. It does nothing but just return the file, so it’s an unnessecary extra step?
How is this relevant to Hikari, when what’s you’re describing is just a factor of SQLite.
You can load data from SQLite. Nothing needs to be done at all with Hikari.
How can I do that?
Just using SQLite? You don’t need Hikari.
What do you want Hikari for exactly? Hikari is a connection pooler for database management. If you’re using SQLite you don’t need Hikari.
So how do I read a SQLite file?
Okay
You open a regular Connection
Google it. You use the jdbc driver, it’s built in.
this is the XY problem. You should ask what exactly it is you need, instead about asking for what you think is the potential solution
I was thinking of adding a db feature anyway
swap driver to the sql one that's bundled with Spigot and jdbc url should point to the file
It wasn't purely for reading sqllite
Hikari is useful for other databases
Yes but you don’t need Hikari to just utilize Databases. I think you’re reading too far ahead. Databases don’t require hikariCP innately. Hikari is a useful tool for concurrent connections with other DBs such as Maria or MySQL
Most of your plugin users won’t have a dedicated database. And will instead opt to use just plain old SQLite.
Handling SQLite as an edge case under hikari is fine. But using hikari for SQLite alone is kinda pointless
it is, the docs say "This is an asynchronous operation: ..."
so I am now using update().thenAcceptAsync but it still sometimes fails to render
Calling complete on it forces it to wait sync
I don't want to block since I am loading up to 30 heads each time the menu gets opened
Is there anywhere you can find the performance of the API calls in spigot? Like checkBlocks being more taxing than .isOp, and so on
usually it's kind of common sense that e.g. a block check is more expensive, but the JD to tell you if e.g. that method returns a clone (like item meta), otherwise, look at the impl
Does anyone have experience with lightweight command apis that work with brigadier
I’ve been looking at Commodore and CommandAPI
Does it offer any significant advantages?
Which one
CommandAPI
It's more abstracted from Brigadier
if that's an advantage or not depends on how much you like Brigadier
Looked at cloud?
It supports commodore too
Cloud is not lightweight
Option still
I love cloud!
At this point I should just turn my core utils into a plugin like Eco
But having that dependency is blah
Yeah not worth
fuck dependencies amirite-
Users can't figure out how to update or download them
Kek
so you just get a ton of bug reports
Man am I happy I don't do public plugins
If there's one thing you learn by doing plugin support
it's that people do not read
even if you tell them what to read

Copy pasting it for them does seem to work better
same goes for bot commands with replies
Then just ignore the bot replies
If I open my plugins for the public they need to compile it themselves I don't want to have non educated people complaining to me about x and y when z is the fix for it
real and based
Now people will come to you asking how to compile
or just beg you in dms for a jar
Blocking exists
and banning >:)
true
Why not just use brigadier?
spigot doesn't have the brig api
Commodore is basically just the file format thingy for it
and I doubt you wanna be using NMS
Euhm, mayhaps :)

File format is a separate dependency and can be excluded
You can just use the Brigadier wrapping part of Commodore if you don't want the rest
Hello, i'm trying to create a custom plugin for my server that uses the LuckPerms API. This is how i'm obtaining the api instance in the onEnable(): java RegisteredServiceProvider<LuckPerms> provider = Bukkit.getServicesManager().getRegistration(LuckPerms.class); if (provider != null) { LuckPerms api = provider.getProvider(); } And this is the error that i'm getting trying to get an instance to their API. [14:42:48 ERROR]: Could not pass event AsyncPlayerChatEvent to TWChat v1.0 java.lang.NullPointerException: Cannot invoke "net.luckperms.api.LuckPerms.getPlayerAdapter(java.lang.Class)" because "this.luckPerms" is null I don't really know why its null because the LuckPerms plugin is loaded and works correctly, and i added the dependency on my pom.xml and my plugin.yml
When are you getting it?
https://github.com/fifazak/PluginMinecraft can some one can tell me what is wron and why its work?
You should tell us what's wrong
on a player chat event
Also I don't think LuckPerms' API is a service
We won't compile and run your plugin just to find the issue
You should be using LuckPermsProvider.get() instead
that's the code that is provided by the LuckPerms docs, but i'll try that too thanks
Is it? lol
yessir
Oh it is. Well it mentions singleton access as well which is honestly a bit nicer
i'll try the singleton access then thanks!
I used to multicore to upload lobby and I download better rtp I tried rtp but happened
How to fix
Looks like it can't find a safe location
Ohh
Make sure it's configured in a world that exists and within bounds that has safe locations
What I do
This lobby are not connected to world
Dude, I literally told you yesterday to tell us what is wrong with it, what it does/does not do
what you expect it to do
?notworking
"Does not working" is a useless statement. Please describe what exactly is not working, what you expect it to do, and what actually happens. If you get any console errors, also ?paste the entire stacktrace.
That I did yesterday too
Guy just did not care...
Yeah people don't like to read
Listen, I'm not a programming specialist, I'm 14 and I watched a few videos on YouTube and I'm trying to make a plugin for the server with my friends. I would tell you what exactly isn't working, but I don't know and the only error I get in the console is "cannot find symbol" so I'm just asking for help
?learnjava
For Beginners:
Codecademy - Learn Java: Interactive Java programming course from basics to more advanced concepts. Perfect for absolute beginners.
https://www.codecademy.com/learn/learn-java
JetBrains Academy - Java Developer Track: Learn by doing with projects and challenges. It covers Java fundamentals to advanced topics.
https://www.jetbrains.com/academy/
Udemy - Java Programming Masterclass for Software Developers: Updated courses that cover Java 8 to Java 17 features. Suitable for those who prefer structured learning.
https://www.udemy.com/course/java-the-complete-java-developer-course/
For Intermediate to Advanced Learners:
Oracle Java Tutorials: The official guides by Oracle for Java programming—great for understanding the depth of Java.
https://docs.oracle.com/javase/tutorial/
Baeldung - Learn Java and Spring: Focus on Spring Framework and modern Java technologies. Best for intermediate learners aiming to expand their knowledge.
https://www.baeldung.com/
Practice and Hands-on Learning:
Exercism - Java Track: Solve exercises and get feedback from mentors. Great for practicing coding skills.
https://exercism.io/tracks/java
LeetCode: Practice your coding skills and prepare for technical interviews with Java.
https://leetcode.com/
Free Resources and Documentation:
Java Programming and Documentation: A comprehensive collection of Java programming guides, tutorials, and API documentation.
https://docs.oracle.com/en/java/
Community and Support:
Stack Overflow: A vast community of developers. Great for getting help with specific problems or understanding concepts.
https://stackoverflow.com/questions/tagged/java
r/learnjava on Reddit: Join the community of Java learners and get advice, share resources, and discuss projects.
https://www.reddit.com/r/learnjava/
Remember: Learning to program takes practice and patience. Don't hesitate to experiment with code and participate in community discussions. Happy coding! 🎉
You dont' need to be a specialist to tell us what's wrong
but yeah time to learn some Java
I tried using the Singleton Access but i still get this error: [15:01:50 ERROR]: Error occurred while enabling TWChat v1.0 (Is it up to date?) net.luckperms.api.LuckPermsProvider$NotLoadedException: The LuckPerms API isn't loaded yet! This could be because: a) the LuckPerms plugin is not installed or it failed to enable b) the plugin in the stacktrace does not declare a dependency on LuckPerms c) the plugin in the stacktrace is retrieving the API before the plugin 'enable' phase (call the #get method in onEnable, not the constructor!) This is how i'm accessing the API now: ```java
if(!Bukkit.getPluginManager().isPluginEnabled("LuckPerms")){
logger.severe("LuckPerms was not found, disabling...");
this.getPluginLoader().disablePlugin(this);
}
this.luckPerms = LuckPermsProvider.get();
loadListeners();
logger.info("TWChat enabled!");
Do you declare a dependency on luckperms
yes, this is my plugin.yml: yml name: TWChat version: '1.0' main: xyz.unhandlederror.TWChat.TWChat api-version: '1.21' depend: [LuckPerms]
oops
I don't know what's not working, it looks like none of the iports are working, e.g. teamManager and loccalSesion, but I have all the libraries and repositories in POM
Don't know what's not working, proceeds to tell us what's not working
That's the wrong word isn't it
🤷♂️
Well, I have to say that what you wrote so far looks pretty good.
Which is interesting provided your imports are not working?, did you write all of that manually ?
I think all the dependencies are correct.
I don't see any mistake (tho I didn't look really that deep)
Did you reload maven ? @high glen
Could also be an outdated Intellij issue
this is the most annoying thing to experience tbh
Actually no the imports are just wrong
They don't match the plugin did you write them by hand
or use GPT to generate the code for you
they said they followed a tutorial on YouTube
so i imagine they paused it and copied it all
Outdated tutorial then 💀
-# bruh
I used bstats as a Dependecy in my Plugin and its compiled into the plugin jar but i still get an error that the method cant be found even if its there.
Did you shade bstats ?
yes i think. Do you mean relocate? Yes into my package. I switched to the newest API Version 3.1.0 and then the error came up but when i switch back to 3.0.2 it works again
Thats my Pom with Shade Plugin
output file in maven shade plugin 💀
If you’re using maven for your Spigot plugins (which you should do), it’s easy to make maven automatically save your plugin’s .jar in your plugins folder. There’s two ways of doing this: 1. The lazy way (not recommended) If you only work alone on one computer, you can just directly declare the output location in...
Yeah but its not wrong. And thats not the error?
Why can it be the error?
Because you might end up with multiple copies of your jar in your plugins folder
and some may not contain the shaded deps
Okay i changed it now but i still get the same error.
I guess I could just libraries feature all my dependencies
And deal with the console spam on startup, kek
Would runTaskLater(p, t, 0) run before runTask(p, t)?
Probably not
No
Same time?
Wb runTaskLater(p, t, 1) and runTask(p, t)?
Same time
is there a documentation about what brigadier'sfork and forward methods do? (and how to use them)
Check brigs GitHub I guess
if there was a wiki 🤷🏻♂️
So 0 just gets set to 1 ig?
you could check fabric's
Yes
Scroll up
it gets scheduled to run in the next tick
connection pooling does not exist for files
all hikari does, is just connects to the sqlite file no differently then accessing a file. As I said earlier the only reason you would use hikari for this is because you want to allow configuring between mysql or sqlite and having the implementation centralized
iirc its a transitive dep, but ye I mean if u just wna use commodore u could just directly use brig otherwise in my opinion
It is but you can exclude it
Yeah I know
But I was requested to add db support
I could get familiar with the api by starting with SQLite and adding the rest afterwards
A lot of shared hosts offer a MySQL database tbf
^^
why is my intellij telling me that the result of mkdirs() is ignored, i dont need the result, if i assign it to a variable it says that its not used
ignore it
So you should print an error or something
Crash the JVM for fun idk
panic
false could just mean that the dir already exists
That’s annoying
no not necessarily
but normally it doesnt make warnings if i ignore results, only if the method only returns something, buti this one does something and returns something
its stupid
?
true if and only if the directory was created, along with all necessary parent directories; false otherwise
yes IFF it was created
if its unknown it'll be false
if it wasnt created itll also be false
So it may have failed or it may already exist
I mean I guess you could just check if it already exists first
But still, clearly we need 3 different return values!
if (!file.exists()) {
file.getParentFile().mkdirs();
plugin.saveResource(fileName, false);
}
``` what does this 'false' change if we already know it doesnt exist?
Or java is having an off day
what
but when
^
Hey, does someone know how to add a Flag in the list of Flags from the Faction plugin by MassiveCraft ? Because I tried this but I get an error :
MFlagColl.get().getAll().add(new MFlag(16_000, "TurretsFriendly", "Are affect by turrets", "Yes, they are affected", "No they are not affected", true, true, true));
because I get this error :
[19:12:35 ERROR]: Error occurred while enabling InvasionBase v1.0-SNAPSHOT (Is it up to date?)
java.lang.UnsupportedOperationException: null
at java.util.Collections$UnmodifiableCollection.add(Collections.java:1057) ~[?:1.8.0_312]
at fr.naosisme.invasionbase.InvasionBase.onEnable(InvasionBase.java:85) ~[?:?]
at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:264) ~[server.jar:git-Spigot-79a30d7-f4830a1]
at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:337) [server.jar:git-Spigot-79a30d7-f4830a1]
at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:403) [server.jar:git-Spigot-79a30d7-f4830a1]
at org.bukkit.craftbukkit.v1_12_R1.CraftServer.enablePlugin(CraftServer.java:381) [server.jar:git-Spigot-79a30d7-f4830a1]
at org.bukkit.craftbukkit.v1_12_R1.CraftServer.enablePlugins(CraftServer.java:330) [server.jar:git-Spigot-79a30d7-f4830a1]
at org.bukkit.craftbukkit.v1_12_R1.CraftServer.reload(CraftServer.java:752) [server.jar:git-Spigot-79a30d7-f4830a1]
at org.bukkit.Bukkit.reload(Bukkit.java:525) [server.jar:git-Spigot-79a30d7-f4830a1]
at org.bukkit.command.defaults.ReloadCommand.execute(ReloadCommand.java:27) [server.jar:git-Spigot-79a30d7-f4830a1]
at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:141) [server.jar:git-Spigot-79a30d7-f4830a1]
at org.bukkit.craftbukkit.v1_12_R1.CraftServer.dispatchCommand(CraftServer.java:648) [server.jar:git-Spigot-79a30d7-f4830a1]
at net.minecraft.server.v1_12_R1.PlayerConnection.handleCommand(PlayerConnection.java:1401) [server.jar:git-Spigot-79a30d7-f4830a1]
at net.minecraft.server.v1_12_R1.PlayerConnection.a(PlayerConnection.java:1236) [server.jar:git-Spigot-79a30d7-f4830a1]
at net.minecraft.server.v1_12_R1.PacketPlayInChat.a(PacketPlayInChat.java:45) [server.jar:git-Spigot-79a30d7-f4830a1]
at net.minecraft.server.v1_12_R1.PacketPlayInChat.a(PacketPlayInChat.java:1) [server.jar:git-Spigot-79a30d7-f4830a1]
at net.minecraft.server.v1_12_R1.PlayerConnectionUtils$1.run(SourceFile:13) [server.jar:git-Spigot-79a30d7-f4830a1]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) [?:1.8.0_312]
at java.util.concurrent.FutureTask.run(FutureTask.java:266) [?:1.8.0_312]
at net.minecraft.server.v1_12_R1.SystemUtils.a(SourceFile:46) [server.jar:git-Spigot-79a30d7-f4830a1]
at net.minecraft.server.v1_12_R1.MinecraftServer.D(MinecraftServer.java:748) [server.jar:git-Spigot-79a30d7-f4830a1]
at net.minecraft.server.v1_12_R1.DedicatedServer.D(DedicatedServer.java:406) [server.jar:git-Spigot-79a30d7-f4830a1]
at net.minecraft.server.v1_12_R1.MinecraftServer.C(MinecraftServer.java:679) [server.jar:git-Spigot-79a30d7-f4830a1]
at net.minecraft.server.v1_12_R1.MinecraftServer.run(MinecraftServer.java:577) [server.jar:git-Spigot-79a30d7-f4830a1]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_312]
i dont understand, when it could not be created?
when the program does not have permission to create folders in your target directory
Creation can fail if the JVM doesn’t have write access to that directory
every file and folder on your PC has a list of things that are allowed to read/write it
still dont understand why it has to do with overriding a file if we know there is no file
you mean the false in your plugin.saveResource(fileName, false);?
I thought you meant why makeDirs returned false
well
in that case, it doesnt matter
if the dir didnt exist before, there is nothing to overwrite
assuming its all the same path you are making/checking
okay so its just safer to do false
well
idk
in this case it literally does not matter
but the reason for the parameter is to not overwrite the existing file every time you call that function
i.e. a config file you dont wanna rewrite everytime
because people might have made changes in them
I dont even know if you need to makedirs in this case
why
because I think saveresource might make the dirs already for you
i dont knwo
?tryandsee
or keep the makedirs and its fine either way
umm maybe later
yeah
clientside you mean
polymer?
polymer is for fabric
is there a method that mimic that ?
im not sure if using protocollib
could do the trick
It does not
before I step to going further look on and ask for fabric, i want be sure if can be done on bukkit xD haha ,
Polymer doesn't have custom entity textures
because it is literally not possible without retexturing an entire entity
I love polymer tho <3
im trying to do its, learning how to make a serverside backpack, so I could imitate "attempt" travelersbackpack mod only serverside on bukkit.
if you do not like a huge fucking PITA, use resource packs
item models to be specific
so I could like make a resource carpet and put the png there, then use normally org.bukkit, after that wrapping all?
wha-
you create an item model
and then you use that item model in bukkit using either custom model data, or new in 1.21.4, the item_model component
the resource directory file its where I put the config.yml and the plugin.yml file
https://github.com/mcbrawls/inject quick shameless lil self promo
Yeah but that’s not specifically designed for sending resource packs
You have to put in extra effort smh
not much tho!
try {
provider = PackProvider.create(this, "localhost");
provider.setDebugLogging(true);
provider.addPack(new File(getDataFolder(), "test.zip").toPath()).setSendOnJoin(true);
provider.addPack(new File(getDataFolder(), "test2.zip").toPath()).setSendOnJoin(true);
} catch (PackProviderException e) {
e.printStackTrace();
}
When
using blockbench?
yes
then the output of that make it .rar then using the code above?
haha, sorry if i sound like not very smart, never did it before.
is this still relevant ? :@EventHandler public void onJoin(PlayerJoinEvent event){ event.getPlayer().setResourcePack( path ); }
ouch
Right I forgot to tell you but Javalin and Spring uses 2 different Jetty versions shading both could have unexpected consequences
😭
did you do any other changes?
Yeah I also forced web servlet mode in the application builder*
That wasn't needed in my code but it appears to be in yours
damn
There we go
Not shading Spring fixed it 
Will renable javalin and see if it breaks again
That does break it due to duplicate dependencies
Oh yeah I remember the shading issue now 🤦♂️
I had this issue before
It's because a few of the dependencies ship their own properties files that spring will automatically detect and try to load
and since a couple of them ship the same file it breaks
on my custom item.java : public void onPlayerJoin(PlayerJoinEvent event) { try { // Using a local pack provider PackProvider provider = PackProvider.create((JavaPlugin) getPlugin(), "localhost"); provider.setDebugLogging(true); provider.addPack(new File(getDataFolder(), "test.zip").toPath()).setSendOnJoin(true); } catch (PackProviderException e) { e.printStackTrace(); } } after this where do I put the test.zip/rar , since im using like src/main/java/customitem/item.java .
Semi certain this should not be done on player join

