more changes (not really ready for testing yet though...)
This commit is contained in:
parent
b5d1202674
commit
9e92a3a68d
@ -19,7 +19,6 @@ import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Snowman;
|
||||
import org.bukkit.entity.Zombie;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
|
||||
@ -34,7 +33,7 @@ import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.hologram.Hologram;
|
||||
import mineplex.core.hologram.Hologram.HologramTarget;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.game.games.monstermaze.MazeMobWaypoint.CardinalDirection;
|
||||
|
||||
public class Maze implements Listener
|
||||
{
|
||||
@ -43,6 +42,7 @@ public class Maze implements Listener
|
||||
private ArrayList<Location> _map;
|
||||
private ArrayList<Location> _goals;
|
||||
private HashSet<Block> _waypoints;
|
||||
private HashSet<Block> _disabledWaypoints; // TODO x)
|
||||
private ArrayList<Location> _borders;
|
||||
|
||||
private SafePad _safePad = null;
|
||||
@ -101,7 +101,6 @@ public class Maze implements Listener
|
||||
|
||||
private void bump()
|
||||
{
|
||||
if(_ents.size() <= 0) return;
|
||||
//Hit Players
|
||||
for (Player player : Host.GetPlayers(true))
|
||||
{
|
||||
@ -160,19 +159,54 @@ public class Maze implements Listener
|
||||
if (south != null) nextBlock.add(south);
|
||||
if (east != null) nextBlock.add(east);
|
||||
if (west != null) nextBlock.add(west);
|
||||
|
||||
//Random Direction
|
||||
if (!nextBlock.isEmpty())
|
||||
|
||||
if(!nextBlock.isEmpty() && data.getValue().Direction != null) // they can do a uturn if they're stuck
|
||||
{
|
||||
data.getValue().Target = UtilAlg.Random(nextBlock).getLocation().add(0.5, 0, 0.5);
|
||||
UtilEnt.CreatureMove(data.getKey(), data.getValue().Target, 1.4f);
|
||||
if(data.getValue().Direction == CardinalDirection.NORTH)
|
||||
{
|
||||
nextBlock.remove(north);
|
||||
}
|
||||
else if(data.getValue().Direction == CardinalDirection.SOUTH)
|
||||
{
|
||||
nextBlock.remove(south);
|
||||
}
|
||||
else if(data.getValue().Direction == CardinalDirection.WEST)
|
||||
{
|
||||
nextBlock.remove(west);
|
||||
}
|
||||
else if(data.getValue().Direction == CardinalDirection.EAST)
|
||||
{
|
||||
nextBlock.remove(east);
|
||||
}
|
||||
}
|
||||
|
||||
//Random Direction
|
||||
Location nextLoc = UtilAlg.Random(nextBlock).getLocation();
|
||||
data.getValue().Target = nextLoc.clone().add(0.5, 0, 0.5);
|
||||
if(north != null && nextLoc.equals(north))
|
||||
{
|
||||
data.getValue().Direction = CardinalDirection.NORTH;
|
||||
}
|
||||
else if(north != null && nextLoc.equals(south.getLocation()))
|
||||
{
|
||||
data.getValue().Direction = CardinalDirection.SOUTH;
|
||||
}
|
||||
else if(north != null && nextLoc.equals(east.getLocation()))
|
||||
{
|
||||
data.getValue().Direction = CardinalDirection.EAST;
|
||||
}
|
||||
else if(north != null && nextLoc.equals(west.getLocation()))
|
||||
{
|
||||
data.getValue().Direction = CardinalDirection.WEST;
|
||||
}
|
||||
UtilEnt.CreatureMove(data.getKey(), data.getValue().Target, 1.4f);
|
||||
|
||||
}
|
||||
|
||||
if(_safePad != null && _safePad.isOn(data.getKey()))
|
||||
{
|
||||
UtilAction.velocity(data.getKey(), UtilAlg.getTrajectory(data.getKey().getLocation(), _safePad.getLocation()), 1, false, 0, 0.5, 1.2, true);
|
||||
}
|
||||
// if(_safePad != null && _safePad.isOn(data.getKey()))
|
||||
// {
|
||||
// UtilAction.velocity(data.getKey(), UtilAlg.getTrajectory(data.getKey().getLocation(), _safePad.getLocation()), 1, false, 0, 0.5, 1.2, true);
|
||||
// }
|
||||
|
||||
//Timeout Move
|
||||
if (UtilMath.offset(data.getKey().getLocation(), data.getValue().Last) > 0.1)
|
||||
@ -210,6 +244,25 @@ public class Maze implements Listener
|
||||
return cur;
|
||||
}
|
||||
|
||||
/*
|
||||
* [11:28:29 ERROR]: Could not pass event UpdateEvent to Arcade v0.1
|
||||
org.bukkit.event.EventException
|
||||
at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:302) ~[craftbukkit.jar:git-Spigot-1.7.9-R0.2-205-gb748d57]
|
||||
at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62) ~[craftbukkit.jar:git-Spigot-1.7.9-R0.2-205-gb748d57]
|
||||
at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManager.java:514) [craftbukkit.jar:git-Spigot-1.7.9-R0.2-205-gb748d57]
|
||||
at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:499) [craftbukkit.jar:git-Spigot-1.7.9-R0.2-205-gb748d57]
|
||||
at mineplex.core.updater.Updater.run(Updater.java:24) [Arcade.jar:?]
|
||||
at org.bukkit.craftbukkit.v1_7_R4.scheduler.CraftTask.run(CraftTask.java:71) [craftbukkit.jar:git-Spigot-1.7.9-R0.2-205-gb748d57]
|
||||
at org.bukkit.craftbukkit.v1_7_R4.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:350) [craftbukkit.jar:git-Spigot-1.7.9-R0.2-205-gb748d57]
|
||||
at net.minecraft.server.v1_7_R4.MinecraftServer.v(MinecraftServer.java:641) [craftbukkit.jar:git-Spigot-1.7.9-R0.2-205-gb748d57]
|
||||
at net.minecraft.server.v1_7_R4.DedicatedServer.v(DedicatedServer.java:275) [craftbukkit.jar:git-Spigot-1.7.9-R0.2-205-gb748d57]
|
||||
at net.minecraft.server.v1_7_R4.MinecraftServer.u(MinecraftServer.java:584) [craftbukkit.jar:git-Spigot-1.7.9-R0.2-205-gb748d57]
|
||||
at net.minecraft.server.v1_7_R4.MinecraftServer.run(MinecraftServer.java:490) [craftbukkit.jar:git-Spigot-1.7.9-R0.2-205-gb748d57]
|
||||
at net.minecraft.server.v1_7_R4.ThreadServerApplication.run(SourceFile:628) [craftbukkit.jar:git-Spigot-1.7.9-R0.2-205-gb748d57]
|
||||
Caused by: java.lang.NullPointerException
|
||||
|
||||
*/
|
||||
|
||||
public void spawn()
|
||||
{
|
||||
//Spawn
|
||||
@ -249,6 +302,11 @@ public class Maze implements Listener
|
||||
_safePad = new SafePad(Host, this, UtilAlg.Random(_goals).clone().subtract(0,1,0));
|
||||
_safePad.build();
|
||||
UtilFirework.playFirework(_safePad.getLocation(), FireworkEffect.builder().withColor(Color.LIME).build());
|
||||
Location holoLoc = _safePad.getLocation().clone();
|
||||
holoLoc.add(0, 2, 0);
|
||||
_holo = new Hologram(Host.getArcadeManager().getHologramManager(), holoLoc, C.cAqua + C.Bold + "SAFE PAD!");
|
||||
_holo.setHologramTarget(HologramTarget.BLACKLIST);
|
||||
_holo.start();
|
||||
_phaseTimer = 11;
|
||||
return;
|
||||
}
|
||||
@ -309,8 +367,8 @@ public class Maze implements Listener
|
||||
_safePad.build();
|
||||
UtilFirework.playFirework(_safePad.getLocation(), FireworkEffect.builder().withColor(Color.LIME).build());
|
||||
Location holoLoc = _safePad.getLocation().clone();
|
||||
holoLoc.add(0, 1.5, 0);
|
||||
_holo = new Hologram(Host.getArcadeManager().getHologramManager(), holoLoc, C.cAqua + C.Bold + "SAFE PAD");
|
||||
holoLoc.add(0, 2, 0);
|
||||
_holo = new Hologram(Host.getArcadeManager().getHologramManager(), holoLoc, C.cAqua + C.Bold + "SAFE PAD!");
|
||||
_holo.setHologramTarget(HologramTarget.BLACKLIST);
|
||||
_holo.start();
|
||||
// for(Block b : _waypoints)
|
||||
|
@ -7,6 +7,7 @@ public class MazeMobWaypoint
|
||||
public Location Last;
|
||||
public Location Target;
|
||||
public long Time;
|
||||
public CardinalDirection Direction;
|
||||
|
||||
public MazeMobWaypoint(Location last)
|
||||
{
|
||||
@ -14,4 +15,9 @@ public class MazeMobWaypoint
|
||||
Target = null;
|
||||
Time = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
public enum CardinalDirection
|
||||
{
|
||||
NORTH, SOUTH, EAST, WEST // such order much not care
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user