statistics, block placed and interacted events, stats event test

This commit is contained in:
gnembon committed 2019-12-27 03:25:56 -04:00
1 parent 860c9b6d21
commit d7ca974f1a
12 files changed
+210 -7

No files matched your search

@@ -29,6 +29,7 @@ import net.minecraft.entity.mob.MobEntityWithAi;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.predicate.entity.EntityPredicates;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.command.ServerCommandSource;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.server.world.ServerWorld;
@@ -93,6 +94,25 @@ public class EntityValue extends Value
return entity;
}
public static ServerPlayerEntity getPlayerByValue(MinecraftServer server, Value value)
{
ServerPlayerEntity player = null;
if (value instanceof EntityValue)
{
Entity e = ((EntityValue) value).getEntity();
if (e instanceof ServerPlayerEntity)
{
player = (ServerPlayerEntity) e;
}
}
else
{
String playerName = value.getString();
player = server.getPlayerManager().getPlayer(playerName);
}
return player;
}
@Override
public String getString()
{