Champs Balance Update

Map Parser Update
This commit is contained in:
Mini-Chiss 2014-07-07 16:23:55 -07:00
parent ce8560bdbf
commit 62f6ea815d
20 changed files with 809 additions and 517 deletions

View File

@ -1,53 +1,50 @@
package mineplex.mapparser; package mineplex.mapparser;
import java.io.BufferedWriter;
import java.io.File; import java.io.File;
import java.io.FileWriter;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.MapUtil;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilWorld; import mineplex.core.common.util.UtilServer;
import net.minecraft.util.org.apache.commons.io.FileUtils; import net.minecraft.util.org.apache.commons.io.FileUtils;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.GameMode; import org.bukkit.GameMode;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.World.Environment; import org.bukkit.World.Environment;
import org.bukkit.WorldCreator; import org.bukkit.WorldCreator;
import org.bukkit.WorldType; 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.EntityType;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.entity.CreatureSpawnEvent;
import org.bukkit.event.entity.EntitySpawnEvent; import org.bukkit.event.entity.EntitySpawnEvent;
import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerMoveEvent; import org.bukkit.event.player.PlayerMoveEvent;
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
{ {
private WorldManager _worldManager; private WorldManager _worldManager;
private Parse _curParse = null;
@Override @Override
public void onEnable() public void onEnable()
{ {
_worldManager = new WorldManager(this); _worldManager = new WorldManager(this);
getServer().getPluginManager().registerEvents(this, this); getServer().getPluginManager().registerEvents(this, this);
getServer().getWorlds().get(0).setSpawnLocation(0, 106, 0);
//Updates
getServer().getScheduler().scheduleSyncRepeatingTask(this, new Ticker(this), 1, 1);
} }
@Override @Override
@ -57,11 +54,44 @@ public class MapParser extends JavaPlugin implements Listener
} }
@EventHandler @EventHandler
public void Command(PlayerCommandPreprocessEvent event) public void PlayerJoin(PlayerJoinEvent event)
{ {
Player player = event.getPlayer(); Player player = event.getPlayer();
if (event.getMessage().toLowerCase().startsWith("/copyschematics")) player.teleport(new Location(getServer().getWorlds().get(0), 0, 106, 0));
DisplayHelp(player);
}
public void DisplayHelp(Player player)
{
UtilPlayer.message(player, F.main("Parser", "Listing Commands;"));
UtilPlayer.message(player, F.value("/hub", "Return to hub world"));
UtilPlayer.message(player, F.value("/create <name>", "Creates a new map"));
UtilPlayer.message(player, F.value("/delete <name>", "Deletes an existing map"));
UtilPlayer.message(player, F.value("/map <name>", "Teleport to a map"));
UtilPlayer.message(player, F.value("/list", "List maps"));
UtilPlayer.message(player, F.value("/copyschematics", "Loads Schematics from Build-1"));
}
@EventHandler
public void Command(PlayerCommandPreprocessEvent event)
{
Player caller = event.getPlayer();
if (_curParse != null)
{
UtilPlayer.message(caller, F.main("Parse", "Cannot use commands during map parse!"));
return;
}
if (event.getMessage().toLowerCase().startsWith("/help"))
{
event.setCancelled(true);
DisplayHelp(caller);
}
else if (event.getMessage().toLowerCase().startsWith("/copyschematics"))
{ {
event.setCancelled(true); event.setCancelled(true);
@ -70,510 +100,219 @@ public class MapParser extends JavaPlugin implements Listener
FileUtils.copyDirectory(new File(".." + File.separator + "Build-1" + File.separator + "plugins" + File.separator + "WorldEdit" + File.separator + "schematics"), 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")); new File("plugins" + File.separator + "WorldEdit" + File.separator + "schematics"));
UtilPlayer.message(player, F.main("Parser", "Schematics Copied.")); UtilPlayer.message(caller, F.main("Parser", "Schematics Copied."));
} }
catch (IOException e) catch (IOException e)
{ {
e.printStackTrace(); e.printStackTrace();
UtilPlayer.message(player, F.main("Parser", "Schematics Copy Failed! Contact Jonalon.")); UtilPlayer.message(caller, F.main("Parser", "Schematics Copy Failed! Contact Jonalon."));
} }
} }
else if (event.getMessage().toLowerCase().startsWith("/createmap")) else if (event.getMessage().toLowerCase().startsWith("/create"))
{ {
event.setCancelled(true); event.setCancelled(true);
String[] args = event.getMessage().substring(event.getMessage().indexOf(' ') + 1).split(" "); String[] args = event.getMessage().substring(event.getMessage().indexOf(' ') + 1).split(" ");
UtilPlayer.message(player, F.main("Parser", "Creating World: " + F.elem(args[0]))); String worldName = "map_" + args[0];
WorldCreator worldCreator = new WorldCreator(args[0]); UtilPlayer.message(caller, F.main("Parser", "Creating World: " + F.elem(worldName)));
WorldCreator worldCreator = new WorldCreator(worldName);
worldCreator.environment(Environment.NORMAL); worldCreator.environment(Environment.NORMAL);
worldCreator.type(WorldType.FLAT); worldCreator.type(WorldType.FLAT);
worldCreator.generateStructures(false); worldCreator.generateStructures(false);
World world = Bukkit.getServer().createWorld(worldCreator); World world = Bukkit.getServer().createWorld(worldCreator);
UtilPlayer.message(player, F.main("Parser", "Teleporting to World: " + F.elem(args[0]))); UtilPlayer.message(caller, F.main("Parser", "Teleporting to World: " + F.elem(worldName)));
event.getPlayer().teleport(new Location(world, 0, 100, 0)); event.getPlayer().teleport(new Location(world, 0, 100, 0));
} }
else if (event.getMessage().toLowerCase().startsWith("/loadmap")) else if (event.getMessage().toLowerCase().startsWith("/delete"))
{ {
event.setCancelled(true); event.setCancelled(true);
String[] args = event.getMessage().substring(event.getMessage().indexOf(' ') + 1).split(" "); String[] args = event.getMessage().substring(event.getMessage().indexOf(' ') + 1).split(" ");
UtilPlayer.message(player, F.main("Parser", "Loading World: " + F.elem(args[0]))); String worldName = "map_" + args[0];
World world = _worldManager.loadPendingParse(event.getPlayer(), args[0]); if (!DoesMapExist(worldName))
{
UtilPlayer.message(player, F.main("Parser", "Teleporting to World: " + F.elem(args[0]))); UtilPlayer.message(caller, F.main("Parser", "World does not exist: " + F.elem(worldName)));
return;
event.getPlayer().teleport(new Location(world, 0, 100, 0));
} }
else if (event.getMessage().toLowerCase().startsWith("/listmaps"))
if (GetMapWorld(worldName) != null)
{
World world = GetMapWorld(worldName);
//Teleport Out
for (Player other : world.getPlayers())
other.teleport(new Location(getServer().getWorlds().get(0), 0, 106, 0));
//Unload World
MapUtil.UnloadWorld(this, world);
}
//Delete
FileUtils.deleteQuietly(new File(worldName));
Inform(caller, "Deleted World: " + F.elem(args[0]));
}
else if (event.getMessage().toLowerCase().startsWith("/hub"))
{ {
event.setCancelled(true); event.setCancelled(true);
UtilPlayer.message(player, F.main("Parser", "Listing Worlds;")); event.getPlayer().teleport(new Location(getServer().getWorlds().get(0), 0, 106, 0));
}
else if (event.getMessage().toLowerCase().startsWith("/map"))
{
event.setCancelled(true);
_worldManager.listPendingParses(event.getPlayer()); String[] args = event.getMessage().substring(event.getMessage().indexOf(' ') + 1).split(" ");
String worldName = "map_" + args[0];
UtilPlayer.message(caller, F.main("Parser", "Loading Map: " + F.elem(worldName)));
World world = GetMapWorld(worldName);
if (world == null)
{
if (DoesMapExist(worldName))
{
UtilPlayer.message(caller, F.main("Parser", "Map Exists!"));
world = Bukkit.getWorld(worldName);
}
else
{
UtilPlayer.message(caller, F.main("Parser", "Map Doesn't Exist!"));
return;
}
}
//Error (This should not occur!)
if (world == null)
{
UtilPlayer.message(caller, F.main("Parser", "Null World Error: " + F.elem(worldName)));
return;
}
//Teleport
UtilPlayer.message(caller, F.main("Parser", "Teleporting to World: " + F.elem(worldName)));
event.getPlayer().teleport(new Location(world, 0, 100, 0));
}
else if (event.getMessage().toLowerCase().startsWith("/list"))
{
event.setCancelled(true);
UtilPlayer.message(caller, F.main("Parser", "Listing Maps;"));
File mapsFolder = new File(".");
for (File file : mapsFolder.listFiles())
{
if (!file.isDirectory())
continue;
if (!file.getName().toLowerCase().startsWith("map_"))
continue;
caller.sendMessage(file.getName());
}
//_worldManager.listPendingParses(event.getPlayer());
} }
else if (event.getMessage().toLowerCase().startsWith("/parse")) else if (event.getMessage().toLowerCase().startsWith("/parse"))
{ {
event.setCancelled(true); event.setCancelled(true);
Location parseLoc = event.getPlayer().getLocation();
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 try
{ {
GameType type = GameType.valueOf(gameType); GameType.valueOf(gameType);
} }
catch (Exception ex) catch (Exception ex)
{ {
event.getPlayer().sendMessage(ChatColor.RED + "" + ChatColor.BOLD + "Invalid gametype!"); UtilPlayer.message(event.getPlayer(), F.main("Parser", "Valid Game Types;"));
event.getPlayer().sendMessage(ChatColor.YELLOW + "" + ChatColor.BOLD + "Available games:");
String gameTypes = "";
for (GameType game : GameType.values()) for (GameType game : GameType.values())
{ {
event.getPlayer().sendMessage(game.toString()); gameTypes += game.toString() + " ";
} }
event.getPlayer().sendMessage(gameTypes);
return; return;
} }
String msg = event.getMessage().replace(gameType, "").toLowerCase(); String msg = event.getMessage().replace(gameType, "").toLowerCase();
World world = player.getWorld(); World world = caller.getWorld();
// TODO teleport player to main world //Teleport Players Out
player.teleport(new Location(Bukkit.getWorlds().get(0), 0, 100, 0)); for (Player worldPlayer : world.getPlayers())
{
worldPlayer.teleport(new Location(Bukkit.getWorlds().get(0), 0, 100, 0));
UtilPlayer.message(event.getPlayer(), F.main("Parser", "World " + F.elem(world.getName()) + " is preparing to be parsed."));
}
//Unload World > Copy
String worldName = _worldManager.prepMapParse(world); String worldName = _worldManager.prepMapParse(world);
World parseableWorld = Bukkit.getWorld(worldName); if (worldName == null)
Parse(event.getPlayer(), parseableWorld, msg.split(" "));
_worldManager.finalizeParsedWorld(gameType, parseableWorld);
}
}
public void Parse(Player caller, World world, String[] args)
{ {
HashSet<Integer> dataId = new HashSet<Integer>(); UtilPlayer.message(event.getPlayer(), F.main("Parser", "Could not prepare world for parsing!"));
for (String arg : args)
{
if (arg.equals("/parse"))
continue;
try
{
dataId.add(Integer.parseInt(arg));
}
catch (Exception e)
{
caller.sendMessage("Invalid Data ID: " + arg);
}
}
HashMap<String, ArrayList<Location>> TeamLocs = new HashMap<String, ArrayList<Location>>();
HashMap<String, ArrayList<Location>> DataLocs = new HashMap<String, ArrayList<Location>>();
HashMap<String, ArrayList<Location>> CustomLocs = new HashMap<String, ArrayList<Location>>();
Location cornerA = null;
Location cornerB = null;
int processed = 0;
caller.sendMessage("Scanning for Blocks...");
for (int x=-600 ; x < 600 ; x++)
for (int z=-600 ; z < 600 ; z++)
for (int y=0 ; y < 256 ; y++)
{
processed++;
if (processed % 20000000 == 0)
caller.sendMessage("Processed: " + processed + " of " + (1200*1200*256));
Block block = world.getBlockAt(caller.getLocation().getBlockX()+x, caller.getLocation().getBlockY()+y, caller.getLocation().getBlockZ()+z);
//ID DATA
if (dataId.contains(block.getTypeId()))
{
String key = ""+block.getTypeId();
if (!CustomLocs.containsKey(key))
CustomLocs.put(key, new ArrayList<Location>());
CustomLocs.get(key).add(block.getLocation());
continue;
}
//Signs
if (block.getType() == Material.SIGN_POST || block.getType() == Material.WALL_SIGN)
{
if (block.getRelative(BlockFace.DOWN).getType() == Material.SPONGE)
{
Sign s = (Sign) block.getState();
String name = "";
try
{
name = s.getLine(0);
}
catch (Exception e)
{
caller.sendMessage("Invalid Sign Data: " + UtilWorld.locToStr(block.getLocation()));
}
//Add
if (!CustomLocs.containsKey(name))
CustomLocs.put(name, new ArrayList<Location>());
CustomLocs.get(name).add(block.getRelative(BlockFace.DOWN).getLocation());
//Remove Blocks
block.setTypeId(0);
block.getRelative(BlockFace.DOWN).setTypeId(0);
}
}
//Spawns + Borders
if (block.getTypeId() == 147)
{
Block wool = block.getRelative(BlockFace.DOWN);
if (wool == null)
continue;
if (wool.getType() == Material.WOOL)
{
if (wool.getData() == 0)
{
if (cornerA == null) cornerA = wool.getLocation();
else if (cornerB == null) cornerB = wool.getLocation();
else
{
caller.sendMessage("More than 2 Corner Markers:");
caller.sendMessage("Corner A: " + cornerA);
caller.sendMessage("Corner B: " + cornerB);
caller.sendMessage("Excess: " + UtilWorld.locToStrClean(wool.getLocation()));
}
//Remove Blocks
block.setTypeId(0);
wool.setTypeId(0);
}
if (wool.getData() == 1)
{
if (!TeamLocs.containsKey("Orange"))
TeamLocs.put("Orange", new ArrayList<Location>());
TeamLocs.get("Orange").add(wool.getLocation());
//Remove Blocks
block.setTypeId(0);
wool.setTypeId(0);
}
if (wool.getData() == 2)
{
if (!TeamLocs.containsKey("Magenta"))
TeamLocs.put("Magenta", new ArrayList<Location>());
TeamLocs.get("Magenta").add(wool.getLocation());
//Remove Blocks
block.setTypeId(0);
wool.setTypeId(0);
}
if (wool.getData() == 3)
{
if (!TeamLocs.containsKey("Sky"))
TeamLocs.put("Sky", new ArrayList<Location>());
TeamLocs.get("Sky").add(wool.getLocation());
//Remove Blocks
block.setTypeId(0);
wool.setTypeId(0);
}
if (wool.getData() == 4)
{
if (!TeamLocs.containsKey("Yellow"))
TeamLocs.put("Yellow", new ArrayList<Location>());
TeamLocs.get("Yellow").add(wool.getLocation());
//Remove Blocks
block.setTypeId(0);
wool.setTypeId(0);
}
if (wool.getData() == 5)
{
if (!TeamLocs.containsKey("Lime"))
TeamLocs.put("Lime", new ArrayList<Location>());
TeamLocs.get("Lime").add(wool.getLocation());
//Remove Blocks
block.setTypeId(0);
wool.setTypeId(0);
}
if (wool.getData() == 6)
{
if (!TeamLocs.containsKey("Pink"))
TeamLocs.put("Pink", new ArrayList<Location>());
TeamLocs.get("Pink").add(wool.getLocation());
//Remove Blocks
block.setTypeId(0);
wool.setTypeId(0);
}
if (wool.getData() == 7)
{
if (!TeamLocs.containsKey("Gray"))
TeamLocs.put("Gray", new ArrayList<Location>());
TeamLocs.get("Gray").add(wool.getLocation());
//Remove Blocks
block.setTypeId(0);
wool.setTypeId(0);
}
if (wool.getData() == 8)
{
if (!TeamLocs.containsKey("LGray"))
TeamLocs.put("LGray", new ArrayList<Location>());
TeamLocs.get("LGray").add(wool.getLocation());
//Remove Blocks
block.setTypeId(0);
wool.setTypeId(0);
}
if (wool.getData() == 9)
{
if (!TeamLocs.containsKey("Cyan"))
TeamLocs.put("Cyan", new ArrayList<Location>());
TeamLocs.get("Cyan").add(wool.getLocation());
//Remove Blocks
block.setTypeId(0);
wool.setTypeId(0);
}
if (wool.getData() == 10)
{
if (!TeamLocs.containsKey("Purple"))
TeamLocs.put("Purple", new ArrayList<Location>());
TeamLocs.get("Purple").add(wool.getLocation());
//Remove Blocks
block.setTypeId(0);
wool.setTypeId(0);
}
if (wool.getData() == 11)
{
if (!TeamLocs.containsKey("DBlue"))
TeamLocs.put("DBlue", new ArrayList<Location>());
TeamLocs.get("DBlue").add(wool.getLocation());
//Remove Blocks
block.setTypeId(0);
wool.setTypeId(0);
}
if (wool.getData() == 12)
{
if (!TeamLocs.containsKey("Brown"))
TeamLocs.put("Brown", new ArrayList<Location>());
TeamLocs.get("Brown").add(wool.getLocation());
//Remove Blocks
block.setTypeId(0);
wool.setTypeId(0);
}
if (wool.getData() == 13)
{
if (!TeamLocs.containsKey("Green"))
TeamLocs.put("Green", new ArrayList<Location>());
TeamLocs.get("Green").add(wool.getLocation());
//Remove Blocks
block.setTypeId(0);
wool.setTypeId(0);
}
if (wool.getData() == 14)
{
if (!TeamLocs.containsKey("Red"))
TeamLocs.put("Red", new ArrayList<Location>());
TeamLocs.get("Red").add(wool.getLocation());
//Remove Blocks
block.setTypeId(0);
wool.setTypeId(0);
}
if (wool.getData() == 15)
{
if (!TeamLocs.containsKey("Black"))
TeamLocs.put("Black", new ArrayList<Location>());
TeamLocs.get("Black").add(wool.getLocation());
//Remove Blocks
block.setTypeId(0);
wool.setTypeId(0);
}
}
}
if (block.getTypeId() != 148)
continue;
Block wool = block.getRelative(BlockFace.DOWN);
if (wool == null)
continue;
if (wool.getType() != Material.WOOL)
continue;
Wool woolData = new Wool(wool.getType(), wool.getData());
String dataType = woolData.getColor().name();
if (!DataLocs.containsKey(dataType))
DataLocs.put(dataType, new ArrayList<Location>());
DataLocs.get(dataType).add(wool.getLocation());
//Remove Blocks
block.setTypeId(0);
wool.setTypeId(0);
}
if (cornerA == null || cornerB == null)
{
caller.sendMessage("Missing Corner Locations!");
return; return;
} }
//Save //World to be Parsed
try World parseableWorld = Bukkit.getWorld(worldName);
{
FileWriter fstream = new FileWriter(world.getName() + File.separator + "WorldConfig.dat");
BufferedWriter out = new BufferedWriter(fstream);
out.write("MAP_NAME:"); //Parse the World
out.write("\n"); Parse(event.getPlayer(), parseableWorld, msg.split(" "), parseLoc);
out.write("MAP_AUTHOR:");
out.write("\n"); //Finalize and Save to Zip
out.write("\n"); _worldManager.finalizeParsedWorld(gameType, parseableWorld);
out.write("MIN_X:"+Math.min(cornerA.getBlockX(), cornerB.getBlockX()));
out.write("\n");
out.write("MAX_X:"+Math.max(cornerA.getBlockX(), cornerB.getBlockX()));
out.write("\n");
out.write("MIN_Z:"+Math.min(cornerA.getBlockZ(), cornerB.getBlockZ()));
out.write("\n");
out.write("MAX_Z:"+Math.max(cornerA.getBlockZ(), cornerB.getBlockZ()));
out.write("\n");
out.write("\n");
if (cornerA.getBlockY() == cornerB.getBlockY())
{
out.write("MIN_Y:0");
out.write("\n");
out.write("MAX_Y:256");
} }
else else if (event.getMessage().toLowerCase().startsWith("/worlds"))
{ {
out.write("MIN_Y:"+Math.min(cornerA.getBlockY(), cornerB.getBlockY())); event.setCancelled(true);
out.write("\n");
out.write("MAX_Y:"+Math.max(cornerA.getBlockY(), cornerB.getBlockY())); UtilPlayer.message(event.getPlayer(), F.main("Parser", "Listing Active Worlds;"));
for (World world : this.getServer().getWorlds())
{
event.getPlayer().sendMessage(world.getName());
}
}
} }
//Teams public void Parse(Player caller, World world, String[] args, Location loc)
for (String team : TeamLocs.keySet())
{ {
out.write("\n"); _curParse = new Parse(this, world, args, caller, loc);
out.write("\n");
out.write("TEAM_NAME:" + team);
out.write("\n");
out.write("TEAM_SPAWNS:" + LocationsToString(TeamLocs.get(team)));
} }
//Data @EventHandler
for (String data : DataLocs.keySet()) public void ParseUpdate(TickEvent event)
{ {
out.write("\n"); if (_curParse == null)
out.write("\n"); return;
out.write("DATA_NAME:" + data);
out.write("\n");
out.write("DATA_LOCS:" + LocationsToString(DataLocs.get(data)));
}
//Custom if (_curParse.Update())
for (String data : CustomLocs.keySet())
{ {
out.write("\n"); _curParse = null;
out.write("\n");
out.write("CUSTOM_NAME:" + data); Announce("Parse Completed!");
out.write("\n");
out.write("CUSTOM_LOCS:" + LocationsToString(CustomLocs.get(data)));
} }
out.close();
}
catch (Exception e)
{
caller.sendMessage("Error: File Write Error");
}
caller.sendMessage("World Data Saved.");
}
public String LocationsToString(ArrayList<Location> locs)
{
String out = "";
for (Location loc : locs)
out += loc.getBlockX() + "," + loc.getBlockY() + "," + loc.getBlockZ() + ":";
return out;
}
public String LocationSignsToString(HashMap<Location, String> locs)
{
String out = "";
for (Location loc : locs.keySet())
out += locs.get(loc) + "@" + loc.getBlockX() + "," + loc.getBlockY() + "," + loc.getBlockZ() + ":";
return out;
} }
@EventHandler @EventHandler
@ -595,4 +334,47 @@ public class MapParser extends JavaPlugin implements Listener
if (!event.getPlayer().isOp()) if (!event.getPlayer().isOp())
event.getPlayer().setOp(true); event.getPlayer().setOp(true);
} }
public void Announce(String msg)
{
for (Player player : UtilServer.getPlayers())
{
player.sendMessage(C.cGold + msg);
System.out.println("[Announce] " + msg);
}
}
public void Inform(Player player, String message)
{
UtilPlayer.message(player, F.main("Parser", message));
System.out.println(message);
}
public boolean DoesMapExist(String name)
{
File mapsFolder = new File(".");
for (File file : mapsFolder.listFiles())
{
if (!file.isDirectory())
continue;
if (file.getName().equals(name))
return true;
}
return false;
}
public World GetMapWorld(String name)
{
for (World world : this.getServer().getWorlds())
{
if (world.getName().equals(name))
return world;
}
return null;
}
} }

