Hub Parkour update
Smash kit prices
This commit is contained in:
parent
02dd579844
commit
313f675ae4
@ -119,4 +119,18 @@ public class UtilAlg
|
||||
{
|
||||
return list.get(UtilMath.r(list.size()));
|
||||
}
|
||||
|
||||
public static boolean inBoundingBox(Location loc, Location cornerA, Location cornerB)
|
||||
{
|
||||
if (loc.getX() < Math.min(cornerA.getX(), cornerB.getX())) return false;
|
||||
if (loc.getX() > Math.max(cornerA.getX(), cornerB.getX())) return false;
|
||||
|
||||
if (loc.getY() < Math.min(cornerA.getY(), cornerB.getY())) return false;
|
||||
if (loc.getY() > Math.max(cornerA.getY(), cornerB.getY())) return false;
|
||||
|
||||
if (loc.getZ() < Math.min(cornerA.getZ(), cornerB.getZ())) return false;
|
||||
if (loc.getZ() > Math.max(cornerA.getZ(), cornerB.getZ())) return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -66,7 +66,7 @@ public class GadgetManager extends MiniPlugin
|
||||
private void CreateGadgets()
|
||||
{
|
||||
_gadgets = new NautHashMap<GadgetType, List<Gadget>>();
|
||||
|
||||
|
||||
// Items
|
||||
addGadget(new ItemPaintballGun(this));
|
||||
addGadget(new ItemBatGun(this));
|
||||
@ -180,6 +180,17 @@ public class GadgetManager extends MiniPlugin
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void DisableAll(Player player)
|
||||
{
|
||||
for (GadgetType gadgetType : _gadgets.keySet())
|
||||
{
|
||||
for (Gadget gadget : _gadgets.get(gadgetType))
|
||||
{
|
||||
gadget.Disable(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public PetManager getPetManager()
|
||||
{
|
||||
|
@ -1,6 +1,7 @@
|
||||
package mineplex.core.gadget.event;
|
||||
|
||||
import mineplex.core.gadget.types.Gadget;
|
||||
import mineplex.core.mount.Mount;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Event;
|
||||
@ -12,9 +13,16 @@ public class GadgetActivateEvent extends Event
|
||||
|
||||
private Player _player;
|
||||
private Gadget _gadget;
|
||||
private Mount _mount;
|
||||
|
||||
private boolean _cancelled = false;
|
||||
|
||||
public GadgetActivateEvent(Player player, Mount mount)
|
||||
{
|
||||
_player = player;
|
||||
_mount = mount;
|
||||
}
|
||||
|
||||
public GadgetActivateEvent(Player player, Gadget gadget)
|
||||
{
|
||||
_player = player;
|
||||
@ -35,6 +43,11 @@ public class GadgetActivateEvent extends Event
|
||||
{
|
||||
return _gadget;
|
||||
}
|
||||
|
||||
public Mount getMount()
|
||||
{
|
||||
return _mount;
|
||||
}
|
||||
|
||||
public Player getPlayer()
|
||||
{
|
||||
|
@ -139,13 +139,4 @@ public class MorphChicken extends MorphGadget
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void HeroOwner(PlayerJoinEvent event)
|
||||
{
|
||||
if (Manager.getClientManager().Get(event.getPlayer()).GetRank().Has(Rank.HERO))
|
||||
{
|
||||
Manager.getDonationManager().Get(event.getPlayer().getName()).AddUnknownSalesPackagesOwned(GetName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -35,6 +35,8 @@ public class MorphCreeper extends MorphGadget
|
||||
C.cWhite + "Transforms the wearer into a creepy Creeper!",
|
||||
" ",
|
||||
C.cYellow + "Crouch" + C.cGray + " to use " + C.cGreen + "Detonate",
|
||||
" ",
|
||||
C.cPurple + "Unlocked with Hero Rank",
|
||||
},
|
||||
-1,
|
||||
ArmorSlot.Helmet, Material.SKULL_ITEM, (byte)4);
|
||||
|
@ -3,9 +3,13 @@ package mineplex.core.gadget.types;
|
||||
import java.util.HashSet;
|
||||
|
||||
import mineplex.core.common.CurrencyType;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.gadget.GadgetManager;
|
||||
import mineplex.core.gadget.event.GadgetActivateEvent;
|
||||
import mineplex.core.shop.item.SalesPackageBase;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@ -55,6 +59,15 @@ public abstract class Gadget extends SalesPackageBase implements Listener
|
||||
|
||||
public void Enable(Player player)
|
||||
{
|
||||
GadgetActivateEvent gadgetEvent = new GadgetActivateEvent(player, this);
|
||||
Bukkit.getServer().getPluginManager().callEvent(gadgetEvent);
|
||||
|
||||
if (gadgetEvent.isCancelled())
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Inventory", "You cannot use Inventory Items."));
|
||||
return;
|
||||
}
|
||||
|
||||
Manager.setActive(player, this);
|
||||
EnableCustom(player);
|
||||
}
|
||||
|
@ -122,12 +122,6 @@ public abstract class ItemGadget extends Gadget
|
||||
|
||||
event.setCancelled(true);
|
||||
|
||||
GadgetActivateEvent gadgetEvent = new GadgetActivateEvent(player, this);
|
||||
Bukkit.getServer().getPluginManager().callEvent(gadgetEvent);
|
||||
|
||||
if (gadgetEvent.isCancelled())
|
||||
return;
|
||||
|
||||
//Recharge
|
||||
if (!Recharge.Instance.use(player, GetName(), _recharge, _recharge > 1000, false))
|
||||
return;
|
||||
|
@ -3,6 +3,7 @@ package mineplex.core.mount;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@ -11,6 +12,9 @@ import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
|
||||
import mineplex.core.common.CurrencyType;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.gadget.event.GadgetActivateEvent;
|
||||
import mineplex.core.shop.item.SalesPackageBase;
|
||||
|
||||
public abstract class Mount<T> extends SalesPackageBase implements Listener
|
||||
@ -35,6 +39,15 @@ public abstract class Mount<T> extends SalesPackageBase implements Listener
|
||||
|
||||
public final void Enable(Player player)
|
||||
{
|
||||
GadgetActivateEvent gadgetEvent = new GadgetActivateEvent(player, this);
|
||||
Bukkit.getServer().getPluginManager().callEvent(gadgetEvent);
|
||||
|
||||
if (gadgetEvent.isCancelled())
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Inventory", "You cannot use Inventory Items."));
|
||||
return;
|
||||
}
|
||||
|
||||
Manager.setActive(player, this);
|
||||
EnableCustom(player);
|
||||
}
|
||||
|
@ -235,7 +235,7 @@ public class PreferencesPage extends ShopPageBase<PreferencesManager, Preference
|
||||
index = 9;
|
||||
}
|
||||
|
||||
buildPreference(index, Material.FIREBALL, "Hub Games", userPreferences.HubGames, _toggleHubGames);
|
||||
buildPreference(index, Material.FIREBALL, "Hub Stacker", userPreferences.HubGames, _toggleHubGames);
|
||||
index += 2;
|
||||
buildPreference(index, Material.EYE_OF_ENDER, "Hub Player Visibility", userPreferences.ShowPlayers, _toggleHubPlayers);
|
||||
index += 2;
|
||||
|
@ -68,7 +68,7 @@ public class Hub extends JavaPlugin implements IRelation
|
||||
Logger.initialize(this);
|
||||
|
||||
//Static Modules
|
||||
CommandCenter.Initialize(this);
|
||||
CommandCenter.Initialize(this);
|
||||
CoreClientManager clientManager = new CoreClientManager(this, webServerAddress);
|
||||
CommandCenter.Instance.setClientManager(clientManager);
|
||||
|
||||
@ -76,7 +76,6 @@ public class Hub extends JavaPlugin implements IRelation
|
||||
Recharge.Initialize(this);
|
||||
Punish punish = new Punish(this, webServerAddress, clientManager);
|
||||
|
||||
|
||||
DonationManager donationManager = new DonationManager(this, webServerAddress);
|
||||
|
||||
//Other Modules
|
||||
|
@ -717,19 +717,27 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
||||
obj.setDisplayName(C.cWhite + C.Bold + Get(player).GetScoreboardText());
|
||||
|
||||
int line = 15;
|
||||
|
||||
|
||||
//Stacker
|
||||
obj.getScore(C.cAqua + C.Bold + "Stacker").setScore(line--);
|
||||
player.getScoreboard().resetScores(Get(player).BestPig);
|
||||
Get(player).BestPig = _pigStacker;
|
||||
obj.getScore(Get(player).BestPig).setScore(line--);
|
||||
|
||||
//Space
|
||||
obj.getScore(" ").setScore(line--);
|
||||
|
||||
//Gems
|
||||
obj.getScore(C.cGreen + C.Bold + "Gems").setScore(line--);
|
||||
|
||||
// Remove Old
|
||||
// Remove Old/Add New
|
||||
player.getScoreboard().resetScores(Get(player.getName()).GetLastGemCount() + "");
|
||||
// Add New
|
||||
obj.getScore(GetDonation().Get(player.getName()).GetGems() + "").setScore(line--);
|
||||
|
||||
Get(player.getName()).SetLastGemCount(GetDonation().Get(player.getName()).GetGems());
|
||||
|
||||
//Space
|
||||
obj.getScore(" ").setScore(line--);
|
||||
obj.getScore(" ").setScore(line--);
|
||||
|
||||
//Coins
|
||||
obj.getScore(C.cYellow + C.Bold + "Coins").setScore(line--);
|
||||
|
||||
// Remove Old
|
||||
@ -738,54 +746,24 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
||||
obj.getScore(GetDonation().Get(player.getName()).getCoins() + "").setScore(line--);
|
||||
|
||||
Get(player.getName()).SetLastCoinCount(GetDonation().Get(player.getName()).getCoins());
|
||||
|
||||
//Space
|
||||
obj.getScore(" ").setScore(line--);
|
||||
|
||||
/*
|
||||
//News
|
||||
obj.getScore(C.cGray + C.Bold + "Latest News")).setScore(line--);
|
||||
player.getScoreboard().resetScores(Get(player).GetNewsText(false)));
|
||||
obj.getScore(Get(player).GetNewsText(true))).setScore(line--);
|
||||
*/
|
||||
|
||||
//Stacker
|
||||
obj.getScore(C.cGray + C.Bold + "Stacker").setScore(line--);
|
||||
player.getScoreboard().resetScores(Get(player).BestPig);
|
||||
Get(player).BestPig = _pigStacker;
|
||||
obj.getScore(Get(player).BestPig).setScore(line--);
|
||||
|
||||
//Space
|
||||
obj.getScore(" ").setScore(line--);
|
||||
|
||||
obj.getScore(" ").setScore(line--);
|
||||
|
||||
|
||||
//Display Rank
|
||||
if (GetClients().Get(player).GetRank().Has(Rank.HERO))
|
||||
{
|
||||
obj.getScore(C.cPurple + C.Bold + "Hero Rank").setScore(line--);
|
||||
|
||||
player.getScoreboard().resetScores(Get(player).GetUltraText(false));
|
||||
obj.getScore(Get(player).GetUltraText(true)).setScore(line--);
|
||||
}
|
||||
else if (GetClients().Get(player).GetRank().Has(Rank.ULTRA))
|
||||
{
|
||||
obj.getScore(C.cAqua + C.Bold + "Ultra Rank").setScore(line--);
|
||||
|
||||
player.getScoreboard().resetScores(Get(player).GetUltraText(false));
|
||||
obj.getScore(Get(player).GetUltraText(true)).setScore(line--);
|
||||
}
|
||||
obj.getScore(C.cGold + C.Bold + "Rank").setScore(line--);
|
||||
if (GetClients().Get(player).GetRank().Has(Rank.ULTRA))
|
||||
obj.getScore(GetClients().Get(player).GetRank().Name).setScore(line--);
|
||||
else
|
||||
{
|
||||
obj.getScore(C.cRed + C.Bold + "No Rank").setScore(line--);
|
||||
|
||||
player.getScoreboard().resetScores(Get(player).GetPurchaseText(false));
|
||||
obj.getScore(Get(player).GetPurchaseText(true)).setScore(line--);
|
||||
}
|
||||
obj.getScore("No Rank").setScore(line--);
|
||||
|
||||
//Space
|
||||
obj.getScore(" ").setScore(line--);
|
||||
obj.getScore(" ").setScore(line--);
|
||||
|
||||
//Website
|
||||
obj.getScore(C.cYellow + C.Bold + "Website").setScore(line--);
|
||||
obj.getScore(C.cRed + C.Bold + "Website").setScore(line--);
|
||||
obj.getScore("www.mineplex.com").setScore(line--);
|
||||
obj.getScore("----------------").setScore(line--);
|
||||
}
|
||||
|
@ -52,15 +52,6 @@ public class JumpManager extends MiniPlugin
|
||||
//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);
|
||||
|
||||
@ -79,6 +70,13 @@ public class JumpManager extends MiniPlugin
|
||||
if (player.getGameMode() == GameMode.CREATIVE)
|
||||
continue;
|
||||
|
||||
if (Manager.GetParkour().isParkourMode(player))
|
||||
{
|
||||
player.setAllowFlight(false);
|
||||
player.setFlying(false);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (UtilEnt.isGrounded(player) || UtilBlock.solid(player.getLocation().getBlock().getRelative(BlockFace.DOWN)))
|
||||
{
|
||||
player.setAllowFlight(true);
|
||||
|
@ -1,6 +1,8 @@
|
||||
package mineplex.hub.modules;
|
||||
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
|
||||
import org.bukkit.Location;
|
||||
@ -12,28 +14,45 @@ public class ParkourData
|
||||
public String Name;
|
||||
public String[] Desc;
|
||||
public int Gems;
|
||||
public Location Location;
|
||||
public Location NPC;
|
||||
public Location CornerA;
|
||||
public Location CornerB;
|
||||
public double Distance;
|
||||
|
||||
public ParkourData(String name, String[] desc, int gems, Location loc, double dist)
|
||||
public ParkourData(String name, String[] desc, int gems, Location npc, Location cornerA, Location cornerB)
|
||||
{
|
||||
Name = name;
|
||||
Desc = desc;
|
||||
Gems = gems;
|
||||
Location = loc;
|
||||
Distance = dist;
|
||||
NPC = npc;
|
||||
CornerA = cornerA;
|
||||
CornerB = cornerB;
|
||||
}
|
||||
|
||||
public void Inform(Player player)
|
||||
{
|
||||
//Inform
|
||||
UtilPlayer.message(player, F.main("Parkour", "Welcome to the " + F.elem(Name) + " course."));
|
||||
UtilPlayer.message(player, "");
|
||||
UtilPlayer.message(player, C.cDGreen + C.Strike + "=============================================");
|
||||
|
||||
UtilPlayer.message(player, "§f§l" + Name + " Course");
|
||||
UtilPlayer.message(player, "");
|
||||
|
||||
for (String cur : Desc)
|
||||
{
|
||||
UtilPlayer.message(player, " " + cur);
|
||||
}
|
||||
|
||||
UtilPlayer.message(player, "");
|
||||
UtilPlayer.message(player, C.cWhite + C.Bold + "You must " + C.cGreen + C.Bold + "Right-Click" + C.cWhite + C.Bold + " the NPC to begin!");
|
||||
|
||||
UtilPlayer.message(player, "");
|
||||
UtilPlayer.message(player, C.cDGreen + C.Strike + "=============================================");
|
||||
|
||||
player.playSound(player.getLocation(), Sound.ORB_PICKUP, 1f, 2f);
|
||||
}
|
||||
|
||||
public boolean InBoundary(Location loc)
|
||||
{
|
||||
return (UtilAlg.inBoundingBox(loc, CornerA, CornerB));
|
||||
}
|
||||
}
|
||||
|
@ -15,10 +15,13 @@ 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.block.BlockPlaceEvent;
|
||||
import org.bukkit.event.entity.EntityCombustEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.event.player.PlayerVelocityEvent;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.common.util.C;
|
||||
@ -31,6 +34,7 @@ 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.gadget.event.GadgetActivateEvent;
|
||||
import mineplex.core.gadget.event.GadgetBlockEvent;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.task.TaskManager;
|
||||
@ -42,6 +46,8 @@ public class ParkourManager extends MiniPlugin
|
||||
{
|
||||
public HubManager Manager;
|
||||
|
||||
private HashSet<Player> _active = new HashSet<Player>();
|
||||
|
||||
private HashSet<ParkourData> _parkour = new HashSet<ParkourData>();
|
||||
|
||||
private Location _lavaParkourReturn;
|
||||
@ -63,133 +69,176 @@ public class ParkourManager extends MiniPlugin
|
||||
|
||||
_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.",
|
||||
"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), 60));
|
||||
|
||||
|
||||
6000, new Location(Manager.GetSpawn().getWorld(), 110,66,-44),
|
||||
new Location(Manager.GetSpawn().getWorld(), 103,100,-60), new Location(Manager.GetSpawn().getWorld(), 150,50,26)));
|
||||
|
||||
|
||||
_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), 60));
|
||||
"This parkour is HOT! It's so hot that you",
|
||||
"must keep sprinting for the entire course,",
|
||||
"or you will die in flames!"
|
||||
}, 4000, new Location(Manager.GetSpawn().getWorld(), -93,67,38),
|
||||
new Location(Manager.GetSpawn().getWorld(), -86,100,42), new Location(Manager.GetSpawn().getWorld(), -120,50,-17)));
|
||||
|
||||
_lavaParkourReturn = new Location(Manager.GetSpawn().getWorld(), -89.5,68,36.5);
|
||||
_lavaParkourReturn.setYaw(90);
|
||||
}
|
||||
|
||||
public boolean isParkourMode(Player player)
|
||||
{
|
||||
return _active.contains(player);
|
||||
}
|
||||
|
||||
public void setParkourMode(Player player, boolean enabled)
|
||||
{
|
||||
if (enabled)
|
||||
{
|
||||
_active.add(player);
|
||||
UtilPlayer.message(player, F.main("Parkour", "You have entered " + F.elem("Parkour Mode") + "."));
|
||||
|
||||
Manager.GetGadget().DisableAll();
|
||||
}
|
||||
else
|
||||
{
|
||||
_active.remove(player);
|
||||
UtilPlayer.message(player, F.main("Parkour", "You have exited " + F.elem("Parkour Mode") + "."));
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void gadgetBlockChange(GadgetBlockEvent event)
|
||||
public void playerVelocity(PlayerVelocityEvent event)
|
||||
{
|
||||
for (Iterator<Block> iterator = event.getBlocks().iterator(); iterator.hasNext();)
|
||||
{
|
||||
for (ParkourData data : _parkour)
|
||||
{
|
||||
if (UtilMath.offset(iterator.next().getLocation(), data.Location) < data.Distance)
|
||||
{
|
||||
iterator.remove();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean InParkour(Entity ent)
|
||||
{
|
||||
for (ParkourData data : _parkour)
|
||||
{
|
||||
if (UtilMath.offset(ent.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 combustPrevent(EntityCombustEvent event)
|
||||
{
|
||||
if (event.getEntity() instanceof Player)
|
||||
{
|
||||
if (isParkourMode(event.getPlayer()))
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void LavaReturn(EntityDamageEvent event)
|
||||
public void disableGadgets(GadgetActivateEvent event)
|
||||
{
|
||||
if (event.getCause() == DamageCause.LAVA)
|
||||
if (event.getEntity() instanceof Player)
|
||||
{
|
||||
event.getEntity().eject();
|
||||
event.getEntity().leaveVehicle();
|
||||
event.getEntity().teleport(_lavaParkourReturn);
|
||||
}
|
||||
|
||||
else
|
||||
event.getEntity().remove();
|
||||
|
||||
event.setCancelled(true);
|
||||
if (isParkourMode(event.getPlayer()))
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void preventCarriers(UpdateEvent event)
|
||||
public void playerEnterParkour(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.SEC)
|
||||
if (event.getType() != UpdateType.FAST)
|
||||
return;
|
||||
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
{
|
||||
if (InParkour(player))
|
||||
{
|
||||
if ((player.getVehicle() != null && !(player.getVehicle() instanceof EnderDragon)) || player.getPassenger() != null)
|
||||
{
|
||||
player.eject();
|
||||
player.leaveVehicle();
|
||||
|
||||
UtilPlayer.message(player, F.main("Parkour", "You can't be a passenger near Parkours!"));
|
||||
}
|
||||
}
|
||||
if (isParkourMode(player))
|
||||
continue;
|
||||
|
||||
for (ParkourData data : _parkour)
|
||||
if (UtilMath.offset(player.getLocation(), data.NPC) < 6)
|
||||
if (Recharge.Instance.use(player, data.Name+" Info", 60000, false, false))
|
||||
data.Inform(player);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void LavaBlockReturn(UpdateEvent event)
|
||||
public void parkourUpdate(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.FAST)
|
||||
return;
|
||||
|
||||
Iterator<Player> playerIterator = _active.iterator();
|
||||
|
||||
while (playerIterator.hasNext())
|
||||
{
|
||||
Player player = playerIterator.next();
|
||||
|
||||
player.leaveVehicle();
|
||||
player.eject();
|
||||
|
||||
if (!InsideParkour(player.getLocation()))
|
||||
{
|
||||
playerIterator.remove();
|
||||
UtilPlayer.message(player, F.main("Parkour", "You have exited " + F.elem("Parkour Mode") + "."));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void playerQuit(PlayerQuitEvent event)
|
||||
{
|
||||
_active.remove(event.getPlayer());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void disallowBlockBreak(BlockBreakEvent event)
|
||||
{
|
||||
if (isParkourMode(event.getPlayer()))
|
||||
{
|
||||
event.getPlayer().teleport(Manager.GetSpawn());
|
||||
UtilPlayer.message(event.getPlayer(), F.main("Parkour", "You cannot break blocks in Parkour Mode!"));
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void disallowBlockPlace(BlockPlaceEvent event)
|
||||
{
|
||||
if (isParkourMode(event.getPlayer()))
|
||||
{
|
||||
event.getPlayer().teleport(Manager.GetSpawn());
|
||||
UtilPlayer.message(event.getPlayer(), F.main("Parkour", "You cannot place blocks in Parkour Mode!"));
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void lavaReturn(EntityDamageEvent event)
|
||||
{
|
||||
if (event.getCause() != DamageCause.LAVA)
|
||||
return;
|
||||
|
||||
if (!(event.getEntity() instanceof Player))
|
||||
{
|
||||
event.getEntity().remove();
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = (Player)event.getEntity();
|
||||
|
||||
if (!isParkourMode(player))
|
||||
return;
|
||||
|
||||
event.getEntity().eject();
|
||||
event.getEntity().leaveVehicle();
|
||||
event.getEntity().teleport(_lavaParkourReturn);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void lavaBlockReturn(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
return;
|
||||
|
||||
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
{
|
||||
if (!UtilEnt.isGrounded(player))
|
||||
continue;
|
||||
|
||||
if (!isParkourMode(player))
|
||||
continue;
|
||||
|
||||
int id = player.getLocation().getBlock().getRelative(BlockFace.DOWN).getTypeId();
|
||||
int data = player.getLocation().getBlock().getRelative(BlockFace.DOWN).getData();
|
||||
if (id != 0 && id != 112 && id != 114 && !(id == 43 && data == 6) && !(id == 44 && data == 6))
|
||||
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;
|
||||
@ -201,25 +250,25 @@ public class ParkourManager extends MiniPlugin
|
||||
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)
|
||||
public void finishParkour(PlayerInteractEntityEvent event)
|
||||
{
|
||||
if (event.getRightClicked() == null)
|
||||
return;
|
||||
@ -231,26 +280,34 @@ public class ParkourManager extends MiniPlugin
|
||||
|
||||
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);
|
||||
setParkourMode(player, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Finish Message
|
||||
if (ent.getCustomName().contains("Finish"))
|
||||
{
|
||||
final Player player = event.getPlayer();
|
||||
|
||||
if (!isParkourMode(player))
|
||||
{
|
||||
//Inform
|
||||
UtilPlayer.message(player, F.main("Parkour", "Cannot finish parkour unless you are in " + F.elem("Parkour Mode") + "."));
|
||||
UtilPlayer.message(player, F.main("Parkour", "Talk to the " + F.elem("Start NPC") + " to enter Parkour Mode."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Recharge.Instance.use(player, "Finish Parkour", 30000, false, false))
|
||||
return;
|
||||
|
||||
@ -268,19 +325,44 @@ public class ParkourManager extends MiniPlugin
|
||||
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);
|
||||
}
|
||||
}, "Parkour " + data.Name, player.getName(), data.Gems);
|
||||
}, "Parkour " + data.Name, player.getName(), data.Gems);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void gadgetBlockChange(GadgetBlockEvent event)
|
||||
{
|
||||
for (Iterator<Block> iterator = event.getBlocks().iterator(); iterator.hasNext();)
|
||||
{
|
||||
for (ParkourData data : _parkour)
|
||||
{
|
||||
if (data.InBoundary(iterator.next().getLocation()))
|
||||
{
|
||||
iterator.remove();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean InsideParkour(Location loc)
|
||||
{
|
||||
for (ParkourData data : _parkour)
|
||||
if (data.InBoundary(loc))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ public class StackerManager extends MiniPlugin implements IThrown
|
||||
return;
|
||||
|
||||
//Parkour Disable
|
||||
if (Manager.GetParkour().InParkour(stacker))
|
||||
if (Manager.GetParkour().InsideParkour(stacker.getLocation()))
|
||||
{
|
||||
UtilPlayer.message(stacker, F.main("Parkour", "You cannot Stack/Throw near Parkour Challenges."));
|
||||
return;
|
||||
@ -186,10 +186,9 @@ public class StackerManager extends MiniPlugin implements IThrown
|
||||
}
|
||||
|
||||
//Parkour Disable
|
||||
if (Manager.GetParkour().InParkour(thrower))
|
||||
if (Manager.GetParkour().InsideParkour(thrower.getLocation()))
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -67,11 +67,11 @@ public class TextManager extends MiniPlugin
|
||||
UtilText.MakeText("DOMINATE", locComp.clone().add(15, 14, 0), faceComp, 159, (byte)4, TextAlign.CENTER);
|
||||
UtilText.MakeText("DOMINATE", locComp.clone().add(16, 14, 0), faceComp, 159, (byte)15, TextAlign.CENTER);
|
||||
|
||||
UtilText.MakeText("DEATHMATCH", locComp.clone().add(15, 21, 0), faceComp, 159, (byte)1, TextAlign.CENTER);
|
||||
UtilText.MakeText("DEATHMATCH", locComp.clone().add(16, 21, 0), faceComp, 159, (byte)15, TextAlign.CENTER);
|
||||
UtilText.MakeText("TEAM DEATHMATCH", locComp.clone().add(15, 21, 0), faceComp, 159, (byte)1, TextAlign.CENTER);
|
||||
UtilText.MakeText("TEAM DEATHMATCH", locComp.clone().add(16, 21, 0), faceComp, 159, (byte)15, TextAlign.CENTER);
|
||||
|
||||
UtilText.MakeText("CAPTURE THE PIG", locComp.clone().add(15, 28, 0), faceComp, 159, (byte)14, TextAlign.CENTER);
|
||||
UtilText.MakeText("CAPTURE THE PIG", locComp.clone().add(16, 28, 0), faceComp, 159, (byte)15, TextAlign.CENTER);
|
||||
//UtilText.MakeText("CAPTURE THE PIG", locComp.clone().add(15, 28, 0), faceComp, 159, (byte)14, TextAlign.CENTER);
|
||||
//UtilText.MakeText("CAPTURE THE PIG", locComp.clone().add(16, 28, 0), faceComp, 159, (byte)15, TextAlign.CENTER);
|
||||
|
||||
//Arcade
|
||||
UtilText.MakeText("ARCADE", locArcade, faceArcade, 159, (byte)5, TextAlign.CENTER);
|
||||
|
@ -38,6 +38,7 @@ import org.bukkit.event.block.BlockFormEvent;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
import org.bukkit.event.block.BlockSpreadEvent;
|
||||
import org.bukkit.event.block.LeavesDecayEvent;
|
||||
import org.bukkit.event.entity.EntityCombustEvent;
|
||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||
import org.bukkit.event.entity.EntityTargetEvent;
|
||||
import org.bukkit.event.player.PlayerDropItemEvent;
|
||||
@ -269,4 +270,13 @@ public class WorldManager extends MiniPlugin
|
||||
if (event.GetDamageeEntity() instanceof Boat)
|
||||
event.SetCancelled("Boat Cancel");
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void combustPrevent(EntityCombustEvent event)
|
||||
{
|
||||
if (event.getEntity() instanceof Player)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ public class CompassAddon extends MiniPlugin
|
||||
|
||||
if (target != null)
|
||||
{
|
||||
if (Manager.GetGame().CompassGiveItem || player.getGameMode() == GameMode.SURVIVAL)
|
||||
if (Manager.GetGame().CompassGiveItem || player.getGameMode() != GameMode.SURVIVAL)
|
||||
if (!player.getInventory().contains(Material.COMPASS))
|
||||
{
|
||||
if (player.getOpenInventory() == null || player.getOpenInventory().getCursor() == null || player.getOpenInventory().getCursor().getType() != Material.COMPASS)
|
||||
|
@ -1,9 +1,7 @@
|
||||
package nautilus.game.arcade.game.games.smash;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@ -24,7 +22,6 @@ import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.core.combat.DeathMessageType;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.ArcadeFormat;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
|
@ -27,7 +27,7 @@ public class KitBlaze extends SmashKit
|
||||
{
|
||||
public KitBlaze(ArcadeManager manager)
|
||||
{
|
||||
super(manager, "Blaze", KitAvailability.Green, 6000,
|
||||
super(manager, "Blaze", KitAvailability.Green, 8000,
|
||||
|
||||
new String[]
|
||||
{
|
||||
|
@ -23,7 +23,7 @@ public class KitChicken extends SmashKit
|
||||
{
|
||||
public KitChicken(ArcadeManager manager)
|
||||
{
|
||||
super(manager, "Chicken", KitAvailability.Green, 5000,
|
||||
super(manager, "Chicken", KitAvailability.Green, 10000,
|
||||
|
||||
new String[]
|
||||
{
|
||||
|
@ -23,7 +23,7 @@ public class KitPig extends SmashKit
|
||||
{
|
||||
public KitPig(ArcadeManager manager)
|
||||
{
|
||||
super(manager, "Pig", KitAvailability.Green, 5000,
|
||||
super(manager, "Pig", KitAvailability.Green, 7000,
|
||||
|
||||
new String[]
|
||||
{
|
||||
|
@ -27,7 +27,7 @@ public class KitSkeletalHorse extends SmashKit
|
||||
{
|
||||
public KitSkeletalHorse(ArcadeManager manager)
|
||||
{
|
||||
super(manager, "Skeletal Horse", KitAvailability.Green, 5000,
|
||||
super(manager, "Skeletal Horse", KitAvailability.Green, 7000,
|
||||
|
||||
new String[]
|
||||
{
|
||||
|
@ -22,7 +22,7 @@ public class KitWolf extends SmashKit
|
||||
{
|
||||
public KitWolf(ArcadeManager manager)
|
||||
{
|
||||
super(manager, "Wolf", KitAvailability.Green,
|
||||
super(manager, "Wolf", KitAvailability.Green, 3000,
|
||||
|
||||
new String[]
|
||||
{
|
||||
|
@ -0,0 +1,113 @@
|
||||
package nautilus.game.arcade.managers;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import mineplex.core.achievement.Achievement;
|
||||
import mineplex.core.achievement.AchievementLog;
|
||||
import mineplex.core.achievement.AchivementData;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import nautilus.game.arcade.ArcadeFormat;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.game.Game;
|
||||
import nautilus.game.arcade.game.Game.GameState;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
|
||||
public class GameAchievementManager implements Listener
|
||||
{
|
||||
ArcadeManager Manager;
|
||||
|
||||
public GameAchievementManager(ArcadeManager manager)
|
||||
{
|
||||
Manager = manager;
|
||||
|
||||
Manager.GetPluginManager().registerEvents(this, Manager.GetPlugin());
|
||||
}
|
||||
|
||||
//Ensure that past achievement progress is ignored
|
||||
@EventHandler
|
||||
public void clearAchievementLog(PlayerJoinEvent event)
|
||||
{
|
||||
Manager.GetAchievement().clearLog(event.getPlayer());
|
||||
}
|
||||
|
||||
//@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void processAchievementLog(final GameStateChangeEvent event)
|
||||
{
|
||||
if (Manager.IsTournamentServer())
|
||||
return;
|
||||
|
||||
if (event.GetState() != GameState.Dead)
|
||||
return;
|
||||
|
||||
UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(Manager.GetPlugin(), new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
{
|
||||
displayAchievementLog(player, event.GetGame(), Manager.GetAchievement().getLog(player));
|
||||
}
|
||||
}
|
||||
}, 120);
|
||||
//Delay after Gems
|
||||
}
|
||||
|
||||
public void displayAchievementLog(Player player, Game game, NautHashMap<Achievement, AchievementLog> log)
|
||||
{
|
||||
if (log == null)
|
||||
return;
|
||||
|
||||
player.playSound(player.getLocation(), Sound.LEVEL_UP, 2f, 1f);
|
||||
|
||||
UtilPlayer.message(player, "");
|
||||
UtilPlayer.message(player, ArcadeFormat.Line);
|
||||
|
||||
UtilPlayer.message(player, "§f§lAchievement Progress");
|
||||
|
||||
int out = 0;
|
||||
|
||||
//Display
|
||||
for (Achievement type : log.keySet())
|
||||
{
|
||||
UtilPlayer.message(player, "");
|
||||
|
||||
AchivementData data = Manager.GetAchievement().get(player, type);
|
||||
|
||||
if (log.get(type).LevelUp)
|
||||
{
|
||||
UtilPlayer.message(player, F.elem(type.getName() + " " + data.getLevel() + "/" + type.getMaxLevel()) +
|
||||
" " + F.elem(C.cGreen + "+" + log.get(type).Amount) +
|
||||
" " + F.elem(C.cAqua + "LEVELED UP!"));
|
||||
}
|
||||
else
|
||||
{
|
||||
UtilPlayer.message(player, F.elem(type.getName() + " " + data.getLevel() + "/" + type.getMaxLevel()) +
|
||||
" " + F.elem(C.cGreen + "+" + log.get(type).Amount) +
|
||||
" " + F.elem(ChatColor.YELLOW + "" + (data.getExpNextLevel() - data.getExpRemainder()) + " to Next Level"));
|
||||
}
|
||||
|
||||
out++;
|
||||
}
|
||||
|
||||
while (out < 5)
|
||||
{
|
||||
//UtilPlayer.message(player, "");
|
||||
out++;
|
||||
}
|
||||
|
||||
UtilPlayer.message(player, "");
|
||||
UtilPlayer.message(player, ArcadeFormat.Line);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user