9
0
mirror of https://github.com/Xiao-MoMi/Custom-Nameplates.git synced 2025-12-19 15:09:23 +00:00

bump adventure platform version

This commit is contained in:
XiaoMoMi
2025-05-12 03:25:38 +08:00
parent 687908defc
commit 9f657166ff
8 changed files with 165 additions and 17 deletions

View File

@@ -17,10 +17,17 @@
package net.momirealms.customnameplates.bukkit.command.feature;
import net.momirealms.customnameplates.api.CNPlayer;
import net.momirealms.customnameplates.api.CustomNameplates;
import net.momirealms.customnameplates.api.DummyPlayer;
import net.momirealms.customnameplates.api.util.Vector3;
import net.momirealms.customnameplates.bukkit.BukkitCustomNameplates;
import net.momirealms.customnameplates.bukkit.command.BukkitCommandFeature;
import net.momirealms.customnameplates.common.command.CustomNameplatesCommandManager;
import org.bukkit.Location;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.incendo.cloud.Command;
import org.incendo.cloud.CommandManager;
@@ -36,6 +43,23 @@ public class DebugTestCommand extends BukkitCommandFeature<CommandSender> {
return builder
.senderType(Player.class)
.handler(context -> {
Player owner = context.sender();
Location loc = context.sender().getLocation().add(5,0,5);
CustomNameplates plugin = CustomNameplates.getInstance();
CNPlayer cnPlayer = plugin.getPlayer(owner.getUniqueId());
Entity entity = owner.getWorld().spawn(loc, ArmorStand.class, e -> {
int fakeEntityId = e.getEntityId();
CNPlayer fakePlayer = new DummyPlayer(plugin, cnPlayer, fakeEntityId, new Vector3(loc.getX(), loc.getY(), loc.getZ()));
plugin.addPlayerUnsafe(fakeEntityId, fakePlayer);
plugin.getUnlimitedTagManager().onPlayerJoin(fakePlayer);
});
plugin.getScheduler().sync().runLater(() -> {
entity.remove();
CNPlayer fake = plugin.removePlayerUnsafe(entity.getEntityId());
if (fake != null) {
plugin.getUnlimitedTagManager().onPlayerQuit(fake);
}
}, 100, null);
});
}