Hub refactor

Hub parkour module
This commit is contained in:
Chiss 2013-09-18 19:46:45 +10:00
parent ae00d3df18
commit 91ce36d6e4
16 changed files with 689 additions and 259 deletions

View File

@ -228,6 +228,30 @@
</jar> </jar>
<copy file="../bin/MineKart.jar" todir="../../Testing/MineKart/plugins"/> <copy file="../bin/MineKart.jar" todir="../../Testing/MineKart/plugins"/>
</target> </target>
<target name ="MagicMC" description="MagicMC">
<jar jarfile="../bin/MagicMC.jar">
<fileset dir="../MagicMC/bin">
<include name="**/*.class"/>
</fileset>
<fileset dir="../Mineplex.Core.Common/bin">
<include name="**/*.class"/>
</fileset>
<fileset dir="../MagicMC">
<include name="*.yml"/>
</fileset>
<zipfileset src="../Libraries/httpclient-4.2.jar" />
<zipfileset src="../Libraries/httpcore-4.2.jar" />
<zipfileset src="../Libraries/httpclient-cache-4.2.jar" />
<zipfileset src="../Libraries/httpmime-4.2.jar" />
<zipfileset src="../Libraries/gson-2.2.1.jar" />
<zipfileset src="../Libraries/commons-logging-1.1.1.jar" />
<zipfileset src="../Libraries/commons-codec-1.6.jar" />
</jar>
<copy file="../bin/MagicMC.jar" todir="../../Testing/MagicMC/plugins"/>
</target>
<target name="NautilusCraftBukkit2" description="NautilusCraftBukkit2"> <target name="NautilusCraftBukkit2" description="NautilusCraftBukkit2">
<mkdir dir="../bin/craftbukkit_temp" /> <mkdir dir="../bin/craftbukkit_temp" />
<delete file="../bin/craftbukkit.jar" /> <delete file="../bin/craftbukkit.jar" />

View File

@ -79,7 +79,6 @@ public class Hub extends JavaPlugin implements INautilusPlugin, IRelation
Portal portal = new Portal(this); Portal portal = new Portal(this);
PartyManager partyManager = new PartyManager(this, clientManager); PartyManager partyManager = new PartyManager(this, clientManager);
new HubManager(this, clientManager, donationManager, new DisguiseManager(this, packetHandler), new TaskManager(this, GetWebServerAddress()), portal, partyManager); new HubManager(this, clientManager, donationManager, new DisguiseManager(this, packetHandler), new TaskManager(this, GetWebServerAddress()), portal, partyManager);
new Stacker(this);
new ServerManager(this, clientManager, donationManager, portal, partyManager, new ServerStatusManager(this, new LagMeter(this, clientManager))); new ServerManager(this, clientManager, donationManager, portal, partyManager, new ServerStatusManager(this, new LagMeter(this, clientManager)));
new Chat(this, clientManager); new Chat(this, clientManager);
new MemoryFix(this); new MemoryFix(this);

View File

