Add playerinfo metadata
This commit is contained in:
parent
b00d9d7bb4
commit
2397cdbba7
@ -29,6 +29,7 @@ import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.antihack.AntiHack;
|
||||
import mineplex.core.antihack.ViolationLevels;
|
||||
import mineplex.core.antihack.logging.builtin.PartyInfoMetadata;
|
||||
import mineplex.core.antihack.logging.builtin.PlayerInfoMetadata;
|
||||
import mineplex.core.antihack.logging.builtin.ServerInfoMetadata;
|
||||
import mineplex.core.antihack.logging.builtin.ViolationInfoMetadata;
|
||||
import mineplex.core.command.CommandBase;
|
||||
@ -63,6 +64,7 @@ public class AntihackLogger extends MiniPlugin
|
||||
registerMetadata(new ServerInfoMetadata());
|
||||
registerMetadata(new ViolationInfoMetadata());
|
||||
registerMetadata(new PartyInfoMetadata());
|
||||
registerMetadata(new PlayerInfoMetadata());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -43,6 +43,12 @@ public class ViolationInfoMetadata extends AnticheatMetadata
|
||||
|
||||
private static final String KEY_PLAYER_INFO = "player-info";
|
||||
private static final String KEY_LOCATION = "loc";
|
||||
private static final String KEY_WORLD = "world";
|
||||
private static final String KEY_X = "x";
|
||||
private static final String KEY_Y = "y";
|
||||
private static final String KEY_Z = "z";
|
||||
private static final String KEY_YAW = "yaw";
|
||||
private static final String KEY_PITCH = "pitch";
|
||||
|
||||
private static final JsonObject VAL_CHECK_DISABLED;
|
||||
|
||||
@ -125,8 +131,18 @@ public class ViolationInfoMetadata extends AnticheatMetadata
|
||||
violationInfo.addProperty(KEY_VL, event.getViolations());
|
||||
violationInfo.addProperty(KEY_MESSAGE, event.getMessage());
|
||||
|
||||
event.getPlayer().getLocation(MUTABLE_LOCATION);
|
||||
|
||||
JsonObject playerInfo = new JsonObject();
|
||||
playerInfo.addProperty(KEY_LOCATION, toString(event.getPlayer().getLocation(MUTABLE_LOCATION)));
|
||||
JsonObject location = new JsonObject();
|
||||
location.addProperty(KEY_WORLD, MUTABLE_LOCATION.getWorld().getName());
|
||||
location.addProperty(KEY_X, MUTABLE_LOCATION.getX());
|
||||
location.addProperty(KEY_Y, MUTABLE_LOCATION.getY());
|
||||
location.addProperty(KEY_Z, MUTABLE_LOCATION.getZ());
|
||||
location.addProperty(KEY_YAW, MUTABLE_LOCATION.getYaw());
|
||||
location.addProperty(KEY_PITCH, MUTABLE_LOCATION.getPitch());
|
||||
|
||||
playerInfo.add(KEY_LOCATION, location);
|
||||
|
||||
JsonObject data = new JsonObject();
|
||||
data.add(KEY_CURRENT_TIME, currentTime);
|
||||
@ -135,17 +151,4 @@ public class ViolationInfoMetadata extends AnticheatMetadata
|
||||
|
||||
violations.add(data);
|
||||
}
|
||||
|
||||
private String toString(Location location)
|
||||
{
|
||||
return location.getWorld().getName() + ", " +
|
||||
fastRound2Digits(location.getX()) + ", " +
|
||||
fastRound2Digits(location.getY()) + ", " +
|
||||
fastRound2Digits(location.getZ());
|
||||
}
|
||||
|
||||
private double fastRound2Digits(double in)
|
||||
{
|
||||
return (long) (in * 100 + 0.5) / 100.0;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user