9
0
mirror of https://gitlab.com/SamB440/rpgregions-2.git synced 2026-01-04 15:31:38 +00:00

Implement time between reward

This commit is contained in:
SamB440
2022-08-26 12:50:42 +01:00
parent b125fc42ff
commit 6eb563198f
13 changed files with 22 additions and 1 deletions

View File

@@ -15,6 +15,8 @@ public abstract class DiscoveryReward implements IGuiEditable {
@GuiEditable("Time Between Reward (s)")
private int timeBetweenReward;
private long lastReward;
public DiscoveryReward(IRPGRegionsAPI api) {
this.api = api;
}
@@ -29,6 +31,10 @@ public abstract class DiscoveryReward implements IGuiEditable {
*/
public abstract void award(Player player);
protected void updateAwardTime() {
this.lastReward = System.currentTimeMillis();
}
public boolean isAlwaysAward() {
return alwaysAward;
}
@@ -45,6 +51,10 @@ public abstract class DiscoveryReward implements IGuiEditable {
this.timeBetweenReward = timeBetweenReward;
}
public boolean canAward() {
return (System.currentTimeMillis() - lastReward) >= (timeBetweenReward * 1000L);
}
public String getPluginRequirement() {
return null;
}