Gems cannot be given multiple times for certain things (prevents bugs giving mass gems)

This commit is contained in:
Chiss 2014-12-15 14:33:38 +11:00
parent 19dfafe9ed
commit 95081a8ab7
35 changed files with 191 additions and 166 deletions

View File

@ -124,56 +124,61 @@ public class CoreClientManager extends MiniPlugin
public int getPlayerCountIncludingConnecting()
{
return Bukkit.getOnlinePlayers().size() + _clientsConnecting;
return Bukkit.getOnlinePlayers().size() + Math.max(0, _clientsConnecting);
}
@EventHandler(priority = EventPriority.LOWEST)
public void AsyncLogin(AsyncPlayerPreLoginEvent event)
{
_clientsConnecting++;
while (_clientsProcessing >= 5)
{
try
{
Thread.sleep(25);
}
catch (InterruptedException e)
{
e.printStackTrace();
}
}
_clientsProcessing++;
try
{
LoadClient(Add(event.getName()), event.getUniqueId(), event.getAddress().getHostAddress());
}
catch(Exception exception)
{
Logger.Instance.log(exception);
event.disallow(Result.KICK_OTHER, "Error retrieving information from web, please retry in a minute.");
System.out.println(exception.getMessage());
}
finally
{
_clientsProcessing--;
_clientsConnecting--;
}
if (Bukkit.hasWhitelist() && !Get(event.getName()).GetRank().Has(Rank.MODERATOR))
{
for (OfflinePlayer player : Bukkit.getWhitelistedPlayers())
_clientsConnecting++;
while (_clientsProcessing >= 5)
{
if (player.getName().equalsIgnoreCase(event.getName()))
try
{
return;
Thread.sleep(25);
}
catch (InterruptedException e)
{
e.printStackTrace();
}
}
event.disallow(Result.KICK_WHITELIST, "You are not whitelisted my friend.");
try
{
_clientsProcessing++;
LoadClient(Add(event.getName()), event.getUniqueId(), event.getAddress().getHostAddress());
}
catch(Exception exception)
{
Logger.Instance.log(exception);
event.disallow(Result.KICK_OTHER, "Error retrieving information from web, please retry in a minute.");
System.out.println(exception.getMessage());
}
finally
{
_clientsProcessing--;
}
if (Bukkit.hasWhitelist() && !Get(event.getName()).GetRank().Has(Rank.MODERATOR))
{
for (OfflinePlayer player : Bukkit.getWhitelistedPlayers())
{
if (player.getName().equalsIgnoreCase(event.getName()))
{
return;
}
}
event.disallow(Result.KICK_WHITELIST, "You are not whitelisted my friend.");
}
}
finally
{
_clientsConnecting--;
}
}
@ -436,6 +441,18 @@ public class CoreClientManager extends MiniPlugin
}
}
@EventHandler
public void debug(UpdateEvent event)
{
if (event.getType() != UpdateType.SLOWER)
return;
System.out.println("=====");
System.out.println("Connecting : " + _clientsConnecting);
System.out.println("Processing : " + _clientsProcessing);
System.out.println("=====");
}
public void addStoredProcedureLoginProcessor(ILoginProcessor processor)
{
_loginProcessors.put(processor.getName(), processor);

View File

@ -390,7 +390,7 @@ public class RedisServerRepository implements ServerRepository
Pipeline pipeline = jedis.pipelined();
String setKey = concatenate("serverstatus", "minecraft", _region.toString());
String min = "-inf";
String max = jedis.time().get(0);
String max = Utility.currentTimeSeconds() + "";
List<Response<String>> responses = new ArrayList<Response<String>>();
for (Tuple serverName : jedis.zrangeByScoreWithScores(setKey, min, max))

View File

@ -42,6 +42,8 @@ public class ServerMonitor
private static int _totalPlayers = 0;
private static Region _region;
private static boolean _debug = false;
public static void main (String args[])
{
_region = !new File("eu.dat").exists() ? Region.US : Region.EU;
@ -264,7 +266,7 @@ public class ServerMonitor
int requiredJoinable = serverGroup.getRequiredJoinableServers();
int joinableServers = serverGroup.getJoinableCount();
int totalServers = serverGroup.getServerCount();
int serversToAdd = Math.max(requiredTotal - totalServers, requiredJoinable - joinableServers);
int serversToAdd = Math.max(0, Math.max(requiredTotal - totalServers, requiredJoinable - joinableServers));
int serversToKill = (totalServers > requiredTotal && joinableServers > requiredJoinable) ? Math.min(joinableServers - requiredJoinable, serverGroup.getEmptyServers().size()) : 0;
// Minimum 1500 slot bufferzone
@ -339,6 +341,9 @@ public class ServerMonitor
private static void killServer(final String serverName, final String serverAddress, final String message, final boolean announce)
{
if (_debug)
return;
String cmd = "/home/mineplex/easyRemoteKillServer.sh";
ProcessRunner pr = new ProcessRunner(new String[] {"/bin/sh", cmd, serverAddress, serverName});
@ -384,6 +389,9 @@ public class ServerMonitor
{
boolean success = false;
if (_debug)
return true;
Process process = null;
String cmd = "/home/mineplex/isServerOnline.sh";
@ -442,6 +450,9 @@ public class ServerMonitor
private static void startServer(final DedicatedServer serverSpace, final ServerGroup serverGroup, final int serverNum, final boolean free)
{
if (_debug)
return;
String cmd = "/home/mineplex/easyRemoteStartServerCustom.sh";
final String groupPrefix = serverGroup.getPrefix();
final String serverName = serverSpace.getName();

View File

@ -581,12 +581,12 @@ public abstract class Game implements Listener
return _gemCount.get(player);
}
public void AddGems(Player player, double gems, String reason, boolean countAmount)
public void AddGems(Player player, double gems, String reason, boolean countAmount, boolean multipleAllowed)
{
if (!countAmount && gems < 1)
gems = 1;
if (GetGems(player).containsKey(reason))
if (GetGems(player).containsKey(reason) && multipleAllowed)
{
GetGems(player).get(reason).AddGems(gems);
}

View File

@ -52,17 +52,17 @@ public abstract class SoloGame extends Game
//Gems
if (places.size() >= 1)
AddGems(places.get(0), 20, "1st Place", false);
AddGems(places.get(0), 20, "1st Place", false, false);
if (places.size() >= 2)
AddGems(places.get(1), 15, "2nd Place", false);
AddGems(places.get(1), 15, "2nd Place", false, false);
if (places.size() >= 3)
AddGems(places.get(2), 10, "3rd Place", false);
AddGems(places.get(2), 10, "3rd Place", false, false);
for (Player player : GetPlayers(false))
if (player.isOnline())
AddGems(player, 10, "Participation", false);
AddGems(player, 10, "Participation", false, false);
//End
SetState(GameState.End);

View File

@ -195,12 +195,12 @@ public abstract class TeamGame extends Game
if (WinnerTeam != null && team.equals(WinnerTeam))
{
for (Player player : team.GetPlayers(false))
AddGems(player, 10, "Winning Team", false);
AddGems(player, 10, "Winning Team", false, false);
}
for (Player player : team.GetPlayers(false))
if (player.isOnline())
AddGems(player, 10, "Participation", false);
AddGems(player, 10, "Participation", false, false);
}
//End

View File

@ -1377,12 +1377,12 @@ public class Bridge extends TeamGame implements OreObsfucation
if (WinnerTeam != null && team.equals(WinnerTeam))
{
for (Player player : team.GetPlayers(false))
AddGems(player, 10, "Winning Team", false);
AddGems(player, 10, "Winning Team", false, false);
}
for (Player player : team.GetPlayers(false))
if (player.isOnline())
AddGems(player, 10, "Participation", false);
AddGems(player, 10, "Participation", false, false);
}
//End
@ -1443,12 +1443,12 @@ public class Bridge extends TeamGame implements OreObsfucation
if (WinnerTeam != null && team.equals(WinnerTeam))
{
for (Player player : team.GetPlayers(false))
AddGems(player, 10, "Winning Team", false);
AddGems(player, 10, "Winning Team", false, false);
}
for (Player player : team.GetPlayers(false))
if (player.isOnline())
AddGems(player, 10, "Participation", false);
AddGems(player, 10, "Participation", false, false);
}
//End

View File

@ -558,13 +558,13 @@ public class CastleSiege extends TeamGame
{
for (Player player : team.GetPlayers(false))
{
AddGems(player, 10, "Winning Team", false);
AddGems(player, 10, "Winning Team", false, false);
}
}
for (Player player : team.GetPlayers(false))
if (player.isOnline())
AddGems(player, 10, "Participation", false);
AddGems(player, 10, "Participation", false, false);
}
SetState(GameState.End);
@ -575,7 +575,7 @@ public class CastleSiege extends TeamGame
if (_kingDamager != null)
{
SetCustomWinLine(C.cRed + _kingDamager.getName() + C.cWhite + " slaughtered " + _kingName + ChatColor.RESET + "!");
AddGems(_kingDamager, 20, "King Slayer", false);
AddGems(_kingDamager, 20, "King Slayer", false, false);
Bukkit.getPluginManager().callEvent(new KingSlaughterEvent(_kingDamager));
}
@ -590,13 +590,13 @@ public class CastleSiege extends TeamGame
{
for (Player player : team.GetPlayers(false))
{
AddGems(player, 10, "Winning Team", false);
AddGems(player, 10, "Winning Team", false, false);
}
}
for (Player player : team.GetPlayers(false))
if (player.isOnline())
AddGems(player, 10, "Participation", false);
AddGems(player, 10, "Participation", false, false);
}
SetState(GameState.End);

