Fix lobby protection on build server, make map locks persistent, implement larger parsing size, make map lock command require op, prevent raining on build server, and make block hunt actually work with any map with required information regardless of order
This commit is contained in:
parent
62d08e74e3
commit
7ec530a8c7
@ -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)
|
||||
|
@ -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));
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
@ -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;
|
||||
}
|
||||
}
|
@ -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());
|
||||
|
||||
|
@ -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());
|
||||
|
||||
|
@ -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());
|
||||
|
||||
|
@ -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)
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user