Merge remote-tracking branch 'origin/develop' into develop

This commit is contained in:
Shaun Bennett 2016-01-20 15:07:48 -05:00
commit 5af8d747b3
8 changed files with 68 additions and 60 deletions

View File

@ -1,5 +1,6 @@
package mineplex.bungee.playerTracker;
import java.util.UUID;
import mineplex.serverdata.commands.CommandCallback;
import mineplex.serverdata.commands.PlayerJoinCommand;
import mineplex.serverdata.commands.ServerCommand;
@ -21,7 +22,7 @@ public class PlayerJoinHandler implements CommandCallback
{
PlayerJoinCommand joinCommand = (PlayerJoinCommand)command;
_playerTracker.kickPlayerIfOnline(joinCommand.getUuid());
_playerTracker.kickPlayerIfOnline(UUID.fromString(joinCommand.getUuid()));
}
}
}

View File

@ -2,6 +2,7 @@ package mineplex.bungee.playerTracker;
import java.io.File;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
@ -27,7 +28,7 @@ public class PlayerTracker implements Listener, Runnable
// Repository storing player status' across network.
private DataRepository<PlayerStatus> _repository;
private HashSet<String> _onlineUUIDs = new HashSet<String>();
private Set<UUID> _onlineUUIDs = new HashSet<>();
private Plugin _plugin;
@ -76,32 +77,32 @@ public class PlayerTracker implements Listener, Runnable
@EventHandler
public void playerConnect(final PostLoginEvent event)
{
_onlineUUIDs.add(event.getPlayer().getUniqueId().toString());
_onlineUUIDs.add(event.getPlayer().getUniqueId());
}
@Override
public void run()
{
HashSet<String> onlineUUIDs = new HashSet<String>();
Set<UUID> onlineUUIDs = new HashSet<>();
for (ProxiedPlayer player : _plugin.getProxy().getPlayers())
{
onlineUUIDs.add(player.getUniqueId().toString());
onlineUUIDs.add(player.getUniqueId());
}
_onlineUUIDs = onlineUUIDs;
}
public boolean isPlayerOnline(String uuid)
public boolean isPlayerOnline(UUID uuid)
{
return _onlineUUIDs.contains(uuid);
}
public void kickPlayerIfOnline(String uuid)
public void kickPlayerIfOnline(UUID uuid)
{
if (_onlineUUIDs.contains(uuid))
{
ProxiedPlayer player = _plugin.getProxy().getPlayer(UUID.fromString(uuid));
ProxiedPlayer player = _plugin.getProxy().getPlayer(uuid);
if (player != null)
player.disconnect("You have logged in from another location.");

View File

@ -80,7 +80,7 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
_entityMap.remove(event.getPlayer().getName());
_entityNameMap.remove(event.getPlayer().getName());
_entityRiding.remove(event.getPlayer().getName());
_loggedIn.remove(event.getPlayer());
_loggedIn.remove(event.getPlayer().getName());
}
@EventHandler(priority = EventPriority.LOW)

View File

@ -136,7 +136,7 @@ public class ObserverManager extends MiniPlugin
if (_observerMap.containsKey(event.getPlayer()))
{
restore(event.getPlayer(), _observerMap.get(event.getPlayer()));
_observerMap.remove(_plugin);
_observerMap.remove(event.getPlayer());
}
}

View File

@ -295,17 +295,7 @@ public class ServerManager extends MiniPlugin
return timeLeft;
}
public void removeServer(String serverName)
{
for (String key : _serverKeyInfoMap.keySet())
{
_serverKeyInfoMap.get(key).remove(serverName);
}
_serverInfoMap.remove(serverName);
}
public void addServerGroup(ServerGroup serverGroup)
{
_serverKeyInfoMap.put(serverGroup.getPrefix(), new HashSet<ServerInfo>());

View File

@ -356,12 +356,10 @@ public class CustomExplosion extends Explosion
if (_fallingBlockExplosion)
{
Collection<org.bukkit.block.Block> blocks = event.GetBlocks();
List<org.bukkit.block.Block> blocks = new ArrayList<>(event.GetBlocks());
if (blocks.size() > _maxFallingBlocks)
{
blocks = new ArrayList<org.bukkit.block.Block>(blocks);
Collections.shuffle((ArrayList) blocks);
int toRemove = blocks.size() - _maxFallingBlocks;

View File

@ -206,7 +206,7 @@ public class ServerMonitor
if (groupStatus.getServerType().equalsIgnoreCase("Player"))
{
_repository.removeServerGroup(groupStatus);
_serverGroupMap.remove(groupStatus);
_serverGroupMap.remove(groupStatus.getName());
groupStatusIterator.remove();
System.out.println("Removed MPS : " + groupStatus.getName());
@ -449,7 +449,7 @@ public class ServerMonitor
if (serverGroup != null && serverGroup.getHost() != null && !serverGroup.getHost().isEmpty() && serverGroup.getServerCount() <= 1)
{
_repository.removeServerGroup(serverGroup);
_serverGroupMap.remove(serverGroup);
_serverGroupMap.remove(serverGroup.getName());
_serverGroups.remove(serverGroup);
System.out.println("Removed ServerGroup : " + serverGroup.getName());
}

View File

@ -2,41 +2,10 @@ package nautilus.game.arcade.game.games.build;
import java.util.AbstractMap;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map.Entry;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTextBottom;
import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.common.util.UtilTime;
import mineplex.core.explosion.ExplosionEvent;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.events.PlayerPrepareTeleportEvent;
import nautilus.game.arcade.game.SoloGame;
import nautilus.game.arcade.game.games.build.gui.MobShop;
import nautilus.game.arcade.game.games.build.gui.OptionsShop;
import nautilus.game.arcade.game.games.build.kits.KitBuilder;
import nautilus.game.arcade.kit.Kit;
import java.util.UUID;
import org.bukkit.ChatColor;
import org.bukkit.Effect;
@ -100,6 +69,40 @@ import org.bukkit.event.vehicle.VehicleCreateEvent;
import org.bukkit.event.vehicle.VehicleDamageEvent;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilEvent.ActionType;
import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTextBottom;
import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.common.util.UtilTime;
import mineplex.core.explosion.ExplosionEvent;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.events.PlayerPrepareTeleportEvent;
import nautilus.game.arcade.game.SoloGame;
import nautilus.game.arcade.game.games.build.gui.MobShop;
import nautilus.game.arcade.game.games.build.gui.OptionsShop;
import nautilus.game.arcade.game.games.build.kits.KitBuilder;
import nautilus.game.arcade.kit.Kit;
public class Build extends SoloGame
{
private NautHashMap<Player, BuildData> _data = new NautHashMap<Player, BuildData>();
@ -142,6 +145,8 @@ public class Build extends SoloGame
private ChatColor _hintColor = ChatColor.YELLOW;
private ChatColor _firstHintColor = ChatColor.YELLOW;
private UUID _winnerUUID = null;
public Build(ArcadeManager manager)
{
super(manager, GameType.Build,
@ -538,7 +543,10 @@ public class Build extends SoloGame
//Gems
if (places.size() >= 1)
{
_winnerUUID = places.get(0).getUniqueId();
AddGems(places.get(0), 20, "1st Place", false, false);
}
if (places.size() >= 2)
AddGems(places.get(1), 15, "2nd Place", false, false);
@ -1542,4 +1550,14 @@ public class Build extends SoloGame
}
}
}
@Override
public List<Player> getWinners()
{
Player player = UtilPlayer.searchExact(_winnerUUID);
if (player == null)
return null;
return Arrays.asList(player);
}
}