feat: id sous les tetes

This commit is contained in:
gdamms 2022-05-16 12:34:39 +02:00
parent aea453bdbf
commit 73d8f8fb1f
2 changed files with 21 additions and 3 deletions

View file

@ -26,8 +26,8 @@ public class ClearPoints implements CommandExecutor {
Camera.controlPoints = new ArrayList<>();
Camera.compute();
ClosePath.closed = false;
Camera.broadlog("All cleared !");
for (World world : Bukkit.getWorlds()) {
for (Entity e : world.getEntities()) {
@ -36,6 +36,9 @@ public class ClearPoints implements CommandExecutor {
}
}
}
ShowCurve.controlPointsArmorStands = new ArrayList<>();
Camera.broadlog("All cleared !");
}
}

View file

@ -38,6 +38,7 @@ public class ShowCurve implements CommandExecutor {
// Kill control points' armorstand
for (ArmorStand as : controlPointsArmorStands) {
as.getEquipment().setHelmet(new ItemStack(Material.AIR));
as.setCustomNameVisible(false);
}
return true;
}
@ -45,6 +46,7 @@ public class ShowCurve implements CommandExecutor {
// Show control points
int i = 0;
for (ArmorStand as : controlPointsArmorStands) {
as.setCustomNameVisible(true);
if (i % 3 == 0)
as.getEquipment().setHelmet(cameraHeadAnchor);
else
@ -102,14 +104,18 @@ public class ShowCurve implements CommandExecutor {
as.setVisible(false);
as.setMarker(true);
as.addScoreboardTag("controlPoint");
if (taskID > 0)
as.setCustomName("" + (controlPointsArmorStands.size()));
if (taskID > 0) {
as.setCustomNameVisible(true);
if ((Camera.controlPoints.size() - 1) % 3 == 0)
as.getEquipment().setHelmet(cameraHeadAnchor);
else
as.getEquipment().setHelmet(cameraHeadControl);
}
controlPointsArmorStands.add(as);
}
@Deprecated
public static void insert(int index, Location point, World world) {
ArmorStand as = world.spawn(point, ArmorStand.class);
as.setGravity(false);
@ -117,7 +123,7 @@ public class ShowCurve implements CommandExecutor {
as.setMarker(true);
as.addScoreboardTag("controlPoint");
if (taskID > 0)
if ((Camera.controlPoints.size() - 1) % 3 == 0)
if ((Camera.controlPoints.size()) % 3 == 0)
as.getEquipment().setHelmet(cameraHeadAnchor);
else
as.getEquipment().setHelmet(cameraHeadControl);
@ -130,5 +136,14 @@ public class ShowCurve implements CommandExecutor {
public static void rm(int index) {
controlPointsArmorStands.remove(index).remove();
// Show IDs
int i = 0;
for (ArmorStand as : controlPointsArmorStands) {
as.setCustomName("" + i);
if (taskID > 0)
as.setCustomNameVisible(true);
i++;
}
}
}