From 30b3facc198890bc5c559248b09e6c074395e9c7 Mon Sep 17 00:00:00 2001 From: Brettflan Date: Sat, 28 Jan 2012 05:59:07 -0600 Subject: [PATCH] Players no longer regain power while dead; no more waiting to respawn in order to regain power Also added AuthDB to softdepend list, so it has first shot at Factions commands in case it needs to cancel one --- plugin.yml | 2 +- src/com/massivecraft/factions/FPlayer.java | 3 +++ .../factions/listeners/FactionsPlayerListener.java | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/plugin.yml b/plugin.yml index aaa8ab4b..4ff23f60 100644 --- a/plugin.yml +++ b/plugin.yml @@ -2,7 +2,7 @@ name: Factions version: 1.7_dev main: com.massivecraft.factions.P authors: [Olof Larsson, Brett Flannigan] -softdepend: [PermissionsEx, Permissions, Essentials, EssentialsChat, HeroChat, iChat, LocalAreaChat, LWC, nChat, ChatManager, CAPI, AuthMe, Vault, Spout, WorldEdit, WorldGuard, CaptureThePoints, CombatTag] +softdepend: [PermissionsEx, Permissions, Essentials, EssentialsChat, HeroChat, iChat, LocalAreaChat, LWC, nChat, ChatManager, CAPI, AuthMe, Vault, Spout, WorldEdit, WorldGuard, AuthDB, CaptureThePoints, CombatTag] commands: factions: description: Reference command for Factions. diff --git a/src/com/massivecraft/factions/FPlayer.java b/src/com/massivecraft/factions/FPlayer.java index d8a84367..746ebd56 100644 --- a/src/com/massivecraft/factions/FPlayer.java +++ b/src/com/massivecraft/factions/FPlayer.java @@ -385,6 +385,9 @@ public class FPlayer extends PlayerEntity implements EconomyParticipator long millisPassed = now - this.lastPowerUpdateTime; this.lastPowerUpdateTime = now; + Player thisPlayer = this.getPlayer(); + if (thisPlayer != null && thisPlayer.isDead()) return; // don't let dead players regain power until they respawn + int millisPerMinute = 60*1000; double powerPerMinute = Conf.powerPerMinute; if(Conf.scaleNegativePower && this.power < 0) diff --git a/src/com/massivecraft/factions/listeners/FactionsPlayerListener.java b/src/com/massivecraft/factions/listeners/FactionsPlayerListener.java index 30386acf..d083a8d4 100644 --- a/src/com/massivecraft/factions/listeners/FactionsPlayerListener.java +++ b/src/com/massivecraft/factions/listeners/FactionsPlayerListener.java @@ -285,6 +285,9 @@ public class FactionsPlayerListener implements Listener public void onPlayerRespawn(PlayerRespawnEvent event) { FPlayer me = FPlayers.i.get(event.getPlayer()); + + me.getPower(); // update power, so they won't have gained any while dead + Location home = me.getFaction().getHome(); if (