Fixed whitelist issue with tournament mode.

This commit is contained in:
Jonathan Williams 2014-07-26 10:40:49 -07:00
parent a455042c07
commit 4e1a05e9bd

View File

@ -19,6 +19,7 @@ import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.GameMode; import org.bukkit.GameMode;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.OfflinePlayer;
import org.bukkit.craftbukkit.v1_7_R3.entity.CraftEntity; import org.bukkit.craftbukkit.v1_7_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_7_R3.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_7_R3.entity.CraftPlayer;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -124,7 +125,10 @@ public class ArcadeManager extends MiniPlugin implements IRelation
// Games // Games
private Game _game; private Game _game;
public ArcadeManager(Arcade plugin, ServerStatusManager serverStatusManager, GameServerConfig serverConfig, CoreClientManager clientManager, DonationManager donationManager, DamageManager damageManager, DisguiseManager disguiseManager, Creature creature, Teleport teleport, Blood blood, AntiStack antistack, Portal portal, PacketHandler packetHandler, PreferencesManager preferences, String webAddress) public ArcadeManager(Arcade plugin, ServerStatusManager serverStatusManager, GameServerConfig serverConfig,
CoreClientManager clientManager, DonationManager donationManager, DamageManager damageManager,
DisguiseManager disguiseManager, Creature creature, Teleport teleport, Blood blood, AntiStack antistack,
Portal portal, PacketHandler packetHandler, PreferencesManager preferences, String webAddress)
{ {
super("Game Manager", plugin); super("Game Manager", plugin);
@ -145,7 +149,9 @@ public class ArcadeManager extends MiniPlugin implements IRelation
_explosionManager = new Explosion(plugin, _blockRestore); _explosionManager = new Explosion(plugin, _blockRestore);
_explosionManager.SetDebris(false); _explosionManager.SetDebris(false);
if (serverConfig.GameList.contains(GameType.ChampionsDominate) || serverConfig.GameList.contains(GameType.ChampionsTDM) || serverConfig.GameList.contains(GameType.ChampionsMOBA)) if (serverConfig.GameList.contains(GameType.ChampionsDominate)
|| serverConfig.GameList.contains(GameType.ChampionsTDM)
|| serverConfig.GameList.contains(GameType.ChampionsMOBA))
{ {
_conditionManager = new SkillConditionManager(plugin); _conditionManager = new SkillConditionManager(plugin);
} }
@ -172,12 +178,18 @@ public class ArcadeManager extends MiniPlugin implements IRelation
_projectileManager = new ProjectileManager(plugin); _projectileManager = new ProjectileManager(plugin);
if (serverConfig.GameList.contains(GameType.ChampionsDominate) || serverConfig.GameList.contains(GameType.ChampionsTDM) || serverConfig.GameList.contains(GameType.ChampionsMOBA)) if (serverConfig.GameList.contains(GameType.ChampionsDominate)
|| serverConfig.GameList.contains(GameType.ChampionsTDM)
|| serverConfig.GameList.contains(GameType.ChampionsMOBA))
{ {
Energy energy = new Energy(plugin); Energy energy = new Energy(plugin);
ItemFactory itemFactory = new ItemFactory(_plugin, _blockRestore, _conditionManager, damageManager, energy, _fire, _projectileManager, webAddress); ItemFactory itemFactory = new ItemFactory(_plugin, _blockRestore, _conditionManager, damageManager, energy,
_skillFactory = new SkillFactory(plugin, damageManager, this, _damageManager.GetCombatManager(), _conditionManager, _projectileManager, _blockRestore, _fire, new Movement(plugin), teleport, energy, webAddress); _fire, _projectileManager, webAddress);
_classManager = new ClassManager(plugin, clientManager, donationManager, _skillFactory, itemFactory, webAddress); _skillFactory = new SkillFactory(plugin, damageManager, this, _damageManager.GetCombatManager(),
_conditionManager, _projectileManager, _blockRestore, _fire, new Movement(plugin), teleport,
energy, webAddress);
_classManager = new ClassManager(plugin, clientManager, donationManager, _skillFactory, itemFactory,
webAddress);
_classShopManager = new ClassShopManager(_plugin, _classManager, _skillFactory, itemFactory); _classShopManager = new ClassShopManager(_plugin, _classManager, _skillFactory, itemFactory);
_classShop = new ClassCombatShop(_classShopManager, clientManager, donationManager, webAddress); _classShop = new ClassCombatShop(_classShopManager, clientManager, donationManager, webAddress);
@ -421,7 +433,8 @@ public class ArcadeManager extends MiniPlugin implements IRelation
@EventHandler @EventHandler
public void MessageMOTD(ServerListPingEvent event) public void MessageMOTD(ServerListPingEvent event)
{ {
String extrainformation = "|" + _serverConfig.ServerType + "|" + (_game == null ? "Unknown" : _game.GetName()) + "|" + ((_game == null || _game.WorldData == null) ? "Unknown" : _game.WorldData.MapName); String extrainformation = "|" + _serverConfig.ServerType + "|" + (_game == null ? "Unknown" : _game.GetName())
+ "|" + ((_game == null || _game.WorldData == null) ? "Unknown" : _game.WorldData.MapName);
if (_game == null || _game.GetState() == GameState.Recruit) if (_game == null || _game.GetState() == GameState.Recruit)
{ {
@ -484,8 +497,11 @@ public class ArcadeManager extends MiniPlugin implements IRelation
if (_game != null && !_game.GiveClock) if (_game != null && !_game.GiveClock)
return; return;
player.getInventory().setItem(8, ItemStackFactory.Instance.CreateStack(Material.WATCH, (byte)0, 1, (short)0, C.cGreen + "Return to Hub", player.getInventory().setItem(
new String[] {"", ChatColor.RESET + "Click while holding this", ChatColor.RESET + "to return to the Hub."})); 8,
ItemStackFactory.Instance.CreateStack(Material.WATCH, (byte) 0, 1, (short) 0, C.cGreen
+ "Return to Hub", new String[] { "", ChatColor.RESET + "Click while holding this",
ChatColor.RESET + "to return to the Hub." }));
} }
@EventHandler @EventHandler
@ -505,6 +521,16 @@ public class ArcadeManager extends MiniPlugin implements IRelation
} }
else else
{ {
for (OfflinePlayer player : Bukkit.getWhitelistedPlayers())
{
if (player.getName().equalsIgnoreCase(event.getPlayer().getName()))
{
event.allow();
event.setResult(PlayerLoginEvent.Result.ALLOWED);
return;
}
}
event.disallow(PlayerLoginEvent.Result.KICK_OTHER, "Server Whitelisted!"); event.disallow(PlayerLoginEvent.Result.KICK_OTHER, "Server Whitelisted!");
} }
@ -516,14 +542,18 @@ public class ArcadeManager extends MiniPlugin implements IRelation
{ {
if (_serverStatusManager.getCurrentServerName().contains("BETA")) if (_serverStatusManager.getCurrentServerName().contains("BETA"))
{ {
if (_clientManager.Get(event.getPlayer().getName()).GetRank().Has(event.getPlayer(), Rank.HELPER, false)) if (_clientManager.Get(event.getPlayer().getName()).GetRank()
.Has(event.getPlayer(), Rank.HELPER, false))
{ {
event.allow(); event.allow();
event.setResult(PlayerLoginEvent.Result.ALLOWED); event.setResult(PlayerLoginEvent.Result.ALLOWED);
return; return;
} }
} }
else if (_clientManager.Get(event.getPlayer().getName()).GetRank().Has(event.getPlayer(), Rank.ULTRA, false) || _donationManager.Get(event.getPlayer().getName()).OwnsUnknownPackage(_serverConfig.ServerType + " ULTRA")) else if (_clientManager.Get(event.getPlayer().getName()).GetRank()
.Has(event.getPlayer(), Rank.ULTRA, false)
|| _donationManager.Get(event.getPlayer().getName()).OwnsUnknownPackage(
_serverConfig.ServerType + " ULTRA"))
{ {
event.allow(); event.allow();
event.setResult(PlayerLoginEvent.Result.ALLOWED); event.setResult(PlayerLoginEvent.Result.ALLOWED);
@ -582,8 +612,10 @@ public class ArcadeManager extends MiniPlugin implements IRelation
public ArrayList<String> LoadFiles(String gameName) public ArrayList<String> LoadFiles(String gameName)
{ {
TimingManager.start("ArcadeManager LoadFiles"); TimingManager.start("ArcadeManager LoadFiles");
File folder = new File(".." + File.separatorChar + ".." + File.separatorChar + "update" + File.separatorChar + "maps" + File.separatorChar + gameName); File folder = new File(".." + File.separatorChar + ".." + File.separatorChar + "update" + File.separatorChar
if (!folder.exists()) folder.mkdirs(); + "maps" + File.separatorChar + gameName);
if (!folder.exists())
folder.mkdirs();
ArrayList<String> maps = new ArrayList<String>(); ArrayList<String> maps = new ArrayList<String>();
@ -754,6 +786,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
@EventHandler @EventHandler
public void TeleportLog(PlayerTeleportEvent event) public void TeleportLog(PlayerTeleportEvent event)
{ {
System.out.println("Teleporting: " + event.getPlayer().getName() + " to " + event.getTo().getWorld().getWorldFolder().getName()); System.out.println("Teleporting: " + event.getPlayer().getName() + " to "
+ event.getTo().getWorld().getWorldFolder().getName());
} }
} }