View File

@ -0,0 +1,472 @@
package mineplex.mapparser;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilWorld;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.Sign;
import org.bukkit.entity.Player;
import org.bukkit.material.Wool;
public class Parse
{
//Parse Data
private MapParser Host;
private World _world;
private String[] _args;
private Player _caller;
private Location _callLoc;
private int _size = 400;
private int y = 0;
//World Data
private HashSet<Integer> _dataId = new HashSet<Integer>();
private HashMap<String, ArrayList<Location>> _teamLocs = new HashMap<String, ArrayList<Location>>();
private HashMap<String, ArrayList<Location>> _dataLocs = new HashMap<String, ArrayList<Location>>();
private HashMap<String, ArrayList<Location>> _customLocs = new HashMap<String, ArrayList<Location>>();
private Location _cornerA = null;
private Location _cornerB = null;
private int _processed = 0;
public Parse(MapParser host, World world, String[] args, Player caller, Location loc)
{
Host = host;
_world = world;
_args = args;
_callLoc = loc;
Host.Announce("Parse Called: " + F.elem(caller.getName()));
Initialize();
}
private void Initialize()
{
Host.Announce("Commencing Parse of World: " + F.elem(_world.getName()));
//Take BlockID Arguments
for (String arg : _args)
{
if (arg.equals("/parse"))
continue;
try
{
_dataId.add(Integer.parseInt(arg));
}
catch (Exception e)
{
_caller.sendMessage("Invalid Data ID: " + arg);
}
}
}
@SuppressWarnings("deprecation")
public boolean Update()
{
for (int x=-_size ; x < _size ; x++)
for (int z=-_size ; z < _size ; z++)
{
_processed++;
if (_processed % 20000000 == 0)
Host.Announce("Processed: " + F.elem((int)(_processed/1000000) + "M of " + (int)(((_size*2)*(_size*2)*256)/1000000) + "M"));
Block block = _world.getBlockAt(_callLoc.getBlockX()+x, _callLoc.getBlockY()+y, _callLoc.getBlockZ()+z);
//ID DATA
if (_dataId.contains(block.getTypeId()))
{
String key = ""+block.getTypeId();
if (!_customLocs.containsKey(key))
_customLocs.put(key, new ArrayList<Location>());
_customLocs.get(key).add(block.getLocation());
continue;
}
//Signs
if (block.getType() == Material.SIGN_POST || block.getType() == Material.WALL_SIGN)
{
if (block.getRelative(BlockFace.DOWN).getType() == Material.SPONGE)
{
Sign s = (Sign) block.getState();
String name = "";
try
{
name = s.getLine(0);
}
catch (Exception e)
{
Host.Announce("Invalid Sign Data: " + UtilWorld.locToStr(block.getLocation()));
}
//Add
if (!_customLocs.containsKey(name))
_customLocs.put(name, new ArrayList<Location>());
_customLocs.get(name).add(block.getRelative(BlockFace.DOWN).getLocation());
//Remove Blocks
block.setTypeId(0);
block.getRelative(BlockFace.DOWN).setTypeId(0);
}
}
//Spawns + Borders
if (block.getTypeId() == 147)
{
Block wool = block.getRelative(BlockFace.DOWN);
if (wool == null)
continue;
if (wool.getType() == Material.WOOL)
{
if (wool.getData() == 0)
{
if (_cornerA == null) _cornerA = wool.getLocation();
else if (_cornerB == null) _cornerB = wool.getLocation();
else
{
Host.Announce("More than 2 Corner Markers:");
Host.Announce("Corner A: " + _cornerA);
Host.Announce("Corner B: " + _cornerB);
Host.Announce("Excess: " + UtilWorld.locToStrClean(wool.getLocation()));
}
//Remove Blocks
block.setTypeId(0);
wool.setTypeId(0);
}
if (wool.getData() == 1)
{
if (!_teamLocs.containsKey("Orange"))
_teamLocs.put("Orange", new ArrayList<Location>());
_teamLocs.get("Orange").add(wool.getLocation());
//Remove Blocks
block.setTypeId(0);
wool.setTypeId(0);
}
if (wool.getData() == 2)
{
if (!_teamLocs.containsKey("Magenta"))
_teamLocs.put("Magenta", new ArrayList<Location>());
_teamLocs.get("Magenta").add(wool.getLocation());
//Remove Blocks
block.setTypeId(0);
wool.setTypeId(0);
}
if (wool.getData() == 3)
{
if (!_teamLocs.containsKey("Sky"))
_teamLocs.put("Sky", new ArrayList<Location>());
_teamLocs.get("Sky").add(wool.getLocation());
//Remove Blocks
block.setTypeId(0);
wool.setTypeId(0);
}
if (wool.getData() == 4)
{
if (!_teamLocs.containsKey("Yellow"))
_teamLocs.put("Yellow", new ArrayList<Location>());
_teamLocs.get("Yellow").add(wool.getLocation());
//Remove Blocks
block.setTypeId(0);
wool.setTypeId(0);
}
if (wool.getData() == 5)
{
if (!_teamLocs.containsKey("Lime"))
_teamLocs.put("Lime", new ArrayList<Location>());
_teamLocs.get("Lime").add(wool.getLocation());
//Remove Blocks
block.setTypeId(0);
wool.setTypeId(0);
}
if (wool.getData() == 6)
{
if (!_teamLocs.containsKey("Pink"))
_teamLocs.put("Pink", new ArrayList<Location>());
_teamLocs.get("Pink").add(wool.getLocation());
//Remove Blocks
block.setTypeId(0);
wool.setTypeId(0);
}
if (wool.getData() == 7)
{
if (!_teamLocs.containsKey("Gray"))
_teamLocs.put("Gray", new ArrayList<Location>());
_teamLocs.get("Gray").add(wool.getLocation());
//Remove Blocks
block.setTypeId(0);
wool.setTypeId(0);
}
if (wool.getData() == 8)
{
if (!_teamLocs.containsKey("LGray"))
_teamLocs.put("LGray", new ArrayList<Location>());
_teamLocs.get("LGray").add(wool.getLocation());
//Remove Blocks
block.setTypeId(0);
wool.setTypeId(0);
}
if (wool.getData() == 9)
{
if (!_teamLocs.containsKey("Cyan"))
_teamLocs.put("Cyan", new ArrayList<Location>());
_teamLocs.get("Cyan").add(wool.getLocation());
//Remove Blocks
block.setTypeId(0);
wool.setTypeId(0);
}
if (wool.getData() == 10)
{
if (!_teamLocs.containsKey("Purple"))
_teamLocs.put("Purple", new ArrayList<Location>());
_teamLocs.get("Purple").add(wool.getLocation());
//Remove Blocks
block.setTypeId(0);
wool.setTypeId(0);
}
if (wool.getData() == 11)
{
if (!_teamLocs.containsKey("DBlue"))
_teamLocs.put("DBlue", new ArrayList<Location>());
_teamLocs.get("DBlue").add(wool.getLocation());
//Remove Blocks
block.setTypeId(0);
wool.setTypeId(0);
}
if (wool.getData() == 12)
{
if (!_teamLocs.containsKey("Brown"))
_teamLocs.put("Brown", new ArrayList<Location>());
_teamLocs.get("Brown").add(wool.getLocation());
//Remove Blocks
block.setTypeId(0);
wool.setTypeId(0);
}
if (wool.getData() == 13)
{
if (!_teamLocs.containsKey("Green"))
_teamLocs.put("Green", new ArrayList<Location>());
_teamLocs.get("Green").add(wool.getLocation());
//Remove Blocks
block.setTypeId(0);
wool.setTypeId(0);
}
if (wool.getData() == 14)
{
if (!_teamLocs.containsKey("Red"))
_teamLocs.put("Red", new ArrayList<Location>());
_teamLocs.get("Red").add(wool.getLocation());
//Remove Blocks
block.setTypeId(0);
wool.setTypeId(0);
}
if (wool.getData() == 15)
{
if (!_teamLocs.containsKey("Black"))
_teamLocs.put("Black", new ArrayList<Location>());
_teamLocs.get("Black").add(wool.getLocation());
//Remove Blocks
block.setTypeId(0);
wool.setTypeId(0);
}
}
}
if (block.getTypeId() != 148)
continue;
Block wool = block.getRelative(BlockFace.DOWN);
if (wool == null)
continue;
if (wool.getType() != Material.WOOL)
continue;
Wool woolData = new Wool(wool.getType(), wool.getData());
String dataType = woolData.getColor().name();
if (!_dataLocs.containsKey(dataType))
_dataLocs.put(dataType, new ArrayList<Location>());
_dataLocs.get(dataType).add(wool.getLocation());
//Remove Blocks
block.setTypeId(0);
wool.setTypeId(0);
}
y++;
//Finalize
if (y > 255)
{
if (_cornerA == null || _cornerB == null)
{
Host.Announce("Missing Corner Locations!");
Host.Announce("Defaulted to -256 to +256");
_cornerA = new Location(_world, -256, 0, -256);
_cornerB = new Location(_world, 256, 0, 256);
}
//Save
try
{
FileWriter fstream = new FileWriter(_world.getName() + File.separator + "WorldConfig.dat");
BufferedWriter out = new BufferedWriter(fstream);
out.write("MAP_NAME:");
out.write("\n");
out.write("MAP_AUTHOR:");
out.write("\n");
out.write("\n");
out.write("MIN_X:"+Math.min(_cornerA.getBlockX(), _cornerB.getBlockX()));
out.write("\n");
out.write("MAX_X:"+Math.max(_cornerA.getBlockX(), _cornerB.getBlockX()));
out.write("\n");
out.write("MIN_Z:"+Math.min(_cornerA.getBlockZ(), _cornerB.getBlockZ()));
out.write("\n");
out.write("MAX_Z:"+Math.max(_cornerA.getBlockZ(), _cornerB.getBlockZ()));
out.write("\n");
out.write("\n");
if (_cornerA.getBlockY() == _cornerB.getBlockY())
{
out.write("MIN_Y:0");
out.write("\n");
out.write("MAX_Y:256");
}
else
{
out.write("MIN_Y:"+Math.min(_cornerA.getBlockY(), _cornerB.getBlockY()));
out.write("\n");
out.write("MAX_Y:"+Math.max(_cornerA.getBlockY(), _cornerB.getBlockY()));
}
//Teams
for (String team : _teamLocs.keySet())
{
out.write("\n");
out.write("\n");
out.write("TEAM_NAME:" + team);
out.write("\n");
out.write("TEAM_SPAWNS:" + LocationsToString(_teamLocs.get(team)));
}
//Data
for (String data : _dataLocs.keySet())
{
out.write("\n");
out.write("\n");
out.write("DATA_NAME:" + data);
out.write("\n");
out.write("DATA_LOCS:" + LocationsToString(_dataLocs.get(data)));
}
//Custom
for (String data : _customLocs.keySet())
{
out.write("\n");
out.write("\n");
out.write("CUSTOM_NAME:" + data);
out.write("\n");
out.write("CUSTOM_LOCS:" + LocationsToString(_customLocs.get(data)));
}
out.close();
}
catch (Exception e)
{
Host.Announce("Error: File Write Error");
}
Host.Announce("WorldConfig.dat Saved.");
}
return false;
}
public String LocationsToString(ArrayList<Location> locs)
{
String out = "";
for (Location loc : locs)
out += loc.getBlockX() + "," + loc.getBlockY() + "," + loc.getBlockZ() + ":";
return out;
}
public String LocationSignsToString(HashMap<Location, String> locs)
{
String out = "";
for (Location loc : locs.keySet())
out += locs.get(loc) + "@" + loc.getBlockX() + "," + loc.getBlockY() + "," + loc.getBlockZ() + ":";
return out;
}
}