@ -8,44 +8,27 @@ import java.io.FileInputStream;
import java.io.FileWriter; import java.io.FileWriter;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Effect;
import org.bukkit.GameMode; import org.bukkit.GameMode;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.block.BlockFace;
import org.bukkit.craftbukkit.v1_6_R2.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_6_R2.entity.CraftPlayer;
import org.bukkit.entity.Chicken;
import org.bukkit.entity.Cow;
import org.bukkit.entity.Egg; import org.bukkit.entity.Egg;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Pig;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.entity.Sheep;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.block.BlockSpreadEvent;
import org.bukkit.event.block.LeavesDecayEvent;
import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.entity.ItemSpawnEvent; import org.bukkit.event.entity.ItemSpawnEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.inventory.InventoryType; import org.bukkit.event.inventory.InventoryType;
import org.bukkit.event.player.AsyncPlayerChatEvent; import org.bukkit.event.player.AsyncPlayerChatEvent;
import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerDropItemEvent;
import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerPickupItemEvent;
import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.player.PlayerRespawnEvent; import org.bukkit.event.player.PlayerRespawnEvent;
import org.bukkit.event.player.PlayerToggleFlightEvent;
import org.bukkit.event.server.ServerListPingEvent; import org.bukkit.event.server.ServerListPingEvent;
import org.bukkit.event.world.ChunkLoadEvent; import org.bukkit.event.world.ChunkLoadEvent;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
@ -58,9 +41,6 @@ import mineplex.core.account.CoreClientManager;
import mineplex.core.common.Rank; import mineplex.core.common.Rank;
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.UtilAction;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
@ -73,8 +53,7 @@ import mineplex.core.portal.Portal;
import mineplex.core.task.TaskManager; 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.modules.MapManager; import mineplex.hub.modules.*;
import mineplex.hub.modules.MountManager;
import mineplex.hub.party.Party; import mineplex.hub.party.Party;
import mineplex.hub.party.PartyManager; import mineplex.hub.party.PartyManager;
import mineplex.hub.tutorial.TutorialManager; import mineplex.hub.tutorial.TutorialManager;
@ -89,7 +68,8 @@ public class HubManager extends MiniClientPlugin<HubClient>
private TutorialManager _tutorialManager; private TutorialManager _tutorialManager;
private TextCreator _textCreator; private TextManager _textCreator;
private ParkourManager _parkour;
private Location _spawn; private Location _spawn;
private int _scoreboardTick = 0; private int _scoreboardTick = 0;
@ -103,7 +83,6 @@ public class HubManager extends MiniClientPlugin<HubClient>
private boolean _shuttingDown; private boolean _shuttingDown;
private HashSet<LivingEntity> _mobs = new HashSet<LivingEntity>();
public HubManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, DisguiseManager disguiseManager, TaskManager taskManager, Portal portal, PartyManager partyManager) public HubManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, DisguiseManager disguiseManager, TaskManager taskManager, Portal portal, PartyManager partyManager)
{ {
@ -116,11 +95,14 @@ public class HubManager extends MiniClientPlugin<HubClient>
_spawn = new Location(UtilWorld.getWorld("world"), 0.5, 74, 0.5); _spawn = new Location(UtilWorld.getWorld("world"), 0.5, 74, 0.5);
_textCreator = new TextCreator(this); _textCreator = new TextManager(this);
_parkour = new ParkourManager(this, donationManager, taskManager);
new Dragon(this);
new MountManager(this); new MountManager(this);
new MapManager(this); new MapManager(this);
new WorldManager(this);
new JumpManager(this);
new StackerManager(this);
_partyManager = partyManager; _partyManager = partyManager;
_tutorialManager = new TutorialManager(this, donationManager, taskManager, _textCreator); _tutorialManager = new TutorialManager(this, donationManager, taskManager, _textCreator);
@ -371,111 +353,18 @@ public class HubManager extends MiniClientPlugin<HubClient>
{ {
if (event.getCause() == DamageCause.VOID) if (event.getCause() == DamageCause.VOID)
if (event.getEntity() instanceof Player) if (event.getEntity() instanceof Player)
{
event.getEntity().eject();
event.getEntity().leaveVehicle();
event.getEntity().teleport(GetSpawn()); event.getEntity().teleport(GetSpawn());
}
else else
event.getEntity().remove(); event.getEntity().remove();
event.setCancelled(true); event.setCancelled(true);
} }
@EventHandler(priority = EventPriority.LOW)
public void ItemPickup(PlayerPickupItemEvent event)
{
if (event.getPlayer().getGameMode() == GameMode.CREATIVE)
return;
event.setCancelled(true);
}
@EventHandler(priority = EventPriority.LOW)
public void ItemDrop(PlayerDropItemEvent event)
{
if (event.getPlayer().getGameMode() == GameMode.CREATIVE)
return;
event.setCancelled(true);
}
@EventHandler
public void BlockBreak(BlockBreakEvent event)
{
if (event.getPlayer().getGameMode() == GameMode.CREATIVE)
return;
event.setCancelled(true);
}
@EventHandler
public void LeaveDecay(LeavesDecayEvent event)
{
event.setCancelled(true);
}
@EventHandler
public void BlockPlace(BlockPlaceEvent event)
{
if (event.getPlayer().getGameMode() == GameMode.CREATIVE)
return;
event.setCancelled(true);
}
@EventHandler
public void FlightHop(PlayerToggleFlightEvent event)
{
Player player = event.getPlayer();
if (player.getGameMode() == GameMode.CREATIVE)
return;
event.setCancelled(true);
player.setFlying(false);
//Disable Flight
player.setAllowFlight(false);
//Velocity
UtilAction.velocity(player, 1.4, 0.2, 1, true);
//Sound
player.playEffect(player.getLocation(), Effect.BLAZE_SHOOT, 0);
}
@EventHandler
public void FlightUpdate(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
for (Player player : UtilServer.getPlayers())
{
if (player.getGameMode() == GameMode.CREATIVE)
continue;
if (UtilEnt.isGrounded(player) || UtilBlock.solid(player.getLocation().getBlock().getRelative(BlockFace.DOWN)))
{
player.setAllowFlight(true);
player.setFlying(false);
}
}
}
@EventHandler
public void BorderUpdate(UpdateEvent event)
{
if (event.getType() != UpdateType.SEC)
return;
for (Player player : UtilServer.getPlayers())
{
if (UtilMath.offset(player.getLocation(), GetSpawn()) > 200)
{
player.eject();
player.leaveVehicle();
player.teleport(GetSpawn());
}
}
}
@EventHandler @EventHandler
public void FoodHealthUpdate(UpdateEvent event) public void FoodHealthUpdate(UpdateEvent event)
@ -489,17 +378,6 @@ public class HubManager extends MiniClientPlugin<HubClient>
player.setFoodLevel(20); player.setFoodLevel(20);
} }
} }
@EventHandler
public void UpdateWeather(UpdateEvent event)
{
if (event.getType() != UpdateType.SEC)
return;
World world = UtilWorld.getWorld("world");
world.setTime(6000);
world.setStorm(false);
}
@EventHandler @EventHandler
public void UpdateScoreboard(UpdateEvent event) public void UpdateScoreboard(UpdateEvent event)
@ -655,6 +533,11 @@ public class HubManager extends MiniClientPlugin<HubClient>
{ {
return _donationManager; return _donationManager;
} }
public ParkourManager GetParkour()
{
return _parkour;
}
public Location GetSpawn() public Location GetSpawn()
{ {
@ -674,7 +557,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
if (player.equals(other)) if (player.equals(other))
continue; continue;
if (UtilMath.offset(player.getLocation(), GetSpawn()) < 4 || _tutorialManager.InTutorial(other) || _tutorialManager.InTutorial(player) || player.getOpenInventory().getType() != InventoryType.CRAFTING) if (UtilMath.offset(player.getLocation(), GetSpawn()) < 4 || _tutorialManager.InTutorial(other) || _tutorialManager.InTutorial(player) || (player.getOpenInventory().getType() != InventoryType.CRAFTING && player.getOpenInventory().getType() != InventoryType.CREATIVE))
{ {
((CraftPlayer)other).hidePlayer(player, true, false); ((CraftPlayer)other).hidePlayer(player, true, false);
} }
@ -685,57 +568,4 @@ public class HubManager extends MiniClientPlugin<HubClient>
} }
} }
} }
@EventHandler
public void SpawnAnimals(UpdateEvent event)
{
if (event.getType() != UpdateType.SLOW)
return;
Iterator<LivingEntity> entIterator = _mobs.iterator();
while (entIterator.hasNext())
{
LivingEntity ent = entIterator.next();
if (!ent.isValid())
{
ent.remove();
entIterator.remove();
}
}
if (_mobs.size() > 24)
return;
//Loc
double r = Math.random();
Location loc = GetSpawn();
if (r > 0.75) loc.add(32, 0.5, 0);
else if (r > 0.5) loc.add(0, 0.5, 32);
else if (r > 0.25) loc.add(-32, 0.5, 0);
else loc.add(0, 0.5, -32);
//Spawn
r = Math.random();
if (r > 0.75) _mobs.add(loc.getWorld().spawn(loc, Cow.class));
else if (r > 0.5) _mobs.add(loc.getWorld().spawn(loc, Pig.class));
else if (r > 0.25) _mobs.add(loc.getWorld().spawn(loc, Sheep.class));
else _mobs.add(loc.getWorld().spawn(loc, Chicken.class));
}
@EventHandler(priority = EventPriority.LOWEST)
public void Explosion(EntityExplodeEvent event)
{
event.blockList().clear();
}
@EventHandler
public void VineGrow(BlockSpreadEvent event)
{
event.setCancelled(true);
}
} }

