diff --git a/src/main/java/isaac/bastion/BastionBlock.java b/src/main/java/isaac/bastion/BastionBlock.java index 6ae5f3bd..b06ad3ff 100644 --- a/src/main/java/isaac/bastion/BastionBlock.java +++ b/src/main/java/isaac/bastion/BastionBlock.java @@ -48,7 +48,7 @@ public BastionBlock(Location location, long placed, double balance, int ID, Bast } else{ this.health = 0; destroy(); - Bastion.getPlugin().severe("Reinforcement removed during BastionBlock instantiation, removing"); + Bastion.getPlugin().severe("Reinforcement removed during BastionBlock instantiation, removing at " + location.toString()); } } @@ -213,7 +213,7 @@ public void regen() { } } else { destroy(); - Bastion.getPlugin().severe("Reinforcement removed without removing bastion, fixed"); + Bastion.getPlugin().severe("Reinforcement removed without removing bastion, fixed at " + location); } } } @@ -277,7 +277,7 @@ private PlayerReinforcement getReinforcement() { return (PlayerReinforcement) reinforcement; } else { destroy(); - Bastion.getPlugin().severe("Reinforcement removed without removing bastion, fixed"); + Bastion.getPlugin().severe("Reinforcement no longer exists, but bastion not removed, fixed at " + location); } return null; } diff --git a/src/main/java/isaac/bastion/BastionType.java b/src/main/java/isaac/bastion/BastionType.java index af645849..a4b71b68 100644 --- a/src/main/java/isaac/bastion/BastionType.java +++ b/src/main/java/isaac/bastion/BastionType.java @@ -378,18 +378,27 @@ public static void startRegenAndErosionTasks() { if(type.erosionTime > 0) { new BukkitRunnable() { public void run() { + Bastion.getPlugin().getLogger().log(Level.INFO, "Erosion task begin, found " + + Bastion.getBastionStorage().getBastionsForType(type).size() + " to erode"); for(BastionBlock bastion : Bastion.getBastionStorage().getBastionsForType(type)) { bastion.erode(1); } + Bastion.getPlugin().getLogger().log(Level.INFO, "Erosion task ended, after erosion " + + Bastion.getBastionStorage().getBastionsForType(type).size() + " remain"); } }.runTaskTimerAsynchronously(Bastion.getPlugin(), type.erosionTime, type.erosionTime); } if(type.regenTime > 0) { new BukkitRunnable() { public void run() { + Bastion.getPlugin().getLogger().log(Level.INFO, "Regen task begin, found " + + Bastion.getBastionStorage().getBastionsForType(type).size() + " to regen"); for(BastionBlock bastion : Bastion.getBastionStorage().getBastionsForType(type)) { bastion.regen(); } + Bastion.getPlugin().getLogger().log(Level.INFO, "Regen task ended, after regen " + + Bastion.getBastionStorage().getBastionsForType(type).size() + " remain"); + } }.runTaskTimerAsynchronously(Bastion.getPlugin(), type.regenTime, type.regenTime); } diff --git a/src/main/java/isaac/bastion/listeners/BastionInteractListener.java b/src/main/java/isaac/bastion/listeners/BastionInteractListener.java index f441d132..7a2d982a 100644 --- a/src/main/java/isaac/bastion/listeners/BastionInteractListener.java +++ b/src/main/java/isaac/bastion/listeners/BastionInteractListener.java @@ -173,9 +173,9 @@ public void run() { } } - @SuppressWarnings("deprecation") + //@SuppressWarnings("deprecation") public BastionType blockToType(Block block, ItemStack inHand) { - MaterialData mat = new MaterialData(block.getType(), block.getData()); + MaterialData mat = new MaterialData(block.getType()); //, block.getData()); -- again, we can't differentiate based on this? String displayName = null; List lore = null; if (inHand != null) { diff --git a/src/main/java/isaac/bastion/storage/BastionBlockStorage.java b/src/main/java/isaac/bastion/storage/BastionBlockStorage.java index 1c40699a..4c05bb14 100644 --- a/src/main/java/isaac/bastion/storage/BastionBlockStorage.java +++ b/src/main/java/isaac/bastion/storage/BastionBlockStorage.java @@ -341,7 +341,7 @@ public BastionType getTypeAtLocation(Location loc) { /** * Loads all bastions from the database */ - @SuppressWarnings("deprecation") + //@SuppressWarnings("deprecation") public void loadBastions() { int enderSearchRadius = EnderPearlManager.MAX_TELEPORT + 100; for(World world : Bukkit.getWorlds()) { @@ -359,16 +359,20 @@ public void loadBastions() { long placed = result.getLong("placed"); double balance = result.getDouble("fraction"); BastionType type = BastionType.getBastionType(result.getString("bastion_type")); + boolean died = result.getBoolean("dead"); Location loc = new Location(world, x, y, z); BastionBlock block = new BastionBlock(loc, placed, balance, id, type); //Check if it's a ghost bastion, if so remove from the db - if(loc.getBlock().getType() != type.getMaterial().getItemType() - || loc.getBlock().getData() != type.getMaterial().getData()) { + if(loc.getBlock().getType() != type.getMaterial().getItemType() ) { // can't set data why check with it deleteBastion(block); continue; } - bastions.add(block); - bastionsForWorld.add(block); + if (died) { + dead.put(loc, block.getType().getName()); + } else { + bastions.add(block); + bastionsForWorld.add(block); + } } } catch (SQLException e) { log.log(Level.SEVERE, "Error loading bastions from database, shutting down", e);