From 910abbc116d94cb2f16277a1ab8681bbb6a35e51 Mon Sep 17 00:00:00 2001 From: j502647092 Date: Sat, 17 Oct 2015 23:34:03 +0800 Subject: [PATCH] fix world command error... Signed-off-by: j502647092 --- pom.xml | 2 +- .../SimpleEssential/command/CommandWorld.java | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 8749fd0..d1c16f4 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 cn.citycraft SimpleEssential - 1.3 + 1.4 SimpleEssential 轻量级基础插件 diff --git a/src/main/java/cn/citycraft/SimpleEssential/command/CommandWorld.java b/src/main/java/cn/citycraft/SimpleEssential/command/CommandWorld.java index c74d5da..cb58186 100644 --- a/src/main/java/cn/citycraft/SimpleEssential/command/CommandWorld.java +++ b/src/main/java/cn/citycraft/SimpleEssential/command/CommandWorld.java @@ -3,8 +3,11 @@ */ package cn.citycraft.SimpleEssential.command; +import java.util.logging.Level; + import org.bukkit.Bukkit; import org.bukkit.ChatColor; +import org.bukkit.Chunk; import org.bukkit.World; import org.bukkit.command.Command; import org.bukkit.command.CommandException; @@ -36,7 +39,15 @@ public class CommandWorld extends BaseCommand { case 0: sender.sendMessage(I18n.p("World.title")); for (final World wd : Bukkit.getWorlds()) { - sender.sendMessage(I18n.p("World.info", wd.getName(), wd.getEnvironment().toString(), wd.getLoadedChunks().length, wd.getEntities().size(), wd.getPlayers().size())); + int tileEntities = 0; + try { + for (final Chunk chunk : wd.getLoadedChunks()) { + tileEntities += chunk.getTileEntities().length; + } + } catch (final ClassCastException ex) { + org.bukkit.Bukkit.getLogger().log(Level.SEVERE, "无法读取区块信息 错误世界: " + wd, ex); + } + sender.sendMessage(I18n.p("World.info", wd.getName(), wd.getEnvironment().toString(), wd.getLoadedChunks().length, wd.getEntities().size(), tileEntities, wd.getPlayers().size())); } case 1: final World wd = Bukkit.getWorld(args[1]);