View File

@ -0,0 +1,82 @@
package mineplex.hub.modules;
import org.bukkit.Effect;
import org.bukkit.GameMode;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerToggleFlightEvent;
import org.bukkit.util.Vector;
import mineplex.core.MiniPlugin;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.hub.HubManager;
public class JumpManager extends MiniPlugin
{
public HubManager Manager;
public JumpManager(HubManager manager)
{
super("Double Jump", manager.GetPlugin());
Manager = manager;
}
@EventHandler
public void FlightHop(PlayerToggleFlightEvent event)
{
Player player = event.getPlayer();
if (player.getGameMode() == GameMode.CREATIVE)
return;
event.setCancelled(true);
player.setFlying(false);
//Disable Flight
player.setAllowFlight(false);
//Parkour Disable
if (Manager.GetParkour().InParkour(player))
{
UtilPlayer.message(player, F.main("Parkour", "You cannot Double Jump near Parkour Challenges."));
player.setVelocity(new Vector(0,0,0));
player.teleport(player.getLocation());
return;
}
//Velocity
UtilAction.velocity(player, 1.4, 0.2, 1, true);
//Sound
player.playEffect(player.getLocation(), Effect.BLAZE_SHOOT, 0);
}
@EventHandler
public void FlightUpdate(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
for (Player player : UtilServer.getPlayers())
{
if (player.getGameMode() == GameMode.CREATIVE)
continue;
if (UtilEnt.isGrounded(player) || UtilBlock.solid(player.getLocation().getBlock().getRelative(BlockFace.DOWN)))
{
player.setAllowFlight(true);
player.setFlying(false);
}
}
}
}

View File

@ -0,0 +1,39 @@
package mineplex.hub.modules;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
import org.bukkit.Location;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
public class ParkourData
{
public String Name;
public String[] Desc;
public int Gems;
public Location Location;
public double Distance;
public ParkourData(String name, String[] desc, int gems, Location loc, double dist)
{
Name = name;
Desc = desc;
Gems = gems;
Location = loc;
Distance = dist;
}
public void Inform(Player player)
{
//Inform
UtilPlayer.message(player, F.main("Parkour", "Welcome to the " + F.elem(Name) + " course."));
for (String cur : Desc)
{
UtilPlayer.message(player, " " + cur);
}
player.playSound(player.getLocation(), Sound.ORB_PICKUP, 1f, 2f);
}
}

View File

