Parser Merge
This commit is contained in:
parent
d8123795aa
commit
afea0ba87f
@ -146,7 +146,7 @@ public class MapUtil
|
|||||||
if (changeChunkBlock(x & 15, y, z & 15, ((CraftWorld) world).getHandle().getChunkAt(x >> 4, z >> 4),
|
if (changeChunkBlock(x & 15, y, z & 15, ((CraftWorld) world).getHandle().getChunkAt(x >> 4, z >> 4),
|
||||||
Block.getById(id), data))
|
Block.getById(id), data))
|
||||||
{
|
{
|
||||||
((CraftWorld) world).getHandle().notify(x, y, z);
|
//((CraftWorld) world).getHandle().notify(x, y, z);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
package mineplex.core.common.util;
|
package mineplex.core.common.util;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.TreeSet;
|
import java.util.TreeSet;
|
||||||
|
@ -460,6 +460,15 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
|||||||
event.allow();
|
event.allow();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.LOW)
|
||||||
|
public void AdminOP(PlayerJoinEvent event)
|
||||||
|
{
|
||||||
|
if (_clientManager.Get(event.getPlayer()).GetRank().Has(Rank.ADMIN))
|
||||||
|
event.getPlayer().setOp(true);
|
||||||
|
else
|
||||||
|
event.getPlayer().setOp(false);
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler(priority = EventPriority.LOW)
|
@EventHandler(priority = EventPriority.LOW)
|
||||||
public void PlayerJoin(PlayerJoinEvent event)
|
public void PlayerJoin(PlayerJoinEvent event)
|
||||||
{
|
{
|
||||||
|
@ -42,6 +42,8 @@ import mineplex.core.task.TaskManager;
|
|||||||
import mineplex.core.updater.UpdateType;
|
import mineplex.core.updater.UpdateType;
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
import mineplex.hub.HubManager;
|
import mineplex.hub.HubManager;
|
||||||
|
import mineplex.hub.modules.parkour.ParkourData;
|
||||||
|
import mineplex.hub.modules.parkour.ParkourSnake;
|
||||||
|
|
||||||
public class ParkourManager extends MiniPlugin
|
public class ParkourManager extends MiniPlugin
|
||||||
{
|
{
|
||||||
@ -51,6 +53,7 @@ public class ParkourManager extends MiniPlugin
|
|||||||
|
|
||||||
private HashSet<ParkourData> _parkour = new HashSet<ParkourData>();
|
private HashSet<ParkourData> _parkour = new HashSet<ParkourData>();
|
||||||
|
|
||||||
|
private Location _snakeParkourReturn;
|
||||||
private Location _lavaParkourReturn;
|
private Location _lavaParkourReturn;
|
||||||
private WeakHashMap<Player, Location> _lavaLocation = new WeakHashMap<Player, Location>();
|
private WeakHashMap<Player, Location> _lavaLocation = new WeakHashMap<Player, Location>();
|
||||||
private WeakHashMap<Player, Long> _lavaTimer = new WeakHashMap<Player, Long>();
|
private WeakHashMap<Player, Long> _lavaTimer = new WeakHashMap<Player, Long>();
|
||||||
@ -85,9 +88,20 @@ public class ParkourManager extends MiniPlugin
|
|||||||
"or you will die in flames!"
|
"or you will die in flames!"
|
||||||
}, 4000, new Location(Manager.GetSpawn().getWorld(), -93,67,38),
|
}, 4000, new Location(Manager.GetSpawn().getWorld(), -93,67,38),
|
||||||
new Location(Manager.GetSpawn().getWorld(), -86,100,42), new Location(Manager.GetSpawn().getWorld(), -120,50,-17)));
|
new Location(Manager.GetSpawn().getWorld(), -86,100,42), new Location(Manager.GetSpawn().getWorld(), -120,50,-17)));
|
||||||
|
|
||||||
|
_parkour.add(new ParkourSnake("Snake Parkour", new String[]
|
||||||
|
{
|
||||||
|
"This parkour requires incredible timing",
|
||||||
|
"and great agility! Some say it was created",
|
||||||
|
"by the devil as a cruel joke!"
|
||||||
|
}, 8000, new Location(Manager.GetSpawn().getWorld(), 22,70,-54),
|
||||||
|
new Location(Manager.GetSpawn().getWorld(), 28,-50,-88), new Location(Manager.GetSpawn().getWorld(), -24,90,-46)));
|
||||||
|
|
||||||
_lavaParkourReturn = new Location(Manager.GetSpawn().getWorld(), -89.5,68,36.5);
|
_lavaParkourReturn = new Location(Manager.GetSpawn().getWorld(), -89.5,68,36.5);
|
||||||
_lavaParkourReturn.setYaw(90);
|
_lavaParkourReturn.setYaw(90);
|
||||||
|
|
||||||
|
_snakeParkourReturn = new Location(Manager.GetSpawn().getWorld(), 16.5,72,-52.5);
|
||||||
|
_snakeParkourReturn.setYaw(180);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isParkourMode(Player player)
|
public boolean isParkourMode(Player player)
|
||||||
@ -145,7 +159,7 @@ public class ParkourManager extends MiniPlugin
|
|||||||
|
|
||||||
for (ParkourData data : _parkour)
|
for (ParkourData data : _parkour)
|
||||||
if (UtilMath.offset(player.getLocation(), data.NPC) < 6)
|
if (UtilMath.offset(player.getLocation(), data.NPC) < 6)
|
||||||
if (Recharge.Instance.use(player, data.Name+" Info", 60000, false, false))
|
if (Recharge.Instance.use(player, data.Name+" Info", 300000, false, false))
|
||||||
data.Inform(player);
|
data.Inform(player);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -229,6 +243,25 @@ public class ParkourManager extends MiniPlugin
|
|||||||
event.getEntity().leaveVehicle();
|
event.getEntity().leaveVehicle();
|
||||||
event.getEntity().teleport(_lavaParkourReturn);
|
event.getEntity().teleport(_lavaParkourReturn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@EventHandler(priority = EventPriority.HIGHEST)
|
||||||
|
public void snakeReturn(EntityDamageEvent event)
|
||||||
|
{
|
||||||
|
if (event.getCause() != DamageCause.VOID)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!(event.getEntity() instanceof Player))
|
||||||
|
return;
|
||||||
|
|
||||||
|
Player player = (Player)event.getEntity();
|
||||||
|
|
||||||
|
if (!isParkourMode(player))
|
||||||
|
return;
|
||||||
|
|
||||||
|
event.getEntity().eject();
|
||||||
|
event.getEntity().leaveVehicle();
|
||||||
|
event.getEntity().teleport(_snakeParkourReturn);
|
||||||
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void lavaBlockReturn(UpdateEvent event)
|
public void lavaBlockReturn(UpdateEvent event)
|
||||||
@ -385,4 +418,16 @@ public class ParkourManager extends MiniPlugin
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@EventHandler
|
||||||
|
public void snakeUpdate(UpdateEvent event)
|
||||||
|
{
|
||||||
|
if (event.getType() != UpdateType.FASTER)
|
||||||
|
return;
|
||||||
|
|
||||||
|
for (ParkourData parkour : _parkour)
|
||||||
|
if (parkour instanceof ParkourSnake)
|
||||||
|
((ParkourSnake)parkour).Update();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,11 +5,16 @@ import java.util.Iterator;
|
|||||||
|
|
||||||
import mineplex.core.MiniPlugin;
|
import mineplex.core.MiniPlugin;
|
||||||
import mineplex.core.common.util.C;
|
import mineplex.core.common.util.C;
|
||||||
|
import mineplex.core.common.util.UtilAction;
|
||||||
import mineplex.core.common.util.UtilBlock;
|
import mineplex.core.common.util.UtilBlock;
|
||||||
|
import mineplex.core.common.util.UtilEnt;
|
||||||
|
import mineplex.core.common.util.UtilEvent;
|
||||||
|
import mineplex.core.common.util.UtilGear;
|
||||||
import mineplex.core.common.util.UtilMath;
|
import mineplex.core.common.util.UtilMath;
|
||||||
import mineplex.core.common.util.UtilServer;
|
import mineplex.core.common.util.UtilServer;
|
||||||
import mineplex.core.common.util.UtilTime;
|
import mineplex.core.common.util.UtilTime;
|
||||||
import mineplex.core.common.util.UtilWorld;
|
import mineplex.core.common.util.UtilWorld;
|
||||||
|
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||||
import mineplex.core.itemstack.ItemStackFactory;
|
import mineplex.core.itemstack.ItemStackFactory;
|
||||||
import mineplex.core.updater.UpdateType;
|
import mineplex.core.updater.UpdateType;
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
@ -25,7 +30,9 @@ import org.bukkit.entity.Boat;
|
|||||||
import org.bukkit.entity.Chicken;
|
import org.bukkit.entity.Chicken;
|
||||||
import org.bukkit.entity.Cow;
|
import org.bukkit.entity.Cow;
|
||||||
import org.bukkit.entity.Creature;
|
import org.bukkit.entity.Creature;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
|
import org.bukkit.entity.Minecart;
|
||||||
import org.bukkit.entity.Pig;
|
import org.bukkit.entity.Pig;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.entity.Skeleton;
|
import org.bukkit.entity.Skeleton;
|
||||||
@ -42,6 +49,7 @@ import org.bukkit.event.entity.EntityCombustEvent;
|
|||||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||||
import org.bukkit.event.entity.EntityTargetEvent;
|
import org.bukkit.event.entity.EntityTargetEvent;
|
||||||
import org.bukkit.event.player.PlayerDropItemEvent;
|
import org.bukkit.event.player.PlayerDropItemEvent;
|
||||||
|
import org.bukkit.event.player.PlayerInteractEvent;
|
||||||
import org.bukkit.event.player.PlayerPickupItemEvent;
|
import org.bukkit.event.player.PlayerPickupItemEvent;
|
||||||
import org.bukkit.event.vehicle.VehicleBlockCollisionEvent;
|
import org.bukkit.event.vehicle.VehicleBlockCollisionEvent;
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
package mineplex.hub.modules;
|
package mineplex.hub.modules.parkour;
|
||||||
|
|
||||||
import mineplex.core.common.util.C;
|
import mineplex.core.common.util.C;
|
||||||
import mineplex.core.common.util.UtilAlg;
|
import mineplex.core.common.util.UtilAlg;
|
||||||
@ -7,6 +7,7 @@ import mineplex.core.common.util.UtilPlayer;
|
|||||||
|
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
|
import org.bukkit.World;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class ParkourData
|
public class ParkourData
|
||||||
@ -55,4 +56,9 @@ public class ParkourData
|
|||||||
{
|
{
|
||||||
return (UtilAlg.inBoundingBox(loc, CornerA, CornerB));
|
return (UtilAlg.inBoundingBox(loc, CornerA, CornerB));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public World getWorld()
|
||||||
|
{
|
||||||
|
return CornerA.getWorld();
|
||||||
|
}
|
||||||
}
|
}
|
@ -0,0 +1,213 @@
|
|||||||
|
package mineplex.hub.modules.parkour;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.BufferedWriter;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileReader;
|
||||||
|
import java.io.FileWriter;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
|
||||||
|
import mineplex.core.common.util.UtilMath;
|
||||||
|
|
||||||
|
|
||||||
|
public class ParkourSnake extends ParkourData
|
||||||
|
{
|
||||||
|
private ArrayList<SnakePart> _snakes;
|
||||||
|
|
||||||
|
public ParkourSnake(String name, String[] desc, int gems, Location npc, Location cornerA, Location cornerB)
|
||||||
|
{
|
||||||
|
super(name, desc, gems, npc, cornerA, cornerB);
|
||||||
|
|
||||||
|
//THIS SHOULD BE COMMENTED OUT
|
||||||
|
//parseSnakes();
|
||||||
|
|
||||||
|
loadSnakes();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void loadSnakes()
|
||||||
|
{
|
||||||
|
_snakes = new ArrayList<SnakePart>();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
BufferedReader br = new BufferedReader(new FileReader("SnakeRoutes.dat"));
|
||||||
|
try
|
||||||
|
{
|
||||||
|
String line = br.readLine();
|
||||||
|
|
||||||
|
while (line != null)
|
||||||
|
{
|
||||||
|
if (line.length() > 6)
|
||||||
|
_snakes.add(loadSnake(line));
|
||||||
|
|
||||||
|
line = br.readLine();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
br.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println("Done");
|
||||||
|
}
|
||||||
|
|
||||||
|
public SnakePart loadSnake(String locString)
|
||||||
|
{
|
||||||
|
ArrayList<Location> locs = new ArrayList<Location>();
|
||||||
|
|
||||||
|
for (String cur : locString.split(":"))
|
||||||
|
{
|
||||||
|
String[] tokens = cur.split(",");
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Location loc = new Location(getWorld(), Integer.parseInt(tokens[0]), Integer.parseInt(tokens[1]), Integer.parseInt(tokens[2]));
|
||||||
|
|
||||||
|
if (InBoundary(loc))
|
||||||
|
locs.add(loc);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
System.out.println("Invalid Hub Snake Location: " + cur);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return new SnakePart(locs);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void parseSnakes()
|
||||||
|
{
|
||||||
|
String locString = "-22,78,-72:-22,79,-72:-22,80,-72:-22,80,-71:-22,80,-70:-22,80,-69:-22,78,-68:-22,79,-68:-22,80,-68:-22,79,-57:-22,79,-56:-22,79,-55:-22,79,-54:-22,79,-53:-21,75,-78:-21,76,-78:-21,77,-78:-21,75,-77:-21,75,-76:-21,75,-75:-21,75,-74:-21,76,-74:-21,77,-74:-21,78,-74:-21,78,-73:-21,78,-72:-21,76,-68:-21,77,-68:-21,78,-68:-21,76,-67:-21,76,-66:-21,76,-65:-21,76,-64:-21,77,-64:-21,78,-64:-21,79,-64:-21,79,-63:-21,77,-62:-21,78,-62:-21,79,-62:-21,79,-57:-21,79,-56:-21,79,-55:-21,79,-54:-21,79,-53:-20,77,-78:-20,77,-62:-20,79,-57:-20,79,-56:-20,79,-55:-20,79,-54:-20,79,-53:-19,75,-78:-19,76,-78:-19,77,-78:-19,75,-77:-19,75,-76:-19,75,-75:-19,75,-74:-19,77,-74:-19,78,-74:-19,79,-74:-19,75,-73:-19,76,-73:-19,77,-73:-19,77,-62:-18,79,-74:-18,77,-62:-17,79,-74:-17,77,-62:-16,79,-74:-16,77,-62:-15,77,-74:-15,78,-74:-15,79,-74:-15,75,-73:-15,76,-73:-15,77,-73:-15,75,-72:-15,75,-71:-15,75,-70:-15,75,-69:-15,76,-69:-15,77,-69:-15,77,-68:-15,77,-67:-15,77,-66:-15,77,-65:-15,77,-64:-15,77,-63:-15,77,-62:-11,77,-68:-11,78,-68:-11,79,-68:-11,77,-67:-11,77,-66:-11,77,-65:-11,78,-65:-11,79,-65:-10,79,-68:-10,79,-65:-9,79,-68:-9,79,-65:-8,77,-68:-8,78,-68:-8,79,-68:-8,77,-67:-8,77,-66:-8,77,-65:-8,78,-65:-8,79,-65:-7,75,-75:-7,75,-74:-7,75,-73:-7,76,-73:-7,77,-73:-7,73,-71:-7,74,-71:-7,75,-71:-7,73,-70:-7,73,-69:-7,72,-66:-7,73,-66:-7,74,-66:-7,72,-65:-7,72,-64:-7,72,-63:-7,73,-63:-7,74,-63:-7,75,-63:-6,71,-79:-6,72,-79:-6,73,-79:-6,74,-79:-6,75,-79:-6,75,-78:-6,76,-78:-6,77,-78:-6,75,-75:-6,77,-73:-6,75,-71:-6,73,-69:-6,74,-66:-6,75,-63:-5,71,-79:-5,77,-78:-5,75,-75:-5,75,-74:-5,75,-73:-5,76,-73:-5,77,-73:-5,73,-71:-5,74,-71:-5,75,-71:-5,73,-70:-5,73,-69:-5,77,-69:-5,77,-68:-5,77,-67:-5,74,-66:-5,75,-66:-5,76,-66:-5,77,-66:-5,72,-63:-5,73,-63:-5,74,-63:-5,75,-63:-4,71,-79:-4,77,-78:-4,77,-69:-4,72,-63:-3,71,-79:-3,77,-78:-3,77,-69:-3,72,-63:-2,71,-79:-2,73,-79:-2,74,-79:-2,75,-79:-2,75,-78:-2,76,-78:-2,77,-78:-2,74,-69:-2,75,-69:-2,76,-69:-2,77,-69:-2,74,-68:-2,74,-67:-2,74,-66:-2,74,-65:-2,75,-65:-2,76,-65:-2,76,-64:-2,72,-63:-2,73,-63:-2,74,-63:-2,75,-63:-2,76,-63:-1,71,-79:-1,73,-79:0,71,-79:0,73,-79:1,71,-79:1,73,-79:1,74,-79:1,75,-79:1,75,-78:1,76,-78:1,77,-78:2,71,-79:2,77,-78:3,71,-79:3,77,-78:4,71,-79:4,73,-79:4,74,-79:4,75,-79:4,75,-78:4,76,-78:4,77,-78:5,71,-79:5,73,-79:6,71,-79:6,73,-79:7,71,-79:7,73,-79:7,74,-79:7,75,-79:7,75,-78:7,76,-78:7,77,-78:7,69,-67:7,70,-67:7,71,-67:7,71,-66:7,71,-65:7,69,-64:7,70,-64:7,71,-64:8,71,-79:8,77,-78:8,66,-74:8,67,-74:8,68,-74:8,68,-73:8,68,-72:8,68,-71:8,68,-70:8,68,-69:8,69,-69:8,70,-69:8,71,-69:8,69,-67:8,69,-64:9,71,-79:9,77,-78:9,66,-74:9,71,-69:9,69,-67:9,69,-64:10,71,-79:10,72,-79:10,73,-79:10,74,-79:10,75,-79:10,75,-78:10,76,-78:10,77,-78:10,66,-74:10,68,-74:10,69,-74:10,70,-74:10,71,-74:10,71,-73:10,69,-72:10,70,-72:10,71,-72:10,69,-71:10,69,-70:10,69,-69:10,70,-69:10,71,-69:10,69,-67:10,70,-67:10,71,-67:10,71,-66:10,71,-65:10,69,-64:10,70,-64:10,71,-64:11,66,-74:11,68,-74:12,66,-74:12,68,-74:13,75,-80:13,76,-80:13,77,-80:13,75,-79:13,75,-78:13,75,-77:13,76,-77:13,77,-77:13,66,-74:13,68,-74:13,69,-74:13,70,-74:13,71,-74:13,72,-74:13,71,-67:13,71,-66:13,71,-65:13,69,-64:13,70,-64:13,71,-64:13,69,-63:13,69,-62:13,69,-61:13,69,-60:13,69,-59:13,69,-58:14,77,-80:14,77,-77:14,66,-74:14,72,-74:14,71,-67:14,69,-58:15,77,-80:15,77,-77:15,66,-74:15,71,-74:15,72,-74:15,69,-67:15,70,-67:15,71,-67:15,69,-58:16,75,-80:16,76,-80:16,77,-80:16,75,-79:16,75,-78:16,75,-77:16,76,-77:16,77,-77:16,66,-74:16,71,-74:16,69,-67:16,69,-58:17,66,-74:17,71,-74:17,69,-67:17,69,-58:18,66,-74:18,71,-74:18,72,-74:18,73,-74:18,69,-67:18,70,-67:18,69,-58:19,74,-79:19,74,-78:19,74,-77:19,66,-74:19,73,-74:19,70,-67:19,67,-62:19,68,-62:19,69,-62:19,69,-61:19,69,-60:19,69,-59:19,69,-58:20,74,-79:20,74,-77:20,66,-74:20,67,-74:20,68,-74:20,69,-74:20,70,-74:20,71,-74:20,72,-74:20,73,-74:20,68,-67:20,69,-67:20,70,-67:20,67,-62:21,72,-79:21,73,-79:21,74,-79:21,72,-78:21,72,-77:21,73,-77:21,74,-77:21,68,-67:21,67,-62:22,68,-67:22,69,-67:22,70,-67:22,70,-66:22,69,-65:22,70,-65:22,69,-64:22,69,-63:22,67,-62:22,68,-62:22,69,-62:";
|
||||||
|
|
||||||
|
ArrayList<Location> locs = new ArrayList<Location>();
|
||||||
|
|
||||||
|
for (String cur : locString.split(":"))
|
||||||
|
{
|
||||||
|
String[] tokens = cur.split(",");
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Location loc = new Location(getWorld(), Integer.parseInt(tokens[0]), Integer.parseInt(tokens[1]), Integer.parseInt(tokens[2]));
|
||||||
|
|
||||||
|
if (InBoundary(loc))
|
||||||
|
locs.add(loc);
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
System.out.println("Invalid Hub Snake Location: " + cur);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
ArrayList<ArrayList<Location>> snakes = new ArrayList<ArrayList<Location>>();
|
||||||
|
|
||||||
|
//Get Blacks
|
||||||
|
Iterator<Location> locIterator = locs.iterator();
|
||||||
|
while (locIterator.hasNext())
|
||||||
|
{
|
||||||
|
Location loc = locIterator.next();
|
||||||
|
|
||||||
|
if (loc.getBlock().getData() != 0)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
ArrayList<Location> newSnake = new ArrayList<Location>();
|
||||||
|
newSnake.add(loc);
|
||||||
|
snakes.add(newSnake);
|
||||||
|
locIterator.remove();
|
||||||
|
}
|
||||||
|
|
||||||
|
//Get Body
|
||||||
|
int partsAdded = 1;
|
||||||
|
while (partsAdded > 0)
|
||||||
|
{
|
||||||
|
partsAdded = 0;
|
||||||
|
|
||||||
|
locIterator = locs.iterator();
|
||||||
|
while (locIterator.hasNext())
|
||||||
|
{
|
||||||
|
Location loc = locIterator.next();
|
||||||
|
|
||||||
|
if (loc.getBlock().getData() == 15)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
for (ArrayList<Location> snake : snakes)
|
||||||
|
{
|
||||||
|
if (UtilMath.offset(loc, snake.get(snake.size() - 1)) != 1)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
snake.add(loc);
|
||||||
|
locIterator.remove();
|
||||||
|
|
||||||
|
partsAdded++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Get Tail
|
||||||
|
try
|
||||||
|
{
|
||||||
|
locIterator = locs.iterator();
|
||||||
|
while (locIterator.hasNext())
|
||||||
|
{
|
||||||
|
Location loc = locIterator.next();
|
||||||
|
|
||||||
|
for (ArrayList<Location> snake : snakes)
|
||||||
|
{
|
||||||
|
if (UtilMath.offset(loc, snake.get(snake.size() - 1)) != 1)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
snake.add(loc);
|
||||||
|
locIterator.remove();
|
||||||
|
|
||||||
|
partsAdded++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
//Write
|
||||||
|
try
|
||||||
|
{
|
||||||
|
File file = new File("SnakeRoutes.dat");
|
||||||
|
if (!file.exists())
|
||||||
|
file.createNewFile();
|
||||||
|
|
||||||
|
FileWriter fw = new FileWriter(file.getAbsoluteFile());
|
||||||
|
BufferedWriter bw = new BufferedWriter(fw);
|
||||||
|
|
||||||
|
for (ArrayList<Location> snake : snakes)
|
||||||
|
{
|
||||||
|
String out = "";
|
||||||
|
|
||||||
|
for (Location loc : snake)
|
||||||
|
out += loc.getBlockX() + "," + loc.getBlockY() + "," + loc.getBlockZ() + ":";
|
||||||
|
|
||||||
|
bw.write(out + "\n\n\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
bw.close();
|
||||||
|
}
|
||||||
|
catch (IOException e)
|
||||||
|
{
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Update()
|
||||||
|
{
|
||||||
|
for (SnakePart snake : _snakes)
|
||||||
|
snake.Update();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,99 @@
|
|||||||
|
package mineplex.hub.modules.parkour;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Iterator;
|
||||||
|
|
||||||
|
import mineplex.core.common.util.MapUtil;
|
||||||
|
import mineplex.core.common.util.UtilBlock;
|
||||||
|
import mineplex.core.common.util.UtilMath;
|
||||||
|
import mineplex.core.common.util.UtilParticle;
|
||||||
|
import mineplex.core.common.util.UtilServer;
|
||||||
|
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||||
|
|
||||||
|
import org.bukkit.Location;
|
||||||
|
import org.bukkit.Material;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
public class SnakePart
|
||||||
|
{
|
||||||
|
private ArrayList<Location> _path = new ArrayList<Location>();
|
||||||
|
private byte _color = 0;
|
||||||
|
|
||||||
|
private int _index = 0;
|
||||||
|
private boolean _colorTick = false;
|
||||||
|
|
||||||
|
private int _pathId = 39;
|
||||||
|
|
||||||
|
public SnakePart(ArrayList<Location> path)
|
||||||
|
{
|
||||||
|
_path = path;
|
||||||
|
|
||||||
|
_color = path.get(1).getBlock().getData();
|
||||||
|
|
||||||
|
for (Location loc : path)
|
||||||
|
MapUtil.QuickChangeBlockAt(loc, 35, _color);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Update()
|
||||||
|
{
|
||||||
|
if (_path.isEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
//Set Block
|
||||||
|
sendBlock(_path.get(_index), 35, GetColor());
|
||||||
|
|
||||||
|
int back = _index - 10;
|
||||||
|
while (back < 0)
|
||||||
|
back += _path.size();
|
||||||
|
|
||||||
|
//Unset Tail
|
||||||
|
sendBlock(_path.get(back), _pathId, (byte) 0);
|
||||||
|
|
||||||
|
//ALT
|
||||||
|
if (_path.size() > 50)
|
||||||
|
{
|
||||||
|
int newIndex = (_index + (_path.size()/2))%_path.size();
|
||||||
|
|
||||||
|
//Set Block
|
||||||
|
sendBlock(_path.get(newIndex), 35, GetColor());
|
||||||
|
|
||||||
|
back = newIndex - 10;
|
||||||
|
if (back < 0)
|
||||||
|
back += _path.size();
|
||||||
|
|
||||||
|
//Unset Tail
|
||||||
|
sendBlock(_path.get(back), _pathId, (byte) 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
_index = (_index+1)%_path.size();
|
||||||
|
_colorTick = !_colorTick;
|
||||||
|
|
||||||
|
/*
|
||||||
|
for (Location loc : _path)
|
||||||
|
if (loc.getBlock().getType() == Material.AIR)
|
||||||
|
UtilParticle.PlayParticle(ParticleType.CRIT, loc, 0, 0, 0, 0, 1);
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sendBlock(Location loc, int id, byte data)
|
||||||
|
{
|
||||||
|
MapUtil.ChunkBlockChange(loc, id, data);
|
||||||
|
|
||||||
|
|
||||||
|
for (Player player : UtilServer.getPlayers())
|
||||||
|
{
|
||||||
|
if (UtilMath.offset(player.getLocation(), loc) < 64)
|
||||||
|
{
|
||||||
|
player.sendBlockChange(loc, Material.getMaterial(id), data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte GetColor()
|
||||||
|
{
|
||||||
|
if (_colorTick)
|
||||||
|
return _color;
|
||||||
|
return _color;
|
||||||
|
}
|
||||||
|
}
|
@ -755,6 +755,7 @@ public class MapParser extends JavaPlugin implements Listener
|
|||||||
player.getInventory().addItem(new ItemStack(Material.STONE_SPADE));
|
player.getInventory().addItem(new ItemStack(Material.STONE_SPADE));
|
||||||
player.getInventory().addItem(new ItemStack(Material.STONE_PICKAXE));
|
player.getInventory().addItem(new ItemStack(Material.STONE_PICKAXE));
|
||||||
player.getInventory().addItem(new ItemStack(Material.STONE_AXE));
|
player.getInventory().addItem(new ItemStack(Material.STONE_AXE));
|
||||||
|
player.getInventory().addItem(new ItemStack(Material.WOOD_AXE));
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
|
@ -8,7 +8,6 @@ import java.util.HashMap;
|
|||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
|
||||||
import mineplex.core.common.util.F;
|
import mineplex.core.common.util.F;
|
||||||
import mineplex.core.common.util.UtilServer;
|
|
||||||
import mineplex.core.common.util.UtilTime;
|
import mineplex.core.common.util.UtilTime;
|
||||||
import mineplex.core.common.util.UtilWorld;
|
import mineplex.core.common.util.UtilWorld;
|
||||||
|
|
||||||
@ -18,7 +17,6 @@ import org.bukkit.World;
|
|||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.block.BlockFace;
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.block.Sign;
|
import org.bukkit.block.Sign;
|
||||||
import org.bukkit.entity.Player;
|
|
||||||
import org.bukkit.material.Wool;
|
import org.bukkit.material.Wool;
|
||||||
|
|
||||||
public class Parse
|
public class Parse
|
||||||
@ -29,7 +27,7 @@ public class Parse
|
|||||||
private String[] _args;
|
private String[] _args;
|
||||||
private Location _callLoc;
|
private Location _callLoc;
|
||||||
|
|
||||||
private int _size = 500;
|
private int _size = 600;
|
||||||
private int _x = 0;
|
private int _x = 0;
|
||||||
private int _y = 0;
|
private int _y = 0;
|
||||||
private int _z = 0;
|
private int _z = 0;
|
||||||
|
@ -4,15 +4,9 @@ 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.*;
|
||||||
import mineplex.core.updater.event.UpdateEvent;
|
import mineplex.core.updater.event.UpdateEvent;
|
||||||
import mineplex.core.updater.UpdateType;
|
import mineplex.core.updater.UpdateType;
|
||||||
import mineplex.core.common.util.C;
|
|
||||||
import mineplex.core.common.util.F;
|
|
||||||
import mineplex.core.common.util.NautHashMap;
|
|
||||||
import mineplex.core.common.util.UtilBlock;
|
|
||||||
import mineplex.core.common.util.UtilPlayer;
|
|
||||||
import mineplex.core.common.util.UtilServer;
|
|
||||||
import mineplex.core.common.util.UtilTime;
|
|
||||||
import mineplex.minecraft.game.core.combat.DeathMessageType;
|
import mineplex.minecraft.game.core.combat.DeathMessageType;
|
||||||
import nautilus.game.arcade.ArcadeFormat;
|
import nautilus.game.arcade.ArcadeFormat;
|
||||||
import nautilus.game.arcade.ArcadeManager;
|
import nautilus.game.arcade.ArcadeManager;
|
||||||
|
Loading…
Reference in New Issue
Block a user