From 0e0582a1a7c339a00f49fcdfabc40314327fc88f Mon Sep 17 00:00:00 2001 From: phobia Date: Wed, 3 Feb 2016 10:39:21 +1100 Subject: [PATCH 1/2] Added safe zone protection for flame --- .../src/mineplex/game/clans/clans/ClansGame.java | 4 ++-- .../mineplex/game/clans/items/attributes/AttackAttribute.java | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansGame.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansGame.java index 9db1f9d2e..01b9f4a39 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansGame.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansGame.java @@ -263,7 +263,7 @@ public class ClansGame extends MiniPlugin { // Cancel event.SetCancelled("Clans Ally"); - + // Inform if (damager != null) { @@ -538,7 +538,7 @@ public class ClansGame extends MiniPlugin ClanInfo clan = _clans.getClanUtility().getOwner(event.getEntity().getLocation()); if (clan == null) return; - + if (_clans.getWarManager().isBeingInvaded(clan)) { // Allow because of invasion diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/attributes/AttackAttribute.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/attributes/AttackAttribute.java index 836665064..58f115f2d 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/attributes/AttackAttribute.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/items/attributes/AttackAttribute.java @@ -30,6 +30,7 @@ public abstract class AttackAttribute extends ItemAttribute @Override public void onAttack(CustomDamageEvent event) { + if(event.GetCancellers().contains("Safe Zone")) return; _attackCount++; System.out.println("Attack count " + _attackCount + " - " + _attackLimit); if (_attackCount >= _attackLimit) From f011fdad5fd601f32fe44f4da8ca28744ceaa957 Mon Sep 17 00:00:00 2001 From: phobia Date: Wed, 3 Feb 2016 15:10:56 +1100 Subject: [PATCH 2/2] Fixes to TntProtection --- .../src/mineplex/game/clans/clans/ClanInfo.java | 8 ++++++-- .../src/mineplex/game/clans/clans/ClansGame.java | 7 ++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClanInfo.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClanInfo.java index fac283def..d5bc9c5ba 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClanInfo.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClanInfo.java @@ -478,7 +478,7 @@ public class ClanInfo public boolean isOnline() { - return isOnlineNow();// || System.currentTimeMillis() - _lastOnline.getTime() < Clans.getOnlineTime(); + return isOnlineNow(); } public String getProtected() @@ -487,7 +487,7 @@ public class ClanInfo if (cur.isOnline()) return C.cRed + "No - Clan Members are Online"; - if (System.currentTimeMillis() - _lastOnline.getTime() > Clans.getOnlineTime()) + if (UtilTime.elapsed(_lastOnline.getTime(), Clans.getOnlineTime())) return C.cGreen + "Yes - Clan Members are Offline"; return C.cGold @@ -496,6 +496,10 @@ public class ClanInfo TimeUnit.FIT) + " to Protection"; } + public boolean isProtected() { + return getProtected().startsWith(C.cGreen + "Yes"); + } + public TntGenerator getGenerator() { return _generator; diff --git a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansGame.java b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansGame.java index 01b9f4a39..b1e198995 100644 --- a/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansGame.java +++ b/Plugins/Mineplex.Game.Clans/src/mineplex/game/clans/clans/ClansGame.java @@ -520,8 +520,9 @@ public class ClansGame extends MiniPlugin { ClanInfo clan = _clans.getClanUtility().getClanByPlayer(event.getPlayer()); if (clan == null) return; - - clan.setLastOnline(new Timestamp(System.currentTimeMillis())); + + if(!clan.isOnline()) clan.setLastOnline(new Timestamp(System.currentTimeMillis())); //Noone else on + else clan.setLastOnline(new Timestamp(0)); } @EventHandler(priority = EventPriority.LOWEST) @@ -545,7 +546,7 @@ public class ClansGame extends MiniPlugin return; } - if (!clan.isOnline()) + if (!clan.isProtected()) event.setCancelled(true); else clan.inform(C.cRed + "Your Territory is under attack!", null);