View File

@ -0,0 +1,19 @@
package mineplex.mapparser;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
public class TickEvent extends Event
{
private static final HandlerList handlers = new HandlerList();
public HandlerList getHandlers()
{
return handlers;
}
public static HandlerList getHandlerList()
{
return handlers;
}
}

View File

@ -0,0 +1,20 @@
package mineplex.mapparser;
import org.bukkit.plugin.java.JavaPlugin;
public class Ticker implements Runnable
{
private JavaPlugin _plugin;
public Ticker(JavaPlugin plugin)
{
_plugin = plugin;
_plugin.getServer().getScheduler().scheduleSyncRepeatingTask(_plugin, this, 0L, 1L);
}
@Override
public void run()
{
_plugin.getServer().getPluginManager().callEvent(new TickEvent());
}
}

View File

@ -1,7 +1,6 @@
package mineplex.mapparser; package mineplex.mapparser;
import java.io.File; import java.io.File;
import java.io.FilenameFilter;
import java.io.IOException; import java.io.IOException;
import java.nio.file.Paths; import java.nio.file.Paths;
import java.util.Arrays; import java.util.Arrays;
@ -13,53 +12,23 @@ import net.minecraft.util.org.apache.commons.io.FileUtils;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.WorldCreator; import org.bukkit.WorldCreator;
import org.bukkit.entity.Player;
import org.bukkit.event.entity.CreatureSpawnEvent;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
public class WorldManager public class WorldManager
{ {
private JavaPlugin _plugin; private JavaPlugin _plugin;
private File _pendingParseDirectory = new File("pendingParses");
public WorldManager(JavaPlugin plugin) public WorldManager(JavaPlugin plugin)
{ {
_plugin = plugin; _plugin = plugin;
if (!_pendingParseDirectory.exists())
_pendingParseDirectory.mkdirs();
}
public void listPendingParses(Player player)
{
FilenameFilter statsFilter = new FilenameFilter()
{
public boolean accept(File paramFile, String paramString)
{
if (paramString.endsWith("zip"))
{
return true;
}
return false;
}
};
for (File f : _pendingParseDirectory.listFiles(statsFilter))
{
player.sendMessage(f.getName());
}
}
public World loadPendingParse(Player player, String name)
{
return WorldUtil.LoadWorld(new WorldCreator(_pendingParseDirectory + File.separator + name));
} }
public String prepMapParse(World world) public String prepMapParse(World world)
{ {
//Unload World
MapUtil.UnloadWorld(_plugin, world); MapUtil.UnloadWorld(_plugin, world);
//Delete Non-Map Files
String[] folders = new File(world.getName()).list(); String[] folders = new File(world.getName()).list();
for (String fileName : folders) for (String fileName : folders)
{ {
@ -75,12 +44,25 @@ public class WorldManager
FileUtils.deleteQuietly(new File(world.getName() + File.separator + fileName)); FileUtils.deleteQuietly(new File(world.getName() + File.separator + fileName));
} }
ZipUtil.ZipFolders(Paths.get("pendingParses").toAbsolutePath().toString(), world.getName() + ".zip", Arrays.asList(new String[] { world.getName() }), Arrays.asList(new String[] { })); //Copy for Parsing
try
{
//Delete if already exists
File destination = new File("parse_" + world.getName());
if (destination.exists())
FileUtils.deleteQuietly(destination);
ZipUtil.UnzipToDirectory("pendingParses" + File.separator + world.getName() + ".zip", world.getName() + "_current"); FileUtils.copyDirectory(new File(world.getName()), destination);
WorldUtil.LoadWorld(new WorldCreator(world.getName() + "_current")); }
catch (IOException e)
{
e.printStackTrace();
return null;
}
return world.getName() + "_current"; WorldUtil.LoadWorld(new WorldCreator("parse_" + world.getName()));
return "parse_" + world.getName();
} }
public void finalizeParsedWorld(String gameType, World world) public void finalizeParsedWorld(String gameType, World world)

View File

@ -101,7 +101,7 @@ public class SilencingArrow extends SkillActive
_arrows.add(event.getProjectile()); _arrows.add(event.getProjectile());
} }
@EventHandler(priority = EventPriority.LOW) @EventHandler(priority = EventPriority.HIGH)
public void Damage(CustomDamageEvent event) public void Damage(CustomDamageEvent event)
{ {
if (event.IsCancelled()) if (event.IsCancelled())

View File

@ -198,9 +198,6 @@ public class BlockToss extends SkillCharge implements IThrown
Factory.Projectile().AddThrow(block, cur, this, -1, true, true, true, Factory.Projectile().AddThrow(block, cur, this, -1, true, true, true,
null, 0, 0, null, 0, UpdateType.FASTEST, 2.5d); null, 0, 0, null, 0, UpdateType.FASTEST, 2.5d);
//Boost
UtilAction.velocity(cur, cur.getLocation().getDirection().multiply(-1), 0.4, false, 0, 0, 1, false);
//Event //Event
UtilServer.getServer().getPluginManager().callEvent(new SkillEvent(cur, GetName(), ClassType.Brute)); UtilServer.getServer().getPluginManager().callEvent(new SkillEvent(cur, GetName(), ClassType.Brute));
} }

