#help-development
1 messages Β· Page 931 of 1
that din't work
hmm, the same thing will happen
well now u have to access the field namespacedKey everytime u need the actual namespacedkey object
oh itβs real, okay
I mean, i just created a section with that path
do you want full code?
yeah
If I need to damage a player with p.damage, what would be the best way to get the player that last hit the player?
Does Player#getKiller() always return the damager or just when killed?
Player#getLastDamageCause()#getDamageSource() seems to be one way as well.
plugin.items.getConfig().set("Rewards." + args[1] + ".enchantments", plugin.items.getConfig().createSection("Rewards." + args[1] + ".enchantments"));
maybe try this?
i think it shiuld work?
I mean, i'll try
didn't work either
I can send you a video if u wish
can't be
i think just plugin.items.getConfig().createSection("Rewards." + args[1] + ".enchantments") should do it
I mean, if I have an enchantment in the item, it works, and is the same path
maybe the args[1] is wrong?
no
because it is changing other values except removing enchantments:
@lilac dagger did some debuging and the else is never firing π
there you go
But having a plank in my hand it says it has enchantments what
Hey so when i do left click in game while holding item it does an ability. (Works good)
But the issue is when i want to drop the item it triggers left click and makes ability work.
(its because of animnation packet from what ive seen on fourms)
I am wondering if theres anyway to make it not do that or do i have to mess around with packets?
show the code that triggers it
Is there any where to give a player the trident impaling effect while they're gliding?
@EventHandler
public void onUseOfAbility(PlayerInteractEvent event) {
Player player = event.getPlayer();
if (player.getInventory().getItemInMainHand().getType().equals(Material.STICK)) {
if (event.getAction() == Action.LEFT_CLICK_AIR || event.getAction() == Action.LEFT_CLICK_BLOCK) {
player.sendMessage("The wand of truth has spoken!");
}
}
}
when i drop from inventory and stuff it counts as a left click action cuz of the animation and calls this. (According to fourms)
yea
I wish for the event to not be called when they drop it out of their inventory.
pretty sure this event should not be called for that
let me just test that real quick
?
try adding this
?interactevent
The PlayerInteractEvent may be called once per hand. If you only want code to be executed once, you can check the result of https://hub.spigotmc.org/javadocs/spigot/org/bukkit/event/player/PlayerInteractEvent.html#getHand(), then decide functionality.
For example, only executing code if the main hand was used:
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event) {
if (event.getHand() != EquipmentSlot.HAND) { // * if the hand used is NOT the main hand:
return; // do not progress past this point |
}
// provide functionality
}
Alright thanks
Is there any where to give a player the trident impaling effect while they're gliding?
oh yeah I meant riptide
i think there is something like player.boostelytra
Well you can launch a player via setVelocity but I just want the riptide effect
like the white thing around the player
thats an animation
that works.
But if i open my inventory then press Q on item it triggers it
i think this one cannot be fixed
if you look closely when dropping something your character swings its arm
yeah ik
mentioned it here
You basically end up with a drop and aj interact listener
Drop event is called prior to the fake interact one so just
Yea
priority?
Hello! Quick question. When using ItemStack.getItemMeta() intellj says that the ItemMeta could be null. When does this happen?
when the type is air
Perfect, thanks!
idk how to explain this but i got this code
} else if (action.equals("auto-pickup")) {
List<ItemStack> items = new ArrayList<>(((BlockBreakEvent) event).getBlock().getDrops());
((BlockBreakEvent) event).setDropItems(false);
for (ItemStack item : items) {
if (player.getInventory().firstEmpty() == -1) {
player.getWorld().dropItemNaturally(player.getLocation(), item);
} else {
player.getInventory().addItem(item);
}
}```
so basically, this is code for a custom enchants coding thing, the issue is 'auto-pickup' can be coded for an enchant that can be applied on armor and tools, if you have the enchant on your tool and armor you basically dupe since Block#getDrops returns a copy, is there a way to fix this?
what is the NBT Data?
it's right there in my original question
To answer the question, no, you cannot add custom NBT data to a player. Arbitrary NBT isn't understood by the server and will be discarded
It won't read it and store it as a field, it will not write it. The only reason Bukkit's persistent data container values are saved is because we patched the server so that it actually reads and writes that data.
ItemStacks are different because they just read the whole NBT and store it, you can store as much arbitrary NBT on that as you want. But entities don't do that and actually read and parse that data into fields. ItemStacks actually do this now with components in 1.20.5, but they at least still support custom data with a custom data component
getKiller returns last player who hit the player during past 5 seconds. after 5 seconds it resets to null
getKiller is null, after player hits him its set to damager player for 5 seconds.
getLastDamageCause saves last damage cause permanently which can tell you last damage cause or who caused it for example you can retrieve the guy who shot the arrow or just the arrow
just use hashmaps where possible and store them locally
Does anyone know why I get a JedisConnectionException when I call the Jedis#get method?
For some more context: I have a Jedis instance which successfully connects to the DB, I can even query/get and set data to the DB. However, once I call #get in fast succession, it seems to give me the exception.
I'm new to Redis and any help would be greatly appreciated :D
Can anyone help me find the spigot 1.20 jar
buildtools
uH
Something something you should be using a jedis pool
Ok, gotta read up on that. I'm currently trying to use #mget
Hello, what do ItemStack#getDurability return if the item isn't damageable?
Or how can I get the list of items that can handle a enchantment (safe)?
Lmao what does that mean now
If it isn't Damageable then I believe it doesn't have a durability
since it can't be damaged..
so what does it returns?
null ? 0 ?
test it out and see
okay x)
?jd-s
but, if an ItemStack has 0 durability, is he breaked?
I already checked, nothing
not yet
It's also deprecated
I know
I want to support 1.9+
I already have the check for Damageable
But not for the old system
so I think it returns -1
with 1.20.5 every material can be damageable again, so you are gonna have to support three different versions of the same concept (pre-1.13, 1.13-1.20.4 and 1.20.5+)
π
every instance of ItemMeta already implements Damageable
every instance of ItemMeta can be cast to Damgeable, Repairable, and BlockDataMeta
No
Damageable extends ItemMeta
that's cool ^
i have some interfaces in my plugin and they don't extend back so it's quiet akward working at a base level
you are incorrect
if you look at the implementation of ItemMeta (CraftMetaItem), you will see that it also implements those other 3 interface
If you see this message, consider taking a look at this thread (in need of help) https://www.spigotmc.org/threads/efficiently-iterate-through-a-large-amount-of-blocks.640168/ π
how on earth is this producing 0b 0 110000100000000:
@Debug.Renderer(text = "\"%s data=0b%8s %8s\".formatted(this.toString(), " +
"Integer.toString(this.data >> 8, 2).replace(' ', '0'), " +
"Integer.toString(this.data << 8, 2).replace(' ', '0'))")
this.data is a short
Is this the built in IntelliJ arbitrary code execution
i never seen this
You can add an annotation and intellij will gracefully execute anything inside of it when youre debugging
It's used by the debugger to prettify the contents of a debugged object
but it comes at the cost of uglyfing with annotations
Anyways, this is likely caused by negative values
I got a problem... So, I'm trying to change items in the barrel when it breaks, but dropped items from the barrel aren't changed
Since I have no fucking idea what that code should be doing, I cannot tell you more though
one minute
meh, you won't be looking at it too often
@EventHandler
public void onBreakBarrel(BlockBreakEvent event){
if(event.getBlock().getState() instanceof Barrel){
Barrel barrel = (Barrel) event.getBlock().getState();
String customName = barrel.getCustomName();
NamespacedKey agingKey = new NamespacedKey(plugin, "Aging");
updateInvHelper.updateInventoryItems(barrel.getInventory());
barrel.getInventory().forEach(item -> {
// Checking conditions
if(item != null && item.getItemMeta() != null){
ItemMeta itemMeta = item.getItemMeta();
PersistentDataContainer itemKeys = itemMeta.getPersistentDataContainer();
boolean hasItemTag = itemKeys.has(agingKey, PersistentDataType.LONG);
if(hasItemTag){
// Adding spoiled lore tag and removing tag
item.setItemMeta(updateInvHelper.spoilItem(item));
plugin.getServer().getLogger().log(item);
}
}
});
barrel.update();
The log is good, item is changed, but drop from barrel - no
if i have a square 102x102 blocks wide
what should the worldborder be set to
if I want it to perfectly align the square
and where EXACTLY should it be centered
in the middle, at the center? (.5, y, .5)
or at non decimal values?
because for the past 30mins I can't get it to work
I'd listen to BlockDropItemEvent instead
You place the center at 1/2 x or y and then set the size at 1/2 x or y
Wait its not a radius so its exacly x
Yeah wait.. let me show you something lol
is worldborder even a square?
Yes, the center just has an offset here
So I should stand here right?
I can't teleport myself to exact zero
with /tp
it always centers my location to .5 y .5
nvm now worked...
really wondering why on earth System.out.printf("%8s", Integer.toBinaryString(12).replace(" ", "0")) is " 1100" rather than "00001100"
yes i wanna say this
Leading zeros are omitted because they have no information value
but instead i get spaces π€
Hm i see, and the spaces arent replaced. Check the char code of those spaces.
same thing as a whitespace
wait replace should be after printf
why cant we just have a {:08b}
I mean, no because that's gonna be after it's been printed
you can just do %08s, no?
0 padding is invalid for strings
pepega
frightening
@Debug.Renderer(text = """
"%s data=0b%s %s".formatted(this.toString(),
String.format("%8s", Integer.toString(this.data >> 8, 2)).replace(' ', '0'),
String.format("%8s", Integer.toString(this.data & 0x00ff, 2)).replace(' ', '0'))""")```
but hey atleast it works
What is that?
changes object representation in debugger automatically
Is it possible to block a player from collecting experience?
is the event cancellable? if so, you may try: event.setCancelled(true);
Hi uhh , iam working on a level system :
it keep duplicating .. why? i mean it should only be , :
uuid , 0 , 0
uuid , 1 , 0
uuid , 2 , 0 .
and so on , the third paramter is boolean which mean is claimed or no .
make uuid unique and handle it conflicting
?nocode
Itβs hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.
declaration: package: org.bukkit.entity, interface: Player
hmmm , well i need to have it like the structure i mentioned?
can i still be able to do that?
sure?
why am I getting this error?
Arrays.asList probably returns an immutable list
it is
Arrays.asList and List.of are immutable
use new ArrayList<>(oldplayers);
but this won't work for array so you'd have to add them yourself
maybe there's a collection data type?
Collection::shallowClone when
Does anyone know if this https://hub.spigotmc.org/javadocs/spigot/org/bukkit/entity/LivingEntity.html#hasLineOfSight(org.bukkit.entity.Entity) (hasLineOfSight) does it consider entitys that are behind slabs or, glass, not in their sight?
like that? or I wrote the same
DataType.PLAYER_LIST or something
yes
okay, thanks
I mean it serves a different purpose
you can certainly set items to something, just not add or remove
Hey guys. I am creating a (for now) private plugin that has a terminal which is basically a chest with multiple pages. The items that are put in and taken out will be stored and updated in the config.yml, looking like this:
Storage:
OAK_LOG:
amount: 160
WOODEN_SWORD?2f1cd314-41c7-4354-9d28-b46ce5cdd02b:
meta:
==: ItemMeta
meta-type: UNSPECIFIC
enchants:
DURABILITY: 3
amount: 1
Stacks with only a maximum stack size of one (the sword in this case) have a unique ID appended to them in the config, seperated with a question mark.
I am aware it is a basic approach. I may use databases in the future and maybe serialized ItemMeta as well. For now, it works perfectly fine.
Items displayed in the terminal have a lore with its amount and the item material.
Everything mostly works, except one issue:
If i take out or put in the (in this case) oak log it will add said lore to the wooden sword in the config. The config now looks like this:
meta:
==: ItemMeta
meta-type: UNSPECIFIC
lore:
- '{"extra":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"color":"gray","text":"Anzahl:
"},{"italic":false,"color":"yellow","text":"1"}],"text":""}'
- '{"extra":[{"bold":false,"italic":false,"underlined":false,"strikethrough":false,"obfuscated":false,"color":"gray","text":"ID:
"},{"italic":false,"color":"light_purple","text":"WOODEN_SWORD"}],"text":""}'
enchants:
DURABILITY: 3
I tried removing it using item.getItemMeta().setLore(null); but this did not resolve the issue entirely.
Does anyone have a clue why?
Please note, that I am willed to show code but it is a lot (I do not have a git repository yet). I am not sure which line the issue lies in either. A unique solution may be required or i have to search for snippets.
I could show snippets that people ask for.
Lets say I have a class MinigamePlayer, it has methods: resetPlayerAbilities, updateVisibility, updateDisguise, updateLostStatistics, updateWinStatistics,
So, based on SOLID principles I should split the class into separate classes?
and as the result I should have something like
MinigamePlayer
PlayerDisguise
+ updatePlayerDisguise
PlayerAbilities
+ resetPlayerAbilities
IPlayerStatistics
+ updateLostGameStatistics
+ updateWonGameStatistics
And so there are two questions:
- what would I change to make it better, more correct ig?
- how do I call methods I need from external classes? Do I do it like
new PlayerDiguise().updatePlayerDisguise();or should it be done differently?
So, generally I am asking what are the best practices I can use at this point
is it possible to make the player copy something on click?
for exemple:
the player click on a chat message and it's making him copy something
Yes, ClickEvent.Action#COPY_TO_CLIPBOARD
thx
also what listener do you use?
The home of Spigot a high performance, no lag customized CraftBukkit Minecraft server API, and BungeeCord, the cloud server proxy.
It's not a listenable event
ho ok
You can't detect when a player does it
If anyone has an idea: i'd appreciate any help. :)
It appears that you have code adding lore somewhere
Show us how exactly you're trying to remove it
?paste the code or put it on github
does the items adder actually send every tick an action bar?
yeah
won't this put a lot of load on the server?
no not really
also it doesn't have to be sent every tick but every few ticks
depends on how fast you want it to update
then my understanding of scheduler is bad. Can you give an example of how much load it loads?
^^
But yeah it's not that heavy regardless
I'd put it here since your request only takes up 3 lines:
ItemMeta cutoutMeta = takeOutItem.getItemMeta();
if (cutoutMeta != null) cutoutMeta.setLore(null); // does get triggered
takeOutItem.setItemMeta(cutoutMeta);
I tried cloning the ItemStack (takeoutItem.clone();) too but this did not fix it unfortunately.
Edit: removed the request. Asking a friend instead.
Especially since you have to use components to send action bars, which avoids the legacy conversion system
Not enough information
When does that fire
If I have two plugins, both have a PlayerJoinEvent, and if I need to take information from the other plugin, then how can I understand which executed first?
Is there a way to change the seed of a world in runtime? I don't mind using NMS, just need to get it to work. I tried using reflection to get the seed field of the WorldOptions class but at runtime, it cannot find the field though (getting an error for that)? I assume that's because the actual fields are obfuscated. Not sure what it obfuscates to though. (not very familiar with nms currently)
Why would you ever need to change the seed at runtime
yes I am using that (I believe?)
Can I place as many entities on a player as I want? or should I add for each?
I don't understand the question
should I upload the remapped-obf or remapped one, or just the regular output name
regular output name
hmm I am doing that
so non-prefix and non-suffix one
yeah I am doing that
WorldOptions options = ((CraftWorld)world).getHandle().K.worldGenOptions();
Field f = options.getClass().getDeclaredField("seed");
f.setAccessible(true);
f.setLong(options, WorldOptions.randomSeed());
f.setAccessible(false);
this is what I currently am trying
the fields will be obfuscated at runtime
anyways you still haven't explained why you need to change the seed
okay so essentially, we've got a world for a minigame that get's randomized using minecraft its worldgen (with a datapack). But to regenerate the world (at runtime) I'd have to change the seed and then regenerate the chunks.
Just create a new world
i made illustration:
For example, I have 2 entities.
to land on the player I can use the method:
player.addPassanger(entity1);
but to sit the second one, I need to use:
player.addPassanger(entity2)
or
entity.addPassanger(entity2)?
and delete the old one
?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.
doing that and re-creating the world with bukkit seemed to break the worldgen
?xy
is that towards me?
yeah
anyways what broke about it? Is the custom worldgen provided by a datapack? What version are you on?
1.20.4
but there are multiple dimensions with custom worldgen. Recreating them using the bukkit worldmanager didn't seem to actually apply the custom worldgen to those worlds as they were (by the looks of it) different from the vanilla dimensions in the way they got created.
hence why I'm currently attempting to keep it in memory (because during startup it does work and find the world) and just changing the seed and regenerating the chunks.
so what's controlling the world gen
a vanilla datapack
it generates a dimension and supplies worldgen to it
but I'm still confused why the reflection failed in the first place
worldoptions has a private final long seed; in it so I'd expect it to find it.
as I said fields are obfuscated at runtime
I am using this though. Or does that not fix the issue?
so how would I get an obfuscated field or know its name
Compare different mappings with this website: https://mappings.cephx.dev
Is there any wahy to get a metadata from a player at bungeecord?
I don't find a method with ProxiedPlayer
Send code
BlockDropItem.getItems doesn't return items from barrel, only barrel item... So... It didn't work too
?jd-s
Might be a bug on spigot's side, otherwise it is possible that the API just isn't here yet
I tried it with chest, it didn't work too
Btw, I still need the solution to change items dropped from barrel
a barrel drops its contents
reminds me of the saying "a barrel without a lid is a soupβs dream - all splash and no whisper"
it is contents
I am contents
yeah
Not if I do container.getInventory().clear() first!
Is there a way to remove the explosion sound from a firework? Setting the entity to silent doesn't achieve that
Yeah, but If I do something like this:
@EventHandler
public void onBreakBarrel(BlockBreakEvent/BlockDropItemEvent event){
if(event.getBlock().getState() instanceof Barrel){
Barrel barrel = (Barrel) event.getBlock().getState();
String customName = barrel.getCustomName();
updateInvHelper.updateInventoryItems(barrel.getInventory());
barrel.getInventory().forEach(item -> {
// Checking conditions
if(item != null && item.getItemMeta() != null){
ItemMeta itemMeta = item.getItemMeta();
PersistentDataContainer itemKeys = itemMeta.getPersistentDataContainer();
boolean hasItemTag = itemKeys.has(agingKey, PersistentDataType.LONG);
if(hasItemTag){
// Adding spoiled lore tag and removing tag
item.setItemMeta(updateInvHelper.spoilItem(item));
plugin.getServer().getLogger().log(item);
}
}
});
barrel.update();
It doesn't work
log tells that everything is ok
items are changed
but the drop isn't changed
um ? onBreakBarrel(BlockBreakEvent/BlockDropItemEvent event){
I tried with both
the same
it didn't work
Like firstly I tried with BlockBreak
after that with BlockDropItemEvent
result - it doesn't work
well the issue with changing the inventory IN the break event is that your uipdate will nto happen until the next tick, after the block is broken
btw it works with changing name of the barrel
barrel.update();
barrel.setCustomName(barrelName);
barrel.update();
drop the contents yourself, after making the changes, then clear drops
like getWorld().dropItemNaturally()?
yes
just set dropItems to false
ArmorStand block2Stand = createConnection(block2.getLocation().clone().add(0.5, 0, 0.5));
block1Stand.setLeashHolder(block2Stand);```
why isnt there a leash being created between the 2 armorstands
what do you expect us to do with that little amount of code
idk what else is needed its 1 method that isnt working
false
Okay so itβs failing to link them
Letβs have a look at the source
It immediately fails because ArmorStand is not an EntityInsentient (I believe this is called Mob in Bukkit)
so armorstands cant have leashes?
Would appear not
i cant see anywhere that says what entities are/arnt leashable
Slimes are LIvingEntities
^ should be on every living entity
Unless slimes are extra weird
Nope slimes seem fine
yeah mb i forgot to cast the slime
Hello, kinda new to the Spigot dev, i can't get the SetType of a block to work :
World world = player.getWorld();
Location playerLocation = player.getLocation();
// Calculate the new position
double newX = playerLocation.getX() + xOffset;
double newY = playerLocation.getY() + yOffset;
double newZ = playerLocation.getZ() + zOffset;
// Create a new location for the block
Location blockLocation = new Location(world, newX, newY, newZ);
// Set the block to Obsidian at the new location
Block block = world.getBlockAt(blockLocation);
block.setType(BlockType.OBSIDIAN);
}
I Also tried with the Material.OBSIDIAN but won't work either
I did register the event and it does proc
player.getLocation().add(0,-1,0).getBlock().setType(Material.OBSIDIAN)
that's a nice oneliner ngl but The Material.OBSIDIAN seems to not correctly resolve the import
are you missing an api version in your plugin.yml?
any error/warning?
'setType(org.bukkit.block.BlockType<?>)' in 'org.bukkit.block.Block' cannot be applied to '(org.bukkit.Material)'
Sounds like you are using an experimental build
hoo
Some fork I guess
what build should i fall back on for a 1.20.2 server ?
Whatever buildtools builds
Just donβt add the experimental flag/check the box
I think getcuckit publishes the experimental builds for whatever reason
wtf
Check the domain name. Looks like it expired 2 days ago.
?
Okay i found the culprit !
I was using the experimental api spigot lib, downgraded to spigot-api-1.20.2-R0.1-20231119.061606-67-shaded.jar and it works perfectly
Thank you for your time everyone (and also the cool oneliner)
I heard getColl publishes experimental builds too
why not 1.20.4?
I would like to demo a few features/gameplay ideas for a serv, and this is their version
Nothing more nothing less
Tell βem to update
I'll sure do but given the number of custom set up they have done pretty sure they don't want to
But hey, can ask anyway
Perfect time to test out that crash exploit on them
I've just uploaded a premium plugin and it's awaiting review, however, since it has to be reviewed, I've uploaded an unobfuscated version of my plugin. Will I be able to remove it afterwards?
You should upload whatβs going to be on the page
is there any way I can remove it now?
Not sure
is there any way I can contact support for such a thing?
?services
If you wish to request or offer development/art/building/administration services, please do so at https://www.spigotmc.org/forums/services-recruitment-v2.54/
You cant eat food in survival while you are full.
Also: You are doing some really dangerous things here.
- Create a separate class for your Listener, dont create a nested class
- Dont make your fields public, they should all be private
- Dont check custom items by their name, people will exploit this by renaming their items (Some plugins allow colored renaming)
btw dont naming your field the same as the class
think the exception is cake
I think so
https://github.com/Flo0/Ambrosia
Im still fiddling with the Spigot serializer so wait for one more release version before using it for that.
But it works and can be used for development.
this is my code:
if (e.getCurrentItem().equals(PlayerInteractListener.pyramidGlobal)) {
// Cancel the event
e.setCancelled(true);
// Checks if player is in world
if (p.getWorld().equals("lobby")) {
p.sendMessage(ChatColor.RED + "You can't locate POIs at spawn!");
} else if (p.getWorld().equals("world_nether") || p.getWorld().equals("world_the_end")) {
p.sendMessage(ChatColor.RED + "You must be in the overworld to locate POIs!");
} else {
// Set GPS target
Location l = new Location(p.getWorld(), 0, 0, 0);
p.setCompassTarget(l);
}
// Close GUI
p.closeInventory();
}
when i click on pyramidGlobal tho it just closes the gui why is that?
did the compass target change
no and when i'm in the world "lobby" it doesnt even send the error message "You can't locate POIs at spawn!"
do you close the GUI anywhere else
nope
can you show full code
is it possible to set textures for a block via durability in 1.12.2?
no
i assume you mean held blocks
and not placed
then how do I make a texture for the block without replacing the block itself?
I have an item and I want it to be placed as a block
here
Models are three-dimensional shapes used in Minecraft which are used to display objects encountered in the game.
The models pertaining to the vast majority of blocks and items can be configured, as well as those of a small selection of entities. Models are stored as JSON files in a resource pack in the assets/<namespace>/models folder.
Alright, uh
I hope you have plans to refactor this
you may have the wrong item?
double check
@rough ibex
I have already exported my model in blockbench as an item/block model
maybe it can already be placed
go in threads both of you, thanks
yep ok
what is the issue
then why did you post here
but it from Mythicmobs
dont crosspost
Ohhhh this channel for Own Built plugin issue
yes
okk i removed
How do you handle the "problem" that the SQLite JDBC weighs around 12mb? (It obviously needs to be shaded)
Use the libraries feature in plugin.yml
So, do you mean having a libs folder?
?
you can use the library property in plugin.yml
it downloads the library from maven central on server start
you can do this with every library, you just have to define its scope in maven as "provided"
no need for an external lib
π
Spigot has it shaded it in already
im making a reload command for my plugin but when i type it i get this in console
this is my code:
// Reload Command
if (cmd.getName().equalsIgnoreCase("ptreload")) {
// Reload the plugin
Plugin plugin = Bukkit.getPluginManager().getPlugin("PlutoTools");
Bukkit.getPluginManager().disablePlugin(plugin);
Bukkit.getPluginManager().enablePlugin(plugin);
// Send success message
if (sender instanceof Player) {
Player p = ((Player) sender).getPlayer();
p.sendMessage(ChatColor.GREEN + "PlutoTools successfully reloaded!");
} else if (sender instanceof ConsoleInput) {
getLogger().info(ChatColor.GREEN + "PlutoTools successfully reloaded!");
}
return true;
// Daily Command
}```
This will inevitably lead to problems eventually.
Anyways: Show your onEnable
how do most plugins like PlugMan do reloading then?
with prayer and high hopes
PlugMan is a perpetual problem generator.
Loading and Unloading plugins on runtime always leads to mind boggling problems down the line.
If you want to introduce a reload command, then you should implement a strategy which doesn involve unloading
the entire plugin.
they dont
they just reload configs
its not very easy to reload your plugin from inside if it
i simply have a list of reloadable components, voila as simple as that
indeed, one of the bugs that someone reported to me i couldn't figure it out why it happened for a while, then in a log i saw plugman and it clicked, on join a hashmap loaded player data and plugman disabled that
ah wait, i'm talking about perworld plugin
some plugins don't implement on disable properly
per world plugins can kindly go and fuck themself
I need help my jar is super big (most likely shading makes this)
Show your pom
So a multi module setup? Then just show the pom for the first module that gets big.
spigot: https://pastebin.com/38ZR2tLq
common: https://pastebin.com/RFg3EJPY
common doesn't seem to be that big
Is your maven shade plugin configured in the parent pom?
Why do you have so many spigot related dependencies in your common module?
well adventure platform api is for bungeecord too
Because you dont shade anything into it
oh yeah
I dont see anything out of order here.
If your code is statically analyzable, then you could try to minimize your jar.
This omits classes which are not used on runtime. Might lead to problems.
the maven shade plugin has a minimizeJar property in its execution configuration
my parent pom is this: https://pastebin.com/A39HWqGF
but ill try that minimizeJar thing
This should be ${java.version} btw.
Hey smile you know enough about classloaders right?
Is it possible to replace, let's say, the bukkit scheduler with a custom scheduler through funky classloading
No
:(
Plugins are loaded later when the bukkit scheduler is already loaded
HOWEVER
You can change the object that getScheduler returns
if it's final you'll need to get the field offset w/ unsafe and edit it with that, otherwise use reflections
And keep all others intact 
you can still do that, make a delegate Scheduler:
if the calling plugin is your plugin, delegate to your scheduler otherwise delegate to the default scheduler
least hacky way π
what do you need this for
Some dude's paying to add folia support
On an obfuscated premium resource
UniversalScheduler and move on
not my problem
I-
cant you replace the whole server instance? and override getScheduler()
because CraftScheduler
not really
that's overkill
not in kotlin
class CustomServer(private val server: Server) : Server by server { override fun getScheduler() = CustomScheduler() }
Yeah but that's still overkill
he has to know
fair
CraftServer is gonna kick your balls
uh no
i have no idea how the impl works but just give Bukkit.getServer() as delegate?
(CraftServer) Bukkit.getServer()
whats the problem, Server is an interface or atleast abstract class
i have no idea
i hope those are methodhandles
Ah I gotta add params
cool this works
hacky shit
I wonder how UniversalScheduler is gonna play with having the bukkit scheduler reroute to itself
hm
need to add a bunch of rerouty stuff
what's this universal scheduler for?
folia shit
yeah
i can't think of a reason on what can this be useful for
but I'm using UniversalScheduler
the idea is that you just rewrite all your schedulers to use this and it magically supports folia
problem is task ids are a thing
desynchcronization is also a thing
No Minestom support smh
I probably won't bother with folia
what on earth is folia?
π
folia is not even a word brothe...
well it is
La FolΓa (Spanish), or Follies (English), also known as folies d'Espagne (French), La Follia (Italian), and Folia (Portuguese), is one of the oldest remembered European musical themes, or primary material, generally melodic, of a composition, on record. The theme exists in two versions, referred to as early and late folias, the earlier being fas...
Thanks, I'll take a look soon!
Also, the paper people probably made an intentional typo on a word like "Foglia" (Latin for "Leaf") given the logo
Hello, is it possible to manipulate cherry leaves particle? (I want to change the color)
foglia is italian, folia is latin
Foglia is both Italian and Latin?
nevermind you're right
I got it wrong
SetDropItems doesn't work with items dropped from the barrel/chest π«
clear the inventory once you have dropped what you want
which one inventory? of Barrel?
fr bestie
yes
Inventory.clear()?
Hello! I am having a problem. Im writing an Interactable Item System.
The interactable item class extends ItemStack but I noticed that as soon as I give the object to the player the itemstack is no longer an instance of interactable item. Is there some way to fix this issue? Or is there another way to make it work? Is it possible to save the class into the item?
I don't want to create a listener for every item or create a list cause everytime the plugin is restarted the list is gonna reset
For starters you should not be extending itemstack
It still doesn't work If I clear barrel's inventory on breakblockevent
How could I do it then?
Add PDC to your items and work from there
What do I add to the pdc?
Is it possible to add a class?
Boolean I think
Whatever you want. I don't know what you're making, "interactable item" is a very broad statement
Why'd you add a c l a s s
Just add some identifier for the item to mark it as interactable
And then work with that
Already done so
So what's the problem
I need to know what identifier it is
You should not be extending bukkit classes unless they are explicitly for extension like BukkitRunnable
Whatever you want
Guys, im making a Override on tabComplete function of my command directly on commandMap, it is working fine.
- But how do i define a type for the argument, and how do i make the argument need to be one of those options
It doesn't work, items are still dropped when I break Barrel even if I try on break block event event.getBlock().getInventory().clear()
you don't define a type, you get a string and you parse it
Bro, im talking about type requirement in command execution
um, there is none?
You have to manually do that
If you mean to require, for example, an integer as your second argument, then just grab your second argument and verify that it's an integer
Theres command that gives you an error in client-side when it is not Integer(for example)
If you're not using a library like ACF, do it manually
int value;
try {
value = Integer.parseInt(args[1]);
} catch (NumberFormatException ex) {
...
}
But, how do i throw an error to client-side argument
I have an abstract class called interactableitem and other classes that extend that class. Every instance overrides an abstract method of the interactable item which I want to execute when the user right clicks with the item. I have a listener for the right click, how do I call the execute method?
Oh
Its literally throwing an error?
Yeah... Read the docs
Yeah? Just sender.sendMessage(whatever message you want); in the catch block
I suppose instantiate an instance of your item class with the itemstack in right click event and use it
Add a single value to the PDC, then listen for player interact event, if the item has a pdc, figure out where the method is (i.e. maybe have a Map<NamespacedKey, BiConsumer<Player, ItemStack>> or whatever) and call it
Good summary yup
Yeah but if you restart the plugin or the server the map would reset
Meaning that the object would not work
Don't understand what's causing the gradient to be "out of phase" when using more than 2 colors. Notice the red jumping to the right end. Works perfectly fine with 2 colors. Any idea what's causing that?
phase debug
if (animationDirection == AnimationDirection.LEFT_TO_RIGHT) {
phase = (phase - getAnimationSpeed() < -1) ? 1 : phase - getAnimationSpeed();
} else {
phase = (phase + getAnimationSpeed() > 1) ? -1 : phase + getAnimationSpeed();
}```
That being in a repeating task
uH
Some color offset missing, i've seen acer's keyboard program having a similar issue sometimes
Is it against rules to move BungeeCord chat module into my project under my package name?
yeah, but you can repopulate it just like you did previously?
why would you do that
i mean shading exists
Comfort for my brain
you are missing a number
Okay but is it against rules or license or not?
read the license
i did at least 3 times XD
but i want to make sure
Hello, how to change the color of cherry leaves particle?
if the license tells you its okay, do it if you really need to
resource packs
humm
which?
Can i sell project then when i use this?
YouΒ mayΒ notΒ useΒ theΒ softwareΒ forΒ commercialΒ softwareΒ hostingΒ servicesΒ without
writtenΒ permissionΒ fromΒ theΒ author.
also, you go to 1.0 and then you are going down back to zero
when it should be positive going to 1
" commercial software hosting " i dont do software hosting so i take it "yes i can" or "no you dont"
It just didn't fit on the last screen
Sorry I don't get your idea. When do you think I should add the items to the map?
you might wanna send up a message to the staff team / md5 then
or just not do it
because why the hell
is that the end or the beginning of it?
if that is the beginning that is fine, but you are worried about the end, which I am telling you it does a large jump but then after the large jump it goes in the wrong direction
it should go from -1 to 0 then to 0.1 going to 1.0
instead you are going from -1 to 1, then going down to 0.9
wait, I start at 0 and keep subtracting 1/16 until it reaches -1
so you say once it reaches -1 I should go back to 0 and up to 1, instead to 1 and down to -1 again?
well, that is what it should do. 1 is greater then anything less then 1, and I don't see why you are skipping 0? -1 to 1 is a skip of a single number. You gradually decrease but then you jump to a whole number and then gradually decrease again?
to me, it makes sense that it gradually decreases and then increases gradually
Just a bit confused as this way it works perfectly fine when only using 2 colors
probably because it is noticable
the more colors you use, the more time it should take to go through all the colors
it also would make number skips more noticable the more colors there are
onEnable
also, it depends how longg of time there is to do all the changes vs how many colors there are
if you use 2 colors, and there is 10 seconds for the entire transition, this means both colors get 5 seconds
if you added 3, this shortens the amount of time each color gets for the transition
if the time isn't increased
that's basically the function or am I wrong? Just for my understanding
idk what you mean about function
the phase cycle
yesn't
The line going downwards shouldn't exist, but it still illustrates what it should do
If an item doesn't have item meta, how to add one to it??
ItemStack#setItemMeta
an item should always have an item meta, unless it's air from what I remember
and air can't have an item meta
pong
photoshop god xD :D
ms paint... :)
even better :D
Is the discussion about that gradient still going on, or was this for something else?
still going on
can't figure it out tbh
I fought cycling the phase from -1 to 1 should make a perfect loop no matter the amount of colors
Did you make sure that they are all evenly spaced?
Also, how are you combining/interpreting between colors?
that's neat
Is the Player class the same when a player disconnects and then reconnects?
no
Thanks, I now know where my mistake came from.
save the uuid instead
seems it has a flaw then
probably better off just creating your own implementation
is it bad that I basically have two classes with the same exact code just different names
If they are trying to achieve the same function then yes
I mean they are trying to, but it's for like a different thing
Otherwise not really, separation of concerns makes your code readability higher and easier to manage
actually it isn't that bad it's just one method
You could extend
I could make an abstract skeletal class
If itβs a single method inside a whole class you could probably just keep them local
Lol
but going through that process made me run into naming issues
I mean
Like I said if itβs a single method then you donβt need a whole class haha, just condense until your concerns require multiple classes
Also yeah you could do this as well, but I mean it just depends what the goal is
True
I donβt think youβre gonna extend any local classes unless theyβre interfaces right? I mean I certainly have never had an issue otherwise
Just keep it one class
Agreed
how get Recipe key from craftItemEvent without nms
Not always
people care a bit too much about DRY sometimes
you should probably have an interface that both share
would be redundant only because what stops you from using that first class?
and why would you need two classes if the code is the same
it makes sense from an interface perspective but not implementation
this is my code:
String url = "http://textures.minecraft.net/texture/17d7b3c8e5735b0da3db74abfdce870c2e904689f5cb2c29bcd2a51ed71fddff";
dance.setItemMeta(getSkull(url));
public ItemStack getSkull(String url) {
ItemStack skull = new ItemStack(Material.PLAYER_HEAD, 1, (short) 3);
if (url == null || url.isEmpty())
return skull;
ItemMeta skullMeta = skull.getItemMeta();
GameProfile profile = new GameProfile(UUID.randomUUID(), null);
byte[] encodedData = Base64.encodeBase64(String.format("{textures:{SKIN:{url:\"%s\"}}}", url).getBytes());
profile.getProperties().put("textures", new Property("textures", new String(encodedData)));
Field profileField = null;
try {
profileField = skullMeta.getClass().getDeclaredField("profile");
} catch (NoSuchFieldException | SecurityException e) {
e.printStackTrace();
}
profileField.setAccessible(true);
try {
profileField.set(skullMeta, profile);
} catch (IllegalArgumentException | IllegalAccessException e) {
e.printStackTrace();
}
skull.setItemMeta(skullMeta);
return skull;
}```
why does it say required type ItemMeta provided type ItemStack at `dance.setItemMeta(getSkull(url));`?
You're returning an ItemStack and expecting an ItemMeta
https://pastes.dev/5O7TJXPxKw suppose there is such a method to replace a mob ```java
@Override
public void write(ChannelHandlerContext channelHandlerContext, Object packet, ChannelPromise channelPromise) throws Exception {
if (packet instanceof PacketPlayOutSpawnEntityLiving) {
System.out.println("spawneddd");
Field idField = packet.getClass().getDeclaredField("c");
idField.setAccessible(true);
int id = idField.getInt(packet);
System.out.println(id);
if (id == 102) {
replaceEntity(FakeZombie::new,"zombie", EntityTypes.ZOMBIE, "ZOMBIE", EntityZombie.p());
}
}
super.write(channelHandlerContext, packet, channelPromise);
}``` how to make a zombie look like a player in 1.16.5? It is currently being replaced by a pig
how do i fix it?
That's not exactly how it works
thought this was a help channel ngl
but if I replace it entity id with the id of some player, for example, it will kick me with an error
I believe that in 1.16 fake players require a different packet
IIRC
However, player metadata and a bunch of other factors are completely different
So you'll have a lot of issues if you just try to "replace an entity" rather than making one from scratch
then why is it being replaced with a pig?
no
The spawn entity packet has an entity type field
but again, I can't just replace it with the ID of the player on the server, otherwise it will be "cant interact" error
We help people, we don't babysit them. I gave you pointers to what's causing you trouble, your own IDE will tell you the same. Asking me how to fix one of the most basic issues out there screams to all of us that you don't know the minimum required
When we help people we expect them to know the bare minimum
Yeah I wouldn't suggest this approach entirely
What you can do is intercept the packet, get the entity ID, cancel the packet and spawn a custom player from scratch with the same entity ID
Sending brand new packets
And even then I wouldn't use the same entity ID due to entity metadata packets causing the possibility of client disconnects / crashes
if I spawn a fake player/npc with the same ID as a zombie, what happens?
can I send entity destroy packet for zombie
or hide it somehow
can you strike lightning that only exists for ?? ticks?
for example 10 tick lightning
Yeah the entity destroy packet is the same for everyone
Hello, how can I teleport smoothly (for 0.05 block every tick) because it's not really good looking
Run a task every tick and interpolate
public double calculateAxis(int tick, int totalTicks, double scale) {
return (double) tick / totalTicks * scale;
}
Simple lerp
whaat ?
Run a task every tick
yeah I know that
your scale is the total distance between start and end
I want to make something smooth like the cherry leaf particle
i feel nooby for asking this but like how do i execute methods from another one of my plugins which is on my server. Not sure how it all works cuz its saying the class wasn't found, although the JVM should've loaded it
Are both plugins enabled, one (soft)depend[s] the other?
yep, both are loaded and my sub plugin is dependant on the main
and is being loaded before it is
made sure of that
Might be some niche classloading issue, have you tried restarting the server?
look
Also make sure you're not shading one in another
I'm already doing that
i have tried to restart, and i've also looked at shading and it seems all fine. I ain't shading anything π
scheduler.runTaskTimer(plugin, task -> {
Location nextLocation = leaf.getLocation().add(nextx, FALL_SPEED, nextz);
if(!nextLocation.getBlock().getType().isAir()){
leaf.remove();
task.cancel();
} else {
leaf.teleport(nextLocation);
}
}, 1L, 1L);```
actually feel dumb cuz i've done this before but every resource i've came across they grabbed the JavaPlugin which is dumb imo, just wanted to make sure you didn't need to do that
but it's slower
I'd probably grab the javaplugin yeah
why do you need to do that exactly? What does that change?
since i'm not trying to execute anything from that class
Try it
Sub-Plugin: Bukkit.broadcast"${player.getData()}".parse()) // getData and parse is from the main plugin
Main: fun Player.getData(): PlayerData = playerDataManager.getData(this)
legit all it is cuz i was testing
and cannot find the class
so, any idea?
do i just use tasks and kill the lightning
Can I recalculate the damage in EntityDamageByEntityEvent? I change the attacker's hand item (e.g. from an enchanted sword to an unenchanted one) and I expect the final damage to change, but it doesn't, probably because it is not recalculated afterward. Is it possible to do so?
Hi, can anyone recommend me a spigot template with already all the config system etc like something like this although this is for mods https://github.com/jaredlll08/MultiLoader-Template
how to cancel packet?
I use Visual Studio Code should go?
I don't recommend using VSCode for Java
You should use a proper IDE like Intellij or Eclipse
I'm aware that VSCode is popular
but not for Java
It's good for web development and languages that don't have good purpose built IDEs
Does anyone know why EntityExplodeEvent sometimes doesn't return all broken blocks?
I did a lot of stuff in Java with it and never had any problems
It's just less efficient
the tooling is worse
but if you really want to keep using VScode I won't stop you
Thank you I have the same
I'm trying to replace non-players chat messages using packets
public class DisguisedChatPacketListener implements SimplePacketListener {
@Override
public PacketType packetType() {
return PacketType.Play.Server.DISGUISED_CHAT;
}
@Override
public void register(JavaPlugin plugin) {
ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(plugin,packetType()) {
@Override
public void onPacketSending(PacketEvent event) {
PacketContainer packetContainer = event.getPacket();
String json = packetContainer.getStrings().read(0);
if(json == null) return;
String text = Utils.readJsonField(json,"text");
json = json.replace(text, Utils.convertText(text,event.getPlayer()));
packetContainer.getStrings().write(0,json);
event.setPacket(packetContainer);
}
});
}
}```
I'm testing for example doing /pl for see what I get, and I get no errors, but message isn't replaced. Do somebody can help me? :-)
Wouldn't it be a wrapped chat component?
Do you mean?
@Override
public void register(JavaPlugin plugin) {
ProtocolLibrary.getProtocolManager().addPacketListener(new PacketAdapter(plugin,packetType()) {
@Override
public void onPacketSending(PacketEvent event) {
PacketContainer packetContainer = event.getPacket();
String json = packetContainer.getChatComponents().read(0).getJson();
if(json == null) return;
String text = Utils.readJsonField(json,"text");
json = json.replace(text, Utils.convertText(text,event.getPlayer()));
packetContainer.getChatComponents().write(0, WrappedChatComponent.fromJson(json));
event.setPacket(packetContainer);
}
});
}
}```
Hello, how can I get the biome leaves color?
how to get the texture and signature of the 128x128 skin?
I found this, but is there an easier system since this thread?
https://www.spigotmc.org/threads/get-biome-leaves-tint-color.630748/
No
Yep, tried until now. Opened a ticket now. Doesn't make sense to me that it works with 2 colors but not with more.
Not sure but I think they have an issue here https://github.com/KyoriPowered/adventure/blob/main/4/text-minimessage/src/main/java/net/kyori/adventure/text/minimessage/tag/standard/GradientTag.java
okay thanks
Are you trying to libraries hibernate
You have to set their class loader to spigots
For the entire hibernate config
Ill find the method when im home give me like 10 min
Does anyone know why EntityExplodeEvent sometimes doesn't return all broken blocks?
@EventHandler (priority = EventPriority.MONITOR)
public void onEntityExplode(EntityExplodeEvent e){
if (!(e.getEntity() instanceof EnderCrystal)) return;
EnderCrystal crystal = (EnderCrystal) e.getEntity();
Block crystalBlock = crystal.getLocation().getBlock();
System.out.println("--------------------");
if (blocks.containsKey(crystalBlock.getLocation()) && UnbreakableManager.existList(blocks.get(crystalBlock.getLocation()))) {
if (crystal.getCustomName() != null && crystal.getCustomName().equals("crystal")) {
String listName = blocks.get(crystalBlock.getLocation());
for (Block block : e.blockList()) {
UnbreakableObject unbreakableObject = UnbreakableManager.getListByName(listName);
System.out.println(block.getType().name());
if (unbreakableObject.getBlocks().contains(block.getType().name())) {
e.blockList().removeIf(blockList -> blockList.getType().equals(block.getType()));
blocks.remove(crystalBlock.getLocation());
}
}
System.out.println("--------------------");
}
}
}
--------------------
STONE_BRICKS
STONE_BRICK_STAIRS
--------------------
--------------------
STONE_BRICKS
STONE_BRICK_STAIRS
--------------------
--------------------
STONE_BRICKS
STONE_BRICK_STAIRS
--------------------
--------------------
STONE_BRICKS <--------------- STONE_BRICK_STAIRS BROKEN
--------------------
--------------------
STONE_BRICKS
--------------------
You are not checking all broken blocks there. You cant make the assumption that "EntityExplodeEvent sometimes doesn't return all broken blocks" with this code.
@solar musk in something i used i had .applyClassLoader(this.getClass().getClassLoader()) being called on org.hibernate.cfg.Configuration
how does the bukkit scheduler, like, tick?
To debug this i would recommend first cleaning up your code.
You should make use of safeguard statements:
if(!condition) {
return; // Or break; Or continute; based on your logic
}
And you should create new variables to reuse them.
yeah thank you (:
The Server has a main thread executor which is scheduled to go over a collection of tickables every 50ms.
Spigot simply adds its own object in there, which gets then called every tick.
damn
so, there is nothing like a tick method in the CraftScheduler or anywhere in that package?
What do you need that for?
I was going through it to see if I can rewrite it a bit to run on fabric or forge
it's a cool thing so I thought why not
Hello, I've got this nms code :java Biome biome = CraftBlock.biomeToBiomeBase(, location.getBlock().getBiome()).value();
What do I need to put in first arg? It requires a net.minecraft.core.Registry<net.minecraft.world.level.biome.Biome>
I just skimmed through nms real quick and this is the best i could come up with:
ServerLevel serverLevel = ...;
Registry<Biome> biomeRegistry = serverLevel.registryAccess().registry(Registries.BIOME).get();
Tell me if this works
Okay I'm going to try thanks
HEY CAN TOU HELP ME PLEASE ?
hey can anyone tell mee how i can enable offhand item swap
i dont know why it is disabled in my server
XD
So I've got that:```java
ServerLevel level = ((ServerLevel) location.getWorld());
if(level == null) return 0;
Registry<Biome> biomeRegistry = level.registryAccess().registry(Registries.BIOME).get();
Biome biome = CraftBlock.biomeToBiomeBase(biomeRegistry, location.getBlock().getBiome()).value();
return biome.getFoliageColor();```
chill out dawg
#help-server <- Ask there
I ALREADY ASKED
so wait
OHK
its been 4 minutes since you answered a question, calm down
π
This wont work
org.bukkit.inventory.ItemStack diamond_helmet = new org.bukkit.inventory.ItemStack(Material.DIAMOND_HELMET);
diamond_helmet.addEnchantment(Enchantment.PROTECTION_FIRE, 4);
``` how to make a helmet invulnerable so that zombies don't burn
I need to use .getLevel after the cast?
- Cast to CraftBukkit implementation
- getHandle on CraftBukkit object
oh okay thanks
set the unbreakable tag
CraftBukkit... ?
diamond_helmet.getItemMeta().setUnbreakable(true);?
what ?
@inland whale You have been hereby warned. Dont spam channels unrelated to your issue and pls refrain from using capslock.
7smile7 you're staff? congrats
sorry i didnt meant to
hes been staff for months
he told that he knows so i told him to come to server section
i forgot the answer
ohk
depend on spigot not spigot-api
No need of reflection, I use spigot using moj maps
World bukkitWorld = ...;
CraftWorld craftWorldImpl = (CraftWorld) bukkitWorld;
ServerLevel nmsWorld = craftWorldImpl.getHandle();
Spigot: X
CraftBukkit: CraftX
NMS: .getHandle() on CraftX
The zombie continues to burn
yup 7smile described it perfectly
and similar would work with many other structures in minecraft
did you actually put the helmet in their helmet slot..?
with a .getHandle() function
okay thanks, X is my version?

Its a generalization for the pattern
oh okay thanks
X = World
in your case
that doesn't look like it's burning
?nocode
Itβs hard to answer a programming question without code
Oh no! You ran into a problem. But no worries, people are willing to help, but first they need to see your code. This is because otherwise, they would be providing help based on guesses instead of concrete knowledge. Whether it be a compile error, runtime error, or an unexpected output, I'm sure that if you were to provide code, you'd receive a quick solution.
yes ```java
org.bukkit.inventory.ItemStack gold_helmet = new org.bukkit.inventory.ItemStack(Material.GOLDEN_HELMET);
gold_helmet.addEnchantment(Enchantment.PROTECTION_FIRE, 4);
gold_helmet.getItemMeta().setUnbreakable(true);
PacketPlayOutEntityEquipment helmet = new PacketPlayOutEntityEquipment();
List<Pair<EnumItemSlot, ItemStack>> list1 = new ArrayList<>();
list1.add(new Pair<>(EnumItemSlot.HEAD, CraftItemStack.asNMSCopy(gold_helmet)));
setField(helmet, "a", entityID);
setField(helmet, "b", list1);
for (Player p : Bukkit.getOnlinePlayers()) {
PlayerConnection conn = ((CraftPlayer) p).getHandle().playerConnection;
conn.sendPacket(helmet);
}
@cinder abyss X could also be Player
bro
He is doing it again
what did i say about the meta
oh okay thanks
He is mixing virtual and physical entities again.
get the meta, set its unbreakable state, then set the meta back into the item
you're gonna have a hard time doing nms without knowing how to deal with api itemstacks
damn
He has been doing this for like a month now.
Spawning something in the world and then sending packets to the player, wondering why the server
doesnt pick it up.
packets are like whispering to a player @sterile flicker
using the api, is gonna let the server understand whats going on
if ever possible use the api
and avoid packets
So, it's good?```java
World bukkitWorld = location.getWorld();
if(bukkitWorld == null) return 0;
CraftWorld craftWorldImpl = (CraftWorld) bukkitWorld;
ServerLevel nmsWorld = craftWorldImpl.getHandle();
Optional<Registry<Biome>> biomeRegistry = nmsWorld.registryAccess().registry(Registries.BIOME);
if(biomeRegistry.isEmpty()) return 0;
Biome biome = CraftBlock.biomeToBiomeBase(biomeRegistry.get(), location.getBlock().getBiome()).value();
return biome.getFoliageColor();```
Looks good
okay thanks
I removed craftWorldImpl to directly use it in nmsWorld
ServerLevel nmsWorld = ((CraftWorld) bukkitWorld).getHandle();
Should i put all the data of a player in one playerdata class or Split it up?
Depends if you want the data to be relational or not
okay
Hello so , again iam facing a problem .. with time and date ..
so i have this :
so when a user didn't claim the package it will say is not claimed .. etc
when user claim it :
it should display the time left till he can open it again..
but there is a problem the timer dissaper when the user log out , and log in again its all 0 ..
in the database it looks like this :
This is what iam using rn :
the getStartedDate is the when user clicked on the package and claimed it
and the getTime is the Package time.
my problem is when a user log out , log in again it display the time left as :
0 day , 0 hour , 0 minute .. etc and that's wrong!
@lost matrix is it good if I copy paste the code from 1.20.2+ method to my 1.20.1 method?
public static net.minecraft.world.level.biome.Biome bukkitToMinecraft(org.bukkit.block.Biome bukkit) {
return bukkit != null && bukkit != org.bukkit.block.Biome.CUSTOM ? CraftRegistry.getMinecraftRegistry(Registries.BIOME).getOptional(CraftNamespacedKey.toMinecraft(bukkit.getKey())).orElseThrow() : null;
}```
This is how i load it from database :
@twin venture find out at which point its not going right by logging
?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.
You're using a Paper system ask Paper
ah yeah that's true :kekw:
Did you shade InvoiceCore into your plugin?
Wait... he interrupted the classpath joining
this is my code for a bunch of GUIs i made:
but the issue is i can still move an item into the gui, how can i fix it since i need it to be locked? (the last else if statement is my best attempt at it)
In your GUI no items should be movable, right?
no there arent any
Well then... just always cancel the click event if the inventory is a GUI of yours.
i did that at the end tho:
else if (e.getClickedInventory().equals(CommandExecutor.gpsBuyGUI) || e.getClickedInventory().equals(CommandExecutor.voteGUI) || e.getClickedInventory().equals(CommandExecutor.emoteGUI) || e.getClickedInventory().equals(PlayerInteractListener.gpsGUI)) {
e.setCancelled(true);
}
but it still didnt fix from moving items into the gui
they would get locked once they were in but they could still be moved in