@ -0,0 +1,236 @@
package mineplex.hub.modules;
import java.util.HashSet;
import java.util.WeakHashMap;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.PlayerInteractEntityEvent;
import mineplex.core.MiniPlugin;
import mineplex.core.common.util.C;
import mineplex.core.common.util.Callback;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.donation.DonationManager;
import mineplex.core.recharge.Recharge;
import mineplex.core.task.TaskManager;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.hub.HubManager;
public class ParkourManager extends MiniPlugin
{
public HubManager Manager;
private HashSet<ParkourData> _parkour = new HashSet<ParkourData>();
private Location _lavaParkourReturn;
private WeakHashMap<Player, Location> _lavaLocation = new WeakHashMap<Player, Location>();
private WeakHashMap<Player, Long> _lavaTimer = new WeakHashMap<Player, Long>();
//Modules
protected DonationManager _donationManager;
protected TaskManager _taskManager;
public ParkourManager(HubManager manager, DonationManager donation, TaskManager task)
{
super("Parkour", manager.GetPlugin());
Manager = manager;
_taskManager = task;
_donationManager = donation;
_parkour.add(new ParkourData("Ruins Parkour", new String[]
{
"This is an extremely difficult parkour.",
"You will need to find the correct way through",
"the ruins, overcoming many challenging jumps.",
},
4000, new Location(Manager.GetSpawn().getWorld(), 115,70,-10), 50));
_parkour.add(new ParkourData("Lava Parkour", new String[]
{
"This parkour is HOT! It's so hot that you",
"must keep sprinting for the entire course,",
"or you will die in flames!"
}, 1000, new Location(Manager.GetSpawn().getWorld(), -100,60,0), 50));
_lavaParkourReturn = new Location(Manager.GetSpawn().getWorld(), -89.5,68,36.5);
_lavaParkourReturn.setYaw(90);
}
public boolean InParkour(Player player)
{
for (ParkourData data : _parkour)
{
if (UtilMath.offset(player.getLocation(), data.Location) < data.Distance)
{
return true;
}
}
return false;
}
@EventHandler
public void BlockBreak(BlockBreakEvent event)
{
if (InParkour(event.getPlayer()))
{
event.getPlayer().teleport(Manager.GetSpawn());
UtilPlayer.message(event.getPlayer(), F.main("Parkour", "You cannot break blocks near parkour!"));
}
}
@EventHandler
public void LavaReturn(EntityDamageEvent event)
{
if (event.getCause() == DamageCause.LAVA)
if (event.getEntity() instanceof Player)
{
event.getEntity().eject();
event.getEntity().leaveVehicle();
event.getEntity().teleport(_lavaParkourReturn);
event.getEntity().setFireTicks(0);
}
else
event.getEntity().remove();
event.setCancelled(true);
}
@EventHandler
public void LavaBlockReturn(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
for (Player player : UtilServer.getPlayers())
{
if (!UtilEnt.isGrounded(player))
continue;
int id = player.getLocation().getBlock().getRelative(BlockFace.DOWN).getTypeId();
if (id != 0 && id != 112)
continue;
if (!_lavaLocation.containsKey(player) || UtilMath.offset(player.getLocation(), _lavaLocation.get(player)) > 1.5)
{
_lavaLocation.put(player, player.getLocation());
_lavaTimer.put(player, System.currentTimeMillis());
continue;
}
if (UtilTime.elapsed(_lavaTimer.get(player), 500))
{
boolean inCourse = false;
for (Block block : UtilBlock.getInRadius(player.getLocation(), 1.5).keySet())
{
if (block.getType() == Material.NETHER_BRICK)
{
inCourse = true;
break;
}
}
if (!inCourse)
continue;
_lavaLocation.remove(player);
_lavaTimer.remove(player);
player.eject();
player.leaveVehicle();
player.teleport(_lavaParkourReturn);
player.setFireTicks(0);
UtilPlayer.message(player, F.main("Parkour", "You cannot stop running during Lava Parkour!"));
}
}
}
@EventHandler
public void Finish(PlayerInteractEntityEvent event)
{
if (event.getRightClicked() == null)
return;
if (!(event.getRightClicked() instanceof LivingEntity))
return;
LivingEntity ent = (LivingEntity)event.getRightClicked();
if (ent.getCustomName() == null)
return;
//Start Message
if (ent.getCustomName().contains("Start"))
{
Player player = event.getPlayer();
for (ParkourData data : _parkour)
{
if (!ent.getCustomName().contains(data.Name))
continue;
data.Inform(player);
}
}
//Finish Message
if (ent.getCustomName().contains("Finish"))
{
final Player player = event.getPlayer();
if (Recharge.Instance.use(player, "Finish Parkour", 30000, false))
return;
for (ParkourData data : _parkour)
{
if (!ent.getCustomName().contains(data.Name))
continue;
//Inform
UtilPlayer.message(player, F.main("Parkour", "You completed " + F.elem(data.Name) + "."));
//Gems
if (!_taskManager.hasCompletedTask(player, data.Name))
{
final ParkourData fData = data;
_donationManager.RewardGems(new Callback<Boolean>()
{
public void run(Boolean completed)
{
UtilPlayer.message(player, F.main("Parkour", "You received " + F.elem(C.cGreen + fData.Gems + " Gems") + "."));
_taskManager.completedTask(player, fData.Name);
//Sound
player.playSound(player.getLocation(), Sound.LEVEL_UP, 2f, 1.5f);
}
}, player.getName(), data.Gems);
}
}
}
}
}

View File