View File

@ -32,12 +32,13 @@ public class Bloodlust extends Skill
SetDesc(new String[] SetDesc(new String[]
{ {
"When an enemy dies within #4#4 blocks,", "When an enemy dies within #8#2 blocks,",
"you go into a Bloodlust, receiving", "you go into a Bloodlust, receiving",
"Speed 1 and Strength 1 for #4#2 seconds.", "Speed 1 and Strength 1 for #4#2 seconds.",
"You also heal healing #2#1 health.",
"", "",
"Bloodlust can stack up to 3 times,", "Bloodlust can stack up to 3 times,",
"boosting the level of Strength." "boosting the level of Speed by 1."
}); });
} }
@ -79,8 +80,10 @@ public class Bloodlust extends Skill
_time.put(cur, (System.currentTimeMillis() + (long)(dur*1000))); _time.put(cur, (System.currentTimeMillis() + (long)(dur*1000)));
//Condition //Condition
Factory.Condition().Factory().Speed(GetName(), cur, event.GetEvent().getEntity(), dur, 0, false, true, true); Factory.Condition().Factory().Speed(GetName(), cur, event.GetEvent().getEntity(), dur, str, false, true, true);
Factory.Condition().Factory().Strength(GetName(), cur, event.GetEvent().getEntity(), dur, str, false, true, true); Factory.Condition().Factory().Strength(GetName(), cur, event.GetEvent().getEntity(), dur, 0, false, true, true);
UtilPlayer.health(cur, 2 + level);
//Inform //Inform
UtilPlayer.message(cur, F.main(GetClassType().name(), "You entered " + F.skill(GetName(level)) + " at " + F.elem("Level " + (str+1)) + ".")); UtilPlayer.message(cur, F.main(GetClassType().name(), "You entered " + F.skill(GetName(level)) + " at " + F.elem("Level " + (str+1)) + "."));

