1.15.2 (SOLVED)

Discussion in 'Spigot Plugin Development' started by xFadedxShadow, Mar 30, 2020.

Thread Status:
Not open for further replies.
  1. Code (Text):
    [06:07:35 INFO]: [Faded-Essentails] Enabling Faded-Essentails v0.1
    [06:07:35 ERROR]: Error occurred while enabling Faded-Essentails v0.1 (Is it up to date?)
    java.lang.NullPointerException: null
        at me.xfadedxshadow.commands.HealCommand.<init>(HealCommand.java:19) ~[?:?]
        at me.xfadedxshadow.FadedEssentials.onEnable(FadedEssentials.java:13) ~[?:?]
        at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:263) ~[patched_1.15.2.jar:git-Paper-143]
        at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:337) ~[patched_1.15.2.jar:git-Paper-143]
        at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:435) ~[patched_1.15.2.jar:git-Paper-143]
        at org.bukkit.craftbukkit.v1_15_R1.CraftServer.enablePlugin(CraftServer.java:470) ~[patched_1.15.2.jar:git-Paper-143]
        at org.bukkit.craftbukkit.v1_15_R1.CraftServer.enablePlugins(CraftServer.java:384) ~[patched_1.15.2.jar:git-Paper-143]
        at org.bukkit.craftbukkit.v1_15_R1.CraftServer.reload(CraftServer.java:884) ~[patched_1.15.2.jar:git-Paper-143]
        at org.bukkit.Bukkit.reload(Bukkit.java:654) ~[patched_1.15.2.jar:git-Paper-143]
        at org.bukkit.command.defaults.ReloadCommand.execute(ReloadCommand.java:54) ~[patched_1.15.2.jar:git-Paper-143]
        at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:159) ~[patched_1.15.2.jar:git-Paper-143]
        at org.bukkit.craftbukkit.v1_15_R1.CraftServer.dispatchCommand(CraftServer.java:752) ~[patched_1.15.2.jar:git-Paper-143]
        at org.bukkit.craftbukkit.v1_15_R1.CraftServer.dispatchServerCommand(CraftServer.java:714) ~[patched_1.15.2.jar:git-Paper-143]
        at net.minecraft.server.v1_15_R1.DedicatedServer.handleCommandQueue(DedicatedServer.java:469) ~[patched_1.15.2.jar:git-Paper-143]
        at net.minecraft.server.v1_15_R1.DedicatedServer.b(DedicatedServer.java:431) ~[patched_1.15.2.jar:git-Paper-143]
        at net.minecraft.server.v1_15_R1.MinecraftServer.a(MinecraftServer.java:1112) ~[patched_1.15.2.jar:git-Paper-143]
        at net.minecraft.server.v1_15_R1.MinecraftServer.run(MinecraftServer.java:934) ~[patched_1.15.2.jar:git-Paper-143]
        at java.lang.Thread.run(Thread.java:748) [?:1.8.0_242]
    [06:07:35 INFO]: [Faded-Essentails] Disabling Faded-Essentails v0.1
     
     
  2. It would be great if we could see your code, can't help you if you just post an error. Anyways:
    Code (Text):
     java.lang.NullPointerException: null
        at me.xfadedxshadow.commands.HealCommand.<init>(HealCommand.java:19) ~[?:?]
        at me.xfadedxshadow.FadedEssentials.onEnable(FadedEssentials.java:13) ~[?:?]
     
  3. Show us a code. HealCommand.java
     
    • Agree Agree x 1
  4. Code (Java):
    package me.xfadedxshadow.commands;

    import org.bukkit.GameMode;
    import org.bukkit.command.Command;
    import org.bukkit.command.CommandExecutor;
    import org.bukkit.command.CommandSender;
    import org.bukkit.entity.Player;
    import org.bukkit.event.Listener;

    import me.xfadedxshadow.FadedEssentials;
    import me.xfadedxshadow.utils.Utils;

    public class HealCommand implements CommandExecutor, Listener {
       
        private FadedEssentials plugin;
       
        public HealCommand(FadedEssentials plugin) {
            this.plugin = plugin;
            plugin.getCommand("heal").setExecutor(this);
        }

        @Override
        public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
            if (sender instanceof Player) {
                Player p = (Player) sender;
                if (p.hasPermission("faded-essentials.heal")) {
                    if (p.getGameMode().equals(GameMode.SURVIVAL)) {
                        p.setHealth(20);
                        p.sendMessage(Utils.chat(plugin.getConfig().getString("messages.command.heal.healed")));
                        return true;
                    }
                    p.sendMessage(Utils.chat(plugin.getConfig().getString("messages.gamemode_error")));
                    return true;
                }
                p.sendMessage(Utils.chat(plugin.getConfig().getString("messages.permission_error")));
                return true;
            }
            sender.sendMessage(Utils.chat(plugin.getConfig().getString("messages.console_error")));
            return false;
        }

    }
     
    Main Class:
    Code (Text):
    package me.xfadedxshadow;

    import org.bukkit.plugin.java.JavaPlugin;

    import me.xfadedxshadow.commands.*;

    public class FadedEssentials extends JavaPlugin {
       
        @Override
        public void onEnable() {
           
            new FlyCommand(this);
            new HealCommand(this);

            this.saveDefaultConfig();
           
        }
       
        @Override
        public void onDisable() {
           
        }

    }
     
     
  5. what's in your plugin.yml?
     
  6. I'm so sorry for wasting yours guys time i just realized something. (I was working on this at like 6am so please don't be too harsh) it's not in the plugin.yml file *facepalm*
     
Thread Status:
Not open for further replies.