@ -1,4 +1,4 @@
package mineplex.hub; package mineplex.hub.modules;
import java.util.HashSet; import java.util.HashSet;
@ -15,7 +15,6 @@ import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
import mineplex.core.MiniPlugin; import mineplex.core.MiniPlugin;
@ -33,103 +32,115 @@ import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.projectile.IThrown; import mineplex.core.projectile.IThrown;
import mineplex.core.projectile.ProjectileManager; import mineplex.core.projectile.ProjectileManager;
import mineplex.core.projectile.ProjectileUser; import mineplex.core.projectile.ProjectileUser;
import mineplex.hub.HubManager;
public class Stacker extends MiniPlugin implements IThrown public class StackerManager extends MiniPlugin implements IThrown
{ {
public HubManager Manager;
private ProjectileManager _projectileManager; private ProjectileManager _projectileManager;
private HashSet<String> _disabled = new HashSet<String>(); private HashSet<String> _disabled = new HashSet<String>();
private HashSet<Entity> _tempStackShift = new HashSet<Entity>(); private HashSet<Entity> _tempStackShift = new HashSet<Entity>();
public Stacker(JavaPlugin plugin) public StackerManager(HubManager manager)
{ {
super("Stacker", plugin); super("Stacker", manager.GetPlugin());
_projectileManager = new ProjectileManager(plugin); Manager = manager;
_projectileManager = new ProjectileManager(manager.GetPlugin());
} }
@EventHandler @EventHandler
public void ToggleInvolvement(PlayerInteractEvent event) public void ToggleInvolvement(PlayerInteractEvent event)
{ {
Player player = event.getPlayer(); Player player = event.getPlayer();
if (UtilGear.isMat(player.getItemInHand(), Material.GRILLED_PORK)) if (UtilGear.isMat(player.getItemInHand(), Material.GRILLED_PORK))
{ {
_disabled.add(player.getName()); _disabled.add(player.getName());
UtilPlayer.message(player, F.main("Stacker", "You are no longer stackable... boring...")); UtilPlayer.message(player, F.main("Stacker", "You are no longer stackable... boring..."));
player.getInventory().setItem(4, ItemStackFactory.Instance.CreateStack(Material.PORK, (byte)0, 1, C.cGreen + "Enable Stacker")); player.getInventory().setItem(4, ItemStackFactory.Instance.CreateStack(Material.PORK, (byte)0, 1, C.cGreen + "Enable Stacker"));
UtilInv.Update(player); UtilInv.Update(player);
event.setCancelled(true); event.setCancelled(true);
} }
else if (UtilGear.isMat(player.getItemInHand(), Material.PORK)) else if (UtilGear.isMat(player.getItemInHand(), Material.PORK))
{ {
_disabled.remove(player.getName()); _disabled.remove(player.getName());
UtilPlayer.message(player, F.main("Stacker", "You are back in the stacking games! Squeeeee!")); UtilPlayer.message(player, F.main("Stacker", "You are back in the stacking games! Squeeeee!"));
player.getInventory().setItem(4, ItemStackFactory.Instance.CreateStack(Material.GRILLED_PORK, (byte)0, 1, C.cRed + "Disable Stacker")); player.getInventory().setItem(4, ItemStackFactory.Instance.CreateStack(Material.GRILLED_PORK, (byte)0, 1, C.cRed + "Disable Stacker"));
UtilInv.Update(player); UtilInv.Update(player);
event.setCancelled(true); event.setCancelled(true);
} }
} }
@EventHandler @EventHandler
public void PlayerJoin(PlayerJoinEvent event) public void PlayerJoin(PlayerJoinEvent event)
{ {
event.getPlayer().getInventory().setItem(4, ItemStackFactory.Instance.CreateStack(Material.GRILLED_PORK, (byte)0, 1, C.cRed + "Disable Stacker")); event.getPlayer().getInventory().setItem(4, ItemStackFactory.Instance.CreateStack(Material.GRILLED_PORK, (byte)0, 1, C.cRed + "Disable Stacker"));
} }
@EventHandler @EventHandler
public void PlayerQuit(PlayerQuitEvent event) public void PlayerQuit(PlayerQuitEvent event)
{ {
_disabled.remove(event.getPlayer().getName()); _disabled.remove(event.getPlayer().getName());
_tempStackShift.remove(event.getPlayer()); _tempStackShift.remove(event.getPlayer());
} }
@EventHandler @EventHandler
public void GrabEntity(PlayerInteractEntityEvent event) public void GrabEntity(PlayerInteractEntityEvent event)
{ {
if (event.isCancelled()) if (event.isCancelled())
return; return;
Player stacker = event.getPlayer(); Player stacker = event.getPlayer();
if (stacker.getGameMode() != GameMode.SURVIVAL) if (stacker.getGameMode() != GameMode.SURVIVAL)
return; return;
//Parkour Disable
if (Manager.GetParkour().InParkour(stacker))
{
UtilPlayer.message(stacker, F.main("Parkour", "You cannot Stack/Throw near Parkour Challenges."));
return;
}
if (_disabled.contains(stacker.getName())) if (_disabled.contains(stacker.getName()))
{ {
UtilPlayer.message(stacker, F.main("Stacker", "You are not playing stacker.")); UtilPlayer.message(stacker, F.main("Stacker", "You are not playing stacker."));
return; return;
} }
if (stacker.getVehicle() != null || _tempStackShift.contains(stacker)) if (stacker.getVehicle() != null || _tempStackShift.contains(stacker))
{ {
UtilPlayer.message(stacker, F.main("Stacker", "You cannot stack while stacked...")); UtilPlayer.message(stacker, F.main("Stacker", "You cannot stack while stacked..."));
return; return;
} }
Entity stackee = event.getRightClicked(); Entity stackee = event.getRightClicked();
if (stackee == null) if (stackee == null)
return; return;
if (!(stackee instanceof LivingEntity)) if (!(stackee instanceof LivingEntity))
return; return;
if (stackee instanceof Horse) if (stackee instanceof Horse)
return; return;
if (stackee instanceof Player && ((Player)stackee).getGameMode() != GameMode.SURVIVAL) if (stackee instanceof Player && ((Player)stackee).getGameMode() != GameMode.SURVIVAL)
return; return;
if (stackee instanceof Player && _disabled.contains(((Player)stackee).getName())) if (stackee instanceof Player && _disabled.contains(((Player)stackee).getName()))
{ {
UtilPlayer.message(stacker, F.main("Stacker", F.name(UtilEnt.getName(stackee)) + " is not playing stacker.")); UtilPlayer.message(stacker, F.main("Stacker", F.name(UtilEnt.getName(stackee)) + " is not playing stacker."));
return; return;
} }
if (stackee instanceof LivingEntity) if (stackee instanceof LivingEntity)
{ {
if (((LivingEntity)stackee).isCustomNameVisible()) if (((LivingEntity)stackee).isCustomNameVisible())
@ -138,54 +149,54 @@ public class Stacker extends MiniPlugin implements IThrown
return; return;
} }
} }
while (stackee.getVehicle() != null) while (stackee.getVehicle() != null)
stackee = stackee.getVehicle(); stackee = stackee.getVehicle();
if (stackee.equals(stacker)) if (stackee.equals(stacker))
return; return;
Entity top = stacker; Entity top = stacker;
while (top.getPassenger() != null) while (top.getPassenger() != null)
top = top.getPassenger(); top = top.getPassenger();
top.setPassenger(stackee); top.setPassenger(stackee);
UtilPlayer.message(stacker, F.main("Stacker", "You stacked " + F.name(UtilEnt.getName(stackee) + "."))); UtilPlayer.message(stacker, F.main("Stacker", "You stacked " + F.name(UtilEnt.getName(stackee) + ".")));
UtilPlayer.message(stackee, F.main("Stacker", "You were stacked by " + F.name(stacker.getName() + "."))); UtilPlayer.message(stackee, F.main("Stacker", "You were stacked by " + F.name(stacker.getName() + ".")));
UtilPlayer.message(stackee, F.main("Stacker", "Push " + F.skill("Crouch") + " to escape!")); UtilPlayer.message(stackee, F.main("Stacker", "Push " + F.skill("Crouch") + " to escape!"));
event.setCancelled(true); event.setCancelled(true);
} }
@EventHandler @EventHandler
public void ThrowEntity(PlayerInteractEvent event) public void ThrowEntity(PlayerInteractEvent event)
{ {
if (!UtilEvent.isAction(event, ActionType.L)) if (!UtilEvent.isAction(event, ActionType.L))
return; return;
Player thrower = event.getPlayer(); Player thrower = event.getPlayer();
if (thrower.getVehicle() != null) if (thrower.getVehicle() != null)
return; return;
Entity throwee = thrower.getPassenger(); Entity throwee = thrower.getPassenger();
if (throwee == null) if (throwee == null)
return; return;
thrower.eject(); thrower.eject();
Entity throweeStack = throwee.getPassenger(); Entity throweeStack = throwee.getPassenger();
if (throweeStack != null) if (throweeStack != null)
{ {
throwee.eject(); throwee.eject();
throweeStack.leaveVehicle(); throweeStack.leaveVehicle();
final Entity fThrower = thrower; final Entity fThrower = thrower;
final Entity fThroweeStack = throweeStack; final Entity fThroweeStack = throweeStack;
_tempStackShift.add(throweeStack); _tempStackShift.add(throweeStack);
GetPlugin().getServer().getScheduler().scheduleSyncDelayedTask(GetPlugin(), new Runnable() GetPlugin().getServer().getScheduler().scheduleSyncDelayedTask(GetPlugin(), new Runnable()
{ {
public void run() public void run()
@ -195,21 +206,29 @@ public class Stacker extends MiniPlugin implements IThrown
} }
}, 2); }, 2);
} }
//Parkour Disable
if (Manager.GetParkour().InParkour(thrower))
{
UtilPlayer.message(thrower, F.main("Parkour", "You cannot Stack/Throw near Parkour Challenges."));
UtilPlayer.message(throwee, F.main("Parkour", "You cannot Stack/Throw near Parkour Challenges."));
return;
}
UtilPlayer.message(thrower, F.main("Stacker", "You threw " + F.name(UtilEnt.getName(throwee)))); UtilPlayer.message(thrower, F.main("Stacker", "You threw " + F.name(UtilEnt.getName(throwee))));
UtilPlayer.message(throwee, F.main("Stacker", "You were thrown by " + F.name(thrower.getName()))); UtilPlayer.message(throwee, F.main("Stacker", "You were thrown by " + F.name(thrower.getName())));
UtilAction.velocity(throwee, thrower.getLocation().getDirection(), 1.8, false, 0, 0.3, 2, false); UtilAction.velocity(throwee, thrower.getLocation().getDirection(), 1.8, false, 0, 0.3, 2, false);
_projectileManager.AddThrow(throwee, thrower, this, -1, true, false, true, false, 2.4d); _projectileManager.AddThrow(throwee, thrower, this, -1, true, false, true, false, 2.4d);
} }
@Override @Override
public void Collide(LivingEntity target, Block block, ProjectileUser data) public void Collide(LivingEntity target, Block block, ProjectileUser data)
{ {
if (target == null) if (target == null)
return; return;
//Velocity //Velocity
UtilAction.velocity(target, UtilAlg.getTrajectory2d(data.GetThrown(), target), 1, true, 0.8, 0, 10, true); UtilAction.velocity(target, UtilAlg.getTrajectory2d(data.GetThrown(), target), 1, true, 0.8, 0, 10, true);
@ -220,9 +239,9 @@ public class Stacker extends MiniPlugin implements IThrown
rider.setVelocity(new Vector(0.25 - Math.random()/2, Math.random()/2, 0.25 - Math.random()/2)); rider.setVelocity(new Vector(0.25 - Math.random()/2, Math.random()/2, 0.25 - Math.random()/2));
rider = rider.getPassenger(); rider = rider.getPassenger();
} }
UtilPlayer.message(target, F.main("Stacker", F.name(UtilEnt.getName(data.GetThrower())) + " hit you with " + F.name(UtilEnt.getName(data.GetThrown())))); UtilPlayer.message(target, F.main("Stacker", F.name(UtilEnt.getName(data.GetThrower())) + " hit you with " + F.name(UtilEnt.getName(data.GetThrown()))));
//Effect //Effect
data.GetThrown().getWorld().playSound(data.GetThrown().getLocation(), Sound.HURT, 1f, 1f); data.GetThrown().getWorld().playSound(data.GetThrown().getLocation(), Sound.HURT, 1f, 1f);
} }
@ -230,14 +249,14 @@ public class Stacker extends MiniPlugin implements IThrown
@Override @Override
public void Idle(ProjectileUser data) public void Idle(ProjectileUser data)
{ {
} }
@Override @Override
public void Expire(ProjectileUser data) public void Expire(ProjectileUser data)
{ {
} }
} }