View File

@ -42,7 +42,7 @@ public class HoldPosition extends SkillActive
SetDesc(new String[] SetDesc(new String[]
{ {
"Hold your position, gaining", "Hold your position, gaining",
"Protection 4, Slow 3 and no", "Protection 3, Slow 3 and no",
"knockback for #3#1 seconds." "knockback for #3#1 seconds."
}); });
} }
@ -66,7 +66,7 @@ public class HoldPosition extends SkillActive
//Action //Action
Factory.Condition().Factory().Slow(GetName(), player, player, duration, 2, false, true, false, true); Factory.Condition().Factory().Slow(GetName(), player, player, duration, 2, false, true, false, true);
Factory.Condition().Factory().Protection(GetName(), player, player, duration, 3, false, true, true); Factory.Condition().Factory().Protection(GetName(), player, player, duration, 2, false, true, true);
//Inform //Inform
UtilPlayer.message(player, F.main(GetClassType().name(), "You used " + F.skill(GetName(level)) + ".")); UtilPlayer.message(player, F.main(GetClassType().name(), "You used " + F.skill(GetName(level)) + "."));

View File

@ -91,7 +91,7 @@ public class GlacialBlade extends SkillActive implements IThrown
//Damage //Damage
Factory.Damage().NewDamageEvent(target, data.GetThrower(), null, Factory.Damage().NewDamageEvent(target, data.GetThrower(), null,
DamageCause.CUSTOM, 4, true, true, false, DamageCause.CUSTOM, 4, false, true, false,
UtilEnt.getName(data.GetThrower()), GetName()); UtilEnt.getName(data.GetThrower()), GetName());
} }

