diff --git a/src/cn/citycraft/SimpleEssential/SimpleEssential.java b/src/cn/citycraft/SimpleEssential/SimpleEssential.java index 4d31768..873649b 100644 --- a/src/cn/citycraft/SimpleEssential/SimpleEssential.java +++ b/src/cn/citycraft/SimpleEssential/SimpleEssential.java @@ -6,7 +6,6 @@ package cn.citycraft.SimpleEssential; import java.util.ArrayList; import java.util.List; -import org.bukkit.ChatColor; import org.bukkit.command.Command; import org.bukkit.command.CommandException; import org.bukkit.command.CommandSender; @@ -48,11 +47,11 @@ public class SimpleEssential extends JavaPlugin { for (SimpleEssentialCommand command : commandlist) { if (command.isValidTrigger(label)) { if (!command.hasPermission(sender)) { - sender.sendMessage(ChatColor.RED + "你没有此命令的权限."); + sender.sendMessage(Language.getMessage("Base.no-permission")); return true; } if (command.isOnlyPlayerExecutable() && !(sender instanceof Player)) { - sender.sendMessage(ChatColor.RED + "此命令只能由玩家执行."); + sender.sendMessage(Language.getMessage("Base.playercommand")); return true; } if (args.length >= command.getMinimumArguments()) { diff --git a/src/cn/citycraft/SimpleEssential/teleport/TeleportControl.java b/src/cn/citycraft/SimpleEssential/teleport/TeleportControl.java index 3183987..0da5f79 100644 --- a/src/cn/citycraft/SimpleEssential/teleport/TeleportControl.java +++ b/src/cn/citycraft/SimpleEssential/teleport/TeleportControl.java @@ -7,7 +7,6 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; -import org.bukkit.Effect; import org.bukkit.Location; import org.bukkit.entity.Player; import org.bukkit.potion.PotionEffect; @@ -16,33 +15,12 @@ import org.bukkit.potion.PotionEffectType; import cn.citycraft.SimpleEssential.SimpleEssential; import cn.citycraft.SimpleEssential.config.Config; import cn.citycraft.SimpleEssential.config.Language; +import cn.citycraft.SimpleEssential.utils.EffectUtil; /** * @author 蒋天蓓 2015年8月12日下午2:26:10 传送控制类 */ public class TeleportControl { - /** - * 粒子发生器 - * - * @param loc - * - 粒子产生的地点 - * @param range - * - 粒子的数量 - */ - static void pEffect(Location loc, long range) { - try { - int i; - if (range < 2) { - range = 2; - } - for (i = 0; i < range; i++) { - loc.getWorld().playEffect(loc, Effect.LAVA_POP, 10, 100); - loc.getWorld().playEffect(loc, Effect.PORTAL, 10, 100); - } - } catch (Exception e) { - } - } - protected HashMap teleportList = new HashMap(); protected HashMap lastlocList = new HashMap(); private SimpleEssential plugin; @@ -170,7 +148,7 @@ public class TeleportControl { public void run() { while (System.currentTimeMillis() < timeoutmark) { if (player.isOnline()) { - pEffect(player.getLocation(), lrng); + EffectUtil.run(player.getLocation(), lrng); } lrng++; try { diff --git a/src/cn/citycraft/SimpleEssential/utils/EffectUtil.java b/src/cn/citycraft/SimpleEssential/utils/EffectUtil.java new file mode 100644 index 0000000..92ffd1c --- /dev/null +++ b/src/cn/citycraft/SimpleEssential/utils/EffectUtil.java @@ -0,0 +1,36 @@ +/** + * + */ +package cn.citycraft.SimpleEssential.utils; + +import org.bukkit.Effect; +import org.bukkit.Location; + +/** + * @author 蒋天蓓 + * 2015年8月14日下午2:07:02 + * TODO + */ +public class EffectUtil { + /** + * 粒子发生器 + * + * @param loc + * - 粒子产生的地点 + * @param range + * - 粒子的数量 + */ + public static void run(Location loc, long range) { + try { + int i; + if (range < 2) { + range = 2; + } + for (i = 0; i < range; i++) { + loc.getWorld().playEffect(loc, Effect.LAVA_POP, 10, 100); + loc.getWorld().playEffect(loc, Effect.PORTAL, 10, 100); + } + } catch (Exception e) { + } + } +} diff --git a/src/language.yml b/src/language.yml index 4ebc1b0..d61fd23 100644 --- a/src/language.yml +++ b/src/language.yml @@ -3,6 +3,8 @@ version: 1.0 #基础语言配置 Base: offline: "§c玩家 {0} 不存在或不在线!" + no-permission: '§c你没有此命令的权限.' + playercommand: '§c此命令只能由玩家执行.' #基础传送系统 Teleport: tp: '§a传送开始 {0}秒 后到达 目的地 §d世界: {1} §3X: {2} Z: {3}!'