View File

@ -146,8 +146,6 @@ public class Christmas extends SoloGame
this.HungerSet = 20;
this.WorldTimeSet = 2000;
this.PrepareFreeze = false;
this.Manager.GetServerConfig().RewardGems = false;
}
//parse 129 19 47 48 103 86 137 56 22 45 121 14 15 16 87 88 89 153 173 172 162
@ -461,20 +459,19 @@ public class Christmas extends SoloGame
{
Manager.rewardPet(player, "Christmas Elf", EntityType.VILLAGER);
Manager.GetGame().AddGems(player, 30, "Slaying the Pumpkin King", false);
Manager.GetGame().AddGems(player, 10, "Participation", false);
Manager.GetGame().AddGems(player, 30, "Slaying the Pumpkin King", false, false);
Manager.GetGame().AddGems(player, 10, "Participation", false, false);
}
SetCustomWinLine("You earned Christmas Elf Pet!");
AnnounceEnd(this.GetTeamList().get(0));
SetState(GameState.End);
}
else if (GetPlayers(true).size() == 0)
{
for (Player player : GetPlayers(false))
{
Manager.GetGame().AddGems(player, 10, "Participation", false);
Manager.GetGame().AddGems(player, 10, "Participation", false, false);
}
SetCustomWinLine("You all died...");
@ -485,7 +482,7 @@ public class Christmas extends SoloGame
{
for (Player player : GetPlayers(false))
{
Manager.GetGame().AddGems(player, 10, "Participation", false);
Manager.GetGame().AddGems(player, 10, "Participation", false, false);
}
SetCustomWinLine("You did not save Christmas in time.");
@ -502,7 +499,7 @@ public class Christmas extends SoloGame
for (Player player : GetPlayers(false))
{
Manager.GetGame().AddGems(player, 10, "Participation", false);
Manager.GetGame().AddGems(player, 10, "Participation", false, false);
}
SetCustomWinLine("Santa Claus was killed by the Giant!");

View File

@ -272,12 +272,12 @@ public class Domination extends TeamGame
if (WinnerTeam != null && team.equals(WinnerTeam))
{
for (Player player : team.GetPlayers(false))
AddGems(player, 10, "Winning Team", false);
AddGems(player, 10, "Winning Team", false, false);
}
for (Player player : team.GetPlayers(false))
if (player.isOnline())
AddGems(player, 10, "Participation", false);
AddGems(player, 10, "Participation", false, false);
}
if (EloRanking)

View File

@ -315,12 +315,12 @@ public class TeamDeathmatch extends TeamGame
if (WinnerTeam != null && team.equals(WinnerTeam))
{
for (Player player : team.GetPlayers(false))
AddGems(player, 10, "Winning Team", false);
AddGems(player, 10, "Winning Team", false, false);
}
for (Player player : team.GetPlayers(false))
if (player.isOnline())
AddGems(player, 10, "Participation", false);
AddGems(player, 10, "Participation", false, false);
}
if (EloRanking)

