Solved Method not working?

Discussion in 'Spigot Plugin Development' started by MaxTheMango, Jun 3, 2018.

  1. In my onenable I'm checking if a value is true in the config and then running a method. When the value is true it runs whatever code is in the constructors like it should, but it doesn't actually run the method for some reason.

    Code (Java):
    if (getConfig().getBoolean("settings.pinglimiter.enabled")) pingLimiter.startChecks();"1");

    Code (Java):
    public static void startChecks() {
            Bukkit.getScheduler().runTaskTimerAsynchronously(Core.getInstance(), new Runnable() {
                public void run() {

          "ping check");
            }, 200, 10);
  2. if (getConfig().getBoolean("settings.pinglimiter.enabled")) pingLimiter.startChecks();"1");
    wouldnt you have to change it to this?
    Code (Text):
    if (getConfig().getBoolean("settings.pinglimiter.enabled")) { pingLimiter.startChecks();"1");
  3. Not using any curly braces in your if statement is not good practice, and will actually only run the first line beneath it. To make your if statement run both lines of code you will need to wrap it like so:
    Code (Java):

    if (getConfig().getBoolean("settings.pinglimiter.enabled")) {
    This also makes the code easier to read, if you run the plugin now do you still get the "1" output?
    My guess is you most likely have an issue with how your config is setup.
    • Informative Informative x 1
  4. Alright, thanks. The method wasn't running because pinglimiter was indented too far so was under whatever was above it, little mistake :ROFLMAO:.
  5. too late i sniped you