remove markers when app unloads or not loaded

This commit is contained in:
gnembon committed 2019-10-23 08:49:58 -03:00
1 parent b90da71359
commit e21cbf5f59
8 files changed
+76 -4

No files matched your search

@@ -2737,7 +2737,8 @@ public class CarpetExpression
(float)pointLocator.yaw,
(float) pointLocator.pitch
);
armorstand.addScoreboardTag("__scarpet_marker");
armorstand.addScoreboardTag(ExpressionInspector.MARKER_STRING+"_"+((cc.host.getName()==null)?"":cc.host.getName()));
armorstand.addScoreboardTag(ExpressionInspector.MARKER_STRING);
if (targetBlock != null)
armorstand.setEquippedStack(EquipmentSlot.HEAD, new ItemStack(targetBlock.getBlock().asItem()));
if (!name.isEmpty())
@@ -2757,7 +2758,8 @@ public class CarpetExpression
this.expr.addLazyFunction("remove_all_markers", 0, (c, t, lv) -> {
CarpetContext cc = (CarpetContext)c;
int total = 0;
for (Entity e : cc.s.getWorld().getEntities(EntityType.ARMOR_STAND, (as) -> as.getScoreboardTags().contains("__scarpet_marker")))
String markerName = ExpressionInspector.MARKER_STRING+"_"+((cc.host.getName()==null)?"":cc.host.getName());
for (Entity e : cc.s.getWorld().getEntities(EntityType.ARMOR_STAND, (as) -> as.getScoreboardTags().contains(markerName)))
{
total ++;
e.remove();