Development Assistance Accesing a method

Discussion in 'Plugin Help/Development/Requests' started by quinster08, Jun 28, 2015.

Thread Status:
Not open for further replies.
  1. Offline

    quinster08

    Hello guys,

    I am creating a minigame. I have this method in my main class:
    Code:
            @SuppressWarnings("deprecation")
            public void startCountdown() {
                   Starter.start = 30;
                   starterId = Bukkit.getServer().getScheduler().scheduleSyncRepeatingTask((Plugin) this, new Starter(this), 20l, 20l);
            }
    I can't make it static, because then Eclipse give error. But I wanna acces / run it from another class. How do I do this?
     
  2. Offline

    timtower Administrator Administrator Moderator

    @quinster08 Make a constructor in the other class that takes an instance of this class as argument.
     
  3. Offline

    quinster08

    @timtower I have tried that. But eclipse give's an error and says the constructor must be static. Then I make it static, and have no errors. But it doesn't actualy work :s
     
  4. Offline

    timtower Administrator Administrator Moderator

    @quinster08 Show your constructor and how you use it please.
     
  5. Offline

    quinster08

    @timtower
    Code:
        Minigame plugin;
      
        public PlayerClass(Minigame runnerSpleef) {
            plugin = runnerSpleef;
        }
    then I try to use plugin.startCountdown(); and then it gives an error on plugin and says you must make Minigame static!

    The weird thing is: It works in 1 class, but in the other one it doesnt :S
     
  6. Offline

    timtower Administrator Administrator Moderator

    @quinster08 That shouldn't happen though. Could you post both classes? The entire class then
     
  7. Offline

    quinster08

    @timtower I have fixed my issue. I had a public static boolean. The static can be removed without issue's and now I don't get the error! Thanks for your help!
     
  8. Offline

    timtower Administrator Administrator Moderator

  9. Offline

    quinster08

    @timtower Wait its not fixed. I can't remove static. Any other way of fixing it? Omg, it is fixed... Sorry :D
     
  10. Offline

    timtower Administrator Administrator Moderator

    @quinster08
     
Thread Status:
Not open for further replies.

Share This Page