use of uk.co.oliwali.HawkEye.HawkEvent in project HawkEye by oliverwoodings.
the class MonitorPlayerListener method onPlayerTeleport.
@HawkEvent(dataType = DataType.TELEPORT)
public void onPlayerTeleport(PlayerTeleportEvent event) {
//Check for inventory close
HawkEye.containerManager.checkInventoryClose(event.getPlayer());
Location from = event.getFrom();
Location to = event.getTo();
if (Util.distance(from, to) > 5)
DataManager.addEntry(new DataEntry(event.getPlayer(), DataType.TELEPORT, from, to.getWorld().getName() + ": " + to.getX() + ", " + to.getY() + ", " + to.getZ()));
}
use of uk.co.oliwali.HawkEye.HawkEvent in project HawkEye by oliverwoodings.
the class MonitorBlockListener method onBlockFromTo.
@HawkEvent(dataType = { DataType.LAVA_FLOW, DataType.WATER_FLOW })
public void onBlockFromTo(BlockFromToEvent event) {
List<Integer> fluidBlocks = Arrays.asList(0, 27, 28, 31, 32, 37, 38, 39, 40, 50, 51, 55, 59, 66, 69, 70, 75, 76, 78, 93, 94);
//Only interested in liquids flowing
if (!event.getBlock().isLiquid())
return;
Location loc = event.getToBlock().getLocation();
BlockState from = event.getBlock().getState();
BlockState to = event.getToBlock().getState();
MaterialData data = from.getData();
//Lava
if (from.getTypeId() == 10 || from.getTypeId() == 11) {
//Flowing into a normal block
if (fluidBlocks.contains(to.getTypeId())) {
data.setData((byte) (from.getRawData() + 1));
from.setData(data);
} else //Flowing into water
if (to.getTypeId() == 8 || to.getTypeId() == 9) {
from.setTypeId(event.getFace() == BlockFace.DOWN ? 10 : 4);
data.setData((byte) 0);
from.setData(data);
}
DataManager.addEntry(new BlockChangeEntry("Environment", DataType.LAVA_FLOW, loc, to, from));
} else //Water
if (from.getTypeId() == 8 || from.getTypeId() == 9) {
//Normal block
if (fluidBlocks.contains(to.getTypeId())) {
data.setData((byte) (from.getRawData() + 1));
from.setData(data);
DataManager.addEntry(new BlockChangeEntry("Environment", DataType.WATER_FLOW, loc, to, from));
}
//If we are flowing over lava, cobble or obsidian will form
BlockState lower = event.getToBlock().getRelative(BlockFace.DOWN).getState();
if (lower.getTypeId() == 10 || lower.getTypeId() == 11) {
from.setTypeId(lower.getData().getData() == 0 ? 49 : 4);
loc.setY(loc.getY() - 1);
DataManager.addEntry(new BlockChangeEntry("Environment", DataType.WATER_FLOW, loc, lower, from));
}
}
}
use of uk.co.oliwali.HawkEye.HawkEvent in project HawkEye by oliverwoodings.
the class MonitorPlayerListener method onPlayerDropItem.
@HawkEvent(dataType = DataType.ITEM_DROP)
public void onPlayerDropItem(PlayerDropItemEvent event) {
Player player = event.getPlayer();
ItemStack stack = event.getItemDrop().getItemStack();
String data = null;
if (stack.getData() != null)
data = stack.getAmount() + "x " + stack.getTypeId() + ":" + stack.getData().getData();
else
data = stack.getAmount() + "x " + stack.getTypeId();
DataManager.addEntry(new DataEntry(player, DataType.ITEM_DROP, player.getLocation(), data));
}
use of uk.co.oliwali.HawkEye.HawkEvent in project HawkEye by oliverwoodings.
the class MonitorPlayerListener method onPlayerJoin.
@HawkEvent(dataType = DataType.JOIN)
public void onPlayerJoin(PlayerJoinEvent event) {
Player player = event.getPlayer();
Location loc = player.getLocation();
DataManager.addEntry(new DataEntry(player, DataType.JOIN, loc, Config.LogIpAddresses ? player.getAddress().getAddress().getHostAddress().toString() : ""));
}
use of uk.co.oliwali.HawkEye.HawkEvent in project HawkEye by oliverwoodings.
the class MonitorPlayerListener method onPlayerChat.
@HawkEvent(dataType = DataType.CHAT)
public void onPlayerChat(PlayerChatEvent event) {
Player player = event.getPlayer();
//Check for inventory close
HawkEye.containerManager.checkInventoryClose(event.getPlayer());
DataManager.addEntry(new DataEntry(player, DataType.CHAT, player.getLocation(), event.getMessage()));
}
Aggregations