Added ability to copy in schematics from build server.
Added in gametype checking on parse.
This commit is contained in:
parent
210264f25b
commit
681dfc5f7c
@ -0,0 +1,73 @@
|
|||||||
|
package mineplex.mapparser;
|
||||||
|
|
||||||
|
public enum GameType
|
||||||
|
{
|
||||||
|
//Mini
|
||||||
|
BaconBrawl("Bacon Brawl"),
|
||||||
|
Barbarians("A Barbarians Life"),
|
||||||
|
Bridge("The Bridges"),
|
||||||
|
CastleSiege("Castle Siege"),
|
||||||
|
ChampionsTDM("Champions TDM", "Champions"),
|
||||||
|
ChampionsDominate("Champions Domination", "Champions"),
|
||||||
|
ChampionsMOBA("Champions MOBA", "Champions"),
|
||||||
|
Christmas("Christmas Chaos"),
|
||||||
|
DeathTag("Death Tag"),
|
||||||
|
DragonEscape("Dragon Escape"),
|
||||||
|
DragonEscapeTeams("Dragon Escape Teams"),
|
||||||
|
DragonRiders("Dragon Riders"),
|
||||||
|
Dragons("Dragons"),
|
||||||
|
DragonsTeams("Dragons Teams"),
|
||||||
|
Draw("Draw My Thing"),
|
||||||
|
Evolution("Evolution"),
|
||||||
|
FlappyBird("Flappy Bird"),
|
||||||
|
Gravity("Gravity"),
|
||||||
|
Halloween("Halloween Horror"),
|
||||||
|
HideSeek("Block Hunt"),
|
||||||
|
Horse("Horseback"),
|
||||||
|
SurvivalGames("Survival Games"),
|
||||||
|
SurvivalGamesTeams("Survival Games Teams"),
|
||||||
|
MineWare("MineWare"),
|
||||||
|
MilkCow("Milk the Cow"),
|
||||||
|
Paintball("Super Paintball"),
|
||||||
|
Quiver("One in the Quiver"),
|
||||||
|
QuiverTeams("One in the Quiver Teams"),
|
||||||
|
Runner("Runner"),
|
||||||
|
Sheep("Sheep Quest"),
|
||||||
|
Smash("Super Smash Mobs"),
|
||||||
|
SmashTeams("Super Smash Mobs Teams", "Super Smash Mobs"),
|
||||||
|
SmashDomination("Super Smash Mobs Domination", "Super Smash Mobs"),
|
||||||
|
Snake("Snake"),
|
||||||
|
SnowFight("Snow Fight"),
|
||||||
|
Spleef("Super Spleef"),
|
||||||
|
SpleefTeams("Super Spleef Teams"),
|
||||||
|
Stacker("Super Stacker"),
|
||||||
|
SquidShooter("Squid Shooter"),
|
||||||
|
TurfWars("Turf Wars"),
|
||||||
|
UHC("Ultra Hardcore"),
|
||||||
|
ZombieSurvival("Zombie Survival");
|
||||||
|
|
||||||
|
String _name;
|
||||||
|
String _lobbyName;
|
||||||
|
|
||||||
|
GameType(String name)
|
||||||
|
{
|
||||||
|
_name = name;
|
||||||
|
_lobbyName = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
GameType(String name, String lobbyName)
|
||||||
|
{
|
||||||
|
_name = name;
|
||||||
|
_lobbyName = lobbyName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String GetName()
|
||||||
|
{
|
||||||
|
return _name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String GetLobbyName()
|
||||||
|
{
|
||||||
|
return _lobbyName;
|
||||||
|
}
|
||||||
|
}
|
@ -3,13 +3,16 @@ package mineplex.mapparser;
|
|||||||
import java.io.BufferedWriter;
|
import java.io.BufferedWriter;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileWriter;
|
import java.io.FileWriter;
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
|
||||||
import mineplex.core.common.util.UtilWorld;
|
import mineplex.core.common.util.UtilWorld;
|
||||||
|
import net.minecraft.util.org.apache.commons.io.FileUtils;
|
||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
@ -25,6 +28,7 @@ import org.bukkit.event.Listener;
|
|||||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||||
import org.bukkit.material.Wool;
|
import org.bukkit.material.Wool;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
import org.fusesource.jansi.Ansi.Color;
|
||||||
|
|
||||||
public class MapParser extends JavaPlugin implements Listener
|
public class MapParser extends JavaPlugin implements Listener
|
||||||
{
|
{
|
||||||
@ -47,7 +51,25 @@ public class MapParser extends JavaPlugin implements Listener
|
|||||||
@EventHandler
|
@EventHandler
|
||||||
public void Command(PlayerCommandPreprocessEvent event)
|
public void Command(PlayerCommandPreprocessEvent event)
|
||||||
{
|
{
|
||||||
if (event.getMessage().startsWith("/createMap"))
|
if (event.getMessage().startsWith("/copyschematics"))
|
||||||
|
{
|
||||||
|
event.setCancelled(true);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
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.");
|
||||||
|
}
|
||||||
|
catch (IOException e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
|
||||||
|
event.getPlayer().sendMessage("Schematics copy failed!");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (event.getMessage().startsWith("/createMap"))
|
||||||
{
|
{
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
|
|
||||||
@ -85,6 +107,24 @@ public class MapParser extends JavaPlugin implements Listener
|
|||||||
String[] args = event.getMessage().substring(event.getMessage().indexOf(' ') + 1).split(" ");
|
String[] args = event.getMessage().substring(event.getMessage().indexOf(' ') + 1).split(" ");
|
||||||
|
|
||||||
String gameType = args[0];
|
String gameType = args[0];
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
GameType type = GameType.valueOf(gameType);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
event.getPlayer().sendMessage(ChatColor.RED + "" + ChatColor.BOLD + "Invalid gametype!");
|
||||||
|
event.getPlayer().sendMessage(ChatColor.YELLOW + "" + ChatColor.BOLD + "Available games:");
|
||||||
|
|
||||||
|
for (GameType game : GameType.values())
|
||||||
|
{
|
||||||
|
event.getPlayer().sendMessage(game.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
String msg = event.getMessage().replace(gameType, "").toLowerCase();
|
String msg = event.getMessage().replace(gameType, "").toLowerCase();
|
||||||
|
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
Loading…
Reference in New Issue
Block a user