mirror of
https://github.com/TotalFreedomMC/TF-EssentialsX.git
synced 2025-02-12 04:20:41 +00:00
Better handle corrupted chunks.
This commit is contained in:
parent
27e9e3aa88
commit
4575fc5aff
1 changed files with 14 additions and 4 deletions
|
@ -6,6 +6,8 @@ import com.earth2me.essentials.utils.DateUtil;
|
||||||
import com.earth2me.essentials.utils.NumberUtil;
|
import com.earth2me.essentials.utils.NumberUtil;
|
||||||
import java.lang.management.ManagementFactory;
|
import java.lang.management.ManagementFactory;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
|
@ -59,9 +61,17 @@ public class Commandgc extends EssentialsCommand
|
||||||
|
|
||||||
int tileEntities = 0;
|
int tileEntities = 0;
|
||||||
|
|
||||||
for (Chunk chunk : w.getLoadedChunks()) {
|
try
|
||||||
|
{
|
||||||
|
for (Chunk chunk : w.getLoadedChunks())
|
||||||
|
{
|
||||||
tileEntities += chunk.getTileEntities().length;
|
tileEntities += chunk.getTileEntities().length;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
catch (java.lang.ClassCastException ex)
|
||||||
|
{
|
||||||
|
Bukkit.getLogger().log(Level.SEVERE, "Corrupted chunk data on world " + w, ex);
|
||||||
|
}
|
||||||
|
|
||||||
sender.sendMessage(tl("gcWorld", worldType, w.getName(), w.getLoadedChunks().length, w.getEntities().size(), tileEntities));
|
sender.sendMessage(tl("gcWorld", worldType, w.getName(), w.getLoadedChunks().length, w.getEntities().size(), tileEntities));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue