Solved "Strange" Error.

Discussion in 'Spigot Plugin Development' started by darkshadow22mc, May 27, 2016.

Thread Status:
Not open for further replies.
  1. Hi!
    I'm developing a command that allows the use of /freeze <player>.
    The point is that I get this console error while loading the plugin.
    Code (Text):
    [18:33:33 ERROR]: Error occurred while enabling OdiNServer v1.0 (Is it up to date?)
            at core.Nexus.onEnable( ~[?:?]
            at ~[s
    .java:335) [spigot-1.8.3.jar:git-Spigot-15fa8e1-17a3db7]
            at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManage [spigot-1.8.3.jar:git-Spigot-15fa8e1-17a3db7]
            at com.rylinaux.plugman.util.PluginUtil.load( [PlugM
            at com.rylinaux.plugman.util.PluginUtil.load( [PlugM
            at com.rylinaux.plugman.util.PluginUtil.reload( [Plu
            at com.rylinaux.plugman.command.ReloadCommand.execute(
    :122) [PlugMan.jar:?]
            at com.rylinaux.plugman.PlugManCommandHandler.onCommand(PlugManCommandHa [PlugMan.jar:?]
            at org.bukkit.command.PluginCommand.execute( [spig
            at org.bukkit.command.SimpleCommandMap.dispatch(
    1) [spigot-1.8.3.jar:git-Spigot-15fa8e1-17a3db7]
            at org.bukkit.craftbukkit.v1_8_R1.CraftServer.dispatchCommand(CraftServe [spigot-1.8.3.jar:git-Spigot-15fa8e1-17a3db7]
            at org.bukkit.craftbukkit.v1_8_R1.CraftServer.dispatchServerCommand(Craf [spigot-1.8.3.jar:git-Spigot-15fa8e1-17a3db7]
            at net.minecraft.server.v1_8_R1.DedicatedServer.aM(
    353) [spigot-1.8.3.jar:git-Spigot-15fa8e1-17a3db7]
            at net.minecraft.server.v1_8_R1.DedicatedServer.z(
    17) [spigot-1.8.3.jar:git-Spigot-15fa8e1-17a3db7]
            at net.minecraft.server.v1_8_R1.MinecraftServer.y(
    34) [spigot-1.8.3.jar:git-Spigot-15fa8e1-17a3db7]
    :537) [spigot-1.8.3.jar:git-Spigot-15fa8e1-17a3db7]
            at Source) [?:1.8.0_91]
    As is says, the error is on Nexus line 45. But the Line 45 of my plugin is the next one:
    Code (Text):
    getCommand("freeze").setExecutor(new FreezeCommand(this));
    The strange part is that I'm using the same method to load other commands (such as /kit)
    Here you have the code that I'm using on the class
    Code (Text):
    package perks;

    import net.md_5.bungee.api.ChatColor;

    import org.bukkit.Bukkit;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandExecutor;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;

    import core.Nexus;

    public class FreezeCommand implements CommandExecutor{
        Nexus nexus;
        public FreezeCommand(Nexus nexus){
   = nexus;
        public boolean onCommand(CommandSender sender,Command cmd,String commandLabel,String[] args){
                if(sender instanceof Player){
                    Player p = (Player) sender;
                    if(p.isOp() || p.hasPermission("odin.freeze")){
                        if(args.length == 0){
                            p.sendMessage(ChatColor.translateAlternateColorCodes('&', "&7[&3&l*&7] &c&lError: &cCorrect usage /freeze <player>"));
                        }else if(args.length == 1){
                            Player target = Bukkit.getPlayer(args[0]);
                            if(target != null){
                                if(target.getWalkSpeed() == 1 || target.getFlySpeed() == 1){
                                    p.sendMessage(ChatColor.translateAlternateColorCodes('&', "&7[&3&l*&7] &3&lRemember: &3Remember to do /freeze "+target.getName()+" after finish!"));
                                    p.sendMessage(ChatColor.translateAlternateColorCodes('&', "&7[&3&l*&7] &3Player "+target.getName()+" can walk again."));
                                p.sendMessage(ChatColor.translateAlternateColorCodes('&', "&7[&3&l*&7] &c&lError: &cThis player isn't online."));
                        }else if(args.length != 1 || args.length != 0){
                            p.sendMessage(ChatColor.translateAlternateColorCodes('&', "&7[&3&l*&7] &c&lError: &cToo many arguments."));
                        p.sendMessage(ChatColor.translateAlternateColorCodes('&', "&3&l[&f&lOdiN&3&l] &cUnknown command. Type /help to get information."));
                    Bukkit.getServer().getConsoleSender().sendMessage(ChatColor.translateAlternateColorCodes('&', "&7[&3&l*&7] &c&lERROR: Only"
                            + " players can perform the command."));
            return true;

    I hope that someone knows why it happens.

    As logical, line 45 is on the onEnable method and Nexus is the class that extends JavaPlugin.​
  2. Why are you using PlugMan?
  3. I'm using a lot of plugins developed by other people. I think PlugMan shouldn't be a problem, am I right?
  4. I think I know exactly what your issue is because I got this same error in the exact same scenario you are having. Did you rememeber to add the command to the plugin.yml file? That was my problem. It confused me for a while too, until I realized what I did.
  5. Thanks... I feel so stupid ;-;
Thread Status:
Not open for further replies.