diff --git a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/MapData.java b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/MapData.java index a87e4e8b9..978d282e6 100644 --- a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/MapData.java +++ b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/MapData.java @@ -72,7 +72,7 @@ public class MapData continue; } - if(tokens[0].equalsIgnoreCase("locked")) + if(tokens[0].equalsIgnoreCase("LOCKED")) { _locked = tokens[1].equalsIgnoreCase("true"); continue; @@ -159,6 +159,8 @@ public class MapData out.write("currentlyLive:" + _currentlyLive); out.write("\n"); out.write("warps:" + warpsToString()); + out.write("\n"); + out.write("LOCKED:" + _locked); out.close(); } catch (Exception e) diff --git a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/MapParser.java b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/MapParser.java index 9105e8ea6..6fa838da5 100644 --- a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/MapParser.java +++ b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/MapParser.java @@ -1,8 +1,26 @@ package mineplex.mapparser; +import java.io.File; +import java.io.IOException; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.World; +import org.bukkit.block.Block; +import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.configuration.file.YamlConfiguration; +import org.bukkit.entity.Player; +import org.bukkit.plugin.java.JavaPlugin; + import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.common.collect.Sets; + import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilBlock; @@ -30,6 +48,7 @@ import mineplex.mapparser.command.PMCommand; import mineplex.mapparser.command.ParseCommand200; import mineplex.mapparser.command.ParseCommand400; import mineplex.mapparser.command.ParseCommand600; +import mineplex.mapparser.command.ParseCommand1000; import mineplex.mapparser.command.PlayerHeadCommand; import mineplex.mapparser.command.RefreshWorldEditCommand; import mineplex.mapparser.command.RenameCommand; @@ -44,22 +63,6 @@ import mineplex.mapparser.module.modules.EventModule; import mineplex.mapparser.module.modules.MMMazeModule; import mineplex.mapparser.module.modules.SignModule; import mineplex.mapparser.module.modules.TreeToolModule; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.World; -import org.bukkit.block.Block; -import org.bukkit.configuration.file.FileConfiguration; -import org.bukkit.configuration.file.YamlConfiguration; -import org.bukkit.entity.Player; -import org.bukkit.plugin.java.JavaPlugin; - -import java.io.File; -import java.io.IOException; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Set; public class MapParser extends JavaPlugin { @@ -104,6 +107,7 @@ public class MapParser extends JavaPlugin commandModule.add(new ParseCommand200(this)); commandModule.add(new ParseCommand400(this)); commandModule.add(new ParseCommand600(this)); + commandModule.add(new ParseCommand1000(this)); commandModule.add(new RenameCommand(this)); commandModule.add(new SaveCommand(this)); commandModule.add(new WorldsCommand(this)); diff --git a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/AdminCommand.java b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/AdminCommand.java index ad52b7f98..962a5813a 100644 --- a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/AdminCommand.java +++ b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/AdminCommand.java @@ -29,7 +29,7 @@ public class AdminCommand extends BaseCommand World world = player.getWorld(); - if (world.getName().equals("world")) + if (world.getName().equals("world_lobby")) { message(player, "Cannot change Admin-List for Lobby."); return true; diff --git a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/AuthorCommand.java b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/AuthorCommand.java index c267e7d4d..48a23c693 100644 --- a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/AuthorCommand.java +++ b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/AuthorCommand.java @@ -33,7 +33,7 @@ public class AuthorCommand extends BaseCommand authorName += arg + " "; authorName = authorName.trim(); - if (world.getName().equals("world")) + if (world.getName().equals("world_lobby")) { message(player, "Cannot set author for Lobby."); return true; diff --git a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/CurrentlyLiveCommand.java b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/CurrentlyLiveCommand.java index 7244346b9..746945b23 100644 --- a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/CurrentlyLiveCommand.java +++ b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/CurrentlyLiveCommand.java @@ -19,6 +19,11 @@ public class CurrentlyLiveCommand extends BaseCommand @Override public boolean execute(Player player, String alias, String[] args) { + if (player.getWorld().getName().equals("world_lobby")) + { + message(player, "Cannot set live status for Lobby."); + return true; + } MapData data = getPlugin().getData(player.getWorld().getName()); if(data == null) diff --git a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/GameTypeCommand.java b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/GameTypeCommand.java index edf2482a9..4b01a03c9 100644 --- a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/GameTypeCommand.java +++ b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/GameTypeCommand.java @@ -32,7 +32,7 @@ public class GameTypeCommand extends BaseCommand return true; } - if (world.getName().equals("world")) + if (world.getName().equals("world_lobby")) { message(player, "Cannot set GameType for Lobby."); return true; diff --git a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/LockCommand.java b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/LockCommand.java index a8dd0082d..9af13bbea 100644 --- a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/LockCommand.java +++ b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/LockCommand.java @@ -20,16 +20,27 @@ public class LockCommand extends BaseCommand @Override public boolean execute(Player player, String alias, String[] args) { + if (!player.isOp()) + { + message(player, "Only OPs can toggle map locks!"); + return true; + } + if (player.getWorld().getName().equals("world_lobby")) + { + message(player, "Cannot toggle lock for Lobby."); + return true; + } MapData data = getPlugin().getData(player.getWorld().getName()); - if(data == null) + if (data == null) { player.sendMessage(C.cRed + "There was an error with your map."); return true; } data._locked = !data._locked; - player.sendMessage(F.tf(data._locked) + " lock for world " + player.getWorld().getName()); + data.Write(); + message(player, "Lock for world " + F.elem(player.getWorld().getName()) + ": " + F.tf(data._locked)); return true; } } diff --git a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/NameCommand.java b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/NameCommand.java index a7988c3ff..5e63f92a5 100644 --- a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/NameCommand.java +++ b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/NameCommand.java @@ -29,7 +29,7 @@ public class NameCommand extends BaseCommand return true; } - if (world.equals("world")) + if (world.getName().equals("world_lobby")) { message(player, "Cannot set name for Lobby."); return true; diff --git a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/PMCommand.java b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/PMCommand.java index 82a72b071..86c4db4f2 100644 --- a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/PMCommand.java +++ b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/PMCommand.java @@ -20,26 +20,27 @@ public class PMCommand extends BaseCommand @Override public boolean execute(Player player, String alias, String[] args) { - if(!player.isOp()) + if (!player.isOp()) { player.sendMessage(C.cRed + "You are not allowed to do that!"); return true; } - if(args.length == 0) + if (args.length == 0) { player.sendMessage(C.cRed + "Please put a message in!"); return true; } StringBuilder builder = new StringBuilder(); - for(String s : args) + builder.append(player.getName() + ": "); + for (String s : args) { builder.append(s).append(" "); } - for(Player ops : UtilServer.getPlayers()) + for (Player ops : UtilServer.getPlayers()) { - if(!ops.isOp()) + if (!ops.isOp()) { continue; } @@ -49,4 +50,4 @@ public class PMCommand extends BaseCommand return true; } -} +} \ No newline at end of file diff --git a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/ParseCommand1000.java b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/ParseCommand1000.java new file mode 100644 index 000000000..8cfb3d5f3 --- /dev/null +++ b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/ParseCommand1000.java @@ -0,0 +1,70 @@ +package mineplex.mapparser.command; + +import org.bukkit.Location; +import org.bukkit.World; +import org.bukkit.entity.Player; + +import mineplex.core.common.util.F; +import mineplex.mapparser.MapData; +import mineplex.mapparser.MapParser; +import mineplex.mapparser.Parse; + +/** + * Larger parse command + */ +public class ParseCommand1000 extends BaseCommand +{ + public ParseCommand1000(MapParser plugin) + { + super(plugin, "parse1000"); + } + + @Override + public boolean execute(Player player, String alias, String[] args) + { + if (!player.isOp()) + { + message(player, "Only OPs can parse maps!"); + return true; + } + + Location parseLoc = player.getLocation(); + + World world = parseLoc.getWorld(); + + if (world.getName().equals("world_lobby")) + { + message(player, "Cannot parse Lobby."); + return true; + } + + MapData data = getPlugin().getData(world.getName()); + + if (data.MapName.equals("null") || data.MapCreator.equals("null") || data.MapGameType.equals("null")) + { + message(player, "Map Name/Author/GameType are not set!"); + return true; + } + + //Teleport Players Out + for (Player worldPlayer : world.getPlayers()) + { + worldPlayer.teleport(getPlugin().getSpawnLocation()); + message(player, "World " + F.elem(world.getName()) + " is preparing to be parsed."); + } + + //Unload World > Copy + World parseableWorld = getPlugin().getWorldManager().prepMapParse(world); + + if (parseableWorld == null) + { + message(player, "Could not prepare world for parsing!"); + return true; + } + + //Parse the World + getPlugin().setCurrentParse(new Parse(getPlugin(), parseableWorld, args, parseLoc, getPlugin().getData(parseLoc.getWorld().getName()), 1000)); + + return true; + } +} \ No newline at end of file diff --git a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/ParseCommand200.java b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/ParseCommand200.java index 9cd58144b..7ac10132c 100644 --- a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/ParseCommand200.java +++ b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/ParseCommand200.java @@ -31,6 +31,12 @@ public class ParseCommand200 extends BaseCommand Location parseLoc = player.getLocation(); World world = parseLoc.getWorld(); + + if (world.getName().equals("world_lobby")) + { + message(player, "Cannot parse Lobby."); + return true; + } MapData data = getPlugin().getData(world.getName()); diff --git a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/ParseCommand400.java b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/ParseCommand400.java index d08d60103..efb416dc5 100644 --- a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/ParseCommand400.java +++ b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/ParseCommand400.java @@ -31,6 +31,12 @@ public class ParseCommand400 extends BaseCommand Location parseLoc = player.getLocation(); World world = parseLoc.getWorld(); + + if (world.getName().equals("world_lobby")) + { + message(player, "Cannot parse Lobby."); + return true; + } MapData data = getPlugin().getData(world.getName()); diff --git a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/ParseCommand600.java b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/ParseCommand600.java index daa28b4fa..07dd1deb2 100644 --- a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/ParseCommand600.java +++ b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/ParseCommand600.java @@ -31,6 +31,12 @@ public class ParseCommand600 extends BaseCommand Location parseLoc = player.getLocation(); World world = parseLoc.getWorld(); + + if (world.getName().equals("world_lobby")) + { + message(player, "Cannot parse Lobby."); + return true; + } MapData data = getPlugin().getData(world.getName()); diff --git a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/RenameCommand.java b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/RenameCommand.java index b2e539bb4..2f66500c2 100644 --- a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/RenameCommand.java +++ b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/RenameCommand.java @@ -24,6 +24,13 @@ public class RenameCommand extends BaseCommand public boolean execute(Player player, String alias, String[] args) { World world = player.getWorld(); + + if (world.getName().equals("world_lobby")) + { + message(player, "Cannot rename Lobby."); + return true; + } + MapData data = getPlugin().getData(world.getName()); if (data == null) diff --git a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/WarpCommand.java b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/WarpCommand.java index dd533e4d8..ca99aa881 100644 --- a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/WarpCommand.java +++ b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/command/WarpCommand.java @@ -25,6 +25,11 @@ public class WarpCommand extends BaseCommand @Override public boolean execute(Player player, String alias, String[] args) { + if (player.getWorld().getName().equals("world_lobby")) + { + message(player, "Cannot use warps in Lobby."); + return true; + } MapData data = getPlugin().getData(player.getWorld().getName()); if(data == null) diff --git a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/module/modules/EventModule.java b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/module/modules/EventModule.java index 3f62f9337..1595b9886 100644 --- a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/module/modules/EventModule.java +++ b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/module/modules/EventModule.java @@ -1,19 +1,8 @@ package mineplex.mapparser.module.modules; -import com.google.common.collect.Lists; -import mineplex.core.common.util.C; -import mineplex.core.common.util.F; -import mineplex.core.common.util.MapUtil; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; -import mineplex.mapparser.BackupTask; -import mineplex.mapparser.MapData; -import mineplex.mapparser.MapParser; -import mineplex.mapparser.Parse; -import mineplex.mapparser.TickEvent; -import mineplex.mapparser.module.Module; +import java.util.List; + import org.bukkit.ChatColor; -import org.bukkit.Sound; import org.bukkit.World; import org.bukkit.entity.EntityType; import org.bukkit.entity.Player; @@ -32,8 +21,21 @@ import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.event.weather.WeatherChangeEvent; -import java.util.List; +import com.google.common.collect.Lists; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.MapUtil; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import mineplex.mapparser.BackupTask; +import mineplex.mapparser.MapData; +import mineplex.mapparser.MapParser; +import mineplex.mapparser.Parse; +import mineplex.mapparser.TickEvent; +import mineplex.mapparser.module.Module; /** * @@ -70,13 +72,14 @@ public class EventModule extends Module if (world.getName().toLowerCase().contains("halloween")) { world.setTime(16000); - } else + } + else { world.setTime(8000); } - _updated.add(world); world.setStorm(false); world.setGameRuleValue("doDaylightCycle", "false"); + _updated.add(world); } } @@ -114,7 +117,7 @@ public class EventModule extends Module { for (World world : getPlugin().getServer().getWorlds()) { - if (world.getName().equalsIgnoreCase("world")) + if (world.getName().equalsIgnoreCase("world_lobby")) { continue; } @@ -212,11 +215,14 @@ public class EventModule extends Module Player target = UtilPlayer.searchOnline(player, tokens[1], true); if (target != null) { - MapData data = getPlugin().getData(target.getWorld().getName()); - if(!data.CanJoin(player)) + if (!target.getWorld().getName().equals("world")) { - player.sendMessage(C.cRed + "That server is currently locked, and you don't have access to it."); - return; + MapData data = getPlugin().getData(target.getWorld().getName()); + if(!data.CanJoin(player)) + { + player.sendMessage(C.cRed + "That world is currently locked, and you don't have access to it."); + return; + } } UtilPlayer.message(player, F.main("Game", "You teleported to " + F.name(target.getName()) + ".")); player.teleport(target); @@ -287,13 +293,6 @@ public class EventModule extends Module @EventHandler public void Join(PlayerJoinEvent event) { - Player player = event.getPlayer(); - if (player.getName().equalsIgnoreCase("TadahTech")) - { - event.setJoinMessage(C.cGreenB + "Your build server Saviour, TIMOTHY! has arrived, please take a moment to thank him."); - getPlugin().getServer().getOnlinePlayers().forEach(o -> o.playSound(o.getLocation(), Sound.AMBIENCE_THUNDER, 1.0F, 1.0F)); - return; - } event.setJoinMessage(F.sys("Player Join", event.getPlayer().getName())); } @@ -351,4 +350,15 @@ public class EventModule extends Module { event.setCancelled(true); } + + @EventHandler + public void DisableWeather(WeatherChangeEvent event) + { + if (!_updated.contains(event.getWorld())) + { + return; + } + + event.setCancelled(true); + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/HideSeek.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/HideSeek.java index ec646d75c..df9de39bb 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/HideSeek.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/HideSeek.java @@ -413,11 +413,11 @@ public class HideSeek extends TeamGame if (event.GetState() != GameState.Recruit) return; - _hiders = GetTeamList().get(0); + _hiders = GetTeamList().stream().filter(team -> team.GetName().toUpperCase().contains("BLUE")).toArray(size -> new GameTeam[size])[0]; _hiders.SetColor(ChatColor.AQUA); _hiders.SetName("Hiders"); - _seekers = GetTeamList().get(1); + _seekers = GetTeamList().stream().filter(team -> team.GetName().toUpperCase().contains("RED")).toArray(size -> new GameTeam[size])[0]; _seekers.SetColor(ChatColor.RED); _seekers.SetName("Hunters");