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 e220d8668..94d745ab4 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 @@ -358,6 +358,8 @@ public abstract class Game implements Listener // Used for "%player% is your teammate" public boolean ShowTeammateMessage = false; + + public boolean ShowEveryoneSpecChat = true; public boolean ForceTeamSize = true; public int PlayersPerTeam = 2; 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 cebb4264a..5c08f3709 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 @@ -23,6 +23,7 @@ import org.bukkit.World; import org.bukkit.World.Environment; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; +import org.bukkit.block.Chest; import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; import org.bukkit.craftbukkit.v1_8_R3.util.CraftMagicNumbers; import org.bukkit.entity.Entity; @@ -49,6 +50,7 @@ import org.bukkit.event.player.PlayerPortalEvent; import org.bukkit.event.player.PlayerTeleportEvent.TeleportCause; import org.bukkit.event.world.ChunkUnloadEvent; import org.bukkit.inventory.CraftingInventory; +import org.bukkit.inventory.Inventory; import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ShapelessRecipe; import org.bukkit.potion.PotionEffect; @@ -96,7 +98,6 @@ import nautilus.game.arcade.game.modules.OreVeinEditorModule; import nautilus.game.arcade.game.modules.PlayerHeadModule; import nautilus.game.arcade.game.modules.RejoinModule; import nautilus.game.arcade.game.modules.RejoinModule.RejoinPlayerData; -import nautilus.game.arcade.game.modules.SafezoneModule; import nautilus.game.arcade.game.modules.combatlog.CombatLogModule; import nautilus.game.arcade.game.modules.combatlog.CombatLogNPC; import nautilus.game.arcade.game.modules.combatlog.CombatLogNPCExpiredEvent; @@ -138,7 +139,7 @@ public abstract class UHC extends Game public static final int PRE_DEATHMATCH_TIME_SECONDS = 11; // The amount of damage to give from hitting the world border - public static final int WORLD_BORDER_DAMAGE = 5; + public static final int WORLD_BORDER_DAMAGE = 2; // The amount of damage to give from hitting the world border public static final int WORLD_BORDER_TIME = 5; @@ -200,12 +201,10 @@ public abstract class UHC extends Game StrictAntiHack = true; - GameTimeout = 10800000; + GameTimeout = TimeUnit.HOURS.toMillis(2); DamagePvP = false; - DeathDropItems = true; - ItemDrop = true; ItemPickup = true; @@ -218,7 +217,7 @@ public abstract class UHC extends Game DeathOut = true; QuitOut = false; - + CreatureAllow = true; AnnounceStay = false; @@ -247,6 +246,8 @@ public abstract class UHC extends Game WorldBoneMeal = true; WorldChunkUnload = true; + ShowEveryoneSpecChat = false; + CraftRecipes(); // Disable Custom Mob Drops (and EXP Disable) @@ -268,7 +269,6 @@ public abstract class UHC extends Game _freezer = new UHCFreezer(this); new PlayerHeadModule().register(this); - new SafezoneModule().filter(location -> location.getX() <= SAFE_REGION && location.getX() >= -SAFE_REGION && location.getZ() <= SAFE_REGION && location.getZ() >= -SAFE_REGION).register(this); new CompassModule().setGiveCompass(false).register(this); new OreVeinEditorModule().removeNonAirVeins().register(this); new AntiExpOrbModule().register(this); @@ -667,7 +667,7 @@ public abstract class UHC extends Game if (IsAlive(player)) { - Manager.GetDamage().NewDamageEvent(player, null, null, DamageCause.CUSTOM, WORLD_BORDER_DAMAGE, false, false, false, "Nether Field", "Vaporize"); + Manager.GetDamage().NewDamageEvent(player, null, null, DamageCause.CUSTOM, WORLD_BORDER_DAMAGE, false, false, true, "Nether Field", "Vaporize"); player.getWorld().playSound(loc, Sound.NOTE_BASS, 2f, 1f); player.getWorld().playSound(loc, Sound.NOTE_BASS, 2f, 1f); @@ -879,8 +879,6 @@ public abstract class UHC extends Game // Toggle temporary game settings Damage = true; - - getModule(SafezoneModule.class).filter(location -> location.getX() <= DEATHMATCH_ARENA_SIZE && location.getX() >= -DEATHMATCH_ARENA_SIZE && location.getZ() <= DEATHMATCH_ARENA_SIZE&& location.getZ() >= -DEATHMATCH_ARENA_SIZE); // Set the border _border.setSize(0, DEATHMATCH_TIME_SECONDS); @@ -1039,11 +1037,7 @@ public abstract class UHC extends Game return; } - if (isSpeedMode()) - { - _border.setSize(MAX_ARENA_SIZE / 2, MINING_TIME / 1000); - } - else + if (!isSpeedMode()) { _border.setSize(0, MINING_TIME / 1000); } @@ -1300,7 +1294,7 @@ public abstract class UHC extends Game } } - @EventHandler + @EventHandler(priority = EventPriority.HIGHEST) public void PlayerDeath(PlayerDeathEvent event) { Player player = event.getEntity(); @@ -1319,6 +1313,21 @@ public abstract class UHC extends Game { long timeAlive = System.currentTimeMillis() - GetStateTime(); AddGems(player, timeAlive / 60000d, "Survived " + UtilTime.MakeStr(timeAlive), false, false); + + // Place their items in a chest + Block block = player.getLocation().getBlock(); + + block.setType(Material.CHEST); + block.getRelative(BlockFace.NORTH).setType(Material.CHEST); + + Chest chest = (Chest) block.getState(); + Inventory inventory = chest.getInventory(); + int i = 0; + + for (ItemStack itemStack : event.getDrops()) + { + inventory.setItem(i++, itemStack); + } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/components/UHCSpeedMode.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/components/UHCSpeedMode.java index dcf2b8934..9edb369dc 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/components/UHCSpeedMode.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/components/UHCSpeedMode.java @@ -34,7 +34,8 @@ public class UHCSpeedMode implements Listener new ItemStack(Material.STONE_PICKAXE), new ItemStack(Material.STONE_AXE), new ItemStack(Material.STONE_SPADE), - new ItemStack(Material.APPLE, 3), + new ItemStack(Material.COOKED_BEEF, 10), + new ItemStack(Material.WOOD, 32) }; private UHC _host; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/RejoinModule.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/RejoinModule.java index 0e9c60ecf..67587fcee 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/RejoinModule.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/RejoinModule.java @@ -5,7 +5,6 @@ import java.util.Iterator; import java.util.Set; import java.util.concurrent.TimeUnit; -import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -18,6 +17,7 @@ import mineplex.core.common.Rank; import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.NautHashMap; +import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilTime; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; @@ -64,6 +64,7 @@ public class RejoinModule extends Module } caller.sendMessage(F.main("Debug", C.cYellow + player + C.cGray + " is now allowed to rejoin. If they are online tell them to relog.")); + caller.sendMessage(F.main("Debug", "There are issues with this and it should not be used outside of the testing environment!")); } }); } @@ -111,7 +112,7 @@ public class RejoinModule extends Module team.RemovePlayer(player); // Announcement - getGame().Announce(team.GetColor() + C.Bold + player.getName() + " has disconnected! " + UtilTime.MakeStr(_rejoinTime) + " minutes to rejoin.", false); + getGame().Announce(team.GetColor() + C.Bold + player.getName() + " has disconnected! " + UtilTime.MakeStr(_rejoinTime) + " to rejoin.", false); } @EventHandler(priority = EventPriority.LOWEST) @@ -124,13 +125,20 @@ public class RejoinModule extends Module Player player = event.getPlayer(); RejoinPlayerData data = getRejoinPlayerData(player.getName()); - GameTeam team = data.getTeam(); - - if (data.getTeam() == null) + + if (data == null) { return; } + GameTeam team = data.getTeam(); + + // Assume they have been revived + if (data.getTeam() == null) + { + team = UtilAlg.Random(getGame().GetTeamList()); + } + team.AddPlayer(player, true); getGame().Announce(team.GetColor() + C.Bold + event.getPlayer().getName() + " has reconnected!", false); @@ -138,6 +146,8 @@ public class RejoinModule extends Module { getGame().SetKit(player, data.getKit(), false); } + + _data.remove(data); } // Do this on Join, not Login, otherwise player no get heal. @@ -160,6 +170,14 @@ public class RejoinModule extends Module getGame().Manager.runSyncLater(() -> { player.setHealth(health); + + NautHashMap location = getGame().GetLocationStore(); + + if (location.containsKey(player.getName())) + { + player.teleport(location.get(player.getName())); + } + }, 1L); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/SafezoneModule.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/SafezoneModule.java index 40a5e8622..06259b756 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/SafezoneModule.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/modules/SafezoneModule.java @@ -146,7 +146,7 @@ public class SafezoneModule extends Module { if (isInSafeZone(event.getBlock().getLocation())) { - UtilPlayer.message(event.getPlayer(), F.main("Game", "You cannot build this high near center of map.")); + UtilPlayer.message(event.getPlayer(), F.main("Game", "You cannot build in this area!")); event.setCancelled(true); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/chat/GameChatManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/chat/GameChatManager.java index f4c6c1b64..f8e887c4e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/chat/GameChatManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/chat/GameChatManager.java @@ -1,15 +1,12 @@ package nautilus.game.arcade.managers.chat; -import mineplex.core.common.Rank; -import mineplex.core.common.jsonchat.JsonMessage; -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.party.Party; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.game.Game; -import nautilus.game.arcade.game.Game.GameState; -import nautilus.game.arcade.game.GameTeam; +import java.text.DecimalFormat; +import java.util.AbstractMap; +import java.util.Collection; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.Map; + import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.entity.Player; @@ -19,13 +16,17 @@ import org.bukkit.event.player.AsyncPlayerChatEvent; import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.jooq.tools.json.JSONObject; -import java.text.DecimalFormat; -import java.util.AbstractMap; -import java.util.Collection; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.Map; -import java.util.UUID; +import mineplex.core.common.Rank; +import mineplex.core.common.jsonchat.JsonMessage; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.party.Party; + +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.game.Game; +import nautilus.game.arcade.game.Game.GameState; +import nautilus.game.arcade.game.GameTeam; public class GameChatManager implements Listener { @@ -208,6 +209,29 @@ public class GameChatManager implements Listener if (globalMessage) { + if (!_manager.GetGame().ShowEveryoneSpecChat) + { + //Team Message Remove Recipient + Iterator recipientIterator = event.getRecipients().iterator(); + + while (recipientIterator.hasNext()) + { + Player receiver = recipientIterator.next(); + + if (_manager.IsAlive(sender) || _manager.GetClients().Get(sender).GetRank().has(Rank.HELPER)) + { + continue; + } + + if (!_manager.IsAlive(receiver) || _manager.GetClients().Get(receiver).GetRank().has(Rank.MODERATOR)) + { + continue; + } + + recipientIterator.remove(); + } + } + if(safeSend(sender, format, rankStr, rank, name, message, event.getRecipients())) { event.setCancelled(true);