forked from LogBlock/LogBlock
Using interfaces
This commit is contained in:
@@ -7,6 +7,7 @@ import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.zip.DataFormatException;
|
||||
import org.bukkit.Material;
|
||||
@@ -15,7 +16,7 @@ import org.bukkit.util.config.Configuration;
|
||||
|
||||
public class Config
|
||||
{
|
||||
public final HashMap<Integer, String> tables;
|
||||
public final Map<Integer, String> tables;
|
||||
public final String url, user, password;
|
||||
public final int delayBetweenRuns, forceToProcessAtLeast, timePerRun;
|
||||
public final boolean useBukkitScheduler;
|
||||
|
||||
@@ -9,6 +9,8 @@ import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Queue;
|
||||
import java.util.Set;
|
||||
import java.util.TimerTask;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
@@ -26,15 +28,15 @@ import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class Consumer extends TimerTask
|
||||
{
|
||||
private final LinkedBlockingQueue<BlockRow> bqueue = new LinkedBlockingQueue<BlockRow>();
|
||||
private final Queue<BlockRow> bqueue = new LinkedBlockingQueue<BlockRow>();
|
||||
private final Config config;
|
||||
private final Set<Integer> hiddenplayers;
|
||||
private final LinkedBlockingQueue<KillRow> kqueue = new LinkedBlockingQueue<KillRow>();
|
||||
private final HashMap<Integer, Integer> lastAttackedEntity = new HashMap<Integer, Integer>();
|
||||
private final HashMap<Integer, Long> lastAttackTime = new HashMap<Integer, Long>();
|
||||
private final Queue<KillRow> kqueue = new LinkedBlockingQueue<KillRow>();
|
||||
private final Map<Integer, Integer> lastAttackedEntity = new HashMap<Integer, Integer>();
|
||||
private final Map<Integer, Long> lastAttackTime = new HashMap<Integer, Long>();
|
||||
private final Logger log;
|
||||
private final LogBlock logblock;
|
||||
private final HashSet<Integer> players = new HashSet<Integer>();
|
||||
private final Set<Integer> players = new HashSet<Integer>();
|
||||
|
||||
Consumer(LogBlock logblock) {
|
||||
this.logblock = logblock;
|
||||
|
||||
@@ -4,6 +4,7 @@ import static de.diddiz.util.BukkitUtils.compareInventories;
|
||||
import static de.diddiz.util.BukkitUtils.compressInventory;
|
||||
import static de.diddiz.util.BukkitUtils.rawData;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkitcontrib.event.inventory.InventoryCloseEvent;
|
||||
@@ -13,7 +14,7 @@ import org.bukkitcontrib.event.inventory.InventoryOpenEvent;
|
||||
class LBChestAccessListener extends InventoryListener
|
||||
{
|
||||
private final Consumer consumer;
|
||||
private final HashMap<Integer, ItemStack[]> containers = new HashMap<Integer, ItemStack[]>();
|
||||
private final Map<Integer, ItemStack[]> containers = new HashMap<Integer, ItemStack[]>();
|
||||
|
||||
LBChestAccessListener(LogBlock logblock) {
|
||||
consumer = logblock.getConsumer();
|
||||
|
||||
@@ -154,6 +154,7 @@ public class LogBlock extends JavaPlugin
|
||||
public void onDisable() {
|
||||
if (timer != null)
|
||||
timer.cancel();
|
||||
getServer().getScheduler().cancelTasks(this);
|
||||
if (consumer != null && consumer.getQueueSize() > 0) {
|
||||
log.info("[LogBlock] Waiting for consumer ...");
|
||||
final Thread thread = new Thread(consumer);
|
||||
|
||||
@@ -23,7 +23,7 @@ import com.sk89q.worldedit.bukkit.selections.Selection;
|
||||
|
||||
public class QueryParams implements Cloneable
|
||||
{
|
||||
private static final HashSet<Integer> keywords = new HashSet<Integer>(Arrays.asList("player".hashCode(), "area".hashCode(), "selection".hashCode(), "sel".hashCode(), "block".hashCode(), "type".hashCode(), "sum".hashCode(), "destroyed".hashCode(), "created".hashCode(), "chestaccess".hashCode(), "all".hashCode(), "time".hashCode(), "since".hashCode(), "before".hashCode(), "limit".hashCode(), "world".hashCode(), "asc".hashCode(), "desc".hashCode(), "last".hashCode(), "coords".hashCode(), "silent".hashCode()));
|
||||
private static final Set<Integer> keywords = new HashSet<Integer>(Arrays.asList("player".hashCode(), "area".hashCode(), "selection".hashCode(), "sel".hashCode(), "block".hashCode(), "type".hashCode(), "sum".hashCode(), "destroyed".hashCode(), "created".hashCode(), "chestaccess".hashCode(), "all".hashCode(), "time".hashCode(), "since".hashCode(), "before".hashCode(), "limit".hashCode(), "world".hashCode(), "asc".hashCode(), "desc".hashCode(), "last".hashCode(), "coords".hashCode(), "silent".hashCode()));
|
||||
public BlockChangeType bct = BlockChangeType.BOTH;
|
||||
public int limit = 15, minutes = 0, radius = -1;
|
||||
public Location loc = null;
|
||||
|
||||
@@ -73,7 +73,7 @@ class Updater
|
||||
try {
|
||||
return readURL(new URL("http://diddiz.insane-architects.net/lbuptodate.php?v=" + logblock.getDescription().getVersion()));
|
||||
} catch (final Exception ex) {
|
||||
return "Can't connect to server";
|
||||
return "Can't check version";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package de.diddiz.LogBlock;
|
||||
|
||||
import static de.diddiz.util.BukkitUtils.equalTypes;
|
||||
import java.util.Queue;
|
||||
import java.util.concurrent.LinkedBlockingQueue;
|
||||
import java.util.logging.Logger;
|
||||
import org.bukkit.World;
|
||||
@@ -18,7 +19,7 @@ public class WorldEditor implements Runnable
|
||||
private final Logger log;
|
||||
private final LogBlock logblock;
|
||||
private final Config config;
|
||||
private final LinkedBlockingQueue<Edit> edits = new LinkedBlockingQueue<Edit>();
|
||||
private final Queue<Edit> edits = new LinkedBlockingQueue<Edit>();
|
||||
private final World world;
|
||||
private int taskID;
|
||||
private int successes = 0, errors = 0, blacklistCollisions = 0;
|
||||
|
||||
Reference in New Issue
Block a user