Merge branch 'clans/alpha' of ssh://184.154.0.242:7999/min/Mineplex into clans/alpha

This commit is contained in:
NewGarbo 2016-02-04 22:55:53 +00:00
commit 6c7d08a8f9
3 changed files with 13 additions and 7 deletions

View File

@ -480,7 +480,7 @@ public class ClanInfo
public boolean isOnline() public boolean isOnline()
{ {
return isOnlineNow();// || System.currentTimeMillis() - _lastOnline.getTime() < Clans.getOnlineTime(); return isOnlineNow();
} }
public String getProtected() public String getProtected()
@ -489,7 +489,7 @@ public class ClanInfo
if (cur.isOnline()) if (cur.isOnline())
return C.cRed + "No - Clan Members are Online"; 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.cGreen + "Yes - Clan Members are Offline";
return C.cGold return C.cGold
@ -498,6 +498,10 @@ public class ClanInfo
TimeUnit.FIT) + " to Protection"; TimeUnit.FIT) + " to Protection";
} }
public boolean isProtected() {
return getProtected().startsWith(C.cGreen + "Yes");
}
public TntGenerator getGenerator() public TntGenerator getGenerator()
{ {
return _generator; return _generator;

View File

@ -263,7 +263,7 @@ public class ClansGame extends MiniPlugin
{ {
// Cancel // Cancel
event.SetCancelled("Clans Ally"); event.SetCancelled("Clans Ally");
// Inform // Inform
if (damager != null) if (damager != null)
{ {
@ -520,8 +520,9 @@ public class ClansGame extends MiniPlugin
{ {
ClanInfo clan = _clans.getClanUtility().getClanByPlayer(event.getPlayer()); ClanInfo clan = _clans.getClanUtility().getClanByPlayer(event.getPlayer());
if (clan == null) return; 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) @EventHandler(priority = EventPriority.LOWEST)
@ -538,14 +539,14 @@ public class ClansGame extends MiniPlugin
ClanInfo clan = _clans.getClanUtility().getOwner(event.getEntity().getLocation()); ClanInfo clan = _clans.getClanUtility().getOwner(event.getEntity().getLocation());
if (clan == null) return; if (clan == null) return;
if (_clans.getWarManager().isBeingInvaded(clan)) if (_clans.getWarManager().isBeingInvaded(clan))
{ {
// Allow because of invasion // Allow because of invasion
return; return;
} }
if (!clan.isOnline()) if (!clan.isProtected())
event.setCancelled(true); event.setCancelled(true);
else else
clan.inform(C.cRed + "Your Territory is under attack!", null); clan.inform(C.cRed + "Your Territory is under attack!", null);

View File

@ -30,6 +30,7 @@ public abstract class AttackAttribute extends ItemAttribute
@Override @Override
public void onAttack(CustomDamageEvent event) public void onAttack(CustomDamageEvent event)
{ {
if(event.GetCancellers().contains("Safe Zone")) return;
_attackCount++; _attackCount++;
System.out.println("Attack count " + _attackCount + " - " + _attackLimit); System.out.println("Attack count " + _attackCount + " - " + _attackLimit);
if (_attackCount >= _attackLimit) if (_attackCount >= _attackLimit)