View File

@ -447,7 +447,7 @@ public class CapturePoint
public void RewardCapture(Player player, int amount)
{
Host.AddGems(player, amount / 25d, "Control Point Score", true);
Host.AddGems(player, amount / 25d, "Control Point Score", true, true);
Host.GetStats(player).CaptureScore += amount;
}
}

View File

@ -99,6 +99,6 @@ public class Emerald
UtilFirework.playFirework(_loc.clone().add(0, 1, 0), FireworkEffect.builder().flicker(false).withColor(Color.GREEN).with(Type.BALL_LARGE).trail(true).build());
//Gems
Host.AddGems(player, 3, "Emerald Powerup", true);
Host.AddGems(player, 3, "Emerald Powerup", true, true);
}
}

View File

@ -262,7 +262,7 @@ public class DeathTag extends SoloGame
if (forced)
{
AddGems(player, 10, "Forced Chaser", false);
AddGems(player, 10, "Forced Chaser", false, false);
Announce(F.main("Game", F.elem(_runners.GetColor() + player.getName()) + " has become an " +
F.elem(_chasers.GetColor() + newKit.GetName()) + "."));
@ -317,17 +317,17 @@ public class DeathTag extends SoloGame
ArrayList<Player> places = _runners.GetPlacements(true);
if (places.size() >= 1)
AddGems(places.get(0), 15, "1st Place", false);
AddGems(places.get(0), 15, "1st Place", false, false);
if (places.size() >= 2)
AddGems(places.get(1), 10, "2nd Place", false);
AddGems(places.get(1), 10, "2nd Place", false, false);
if (places.size() >= 3)
AddGems(places.get(2), 5, "3rd Place", false);
AddGems(places.get(2), 5, "3rd Place", false, false);
for (Player player : GetPlayers(false))
if (player.isOnline())
AddGems(player, 10, "Participation", false);
AddGems(player, 10, "Participation", false, false);
AnnounceEnd(places);

View File

@ -449,20 +449,20 @@ public class DragonEscape extends SoloGame
//Gems
if (_winner != null)
AddGems(_winner, 10, "Course Complete", false);
AddGems(_winner, 10, "Course Complete", false, false);
if (places.size() >= 1)
AddGems(places.get(0), 20, "1st Place", false);
AddGems(places.get(0), 20, "1st Place", false, false);
if (places.size() >= 2)
AddGems(places.get(1), 15, "2nd Place", false);
AddGems(places.get(1), 15, "2nd Place", false, false);
if (places.size() >= 3)
AddGems(places.get(2), 10, "3rd Place", false);
AddGems(places.get(2), 10, "3rd Place", false, false);
for (Player player : GetPlayers(false))
if (player.isOnline())
AddGems(player, 10, "Participation", false);
AddGems(player, 10, "Participation", false, false);
//End
SetState(GameState.End);

View File

@ -474,12 +474,12 @@ public class DragonEscapeTeams extends TeamGame
if (WinnerTeam != null && team.equals(WinnerTeam))
{
for (Player player : team.GetPlayers(false))
AddGems(player, 10, "Winning Team", false);
AddGems(player, 10, "Winning Team", false, false);
}
for (Player player : team.GetPlayers(false))
if (player.isOnline())
AddGems(player, 10, "Participation", false);
AddGems(player, 10, "Participation", false, false);
}
//End

