Merge remote-tracking branch 'origin/master'

This commit is contained in:
Shaun Bennett 2015-05-11 15:17:50 -05:00
commit d57bab7430
11 changed files with 44 additions and 271 deletions

View File

@ -815,7 +815,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|| _donationManager.Get(event.getPlayer().getName()).OwnsUnknownPackage(_serverConfig.ServerType + " ULTRA")) || _donationManager.Get(event.getPlayer().getName()).OwnsUnknownPackage(_serverConfig.ServerType + " ULTRA"))
{ {
if (GetGame() != null && (GetGame().GetType() == GameType.UHC || GetGame().GetType() == GameType.Halloween || GetGame().GetType() == GameType.Christmas || GetGame().GetType() == GameType.ChampionsDominate || GetGame().GetType() == GameType.ChampionsTDM || GetGame().GetType() == GameType.MineStrike)) if (GetGame() != null && GetGame().DontAllowOverfill)
{ {
event.disallow(PlayerLoginEvent.Result.KICK_OTHER, C.Bold + "Server has reached max capacity for gameplay purposes."); event.disallow(PlayerLoginEvent.Result.KICK_OTHER, C.Bold + "Server has reached max capacity for gameplay purposes.");
return; return;

View File

@ -188,6 +188,7 @@ public abstract class Game implements Listener
public boolean WorldFireSpread = false; public boolean WorldFireSpread = false;
public boolean WorldLeavesDecay = false; public boolean WorldLeavesDecay = false;
public boolean WorldSoilTrample = false; public boolean WorldSoilTrample = false;
public boolean WorldBoneMeal = false;
public int HungerSet = -1; public int HungerSet = -1;
public int HealthSet = -1; public int HealthSet = -1;
@ -218,6 +219,8 @@ public abstract class Game implements Listener
public boolean TeleportsDisqualify = true; public boolean TeleportsDisqualify = true;
public boolean DontAllowOverfill = false;
//Addons //Addons
public boolean CompassEnabled = false; public boolean CompassEnabled = false;
public boolean CompassGiveItem = true; public boolean CompassGiveItem = true;

View File

@ -171,6 +171,9 @@ public class Build extends SoloGame
this.CreatureAllow = true; this.CreatureAllow = true;
this.WorldFireSpread = true; this.WorldFireSpread = true;
this.WorldBoneMeal = true;
this.DontAllowOverfill = true;
UtilServer.getServer().spigot().getConfig().set("view-distance", 4); UtilServer.getServer().spigot().getConfig().set("view-distance", 4);

View File

@ -66,6 +66,8 @@ public class ChampionsDominate extends Domination
EloRanking = false; EloRanking = false;
EloStart = 1000; EloStart = 1000;
this.DontAllowOverfill = true;
this.DisableKillCommand = false; this.DisableKillCommand = false;
registerStatTrackers( registerStatTrackers(

View File

@ -66,6 +66,8 @@ public class ChampionsTDM extends TeamDeathmatch
this.DisableKillCommand = false; this.DisableKillCommand = false;
this.DontAllowOverfill = true;
registerStatTrackers( registerStatTrackers(
new WinWithoutLosingTeammateStatTracker(this, "FlawlessVictory"), new WinWithoutLosingTeammateStatTracker(this, "FlawlessVictory"),
new KillAllOpposingStatTracker(this), new KillAllOpposingStatTracker(this),

View File

@ -120,6 +120,8 @@ public class Halloween extends SoloGame
//this.HungerSet = 20; //this.HungerSet = 20;
this.WorldBoundaryKill = false; this.WorldBoundaryKill = false;
this.DontAllowOverfill = true;
} }
@Override @Override

View File

@ -263,6 +263,8 @@ public class MineStrike extends TeamGame
this.VersionRequire1_8 = true; this.VersionRequire1_8 = true;
this.DontAllowOverfill = true;
_scoreObj = Scoreboard.GetScoreboard().registerNewObjective("HP", "dummy"); _scoreObj = Scoreboard.GetScoreboard().registerNewObjective("HP", "dummy");
_scoreObj.setDisplaySlot(DisplaySlot.BELOW_NAME); _scoreObj.setDisplaySlot(DisplaySlot.BELOW_NAME);

View File

@ -64,6 +64,7 @@ import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.timing.TimingManager; import mineplex.core.timing.TimingManager;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
@ -95,13 +96,10 @@ public class UHC extends TeamGame
private long _hour = 3600000; private long _hour = 3600000;
private long _createTime; private long _createTime;
private long _serverTime; private long _serverTime;
private boolean _joinable = false; private boolean _mapLoaded = false;
private boolean _ended = false;
private boolean xrayDebug = false; private boolean xrayDebug = false;
private long lastInform = 0;
public UHC(ArcadeManager manager) public UHC(ArcadeManager manager)
{ {
super(manager, GameType.UHC, super(manager, GameType.UHC,
@ -161,6 +159,12 @@ public class UHC extends TeamGame
this.GemDoubleEnabled = false; this.GemDoubleEnabled = false;
this.GemHunterEnabled = false; this.GemHunterEnabled = false;
this.WorldBoneMeal = true;
this.DontAllowOverfill = true;
this.VersionRequire1_8 = true;
WorldTimeSet = -1; WorldTimeSet = -1;
CraftRecipes(); CraftRecipes();
@ -170,7 +174,6 @@ public class UHC extends TeamGame
//Disable Anti-Stack //Disable Anti-Stack
setItemMerge(true); setItemMerge(true);
// Manager.GetAntiStack().SetEnabled(false);
//Damage Settings //Damage Settings
Manager.GetDamage().SetEnabled(false); Manager.GetDamage().SetEnabled(false);
@ -212,11 +215,11 @@ public class UHC extends TeamGame
if (_gameMinutes < _safeTime) if (_gameMinutes < _safeTime)
{ {
Announce(ChatColor.WHITE + C.Bold + "PvP enabled in " + (_safeTime - _gameMinutes) + " minutes."); UtilTextMiddle.display(null, "PvP enabled in " + (_safeTime - _gameMinutes) + " minutes.", 5, 80, 5);
} }
else if (_gameMinutes == _safeTime) else if (_gameMinutes == _safeTime)
{ {
Announce(ChatColor.WHITE + C.Bold + "PvP has been enabled!"); UtilTextMiddle.display(null, "PvP has been enabled!", 5, 80, 5);
for (Player player : UtilServer.getPlayers()) for (Player player : UtilServer.getPlayers())
player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 1f, 1f); player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 1f, 1f);
@ -275,28 +278,6 @@ public class UHC extends TeamGame
} }
} }
/*
@EventHandler
public void WorldBoundaryCheck(PlayerMoveEvent event)
{
if (!IsLive())
return;
//Allowed
if (
event.getTo().getX() < _borderSize&&
event.getTo().getX() >= -_borderSize &&
event.getTo().getZ() < _borderSize &&
event.getTo().getZ() >= -_borderSize)
return;
if (Recharge.Instance.use(event.getPlayer(), "Border Shrink", 500, false, false))
{
Manager.GetCondition().Factory().Poison("Border", event.getPlayer(), event.getPlayer(), 1.9, 0, false, false, false);
}
}
*/
@EventHandler @EventHandler
public void WorldBoundaryCheck(UpdateEvent event) public void WorldBoundaryCheck(UpdateEvent event)
{ {
@ -310,92 +291,6 @@ public class UHC extends TeamGame
{ {
player.damage(0.75); player.damage(0.75);
} }
VisualBoundary(player);
VisualBoundaryClose(player);
}
}
public void VisualBoundary(Player player)
{
//Effect 1
if (Math.abs(player.getLocation().getX()) + 16 < _borderSize && Math.abs(player.getLocation().getZ()) + 16 < _borderSize)
return;
//X Wall
if (Math.abs(player.getLocation().getX()) + 16 >= _borderSize)
{
Location loc = player.getLocation().getBlock().getLocation().add(0.5, 0.5, 0.5);
loc.setX(_borderSize);
for (int y=-16 ; y<=16 ; y++)
{
for (int z=-16 ; z<=16 ; z++)
{
if (Math.abs(loc.getZ() + z) > _borderSize)
continue;
Location newLoc = loc.clone().add(0, y, z);
if (UtilMath.offset(player.getLocation(), newLoc) > 16)
continue;
UtilParticle.PlayParticle(ParticleType.FLAME, newLoc, 0.5f, 0.5f, 0.5f, 0, 1,
ViewDist.NORMAL, player);
if (_borderSize > 16)
player.playSound(newLoc, Sound.FIZZ, 0.1f, 0.1f);
}
}
}
//Z Wall
if (Math.abs(player.getLocation().getZ()) + 16 >= _borderSize)
{
Location loc = player.getLocation().getBlock().getLocation().add(0.5, 0.5, 0.5);
loc.setZ(_borderSize);
for (int x=-16 ; x<=16 ; x++)
{
for (int y=-16 ; y<=16 ; y++)
{
if (Math.abs(loc.getX() + x) > _borderSize)
continue;
Location newLoc = loc.clone().add(x, y, 0);
if (UtilMath.offset(player.getLocation(), newLoc) > 16)
continue;
UtilParticle.PlayParticle(ParticleType.FLAME, newLoc, 0.5f, 0.5f, 0.5f, 0, 1,
ViewDist.NORMAL, player);
if (_borderSize > 16)
player.playSound(newLoc, Sound.FIZZ, 0.1f, 0.1f);
}
}
}
}
public void VisualBoundaryClose(Player player)
{
//Effect
if (Math.abs(player.getLocation().getX()) + 5 < _borderSize && Math.abs(player.getLocation().getZ()) + 5 < _borderSize)
return;
for (Block block : UtilBlock.getInRadius(player.getLocation(), 5d).keySet())
{
if (Math.random() > 0.80)
continue;
if (Math.abs(block.getX()) < _borderSize && Math.abs(block .getZ()) < _borderSize)
continue;
if (!UtilBlock.airFoliage(block))
continue;
UtilParticle.PlayParticle(ParticleType.LAVA, block.getLocation().add(0.5, 0.5, 0.5), 0.5f, 0.5f, 0.5f, 0, 1,
ViewDist.NORMAL, UtilServer.getPlayers());
} }
} }
@ -426,18 +321,6 @@ public class UHC extends TeamGame
this.WorldData.MinY = -1000; this.WorldData.MinY = -1000;
this.WorldData.MaxY = 1000; this.WorldData.MaxY = 1000;
/*
for (int y=0 ; y<128 ; y++)
for (int x=-_borderSize ; x<_borderSize ; x++)
for (int z=-_borderSize ; z<_borderSize ; z++)
{
if (x == -_borderSize || x == _borderSize-1 || z == -_borderSize || z == _borderSize-1)
{
MapUtil.QuickChangeBlockAt(WorldData.World, x, y, z , 159, (byte)14);
}
}
*/
//Find Y Max //Find Y Max
for (int x=-16 ; x<16 ; x++) for (int x=-16 ; x<16 ; x++)
for (int z=-16 ; z<16 ; z++) for (int z=-16 ; z<16 ; z++)
@ -447,6 +330,7 @@ public class UHC extends TeamGame
if (y > _yMax) if (y > _yMax)
_yMax = y; _yMax = y;
} }
System.out.println("Y Max: " + _yMax); System.out.println("Y Max: " + _yMax);
System.out.println("Time: " + UtilTime.MakeStr(System.currentTimeMillis() - time)); System.out.println("Time: " + UtilTime.MakeStr(System.currentTimeMillis() - time));
@ -461,7 +345,7 @@ public class UHC extends TeamGame
event.getBlock().getZ() <= 16 && event.getBlock().getZ() <= 16 &&
event.getBlock().getY() >= _yMax) event.getBlock().getY() >= _yMax)
{ {
UtilPlayer.message(event.getPlayer(), F.main("Game", "You cannot build this high up.")); UtilPlayer.message(event.getPlayer(), F.main("Game", "You cannot build this high near center of map."));
event.setCancelled(true); event.setCancelled(true);
} }
} }
@ -1046,54 +930,6 @@ public class UHC extends TeamGame
event.setCancelled(false); event.setCancelled(false);
} }
/*
@EventHandler
public void TabHealth(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST)
return;
if (!InProgress())
return;
for (Player player : GetPlayers(true))
{
GameTeam team = GetTeam(player);
ChatColor col = ChatColor.GREEN;
if (player.getHealth() <= 12) col = ChatColor.YELLOW;
if (player.getHealth() <= 6) col = ChatColor.RED;
String health = " - " + col;
if (_soloGame)
health = " - ";
int hp = (int)(player.getHealth() + 0.9999999999);
if (hp % 2 == 0)
health += (int)(hp/2);
else
health += UtilMath.trim(1, hp/2d);
String name = team.GetColor() + player.getName();
if (_soloGame)
name = col + player.getName();
try
{
while (name.length() + health.length() > 16)
name = name.substring(0, name.length()-1);
player.setPlayerListName(name + health);
}
catch (Exception e)
{
System.out.println("TAB NAME: " + name + health);
e.printStackTrace();
}
}
}*/
@Override @Override
public void EndCheck() public void EndCheck()
{ {
@ -1237,49 +1073,6 @@ public class UHC extends TeamGame
return _serverTime + (System.currentTimeMillis() - _createTime); return _serverTime + (System.currentTimeMillis() - _createTime);
} }
@EventHandler
public void returnToHub(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
if (_joinable)
return;
//Cannot become Joinable within first 10 seconds of creation
if (!UtilTime.elapsed(_createTime, 10000))
{
return;
}
//Become Joinable (first 5 seconds of the hour)
if (getServerTime() % _hour < 5000)
{
_joinable = true;
}
}
@EventHandler
public void kickPlayers(UpdateEvent event)
{
if (event.getType() != UpdateType.SEC)
return;
if (!_ended)
if (_joinable)
return;
for (final Player player : UtilServer.getPlayers())
{
UtilPlayer.message(player, " ");
UtilPlayer.message(player, C.cGold + C.Bold + "This UHC game is closed!");
UtilPlayer.message(player, " ");
player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 10f, 1f);
Manager.GetPortal().sendPlayerToServer(player, "Lobby");
}
}
@Override @Override
public boolean CanJoinTeam(GameTeam team) public boolean CanJoinTeam(GameTeam team)
{ {
@ -1338,25 +1131,6 @@ public class UHC extends TeamGame
} }
} }
@EventHandler(priority = EventPriority.MONITOR)
public void setEnded(final GameStateChangeEvent event)
{
if (!Manager.IsRewardItems())
return;
if (event.GetState() != GameState.Dead)
return;
UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(Manager.getPlugin(), new Runnable()
{
public void run()
{
_ended = true;
}
}, 360);
//Delay 18 Seconds
}
@Override @Override
public double GetKillsGems(Player killer, Player killed, boolean assist) public double GetKillsGems(Player killer, Player killed, boolean assist)
{ {
@ -1424,16 +1198,13 @@ public class UHC extends TeamGame
//Ended //Ended
if (GetState() == GameState.End || GetState() == GameState.Dead) if (GetState() == GameState.End || GetState() == GameState.Dead)
{ {
if (_ended)
return ChatColor.RED + "Finished";
else
return ChatColor.YELLOW + "In Progress"; return ChatColor.YELLOW + "In Progress";
} }
//Not Joinable Yet //Not Loaded (but still joinable)
if (!_joinable) if (!_mapLoaded)
{ {
return ChatColor.GOLD + "Open in " + UtilTime.MakeStr(_hour - (getServerTime() % _hour)); return ChatColor.GOLD + "Generating Map...";
} }
return ChatColor.GREEN + "Recruiting"; return ChatColor.GREEN + "Recruiting";
@ -1611,13 +1382,8 @@ public class UHC extends TeamGame
} }
} }
public void informStartSoon() public boolean isMapLoaded()
{ {
if (UtilTime.elapsed(lastInform, 20000)) return _mapLoaded;
{
lastInform = System.currentTimeMillis();
Bukkit.broadcastMessage(C.cGray + "Countdown will start in " + UtilTime.MakeStr(150000 - (System.currentTimeMillis() - GetStateTime())) +"...");
}
} }
} }