View File

@ -1,16 +1,17 @@
package mineplex.hub; package mineplex.hub.modules;
import mineplex.core.MiniPlugin; import mineplex.core.MiniPlugin;
import mineplex.core.common.util.UtilText; import mineplex.core.common.util.UtilText;
import mineplex.core.common.util.UtilText.TextAlign; import mineplex.core.common.util.UtilText.TextAlign;
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 org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
public class TextCreator extends MiniPlugin public class TextManager extends MiniPlugin
{ {
public HubManager Manager; public HubManager Manager;
@ -29,7 +30,7 @@ public class TextCreator extends MiniPlugin
int smashIndex = 0; int smashIndex = 0;
public TextCreator(HubManager manager) public TextManager(HubManager manager)
{ {
super("Text Creator", manager.GetPlugin()); super("Text Creator", manager.GetPlugin());
@ -47,8 +48,8 @@ public class TextCreator extends MiniPlugin
"DRAGON ESCAPE", "DRAGON ESCAPE",
"MILK THE COW", "MILK THE COW",
"SUPER SPLEEF", "SUPER SPLEEF",
"TURF FORTS",
"DEATH TAG", "DEATH TAG",
"TURF WARS",
"DRAGONS", "DRAGONS",
"RUNNER" "RUNNER"
}; };
@ -82,8 +83,8 @@ public class TextCreator extends MiniPlugin
UtilText.MakeText("THE BRIDGES", locSurvival.clone().add(-15, 14, 0), faceSurvival, 159, (byte)4, TextAlign.CENTER); UtilText.MakeText("THE BRIDGES", locSurvival.clone().add(-15, 14, 0), faceSurvival, 159, (byte)4, TextAlign.CENTER);
UtilText.MakeText("THE BRIDGES", locSurvival.clone().add(-16, 14, 0), faceSurvival, 159, (byte)15, TextAlign.CENTER); UtilText.MakeText("THE BRIDGES", locSurvival.clone().add(-16, 14, 0), faceSurvival, 159, (byte)15, TextAlign.CENTER);
//UtilText.MakeText("CASTLE SIEGE", locSurvival.clone().add(-15, 21, 0), faceSurvival, 159, (byte)1, TextAlign.CENTER); UtilText.MakeText("SURVIVAL GAMES", locSurvival.clone().add(-15, 21, 0), faceSurvival, 159, (byte)1, TextAlign.CENTER);
//UtilText.MakeText("CASTLE SIEGE", locSurvival.clone().add(-16, 21, 0), faceSurvival, 159, (byte)15, TextAlign.CENTER); UtilText.MakeText("SURVIVAL GAMES", locSurvival.clone().add(-16, 21, 0), faceSurvival, 159, (byte)15, TextAlign.CENTER);
//Other //Other

View File

@ -0,0 +1,166 @@
package mineplex.hub.modules;
import java.util.HashSet;
import java.util.Iterator;
import mineplex.core.MiniPlugin;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilWorld;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.hub.HubManager;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.entity.Chicken;
import org.bukkit.entity.Cow;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Pig;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.block.BlockSpreadEvent;
import org.bukkit.event.block.LeavesDecayEvent;
import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.player.PlayerDropItemEvent;
import org.bukkit.event.player.PlayerPickupItemEvent;
public class WorldManager extends MiniPlugin
{
public HubManager Manager;
private HashSet<LivingEntity> _mobs = new HashSet<LivingEntity>();
public WorldManager(HubManager manager)
{
super("World Manager", manager.GetPlugin());
Manager = manager;
}
@EventHandler
public void SpawnAnimals(UpdateEvent event)
{
if (event.getType() != UpdateType.SLOW)
return;
Iterator<LivingEntity> entIterator = _mobs.iterator();
while (entIterator.hasNext())
{
LivingEntity ent = entIterator.next();
if (!ent.isValid())
{
ent.remove();
entIterator.remove();
}
}
if (_mobs.size() > 16)
return;
//Loc
double r = Math.random();
Location loc = Manager.GetSpawn();
if (r > 0.75) loc.add(32, 0.5, 0);
else if (r > 0.5) loc.add(0, 0.5, 32);
else if (r > 0.25) loc.add(-32, 0.5, 0);
else loc.add(0, 0.5, -32);
//Spawn
r = Math.random();
if (r > 0.66) _mobs.add(loc.getWorld().spawn(loc, Cow.class));
else if (r > 0.33) _mobs.add(loc.getWorld().spawn(loc, Pig.class));
else _mobs.add(loc.getWorld().spawn(loc, Chicken.class));
}
@EventHandler
public void BlockBreak(BlockBreakEvent event)
{
if (event.getPlayer().getGameMode() == GameMode.CREATIVE)
return;
event.setCancelled(true);
}
@EventHandler(priority = EventPriority.LOWEST)
public void Explosion(EntityExplodeEvent event)
{
event.blockList().clear();
}
@EventHandler
public void VineGrow(BlockSpreadEvent event)
{
event.setCancelled(true);
}
@EventHandler
public void LeaveDecay(LeavesDecayEvent event)
{
event.setCancelled(true);
}
@EventHandler
public void BlockPlace(BlockPlaceEvent event)
{
if (event.getPlayer().getGameMode() == GameMode.CREATIVE)
return;
event.setCancelled(true);
}
@EventHandler
public void BorderUpdate(UpdateEvent event)
{
if (event.getType() != UpdateType.SEC)
return;
for (Player player : UtilServer.getPlayers())
{
if (UtilMath.offset(player.getLocation(), Manager.GetSpawn()) > 200)
{
player.eject();
player.leaveVehicle();
player.teleport(Manager.GetSpawn());
}
}
}
@EventHandler(priority = EventPriority.LOW)
public void ItemPickup(PlayerPickupItemEvent event)
{
if (event.getPlayer().getGameMode() == GameMode.CREATIVE)
return;
event.setCancelled(true);
}
@EventHandler(priority = EventPriority.LOW)
public void ItemDrop(PlayerDropItemEvent event)
{
if (event.getPlayer().getGameMode() == GameMode.CREATIVE)
return;
event.setCancelled(true);
}
@EventHandler
public void UpdateWeather(UpdateEvent event)
{
if (event.getType() != UpdateType.SEC)
return;
World world = UtilWorld.getWorld("world");
world.setTime(6000);
world.setStorm(false);
}
}

View File

@ -22,7 +22,7 @@ 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.TextCreator; import mineplex.hub.modules.TextManager;
import mineplex.hub.tutorial.types.PartyTutorial; import mineplex.hub.tutorial.types.PartyTutorial;
import mineplex.hub.tutorial.types.WelcomeTutorial; import mineplex.hub.tutorial.types.WelcomeTutorial;
@ -35,7 +35,7 @@ public class TutorialManager extends MiniPlugin
protected DonationManager _donationManager; protected DonationManager _donationManager;
protected TaskManager _taskManager; protected TaskManager _taskManager;
public TutorialManager(HubManager manager, DonationManager donation, TaskManager task, TextCreator text) public TutorialManager(HubManager manager, DonationManager donation, TaskManager task, TextManager text)
{ {
super("Tutorial Manager", manager.GetPlugin()); super("Tutorial Manager", manager.GetPlugin());

View File

@ -1,13 +1,13 @@
package mineplex.hub.tutorial.types; package mineplex.hub.tutorial.types;
import mineplex.hub.HubManager; import mineplex.hub.HubManager;
import mineplex.hub.TextCreator; import mineplex.hub.modules.TextManager;
import mineplex.hub.tutorial.Tutorial; import mineplex.hub.tutorial.Tutorial;
import mineplex.hub.tutorial.TutorialPhase; import mineplex.hub.tutorial.TutorialPhase;
public class WelcomeTutorial extends Tutorial public class WelcomeTutorial extends Tutorial
{ {
public WelcomeTutorial(HubManager manager, TextCreator text) public WelcomeTutorial(HubManager manager, TextManager text)
{ {
super(manager, "Welcome Tutorial", 5000, "Hub_JoinTutorial"); super(manager, "Welcome Tutorial", 5000, "Hub_JoinTutorial");

View File

@ -14,6 +14,7 @@ import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.SmashKit; import nautilus.game.arcade.kit.SmashKit;
import nautilus.game.arcade.kit.perks.PerkDamageSet; import nautilus.game.arcade.kit.perks.PerkDamageSet;
import nautilus.game.arcade.kit.perks.PerkIronSkin;
import nautilus.game.arcade.kit.perks.PerkKnockbackMultiplier; import nautilus.game.arcade.kit.perks.PerkKnockbackMultiplier;
public class KitAlphaChaser extends SmashKit public class KitAlphaChaser extends SmashKit
@ -29,7 +30,8 @@ public class KitAlphaChaser extends SmashKit
new Perk[] new Perk[]
{ {
new PerkDamageSet(6), new PerkDamageSet(6),
new PerkKnockbackMultiplier(0.5) new PerkKnockbackMultiplier(0.5),
new PerkIronSkin(4)
}, },
EntityType.SKELETON, EntityType.SKELETON,
new ItemStack(Material.IRON_AXE)); new ItemStack(Material.IRON_AXE));

View File

@ -13,6 +13,7 @@ import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.SmashKit; import nautilus.game.arcade.kit.SmashKit;
import nautilus.game.arcade.kit.perks.PerkDamageSet; import nautilus.game.arcade.kit.perks.PerkDamageSet;
import nautilus.game.arcade.kit.perks.PerkIronSkin;
public class KitChaser extends SmashKit public class KitChaser extends SmashKit
{ {
@ -26,7 +27,8 @@ public class KitChaser extends SmashKit
new Perk[] new Perk[]
{ {
new PerkDamageSet(4) new PerkDamageSet(4),
new PerkIronSkin(2)
}, },
EntityType.SKELETON, EntityType.SKELETON,
new ItemStack(Material.IRON_AXE)); new ItemStack(Material.IRON_AXE));

View File

@ -96,6 +96,14 @@ public class DragonEscape extends SoloGame
bestDist = dist; bestDist = dist;
} }
} }
//Ignore Close
if (bestDist < 6 && WorldData.GetDataLocs("BLACK").size() > 1)
{
System.out.println("Ignoring Node");
WorldData.GetDataLocs("BLACK").remove(best);
continue;
}
_waypoints.add(best); _waypoints.add(best);
WorldData.GetDataLocs("BLACK").remove(best); WorldData.GetDataLocs("BLACK").remove(best);

View File

@ -1,9 +1,11 @@
package nautilus.game.arcade.game.games.dragonescape; package nautilus.game.arcade.game.games.dragonescape;
import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilMath;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.entity.EnderDragon; import org.bukkit.entity.EnderDragon;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
public class DragonEscapeData public class DragonEscapeData
@ -38,10 +40,28 @@ public class DragonEscapeData
{ {
Turn(); Turn();
double timeSpeed = 0.16 + (System.currentTimeMillis() - Host.GetStateTime())/3000000d;
//System.out.println(timeSpeed);
Location.add(Velocity.clone().multiply(timeSpeed)); //Distance Boost
double dist = 0;
for (Player player : Host.GetPlayers(true))
{
double offset = UtilMath.offset(Location, player.getLocation());
if (offset < dist || dist == -1)
{
dist = offset;
}
}
//Speed
double speed = 0.16; //+ (System.currentTimeMillis() - Host.GetStateTime())/2000000d;
speed += (System.currentTimeMillis() - Host.GetStateTime())/1000d * 0.001;
if (dist > 10)
speed += (dist-10) * 0.001;
Location.add(Velocity.clone().multiply(speed));
Location.add(0, -Pitch, 0); Location.add(0, -Pitch, 0);
Location.setPitch(-1 * Pitch); Location.setPitch(-1 * Pitch);

View File

@ -123,8 +123,10 @@ public class PerkDisruptor extends Perk
_tntMap.remove(event.getItem()); _tntMap.remove(event.getItem());
event.getItem().remove(); event.getItem().remove();
event.getPlayer().setVelocity(new Vector(0,0.3,0)); event.getPlayer().setVelocity(new Vector(0,0.5,0));
event.getPlayer().getWorld().playSound(event.getPlayer().getLocation(), Sound.EXPLODE, 1f, 2f); event.getPlayer().getWorld().playSound(event.getPlayer().getLocation(), Sound.EXPLODE, 1f, 2f);
event.getPlayer().playEffect(EntityEffect.HURT); event.getPlayer().playEffect(EntityEffect.HURT);
event.getPlayer().setSprinting(false);
} }
} }