Merge pull request #95 from ermalsh/cannon_notify

Cannon notify
This commit is contained in:
Ganom
2019-04-24 20:40:25 -04:00
committed by GitHub
2 changed files with 27 additions and 0 deletions

View File

@@ -83,4 +83,24 @@ public interface CannonConfig extends Config
{
return true;
}
@ConfigItem(
keyName = "ammoAmount",
name = "Ammo left",
description = "Configure to set the amount of ammo left to receive ammo left notification"
)
default int ammoAmount()
{
return 5;
}
@ConfigItem(
keyName = "notifyAmmoLeft",
name = "Ammo left notification",
description = "Sends a notification when cannon ammo is under the specified amount"
)
default boolean notifyAmmoLeft()
{
return true;
}
}

View File

@@ -379,6 +379,13 @@ public class CannonPlugin extends Plugin
{
return Color.orange;
}
else if (cballsLeft <= config.ammoAmount())
{
if (config.notifyAmmoLeft())
{
notifier.notify("Your cannon has " + config.ammoAmount() + " balls left!");
}
}
return Color.red;
}