From 16003a35263b557794ca3fb1bc3e0548af0e99e4 Mon Sep 17 00:00:00 2001 From: 502647092 Date: Wed, 16 Sep 2015 15:52:17 +0800 Subject: [PATCH] add tiles and update version... --- pom.xml | 2 +- .../SimpleEssential/command/CommandGc.java | 15 +++++++++++++-- src/main/resources/language.yml | 4 ++-- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/pom.xml b/pom.xml index f9f8eec..f3f5743 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ 4.0.0 cn.citycraft SimpleEssential - 1.2 + 1.3 SimpleEssential 轻量级基础插件 diff --git a/src/main/java/cn/citycraft/SimpleEssential/command/CommandGc.java b/src/main/java/cn/citycraft/SimpleEssential/command/CommandGc.java index a698108..c45e480 100644 --- a/src/main/java/cn/citycraft/SimpleEssential/command/CommandGc.java +++ b/src/main/java/cn/citycraft/SimpleEssential/command/CommandGc.java @@ -3,7 +3,10 @@ */ package cn.citycraft.SimpleEssential.command; +import java.util.logging.Level; + import org.bukkit.Bukkit; +import org.bukkit.Chunk; import org.bukkit.World; import org.bukkit.command.CommandException; import org.bukkit.command.CommandSender; @@ -41,8 +44,16 @@ public class CommandGc extends BaseCommand { sender.sendMessage(I18n.p("Gc.maxMem", StringUtil.b2mb(rt.maxMemory()))); sender.sendMessage(I18n.p("Gc.totalMem", StringUtil.b2mb(rt.totalMemory()))); sender.sendMessage(I18n.p("Gc.freeMem", StringUtil.b2mb(rt.freeMemory()))); - for (World wd : Bukkit.getWorlds()) - sender.sendMessage(I18n.p("World.info", wd.getName(), wd.getEnvironment().toString(), wd.getLoadedChunks().length, wd.getEntities().size(), wd.getPlayers().size())); + for (World wd : Bukkit.getWorlds()) { + int tileEntities = 0; + try { + for (Chunk chunk : wd.getLoadedChunks()) + tileEntities += chunk.getTileEntities().length; + } catch (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())); + } }; @Override diff --git a/src/main/resources/language.yml b/src/main/resources/language.yml index ce2ba2d..abb0b47 100644 --- a/src/main/resources/language.yml +++ b/src/main/resources/language.yml @@ -1,5 +1,5 @@ #本文件为基础插件的语言配置文件 -version: 1.2 +version: 1.3 #基础语言配置 Base: offline: "§c玩家 %s 不存在或不在线!" @@ -40,5 +40,5 @@ Gc: freeMem: '§6空闲内存: §a%s' World: title: '§6当前服务器的启用的世界如下' - info: '§a%s §3- §a%s §6区块: §a%s §6实体: §a%s §6玩家: §a%s' + info: '§a%s §3- §a%s §6区块: §a%s §6实体: §a%s §6tiles: §a%s §6玩家: §a%s' unknow: '§c未知的世界 §a%s' \ No newline at end of file