View File

@ -73,10 +73,6 @@ public class GameCreationManager implements Listener
//Archive Game //Archive Game
if (Manager.GetGame() != null) if (Manager.GetGame() != null)
{ {
//Don't End UHC
if (Manager.GetGame().GetType() == GameType.UHC)
return;
if (Manager.GetGame().GetState() == GameState.Dead) if (Manager.GetGame().GetState() == GameState.Dead)
{ {
HandlerList.unregisterAll(Manager.GetGame()); HandlerList.unregisterAll(Manager.GetGame());

View File

@ -224,14 +224,9 @@ public class GameManager implements Listener
public void StateCountdown(Game game, int timer, boolean force) public void StateCountdown(Game game, int timer, boolean force)
{ {
//Always give time to pick team. if (game instanceof UHC)
if (!game.GetCountdownForce() && !force && !UtilTime.elapsed(game.GetStateTime(), game.GetType() == GameType.UHC ? 150000 : 15000))
{ {
if (game.GetType() == GameType.UHC) if (((UHC)game).isMapLoaded())
{
((UHC)game).informStartSoon();
}
return; return;
} }

View File

@ -50,9 +50,11 @@ public class MiscManager implements Listener
Player player = event.getPlayer(); Player player = event.getPlayer();
//BoneMeal //BoneMeal
if (event.getPlayer().getItemInHand().getType() == Material.INK_SACK && event.getPlayer().getItemInHand().getData().getData() == (byte)15) if (!Manager.GetGame().WorldBoneMeal &&
event.getAction() == Action.RIGHT_CLICK_BLOCK &&
event.getPlayer().getItemInHand().getType() == Material.INK_SACK &&
event.getPlayer().getItemInHand().getData().getData() == (byte)15)
{ {
if (event.getAction() == Action.RIGHT_CLICK_BLOCK && Manager.GetGame().GetType() != GameType.UHC && Manager.GetGame().GetType() != GameType.Build)
event.setCancelled(true); event.setCancelled(true);
} }
else if (Manager.GetGame().GetState() != GameState.Live) else if (Manager.GetGame().GetState() != GameState.Live)