Merge pull request #125 in MIN/mineplex from bugfix/mb-wins to develop
* commit '4924d652f555392c9e36feb05a64cccd61b6c594': Store winner UUID instead of Player object to avoid leaking excess data Fixed who the winner is in MB Games.
This commit is contained in:
commit
c0d4fa1bea
@ -2,41 +2,10 @@ package nautilus.game.arcade.game.games.build;
|
|||||||
|
|
||||||
import java.util.AbstractMap;
|
import java.util.AbstractMap;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
import java.util.UUID;
|
||||||
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 org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Effect;
|
import org.bukkit.Effect;
|
||||||
@ -100,6 +69,40 @@ import org.bukkit.event.vehicle.VehicleCreateEvent;
|
|||||||
import org.bukkit.event.vehicle.VehicleDamageEvent;
|
import org.bukkit.event.vehicle.VehicleDamageEvent;
|
||||||
import org.bukkit.inventory.ItemStack;
|
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
|
public class Build extends SoloGame
|
||||||
{
|
{
|
||||||
private NautHashMap<Player, BuildData> _data = new NautHashMap<Player, BuildData>();
|
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 _hintColor = ChatColor.YELLOW;
|
||||||
private ChatColor _firstHintColor = ChatColor.YELLOW;
|
private ChatColor _firstHintColor = ChatColor.YELLOW;
|
||||||
|
|
||||||
|
private UUID _winnerUUID = null;
|
||||||
|
|
||||||
public Build(ArcadeManager manager)
|
public Build(ArcadeManager manager)
|
||||||
{
|
{
|
||||||
super(manager, GameType.Build,
|
super(manager, GameType.Build,
|
||||||
@ -538,7 +543,10 @@ public class Build extends SoloGame
|
|||||||
|
|
||||||
//Gems
|
//Gems
|
||||||
if (places.size() >= 1)
|
if (places.size() >= 1)
|
||||||
|
{
|
||||||
|
_winnerUUID = places.get(0).getUniqueId();
|
||||||
AddGems(places.get(0), 20, "1st Place", false, false);
|
AddGems(places.get(0), 20, "1st Place", false, false);
|
||||||
|
}
|
||||||
|
|
||||||
if (places.size() >= 2)
|
if (places.size() >= 2)
|
||||||
AddGems(places.get(1), 15, "2nd Place", false, false);
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user