View File

@ -123,7 +123,7 @@ public class Dragons extends SoloGame
double gems = time/10000d;
String reason = "Survived for " + UtilTime.MakeStr(time);
this.AddGems(event.GetPlayer(), gems, reason, false);
this.AddGems(event.GetPlayer(), gems, reason, false, false);
}
@EventHandler

View File

@ -122,7 +122,7 @@ public class DragonsTeams extends TeamGame
double gems = time/10000d;
String reason = "Survived for " + UtilTime.MakeStr(time);
this.AddGems(event.GetPlayer(), gems, reason, false);
this.AddGems(event.GetPlayer(), gems, reason, false, false);
}
@EventHandler
@ -305,12 +305,12 @@ public class DragonsTeams extends TeamGame
if (WinnerTeam != null && team.equals(WinnerTeam))
{
for (Player player : team.GetPlayers(false))
AddGems(player, 10, "Winning Team", false);
AddGems(player, 10, "Winning Team", false, false);
}
for (Player player : team.GetPlayers(false))
if (player.isOnline())
AddGems(player, 10, "Participation", false);
AddGems(player, 10, "Participation", false, false);
}
//End

View File

@ -316,7 +316,7 @@ public class Draw extends SoloGame
//Points for Drawer
AddScore(_round.Drawer, 2);
this.AddGems(_round.Drawer, 2, "Drawings Guessed", true);
this.AddGems(_round.Drawer, 2, "Drawings Guessed", true, true);
}
if (_round.Guessed(player))
@ -325,9 +325,9 @@ public class Draw extends SoloGame
Announce(C.cYellow + C.Bold + "+" + score + " " + C.cGreen + C.Bold + player.getName() + " has guessed the word!");
if (score == 1)
this.AddGems(player, 1, "Words Guessed", true);
this.AddGems(player, 1, "Words Guessed", true, true);
else
this.AddGems(player, 4, "Words Guessed First", true);
this.AddGems(player, 4, "Words Guessed First", true, true);
}
else
{
@ -698,18 +698,18 @@ public class Draw extends SoloGame
//Award Gems
if (_ranks.size() >= 1)
AddGems(_ranks.get(0).Player, 20, "1st Place", false);
AddGems(_ranks.get(0).Player, 20, "1st Place", false, false);
if (_ranks.size() >= 2)
AddGems(_ranks.get(1).Player, 15, "2nd Place", false);
AddGems(_ranks.get(1).Player, 15, "2nd Place", false, false);
if (_ranks.size() >= 3)
AddGems(_ranks.get(2).Player, 10, "3rd Place", false);
AddGems(_ranks.get(2).Player, 10, "3rd Place", false, false);
//Participation
for (Player player : GetPlayers(false))
if (player.isOnline())
AddGems(player, 10, "Participation", false);
AddGems(player, 10, "Participation", false, false);
SetState(GameState.End);
AnnounceEnd(places);

View File

@ -255,18 +255,18 @@ public class Evolution extends SoloGame
//Award Gems
if (_ranks.size() >= 1)
AddGems(_ranks.get(0).Player, 20, "1st Place", false);
AddGems(_ranks.get(0).Player, 20, "1st Place", false, false);
if (_ranks.size() >= 2)
AddGems(_ranks.get(1).Player, 15, "2nd Place", false);
AddGems(_ranks.get(1).Player, 15, "2nd Place", false, false);
if (_ranks.size() >= 3)
AddGems(_ranks.get(2).Player, 10, "3rd Place", false);
AddGems(_ranks.get(2).Player, 10, "3rd Place", false, false);
//Participation
for (Player player : GetPlayers(false))
if (player.isOnline())
AddGems(player, 10, "Participation", false);
AddGems(player, 10, "Participation", false, false);
SetState(GameState.End);
AnnounceEnd(places);

View File

@ -400,8 +400,8 @@ public class Halloween extends SoloGame
for (Player player : GetPlayers(false))
{
Manager.GetDonation().PurchaseUnknownSalesPackage(null, player.getName(), player.getUniqueId(), "Pumpling", false, 0, true);
Manager.GetGame().AddGems(player, 30, "Killing the Pumpkin King", false);
Manager.GetGame().AddGems(player, 10, "Participation", false);
Manager.GetGame().AddGems(player, 30, "Killing the Pumpkin King", false, false);
Manager.GetGame().AddGems(player, 10, "Participation", false, false);
}
SetCustomWinLine("You earned Pumpling Pet!");
@ -416,7 +416,7 @@ public class Halloween extends SoloGame
for (Player player : GetPlayers(false))
{
Manager.GetGame().AddGems(player, 10, "Participation", false);
Manager.GetGame().AddGems(player, 10, "Participation", false, false);
}
AnnounceEnd(this.GetTeamList().get(1));

View File

@ -904,7 +904,7 @@ public class HideSeek extends TeamGame
player.getWorld().playSound(player.getLocation(), Sound.CAT_MEOW, 1f, 1f);
this.AddGems(player, 0.25, "Meows", true);
this.AddGems(player, 0.25, "Meows", true, true);
UtilParticle.PlayParticle(ParticleType.NOTE, player.getLocation().add(0, 0.75, 0), 0.4f, 0.4f, 0.4f, 0, 6);
@ -927,7 +927,7 @@ public class HideSeek extends TeamGame
if (!Recharge.Instance.use(player, "Firework", 15000, true, true))
return;
this.AddGems(player, 2, "Fireworks", true);
this.AddGems(player, 2, "Fireworks", true, true);
UtilInv.remove(player, Material.FIREWORK, (byte)0, 1);
UtilInv.Update(player);
@ -948,7 +948,7 @@ public class HideSeek extends TeamGame
for (Player player : _hiders.GetPlayers(true))
{
this.AddGems(player, 0.05, "Seconds Alive", true);
this.AddGems(player, 0.05, "Seconds Alive", true, true);
}
}
@ -1043,7 +1043,7 @@ public class HideSeek extends TeamGame
if (forced)
{
AddGems(player, 10, "Forced Seeker", false);
AddGems(player, 10, "Forced Seeker", false, false);
Announce(F.main("Game",
F.elem(_hiders.GetColor() + player.getName()) + " was moved to " + F.elem(C.cRed + C.Bold + "Hunters") + "."));
@ -1080,17 +1080,17 @@ public class HideSeek extends TeamGame
// Gems
if (places.size() >= 1)
AddGems(places.get(0), 20, "1st Place", false);
AddGems(places.get(0), 20, "1st Place", false, false);
if (places.size() >= 2)
AddGems(places.get(1), 15, "2nd Place", false);
AddGems(places.get(1), 15, "2nd Place", false, false);
if (places.size() >= 3)
AddGems(places.get(2), 10, "3rd Place", false);
AddGems(places.get(2), 10, "3rd Place", false, false);
for (Player player : GetPlayers(false))
if (player.isOnline())
AddGems(player, 10, "Participation", false);
AddGems(player, 10, "Participation", false, false);
SetState(GameState.End);
}
@ -1162,11 +1162,11 @@ public class HideSeek extends TeamGame
AnnounceEnd(_hiders);
for (Player player : _hiders.GetPlayers(true))
AddGems(player, 10, "Winning Team", false);
AddGems(player, 10, "Winning Team", false, false);
for (Player player : GetPlayers(false))
if (player.isOnline())
AddGems(player, 10, "Participation", false);
AddGems(player, 10, "Participation", false, false);
SetState(GameState.End);
}