View File

@ -48,7 +48,7 @@ public class Agility extends SkillActive
SetDesc(new String[] SetDesc(new String[]
{ {
"Sprint with great agility, gaining", "Sprint with great agility, gaining",
"Speed I for #2#2 seconds. You are", "Speed I for #2#1 seconds. You are",
"immune to damage while sprinting.", "immune to damage while sprinting.",
"", "",
"Agility ends if you interact." "Agility ends if you interact."

View File

@ -22,8 +22,7 @@ public class BarbedArrows extends Skill
{ {
"Your arrows are barbed, and give", "Your arrows are barbed, and give",
"opponents Slow 1 for #2#1 seconds.", "opponents Slow 1 for #2#1 seconds.",
"If opponent is sprinting, they", "Will cancel sprint on opponents.",
"receive Slow 3 instead.",
"", "",
"Duration scales with arrow velocity." "Duration scales with arrow velocity."
}); });
@ -54,16 +53,13 @@ public class BarbedArrows extends Skill
Player damageePlayer = event.GetDamageePlayer(); Player damageePlayer = event.GetDamageePlayer();
//Action //Action
int str = 0; damageePlayer.setSprinting(false);
if (damageePlayer != null)
if (damageePlayer.isSprinting())
str = 3;
//Damage //Damage
event.AddMod(damager.getName(), GetName(), 0, false); event.AddMod(damager.getName(), GetName(), 0, false);
//Condition //Condition
Factory.Condition().Factory().Slow(GetName(), damagee, damager, (projectile.getVelocity().length() / 3) * (2 + level), str, false, true, true, true); Factory.Condition().Factory().Slow(GetName(), damagee, damager, (projectile.getVelocity().length() / 3) * (2 + level), 0, false, true, true, true);
} }
@Override @Override

