Solved Melting Blocks...

Discussion in 'Spigot Plugin Development' started by Wilsoon, Feb 19, 2020.

Thread Status:
Not open for further replies.
  1. Don't really know where to post this but I want to make a plugin where it prevents Snow from melting. But I don't know what event to put it under so that I can cancel it. or if there's any gamerule I can set in my server.

    Side question: I did reloadConfig() and it said Unable to find reload. What does this mean?
  2. drives_a_ford


    You want to listen to the BlockFadeEvent.

    As for the "side question", you'd need to include the actual stacktrace of the error you're seeing.
  3. No stacktrace, it issued the command as per normal.
  4. drives_a_ford


    Then where did you see this "Unable to find reload."?
  5. It's my own plugin. I took an instance of my Main class, and called reloadConfig() from there. That's where there "Unable to find reload" came by.
    I'm sure I set my instance = this, I've also already did saveDefaultConfig() in onEnable().
  6. drives_a_ford


    Please provide the code that you're using and the details of the issue you've got.
    Where do you see this message? Is it in your IDE when looking at the source? Is it in the console when running the plugin?
    What's the actual message you're seeing?

    Right now you're giving next to no information to go on.
  7. It's a spleef plugin, and I used /spleef reload to reload my plugin. (I'm ready for more criticism)
    No Exception is thrown, thus, when I do /spleef reload, it just says "Unable to find reload." then it says "Successfully reloaded bla bla bla"
    Main class:
    Code (Java):



    import commands.*;
    import events.*;

    public class SpleefGame extends JavaPlugin {
        private static SpleefGame instance;
        public static SpleefGame getInstance() { return instance; }
        public void onEnable() {
            instance = this;
            getLogger().info("Registering Events...");
            getServer().getPluginManager().registerEvents(new SpleefWinnerEvents(), this);
            getLogger().info("Registering Commands...");
            getCommand("spleef").setExecutor(new SpleefBaseCommand());
            getLogger().info("Checking for NoNaturalDecay, created by Wilsoon. Meant for Spleef.");
            if(getServer().getPluginManager().getPlugin("NoNaturalDecay") != null) {
                getLogger().info("NoNaturalDecay found, snow will not melt.");
            } else { getLogger().info("NoNaturalDecay was not found. NoNaturalDecay is just a recommendation."); }  
            getLogger().info("Successfully enabled SpleefGame.");
            getLogger().info(" | Coded by Wilsoon.");
        public void onDisable() {
            getLogger().info("Successfully disabled SpleefGame.");
            getLogger().info(" | Coded by Wilsoon.");

    Reload area:
    Code (Java):

    if(args.length > 0 && !args[0].equalsIgnoreCase("accept") && !args[0].equalsIgnoreCase("deny") && args[0].equalsIgnoreCase("reload")) {
                    sender.sendMessage(ChatColor.GREEN + "Successfully reloaded SpleefGame's configuration.");
  8. drives_a_ford


    Again, you need to provide the whole actual code and actual output.

    As for the code you posted.
    Firstly, don't be afraid of whitespace. When cramping everything on one line like you're trying to do in the else clause of the NoNaturalDecay check, all you're doing is making sure the reader of the code spends an extra few seconds trying to understand your code.
    Secondly, I don't like plugins being so verbouse. You don't really need all those log messages in onEnable. If something goes wrong, you'll see an error anyway. You could simply replace the log messages with comments if you like.
    Lastly, you don't need to check for !args[0].equalsIgnoreCase("accept") && !args[0].equalsIgnoreCase("deny"). args[0].equalsIgnoreCase("reload") already assures you don't get any of the other words. The same word cannot both be "accept" and/or "deny" and "reload". You would also probably be better of just using a switch statement here for the first argument.

    But again, since you didn't post the entire onCommand method nor the entire actual output, I still can't help you with your "Unable to find reload" issue.
  9. I've managed to fix it. Thank you!
Thread Status:
Not open for further replies.