View File

@ -301,7 +301,7 @@ public class MilkCow extends SoloGame
if (forced)
{
AddGems(player, 10, "Forced Cow", false);
AddGems(player, 10, "Forced Cow", false, false);
Announce(F.main("Game", F.elem(_farmers.GetColor() + player.getName()) + " has become " +
F.elem(_cows.GetColor() + newKit.GetName()) + "."));
@ -342,7 +342,7 @@ public class MilkCow extends SoloGame
event.getPlayer().getWorld().playSound(event.getPlayer().getLocation(), Sound.BURP, 2f, 1f);
UtilPlayer.health(event.getPlayer(), 2);
this.AddGems(event.getPlayer(), 0.5, "Milk Drunk", true);
this.AddGems(event.getPlayer(), 0.5, "Milk Drunk", true, true);
}
@EventHandler
@ -432,18 +432,18 @@ public class MilkCow extends SoloGame
//Award Gems
if (_ranks.size() >= 1)
AddGems(_ranks.get(0).Player, 20, "1st Place", false);
AddGems(_ranks.get(0).Player, 20, "1st Place", false, false);
if (_ranks.size() >= 2)
AddGems(_ranks.get(1).Player, 15, "2nd Place", false);
AddGems(_ranks.get(1).Player, 15, "2nd Place", false, false);
if (_ranks.size() >= 3)
AddGems(_ranks.get(2).Player, 10, "3rd Place", false);
AddGems(_ranks.get(2).Player, 10, "3rd Place", false, false);
//Participation
for (Player player : GetPlayers(false))
if (player.isOnline())
AddGems(player, 10, "Participation", false);
AddGems(player, 10, "Participation", false, false);
SetState(GameState.End);
AnnounceEnd(places);