View File

@ -63,7 +63,7 @@ public class HeavyArrows extends Skill
{ {
double vel = (event.getProjectile().getVelocity().length() * (0.1 + 0.1 * level)); double vel = (event.getProjectile().getVelocity().length() * (0.1 + 0.1 * level));
UtilAction.velocity(player, player.getLocation().getDirection().multiply(-1), vel, UtilAction.velocity(player, player.getLocation().getDirection().multiply(-1), vel,
false, 0, 0.2, 0.8, true); false, 0, 0.2, 0.6, true);
} }
//Decrease Speed //Decrease Speed

View File

@ -40,14 +40,14 @@ public class Overcharge extends SkillChargeBow
"", "",
GetChargeString(), GetChargeString(),
"", "",
"Deals up to #1#1 bonus damage." "Deals up to #0#1 bonus damage."
}); });
} }
@Override @Override
public void DoSkillCustom(Player player, float charge, Arrow arrow) public void DoSkillCustom(Player player, float charge, Arrow arrow)
{ {
double damage = charge * (1 + 1 * getLevel(player)); double damage = charge * (getLevel(player));
_arrows.put(arrow, damage); _arrows.put(arrow, damage);
} }

View File

@ -22,9 +22,9 @@ public class VitalitySpores extends Skill
SetDesc(new String[] SetDesc(new String[]
{ {
"After #12#-2 seconds of not taking damage,", "After #14#-2 seconds of not taking damage,",
"forest spores surround you, giving", "forest spores surround you, giving",
"you Regeneration 1 for #3#2 seconds.", "you Regeneration 1 for #2#2 seconds.",
"", "",
"This remains until you take damage." "This remains until you take damage."
}); });

