diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java index 8c69eddb5..5cedb59b3 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java @@ -815,7 +815,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation || _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."); return; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java index 318e93d47..1d247b2c7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java @@ -188,6 +188,7 @@ public abstract class Game implements Listener public boolean WorldFireSpread = false; public boolean WorldLeavesDecay = false; public boolean WorldSoilTrample = false; + public boolean WorldBoneMeal = false; public int HungerSet = -1; public int HealthSet = -1; @@ -217,6 +218,8 @@ public abstract class Game implements Listener public boolean GadgetsDisabled = true; public boolean TeleportsDisqualify = true; + + public boolean DontAllowOverfill = false; //Addons public boolean CompassEnabled = false; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/Build.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/Build.java index 97d72fbc8..c2b186910 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/Build.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/build/Build.java @@ -171,6 +171,9 @@ public class Build extends SoloGame this.CreatureAllow = true; this.WorldFireSpread = true; + this.WorldBoneMeal = true; + + this.DontAllowOverfill = true; UtilServer.getServer().spigot().getConfig().set("view-distance", 4); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/ChampionsDominate.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/ChampionsDominate.java index a3b8b3edd..f7eb0d360 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/ChampionsDominate.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/ChampionsDominate.java @@ -66,6 +66,8 @@ public class ChampionsDominate extends Domination EloRanking = false; EloStart = 1000; + this.DontAllowOverfill = true; + this.DisableKillCommand = false; registerStatTrackers( diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/ChampionsTDM.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/ChampionsTDM.java index 490688277..cc414be9b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/ChampionsTDM.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/champions/ChampionsTDM.java @@ -65,6 +65,8 @@ public class ChampionsTDM extends TeamDeathmatch InventoryOpenChest = true; this.DisableKillCommand = false; + + this.DontAllowOverfill = true; registerStatTrackers( new WinWithoutLosingTeammateStatTracker(this, "FlawlessVictory"), diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/Halloween.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/Halloween.java index 3858e54c8..8d03a03a9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/Halloween.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/halloween/Halloween.java @@ -120,6 +120,8 @@ public class Halloween extends SoloGame //this.HungerSet = 20; this.WorldBoundaryKill = false; + + this.DontAllowOverfill = true; } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/MineStrike.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/MineStrike.java index c4f5a47ed..cfc70dab1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/MineStrike.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/minestrike/MineStrike.java @@ -262,6 +262,8 @@ public class MineStrike extends TeamGame this.JoinInProgress = true; this.VersionRequire1_8 = true; + + this.DontAllowOverfill = true; _scoreObj = Scoreboard.GetScoreboard().registerNewObjective("HP", "dummy"); _scoreObj.setDisplaySlot(DisplaySlot.BELOW_NAME); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java index 603f1c2bf..741d1c093 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java @@ -64,6 +64,7 @@ import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTime; +import mineplex.core.common.util.UtilTextMiddle; import mineplex.core.itemstack.ItemStackFactory; import mineplex.core.timing.TimingManager; import mineplex.core.updater.UpdateType; @@ -95,13 +96,10 @@ public class UHC extends TeamGame private long _hour = 3600000; private long _createTime; private long _serverTime; - private boolean _joinable = false; - private boolean _ended = false; + private boolean _mapLoaded = false; private boolean xrayDebug = false; - private long lastInform = 0; - public UHC(ArcadeManager manager) { super(manager, GameType.UHC, @@ -160,6 +158,12 @@ public class UHC extends TeamGame this.GemBoosterEnabled = false; this.GemDoubleEnabled = false; this.GemHunterEnabled = false; + + this.WorldBoneMeal = true; + + this.DontAllowOverfill = true; + + this.VersionRequire1_8 = true; WorldTimeSet = -1; @@ -170,8 +174,7 @@ public class UHC extends TeamGame //Disable Anti-Stack setItemMerge(true); - // Manager.GetAntiStack().SetEnabled(false); - + //Damage Settings Manager.GetDamage().SetEnabled(false); @@ -212,11 +215,11 @@ public class UHC extends TeamGame 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) { - Announce(ChatColor.WHITE + C.Bold + "PvP has been enabled!"); + UtilTextMiddle.display(null, "PvP has been enabled!", 5, 80, 5); for (Player player : UtilServer.getPlayers()) 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 public void WorldBoundaryCheck(UpdateEvent event) { @@ -310,92 +291,6 @@ public class UHC extends TeamGame { 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.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 for (int x=-16 ; x<16 ; x++) for (int z=-16 ; z<16 ; z++) @@ -447,6 +330,7 @@ public class UHC extends TeamGame if (y > _yMax) _yMax = y; } + System.out.println("Y Max: " + _yMax); System.out.println("Time: " + UtilTime.MakeStr(System.currentTimeMillis() - time)); @@ -461,7 +345,7 @@ public class UHC extends TeamGame event.getBlock().getZ() <= 16 && 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); } } @@ -1046,54 +930,6 @@ public class UHC extends TeamGame 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 public void EndCheck() { @@ -1237,49 +1073,6 @@ public class UHC extends TeamGame 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 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 public double GetKillsGems(Player killer, Player killed, boolean assist) { @@ -1424,16 +1198,13 @@ public class UHC extends TeamGame //Ended 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 - if (!_joinable) + //Not Loaded (but still joinable) + if (!_mapLoaded) { - return ChatColor.GOLD + "Open in " + UtilTime.MakeStr(_hour - (getServerTime() % _hour)); + return ChatColor.GOLD + "Generating Map..."; } return ChatColor.GREEN + "Recruiting"; @@ -1610,14 +1381,9 @@ public class UHC extends TeamGame } } } - - public void informStartSoon() + + public boolean isMapLoaded() { - if (UtilTime.elapsed(lastInform, 20000)) - { - lastInform = System.currentTimeMillis(); - - Bukkit.broadcastMessage(C.cGray + "Countdown will start in " + UtilTime.MakeStr(150000 - (System.currentTimeMillis() - GetStateTime())) +"..."); - } + return _mapLoaded; } } \ No newline at end of file diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameCreationManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameCreationManager.java index 2337f1f77..f91764e84 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameCreationManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameCreationManager.java @@ -72,11 +72,7 @@ public class GameCreationManager implements Listener //Archive Game if (Manager.GetGame() != null) - { - //Don't End UHC - if (Manager.GetGame().GetType() == GameType.UHC) - return; - + { if (Manager.GetGame().GetState() == GameState.Dead) { HandlerList.unregisterAll(Manager.GetGame()); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java index 03dbcb835..3abbeebee 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameManager.java @@ -224,15 +224,10 @@ public class GameManager implements Listener public void StateCountdown(Game game, int timer, boolean force) { - //Always give time to pick team. - if (!game.GetCountdownForce() && !force && !UtilTime.elapsed(game.GetStateTime(), game.GetType() == GameType.UHC ? 150000 : 15000)) + if (game instanceof UHC) { - if (game.GetType() == GameType.UHC) - { - ((UHC)game).informStartSoon(); - } - - return; + if (((UHC)game).isMapLoaded()) + return; } //Disabling Cosmetics diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/MiscManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/MiscManager.java index 400e46a4a..418871ce9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/MiscManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/MiscManager.java @@ -50,10 +50,12 @@ public class MiscManager implements Listener Player player = event.getPlayer(); //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) {