View File

@ -2451,12 +2451,12 @@ public class MineStrike extends TeamGame
if (WinnerTeam != null && other.equals(WinnerTeam))
{
for (Player player : other.GetPlayers(false))
AddGems(player, 10, "Winning Team", false);
AddGems(player, 10, "Winning Team", false, false);
}
for (Player player : other.GetPlayers(false))
if (player.isOnline())
AddGems(player, 10, "Participation", false);
AddGems(player, 10, "Participation", false, false);
}
//End
@ -2487,12 +2487,12 @@ public class MineStrike extends TeamGame
if (WinnerTeam != null && team.equals(WinnerTeam))
{
for (Player player : team.GetPlayers(false))
AddGems(player, 10, "Winning Team", false);
AddGems(player, 10, "Winning Team", false, false);
}
for (Player player : team.GetPlayers(false))
if (player.isOnline())
AddGems(player, 10, "Participation", false);
AddGems(player, 10, "Participation", false, false);
}
//End

View File

@ -273,7 +273,7 @@ public class Paintball extends TeamGame
PlayerOut(damagee);
AddGems(damager, 2, "Kills", true);
AddGems(damager, 2, "Kills", true, true);
}
//Hit Sound
@ -401,7 +401,7 @@ public class Paintball extends TeamGame
PlayerIn(copy.GetPlayer(), copy.GetEntity());
copyIterator.remove();
AddGems(thrower, 3, "Revived Ally", true);
AddGems(thrower, 3, "Revived Ally", true, true);
Bukkit.getPluginManager().callEvent(new ReviveEvent(thrower, copy.GetPlayer()));
}

View File

@ -316,32 +316,32 @@ public class Quiver extends SoloGame
//Award Gems
if (_ranks.size() >= 1)
AddGems(_ranks.get(0).Player, 20, "1st Place", false);
AddGems(_ranks.get(0).Player, 20, "1st Place", false, false);
if (_ranks.size() >= 2)
AddGems(_ranks.get(1).Player, 15, "2nd Place", false);
AddGems(_ranks.get(1).Player, 15, "2nd Place", false, false);
if (_ranks.size() >= 3)
AddGems(_ranks.get(2).Player, 10, "3rd Place", false);
AddGems(_ranks.get(2).Player, 10, "3rd Place", false, false);
//Combo Gems
for (Player player : _bestCombo.keySet())
{
int combo = _bestCombo.get(player);
if (combo >= 20) AddGems(player, 40, "PERFECT - 20 Kill Combo", false);
else if (combo >= 13) AddGems(player, 24, "GODLIKE - 13 Kill Combo", false);
else if (combo >= 11) AddGems(player, 20, "UNSTOPPABLE - 11 Kill Combo", false);
else if (combo >= 9) AddGems(player, 16, "ULTRA KILL - 9 Kill Combo", false);
else if (combo >= 7) AddGems(player, 12, "MONSTER KILL - 7 Kill Combo", false);
else if (combo >= 5) AddGems(player, 8, "MEGA KILL - 5 Kill Combo", false);
else if (combo >= 3) AddGems(player, 4, "TRIPLE KILL - 3 Kill Combo", false);
if (combo >= 20) AddGems(player, 40, "PERFECT - 20 Kill Combo", false, false);
else if (combo >= 13) AddGems(player, 24, "GODLIKE - 13 Kill Combo", false, false);
else if (combo >= 11) AddGems(player, 20, "UNSTOPPABLE - 11 Kill Combo", false, false);
else if (combo >= 9) AddGems(player, 16, "ULTRA KILL - 9 Kill Combo", false, false);
else if (combo >= 7) AddGems(player, 12, "MONSTER KILL - 7 Kill Combo", false, false);
else if (combo >= 5) AddGems(player, 8, "MEGA KILL - 5 Kill Combo", false, false);
else if (combo >= 3) AddGems(player, 4, "TRIPLE KILL - 3 Kill Combo", false, false);
}
//Participation
for (Player player : GetPlayers(false))
if (player.isOnline())
AddGems(player, 10, "Participation", false);
AddGems(player, 10, "Participation", false, false);
SetState(GameState.End);
AnnounceEnd(places);

