Hub refactor
Hub parkour module
This commit is contained in:
parent
ae00d3df18
commit
91ce36d6e4
@ -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" />
|
||||||
|
@ -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);
|
||||||
|
@ -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)
|
||||||
@ -490,17 +379,6 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@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)
|
||||||
{
|
{
|
||||||
@ -656,6 +534,11 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
|||||||
return _donationManager;
|
return _donationManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ParkourManager GetParkour()
|
||||||
|
{
|
||||||
|
return _parkour;
|
||||||
|
}
|
||||||
|
|
||||||
public Location GetSpawn()
|
public Location GetSpawn()
|
||||||
{
|
{
|
||||||
return _spawn.clone();
|
return _spawn.clone();
|
||||||
@ -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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -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,19 +32,24 @@ 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
|
||||||
@ -99,6 +103,13 @@ public class Stacker extends MiniPlugin implements IThrown
|
|||||||
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."));
|
||||||
@ -196,6 +207,14 @@ 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())));
|
||||||
|
|
@ -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
|
166
Plugins/Mineplex.Hub/src/mineplex/hub/modules/WorldManager.java
Normal file
166
Plugins/Mineplex.Hub/src/mineplex/hub/modules/WorldManager.java
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
@ -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());
|
||||||
|
|
||||||
|
@ -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");
|
||||||
|
|
||||||
|
@ -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));
|
||||||
|
@ -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));
|
||||||
|
@ -97,6 +97,14 @@ public class DragonEscape extends SoloGame
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//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);
|
||||||
best.subtract(new Vector(0,1,0));
|
best.subtract(new Vector(0,1,0));
|
||||||
|
@ -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);
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user