#development
1 messages · Page 49 of 1
I'm not sure whether you can bypass this limit in the tablist
I'm afraid you'll have to update the position manually
nametagedit did it
i've tried too 
but if the as is passenger
It probably supports it
I can't modify the position
Yeah TAB still supports 1.8, so check it's source code
i've already tried tab, in 1.8 they block the nametags with more than 16
wdym by this?
if I set the armorstand passenger, then tp it lower, it wont work ( no error ofc )
and if I tp first the as then set the as passenger, it will be too high
I'm afraid you can't do it simply by setting it as a passenger
iirc most servers just sent the packets manually instead of spawning a real entity to avoid lag
So you will have to send a packet to spawn an armor stand and then update it's position each tick (ideally async)
uh
by updating the position, you mean tp it ?
well
This sometimes bugs out and leaves "ghost" names in the air
the problem is that for custom ranks, a player who wants to make a lot of colors, they can't
because there will be an error showing that the prefix is too long
I already seen the website but I still don't understand
What don't you understand?
how to use what they written
You will have to use NMS
Or ProtocolLib (I'm not sure whether it still supports 1.8)
By doing packetplayout ?
yes
okay
ok uh
I'm really not good with nms
I have to initialize the entityliving before the packet ?
I don't know
oh
I've used 1.8NMS several years ago
I'm doing a RTP plugin and I don't want players to teleport to lava / water:
fun getRandomLocation(world: World) : Location {
val x = (minX..maxX).random()
val z = (minZ..maxZ).random()
val y = world.getHighestBlockYAt(x, z)
val selectedBlock = world.getBlockAt(x, y, z)
if(selectedBlock.type.isSolid) {
return Location(world, x.toDouble(), y.toDouble(), z.toDouble())
}
return getRandomLocation(world)
}
I'm doing a recursive call but I wonder is it dangerous? Or is there any better way than that?
maybe you could verify if the block at the location of the r location is lava or water ? Idk
im not sure sorry
I'm already checking it with isSolid
oh ok
Maybe I would add a limit for how many times it can run
Before you would reach stack overflow, you would most likely crash the server by loading the chunks
If I get an image from an endpoint X and process it for example to modify colors, extract sections, or whatever, would it be a good idea to use something like this so it's removed after some time of not being used? The question is what happen if the image "linked" to the key is updated, i'd would take 5 minutes after write to be deleted so it can be cached again?
public Cache<String,MyClass> avatarCache = CacheBuilder.newBuilder().maximumSize(100).expireAfterWrite(5, TimeUnit.MINUTES).build();
Question is actually what would be the best way?
unless you manually invalidate and refresh it, yes that's what will happen
"best way" depends on your design goals and constraints
In few words the scenario is this:
Player joins > checks if current name or texture (string) is in cache > uses the data and creates something with it > if not in cache, requests the image skin and process it and add it to cache and create something with it
should prolly use a loading cache instead of doing the checking yourself
idk about guava, but with caffeine there's a build method that takes an asynccacheloader or whatever, guava is like old caffeine so it should have something similar
LoadingCache<String,List<String>> cache = CacheBuilder.newBuilder().maximumSize(100).build(new CacheLoader<String, List<String>>() {
@Override
public List<String> load(String key) {
return getListFromEndPointAndProcess(key);
}
});```
something like that?
sure
then when you request a value from the cache, it will use the loader if there's nothing for the key
just wondering, thats async? 
idk how guava works but if the whole loading thing is similar to that of caffeine, no

api-version: 1.20?
minecraft version in this case wouldnt matter afaik
it should just pick them up
1.20 blocks/items do show up in Material
thats what I thought I must be missing something
@EventHandler
public void onPlayerChat(AsyncPlayerChatEvent event){
Player player = event.getPlayer();
String format = PlaceholderAPI.setPlaceholders(player, "%luckperms_prefix%%player_name%%luckperms_meta_chatcolor%: ");
event.setFormat(format + ChatColor.stripColor(event.getMessage()));
}
somehow when ever player chat %
it throws an error
or anything related to %
You need to use %1&s for player name and %2&s for the actual message.
i don't really understand this can u explain a bit further?
If you are changing the format, you need to use those two placeholders. You'll also need to use %% instead of a single one otherwise it complains.
im preventing player from being able to use placeholdersapi in the chat
while still be able to send % related
I haven't tested or anything but shouldn't you use setMessage(ChatColor.stripColor(event.getMessage()))?
and event.setFormat(format + "%2&s")? (I think that's what @bright pier meant?)
idk what the &s is tho
now it just thows full error
can u show code and error?
Player player = event.getPlayer();
event.setMessage(ChatColor.stripColor(event.getMessage()));
String format = PlaceholderAPI.setPlaceholders(player, "%luckperms_prefix%%player_name%%luckperms_meta_chatcolor%: ");
event.setFormat(format + "%2&s");
it now show Conversion = '2' error
what if you do System.out.println(event.getFormat()) at the top
to see the default
ohh its $ not &
try ```java
Player player = event.getPlayer();
event.setMessage(ChatColor.stripColor(event.getMessage()));
String format = PlaceholderAPI.setPlaceholders(player, "%luckperms_prefix%%1$s%luckperms_meta_chatcolor%: ");
event.setFormat(format + "%2$s");
now it came to Conversaion = 'l'
[OWNER] porudev: Hello!
is what i expected
or [OWNER] porudev: 50%
[OWNER] porudev: %luckperms_prefix%
can u show the full error?
Use https://paste.helpch.at/ for errors, logs and configs. So we don't spam the discord.
lol
Player player = event.getPlayer();
String format = PlaceholderAPI.setPlaceholders(player, "%luckperms_prefix%%player_name%%luckperms_meta_chatcolor%: ");
event.setFormat(format + ChatColor.stripColor(event.getMessage()));
doing this seems perfectly fine
oh
Player player = event.getPlayer();
event.setMessage(ChatColor.stripColor(event.getMessage()));
String format = PlaceholderAPI.setPlaceholders(player, "%luckperms_prefix%%1$s%luckperms_meta_chatcolor%: %2$s");
event.setFormat(ChatColor.translateAlternateColorCodes('&', format));
try this
try ```java
Player player = event.getPlayer();
event.setMessage(ChatColor.stripColor(event.getMessage()));
String format = PlaceholderAPI.setPlaceholders(player, "%luckperms_prefix%%1$s%luckperms_meta_chatcolor%: %2$s");
System.out.println("Format: " + format);
event.setFormat(format);
let me try
back to the Conversion error
but does it print out Format: blah?
Format: §c[OWNER] %1$s%luckperms_meta_chatcolor%: %2$s
oh
so thats not being converted
wait
nvm
wait
why don't you just leave format blank
idk how does AdvancedChatTorch manage to do it
and put everything in message
oh
why isn't that placeholder being converted 🤔
is that a valid meta thingy?
what if you do /papi parse me %luckperms_meta_chatcolor%
because %1$s%
is overriding it
ok i have an idea lol
i remove the weird symbol
and now it give me just [OWNER[
what symbol-
[OWNER] : %
with no error
String format = PlaceholderAPI.setPlaceholders(player, "%luckperms_prefix%%luckperms_meta_chatcolor%: %2$s");
change it to this
try ```java
Player player = event.getPlayer();
event.setMessage(ChatColor.stripColor(event.getMessage()));
String format = PlaceholderAPI.setPlaceholders(player, "%luckperms_prefix%supercoolplayerwoooooooo%luckperms_meta_chatcolor%: %2$s");
event.setFormat(format.replace("supercoolplayerwoooooooo", "%1$s"));
🥴
trust
i just need to add %player_name%
oh
What could be going wrong with this code? It's not spawning the armorstand...
return loc.getWorld().spawn(loc, ArmorStand.class, armorStand -> {
armorStand.setGravity(false);
armorStand.setCanPickupItems(false);
armorStand.setArms(true);
armorStand.setBasePlate(false);
armorStand.setCanMove(false);
armorStand.setVisible(true);
armorStand.setItem(EquipmentSlot.HEAD, ItemBuilder.skull().owner(player).build());
armorStand.setItem(EquipmentSlot.CHEST, ItemBuilder.from(Material.LEATHER_CHESTPLATE).color(Color.RED).build());
armorStand.setItem(EquipmentSlot.LEGS, ItemBuilder.from(Material.LEATHER_LEGGINGS).color(Color.RED).build());
armorStand.setItem(EquipmentSlot.FEET, ItemBuilder.from(Material.LEATHER_BOOTS).color(Color.RED).build());
});
the problem is that is too slow
armorStand = new EntityArmorStand(((CraftWorld) player.getWorld()).getHandle());
armorStand.setSmall(true);
armorStand.setCustomName(player.getName() + "§5test");
armorStand.setCustomNameVisible(true);
armorStand.setPosition(player.getLocation().getX(), player.getLocation().getY(), player.getLocation().getZ());
PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving(armorStand);
PlayerConnection connection = ((CraftPlayer)player).getHandle().playerConnection;
connection.sendPacket(packet);
main.getServer().getScheduler().runTaskTimerAsynchronously(main, () ->{
Double X1 = player.getLocation().getX();
Double Y1 = player.getLocation().getY();
Double Z1 = player.getLocation().getZ();
armorStand.setPosition(X1, Y1, Z1);
PacketPlayOutEntityTeleport teleport = new PacketPlayOutEntityTeleport(armorStand);
connection.sendPacket(teleport);
}, 0, 0);
the video is with 0 ticks
Perhaps you should set a vector instead of tping it?
I honestly don't know
Or you should do it in the player move event? Idk
with the playermoveevent it does the same thing, im trying with vectors
armorStand = (ArmorStand) player.getWorld().spawnEntity(player.getLocation(), EntityType.ARMOR_STAND);
armorStand.setSmall(true);
armorStand.setCustomName(player.getName() + "§5test");
armorStand.setCustomNameVisible(true);
armorStand.teleport(player.getLocation());
main.getServer().getScheduler().runTaskTimerAsynchronously(main, () ->{
armorStand.setVelocity(new Vector(player.getVelocity().getX(), player.getVelocity().getY(), player.getVelocity().getZ()));
}, 0, 0);
``` please help the armorstand wont even spawn
no error
As I've said, I don't know
wild thought
but
on move event
get the armor stand
and set armor stand velocity the same as player velocity
🦧
thanks, but anyone can tell me why the armorstand wont spawn please ?
also you're creating an async task to teleport the armor stand
hence why it lags back behind
I mean, it will be more lightweight
what is the best please ?
bruh
AsyncPlayerChatEvent or PlayerChatEvent ?
the playerchatevent is deprecated
I guess you answered yourself
in paper there's AsyncChatEvent iirc
you are most likely confusing PermissionManager or whatever with PluginManager
is this normal please ? https://imgur.com/y48BM6K
armorStand = (ArmorStand) e.getPlayer().getWorld().spawnEntity(e.getPlayer().getLocation(), EntityType.ARMOR_STAND);
armorStand.setCustomName("§6test " + e.getPlayer().getName());
armorStand.setCustomNameVisible(true);
armorStand.teleport(e.getPlayer());
@EventHandler
public void onMove(PlayerMoveEvent e){
Player player = e.getPlayer();
armorStand.setVelocity(new Vector(player.getVelocity().getX(), player.getVelocity().getY(), player.getVelocity().getZ()));
}
what do you want to do?
Have longer names above the player than what's allowed
ok, then attach the armor stand as passenger to the player?
They said it was too high
why are you creating new vector
just do armorStand.setVelocity(player.getVelocity());
same problem
what problem
armorstand.setGravity(false)
and then just teleport it to the player's location every time it moves
or a bukkit task that constantly teleports itself every tick
i'll test
whats the code for this?
armorStand = (ArmorStand) e.getPlayer().getWorld().spawnEntity(e.getPlayer().getLocation(), EntityType.ARMOR_STAND);
armorStand.setCustomName("§6test " + e.getPlayer().getName());
armorStand.setCustomNameVisible(true);
armorStand.setSmall(true);
armorStand.setBasePlate(false);
armorStand.setVisible(false);
armorStand.setGravity(false);
i ment the teleporting
you should also set it as marker
@EventHandler
public void onMove(PlayerMoveEvent e){
armorStand.teleport(e.getPlayer());
}
what ?
armorstand.setMarker(true)
what does it do ?
you teleport it higher
you modify the location that your teleporting it to and add to the Y coodinate
but the thing is that the as is too slow
tbh i have no idea why its not instantly teleporting to you
oh
ig you could try changing the teleport cause, it might make a difference
it doesn't change :/
are the positions of the as change anything on the position when it's passenger ?
[11:55:43 WARN]: [TestPlugin] Plugin TestPlugin v0.0.1 generated an exception whilst handling plugin message
java.lang.NullPointerException: Cannot invoke "me.clip.placeholderapi.PlaceholderAPIPlugin.getLocalExpansionManager()" because the return value of "me.clip.placeholderapi.PlaceholderAPIPlugin.getInstance()" is null
What is the problem? I have added the PlaceholderAPI in dependencies and 'plugins' folders.
you shade papi
?
then im not sure
Gaby means that you shaded papi in your plugin
Make sure its not like "compile", but "provided"
ok :/
you might be better off using packets to create the armorstand
cus it sounds like the teleport method at some point sends the move to packet instead of the teleport packet which is annoying
If an entity is teleported within 8 blocks of its previous position the move packet is sent instead of teleport.
which is what its doing
Yeah just providing context
id assume if you always sent the teleport packet instead of the move packet it would just teleport the armorstand instead of doing the moving thing
It still comes up with the same error.
<dependency> <groupId>me.clip</groupId> <artifactId>placeholderapi</artifactId> <version>2.11.3</version> <scope>provided</scope> </dependency>
Refresh maven
I'm pretty sure its the same. I think I had to resort to sending the remove and spawn packet within 8 blocks
Tried.
so on the same tick teleport the armorstand 8 blocks away and back again or just delete and remake the armorstand every tick?
actually if tab already does this might be better to just go look at the source
fucking old versions
Delete and remake. You can save the packets though so you aren't recreating them.
i didnt know you could update packets that are already created
since as far as i could tell there wasnt any setters in them
Recreate artifacts maybe, it prob stuck as compiled in it
I set the fields with reflection
Thought about it too. Still doesn't work.
Decompile your output .jar, it contains papi?
i thought so
Nvm I calculate the distance then use move or teleport depending.
i did consider that but wasnt sure if that was actually an option
doing 2 teleports on the same tick wasnt sure if that actually was possible
like if only one of the teleports would actually occur
Yeah.

can anyone tell me why this method doesn't work ? ( no error ofc )
e.getPlayer().setPassenger(armorStand.getBukkitEntity());
rip
Also, why.
Can I have some video guide, maybe I did something wrong?
it doesn't take much ram, and for now it's the best version i've tried bc on paper, I have a lot of problems, and in spigot it takes a lot of ram
lol
why ?
just to prevent being muted
because your logic is not logic
You deprive yourself from several features, security patches and more just to save up some tiny amount of ram??
uh
that version is almost 10 years old.
with spigot
your mistake in using spigot
in paper I have a lot of problems, for example this:
yes, you a lot of problems cause you are on an almost 10 year old version of minecraft
what do you expect
candies?
on paper 1.19.4*
this = ?
but I had
it happened to another person,
in another pc
on another connection
and it's on 1.19.4
paper is bad or is good ? Didn't understand exactly what you said
ig the answer is good
i'm gonna try paper for the idk time
1.15
bruh
paper and its forks are the best option in the market
Imagine using spigot in 2023
for maven what dependency should I use please ?
I have this:
https://www.spigotmc.org/threads/paper-with-nms-using-maven.334219/ ( Parozzz respond )
Hello, I reached out to you as someone who could help me solve an error in my code. Since the error occurs every time in the same situation, we know roughly what it is. But everything seems flawless. Who would be willing and good at programming java plugins for version 1.8.8 please? Debug show us that it occurred, but no other info except when. We have a minigame that has an arena. After restarting, when I join the arena, everything works correctly. You play, you die, the game ends, it teleports you to the location it's supposed to. The second game without restarting, after connecting, you will classically join the waiting spawn, and after the countdown, it will not connect you to the arena, but to a completely different world. So the first time it teleports me correctly after restarting and the second time it doesn't. I have no idea what it could be.
- don't use 1.8.8
- We need code, we are not akinator
int num = Utils.getRandomNumber(1, arena.getSpawns().size() - 1);
Location loc = arena.getSpawns().get(num);
Location telLoc = loc;
System.out.println(loc.getWorld());
System.out.println(loc.getY());
System.out.println(loc.getZ());
System.out.println(loc.getX());
System.out.println(telLoc.getWorld());
System.out.println(telLoc.getY());
System.out.println(telLoc.getZ());
System.out.println(telLoc.getX());
loc.subtract(0, -1, 0);
Block block = loc.getBlock();
loc = telLoc;
block = loc.getBlock();
block.setType(Material.AIR);
loc = telLoc.subtract(0, 1, 0);
block = loc.getBlock();
block.setType(Material.AIR);
Location save = telLoc;
save.setY(save.getY() - 1);
System.out.println("SAVE POZICE - " + save.getY());
save.getBlock().setType(Material.WOOL);
player.teleport(telLoc);
System.out.println(telLoc.getWorld());
System.out.println(telLoc.getY());
System.out.println(telLoc.getZ());
System.out.println(telLoc.getX());
player.getInventory().clear();
Utils.giveArenaItems(player, member.getColor());
player.setGameMode(GameMode.SURVIVAL);
cancel();
return;
}```
World world = worlds.get(arena.getName());
if (world == null) {
System.out.println("WORLD JE NULL!");
return;
}
Bukkit.unloadWorld(worldName, false);
world = Bukkit.createWorld(new WorldCreator(worldName));
Is creating an ItemStack in another thread (async runnable) a problem?
a simple new ItemStack() is not going to blow up your server, ig it depends what you want to do with that item 
Not at all, however as gaby mentioned, you should be running sync when using the itemstack
I'm doing a minion plugin and when loading minions from their files I'm using parallel streams and I load their main hand items too
bruh not a valdi reason, 1.8.8 pvpers are a low % of all pvp players nowadays
people understand 1.8.8 is outdated
Hypixel minions or normal? Just curious
Hypixel
👍
that looks like you created an armorstand with nms, did you make sure to actually spawn it before setting it as passenger?
yes, now I have another problem, the as is not spawning:
armorStand = new EntityArmorStand(((CraftWorld)p.getWorld()).getHandle());
armorStand.setCustomName(rmain.getPrefix(p.getUniqueId()));
armorStand.setInvisible(true);
armorStand.setPosition(p.getLocation().getX(), p.getLocation().getY(), p.getLocation().getZ());
PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving(armorStand);
for(Player pl : Bukkit.getOnlinePlayers()){
PlayerConnection connection = ((CraftPlayer)pl).getHandle().playerConnection;
connection.sendPacket(packet);
}
PlayerConnection connection = ((CraftPlayer)p).getHandle().playerConnection;
connection.sendPacket(packet);
((CraftWorld)p.getWorld()).getHandle().addFreshEntity(armorstand)
that will spawn the armorstand
actually, you could be trying to spawn it packet only, lemme see
uh what should i put please ?
armorStand = new EntityArmorStand(((CraftWorld)p.getWorld()).getHandle().addEntity(EntityArmorStand));
between the ()
it has an error
Expression expected
I have to do new EntityArmorStand ?
I guess you need to run that after you set all the properties to the armorStand
yes
But not the way you typed it
still not spawning
no error
World world = ((CraftWorld)p.getWorld()).getHandle();
armorStand = new EntityArmorStand(world);
armorStand.setCustomName(rmain.getPrefix(p.getUniqueId()));
armorStand.setInvisible(true);
armorStand.setPosition(p.getLocation().getX(), p.getLocation().getY(), p.getLocation().getZ());
PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving(armorStand);
for(Player pl : Bukkit.getOnlinePlayers()){
PlayerConnection connection = ((CraftPlayer)pl).getHandle().playerConnection;
connection.sendPacket(packet);
}
PlayerConnection connection = ((CraftPlayer)p).getHandle().playerConnection;
connection.sendPacket(packet);
addfreshentity might not exist for 1.8.8
id say dont spawn an invisible armorstand to start with
ye
just so you can check to see if its actually there or if the custom name failed and it just doesnt show it for whatever reason
tho why are you sending the packet twice?
nothing
uh
so everyone can see the packets
but if i do a for
all players can see
i'll remove ti
im just saying your sending the packet to the original player twice
yes
since they are included in the getonlineplayers
oh
it's spawning
it was just bc I sent the packet twice
makes sense
thanks
just remember because your spawning the entity with packets only, you will have to manually keep track of it
uh please, I made a task, to make the tp of the as, the problem is that when I join with my alt, the as of the alt is tping to both of players, here is my code:
task = Bukkit.getScheduler().runTaskTimerAsynchronously(main, () -> {
armorStand.setPosition(p.getLocation().getX(), p.getLocation().getY(), p.getLocation().getZ());
PacketPlayOutEntityTeleport teleport = new PacketPlayOutEntityTeleport(armorStand);
for(Player pl : Bukkit.getOnlinePlayers()){
PlayerConnection connection = ((CraftPlayer)pl).getHandle().playerConnection;
connection.sendPacket(teleport);
}
}, 0, 0);
are you keeping track which armorstand is assigned to which player?
I made a variable armorstand in the top of the code then I initialized it in the code when it spawns
You are sending the same armorstand teleport packet to all players with this
yeah you need to create one armorstand per player
I did this
private void setNametag(Player p) {
scoreboard = p.getScoreboard();
team = scoreboard.getTeam("-" + p.getName());
if (team == null) {
team = scoreboard.registerNewTeam("-" + p.getName());
}
team.setPrefix(rmain.getColor(p.getUniqueId()));
team.addEntry(p.getName());
armorStand = (ArmorStand) p.getWorld().spawnEntity(p.getLocation(), EntityType.ARMOR_STAND);
armorStand.setCustomName(rmain.getPrefix(p.getUniqueId()));
armorStand.setCustomNameVisible(true);
armorStand.setVisible(false);
armorStand.teleport(p.getLocation());
task = Bukkit.getScheduler().runTaskTimerAsynchronously(Bukkit.getPluginManager().getPlugin("Nametags"), () -> {
armorStand.teleport(p.getLocation());
}, 0, 0);
}
well since they use the armorstand for player's name, they need to send it to all players though (without the player for whom you display the name though)
I just read what luna said and added to it xD
that doesnt look like they are saving the armorstand's entity id or uuid anywhere to keep track of which armorstand to send to which player
Well they don't need to because they run a task for each player
ohh i see
which contains each armor stand
do I need to create a hashmap?
I wonder why when you add the armorstand as passenger, the name is so high
i already tested it before, it wasn't that high
i didnt think they were adding it as a passenger anymore?
yes
Name is still at the top of the entity
mind recording a small video or gif or smth of it occuring and posting it somewhere?
so i or others can understand exactly whats occuring
it is at the top, but uh, very high
- A riding slime with negative size 1 and a small armor stand riding the slime have the perfect height for showing something over the players head.
i think they want to replace the player's nametag with it
the time I tried with a slime block, I couldn't put less than 1 bc it died at the second I joined
have you set invincible = true?
and isn't the slime blocking while attacking ?
if it is invisible, no, it won't
can entity names be bigger then 48 character or is it only players that are limited to that?

well
only invisible exists
in the version i use
ahh it is invurnerable, not invincible
invulnerable toohttps://imgur.com/9DHlM2o
nvm 1.8 doesn't have that either lol
I could simply do that, right ?
@EventHandler
public void onDamage(EntityDamageEvent e){
if(e.getEntity() instanceof EntitySlime){
e.setCancelled(true);
}
}
how i can get list of server players on fabric/forge?
probably EntityDeathEvent
I can't cancel it
Did you try?
yes
public void onClickEvent(PlayerInteractEvent event) {
Player player = event.getPlayer();
if (event.getAction().equals(Action.LEFT_CLICK_BLOCK)) {
player.sendMessage(ChatColor.GRAY + "10 Seconds on the delay.");
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
player.sendMessage(ChatColor.GRAY + "5 Seconds on the delay");
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
player.sendMessage(ChatColor.GRAY + "Event Happens!");
//Ta Da!
}
}```
Hey all, what could I replace this with?
```Thread.sleep();```
I have no experience with making multiple threads so I'm looking to avoid that for now.
main.getScheduler().runTaskLater
and that won't pause anything or cause issues? 🙂 (Also thanks a lot of spent hrs trying to figure this out)
no it won't
no, but maybe it would be better if you try to runtasklater asynchro...(idk) idk
someone told me that it pause the entire server, I stopped using it
GabyTM
it's hiding my nametag
do you have an idea why please
?
Slime slime = (Slime) p.getWorld().spawnEntity(p.getLocation(), EntityType.SLIME);
slime.setSize(-1);
slime.setCustomName("test ");
slime.setCustomNameVisible(true);
slime.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 9999, 2, false, false));
slime.teleport(p);
p.setPassenger(slime);
perhaps because of the invisibility?
bruhhhhhhhh
I know how to do it wait
try setInvisible(true)
yes I'm trying by using:
EntitySlime slime1 = ((CraftSlime)slime).getHandle();
slime1.setInvisible(true);
negative size doesn't work...
wait
and invisibility too wtf ,
?
yeah the person said to use a slime and then add a small armor stand as passenger to the slime
I don't know much about NMS, so Idk why it doesn't work
like this ?
Slime slime = (Slime) p.getWorld().spawnEntity(p.getLocation(), EntityType.SLIME);
slime.setSize(-1);
slime.setCustomName("test ");
slime.setCustomNameVisible(true);
slime.teleport(p);
p.setPassenger(slime);
slime.setPassenger(armorStand);
EntitySlime slime1 = ((CraftSlime)slime).getHandle();
slime1.setInvisible(true);
yeah
also, why do you combine nms and spigot api like that? Just use NMS directly if you go on that direction
I'll test, but look at my screen wtf
the curse of using 1.8 
any ideas why loc.getWorld().spawn(loc, ArmorStand.class); doesn't spawn the armorstand?
player.getWorld().spawnEntity(player.getLocation(), EntityType.ARMOR_STAND);
idk how this works but is the chunk loaded?
it's for spawning an armorstand at a location, right ?
if so, then the method I gave is right
normally
confusion
why
apparently it's multiversecore?
but I didn't disable anything though
is the there a propriety for this?
I wonder what is the difference between spawn and create
@pulsar ferry any idea?
also, with the new name I can finally not mention someone else by accident 
One returns T other returns Entity, type safety is the difference
oh but the behaviour is the same?
Yeah
good to know, thanks bb
Does anyone know if Bukkit#performCommand triggers any event?
i want to show action bar every 3 second with different text (list<string>) and use placeholderapi in it how to do it
Send an action bar every 3 seconds?
Anyone able to tell me why it's doing this? It's driving me nuts and I've re wrote it twice now and I can't see what the issue is at all.
https://imgur.com/a/JdWOaxl
@EventHandler
public void onEntityDeath(EntityDeathEvent event) {
Player player = event.getEntity().getKiller();
if (!(event.getEntity() instanceof Vindicator))
return;
if (event.getEntity().getCustomName() == null)
return;
if (!event.getEntity().getCustomName().contains("Ivan The Immovable"))
return;
for (Entity entity : event.getEntity().getNearbyEntities(10, 10, 10)) {
player.addPotionEffect(new PotionEffect(PotionEffectType.CONFUSION, 200, 2));
player.sendMessage(ChatColor.GRAY + "Using his last ounce of strength Ivan hit the ground with as much strength as he could muster,");
new DelayedTask(() -> {
player.sendMessage(ChatColor.GRAY + "hitting you hard enough to leave a slight concussion.");
new DelayedTask(() -> {
event.getDrops().clear();
Random random = new Random();
int number = random.nextInt(1000) + 1;
Random randomEmerald = new Random();
int numberEmerald = random.nextInt(15) + 1;
Random randomEmeraldBlock = new Random();
int numberEmeraldBlock = randomEmeraldBlock.nextInt(7) + 1;
if (number < 600) {
for (int i = 0; i < numberEmerald; i++) {
event.getDrops().add(new ItemStack(Material.EMERALD));
}
Bukkit.broadcastMessage(ChatColor.translateAlternateColorCodes('&', "&7Congratulations " + event.getEntity().getKiller().getName() + " for slaying [&cIvan The Immovable&7] and getting the drop [&c" + numberEmerald + "&7] Emerald(s)"));
} else
for (int i = 0; i < numberEmeraldBlock; i++) {
event.getDrops().add(new ItemStack(Material.EMERALD_BLOCK, 1));
}
Bukkit.broadcastMessage(ChatColor.translateAlternateColorCodes('&', "&7Congratulations " + event.getEntity().getKiller().getName() + " for slaying [&cIvan The Immovable&7] and getting the drop [&c" + numberEmeraldBlock + "&7] Emerald block(s)"));
ItemStack ivansShield = new ItemStack(Material.SHIELD, 1);
ItemMeta ivansShieldMeta = ivansShield.getItemMeta();
ivansShield.setItemMeta(ivansShieldMeta);
Random randomShield = new Random();
int numberShield = randomShield.nextInt(100) + 1;
if (numberShield < 25) {
event.getDrops().add(ivansShield);
Bukkit.broadcastMessage(ChatColor.translateAlternateColorCodes('&', "&7Congratulations " + event.getEntity().getKiller().getName() + " You obtained the [&cIvan The Immovable's Shield&7]!"));
} else
return;
}, 20 * 3);
}, 20 * 4);
}
}
ye with different message
again(show action bar => 3 seconds => show action bar with different text )
?paste
Paste Services
When asking for help with a config/menu/code issue please use our paste bin:
(we prefer it over pastebin.com)
• HelpChat Paste - How To Use
You could use a join event.
//Code for first one
new DelayedTask(() -> {
//Code for second one
//etc
}, 20 * 60 * 3);
}, 20 * 60 * 3);
probably not the best solution though.
How would you make it impossible to get the armor of armor stands?
cancel interact event
PlayerInteractEntityEvent?
or just PlayerInteractEvent?
cause it's not working lol
which one?
PlayerArmorStandManipulateEvent
hey guys anyone know how to import another gradle plugin into ur own?
trying to use some features from the java plugin
spigot has the most niche events xD
now thats even better xd ty
uhm what's the alternative to setCustomName in newer versions since that's depricated
ignore, it's customName()
Yes
I was always interested behind the reasoning of paper not using the getX setX convention and instead 0 overloads = get, else set
spigot compatibility
and i think the adventure devs in general tend to use that naming convention
How so
Oh nvm
I was thinking about the setter, that it wouldnt matter since it's a different param
But getter wouldnt work
How do I teleport a fishing hook? ex this doesn't do anything: ```kt
@EventHandler
private fun ProjectileHitEvent.onHit() {
if (entity is FishHook) {
Bukkit.broadcast(text("Teleporting up")) // prints
entity.teleport(entity.location.clone().add(0.0, 5.0, 0.0))
return
}
}
🤔
uhm any ideas why #remove() doesn't remove an armorstand? (also, not idea about the above)
Is the entity a FishHook though?
Ah nvm, I just saw the comment
How do i revoke a players advancement? for some reason i can't find a single thread that helps
Try this https://hub.spigotmc.org/javadocs/spigot/org/bukkit/entity/Player.html#getAdvancementProgress(org.bukkit.advancement.Advancement) and revoke all awarded criterias
i want to send actionbar to players and use placeholder to format text and i want to show their own output from placeholder how to do it?
anyone know?
As in to expose it to projects that use your plugin? Otherwise I guess you simply import it as usualy, in the plugins {} block
i need to use some of the plugin's classes and such, such as JavaPluginExtension from the java plugin
how to make own library to my plugins (i change library plugin it will apply to all plugins)
is this the class for CraftPlayer? https://nms.screamingsandals.org/1.20/net/minecraft/world/entity/player/Player.html
I try to find the ping field
f is data id whatever that means
yes
so would anyone know how to do this? 🙏
was adventure updated to 1.20 / works in 1.20?
yeah
since paper is out as well
i think fabric adventure 1.20 isn't ready yet though
but besides that the others should
yeah i need only the bukkit platform
me too, any idea if it was released or not yet?
I guess latest version does work in 1.20
from 7 days ago:
seems mostly fine
I haven't checked sounds or tab list yet
so
as there are people using my library (yes, adventure bukkit shaded in it)
¯_(ツ)_/¯
nice

Hey there, question.
Some uses of my plugin wants that I add a leaderboard of the most gentle and the most evil players (let's call it a Score).
When disconnected players data are stored into database, it is simple to do so: get Scores from database (ignore online players), then compare.
But for servers that stores datas into .yml files (with 1 file per player instead of one big file for all), is it gonna be problematic for perfs ? (I have an idea of just storing the most extreme Scores updated amounts into a separated file but. What do you think of it ?)
Can anyone help me so I setup guylab with a. Runner when I commit it start to build it build successfully but won’t artefact it
Why would you consider yml as a storage option? Use sqlite or h2 for flat file storage
Edit: Are you storing key:value or more complexe objects?
old plugins and old habits ^^' (and also seen that on some plugins)
I'll check sqlite then !
yeah that's true, but this might not be one of those situations
Bentobox stores a lot of things like that, I didn't see any performance issues in 200~ online server
I think I'm losing the plot ;-; it's one issue after the other with this entity.
int number = random.nextInt(100) + 1;
Random randomEmerald = new Random();
int numberEmerald = randomEmerald.nextInt(16) + 1;
Random randomEmeraldBlock = new Random();
int numberEmeraldBlock = randomEmeraldBlock.nextInt(8) + 1;
if (number < 60) {
event.getDrops().add(new ItemStack(Material.EMERALD, numberEmerald));
Bukkit.broadcastMessage(ChatColor.translateAlternateColorCodes('&', "&7Congratulations " + event.getEntity().getKiller().getName() + " for slaying [&cEntity&7] and getting the drop [&cEmerald x" + numberEmerald + "&7]"));
} else {
event.getDrops().add(new ItemStack(Material.EMERALD_BLOCK, numberEmeraldBlock));
Bukkit.broadcastMessage(ChatColor.translateAlternateColorCodes('&', "&7Congratulations " + event.getEntity().getKiller().getName() + " for slaying [&cEntity&7] and getting the drop [&cEmerald Block x" + numberEmeraldBlock + "&7]"));
}```
I'm trying to simply set the drops of an entity on it's death to either emeralds or emerald blocks.
It's saying the message so I know the if parts are working, I also know I'm changing the entities drops because 'event.getDrops().clear();' works but adding items just isn't working.
define Random as a static field for one
and don't re-create the random class for each roll 💀
so it doesn't save the random number? it re rolls per part?
everytime you call .nextInt or .nextWhatever, it spits out a pseudo-random number
yeah it generates a new number every time
so you don't need to create a new instance of it everytime, just do smt like
private static final Random rnd = new Random();
you probably need to drop the items manually with World#dropItem
When you said this did you mean @EventHandler public static void onEntityDeath(EntityDeathEvent event) {?
what
I'm talking about the random class, not the event handler
private static final Random rnd = new Random();
@EventHandler
public void onEntityDeath(EntityDeathEvent event) {
rnd.nextInt();
}
or ThreadLocalRandom.current()
edit: or not
stop giving da man confusing stuff
lets keep it shrimple
yes please xD I'm teaching myself all this from fourms and youtube.
yeah well I'd suggest some learning OOP fundamentals first
I'll look into one 🙂 (might be a bit off topic) do you know where I could take one online?
thanks 🙂
anyway back on topic. The random part wasn't the issue. What you showed me here ^ won't fix my issue will it?
well if you'd know the basics of what I'm saying, then no, it won't
it's just a performance save
tldr
- cancel the event
- get the death location
- drop items manually
that worked thanks 🙂
ah maybe not cancel the event but nvm
please i really need to know to fix dkim's gradle plugin 😭 🙏
even just helping me google how, cause ive tried so many different searches
add the plugin in the dependencies block of the plugin's build script
or if it's a convention plugin you can also add it to the plugins block
i tried doing that, but Project#java is still not accessible, am i just doing it wrong or something?
/**
* Sets the Java (and possibly Kotlin in the future) version for the project
*
* @param javaVersion The java version to set (example: `1.8`)
*/
fun Project.setJavaVersion(javaVersion: JavaVersion = JavaVersion.VERSION_1_8) {
require(hasJavaPlugin()) { "Java plugin is not applied!" }
java {
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
}
}
you need to get the extension directly
ahhhh so like this right?
fun Project.setJavaVersion(javaVersion: JavaVersion = JavaVersion.VERSION_1_8) {
require(hasJavaPlugin()) { "Java plugin is not applied!" }
val java: JavaPluginExtension = extensions["java"] as JavaPluginExtension
java.sourceCompatibility = javaVersion
java.targetCompatibility = javaVersion
}
yea
thank u that makes much sense @dusky harness
nothing new
since java is a built-in pugin the classes (JavaPluginExtension) were already accessible
it was just a matter of how to get an instance of it
also dkim, does kotlin require/use the java plugin?
it automatically imports it
does kotlin use compileOnly and stuff
ok then yea kotlin does import java cause i think its what adds those
ye
you can do the java {} stuff with only kotlin plugin too
ah ok yeye
Hey I am trying to create a link detector but it doesn't really detect the link if it's combined with words:
public class ClickableLinks {
private static final String LINK_REGEX = "^https?:\\/\\/(?:www\\.)?[-a-zA-Z0-9@:%._\\+~#=]{1,256}\\.[a-zA-Z0-9()]{1,6}\\b(?:[-a-zA-Z0-9()@:%_\\+.~#?&\\/=]*)$";
private static final Pattern pattern = Pattern.compile(LINK_REGEX);
public static BaseComponent[] convertLinksToClickable(String message) {
ComponentBuilder builder = new ComponentBuilder("");
Matcher matcher = pattern.matcher(message);
int lastEnd = 0;
while (matcher.find()) {
String textBeforeLink = message.substring(lastEnd, matcher.start());
String link = matcher.group();
builder.append(textBeforeLink);
BaseComponent[] linkComponent = new ComponentBuilder(link)
.color(ChatColor.AQUA)
.underlined(true)
.event(new ClickEvent(ClickEvent.Action.OPEN_URL, link))
.create();
builder.append(linkComponent);
lastEnd = matcher.end();
}
if (lastEnd < message.length()) {
String textAfterLink = message.substring(lastEnd);
builder.append(textAfterLink);
}
return builder.create();
}
}```
I've got no idea why
remove the ^ and $
Still doesn't seem to be working
with: "https?:\\/\\/(?:www\\.)?[-a-zA-Z0-9@:%._\\+~#=]{1,256}\\.[a-zA-Z0-9()]{1,6}\\b(?:[-a-zA-Z0-9()@:%_\\+.~#?&\\/=]*)";
I honestly don't know regex, but here's the regex I'm using for this same purpose.
Pattern.compile(
"(?:^|[\\W])((ht|f)tp(s?)://|www\\.)(([\\w\\-]+\\.)+?([\\w\\-.~]+/?)*[\\p{Alnum}.,%_=?&#\\-+()\\[\\]*$~@!:/{};']*)",
Pattern.CASE_INSENSITIVE | Pattern.MULTILINE | Pattern.DOTALL
);
it doesnt do anything
send the updated code
add debug messages before and after each if statement to see where it stops working
ok
I have no idea but nope, doesn't work 🥲
i got an error where can i send it?
Paste Services
When asking for help with a config/menu/code issue please use our paste bin:
(we prefer it over pastebin.com)
• HelpChat Paste - How To Use
private static final String LINK_REGEX = "(?:^|[\\W])((ht|f)tp(s?)://|www\\.)(([\\w\\-]+\\.)+?([\\w\\-.~]+/?)*[\\p{Alnum}.,%_=?&#\\-+()\\[\\]*$~@!:/{};']*)";
private static final Pattern pattern = Pattern.compile(LINK_REGEX, Pattern.CASE_INSENSITIVE | Pattern.MULTILINE | Pattern.DOTALL);
public static BaseComponent[] convertLinksToClickable(String message) {
ComponentBuilder builder = new ComponentBuilder("");
Matcher matcher = pattern.matcher(message);
int lastEnd = 0;
while (matcher.find()) {
String textBeforeLink = message.substring(lastEnd, matcher.start());
String link = matcher.group();
builder.append(textBeforeLink);
BaseComponent[] linkComponent = new ComponentBuilder(link)
.color(ChatColor.AQUA)
.underlined(true)
.event(new ClickEvent(ClickEvent.Action.OPEN_URL, link))
.create();
builder.append(linkComponent);
lastEnd = matcher.end();
}
if (lastEnd < message.length()) {
String textAfterLink = message.substring(lastEnd);
builder.append(textAfterLink);
}
return builder.create();
}```
oh
Maybe it's not the regex then but the actual code that contains an error... maybe
Thanks!
Just a question, what's this, in the regex?
... *[\p{Alnum}.,%_...
no idea
Ah okay, just thought you modified it
How can I make the deluxe menu open by clicking on an item (for example, the hell star)
I tried to use this code:
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event){
try{
ItemStack clickItem = event.getItem();
Action playerAction = event.getAction();
Player player = event.getPlayer();
if(clickItem.getType() == Material.NETHER_STAR && playerAction.toString().contains("RIGHT") && clickItem.getItemMeta().getCustomModelData() == 25){
Bukkit.dispatchCommand(player, "menu");
}
}catch (Exception e){
System.out.println("click with nothing item");
}
}
we are fix
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event){
try{
ItemStack clickItem = event.getItem();
Action playerAction = event.getAction();
Player player = event.getPlayer();
if(clickItem.getType() == Material.NETHER_STAR && playerAction.toString().contains("RIGHT") && clickItem.getItemMeta().getCustomModelData() == 25){
Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "dm open main_menu " + player.getDisplayName());
}
}catch (Exception e){
System.out.println("click with nothing item");
}
}
instead of playerAction.toString().contains("RIGHT") why not (playerAction == RIGHT_CLICK_BLOCK || playerAction == RIGHT_CLICK_AIR) doesnt really make much difference, just takes less time to compute
I just learn java
anyone know if i need to use com.github.srnyx in my jitpack publishing configuration in my build file if i have a custom domain (xyz.srnyx) set-up instead? or can i just use xyz.srnyx as the groupId in the configuration?
// Maven publishing for Jitpack
configure<PublishingExtension> {
publications {
create<MavenPublication>("maven") {
groupId = "com.github.srnyx" // instead, could it be "xyz.srnyx"?
from(components["java"])
}
}
}
Group Id would be whatever the maven group id is
When importing the dependency
what
Like in another project when you add the dependency
Well its not really java specific thing, but also you gotta learn right
yeah i set it up so that i could do xyz.srnyx already
so idk if i need to keep com.github.srnyx as the groupId in the api's build file (for jitpack) or if it just doesnt matter
Prob should be xyz then
Hello, can anyone give me the dependence ( maven ) for paper 1.8.8 ? Thanks
because:
com.destroystokyo.paper:paper-api🫙1.8.8-R0.1-SNAPSHOT was not found in https://papermc.io/repo/repository/maven-public/ during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of papermc has elapsed or updates are forced
afaik paper api doesnt exist for 1.8.8, you will have to use the spigot api dependency
Isn't using paper 1.8 a security risk due to log4j?
paper patched all their available jars including 1.8.8
Well then
but, I want to use the paper api for the PlayerStopSpectatingEntityEvent
I'll just take the 1.19.4 version for the event
It does
Gimme a min
org.github.paperspigot:paperspigot-api
thanks
does anyone know i deploy compiled jar file to sFTP server (maven)
anyone know off top if i can call config.getDouble() on an int? or if its gonna throw an exception
x: 0
config.getDouble("x")
im just gonna assume it works and find out later
it does
JavaPlugin#getConfig() is in memory right?
like the config file is only read on startup
yes
unless you do saveDefaultConfig or reloadConfig i think?
It works
0.0 = 0 so
would be dumb not to
Hey,
I've got a ptoblem: I am trying to loop a SignChangeEvent so it updates the lines automatically. I am creating a minigame and as soon as the Staus of the Lobby changes, it should automatically be changed on the sign too. However, as soon as the sign is updated, it becomes blank :/
For reference: The loop is probably the main cause of the issue
@Override
public void run() {
e.setLine(0, "§8[§3Hide§fand§bSeek§8]");
e.setLine(1, "§7" + e.getLine(1));
e.setLine(2, "§b" + cfg.getInt("HAS.Maps." + ChatColor.stripColor(e.getLine(1)) + ".PlayerAmount") + " §8/ §b10");
switch(status) {
case "OPEN":
e.setLine(3, "§a" + status);
break;
case "RUNNING":
e.setLine(3, "§6" + status);
break;
case "CLOSED":
this.cancel();
break;
}
s.update(true);
}
}.runTaskTimer(pl, 0, 20L); ```
Because you are running setLine from the event which has already passed. You need to variablize the sign from the event then change its lines.
Ahh okay, thank you 🙂 So in that case I can use the "s" variable, right? The s Variable is just the BlockState of the Sign
Sign sign = event.getSign()
Ah yeah didn't see the s.update()
Don't worry. Thank you for your help
Np
Also I would keep track of that task incase you need to forcefully cancel it later.
By which means?
The runnable gets cancelled, as soon as the sign is broken or the game has ended
Create a variable of it too.
👍 Only see it cancel on status "closed" but don't see any other code.
Yeah, sry. I added it afterwards
If anyone already knows this or has the time to test this, can you have a list of objects that have different types with spigot's snakeyaml? I don't minding it just giving me a List<Object> and letting me handle the type check and casting.
Uhm how would I get the player that killed another player with a respawn anchor or minecart?
any ideas?
???
you can kill players with respawn anchors and tnt minecarts
question is how I would get the killer, aka who ignited/explodes the respawn anchor or tnt minecart
Get the last damage cause? It might be EXPLOSION or smth
Minecarts you have to cache on explode who ignited and then check when the player dies.
Anchors I have no clue
think I already know how anchors would work
LivingEntity#getKiller() might work
but how would you get the person who ignited the minecart though?
is there no getList ? I know get exists, which returns Object
cause the death messages know who killed them right
yes
so surely that's tracked somewhere
I mean yesno
probably in Player#getKiller()
maybe. idk. I don't really have time to look.
Just that they were killed by TNT
anchors for example:
yeah but doesn't the death message know who ignited the TNT
I think TNT but not minecart tnt
they don't store who ignited them
oh that's annoying
yeah...
whelp yeah i guess we'll never know
and/or it's time to fork Paper and add your own patch >:)
TNTPrime has getSource which returns Entity, can you get TNTPrime from the damage event?
I could check for EntityExplodeEvent but that doesn't get me who ignited it
aaaaaaaaaa
but a minecart tnt isn't tnt prime or is it?
Ah I thought you want normal tnt as well
nha
I think the cart explodes on impact or whatever, it doesnt behave like normal tnt
See what the damage event returns for tnt minecart ig
Yeah but doesnt it explode instantly?
Yeah idk either exactly, some debug on the death event should help
apparently there's BlockIgniteEvent, but I'm guessing that doesn't count for respawn anchors and tnt minecarts that blow up instantly
I think anchors and end crystals trigger entity explode, or at least that is the only event that makes sense to me
would be nice if they ignited 😔
already did, couldn't find anything lol
anchors aren't an entity or are they? Couldn't find them in EntityType
I already added crystals
No it is a block
PlayerInteractEvent, save the location
are we 100% on this?
have you tried BlockIgniteEvent
for crystals I listened to EntityDamageByEntityEvent and stored the crystal UUID and player in a map, then when the player died, got the id of the killer entity and voila
What does Entity#getKiller or Entity#getLastDamage#getDamager returns?
yes already tried that, but then what? you can't get the location of the explosion on the player death event.
you can't get the damager
only the cause
You can 100% because it returns entity damage event
You might need to cast it to EntityDamageByEntityEvent
Amazing
yes but that doesn't solve the issue
I still don't know who ignited that minecart
I need to detect when someone shoots a minecart tnt with a bow with flaming
and store that info
Entity damage by entity probably
and damager should be instance of Projectile etc
I saw a post on bukkit and they suggested to set a meta key to all players in the radius of the explosion and then check for that meta on the death event
Kinda what I suggested.
Yeah, or PDC, the post was old and back then only metadata existed xD
im developing a client, and i need help with a crash, that idk how to fix
nvm i fixed it lol
pdc to store who ignited them?
Yea
uh... #getDamager() in EntityDamageByBlockEvent is returning null when a respawn anchor explodes lol
shouldn't it return the anchor block object?!
😩
yes.
i mean how far back do you plan to go - you could have a chain reaction of explosions set off by other explosions
i'd just define a few special cases like if the player directly set off the explosive or if they directly shoot it, theyre the killer. if not, idk.. either assign nobody the killer or whoever placed the explosive
just Player -> TNT Minecart
yeah thats good enough
here's the thing
same thing seems to be happening like respawn anchors
or wait...
yeah no
but yeah respawn anchors are an issue
apparently paper issue
yeah no idea
Dead end
private void removeAmount(Player p, ItemStack item, int amount) {
PlayerInventory inventory = p.getInventory();
for (ItemStack inventoryItem : inventory.getContents()){
if (inventoryItem == null || inventoryItem.getType() == Material.AIR){
continue;
}
if (inventoryItem.isSimilar(item)) {
if (inventoryItem.getAmount() > amount){
inventoryItem.setAmount(inventoryItem.getAmount() - amount);
return;
} else {
amount -= inventoryItem.getAmount();
inventory.remove(inventoryItem);
if (amount <= 0) return;
}
}
}
}
any ideas what's wrong with this? Cause right now, if amount is 200 for example, and I have 4x64 of that item, instead of removing 200 it will remove all the stacks
I am a bit lost on what's causing it
probably just missing smt lol
btw the else isn't needed
Try to do inventoryItem.setAmount(0) or inventoryItem.setType(AIR) instead
that's not the issue though? if I have 4x64 items, that's 256 items, so 56 items should be left.
it's removing the items, the issue is that it's removing too many
actually found a way.
nice
Simply, on the PlayerInteractEvent listener, when the player exploded the anchor, it would get all players in a 12 block radius (from what I tested, you get dmg till 12 blocks) and then stored in a hashmap, the damaged player and the player that caused it. It gets wiped 5 ticks after, but that's enough for the PlayerDeathEvent to check if the player is in that list.
Quite a workaround but welp
Still opened the paper issue though
Working on some enchants, and i just had a thought would it be easier/more efficient to store the enchants in a PDC and then refrence that or register them and add them normally?
Looks fine to me, just try to make sure that it's not being called twice; otherwise it could end up potentially erasing all of said item. You could perhaps add debug messages inside that method, just for sanity sakes.
well it's getting called only once and it's not working like intended so yeah
im worried that it's removing the wrong stack or smth
bc ur not removing the specific slot
you're removing the ItemStack instance
which I assume uses #equals instead of ==
¯_(ツ)_/¯
confusion
Have you verified that? Assumptions is unlikely to help you here unfortunately
yes I have lol
debugged, only called once
Very well! I just checked the #remove (https://helpch.at/docs/1.16.5/org/bukkit/inventory/Inventory.html#remove(org.bukkit.inventory.ItemStack)) method for you, and it states this on 1.16.5 version of Spigot:
Removes all stacks in the inventory matching the given stack.
If you are using a different version, or on Paper, and it still states the same thing, then Dkim was perhaps right afterall
declaration: package: org.bukkit.inventory, interface: Inventory
Try using the #clear(slot) method instead maybe? That could ought to do it
yeah that works, thanks a lot.
Anytime! :)
basically what Tofpu's solution was
🥲
i just explained very poorly lol
Yeah haha, I (rightfully) credited that to ya
yeah.. didn't understand at first
hi i need to apply a gradle plugin (non-built-in) with a specific version using apply(...), cant use plugins { } dsl unfortunately as this is in my own plugin 
here's what happens when i try using plugins { }:
Using 'plugins(PluginDependenciesSpec.() -> Unit): Nothing' is an error. The plugins {} block must not be used here. If you need to apply a plugin imperatively, please use apply<PluginType>() or apply(plugin = "id") instead.
yeah but idk how to solve it 
It also tells you what to do lol
how do i incorporate the version into either of the suggestsions it gave me tho?
destroyed with fax and logistics
[16:45:32 INFO]: [ZXRust][Debug]1 Ammo: 20
[16:45:32 INFO]: [ZXRust][Debug]2 Ammo: 19
[16:45:32 INFO]: [ZXRust][Debug]3 Ammo: 19
[16:45:32 INFO]: [ZXRust][Debug]Shoot was called by player
[16:45:33 INFO]: [ZXRust][Debug]1 Ammo: 19
[16:45:33 INFO]: [ZXRust][Debug]2 Ammo: 18
[16:45:33 INFO]: [ZXRust][Debug]3 Ammo: 18
[16:45:33 INFO]: [ZXRust][Debug]Shoot was called by player
[16:45:46 INFO]: [ZXRust][Debug]1 Ammo: 19
[16:45:46 INFO]: [ZXRust][Debug]2 Ammo: 18
[16:45:46 INFO]: [ZXRust][Debug]3 Ammo: 18
[16:45:46 INFO]: [ZXRust][Debug]Shoot was called by player
[16:45:54 INFO]: [ZXRust][Debug]1 Ammo: 18
[16:45:54 INFO]: [ZXRust][Debug]2 Ammo: 17
[16:45:54 INFO]: [ZXRust][Debug]3 Ammo: 17
what causes the event be fired but the itemstack not to update?
Have you sent any code?
yeah sec i remove all not nessecery thngs from iit (things that are doing other things and work well.)
Player player = event.getPlayer();
CLog.ConsoleDebugMessage("1 Ammo: " + WeaponsUtils.getGunAmmo(player.getInventory().getItemInHand()));
String itemID = compound.getString("ID");
int itemSID = compound.getInt("SID");
if (WeaponsUtils.getGunAmmo(player.getInventory().getItemInHand()) > 0) {
ItemMeta meta = item.getItemMeta();
List<String> lore = meta.getLore();
lore.set(lore.size() - 1,"Ammo: " + (WeaponsUtils.getGunAmmo(player.getInventory().getItemInHand()) - 1));
meta.setLore(lore);
item.setItemMeta(meta);
CLog.ConsoleDebugMessage("2 Ammo: " + WeaponsUtils.getGunAmmo(player.getInventory().getItemInHand()));
the getGunAmmo is basically int dont tmind the caps i know its java and not C#
it just returns the amount of ammo from lore
dont suggest to use PDC. player meant to see the ammo viia lore
else i would use map to control it
Use PDC
no no dont suggest PDC please player cant see PDC
PDC is just bukkit's api for nbt, but you can not edit any tags with it
They can see lore though
Dont strip lore for data
no no GabyTM lett me explain i do have other way to ttrack ammo
i use map with weapon Serial ID (every weapon has unique Serial ID) and int ammo
now problem is lets say player wants to see amount of ammo
because the server is survival server and ammo is sometthing exclusive
i dont update item constatly if lore wont work i guess ill just use handler that loads weapon ammo from database each time if its not in the server cache already
so basically lore wont work? thats why its so broken?
I would just use PDC and lore, and no database stuff
And no other nbt stuff
Just PDC and lore
Whenever you modify ammo, modify both PDC and lore
No compound stuff
No weapon serial
compound is basically pdc
Ik but I mean use PDC not the other nbt
No need for database and serial Id and stuff
When PDC exists
PDC is basically API that allows you to use nbt compunds
i use compunds directtly no need shit api
nms ftw
Ik
. Ok
I'm on phone anyways so that's my input but I can't give any code or anything rn
Ok
i dont ask for spoon feed so you guys saying lore is broken af? and its a game limit?
i prefer to just update it in the memory
then actually updating the item tags
too much to update
Shits gonna get crazy with unmarked weapons
wdym unmarked
nah user will complain but ill make it if you right click (hit) it says ammo amount
i think its fine
I was joking about the irl fact that there are weapons with untraceable serial ids
haha xD
americans joke
the jokes syrian guys wont get since all of the weapons are untracable
haha
ill return here with new code so you can rate it guys and tell me if its better 😄
Player player = event.getPlayer();
ItemStack item = player.getInventory().getItemInHand();
net.minecraft.server.v1_6_R3.ItemStack nmsItem = CraftItemStack.asNMSCopy(item);
NBTTagCompound compound = nmsItem.getTag();
if (compound == null) {
return;
}
String itemID = compound.getString("ID");
int itemSID = compound.getInt("SID");
if (!WeaponAmmo.containsKey(itemSID)) {
WeaponAmmo.put(itemSID,WeaponsUtils.getGunAmmo(item)); //todo later to change it to load from database if database returns none get gun ammo.
}
if (WeaponAmmo.get(itemSID) > 0) {
CLog.ConsoleDebugMessage("2 Ammo: " + WeaponAmmo.get(itemSID));
WeaponAmmo.put(itemSID,WeaponAmmo.get(itemSID) - 1);
CLog.ConsoleDebugMessage("3 Ammo: " + WeaponAmmo.get(itemSID));
PacketUtils.sendActionBar(player,"&4&lAMMO: &6" + WeaponAmmo.get(itemSID));
//rest of code works fine.
whatt do you think about hat
ofc i will ; the int so i wont ask request db
so often its just for debugging
imagine those guys tell me to use PDC 🤣
yeah so it looks fine i think i hope it will work
lmao
Imagine being on a version that's so ancient the greek gods have played it
u know whats awesome about that version
that in the server we never get to encounter any cheaters
my anti cheat is way more advanced that cheats that were created at that ancient ver
[17:20:35 INFO]: [ZXRust][Debug]2 Ammo: 23
[17:20:35 INFO]: [ZXRust][Debug]3 Ammo: 22
[17:20:35 INFO]: [ZXRust][Debug]Shoot was called by player
[17:20:36 INFO]: [ZXRust][Debug]2 Ammo: 22
[17:20:36 INFO]: [ZXRust][Debug]3 Ammo: 21
[17:20:36 INFO]: [ZXRust][Debug]Shoot was called by player
[17:20:36 INFO]: [ZXRust][Debug]2 Ammo: 21
[17:20:36 INFO]: [ZXRust][Debug]3 Ammo: 20
[17:20:36 INFO]: [ZXRust][Debug]Shoot was called by player
[17:20:36 INFO]: [ZXRust][Debug]2 Ammo: 20
[17:20:36 INFO]: [ZXRust][Debug]3 Ammo: 19
[17:20:36 INFO]: [ZXRust][Debug]Shoot was called by player
issue was fixed thanks for the suggestion~ now using a map instead of item data to store ammo.
anyone know how?
uhm how can I get the content of a component without the tags? aka just the message, with the colors, etc
what
Components don't contain MM tags anymore
If you serialize them with MM, the string will contain tags obv
serialize*
legacyApersand returns the legacy color code though
And?
you probably want the PlainTextSerializer?
not sure what you actually want to achieve here
You said with the colors smh
i think i have to use the legacy plugin applying method, right?
//TODO Apply the shadow plugin
buildscript {
repositories { gradlePluginPortal() }
dependencies { add("classpath", "${ShadowVersion.parse(shadowVersion).groupId}:shadow:$shadowVersion") }
}
apply(plugin = "com.github.johnrengelman.shadow")
What are you trying to do?
summon satan
.
Hello, I have a problem, when I want to setSpectatorTarget to a player on join, the player isn't the first time on the spectatortarget, but when I open my hotbar to tp to the player, I am on the spectator target... Idk if y'all understood me but here's my code
p.setPlayerListName("");
p.setGameMode(GameMode.SPECTATOR);
List<Player> playerList = new ArrayList<>();
for(Player pl : Bukkit.getOnlinePlayers()){
playerList.add(pl);
}
playerList.remove(p);
Random r = new Random();
int ri = r.nextInt(playerList.size());
Bukkit.broadcastMessage(ri + "");
SpectatorTarget.put(p, playerList.get(ri));
isSpectating.put(playerList.get(ri), true);
p.teleport(playerList.get(ri));
main.getServer().getScheduler().runTaskLater(main, () -> p.setSpectatorTarget(playerList.get(ri)),45);
I tried everything
that's why there's the nms player
wait
where did you get tha trash code?
me
why you got this ( main.getServer().getScheduler().runTaskLater(main, () -> p.setSpectatorTarget(playerList.get(ri)),45);) can you explain?
just curious
I was just doing a wait to see if it was the problem
u never do a wait you debug instead
to see what executes and what values your code outputs
also , for(Player pl : Bukkit.getOnlinePlayers()){
playerList.add(pl);
}
playerList.remove(p); wtf is this
u already have a list
by bukkit
why do you re create another list
isee you remove the player so it wont tp to him self
yes
but why you use a new list instead of bukkit one?
"tp to the player, I am on the spectator target" from your words
it should not be random
what r u even coding
I'm trying to assign a random spectator target to a player when the party is running
so he spectate spectetor?
instead just get a random player and check if he survival else use while()
so it will try few times
since no sense in your code
it will just tp to other spectetor also
or if he is in playersmap for example
what,
?
use uuid instead of players too
i just told u what to do
will work like charm
and simple
because what you wrote there lets say if it will work it will be broken af
and why teleport
why you want to teleportt him
use o#setSpectatorTarget(ob2) instead
that it so simple
also cancel then PlayerSpectateEntityEvent if u want to force players to watch someone
do you understand?
ok i just gave up on this lmao
iirc, if they arent close, it wont work
and u might also need to add a delay when setting the spectator target after teleporting, as sometimes it still wont work cause the player is still being teleported or something. ive had the issue before, so did someone else
he sets delay after doing the whole thing
o yeah, yeah thats correct
but thats like the only correct thing there 💀