View File

@ -243,12 +243,12 @@ public class QuiverTeams extends TeamGame
if (WinnerTeam != null && team.equals(WinnerTeam))
{
for (Player player : team.GetPlayers(false))
AddGems(player, 10, "Winning Team", false);
AddGems(player, 10, "Winning Team", false, false);
}
for (Player player : team.GetPlayers(false))
if (player.isOnline())
AddGems(player, 10, "Participation", false);
AddGems(player, 10, "Participation", false, false);
}
//End

View File

@ -108,7 +108,7 @@ public class SheepData
//Reward
if (Holder != null && HolderTeam != null)
{
Host.AddGems(Holder, 3, "Sheep Captured", true);
Host.AddGems(Holder, 3, "Sheep Captured", true, true);
UtilPlayer.message(Holder, F.main("Game", "You captured a Sheep!"));

View File

@ -649,12 +649,12 @@ public class SheepGame extends TeamGame
if (WinnerTeam != null && team.equals(WinnerTeam))
{
for (Player player : team.GetPlayers(false))
AddGems(player, 10, "Winning Team", false);
AddGems(player, 10, "Winning Team", false, false);
}
for (Player player : team.GetPlayers(false))
if (player.isOnline())
AddGems(player, 10, "Participation", false);
AddGems(player, 10, "Participation", false, false);
}
//End
@ -701,12 +701,12 @@ public class SheepGame extends TeamGame
if (WinnerTeam != null && team.equals(WinnerTeam))
{
for (Player player : team.GetPlayers(false))
AddGems(player, 10, "Winning Team", false);
AddGems(player, 10, "Winning Team", false, false);
}
for (Player player : team.GetPlayers(false))
if (player.isOnline())
AddGems(player, 10, "Participation", false);
AddGems(player, 10, "Participation", false, false);
}
//End

View File

@ -168,18 +168,18 @@ public class SquidShooter extends SoloGame
//Award Gems
if (_ranks.size() >= 1)
AddGems(_ranks.get(0).Player, 20, "1st Place", false);
AddGems(_ranks.get(0).Player, 20, "1st Place", false, false);
if (_ranks.size() >= 2)
AddGems(_ranks.get(1).Player, 15, "2nd Place", false);
AddGems(_ranks.get(1).Player, 15, "2nd Place", false, false);
if (_ranks.size() >= 3)
AddGems(_ranks.get(2).Player, 10, "3rd Place", false);
AddGems(_ranks.get(2).Player, 10, "3rd Place", false, false);
//Participation
for (Player player : GetPlayers(false))
if (player.isOnline())
AddGems(player, 10, "Participation", false);
AddGems(player, 10, "Participation", false, false);
SetState(GameState.End);
AnnounceEnd(places);

View File

@ -691,12 +691,12 @@ public class TurfForts extends TeamGame
if (WinnerTeam != null && team.equals(WinnerTeam))
{
for (Player player : team.GetPlayers(false))
AddGems(player, 10, "Winning Team", false);
AddGems(player, 10, "Winning Team", false, false);
}
for (Player player : team.GetPlayers(false))
if (player.isOnline())
AddGems(player, 10, "Participation", false);
AddGems(player, 10, "Participation", false, false);
}
//End

View File

