forked from LogBlock/LogBlock
Formatting, indentation and ignore cancelled.
This commit is contained in:
@@ -129,7 +129,6 @@ public class LogBlock extends JavaPlugin
|
|||||||
}
|
}
|
||||||
commandsHandler = new CommandsHandler(this);
|
commandsHandler = new CommandsHandler(this);
|
||||||
getCommand("lb").setExecutor(commandsHandler);
|
getCommand("lb").setExecutor(commandsHandler);
|
||||||
getLogger().info("[LogBlock] Permissions plugin not found. Using Bukkit Permissions.");
|
|
||||||
if (enableAutoClearLog && autoClearLogDelay > 0)
|
if (enableAutoClearLog && autoClearLogDelay > 0)
|
||||||
getServer().getScheduler().scheduleAsyncRepeatingTask(this, new AutoClearLog(this), 6000, autoClearLogDelay * 60 * 20);
|
getServer().getScheduler().scheduleAsyncRepeatingTask(this, new AutoClearLog(this), 6000, autoClearLogDelay * 60 * 20);
|
||||||
getServer().getScheduler().scheduleAsyncDelayedTask(this, new DumpedLogImporter(this));
|
getServer().getScheduler().scheduleAsyncDelayedTask(this, new DumpedLogImporter(this));
|
||||||
@@ -152,12 +151,6 @@ public class LogBlock extends JavaPlugin
|
|||||||
final Permission perm = new Permission("logblock.tools." + tool.name, tool.permissionDefault);
|
final Permission perm = new Permission("logblock.tools." + tool.name, tool.permissionDefault);
|
||||||
pm.addPermission(perm);
|
pm.addPermission(perm);
|
||||||
}
|
}
|
||||||
// perm.addParent("logblock.*", true);
|
|
||||||
getLogger().info("LogBlock v" + getDescription().getVersion() + " by DiddiZ enabled.");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void reload() {
|
|
||||||
// TODO
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void registerEvents() {
|
private void registerEvents() {
|
||||||
|
@@ -312,7 +312,7 @@ public class QueryParams implements Cloneable
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void parseArgs(CommandSender sender, List<String> args) throws IllegalArgumentException {
|
public void parseArgs(CommandSender sender, List<String> args) throws IllegalArgumentException {
|
||||||
if (args == null || args.size() == 0)
|
if (args == null || args.isEmpty())
|
||||||
throw new IllegalArgumentException("No parameters specified.");
|
throw new IllegalArgumentException("No parameters specified.");
|
||||||
final Player player = sender instanceof Player ? (Player)sender : null;
|
final Player player = sender instanceof Player ? (Player)sender : null;
|
||||||
final Session session = prepareToolQuery ? null : getSession(sender);
|
final Session session = prepareToolQuery ? null : getSession(sender);
|
||||||
|
@@ -17,10 +17,10 @@ public class BlockBreakLogging extends LoggingListener
|
|||||||
super(lb);
|
super(lb);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onBlockBreak(BlockBreakEvent event) {
|
public void onBlockBreak(BlockBreakEvent event) {
|
||||||
final WorldConfig wcfg = getWorldConfig(event.getBlock().getWorld());
|
final WorldConfig wcfg = getWorldConfig(event.getBlock().getWorld());
|
||||||
if (!event.isCancelled() && wcfg != null && wcfg.isLogging(Logging.BLOCKBREAK)) {
|
if (wcfg != null && wcfg.isLogging(Logging.BLOCKBREAK)) {
|
||||||
final int type = event.getBlock().getTypeId();
|
final int type = event.getBlock().getTypeId();
|
||||||
if (wcfg.isLogging(Logging.SIGNTEXT) && (type == 63 || type == 68))
|
if (wcfg.isLogging(Logging.SIGNTEXT) && (type == 63 || type == 68))
|
||||||
consumer.queueSignBreak(event.getPlayer().getName(), (Sign)event.getBlock().getState());
|
consumer.queueSignBreak(event.getPlayer().getName(), (Sign)event.getBlock().getState());
|
||||||
@@ -33,9 +33,9 @@ public class BlockBreakLogging extends LoggingListener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onPlayerBucketFill(PlayerBucketFillEvent event) {
|
public void onPlayerBucketFill(PlayerBucketFillEvent event) {
|
||||||
if (!event.isCancelled() && isLogging(event.getPlayer().getWorld(), Logging.BLOCKBREAK))
|
if (isLogging(event.getPlayer().getWorld(), Logging.BLOCKBREAK))
|
||||||
consumer.queueBlockBreak(event.getPlayer().getName(), event.getBlockClicked().getState());
|
consumer.queueBlockBreak(event.getPlayer().getName(), event.getBlockClicked().getState());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -13,9 +13,9 @@ public class BlockBurnLogging extends LoggingListener
|
|||||||
super(lb);
|
super(lb);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onBlockBurn(BlockBurnEvent event) {
|
public void onBlockBurn(BlockBurnEvent event) {
|
||||||
if (!event.isCancelled() && isLogging(event.getBlock().getWorld(), Logging.FIRE))
|
if (isLogging(event.getBlock().getWorld(), Logging.FIRE))
|
||||||
consumer.queueBlockBreak("Fire", event.getBlock().getState());
|
consumer.queueBlockBreak("Fire", event.getBlock().getState());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -19,10 +19,10 @@ public class BlockPlaceLogging extends LoggingListener
|
|||||||
super(lb);
|
super(lb);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onBlockPlace(BlockPlaceEvent event) {
|
public void onBlockPlace(BlockPlaceEvent event) {
|
||||||
final WorldConfig wcfg = getWorldConfig(event.getBlock().getWorld());
|
final WorldConfig wcfg = getWorldConfig(event.getBlock().getWorld());
|
||||||
if (!event.isCancelled() && wcfg != null && wcfg.isLogging(Logging.BLOCKPLACE)) {
|
if (wcfg != null && wcfg.isLogging(Logging.BLOCKPLACE)) {
|
||||||
final int type = event.getBlock().getTypeId();
|
final int type = event.getBlock().getTypeId();
|
||||||
final BlockState before = event.getBlockReplacedState();
|
final BlockState before = event.getBlockReplacedState();
|
||||||
final BlockState after = event.getBlockPlaced().getState();
|
final BlockState after = event.getBlockPlaced().getState();
|
||||||
@@ -56,9 +56,9 @@ public class BlockPlaceLogging extends LoggingListener
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onPlayerBucketEmpty(PlayerBucketEmptyEvent event) {
|
public void onPlayerBucketEmpty(PlayerBucketEmptyEvent event) {
|
||||||
if (!event.isCancelled() && isLogging(event.getPlayer().getWorld(), Logging.BLOCKPLACE))
|
if (isLogging(event.getPlayer().getWorld(), Logging.BLOCKPLACE))
|
||||||
consumer.queueBlockPlace(event.getPlayer().getName(), event.getBlockClicked().getRelative(event.getBlockFace()).getLocation(), event.getBucket() == Material.WATER_BUCKET ? 9 : 11, (byte)0);
|
consumer.queueBlockPlace(event.getPlayer().getName(), event.getBlockClicked().getRelative(event.getBlockFace()).getLocation(), event.getBucket() == Material.WATER_BUCKET ? 9 : 11, (byte)0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -2,8 +2,8 @@ package de.diddiz.LogBlock.listeners;
|
|||||||
|
|
||||||
import static de.diddiz.util.BukkitUtils.compareInventories;
|
import static de.diddiz.util.BukkitUtils.compareInventories;
|
||||||
import static de.diddiz.util.BukkitUtils.compressInventory;
|
import static de.diddiz.util.BukkitUtils.compressInventory;
|
||||||
import static de.diddiz.util.BukkitUtils.getInventoryHolderType;
|
|
||||||
import static de.diddiz.util.BukkitUtils.getInventoryHolderLocation;
|
import static de.diddiz.util.BukkitUtils.getInventoryHolderLocation;
|
||||||
|
import static de.diddiz.util.BukkitUtils.getInventoryHolderType;
|
||||||
import static de.diddiz.util.BukkitUtils.rawData;
|
import static de.diddiz.util.BukkitUtils.rawData;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@@ -14,9 +14,9 @@ public class EndermenLogging extends LoggingListener
|
|||||||
super(lb);
|
super(lb);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onEntityChangeBlock(EntityChangeBlockEvent event) {
|
public void onEntityChangeBlock(EntityChangeBlockEvent event) {
|
||||||
if (!event.isCancelled() && event.getEntity() instanceof Enderman && isLogging(event.getBlock().getWorld(), Logging.ENDERMEN))
|
if (event.getEntity() instanceof Enderman && isLogging(event.getBlock().getWorld(), Logging.ENDERMEN))
|
||||||
consumer.queueBlockReplace("Enderman", event.getBlock().getState(), event.getTo().getId(), (byte)0); // Figure out how to get the data of the placed block;
|
consumer.queueBlockReplace("Enderman", event.getBlock().getState(), event.getTo().getId(), (byte)0); // Figure out how to get the data of the placed block;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -23,10 +23,10 @@ public class ExplosionLogging extends LoggingListener
|
|||||||
super(lb);
|
super(lb);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onEntityExplode(EntityExplodeEvent event) {
|
public void onEntityExplode(EntityExplodeEvent event) {
|
||||||
final WorldConfig wcfg = getWorldConfig(event.getLocation().getWorld());
|
final WorldConfig wcfg = getWorldConfig(event.getLocation().getWorld());
|
||||||
if (!event.isCancelled() && wcfg != null) {
|
if (wcfg != null) {
|
||||||
final String name;
|
final String name;
|
||||||
if (event.getEntity() == null) {
|
if (event.getEntity() == null) {
|
||||||
if (!wcfg.isLogging(Logging.MISCEXPLOSION))
|
if (!wcfg.isLogging(Logging.MISCEXPLOSION))
|
||||||
|
@@ -21,10 +21,10 @@ public class FluidFlowLogging extends LoggingListener
|
|||||||
super(lb);
|
super(lb);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onBlockFromTo(BlockFromToEvent event) {
|
public void onBlockFromTo(BlockFromToEvent event) {
|
||||||
final WorldConfig wcfg = getWorldConfig(event.getBlock().getWorld());
|
final WorldConfig wcfg = getWorldConfig(event.getBlock().getWorld());
|
||||||
if (!event.isCancelled() && wcfg != null) {
|
if (wcfg != null) {
|
||||||
final Block to = event.getToBlock();
|
final Block to = event.getToBlock();
|
||||||
final int typeFrom = event.getBlock().getTypeId();
|
final int typeFrom = event.getBlock().getTypeId();
|
||||||
final int typeTo = to.getTypeId();
|
final int typeTo = to.getTypeId();
|
||||||
|
@@ -17,10 +17,10 @@ public class InteractLogging extends LoggingListener
|
|||||||
super(lb);
|
super(lb);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onPlayerInteract(PlayerInteractEvent event) {
|
public void onPlayerInteract(PlayerInteractEvent event) {
|
||||||
final WorldConfig wcfg = getWorldConfig(event.getPlayer().getWorld());
|
final WorldConfig wcfg = getWorldConfig(event.getPlayer().getWorld());
|
||||||
if (!event.isCancelled() && wcfg != null && (event.getAction() == Action.LEFT_CLICK_BLOCK || event.getAction() == Action.RIGHT_CLICK_BLOCK)) {
|
if (wcfg != null && (event.getAction() == Action.LEFT_CLICK_BLOCK || event.getAction() == Action.RIGHT_CLICK_BLOCK)) {
|
||||||
final int type = event.getClickedBlock().getTypeId();
|
final int type = event.getClickedBlock().getTypeId();
|
||||||
final Player player = event.getPlayer();
|
final Player player = event.getPlayer();
|
||||||
final Location loc = event.getClickedBlock().getLocation();
|
final Location loc = event.getClickedBlock().getLocation();
|
||||||
|
@@ -25,9 +25,9 @@ public class KillLogging extends LoggingListener
|
|||||||
super(lb);
|
super(lb);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onEntityDamage(EntityDamageEvent event) {
|
public void onEntityDamage(EntityDamageEvent event) {
|
||||||
if (!event.isCancelled() && isLogging(event.getEntity().getWorld(), Logging.KILL) && event instanceof EntityDamageByEntityEvent && event.getEntity() instanceof LivingEntity) {
|
if (isLogging(event.getEntity().getWorld(), Logging.KILL) && event instanceof EntityDamageByEntityEvent && event.getEntity() instanceof LivingEntity) {
|
||||||
final LivingEntity victim = (LivingEntity)event.getEntity();
|
final LivingEntity victim = (LivingEntity)event.getEntity();
|
||||||
final Entity killer = ((EntityDamageByEntityEvent)event).getDamager();
|
final Entity killer = ((EntityDamageByEntityEvent)event).getDamager();
|
||||||
if (victim.getHealth() - event.getDamage() > 0 || victim.getHealth() <= 0)
|
if (victim.getHealth() - event.getDamage() > 0 || victim.getHealth() <= 0)
|
||||||
|
@@ -13,9 +13,9 @@ public class LeavesDecayLogging extends LoggingListener
|
|||||||
super(lb);
|
super(lb);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onLeavesDecay(LeavesDecayEvent event) {
|
public void onLeavesDecay(LeavesDecayEvent event) {
|
||||||
if (!event.isCancelled() && isLogging(event.getBlock().getWorld(), Logging.LEAVESDECAY))
|
if (isLogging(event.getBlock().getWorld(), Logging.LEAVESDECAY))
|
||||||
consumer.queueBlockBreak("LeavesDecay", event.getBlock().getState());
|
consumer.queueBlockBreak("LeavesDecay", event.getBlock().getState());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -13,9 +13,9 @@ public class SignChangeLogging extends LoggingListener
|
|||||||
super(lb);
|
super(lb);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onSignChange(SignChangeEvent event) {
|
public void onSignChange(SignChangeEvent event) {
|
||||||
if (!event.isCancelled() && isLogging(event.getBlock().getWorld(), Logging.SIGNTEXT))
|
if (isLogging(event.getBlock().getWorld(), Logging.SIGNTEXT))
|
||||||
consumer.queueSignPlace(event.getPlayer().getName(), event.getBlock().getLocation(), event.getBlock().getTypeId(), event.getBlock().getData(), event.getLines());
|
consumer.queueSignPlace(event.getPlayer().getName(), event.getBlock().getLocation(), event.getBlock().getTypeId(), event.getBlock().getData(), event.getLines());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -13,9 +13,9 @@ public class SnowFadeLogging extends LoggingListener
|
|||||||
super(lb);
|
super(lb);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onBlockFade(BlockFadeEvent event) {
|
public void onBlockFade(BlockFadeEvent event) {
|
||||||
if (!event.isCancelled() && isLogging(event.getBlock().getWorld(), Logging.SNOWFADE)) {
|
if (isLogging(event.getBlock().getWorld(), Logging.SNOWFADE)) {
|
||||||
final int type = event.getBlock().getTypeId();
|
final int type = event.getBlock().getTypeId();
|
||||||
if (type == 78 || type == 79)
|
if (type == 78 || type == 79)
|
||||||
consumer.queueBlockReplace("SnowFade", event.getBlock().getState(), event.getNewState());
|
consumer.queueBlockReplace("SnowFade", event.getBlock().getState(), event.getNewState());
|
||||||
|
@@ -14,15 +14,15 @@ public class SnowFormLogging extends LoggingListener
|
|||||||
super(lb);
|
super(lb);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onLeavesDecay(LeavesDecayEvent event) {
|
public void onLeavesDecay(LeavesDecayEvent event) {
|
||||||
if (!event.isCancelled() && isLogging(event.getBlock().getWorld(), Logging.SNOWFORM))
|
if (isLogging(event.getBlock().getWorld(), Logging.SNOWFORM))
|
||||||
consumer.queueBlockBreak("LeavesDecay", event.getBlock().getState());
|
consumer.queueBlockBreak("LeavesDecay", event.getBlock().getState());
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onBlockForm(BlockFormEvent event) {
|
public void onBlockForm(BlockFormEvent event) {
|
||||||
if (!event.isCancelled() && isLogging(event.getBlock().getWorld(), Logging.SNOWFORM)) {
|
if (isLogging(event.getBlock().getWorld(), Logging.SNOWFORM)) {
|
||||||
final int type = event.getNewState().getTypeId();
|
final int type = event.getNewState().getTypeId();
|
||||||
if (type == 78 || type == 79)
|
if (type == 78 || type == 79)
|
||||||
consumer.queueBlockReplace("SnowForm", event.getBlock().getState(), event.getNewState());
|
consumer.queueBlockReplace("SnowForm", event.getBlock().getState(), event.getNewState());
|
||||||
|
@@ -15,10 +15,10 @@ public class StructureGrowLogging extends LoggingListener
|
|||||||
super(lb);
|
super(lb);
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.MONITOR)
|
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
|
||||||
public void onStructureGrow(StructureGrowEvent event) {
|
public void onStructureGrow(StructureGrowEvent event) {
|
||||||
final WorldConfig wcfg = getWorldConfig(event.getWorld());
|
final WorldConfig wcfg = getWorldConfig(event.getWorld());
|
||||||
if (!event.isCancelled() && wcfg != null) {
|
if (wcfg != null) {
|
||||||
final String playerName;
|
final String playerName;
|
||||||
if (event.getPlayer() != null) {
|
if (event.getPlayer() != null) {
|
||||||
if (!wcfg.isLogging(Logging.BONEMEALSTRUCTUREGROW))
|
if (!wcfg.isLogging(Logging.BONEMEALSTRUCTUREGROW))
|
||||||
|
@@ -36,9 +36,9 @@ public class ToolListener implements Listener
|
|||||||
handler = logblock.getCommandsHandler();
|
handler = logblock.getCommandsHandler();
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler(ignoreCancelled = true)
|
||||||
public void onPlayerInteract(PlayerInteractEvent event) {
|
public void onPlayerInteract(PlayerInteractEvent event) {
|
||||||
if (!event.isCancelled() && event.getMaterial() != null) {
|
if (event.getMaterial() != null) {
|
||||||
final Action action = event.getAction();
|
final Action action = event.getAction();
|
||||||
final int type = event.getMaterial().getId();
|
final int type = event.getMaterial().getId();
|
||||||
final Tool tool = toolsByType.get(type);
|
final Tool tool = toolsByType.get(type);
|
||||||
|
@@ -13,9 +13,6 @@ import org.bukkit.configuration.ConfigurationSection;
|
|||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
import org.bukkit.material.MaterialData;
|
import org.bukkit.material.MaterialData;
|
||||||
|
|
||||||
/**
|
|
||||||
* @author DiddiZ
|
|
||||||
*/
|
|
||||||
public class MaterialName
|
public class MaterialName
|
||||||
{
|
{
|
||||||
private static final Map<Integer, String> materialNames = new HashMap<Integer, String>();
|
private static final Map<Integer, String> materialNames = new HashMap<Integer, String>();
|
||||||
|
Reference in New Issue
Block a user