1
0
mirror of https://e.coding.net/circlecloud/TeleportRandom.git synced 2024-12-26 16:38:49 +00:00

feat: 修复数组越界错误

Signed-off-by: 502647092 <admin@yumc.pw>
This commit is contained in:
502647092 2016-07-20 10:57:15 +08:00
parent 8fee67e861
commit dc133a01f0
2 changed files with 14 additions and 12 deletions

View File

@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>pw.yumc</groupId> <groupId>pw.yumc</groupId>
<artifactId>TeleportRandom</artifactId> <artifactId>TeleportRandom</artifactId>
<version>1.4</version> <version>1.4.1</version>
<name>TeleportRandom</name> <name>TeleportRandom</name>
<build> <build>
<finalName>${project.name}</finalName> <finalName>${project.name}</finalName>
@ -59,6 +59,7 @@
<properties> <properties>
<update.description>&amp;a代码重构版本</update.description> <update.description>&amp;a代码重构版本</update.description>
<update.changes> <update.changes>
&amp;b1.4.1 - &amp;c修复AIOOBE错误...;
&amp;b1.4 - &amp;a添加命令CD...; &amp;b1.4 - &amp;a添加命令CD...;
&amp;b1.3.2 - &amp;c修复上个版本的空指针错误...; &amp;b1.3.2 - &amp;c修复上个版本的空指针错误...;
&amp;b1.3.1 - &amp;c修复上个版本一个逻辑错误...; &amp;b1.3.1 - &amp;c修复上个版本一个逻辑错误...;

View File

@ -26,16 +26,6 @@ public class TeleportRandom extends JavaPlugin implements CommandExecutor {
@Override @Override
public boolean onCommand(final CommandSender sender, final Command cmd, final String string, final String[] args) { public boolean onCommand(final CommandSender sender, final Command cmd, final String string, final String[] args) {
if (args[0].equalsIgnoreCase("reload")) {
config.reload();
sender.sendMessage(getPrefix() + config.getMessage("Message.Reload"));
return true;
}
if (args[0].equalsIgnoreCase("help")) {
sender.sendMessage("玩家: /tpr [范围] [世界]");
sender.sendMessage("控制台: /tpr <玩家> [范围] [世界]");
return true;
}
try { try {
if (sender instanceof Player) { if (sender instanceof Player) {
final Player p = (Player) sender; final Player p = (Player) sender;
@ -54,7 +44,6 @@ public class TeleportRandom extends JavaPlugin implements CommandExecutor {
randomTP(Integer.parseInt(args[0]), Bukkit.getWorld(args[1]), p); randomTP(Integer.parseInt(args[0]), Bukkit.getWorld(args[1]), p);
break; break;
} }
return true; return true;
} else if (args.length > 1) { } else if (args.length > 1) {
final Player p = Bukkit.getPlayer(args[0]); final Player p = Bukkit.getPlayer(args[0]);
@ -73,6 +62,18 @@ public class TeleportRandom extends JavaPlugin implements CommandExecutor {
} catch (final IllegalArgumentException e) { } catch (final IllegalArgumentException e) {
sender.sendMessage(getPrefix() + "§c非法的参数或不存在的世界!"); sender.sendMessage(getPrefix() + "§c非法的参数或不存在的世界!");
} }
if (args.length > 0) {
if (args[0].equalsIgnoreCase("reload")) {
config.reload();
sender.sendMessage(getPrefix() + config.getMessage("Message.Reload"));
return true;
}
if (args[0].equalsIgnoreCase("help")) {
sender.sendMessage("玩家: /tpr [范围] [世界]");
sender.sendMessage("控制台: /tpr <玩家> [范围] [世界]");
return true;
}
}
return false; return false;
} }