-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
3 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,14 @@ | ||
package me.snoh666.manhunt; | ||
|
||
import org.bukkit.command.Command; | ||
import org.bukkit.command.CommandSender; | ||
import org.bukkit.plugin.java.JavaPlugin; | ||
import org.bukkit.scheduler.BukkitRunnable; | ||
|
||
public class InitCommand extends JavaPlugin { | ||
private boolean isCompassTrackerStarted = false; | ||
private final BukkitRunnable CompassTracker = new CompassTracker(this); | ||
|
||
@Override | ||
public void onEnable() {} | ||
public void onEnable() { | ||
new CompassTracker(this).runTaskTimer(this, 0L, 20L); | ||
} | ||
|
||
@Override | ||
public void onDisable() {} | ||
|
||
@Override | ||
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) { | ||
if (cmd.getName().equalsIgnoreCase("manhunt")) { | ||
if (args[0] != null) { | ||
if (this.isCompassTrackerStarted && args[0].equals("stop")) { | ||
this.CompassTracker.cancel(); | ||
sender.sendMessage("[manhunt]: updating compass stopped"); | ||
return true; | ||
} else if(!this.isCompassTrackerStarted && args[0].equals("start")) { | ||
this.CompassTracker.runTaskTimer(this, 0L, 20L); | ||
sender.sendMessage("[manhunt]: updating compass started"); | ||
return true; | ||
} | ||
return false; | ||
} else { | ||
sender.sendMessage("[manhunt]: Correct command usage: /manhunt <start | stop>"); | ||
return true; | ||
} | ||
} | ||
return false; | ||
} | ||
} |