View File

@ -50,7 +50,7 @@ public class WolfsPounce extends SkillChargeSword
"", "",
"Colliding with another player", "Colliding with another player",
"mid-air deals #1#1 damage and", "mid-air deals #1#1 damage and",
"Slow 2 for #2.5#0.5 seconds." "Slow 2 for 3 seconds."
}); });
} }
@ -129,7 +129,7 @@ public class WolfsPounce extends SkillChargeSword
damager.getName(), GetName()); damager.getName(), GetName());
//Conditions //Conditions
Factory.Condition().Factory().Slow(GetName(), damagee, damagee, 2.5 + 0.5 * level, 1, false, true, true, true); Factory.Condition().Factory().Slow(GetName(), damagee, damagee, 3, 1, false, true, true, true);
//Inform //Inform
UtilPlayer.message(damager, F.main(GetClassType().name(), "You hit " + F.name(UtilEnt.getName(damagee)) + " with " + F.skill(GetName(level)) + ".")); UtilPlayer.message(damager, F.main(GetClassType().name(), "You hit " + F.name(UtilEnt.getName(damagee)) + " with " + F.skill(GetName(level)) + "."));

View File

@ -183,7 +183,7 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory
AddSkill(new Leap(this, "Leap", ClassType.Assassin, SkillType.Axe, AddSkill(new Leap(this, "Leap", ClassType.Assassin, SkillType.Axe,
1, 4, 1, 4,
40, -2, 40, -2,
11500, -1500, true, 10500, -1500, true,
new Material[] {Material.IRON_AXE, Material.GOLD_AXE, Material.DIAMOND_AXE}, new Material[] {Material.IRON_AXE, Material.GOLD_AXE, Material.DIAMOND_AXE},
new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK})); new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK}));
@ -442,7 +442,7 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory
AddSkill(new WolfsFury(this, "Wolfs Fury", ClassType.Ranger, SkillType.Axe, AddSkill(new WolfsFury(this, "Wolfs Fury", ClassType.Ranger, SkillType.Axe,
1, 4, 1, 4,
0, 0, 0, 0,
20000, 2000, true, 18000, 2000, true,
new Material[] {Material.IRON_AXE, Material.GOLD_AXE, Material.DIAMOND_AXE}, new Material[] {Material.IRON_AXE, Material.GOLD_AXE, Material.DIAMOND_AXE},
new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK})); new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK}));

View File

@ -4,6 +4,8 @@ import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
@ -13,9 +15,11 @@ import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.ItemDespawnEvent; import org.bukkit.event.entity.ItemDespawnEvent;
import org.bukkit.event.inventory.InventoryClickEvent; import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryType; import org.bukkit.event.inventory.InventoryType;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerPickupItemEvent; import org.bukkit.event.player.PlayerPickupItemEvent;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.elo.EloPlayer; import mineplex.core.elo.EloPlayer;
import mineplex.core.elo.EloTeam; import mineplex.core.elo.EloTeam;
@ -402,4 +406,11 @@ public class Domination extends TeamGame
GetStats(damagee).DamageTaken += event.GetDamage(); GetStats(damagee).DamageTaken += event.GetDamage();
} }
} }
@EventHandler(priority = EventPriority.HIGHEST)
public void UsableInteract(PlayerInteractEvent event)
{
if (UtilBlock.usable(event.getClickedBlock()))
event.setCancelled(true);
}
} }

View File

@ -9,11 +9,14 @@ import org.bukkit.Sound;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityShootBowEvent; import org.bukkit.event.entity.EntityShootBowEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.scoreboard.Objective; import org.bukkit.scoreboard.Objective;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
@ -365,4 +368,11 @@ public class TeamDeathmatch extends TeamGame
//End //End
SetState(GameState.End); SetState(GameState.End);
} }
@EventHandler(priority = EventPriority.HIGHEST)
public void UsableInteract(PlayerInteractEvent event)
{
if (UtilBlock.usable(event.getClickedBlock()))
event.setCancelled(true);
}
} }

View File

@ -295,7 +295,7 @@ public class UHC extends TeamGame
continue; continue;
UtilParticle.PlayParticle(player, ParticleType.EXPLODE, block.getLocation(), (float)Math.random(), (float)Math.random(), (float)Math.random(), 0, 1); UtilParticle.PlayParticle(player, ParticleType.LARGE_EXPLODE, block.getLocation(), (float)Math.random(), (float)Math.random(), (float)Math.random(), 0, 1);
player.playSound(block.getLocation(), Sound.FIZZ, 0.1f, 0.1f); player.playSound(block.getLocation(), Sound.FIZZ, 0.1f, 0.1f);
} }