Плагины майнкрафт - 1

Xb
- в Карты
1

Я первый раз пишу плагины всё работает. Пока я пишу простенькие плагины на дом то есть /savehome и /tphome
/tphome работает без ошибок в чате
а /savehome работает но с ошибкой: An internal error occurred white attempting to perform this command вместо точка дома установлена!

код плагина:
public class JSM extends JavaPlugin implements Listener {

private static JSM instance;
FileConfiguration config = getConfig();

public static JSM instance() {
return instance;
}

public void onEnable() {
Bukkit.getServer().getPluginManager().registerEvents(this, this);
}

public void onDisable() {

}

public boolean checkSender (CommandSender sender) {
if (sender instanceof Player) {
return false;
}
return true;
}
public boolean onCommand (CommandSender sender, Command cmd, String label, String[] args) {
if (cmd.getName().equalsIgnoreCase("savehome")) {
if (checkSender(sender)) {
sender.sendMessage(ChatColor.GREEN + "[Твой дом] → Точка дома установлена!)");
return true;
}
Player p = (Player) sender;

locToConfig(p.getName(), p.getLocation());
p.sendMessage(ChatColor.GREEN + "[Твой дом] → Точка дома установлена!)");
return true;
}
if (cmd.getName().equalsIgnoreCase("tphome")) {
if (checkSender(sender)) {
sender.sendMessage(ChatColor.GREEN + "[Твой дом] → ты дома)");
return true;
}
Player p = (Player) sender;

Location home = configToLoc(p.getName());
p.teleport(home);
p.sendMessage(ChatColor.GREEN + "[Твой дом] → ты дома)");
return true;
}
return false;
}

public void locToConfig(String name, Location loc) {
config.set((new StringBuilder("locations.")).append(name).append(".world").toString(), loc.getWorld().getName());
config.set((new StringBuilder("locations.")).append(name).append(".x").toString(), Double.valueOf(loc.getX( ;
config.set((new StringBuilder("locations.")).append(name).append(".y").toString(), Double.valueOf(loc.getY( ;
config.set((new StringBuilder("locations.")).append(name).append(".z").toString(), Double.valueOf(loc.getZ( ;
JSM.instance().saveConfig();
}

public Location configToLoc (String name) {
if (!config.getConfigurationSection("locations.").isConfigurationSection(name)) return null;

Location loc = new Location(Bukkit.getServer().getWorld(config.getString("locations." + name + ".world")),
config.getDouble("locations." + name + ".x"),
config.getDouble("locations." + name + ".y"),
config.getDouble("locations." + name + ".z"));
return loc;
}

ошибка в консоли:
[15:57:51 ERROR]: null
org.bukkit.command.CommandException: Unhandled exception executing command 'savehome' in plugin JoinSoundMessager v0.0.1
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:46) ~[spigot-1.8.jar: git-Spigot-c3c767f-33d5de3]
at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:141) ~[spigot-1.8.jar: git-Spigot-c3c767f-33d5de3]
at org.bukkit.craftbukkit.v1_8_R1.CraftServer.dispatchCommand(CraftServer.java:646) ~[spigot-1.8.jar: git-Spigot-c3c767f-33d5de3]
at net.minecraft.server.v1_8_R1.PlayerConnection.handleCommand(PlayerConnection.java:1115) [spigot-1.8.jar: git-Spigot-c3c767f-33d5de3]
at net.minecraft.server.v1_8_R1.PlayerConnection.a(PlayerConnection.java:950) [spigot-1.8.jar: git-Spigot-c3c767f-33d5de3]
at net.minecraft.server.v1_8_R1.PacketPlayInChat.a(PacketPlayInChat.java:26) [spigot-1.8.jar: git-Spigot-c3c767f-33d5de3]
at net.minecraft.server.v1_8_R1.PacketPlayInChat.a(PacketPlayInChat.java:53) [spigot-1.8.jar: git-Spigot-c3c767f-33d5de3]
(не вся)

Ze

Тебе в эту категорию