Fix compile issue

This commit is contained in:
Shaun Bennett 2015-10-18 12:42:56 -04:00
parent 177e482dbc
commit 0a3f942575

View File

@ -2,6 +2,7 @@ package mineplex.game.clans.clans;
import java.util.HashSet;
import java.util.TimeZone;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.Location;
@ -38,12 +39,15 @@ import mineplex.core.common.util.F;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilWorld;
import mineplex.core.creature.Creature;
import mineplex.core.creature.event.CreatureSpawnCustomEvent;
import mineplex.core.disguise.DisguiseManager;
import mineplex.core.donation.DonationManager;
import mineplex.core.energy.Energy;
import mineplex.core.explosion.Explosion;
import mineplex.core.gui.SimpleGuiItem;
import mineplex.core.hologram.HologramManager;
import mineplex.core.movement.Movement;
import mineplex.core.npc.NpcManager;
import mineplex.core.packethandler.PacketHandler;
@ -63,6 +67,7 @@ import mineplex.game.clans.clans.event.ClansPlayerDeathEvent;
import mineplex.game.clans.clans.loot.LootManager;
import mineplex.game.clans.clans.map.ItemMapManager;
import mineplex.game.clans.clans.murder.MurderManager;
import mineplex.game.clans.clans.observer.ObserverManager;
import mineplex.game.clans.clans.redis.ClanDeleteCommandHandler;
import mineplex.game.clans.clans.redis.ClanLoadCommandHandler;
import mineplex.game.clans.clans.regions.ClansRegions;
@ -99,7 +104,11 @@ import mineplex.minecraft.game.core.condition.ConditionManager;
import mineplex.minecraft.game.core.damage.DamageManager;
import mineplex.minecraft.game.core.fire.Fire;
import mineplex.minecraft.game.core.mechanics.Weapon;
import mineplex.serverdata.Region;
import mineplex.serverdata.commands.ServerCommandManager;
import mineplex.serverdata.redis.RedisDataRepository;
import mineplex.serverdata.servers.ConnectionData;
import mineplex.serverdata.servers.ServerManager;
public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelation
{
@ -125,6 +134,9 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
private Teleport _teleport;
private ConditionManager _condition;
private ClassCombatShop _classShop;
private HologramManager _hologramManager;
private GearManager _gearManager;
private LootManager _lootManager;
private ClassManager _classManager;
public ClassManager getClassManager() { return _classManager; }
@ -147,7 +159,8 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
//Clans
private NautHashMap<String, ClanInfo> _clanMap = new NautHashMap<String, ClanInfo>();
private NautHashMap<String, ClanInfo> _clanMemberMap = new NautHashMap<String, ClanInfo>();
// private NautHashMap<String, ClanInfo> _clanMemberNameMap = new NautHashMap<String, ClanInfo>();
private NautHashMap<UUID, ClanInfo> _clanMemberUuidMap = new NautHashMap<UUID, ClanInfo>();
private NautHashMap<String, ClanTerritory> _claimMap = new NautHashMap<String, ClanTerritory>();
private NautHashMap<String, Long> _unclaimMap = new NautHashMap<String, Long>();
@ -156,7 +169,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
public String[] denyClan = new String[] {
"neut", "neutral", "sethome", "promote", "demote", "admin", "help", "create", "disband", "delete", "invite", "join", "kick", "ally", "trust", "claim", "unclaim", "territory", "home"};
public ClansManager(JavaPlugin plugin, String serverName, CoreClientManager clientManager, DonationManager donationManager, BlockRestore blockRestore, Teleport teleport, Chat chat, GearManager gearManager, String webServerAddress)
public ClansManager(JavaPlugin plugin, String serverName, CoreClientManager clientManager, DonationManager donationManager, BlockRestore blockRestore, Teleport teleport, Chat chat, GearManager gearManager, HologramManager hologramManager, String webServerAddress)
{
super("Clans Manager", plugin);
@ -164,6 +177,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
_serverName = serverName;
_clientManager = clientManager;
_combatManager = new CombatManager(plugin);
_hologramManager = hologramManager;
_chat = chat;
_blockRestore = blockRestore;
@ -171,14 +185,15 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
_warManager = new WarManager(plugin, this);
_goldManager = new GoldManager(this, _clientManager, donationManager);
LootManager lootManager = new LootManager(gearManager, _goldManager);
_gearManager = gearManager;
_lootManager = new LootManager(gearManager, _goldManager);
PacketHandler packetHandler = new PacketHandler(plugin);
_disguiseManager = new DisguiseManager(plugin, packetHandler);
Creature creature = new Creature(plugin);
_npcManager = new NpcManager(plugin, creature);
_condition = new SkillConditionManager(plugin);
DamageManager damageManager = new DamageManager(plugin, _combatManager, _npcManager, _disguiseManager, _condition);
_worldEvent = new WorldEventManager(plugin, this, damageManager, lootManager, blockRestore);
_worldEvent = new WorldEventManager(plugin, this, damageManager, _lootManager, blockRestore);
_scoreboard = new ClansScoreboardManager(plugin, this, _warManager, _worldEvent, clientManager, donationManager);
new MurderManager(plugin, this);
@ -207,6 +222,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
new Spawn(plugin, this);
new NPCManager(this);
new LoggingManager(plugin, this);
new ObserverManager(plugin, _condition, this);
new Weapon(plugin, energy);
new Gameplay(plugin, this, blockRestore, damageManager);
@ -230,8 +246,8 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
StatsManager statsManager = new StatsManager(plugin, _clientManager);
AchievementManager achievementManager = new AchievementManager(statsManager, _clientManager, donationManager);
ClassShopManager shopManager = new ClassShopManager(plugin, _classManager, skillManager, itemFactory, achievementManager, _clientManager);
_classShop = new ClassCombatShop(shopManager, _clientManager, donationManager, true, "Class Shop");
ClassShopManager shopManager = new ClassShopManager(plugin, _classManager, skillManager, itemFactory, achievementManager, _clientManager);
_classShop = new ClassCombatShop(shopManager, _clientManager, donationManager, true, "Class Shop");
ClanEnergyManager clanEnergyManager = new ClanEnergyManager(plugin, this, clientManager, donationManager);
@ -263,7 +279,10 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
_clanMap.put(clanToken.Name, clan);
for (ClanMemberToken memberToken : clanToken.Members)
_clanMemberMap.put(memberToken.Name, clan);
{
_clanMemberUuidMap.put(memberToken.PlayerUUID, clan);
// _clanMemberMap.put(memberToken.Name, clan);
}
for (ClanTerritoryToken territoryToken : clanToken.Territories)
_claimMap.put(territoryToken.Chunk, new ClanTerritory(territoryToken));
@ -304,9 +323,9 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
return _clanMap;
}
public NautHashMap<String, ClanInfo> getClanMemberMap()
public NautHashMap<UUID, ClanInfo> getClanMemberUuidMap()
{
return _clanMemberMap;
return _clanMemberUuidMap;
}
public static boolean isClaimable(Location location)
@ -331,7 +350,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
public ClanInfo getClan(Player player)
{
return _clanMemberMap.get(player.getName());
return _clanMemberUuidMap.get(player.getUniqueId());
}
public ClanInfo getEnemy(ClanInfo clanInfo)
@ -347,7 +366,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
public boolean isInClan(Player player)
{
return _clanMemberMap.containsKey(player.getName());
return _clanMemberUuidMap.containsKey(player.getUniqueId());
}
public ClanInfo getClan(String clan)
@ -407,7 +426,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
ClanInfo clan = _clanUtility.getOwner(event.GetLocation());
if (clan != null && !clan.isAdmin()
&& !clan.getName().equals("Spawn") && event.getReason() != SpawnReason.CUSTOM)
&& !clan.getName().equals("Spawn") && event.getReason() != SpawnReason.CUSTOM)
{
event.setCancelled(true);
}
@ -423,7 +442,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
public void join(PlayerJoinEvent event)
{
Player player = event.getPlayer();
ClanInfo clanInfo = getClanMemberMap().get(player.getName());
ClanInfo clanInfo = _clanMemberUuidMap.get(player.getUniqueId());
if (clanInfo != null)
{
clanInfo.playerOnline(player);
@ -449,7 +468,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
public void quit(PlayerQuitEvent event)
{
Player player = event.getPlayer();
ClanInfo clanInfo = getClanMemberMap().get(player.getName());
ClanInfo clanInfo = getClanMemberUuidMap().get(player.getUniqueId());
if (clanInfo != null)
{
clanInfo.playerOffline(player);
@ -474,9 +493,9 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
event.setFormat(C.cAqua + "%1$s " + C.cDAqua + "%2$s");
event.getRecipients().clear();
for (String cur : clan.getMembers().keySet())
for (ClansPlayer cur : clan.getMembers().values())
{
Player player = UtilPlayer.searchOnline(null, cur, false);
Player player = UtilPlayer.searchExact(cur.getUuid());
if (player == null)
continue;
@ -489,9 +508,9 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
event.setFormat(C.cDGreen + clan.getName() + " " + C.cDGreen + "%1$s " + C.cGreen + "%2$s");
event.getRecipients().clear();
for (String cur : clan.getMembers().keySet())
for (ClansPlayer cur : clan.getMembers().values())
{
Player player = UtilPlayer.searchOnline(null, cur, false);
Player player = UtilPlayer.searchExact(cur.getUuid());
if (player == null)
continue;
@ -504,9 +523,9 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
ClanInfo ally = _clanUtility.getClanByClanName(allyName);
if (ally == null) continue;
for (String playerName : ally.getMembers().keySet())
for (ClansPlayer cur : ally.getMembers().values())
{
Player player = UtilPlayer.searchOnline(null, playerName, false);
Player player = UtilPlayer.searchExact(cur.getUuid());
if (player == null)
continue;
@ -608,11 +627,22 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
return _clanUtility.isSafe(a);
}
public ClanRelation getRelation(String playerA, String playerB)
// public ClanRelation getRelation(String playerA, String playerB)
// {
// return getClanUtility().rel(_clanMemberMap.get(playerA), _clanMemberMap.get(playerB));
// }
public ClanRelation getRelation(Player playerA, Player playerB)
{
return getClanUtility().rel(_clanMemberMap.get(playerA), _clanMemberMap.get(playerB));
return getRelation(playerA.getUniqueId(), playerB.getUniqueId());
}
public ClanRelation getRelation(UUID playerA, UUID playerB)
{
return getClanUtility().rel(getClanMemberUuidMap().get(playerA), getClanMemberUuidMap().get(playerB));
}
public long getOnlineTime()
{
return _onlineTime;
@ -709,6 +739,21 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
return _worldEvent;
}
public HologramManager getHologramManager()
{
return _hologramManager;
}
public GearManager getGearManager()
{
return _gearManager;
}
public LootManager getLootManager()
{
return _lootManager;
}
public Chat getChat()
{
return _chat;
@ -735,7 +780,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
_goldManager.onDisable();
}
// @EventHandler
// @EventHandler
public void itemBreak(PlayerItemBreakEvent event)
{
Bukkit.broadcastMessage("Item Break: " + event.getPlayer());
@ -744,7 +789,7 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
}
// @EventHandler
// @EventHandler
public void blockBreak(BlockBreakEvent event)
{
Bukkit.broadcastMessage("dur: " + event.getPlayer().getItemInHand().getDurability());
@ -771,27 +816,6 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
Bukkit.broadcastMessage("name: " + item.getName() + " max dur: " + item.getMaxDurability());
}
@EventHandler(priority = EventPriority.HIGH)
public void handleClansDeath(PlayerDeathEvent event)
{
PlayerClan playerClan;
PlayerClan killerClan = null;
Player player = event.getEntity();
ClanInfo pClan = _clanMemberMap.get(player.getName());
playerClan = new PlayerClan(player, pClan);
if (player.getKiller() != null)
{
Player killer = player.getKiller();
ClanInfo kClan = _clanMemberMap.get(killer.getName());
killerClan = new PlayerClan(killer, kClan);
}
ClansPlayerDeathEvent clansPlayerDeathEvent = new ClansPlayerDeathEvent(event, playerClan, killerClan);
Bukkit.getServer().getPluginManager().callEvent(clansPlayerDeathEvent);
}
@EventHandler(priority = EventPriority.HIGHEST)
public void onJoin(PlayerLoginEvent event)
{
@ -803,4 +827,25 @@ public class ClansManager extends MiniClientPlugin<ClientClan> implements IRelat
event.setKickMessage("Only Media+ can join this server!");
}
}
@EventHandler(priority = EventPriority.HIGH)
public void handleClansDeath(PlayerDeathEvent event)
{
PlayerClan playerClan;
PlayerClan killerClan = null;
Player player = event.getEntity();
ClanInfo pClan = _clanMemberUuidMap.get(player.getUniqueId());
playerClan = new PlayerClan(player, pClan);
if (player.getKiller() != null)
{
Player killer = player.getKiller();
ClanInfo kClan = _clanMemberUuidMap.get(killer.getUniqueId());
killerClan = new PlayerClan(killer, kClan);
}
ClansPlayerDeathEvent clansPlayerDeathEvent = new ClansPlayerDeathEvent(event, playerClan, killerClan);
Bukkit.getServer().getPluginManager().callEvent(clansPlayerDeathEvent);
}
}