Little more work on Clans.

This commit is contained in:
Jonathan Williams 2014-11-23 05:08:33 -08:00
parent cb43bc04d3
commit 1198426d8d

View File

@ -37,6 +37,7 @@ import mineplex.core.creature.event.CreatureSpawnCustomEvent;
import mineplex.core.teleport.Teleport;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.game.clans.clans.ClansUtility.ClanRelation;
import mineplex.game.clans.clans.repository.ClanTerritory;
import mineplex.minecraft.game.core.combat.CombatManager;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
@ -126,9 +127,6 @@ public class ClansManager extends MiniClientPlugin<ClientClan>
@EventHandler
public void Update(UpdateEvent event)
{
if (event.getType() == UpdateType.SEC)
Power();
if (event.getType() == UpdateType.FAST)
CGame().UpdateSafe();
@ -184,7 +182,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan>
@EventHandler(priority = EventPriority.HIGHEST)
public void BlockCreatureSpawn(CreatureSpawnCustomEvent event)
{
ClansClan clan = Clans().CUtil().getOwner(event.GetLocation());
ClansClan clan = _clanUtility.getOwner(event.GetLocation());
if (clan != null)
if (!clan.IsAdmin() && !clan.GetName().equals("Spawn"))
@ -263,18 +261,18 @@ public class ClansManager extends MiniClientPlugin<ClientClan>
public boolean HandleClanChat(AsyncPlayerChatEvent event, String filteredMessage)
{
CoreClient client = Clients().Get(event.getPlayer());
ClientClan client = Get(event.getPlayer());
if (client == null)
return false;
if (!client.Clan().IsClanChat())
if (!client.isClanChat())
return false;
ClansClan clan = CUtil().getClanByPlayer(event.getPlayer());
ClanInfo clan = _clanUtility.getClanByPlayer(event.getPlayer());
if (clan == null)
{
Clients().Get(event.getPlayer()).Clan().SetClanChat(false);
Get(event.getPlayer()).setClanChat(false);
return false;
}
@ -287,10 +285,10 @@ public class ClansManager extends MiniClientPlugin<ClientClan>
if (!Get(event.getPlayer()).isAllyChat())
return false;
ClansClan clan = CUtil().getClanByPlayer(event.getPlayer());
ClanInfo clan = _clanUtility.getClanByPlayer(event.getPlayer());
if (clan == null)
{
Clients().Get(event.getPlayer()).Clan().SetAllyChat(false);
Get(event.getPlayer()).setAllyChat(false);
return false;
}
@ -331,59 +329,38 @@ public class ClansManager extends MiniClientPlugin<ClientClan>
return _reclaimTime;
}
@Override
public boolean CanHurt(Player a, Player b)
public boolean canHurt(Player a, Player b)
{
if (a.equals(b))
return false;
return CUtil().canHurt(a, b);
return _clanUtility.canHurt(a, b);
}
@Override
public boolean CanHurt(String a, String b)
public boolean canHurt(String a, String b)
{
if (a.equals(b))
return false;
return CUtil().canHurt(UtilPlayer.searchExact(a), UtilPlayer.searchExact(b));
return _clanUtility.canHurt(UtilPlayer.searchExact(a), UtilPlayer.searchExact(b));
}
@Override
public boolean IsSafe(Player a)
public boolean isSafe(Player a)
{
return CUtil().isSafe(a);
return _clanUtility.isSafe(a);
}
public IRepository GetRepository() {
return _repository;
}
public void SetRepository(IRepository _repository) {
this._repository = _repository;
}
public HashMap<String, ClansClan> GetClanMemberMap()
public ClanRelation getRelation(String playerA, String playerB)
{
return _clanMemberMap;
}
public ClanRelation GetRelation(String playerA, String playerB)
{
return Clients().Get(playerA).Clan().GetRelation(playerB);
return Get(playerA).getRelation(playerB);
}
@Override
public ChatColor GetColorOfFor(String other, Player player)
{
return CUtil().relChatColor(Clients().Get(player).Clan().GetRelation(other), false);
return _clanUtility.relChatColor(Get(player).getRelation(other), false);
}
public String GetServerName()
{
return _serverName;
}
public long getOnlineTime()
{
return _onlineTime;