Adds powergain flag and worldsPowerGainDisabled config option. See #526
This commit is contained in:

committed by
Olof Larsson

parent
7ee391f6b9
commit
83767dc275
@@ -1,11 +1,16 @@
|
||||
package com.massivecraft.factions.task;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.massivecraft.factions.entity.BoardColl;
|
||||
import com.massivecraft.factions.entity.Faction;
|
||||
import com.massivecraft.factions.entity.MConf;
|
||||
import com.massivecraft.factions.entity.MFlag;
|
||||
import com.massivecraft.factions.entity.MPlayer;
|
||||
import com.massivecraft.factions.event.EventFactionsPowerChange;
|
||||
import com.massivecraft.factions.event.EventFactionsPowerChange.PowerChangeReason;
|
||||
import com.massivecraft.massivecore.ModuloRepeatTask;
|
||||
import com.massivecraft.massivecore.ps.PS;
|
||||
import com.massivecraft.massivecore.util.MUtil;
|
||||
import com.massivecraft.massivecore.util.TimeUnit;
|
||||
|
||||
@@ -44,6 +49,14 @@ public class TaskPlayerPowerUpdate extends ModuloRepeatTask
|
||||
if (MUtil.isntPlayer(player)) continue;
|
||||
if (player.isDead()) continue;
|
||||
|
||||
// Check the powergain flag is not disabled
|
||||
Faction faction = BoardColl.get().getFactionAt(PS.valueOf(player.getLocation()));
|
||||
|
||||
if ( ! faction.getFlag(MFlag.getFlagPowergain())) return;
|
||||
|
||||
// Check power gain has not been disabled in this world
|
||||
if ( ! MConf.get().worldsPowerGainEnabled.contains(player)) return;
|
||||
|
||||
MPlayer mplayer = MPlayer.get(player);
|
||||
double newPower = mplayer.getPower() + mplayer.getPowerPerHour() * millis / TimeUnit.MILLIS_PER_HOUR;
|
||||
|
||||
|
Reference in New Issue
Block a user