Improve support for mypet

This commit is contained in:
Len 2024-04-20 15:12:13 +02:00
parent 1672fccced
commit 66276fbf47
2 changed files with 4 additions and 2 deletions

View File

@ -60,7 +60,7 @@ public class AFKDetector extends JavaPlugin implements Listener {
getCommand("afkcheck").setExecutor(new AFKCheckCommand(this));
getCommand("reloadafkdetector").setExecutor(new ReloadCommand(this));
new AFKCheckTimer(this).init();
myPetEnabled = getServer().getPluginManager().isPluginEnabled("MyPet");
myPetEnabled = getServer().getPluginManager().getPlugin("MyPet") != null;
} catch (Throwable t) {
getLogger().severe("An error has occured while loading AFKDetector");
if (!(t instanceof ExceptionInInitializerError)) {

View File

@ -97,7 +97,9 @@ public class AFKPlayer {
}
public void setAFK(Player player) {
sendPetAway();
if (AFKDetector.myPetEnabled)
sendPetAway();
bossBar.setTitle(afkKickSoon);
bossBar.setColor(BarColor.RED);
player.setAfk(true);