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

@@ -9,9 +9,12 @@ import carpet.script.value.NumericValue;
import carpet.script.value.StringValue;
import carpet.script.value.Value;
import com.mojang.brigadier.exceptions.CommandSyntaxException;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
import net.minecraft.nbt.Tag;
import net.minecraft.server.command.ServerCommandSource;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.util.math.BlockPos;
import java.math.BigInteger;
@@ -288,6 +291,14 @@ public class ScriptHost
{
if (this.saveTimeout > 0)
dumpState();
String markerName = ExpressionInspector.MARKER_STRING+"_"+((getName()==null)?"":getName());
for (ServerWorld world : CarpetServer.minecraft_server.getWorlds())
{
for (Entity e : world.getEntities(EntityType.ARMOR_STAND, (as) -> as.getScoreboardTags().contains(markerName)))
{
e.remove();
}
}
}
public void setPerPlayer(boolean isPerUser)