diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/Rank.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/Rank.java index 339738f83..64a020bdd 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/Rank.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/Rank.java @@ -11,6 +11,7 @@ public enum Rank OWNER("Owner", ChatColor.DARK_RED), DEVELOPER("Dev", ChatColor.RED), ADMIN("Admin", ChatColor.RED), + SNR_MODERATOR("SnrMod", ChatColor.GOLD), MODERATOR("Mod", ChatColor.GOLD), HELPER("Helper", ChatColor.GREEN), MAPDEV("Mapper", ChatColor.BLUE), diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilPlayer.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilPlayer.java index bb62028b4..3a3f1947f 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilPlayer.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilPlayer.java @@ -172,7 +172,7 @@ public class UtilPlayer for (String cur : matches) matchString += cur + " "; if (matchString.length() > 1) - matchString = matchString.substring(0 , matchString.length() - 2); + matchString = matchString.substring(0 , matchString.length() - 1); message(caller, F.main("Offline Player Search", "" + C.mBody + "Matches [" + diff --git a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/MapParser.java b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/MapParser.java index d5878e82a..29a6b1855 100644 --- a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/MapParser.java +++ b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/MapParser.java @@ -8,11 +8,14 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilWorld; import net.minecraft.util.org.apache.commons.io.FileUtils; import org.bukkit.Bukkit; import org.bukkit.ChatColor; +import org.bukkit.GameMode; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.World; @@ -22,10 +25,15 @@ import org.bukkit.WorldType; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; import org.bukkit.block.Sign; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.Listener; +import org.bukkit.event.entity.CreatureSpawnEvent; +import org.bukkit.event.entity.EntitySpawnEvent; import org.bukkit.event.player.PlayerCommandPreprocessEvent; +import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.material.Wool; import org.bukkit.plugin.java.JavaPlugin; import org.fusesource.jansi.Ansi.Color; @@ -51,7 +59,9 @@ public class MapParser extends JavaPlugin implements Listener @EventHandler public void Command(PlayerCommandPreprocessEvent event) { - if (event.getMessage().startsWith("/copyschematics")) + Player player = event.getPlayer(); + + if (event.getMessage().toLowerCase().startsWith("/copyschematics")) { event.setCancelled(true); @@ -60,47 +70,57 @@ public class MapParser extends JavaPlugin implements Listener FileUtils.copyDirectory(new File(".." + File.separator + "Build-1" + File.separator + "plugins" + File.separator + "WorldEdit" + File.separator + "schematics"), new File("plugins" + File.separator + "WorldEdit" + File.separator + "schematics")); - event.getPlayer().sendMessage("Schematics copied."); + UtilPlayer.message(player, F.main("Parser", "Schematics Copied.")); } catch (IOException e) { e.printStackTrace(); - event.getPlayer().sendMessage("Schematics copy failed!"); + UtilPlayer.message(player, F.main("Parser", "Schematics Copy Failed! Contact Jonalon.")); } } - else if (event.getMessage().startsWith("/createMap")) + else if (event.getMessage().toLowerCase().startsWith("/createmap")) { event.setCancelled(true); String[] args = event.getMessage().substring(event.getMessage().indexOf(' ') + 1).split(" "); + UtilPlayer.message(player, F.main("Parser", "Creating World: " + F.elem(args[0]))); + WorldCreator worldCreator = new WorldCreator(args[0]); worldCreator.environment(Environment.NORMAL); worldCreator.type(WorldType.FLAT); worldCreator.generateStructures(false); World world = Bukkit.getServer().createWorld(worldCreator); + + UtilPlayer.message(player, F.main("Parser", "Teleporting to World: " + F.elem(args[0]))); - event.getPlayer().teleport(world.getSpawnLocation()); + event.getPlayer().teleport(new Location(world, 0, 100, 0)); } - else if (event.getMessage().startsWith("/loadMap")) + else if (event.getMessage().toLowerCase().startsWith("/loadmap")) { event.setCancelled(true); String[] args = event.getMessage().substring(event.getMessage().indexOf(' ') + 1).split(" "); + UtilPlayer.message(player, F.main("Parser", "Loading World: " + F.elem(args[0]))); + World world = _worldManager.loadPendingParse(event.getPlayer(), args[0]); - event.getPlayer().teleport(world.getSpawnLocation()); + UtilPlayer.message(player, F.main("Parser", "Teleporting to World: " + F.elem(args[0]))); + + event.getPlayer().teleport(new Location(world, 0, 100, 0)); } - else if (event.getMessage().startsWith("/listMaps")) + else if (event.getMessage().toLowerCase().startsWith("/listmaps")) { event.setCancelled(true); + UtilPlayer.message(player, F.main("Parser", "Listing Worlds;")); + _worldManager.listPendingParses(event.getPlayer()); } - else if (event.getMessage().startsWith("/parse")) + else if (event.getMessage().toLowerCase().startsWith("/parse")) { event.setCancelled(true); @@ -127,7 +147,6 @@ public class MapParser extends JavaPlugin implements Listener String msg = event.getMessage().replace(gameType, "").toLowerCase(); - Player player = event.getPlayer(); World world = player.getWorld(); // TODO teleport player to main world @@ -556,4 +575,24 @@ public class MapParser extends JavaPlugin implements Listener return out; } + + @EventHandler + public void DisableCreatures(EntitySpawnEvent event) + { + if (event.getEntityType() == EntityType.DROPPED_ITEM || event.getEntity() instanceof LivingEntity) + event.setCancelled(true); + } + + @EventHandler + public void Updates(PlayerMoveEvent event) + { + for (World world : this.getServer().getWorlds()) + world.setTime(8000); + + if (event.getPlayer().getGameMode() != GameMode.CREATIVE) + event.getPlayer().setGameMode(GameMode.CREATIVE); + + if (!event.getPlayer().isOp()) + event.getPlayer().setOp(true); + } } diff --git a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/WorldManager.java b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/WorldManager.java index 267f79cbe..778738d44 100644 --- a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/WorldManager.java +++ b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/WorldManager.java @@ -14,6 +14,7 @@ import net.minecraft.util.org.apache.commons.io.FileUtils; import org.bukkit.World; import org.bukkit.WorldCreator; import org.bukkit.entity.Player; +import org.bukkit.event.entity.CreatureSpawnEvent; import org.bukkit.plugin.java.JavaPlugin; public class WorldManager 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 c67ab2c82..8ea193e3b 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 @@ -946,12 +946,20 @@ public abstract class Game implements Listener if (AnnounceSilence) Manager.GetChat().Silence(5000, false); } + + public void Announce(String message) + { + Announce(message, true); + } + + public void Announce(String message, boolean playSound) { for (Player player : UtilServer.getPlayers()) { - player.playSound(player.getLocation(), Sound.NOTE_PLING, 1f, 1f); + if (playSound) + player.playSound(player.getLocation(), Sound.NOTE_PLING, 1f, 1f); UtilPlayer.message(player, message); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameTeam.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameTeam.java index d91903dce..65a7ce4b6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameTeam.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/GameTeam.java @@ -206,7 +206,7 @@ public class GameTeam ArrayList alive = new ArrayList(); for (Player player : _players.keySet()) - if (!playerIn || _players.get(player) == PlayerState.IN ) + if (!playerIn || (_players.get(player) == PlayerState.IN && player.isOnline())) alive.add(player); return alive; @@ -250,7 +250,7 @@ public class GameTeam if (!_players.containsKey(player)) return false; - return _players.get(player) == PlayerState.IN; + return player.isOnline() && _players.get(player) == PlayerState.IN; } public void SetColor(ChatColor color) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/TeamGame.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/TeamGame.java index 56ed359f0..1dc2f49b5 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/TeamGame.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/TeamGame.java @@ -3,6 +3,7 @@ package nautilus.game.arcade.game; import java.util.ArrayList; import java.util.Iterator; +import org.bukkit.Sound; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; @@ -12,6 +13,8 @@ import org.bukkit.event.player.PlayerQuitEvent; import mineplex.core.common.util.C; import mineplex.core.common.util.NautHashMap; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilTime.TimeUnit; import mineplex.core.updater.UpdateType; @@ -88,7 +91,7 @@ public abstract class TeamGame extends Game GetLocationStore().put(player.getName(), player.getLocation()); //Announcement - Announce(team.GetColor() + C.Bold + player.getName() + " has disconnected! " + UtilTime.convert(RejoinTime, 0, TimeUnit.MINUTES) + " minutes to rejoin."); + Announce(team.GetColor() + C.Bold + player.getName() + " has disconnected! " + UtilTime.convert(RejoinTime, 0, TimeUnit.MINUTES) + " minutes to rejoin.", false); } } @@ -103,7 +106,7 @@ public abstract class TeamGame extends Game if (team != null && _rejoinTime.remove(event.getPlayer().getName()) != null) { team.AddPlayer(event.getPlayer()); - Announce(team.GetColor() + C.Bold + event.getPlayer().getName() + " has reconnected!"); + Announce(team.GetColor() + C.Bold + event.getPlayer().getName() + " has reconnected!", false); Kit kit = RejoinKit.remove(event.getPlayer().getName()); @@ -144,7 +147,7 @@ public abstract class TeamGame extends Game //Get Team (By Name) GameTeam team = RejoinTeam.remove(name); if (team != null) - Announce(team.GetColor() + C.Bold + name + " did not reconnect in time!"); + Announce(team.GetColor() + C.Bold + name + " did not reconnect in time!", false); RejoinKit.remove(name); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/Domination.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/Domination.java index 827b3c557..394278c61 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/Domination.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/Domination.java @@ -216,7 +216,7 @@ public class Domination extends TeamGame return; //Wipe Last - Scoreboard.Reset(); + Scoreboard.Reset(); //Scores Scoreboard.WriteBlank(); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/TeamDeathmatch.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/TeamDeathmatch.java index b823b9e63..7a1dc54c7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/TeamDeathmatch.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/common/TeamDeathmatch.java @@ -251,7 +251,7 @@ public class TeamDeathmatch extends TeamGame { Scoreboard.WriteBlank(); - for (Player player : team.GetPlayers(true)) + for (Player player : team.GetPlayers(false)) { int kills = 0; if (_kills.containsKey(player)) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/PowerUpManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/PowerUpManager.java index b379d3b8a..aac0fc3bb 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/PowerUpManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/PowerUpManager.java @@ -4,6 +4,8 @@ import mineplex.core.updater.*; import mineplex.core.updater.event.*; import nautilus.game.arcade.events.*; import nautilus.game.arcade.game.*; +import nautilus.game.arcade.game.Game.GameState; + import org.bukkit.*; import org.bukkit.event.*; import org.bukkit.plugin.*; @@ -107,4 +109,14 @@ public class PowerUpManager implements Listener for(PowerUp powerUp : getPowerUps()) powerUp.onUpdate(event); } + + @EventHandler + public void deregisterSelf(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + if (game.GetState() == GameState.Dead) + HandlerList.unregisterAll(this); + } } 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 4f47b52b5..beceda454 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 @@ -143,6 +143,10 @@ public class UHC extends TeamGame _scoreObj = Scoreboard.GetScoreboard().registerNewObjective("Health", "health"); _scoreObj.setDisplaySlot(DisplaySlot.PLAYER_LIST); + + //Tournament + //this.AutoBalance = false; + //this.AutoStart = false; } @Override @@ -186,10 +190,6 @@ public class UHC extends TeamGame this.DamagePvP = true; } - else if (_gameMinutes % 15 == 0) - { - Announce(ChatColor.WHITE + C.Bold + _gameMinutes + " minutes have passed."); - } } @@ -572,6 +572,7 @@ public class UHC extends TeamGame event.setLeaveMessage(null); } + /* @EventHandler(priority = EventPriority.LOWEST) public void PlayerQuit(PlayerQuitEvent event) { @@ -588,7 +589,7 @@ public class UHC extends TeamGame if (player.isDead()) return; - /* + if (true) { //Announcement @@ -597,7 +598,7 @@ public class UHC extends TeamGame player.damage(5000); return; } - */ + if (_combatTime.containsKey(player.getName()) && !UtilTime.elapsed(_combatTime.get(player.getName()), 15000)) { @@ -608,6 +609,7 @@ public class UHC extends TeamGame return; } } + */ @EventHandler(priority=EventPriority.MONITOR) public void DamageRecord(CustomDamageEvent event) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GamePlayerManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GamePlayerManager.java index dd8b7d1d2..4d5485a4d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GamePlayerManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GamePlayerManager.java @@ -352,6 +352,9 @@ public class GamePlayerManager implements Listener Player player = event.getPlayer(); + if (Manager.GetClients().Get(player).GetRank().Has(Rank.MODERATOR)) + return; + if (game.IsAlive(player) || player.getGameMode() != GameMode.CREATIVE) { UtilPlayer.message(player, F.main("Game", "Only Spectators can use teleport."));