Added coordinates to blacklist file logger.

This commit is contained in:
sk89q 2010-12-09 23:21:24 -08:00
parent e94a9bf68f
commit d619ed5798

View File

@ -206,6 +206,16 @@ private void log(Player player, String message, String comment) {
}
}
/**
* Gets the coordinates of a block in text form for the log.
*
* @param block
* @return
*/
private String getCoordinates(Block block) {
return "@" + block.getX() + "," + block.getY() + "," + block.getZ();
}
/**
* Log a block destroy attempt.
*
@ -213,7 +223,8 @@ private void log(Player player, String message, String comment) {
* @param block
*/
public void logDestroyAttempt(Player player, Block block, String comment) {
log(player, "Tried to destroy " + getFriendlyItemName(block.getType()),
log(player, "Tried to destroy " + getFriendlyItemName(block.getType())
+ " " + getCoordinates(block),
comment);
}
@ -224,7 +235,8 @@ public void logDestroyAttempt(Player player, Block block, String comment) {
* @param block
*/
public void logBreakAttempt(Player player, Block block, String comment) {
log(player, "Tried to break " + getFriendlyItemName(block.getType()),
log(player, "Tried to break " + getFriendlyItemName(block.getType())
+ " " + getCoordinates(block),
comment);
}
@ -235,7 +247,8 @@ public void logBreakAttempt(Player player, Block block, String comment) {
* @param block
*/
public void logUseAttempt(Player player, Block block, String comment) {
log(player, "Tried to use " + getFriendlyItemName(block.getType()),
log(player, "Tried to use " + getFriendlyItemName(block.getType())
+ " " + getCoordinates(block),
comment);
}