@ -667,7 +667,7 @@ public class UHC extends TeamGame
if (IsLive())
{
long timeAlive = System.currentTimeMillis() - GetStateTime();
AddGems(player, timeAlive / 60000d, "Survived " + UtilTime.MakeStr(timeAlive), false);
AddGems(player, timeAlive / 60000d, "Survived " + UtilTime.MakeStr(timeAlive), false, false);
}
//Time
@ -1116,17 +1116,17 @@ public class UHC extends TeamGame
//Gems
if (places.size() >= 1)
AddGems(places.get(0), 20, "1st Place", false);
AddGems(places.get(0), 20, "1st Place", false, false);
if (places.size() >= 2)
AddGems(places.get(1), 15, "2nd Place", false);
AddGems(places.get(1), 15, "2nd Place", false, false);
if (places.size() >= 3)
AddGems(places.get(2), 10, "3rd Place", false);
AddGems(places.get(2), 10, "3rd Place", false, false);
for (Player player : GetPlayers(false))
if (player.isOnline())
AddGems(player, 10, "Participation", false);
AddGems(player, 10, "Participation", false, false);
//End
SetState(GameState.End);
@ -1150,7 +1150,7 @@ public class UHC extends TeamGame
{
if (teamsAlive.size() > 0)
for (Player player : teamsAlive.get(0).GetPlayers(false))
AddGems(player, 8000, "Winning Team", false);
AddGems(player, 8000, "Winning Team", false, false);
AnnounceEnd(teamsAlive.get(0));
SetState(GameState.End);

View File

@ -200,7 +200,7 @@ public class WitherGame extends TeamGame implements IBlockRestorer
if (forced)
{
AddGems(player, 10, "Forced Wither", false);
AddGems(player, 10, "Forced Wither", false, false);
Announce(F.main("Game", F.elem(_withers.GetColor() + player.getName()) + " has become a " +
F.elem(_withers.GetColor() + newKit.GetName()) + "."));
@ -293,12 +293,12 @@ public class WitherGame extends TeamGame implements IBlockRestorer
if (WinnerTeam != null && team.equals(WinnerTeam))
{
for (Player player : team.GetPlayers(false))
AddGems(player, 10, "Winning Team", false);
AddGems(player, 10, "Winning Team", false, false);
}
for (Player player : team.GetPlayers(false))
if (player.isOnline())
AddGems(player, 10, "Participation", false);
AddGems(player, 10, "Participation", false, false);
}
//End
@ -510,7 +510,7 @@ public class WitherGame extends TeamGame implements IBlockRestorer
if (event.GetDamagerPlayer(true) != null)
{
AddGems(event.GetDamagerPlayer(true), 2, "Humans Stunned", true);
AddGems(event.GetDamagerPlayer(true), 2, "Humans Stunned", true, true);
Bukkit.broadcastMessage(C.cBlue + "Death> " + C.cGreen + event.GetDamageePlayer().getName() + C.cGray + " was killed by " + C.cRed + event.GetDamagerPlayer(true).getName() + C.cGray + ".");
}
@ -626,7 +626,7 @@ public class WitherGame extends TeamGame implements IBlockRestorer
playerIn(copy.GetPlayer(), copy.GetEntity());
copyIterator.remove();
AddGems(thrower, 3, "Revived Ally", true);
AddGems(thrower, 3, "Revived Ally", true, true);
}
//Revive

View File

@ -169,7 +169,7 @@ public class ZombieSurvival extends SoloGame
player.eject();
player.teleport(_undead.GetSpawn());
AddGems(player, 10, "Forced Undead", false);
AddGems(player, 10, "Forced Undead", false, false);
Announce(F.main("Game", F.elem(_survivors.GetColor() + player.getName()) + " has become an " +
F.elem(_undead.GetColor() + "Alpha Zombie") + "."));
@ -330,18 +330,18 @@ public class ZombieSurvival extends SoloGame
ArrayList<Player> places = _survivors.GetPlacements(true);
if (places.size() >= 1)
AddGems(places.get(0), 15, "1st Place", false);
AddGems(places.get(0), 15, "1st Place", false, false);
if (places.size() >= 2)
AddGems(places.get(1), 10, "2nd Place", false);
AddGems(places.get(1), 10, "2nd Place", false, false);
if (places.size() >= 3)
AddGems(places.get(2), 5, "3rd Place", false);
AddGems(places.get(2), 5, "3rd Place", false, false);
for (Player player : GetPlayers(false))
if (player.isOnline())
AddGems(player, 10, "Participation", false);
AddGems(player, 10, "Participation", false, false);
AnnounceEnd(places);

View File

@ -60,12 +60,12 @@ public class GameGemManager implements Listener
if (killer != null && !killer.equals(killed))
{
//Kill
game.AddGems(killer, game.GetKillsGems(killer, killed, false), "Kills", true);
game.AddGems(killer, game.GetKillsGems(killer, killed, false), "Kills", true, true);
//First Kill
if (game.FirstKill)
{
game.AddGems(killer, 10, "First Blood", false);
game.AddGems(killer, 10, "First Blood", false, false);
game.FirstKill = false;
@ -83,7 +83,7 @@ public class GameGemManager implements Listener
//Assist
if (assist != null)
game.AddGems(assist, game.GetKillsGems(assist, killed, true), "Kill Assists", true);
game.AddGems(assist, game.GetKillsGems(assist, killed, true), "Kill Assists", true, true);
}
}