Halloween event update
hub News hub mounts hub gadgets
This commit is contained in:
parent
1977572ced
commit
5563d94111
@ -0,0 +1,16 @@
|
||||
package mineplex.core.common.util;
|
||||
|
||||
import org.bukkit.entity.EntityType;
|
||||
|
||||
public class EntData
|
||||
{
|
||||
public String Name;
|
||||
public EntityType Type;
|
||||
public double Height;
|
||||
public double Scale;
|
||||
|
||||
public EntData(String name, EntityType type, double height, double scale)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -162,6 +162,13 @@ public class UtilEnt
|
||||
if (GetEntityNames().containsKey(ent))
|
||||
return GetEntityNames().get(ent);
|
||||
|
||||
if (ent instanceof LivingEntity)
|
||||
{
|
||||
LivingEntity le = (LivingEntity)ent;
|
||||
if (le.getCustomName() != null)
|
||||
return le.getCustomName();
|
||||
}
|
||||
|
||||
return getName(ent.getType());
|
||||
}
|
||||
|
||||
@ -322,7 +329,7 @@ public class UtilEnt
|
||||
}
|
||||
}
|
||||
else
|
||||
if (loc.getY() > ent.getLocation().getY() && loc.getY() < ent.getLocation().getY() + 1)
|
||||
if (loc.getY() > ent.getLocation().getY() && loc.getY() < ent.getLocation().getY() + 2)
|
||||
if (UtilMath.offset2d(loc, ent.getLocation()) < 0.5 * mult)
|
||||
return true;
|
||||
|
||||
|
@ -0,0 +1,107 @@
|
||||
package mineplex.core.common.util;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import net.minecraft.server.v1_6_R3.Packet63WorldParticles;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class UtilParticle
|
||||
{
|
||||
public enum ParticleType
|
||||
{
|
||||
HUGE_EXPLOSION("hugeexplosion"),
|
||||
LARGE_EXPLODE("largeexplode"),
|
||||
FIREWORKS_SPARK("fireworksSpark"),
|
||||
BUBBLE("bubble"),
|
||||
SUSPEND("suspend"),
|
||||
DEPTH_SUSPEND("depthSuspend"),
|
||||
TOWN_AURA("townaura"),
|
||||
CRIT("crit"),
|
||||
MAGIC_CRIT("magicCrit"),
|
||||
MOB_SPELL("mobSpell"),
|
||||
MOB_SPELL_AMBIENT("mobSpellAmbient"),
|
||||
SPELL("spell"),
|
||||
INSTANT_SPELL("instantSpell"),
|
||||
WITCH_MAGIC("witchMagic"),
|
||||
NOTE("note"),
|
||||
PORTAL("portal"),
|
||||
ENCHANTMENT_TABLE("enchantmenttable"),
|
||||
EXPLODE("explode"),
|
||||
FLAME("flame"),
|
||||
LAVA("lava"),
|
||||
FOOTSTEP("footstep"),
|
||||
SPLASH("splash"),
|
||||
LARGE_SMOKE("largesmoke"),
|
||||
CLOUD("cloud"),
|
||||
RED_DUST("reddust"),
|
||||
SNOWBALL_POOF("snowballpoof"),
|
||||
DRIP_WATER("dripWater"),
|
||||
DRIP_LAVA("dripLava"),
|
||||
SNOW_SHOVEL("snowshovel"),
|
||||
SLIME("slime"),
|
||||
HEART("heart"),
|
||||
ANGRY_VILLAGER("angryVillager"),
|
||||
HAPPY_VILLAGER("happerVillager");
|
||||
|
||||
public String particleName;
|
||||
|
||||
ParticleType(String particleName)
|
||||
{
|
||||
this.particleName = particleName;
|
||||
}
|
||||
}
|
||||
|
||||
public static void PlayParticle(Player player, ParticleType type, Location location, float offsetX, float offsetY, float offsetZ, float speed, int count)
|
||||
{
|
||||
Packet63WorldParticles packet = new Packet63WorldParticles();
|
||||
|
||||
for (Field field : packet.getClass().getDeclaredFields())
|
||||
{
|
||||
try
|
||||
{
|
||||
field.setAccessible(true);
|
||||
String fieldName = field.getName();
|
||||
switch (fieldName)
|
||||
{
|
||||
case "a":
|
||||
field.set(packet, type.particleName); //Particle name
|
||||
break;
|
||||
case "b":
|
||||
field.setFloat(packet, (float)location.getX()); //Block X
|
||||
break;
|
||||
case "c":
|
||||
field.setFloat(packet, (float)location.getY()); //Block Y
|
||||
break;
|
||||
case "d":
|
||||
field.setFloat(packet, (float)location.getZ()); //Block Z
|
||||
break;
|
||||
case "e":
|
||||
field.setFloat(packet, offsetX); //Random X Offset
|
||||
break;
|
||||
case "f":
|
||||
field.setFloat(packet, offsetY); //Random Y Offset
|
||||
break;
|
||||
case "g":
|
||||
field.setFloat(packet, offsetZ); //Random Z Offset
|
||||
break;
|
||||
case "h":
|
||||
field.setFloat(packet, speed); //Speed/data of particles
|
||||
break;
|
||||
case "i":
|
||||
field.setInt(packet, count); //Amount of particles
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
System.out.println(e.getMessage());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
|
||||
}
|
||||
}
|
@ -357,7 +357,7 @@ public class AntiHack extends MiniPlugin
|
||||
|
||||
//Staff
|
||||
for (Player other : UtilServer.getPlayers())
|
||||
if (other.isOp())
|
||||
if (other.isOp() && other.getGameMode() == GameMode.CREATIVE)
|
||||
UtilPlayer.message(other, C.cGold + C.Bold + player.getName() + " received offense for " + type + ".");
|
||||
|
||||
//Print (Debug)
|
||||
|
@ -177,11 +177,13 @@ public class PetManager extends MiniClientPlugin<PetClient>
|
||||
}
|
||||
}
|
||||
|
||||
/* not necessary for hub
|
||||
@EventHandler(priority = EventPriority.HIGHEST)
|
||||
public void onPlayerInventoryClick(InventoryClickEvent event)
|
||||
{
|
||||
UtilInv.DisallowMovementOf(event, "Pet Menu", Material.BONE, (byte)0, true, true);
|
||||
}
|
||||
*/
|
||||
|
||||
@EventHandler
|
||||
public void onPlayerJoin(PlayerJoinEvent event)
|
||||
|
@ -13,7 +13,6 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Egg;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
@ -23,7 +22,7 @@ import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.ItemSpawnEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.inventory.InventoryType;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
@ -56,6 +55,7 @@ import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.hub.gadget.GadgetManager;
|
||||
import mineplex.hub.modules.*;
|
||||
import mineplex.hub.mount.MountManager;
|
||||
import mineplex.hub.party.Party;
|
||||
import mineplex.hub.party.PartyManager;
|
||||
import mineplex.hub.tutorial.TutorialManager;
|
||||
@ -73,6 +73,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
||||
private PartyManager _partyManager;
|
||||
private Portal _portal;
|
||||
|
||||
private VisibilityManager _visibilityManager;
|
||||
private TutorialManager _tutorialManager;
|
||||
private TextManager _textCreator;
|
||||
private ParkourManager _parkour;
|
||||
@ -99,6 +100,7 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
||||
_conditionManager = conditionManager;
|
||||
_donationManager = donationManager;
|
||||
_disguiseManager = disguiseManager;
|
||||
|
||||
_portal = portal;
|
||||
|
||||
_spawn = new Location(UtilWorld.getWorld("world"), 0.5, 74, 0.5);
|
||||
@ -106,16 +108,17 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
||||
_textCreator = new TextManager(this);
|
||||
_parkour = new ParkourManager(this, donationManager, taskManager);
|
||||
|
||||
new MountManager(this);
|
||||
new MapManager(this);
|
||||
new WorldManager(this);
|
||||
new JumpManager(this);
|
||||
new NewsManager(this);
|
||||
|
||||
new GadgetManager(this);
|
||||
new MountManager(this);
|
||||
|
||||
_partyManager = partyManager;
|
||||
_tutorialManager = new TutorialManager(this, donationManager, taskManager, _textCreator);
|
||||
_visibilityManager = new VisibilityManager(this);
|
||||
|
||||
DragonTextB = GetDragonText();
|
||||
}
|
||||
@ -402,6 +405,12 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void InventoryCancel(InventoryClickEvent event)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void UpdateScoreboard(UpdateEvent event)
|
||||
{
|
||||
@ -567,6 +576,11 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
||||
return _donationManager;
|
||||
}
|
||||
|
||||
public DisguiseManager GetDisguise()
|
||||
{
|
||||
return _disguiseManager;
|
||||
}
|
||||
|
||||
public ParkourManager GetParkour()
|
||||
{
|
||||
return _parkour;
|
||||
@ -577,28 +591,13 @@ public class HubManager extends MiniClientPlugin<HubClient>
|
||||
return _spawn.clone();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void UpdateVisibility(UpdateEvent event)
|
||||
public TutorialManager GetTutorial()
|
||||
{
|
||||
if (event.getType() != UpdateType.FAST)
|
||||
return;
|
||||
return _tutorialManager;
|
||||
}
|
||||
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
public VisibilityManager GetVisibility()
|
||||
{
|
||||
for (Player other : UtilServer.getPlayers())
|
||||
{
|
||||
if (player.equals(other))
|
||||
continue;
|
||||
|
||||
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);
|
||||
}
|
||||
else
|
||||
{
|
||||
other.showPlayer(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
return _visibilityManager;
|
||||
}
|
||||
}
|
||||
|
@ -4,11 +4,11 @@ import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.command.CommandBase;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.hub.modules.MountManager;
|
||||
import mineplex.hub.modules.AdminMountManager;
|
||||
|
||||
public class HorseSpawn extends CommandBase<MountManager>
|
||||
public class HorseSpawn extends CommandBase<AdminMountManager>
|
||||
{
|
||||
public HorseSpawn(MountManager plugin)
|
||||
public HorseSpawn(AdminMountManager plugin)
|
||||
{
|
||||
super(plugin, Rank.OWNER, new String[] {"horse"});
|
||||
}
|
||||
|
@ -2,10 +2,11 @@ package mineplex.hub.gadget.gadgets;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Skeleton.SkeletonType;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.player.PlayerDropItemEvent;
|
||||
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.core.disguise.disguises.DisguiseSkeleton;
|
||||
import mineplex.hub.gadget.GadgetManager;
|
||||
import mineplex.hub.gadget.types.ArmorGadget;
|
||||
|
||||
@ -13,28 +14,33 @@ public class Halloween2013_Helmet extends ArmorGadget
|
||||
{
|
||||
public Halloween2013_Helmet(GadgetManager manager)
|
||||
{
|
||||
super(manager, "Halloween2013_Helmet", "Pumpkin Helmet", ArmorSlot.Helmet, Material.PUMPKIN, (byte)0);
|
||||
super(manager, "Halloween2013_Helmet", "Pumpkin Kings Head", ArmorSlot.Helmet, Material.PUMPKIN, (byte)0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Enable(Player player)
|
||||
{
|
||||
this.ApplyArmor(player);
|
||||
|
||||
DisguiseSkeleton disguise = new DisguiseSkeleton(player);
|
||||
disguise.SetName(player.getName());
|
||||
disguise.SetSkeletonType(SkeletonType.WITHER);
|
||||
Manager.Manager.GetDisguise().disguise(disguise);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Disable(Player player)
|
||||
{
|
||||
this.RemoveArmor(player);
|
||||
Manager.Manager.GetDisguise().undisguise(player);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void Effect(UpdateEvent event)
|
||||
public void TOGGLE(PlayerDropItemEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.FAST)
|
||||
return;
|
||||
|
||||
for (Player player : this.GetActive())
|
||||
Manager.Manager.GetCondition().Factory().Invisible(GetName(), player, player, 1.9, 0, false, false, true);
|
||||
if (!this.IsActive(event.getPlayer()))
|
||||
Enable(event.getPlayer());
|
||||
else
|
||||
Disable(event.getPlayer());
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,5 @@
|
||||
package mineplex.hub.gadget.types;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
@ -20,8 +18,6 @@ public abstract class ArmorGadget extends Gadget
|
||||
Boots
|
||||
}
|
||||
|
||||
private HashSet<Player> _active = new HashSet<Player>();
|
||||
|
||||
private ArmorSlot _slot;
|
||||
private Material _material;
|
||||
private byte _data;
|
||||
@ -35,10 +31,7 @@ public abstract class ArmorGadget extends Gadget
|
||||
_data = data;
|
||||
}
|
||||
|
||||
public HashSet<Player> GetActive()
|
||||
{
|
||||
return _active;
|
||||
}
|
||||
|
||||
|
||||
public ArmorSlot GetSlot()
|
||||
{
|
||||
|
@ -15,6 +15,7 @@ public abstract class Gadget implements Listener
|
||||
public GadgetManager Manager;
|
||||
|
||||
private HashSet<Player> _owners = new HashSet<Player>();
|
||||
protected HashSet<Player> _active = new HashSet<Player>();
|
||||
|
||||
private String _code;
|
||||
private String _name;
|
||||
@ -44,6 +45,16 @@ public abstract class Gadget implements Listener
|
||||
return _owners;
|
||||
}
|
||||
|
||||
public HashSet<Player> GetActive()
|
||||
{
|
||||
return _active;
|
||||
}
|
||||
|
||||
public boolean IsActive(Player player)
|
||||
{
|
||||
return _active.contains(player);
|
||||
}
|
||||
|
||||
public boolean HasGadget(Player player)
|
||||
{
|
||||
return _owners.contains(player);
|
||||
@ -62,6 +73,7 @@ public abstract class Gadget implements Listener
|
||||
public void PlayerQuit(PlayerQuitEvent event)
|
||||
{
|
||||
_owners.remove(event.getPlayer());
|
||||
Disable(event.getPlayer());
|
||||
}
|
||||
|
||||
public abstract void Enable(Player player);
|
||||
|
@ -4,8 +4,6 @@ import java.util.HashSet;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
@ -15,8 +13,6 @@ import mineplex.hub.gadget.GadgetManager;
|
||||
|
||||
public abstract class ItemGadget extends Gadget
|
||||
{
|
||||
private HashSet<Player> _active = new HashSet<Player>();
|
||||
|
||||
private Material _material;
|
||||
private byte _data;
|
||||
|
||||
|
@ -23,13 +23,13 @@ import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class MountManager extends MiniPlugin
|
||||
public class AdminMountManager extends MiniPlugin
|
||||
{
|
||||
private HubManager Manager;
|
||||
|
||||
private HashMap<Player, Horse> _mounts = new HashMap<Player, Horse>();
|
||||
|
||||
public MountManager(HubManager manager)
|
||||
public AdminMountManager(HubManager manager)
|
||||
{
|
||||
super("Mount Manager", manager.GetPlugin());
|
||||
|
||||
@ -68,22 +68,6 @@ public class MountManager extends MiniPlugin
|
||||
horse.remove();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void PlayerJoin(PlayerJoinEvent event)
|
||||
{
|
||||
if (!Manager.GetClients().Get(event.getPlayer()).GetRank().Has(Rank.OWNER))
|
||||
return;
|
||||
|
||||
final Player fPlayer = event.getPlayer();
|
||||
Manager.GetPlugin().getServer().getScheduler().scheduleSyncDelayedTask(Manager.GetPlugin(), new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
Spawn(fPlayer, Variant.HORSE).setPassenger(fPlayer);
|
||||
}
|
||||
}, 5);
|
||||
}
|
||||
|
||||
public void HorseCommand(Player caller, String[] args)
|
||||
{
|
||||
if (args == null || args.length == 0)
|
||||
@ -334,10 +318,4 @@ public class MountManager extends MiniPlugin
|
||||
if (event.getEntity().getItemStack().getType() == Material.LEASH)
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void HangingBreakEvent(org.bukkit.event.hanging.HangingBreakEvent event)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
@ -31,9 +31,12 @@ public class NewsManager extends MiniPlugin
|
||||
|
||||
_news = new String[]
|
||||
{
|
||||
"New Game: " + C.cRed + C.Bold + "Halloween Horror" + ChatColor.RESET + "! Limited time!",
|
||||
"Halloween Hub Gadgets! Unlockable for limited time!",
|
||||
"New Super Smash Mobs Kit: " + C.cYellow + C.Bold + "Witch" + ChatColor.RESET + "!"
|
||||
"New Game: " + C.cGold + C.Bold + "Halloween Horror" + ChatColor.RESET + "! Limited time!",
|
||||
"New Super Smash Mobs Kit: " + C.cYellow + C.Bold + "Witch" + ChatColor.RESET + "!",
|
||||
"New Halloween Hub Items! Limited time to unlock!",
|
||||
"New Hub Mount: " + C.cYellow + C.Bold + "Horse of Horror" + ChatColor.RESET + "!",
|
||||
"New Hub Gadget: " + C.cYellow + C.Bold + "Pumpkin Kings Head" + ChatColor.RESET + "!",
|
||||
"New Hub Gadget: " + C.cYellow + C.Bold + "Bat Cannon" + ChatColor.RESET + "!",
|
||||
};
|
||||
}
|
||||
|
||||
@ -53,7 +56,7 @@ public class NewsManager extends MiniPlugin
|
||||
_mineplexIndex = (_mineplexIndex + 1)%6;
|
||||
|
||||
//News Change
|
||||
if (UtilTime.elapsed(_newsTime, 3000))
|
||||
if (UtilTime.elapsed(_newsTime, 4500))
|
||||
{
|
||||
_newsIndex = (_newsIndex + 1)%_news.length;
|
||||
_newsTime = System.currentTimeMillis();
|
||||
|
@ -141,7 +141,7 @@ public class ParkourManager extends MiniPlugin
|
||||
player.eject();
|
||||
player.leaveVehicle();
|
||||
|
||||
UtilPlayer.message(player, F.main("Parkour", "You can't run parkours while stacked!"));
|
||||
UtilPlayer.message(player, F.main("Parkour", "You can't be a passenger near Parkours!"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -25,8 +25,6 @@ import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilEvent;
|
||||
import mineplex.core.common.util.UtilGear;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||
@ -43,11 +41,13 @@ public class StackerManager extends MiniPlugin implements IThrown
|
||||
|
||||
private ProjectileManager _projectileManager;
|
||||
|
||||
private HashSet<String> _disabled = new HashSet<String>();
|
||||
private HashSet<Player> _disabled = new HashSet<Player>();
|
||||
private HashSet<Entity> _tempStackShift = new HashSet<Entity>();
|
||||
|
||||
private HashMap<String, Long> _portalTime = new HashMap<String, Long>();
|
||||
|
||||
private int _slot = 7;
|
||||
|
||||
public StackerManager(HubManager manager)
|
||||
{
|
||||
super("Stacker", manager.GetPlugin());
|
||||
@ -58,46 +58,62 @@ public class StackerManager extends MiniPlugin implements IThrown
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void ToggleInvolvement(PlayerInteractEvent event)
|
||||
public void ToggleVisibility(PlayerInteractEvent event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (UtilGear.isMat(player.getItemInHand(), Material.GRILLED_PORK))
|
||||
{
|
||||
_disabled.add(player.getName());
|
||||
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"));
|
||||
UtilInv.Update(player);
|
||||
if (player.getInventory().getHeldItemSlot() != _slot)
|
||||
return;
|
||||
|
||||
event.setCancelled(true);
|
||||
}
|
||||
else if (UtilGear.isMat(player.getItemInHand(), Material.PORK))
|
||||
|
||||
if (_disabled.remove(player))
|
||||
{
|
||||
_disabled.remove(player.getName());
|
||||
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"));
|
||||
UtilInv.Update(player);
|
||||
player.getInventory().setItem(_slot, ItemStackFactory.Instance.CreateStack(Material.REDSTONE_TORCH_ON, (byte)0, 1,
|
||||
C.cYellow + "Stacker" + C.cWhite + " - " + C.cGreen + "Enabled"));
|
||||
}
|
||||
else
|
||||
{
|
||||
_disabled.add(player);
|
||||
UtilPlayer.message(player, F.main("Stacker", "You are no longer stackable... boring!"));
|
||||
|
||||
event.setCancelled(true);
|
||||
player.getInventory().setItem(_slot, ItemStackFactory.Instance.CreateStack(Material.REDSTONE_TORCH_OFF, (byte)0, 1,
|
||||
C.cYellow + "Stacker" + C.cWhite + " - " + C.cRed + "Disabled"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@EventHandler
|
||||
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(_slot, ItemStackFactory.Instance.CreateStack(Material.REDSTONE_TORCH_ON, (byte)0, 1,
|
||||
C.cYellow + "Stacker" + C.cWhite + " - " + C.cGreen + "Enabled"));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void PlayerQuit(PlayerQuitEvent event)
|
||||
{
|
||||
_disabled.remove(event.getPlayer().getName());
|
||||
_disabled.remove(event.getPlayer());
|
||||
_tempStackShift.remove(event.getPlayer());
|
||||
_portalTime.remove(event.getPlayer().getName());
|
||||
}
|
||||
|
||||
public boolean CanStack(LivingEntity ent)
|
||||
{
|
||||
if (!(ent instanceof Player))
|
||||
return true;
|
||||
|
||||
if (_disabled.contains(ent))
|
||||
return false;
|
||||
|
||||
if (Manager.GetVisibility().IsHiding(ent))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void GrabEntity(PlayerInteractEntityEvent event)
|
||||
{
|
||||
@ -116,7 +132,7 @@ public class StackerManager extends MiniPlugin implements IThrown
|
||||
return;
|
||||
}
|
||||
|
||||
if (_disabled.contains(stacker.getName()))
|
||||
if (!CanStack(stacker))
|
||||
{
|
||||
UtilPlayer.message(stacker, F.main("Stacker", "You are not playing stacker."));
|
||||
return;
|
||||
@ -141,7 +157,7 @@ public class StackerManager extends MiniPlugin implements IThrown
|
||||
if (stackee instanceof Player && ((Player)stackee).getGameMode() != GameMode.SURVIVAL)
|
||||
return;
|
||||
|
||||
if (stackee instanceof Player && _disabled.contains(((Player)stackee).getName()))
|
||||
if (stackee instanceof Player && !CanStack(((Player)stackee)))
|
||||
{
|
||||
UtilPlayer.message(stacker, F.main("Stacker", F.name(UtilEnt.getName(stackee)) + " is not playing stacker."));
|
||||
return;
|
||||
|
@ -0,0 +1,168 @@
|
||||
package mineplex.hub.modules;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftPlayer;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.inventory.InventoryType;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilEvent;
|
||||
import mineplex.core.common.util.UtilGear;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
|
||||
import mineplex.hub.HubManager;
|
||||
|
||||
public class VisibilityManager extends MiniPlugin
|
||||
{
|
||||
public HubManager Manager;
|
||||
|
||||
private HashSet<Player> _hide = new HashSet<Player>();
|
||||
|
||||
private int _slot = 8;
|
||||
|
||||
public VisibilityManager(HubManager manager)
|
||||
{
|
||||
super("Visibility Manager", manager.GetPlugin());
|
||||
|
||||
Manager = manager;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void PlayerJoin(PlayerJoinEvent event)
|
||||
{
|
||||
event.getPlayer().getInventory().setItem(_slot, ItemStackFactory.Instance.CreateStack(Material.EYE_OF_ENDER, (byte)0, 1,
|
||||
C.cYellow + "Show Players" + C.cWhite + " - " + C.cGreen + "Enabled"));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void PlayerQuit(PlayerQuitEvent event)
|
||||
{
|
||||
_hide.remove(event.getPlayer());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void ToggleVisibility(PlayerInteractEvent event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (player.getInventory().getHeldItemSlot() != _slot)
|
||||
return;
|
||||
|
||||
event.setCancelled(true);
|
||||
|
||||
if (_hide.remove(player))
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Visibility", "All players are now visible."));
|
||||
|
||||
player.getInventory().setItem(_slot, ItemStackFactory.Instance.CreateStack(Material.EYE_OF_ENDER, (byte)0, 1,
|
||||
C.cYellow + "Show Players" + C.cWhite + " - " + C.cGreen + "Enabled"));
|
||||
}
|
||||
else
|
||||
{
|
||||
_hide.add(player);
|
||||
UtilPlayer.message(player, F.main("Visibility", "All players are now invisible."));
|
||||
|
||||
player.getInventory().setItem(_slot, ItemStackFactory.Instance.CreateStack(Material.ENDER_PEARL, (byte)0, 1,
|
||||
C.cYellow + "Show Players" + C.cWhite + " - " + C.cRed + "Disabled"));
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void UpdateVisibility(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.FAST)
|
||||
return;
|
||||
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
{
|
||||
for (Player other : UtilServer.getPlayers())
|
||||
{
|
||||
if (player.equals(other))
|
||||
continue;
|
||||
|
||||
if (_hide.contains(other) || UtilMath.offset(player.getLocation(), Manager.GetSpawn()) < 4 ||
|
||||
Manager.GetTutorial().InTutorial(other) || Manager.GetTutorial().InTutorial(player) ||
|
||||
(player.getOpenInventory().getType() != InventoryType.CRAFTING && player.getOpenInventory().getType() != InventoryType.CREATIVE))
|
||||
{
|
||||
((CraftPlayer)other).hidePlayer(player, true, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
other.showPlayer(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean IsHiding(LivingEntity ent)
|
||||
{
|
||||
return _hide.contains(ent);
|
||||
}
|
||||
|
||||
public HashMap<Player, Integer> _particle = new HashMap<Player, Integer>();
|
||||
|
||||
@EventHandler
|
||||
public void ParticleSwap(PlayerInteractEvent event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (!player.isOp())
|
||||
return;
|
||||
|
||||
if (!UtilGear.isMat(player.getItemInHand(), Material.GOLD_NUGGET))
|
||||
return;
|
||||
|
||||
int past = 0;
|
||||
if (_particle.containsKey(player))
|
||||
past = _particle.get(player);
|
||||
|
||||
if (UtilEvent.isAction(event, ActionType.R))
|
||||
{
|
||||
past = (past+1)%ParticleType.values().length;
|
||||
}
|
||||
else if (UtilEvent.isAction(event, ActionType.L))
|
||||
{
|
||||
past = past - 1;
|
||||
if (past < 0)
|
||||
past = ParticleType.values().length - 1;
|
||||
}
|
||||
|
||||
_particle.put(player, past);
|
||||
|
||||
player.sendMessage("Particle: " + ParticleType.values()[past]);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void Particles(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.FAST)
|
||||
return;
|
||||
|
||||
for (Player player : _particle.keySet())
|
||||
{
|
||||
for (Player other : UtilServer.getPlayers())
|
||||
{
|
||||
UtilParticle.PlayParticle(other, ParticleType.values()[_particle.get(player)], player.getLocation().add(1, 1, 0), 0f, 0f, 0f, 0, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -4,6 +4,7 @@ import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
@ -12,14 +13,12 @@ import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.hub.HubManager;
|
||||
import net.minecraft.server.v1_6_R3.EntitySkeleton;
|
||||
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftSkeleton;
|
||||
import org.bukkit.entity.Chicken;
|
||||
import org.bukkit.entity.Cow;
|
||||
import org.bukkit.entity.Creature;
|
||||
@ -28,7 +27,6 @@ import org.bukkit.entity.Pig;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Skeleton;
|
||||
import org.bukkit.entity.Skeleton.SkeletonType;
|
||||
import org.bukkit.entity.Zombie;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.block.BlockBreakEvent;
|
||||
@ -94,6 +92,8 @@ public class WorldManager extends MiniPlugin
|
||||
|
||||
ent.getEquipment().setHelmet(ItemStackFactory.Instance.CreateStack(Material.PUMPKIN));
|
||||
|
||||
ent.setCustomName(C.cYellow + "Pumpkin Minion");
|
||||
|
||||
_mobs.add(ent);
|
||||
|
||||
Manager.GetCondition().Factory().Invisible("Perm", ent, ent, 999999999, 0, false, false, true);
|
||||
|
187
Plugins/Mineplex.Hub/src/mineplex/hub/mount/Mount.java
Normal file
187
Plugins/Mineplex.Hub/src/mineplex/hub/mount/Mount.java
Normal file
@ -0,0 +1,187 @@
|
||||
package mineplex.hub.mount;
|
||||
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import net.minecraft.server.v1_6_R3.EntityCreature;
|
||||
import net.minecraft.server.v1_6_R3.Navigation;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftCreature;
|
||||
import org.bukkit.entity.Horse.Variant;
|
||||
import org.bukkit.entity.Horse;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Horse.Color;
|
||||
import org.bukkit.entity.Horse.Style;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class Mount implements Listener
|
||||
{
|
||||
private HashSet<Player> _owners = new HashSet<Player>();
|
||||
private HashMap<Player, Horse> _active = new HashMap<Player, Horse>();
|
||||
|
||||
public MountManager Manager;
|
||||
|
||||
private String _code;
|
||||
|
||||
private String _name;
|
||||
|
||||
private Color _color;
|
||||
private Style _style;
|
||||
private Variant _variant;
|
||||
private double _jump;
|
||||
private Material _armor;
|
||||
|
||||
public Mount(MountManager manager, String code, String name, Color color, Style style, Variant variant, double jump, Material armor)
|
||||
{
|
||||
Manager = manager;
|
||||
|
||||
_code = code;
|
||||
_name = name;
|
||||
_color = color;
|
||||
_style = style;
|
||||
_variant = variant;
|
||||
_jump = jump;
|
||||
_armor = armor;
|
||||
|
||||
Manager.GetPlugin().getServer().getPluginManager().registerEvents(this, Manager.GetPlugin());
|
||||
}
|
||||
|
||||
public String GetName()
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
|
||||
public String GetCode()
|
||||
{
|
||||
return _code;
|
||||
}
|
||||
|
||||
public HashSet<Player> GetOwners()
|
||||
{
|
||||
return _owners;
|
||||
}
|
||||
|
||||
public HashMap<Player, Horse> GetActive()
|
||||
{
|
||||
return _active;
|
||||
}
|
||||
|
||||
public boolean IsActive(Player player)
|
||||
{
|
||||
return _active.containsKey(player);
|
||||
}
|
||||
|
||||
public boolean HasMount(Player player)
|
||||
{
|
||||
return _owners.contains(player);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void PlayerJoin(PlayerJoinEvent event)
|
||||
{
|
||||
if (event.getPlayer().isOp())
|
||||
_owners.add(event.getPlayer());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void PlayerQuit(PlayerQuitEvent event)
|
||||
{
|
||||
_owners.remove(event.getPlayer());
|
||||
Disable(event.getPlayer());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void UpdateHorse(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.FAST)
|
||||
return;
|
||||
|
||||
Iterator<Player> activeIterator = _active.keySet().iterator();
|
||||
|
||||
while (activeIterator.hasNext())
|
||||
{
|
||||
Player player = activeIterator.next();
|
||||
Horse horse = _active.get(player);
|
||||
|
||||
//Invalid (dead)
|
||||
if (!horse.isValid())
|
||||
{
|
||||
horse.remove();
|
||||
activeIterator.remove();
|
||||
continue;
|
||||
}
|
||||
|
||||
//Move
|
||||
EntityCreature ec = ((CraftCreature)horse).getHandle();
|
||||
Navigation nav = ec.getNavigation();
|
||||
|
||||
Location target = player.getLocation().add(UtilAlg.getTrajectory(player, horse).multiply(2));
|
||||
|
||||
if (UtilMath.offset(horse.getLocation(), target) > 12)
|
||||
{
|
||||
target = horse.getLocation();
|
||||
target.add(UtilAlg.getTrajectory(horse, player).multiply(12));
|
||||
nav.a(target.getX(), target.getY(), target.getZ(), 1.4f);
|
||||
}
|
||||
else if (UtilMath.offset(horse, player) > 43)
|
||||
{
|
||||
nav.a(target.getX(), target.getY(), target.getZ(), 1.4f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void Enable(Player player)
|
||||
{
|
||||
//Remove other mounts
|
||||
Manager.DeregisterAll(player);
|
||||
|
||||
Horse horse = player.getWorld().spawn(player.getLocation(), Horse.class);
|
||||
horse.setAdult();
|
||||
horse.setAgeLock(true);
|
||||
horse.setColor(_color);
|
||||
horse.setStyle(_style);
|
||||
horse.setVariant(_variant);
|
||||
horse.setOwner(player);
|
||||
horse.setMaxDomestication(1);
|
||||
horse.setJumpStrength(_jump);
|
||||
horse.getInventory().setSaddle(new ItemStack(Material.SADDLE));
|
||||
|
||||
if (_armor != null)
|
||||
horse.getInventory().setArmor(new ItemStack(_armor));
|
||||
|
||||
horse.setCustomName(player.getName() + "'s " + _name);
|
||||
horse.setCustomNameVisible(true);
|
||||
|
||||
//Inform
|
||||
UtilPlayer.message(player, F.main("Mount", "You spawned " + F.elem(_name) + "."));
|
||||
|
||||
//Store
|
||||
_active.put(player, horse);
|
||||
}
|
||||
|
||||
public void Disable(Player player)
|
||||
{
|
||||
Horse horse = _active.remove(player);
|
||||
if (horse != null)
|
||||
{
|
||||
horse.remove();
|
||||
|
||||
//Inform
|
||||
UtilPlayer.message(player, F.main("Mount", "You despawned " + F.elem(_name) + "."));
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,70 @@
|
||||
package mineplex.hub.mount;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Horse;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.ItemSpawnEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.hub.HubManager;
|
||||
import mineplex.hub.mount.types.*;
|
||||
|
||||
public class MountManager extends MiniPlugin
|
||||
{
|
||||
public HubManager Manager;
|
||||
|
||||
private HashSet<Mount> _types;
|
||||
|
||||
public MountManager(HubManager manager)
|
||||
{
|
||||
super("Gadget Manager", manager.GetPlugin());
|
||||
|
||||
Manager = manager;
|
||||
|
||||
CreateGadgets();
|
||||
}
|
||||
|
||||
private void CreateGadgets()
|
||||
{
|
||||
_types = new HashSet<Mount>();
|
||||
|
||||
_types.add(new Undead(this));
|
||||
_types.add(new Mule(this));
|
||||
}
|
||||
|
||||
//Disallows two mounts active
|
||||
public void DeregisterAll(Player player)
|
||||
{
|
||||
for (Mount mount : _types)
|
||||
mount.Disable(player);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void HorseInteract(PlayerInteractEntityEvent event)
|
||||
{
|
||||
if (!(event.getRightClicked() instanceof Horse))
|
||||
return;
|
||||
|
||||
Player player = event.getPlayer();
|
||||
Horse horse = (Horse)event.getRightClicked();
|
||||
|
||||
if (horse.getOwner() == null || !horse.getOwner().equals(player))
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Mount", "This is not your Mount!"));
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void LeashDropCancel(ItemSpawnEvent event)
|
||||
{
|
||||
if (event.getEntity().getItemStack().getType() == Material.LEASH)
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
16
Plugins/Mineplex.Hub/src/mineplex/hub/mount/types/Mule.java
Normal file
16
Plugins/Mineplex.Hub/src/mineplex/hub/mount/types/Mule.java
Normal file
@ -0,0 +1,16 @@
|
||||
package mineplex.hub.mount.types;
|
||||
|
||||
import org.bukkit.entity.Horse.Color;
|
||||
import org.bukkit.entity.Horse.Style;
|
||||
import org.bukkit.entity.Horse.Variant;
|
||||
|
||||
import mineplex.hub.mount.Mount;
|
||||
import mineplex.hub.mount.MountManager;
|
||||
|
||||
public class Mule extends Mount
|
||||
{
|
||||
public Mule(MountManager manager)
|
||||
{
|
||||
super(manager, "MountMule", "Horse of Horror", Color.BLACK, Style.BLACK_DOTS, Variant.MULE, 1.0, null);
|
||||
}
|
||||
}
|
@ -0,0 +1,68 @@
|
||||
package mineplex.hub.mount.types;
|
||||
|
||||
import org.bukkit.entity.Horse;
|
||||
import org.bukkit.entity.Horse.Color;
|
||||
import org.bukkit.entity.Horse.Style;
|
||||
import org.bukkit.entity.Horse.Variant;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.player.PlayerToggleSneakEvent;
|
||||
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.hub.mount.Mount;
|
||||
import mineplex.hub.mount.MountManager;
|
||||
|
||||
public class Undead extends Mount
|
||||
{
|
||||
public Undead(MountManager manager)
|
||||
{
|
||||
super(manager, "MountHalloween2013", "Horse of Horror", Color.BLACK, Style.BLACK_DOTS, Variant.SKELETON_HORSE, 0.8, null);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void Test(PlayerToggleSneakEvent event)
|
||||
{
|
||||
if (event.getPlayer().isSneaking())
|
||||
this.Enable(event.getPlayer());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void Trail(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() == UpdateType.TICK)
|
||||
{
|
||||
for (Horse horse : GetActive().values())
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
{
|
||||
try
|
||||
{
|
||||
UtilParticle.PlayParticle(player, ParticleType.FLAME, horse.getLocation().add(0, 1, 0), 0.25f, 0.25f, 0.25f, 0, 2);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (event.getType() == UpdateType.FAST)
|
||||
{
|
||||
for (Horse horse : GetActive().values())
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
{
|
||||
try
|
||||
{
|
||||
UtilParticle.PlayParticle(player, ParticleType.LAVA, horse.getLocation().add(0, 1, 0), 0.25f, 0.25f, 0.25f, 0, 1);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -10,14 +10,12 @@ import org.bukkit.Sound;
|
||||
import org.bukkit.entity.*;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.entity.EntityBreakDoorEvent;
|
||||
import org.bukkit.event.entity.EntityDeathEvent;
|
||||
import org.bukkit.event.entity.EntityTargetEvent;
|
||||
import org.bukkit.event.entity.ItemSpawnEvent;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
@ -26,25 +24,21 @@ import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.SoloGame;
|
||||
import nautilus.game.arcade.game.Game.GameState;
|
||||
import nautilus.game.arcade.game.games.halloween.creatures.*;
|
||||
import nautilus.game.arcade.game.games.halloween.kits.KitDefault;
|
||||
import nautilus.game.arcade.game.games.spleef.kits.*;
|
||||
import nautilus.game.arcade.game.games.halloween.kits.*;
|
||||
import nautilus.game.arcade.game.games.halloween.waves.*;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
|
||||
public class Halloween extends SoloGame
|
||||
{
|
||||
//Wave Data
|
||||
private ArrayList<ArrayList<Location>> _spawns;
|
||||
private int _spawnWave = 0;
|
||||
private int _spawnTick = 0;
|
||||
|
||||
private String _waveName = "";
|
||||
private ArrayList<WaveBase> _waves;
|
||||
private int _wave = 0;
|
||||
private long _waveStart = 0;
|
||||
private long _waveDuration = 0;
|
||||
|
||||
private PumpkinKing _king;
|
||||
|
||||
private HashSet<CreatureBase> _mobs = new HashSet<CreatureBase>();
|
||||
private PumpkinKing _king;
|
||||
|
||||
public Halloween(ArcadeManager manager)
|
||||
{
|
||||
@ -52,7 +46,9 @@ public class Halloween extends SoloGame
|
||||
|
||||
new Kit[]
|
||||
{
|
||||
new KitDefault(manager)
|
||||
new KitFinn(manager),
|
||||
new KitRobinHood(manager),
|
||||
new KitThor(manager),
|
||||
},
|
||||
|
||||
new String[]
|
||||
@ -66,10 +62,12 @@ public class Halloween extends SoloGame
|
||||
|
||||
this.WorldTimeSet = 16000;
|
||||
|
||||
this.ItemDrop = true;
|
||||
this.ItemPickup = true;
|
||||
this.ItemDrop = false;
|
||||
this.ItemPickup = false;
|
||||
|
||||
this.PrepareFreeze = false;
|
||||
|
||||
this.HungerSet = 20;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -80,6 +78,16 @@ public class Halloween extends SoloGame
|
||||
_spawns.add(WorldData.GetDataLocs("YELLOW"));
|
||||
_spawns.add(WorldData.GetDataLocs("GREEN"));
|
||||
_spawns.add(WorldData.GetDataLocs("BLUE"));
|
||||
|
||||
_waves = new ArrayList<WaveBase>();
|
||||
_waves.add(new Wave1(this));
|
||||
_waves.add(new Wave2(this));
|
||||
_waves.add(new Wave3(this));
|
||||
//_waves.add(new Wave4(this));
|
||||
//_waves.add(new Wave5(this));
|
||||
//_waves.add(new Wave6(this));
|
||||
_waves.add(new WaveBoss(this));
|
||||
_waves.add(new WaveVictory(this));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -108,112 +116,41 @@ public class Halloween extends SoloGame
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void UpdateWave(UpdateEvent event)
|
||||
public void WaveUpdate(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.FAST)
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
return;
|
||||
|
||||
if (!IsLive())
|
||||
return;
|
||||
|
||||
//Display Remaining Time
|
||||
if (_wave > 0)
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
if (_waves.get(_wave).Update(_wave+1))
|
||||
{
|
||||
player.setExp(Math.min(0.999f, (float)(_waveDuration - (System.currentTimeMillis() - _waveStart)) / (float)_waveDuration));
|
||||
player.setLevel(_wave);
|
||||
}
|
||||
_wave++;
|
||||
|
||||
if (!UtilTime.elapsed(_waveStart, _waveDuration) || (_wave == 4 && !_king.GetEntity().isValid()))
|
||||
return;
|
||||
|
||||
_wave = _wave + 1;
|
||||
_waveStart = System.currentTimeMillis();
|
||||
_waveDuration = 60000;
|
||||
_spawnTick = 0;
|
||||
|
||||
_spawnWave = UtilMath.r(_spawns.size());
|
||||
|
||||
if (_wave == 1) _waveName = "Zombies, Skeletons and Creepers, OH MY!";
|
||||
if (_wave == 2) _waveName = "A Giant? Better kill that guy!";
|
||||
if (_wave == 3) _waveName = "SPIDERS SPIDERS SPIDERS!!!!!";
|
||||
if (_wave == 4) _waveName = "THE SKELETON KING EMERGES";
|
||||
|
||||
if (_wave <= 4)
|
||||
Announce(C.cRed + C.Bold + "Wave " + _wave + ": " + C.cYellow + _waveName);
|
||||
}
|
||||
|
||||
public Location GetSpawn()
|
||||
{
|
||||
return _spawns.get(_spawnWave).get(UtilMath.r(_spawns.get(_spawnWave).size()));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void SpawnCreatures(UpdateEvent event)
|
||||
{
|
||||
//Boss Swarm
|
||||
if (event.getType() == UpdateType.SEC && _wave == 4 && _mobs.size() < 20)
|
||||
{
|
||||
Location loc = _spawns.get(UtilMath.r(_spawns.size())).get(UtilMath.r(_spawns.get(_spawnWave).size()));
|
||||
_mobs.add(new MobZombie(this, loc));
|
||||
}
|
||||
|
||||
if (event.getType() != UpdateType.FAST)
|
||||
return;
|
||||
|
||||
if (!IsLive())
|
||||
return;
|
||||
|
||||
this.CreatureAllowOverride = true;
|
||||
|
||||
//Plain
|
||||
if (_wave == 1)
|
||||
{
|
||||
if (UtilTime.elapsed(_waveStart, 12000 + (_wave * 2000)))
|
||||
return;
|
||||
|
||||
_mobs.add(new MobZombie(this, GetSpawn()));
|
||||
|
||||
if (_spawnTick % 3 == 0)
|
||||
_mobs.add(new MobSkeletonArcher(this, GetSpawn()));
|
||||
|
||||
if (_spawnTick % 5 == 0)
|
||||
_mobs.add(new MobCreeper(this, GetSpawn()));
|
||||
}
|
||||
//Single Giant
|
||||
if (_wave == 2)
|
||||
{
|
||||
_mobs.add(new MobZombie(this, GetSpawn()));
|
||||
|
||||
if (_spawnTick % 3 == 0)
|
||||
_mobs.add(new MobSkeletonArcher(this, GetSpawn()));
|
||||
|
||||
if (_spawnTick % 5 == 0)
|
||||
_mobs.add(new MobCreeper(this, GetSpawn()));
|
||||
|
||||
if (_spawnTick == 0)
|
||||
_mobs.add(new MobGiant(this, GetSpawn()));
|
||||
}
|
||||
//Spiders
|
||||
if (_wave == 3)
|
||||
{
|
||||
_mobs.add(new MobSpider(this, GetSpawn()));
|
||||
_mobs.add(new MobSpider(this, GetSpawn()));
|
||||
}
|
||||
//Quad Giant
|
||||
if (_wave == 4)
|
||||
{
|
||||
if (_spawnTick == 0)
|
||||
{
|
||||
_waveDuration = 900000;
|
||||
_king = new PumpkinKing(this, WorldData.GetDataLocs("BLACK").get(0));
|
||||
_mobs.add(_king);
|
||||
EndCheck();
|
||||
}
|
||||
}
|
||||
|
||||
this.CreatureAllowOverride = false;
|
||||
public ArrayList<Location> GetSpawnSet(int i)
|
||||
{
|
||||
return _spawns.get(i);
|
||||
}
|
||||
|
||||
_spawnTick++;
|
||||
public Location GetRandomSpawn()
|
||||
{
|
||||
ArrayList<Location> locSet = GetSpawnSet(UtilMath.r(_spawns.size()));
|
||||
return locSet.get(UtilMath.r(locSet.size()));
|
||||
}
|
||||
|
||||
public void AddCreature(CreatureBase mob)
|
||||
{
|
||||
_mobs.add(mob);
|
||||
}
|
||||
|
||||
public HashSet<CreatureBase> GetCreatures()
|
||||
{
|
||||
return _mobs;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -259,7 +196,7 @@ public class Halloween extends SoloGame
|
||||
if (!IsLive())
|
||||
return;
|
||||
|
||||
if (_wave == 5)
|
||||
if (_wave >= _waves.size())
|
||||
{
|
||||
SetState(GameState.End);
|
||||
SetCustomWinLine("You defeated the Pumpkin King!!!");
|
||||
@ -276,4 +213,10 @@ public class Halloween extends SoloGame
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void Door(EntityBreakDoorEvent event)
|
||||
{
|
||||
System.out.println("Door Break");
|
||||
}
|
||||
}
|
||||
|
@ -91,11 +91,7 @@ public abstract class CreatureBase<T extends LivingEntity>
|
||||
public boolean Updater(UpdateEvent event)
|
||||
{
|
||||
if (_ent == null || !_ent.isValid())
|
||||
{
|
||||
System.out.println(_ent.getType() + " INVALID");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Update(event);
|
||||
|
||||
|
@ -43,7 +43,7 @@ public class MobCreeper extends CreatureBase<Creeper>
|
||||
@Override
|
||||
public void Update(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.FAST)
|
||||
if (event.getType() != UpdateType.SEC)
|
||||
return;
|
||||
|
||||
//New Target via Distance
|
||||
|
@ -27,12 +27,16 @@ public class MobGiant extends CreatureBase<Giant>
|
||||
public void SpawnCustom(Giant ent)
|
||||
{
|
||||
_tpLoc = ent.getLocation();
|
||||
|
||||
ent.setMaxHealth(120);
|
||||
ent.setHealth(120);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Damage(CustomDamageEvent event)
|
||||
{
|
||||
|
||||
if (event.GetDamageeEntity().equals(GetEntity()))
|
||||
event.SetKnockback(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -0,0 +1,94 @@
|
||||
package nautilus.game.arcade.game.games.halloween.creatures;
|
||||
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.disguise.disguises.DisguisePigZombie;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.game.Game;
|
||||
import net.minecraft.server.v1_6_R3.EntityCreature;
|
||||
import net.minecraft.server.v1_6_R3.Navigation;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftCreature;
|
||||
import org.bukkit.entity.Zombie;
|
||||
import org.bukkit.event.entity.EntityTargetEvent;
|
||||
|
||||
public class MobPigZombie extends CreatureBase<Zombie>
|
||||
{
|
||||
public MobPigZombie(Game game, Location loc)
|
||||
{
|
||||
super(game, null, Zombie.class, loc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void SpawnCustom(Zombie ent)
|
||||
{
|
||||
DisguisePigZombie disguise = new DisguisePigZombie(ent);
|
||||
Host.Manager.GetDisguise().disguise(disguise);
|
||||
|
||||
Host.Manager.GetCondition().Factory().Speed("Speed", ent, ent, 99999, 1, false, false, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Damage(CustomDamageEvent event)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Target(EntityTargetEvent event)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Update(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() == UpdateType.FAST)
|
||||
Move();
|
||||
}
|
||||
|
||||
private void Move()
|
||||
{
|
||||
//New Target via Distance
|
||||
if (GetTarget() == null ||
|
||||
UtilMath.offset(GetEntity().getLocation(), GetTarget()) < 10 ||
|
||||
UtilMath.offset2d(GetEntity().getLocation(), GetTarget()) < 6 ||
|
||||
UtilTime.elapsed(GetTargetTime(), 10000))
|
||||
{
|
||||
SetTarget(GetRoamTarget());
|
||||
return;
|
||||
}
|
||||
|
||||
//Untarget
|
||||
if (GetEntity().getTarget() != null)
|
||||
{
|
||||
if (UtilMath.offset2d(GetEntity(), GetEntity().getTarget()) > 10)
|
||||
{
|
||||
GetEntity().setTarget(null);
|
||||
}
|
||||
}
|
||||
//Move
|
||||
else
|
||||
{
|
||||
EntityCreature ec = ((CraftCreature)GetEntity()).getHandle();
|
||||
Navigation nav = ec.getNavigation();
|
||||
|
||||
if (UtilMath.offset(GetEntity().getLocation(), GetTarget()) > 12)
|
||||
{
|
||||
Location target = GetEntity().getLocation();
|
||||
|
||||
target.add(UtilAlg.getTrajectory(GetEntity().getLocation(), GetTarget()).multiply(12));
|
||||
|
||||
nav.a(target.getX(), target.getY(), target.getZ(), 1.6f);
|
||||
}
|
||||
else
|
||||
{
|
||||
nav.a(GetTarget().getX(), GetTarget().getY(), GetTarget().getZ(), 1.2f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -45,7 +45,7 @@ public class MobSkeletonArcher extends CreatureBase<Skeleton>
|
||||
@Override
|
||||
public void Update(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.FAST)
|
||||
if (event.getType() != UpdateType.SEC)
|
||||
return;
|
||||
|
||||
//New Target via Distance
|
||||
|
@ -0,0 +1,89 @@
|
||||
package nautilus.game.arcade.game.games.halloween.creatures;
|
||||
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.game.Game;
|
||||
import net.minecraft.server.v1_6_R3.EntityCreature;
|
||||
import net.minecraft.server.v1_6_R3.Navigation;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftCreature;
|
||||
import org.bukkit.entity.Skeleton;
|
||||
import org.bukkit.event.entity.EntityTargetEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class MobSkeletonWarrior extends CreatureBase<Skeleton>
|
||||
{
|
||||
public MobSkeletonWarrior(Game game, Location loc)
|
||||
{
|
||||
super(game, null, Skeleton.class, loc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void SpawnCustom(Skeleton ent)
|
||||
{
|
||||
ent.getEquipment().setItemInHand(new ItemStack(Material.WOOD_SWORD));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Damage(CustomDamageEvent event)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Target(EntityTargetEvent event)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Update(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.FAST)
|
||||
return;
|
||||
|
||||
//New Target via Distance
|
||||
if (GetTarget() == null ||
|
||||
UtilMath.offset(GetEntity().getLocation(), GetTarget()) < 10 ||
|
||||
UtilMath.offset2d(GetEntity().getLocation(), GetTarget()) < 6 ||
|
||||
UtilTime.elapsed(GetTargetTime(), 10000))
|
||||
{
|
||||
SetTarget(GetRoamTarget());
|
||||
return;
|
||||
}
|
||||
|
||||
//Untarget
|
||||
if (GetEntity().getTarget() != null)
|
||||
{
|
||||
if (UtilMath.offset2d(GetEntity(), GetEntity().getTarget()) > 10)
|
||||
{
|
||||
GetEntity().setTarget(null);
|
||||
}
|
||||
}
|
||||
//Move
|
||||
else
|
||||
{
|
||||
EntityCreature ec = ((CraftCreature)GetEntity()).getHandle();
|
||||
Navigation nav = ec.getNavigation();
|
||||
|
||||
if (UtilMath.offset(GetEntity().getLocation(), GetTarget()) > 12)
|
||||
{
|
||||
Location target = GetEntity().getLocation();
|
||||
|
||||
target.add(UtilAlg.getTrajectory(GetEntity().getLocation(), GetTarget()).multiply(12));
|
||||
|
||||
nav.a(target.getX(), target.getY(), target.getZ(), 1f);
|
||||
}
|
||||
else
|
||||
{
|
||||
nav.a(GetTarget().getX(), GetTarget().getY(), GetTarget().getZ(), 1f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -14,18 +14,18 @@ import net.minecraft.server.v1_6_R3.Navigation;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftCreature;
|
||||
import org.bukkit.entity.Spider;
|
||||
import org.bukkit.entity.CaveSpider;
|
||||
import org.bukkit.event.entity.EntityTargetEvent;
|
||||
|
||||
public class MobSpider extends CreatureBase<Spider>
|
||||
public class MobSpiderLeaper extends CreatureBase<CaveSpider>
|
||||
{
|
||||
public MobSpider(Game game, Location loc)
|
||||
public MobSpiderLeaper(Game game, Location loc)
|
||||
{
|
||||
super(game, null, Spider.class, loc);
|
||||
super(game, null, CaveSpider.class, loc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void SpawnCustom(Spider ent)
|
||||
public void SpawnCustom(CaveSpider ent)
|
||||
{
|
||||
|
||||
}
|
@ -0,0 +1,108 @@
|
||||
package nautilus.game.arcade.game.games.halloween.creatures;
|
||||
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.disguise.disguises.DisguiseSpider;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.game.Game;
|
||||
import net.minecraft.server.v1_6_R3.EntityCreature;
|
||||
import net.minecraft.server.v1_6_R3.Navigation;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftCreature;
|
||||
import org.bukkit.entity.Zombie;
|
||||
import org.bukkit.event.entity.EntityTargetEvent;
|
||||
|
||||
public class MobSpiderWebber extends CreatureBase<Zombie>
|
||||
{
|
||||
public MobSpiderWebber(Game game, Location loc)
|
||||
{
|
||||
super(game, null, Zombie.class, loc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void SpawnCustom(Zombie ent)
|
||||
{
|
||||
DisguiseSpider spider = new DisguiseSpider(ent);
|
||||
Host.Manager.GetDisguise().disguise(spider);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Damage(CustomDamageEvent event)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Target(EntityTargetEvent event)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Update(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() == UpdateType.FAST)
|
||||
Move();
|
||||
|
||||
if (event.getType() == UpdateType.SEC)
|
||||
Web();
|
||||
}
|
||||
|
||||
private void Web()
|
||||
{
|
||||
if (GetTarget() == null)
|
||||
return;
|
||||
|
||||
if (Math.random() > 0.5)
|
||||
return;
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void Move()
|
||||
{
|
||||
//New Target via Distance
|
||||
if (GetTarget() == null ||
|
||||
UtilMath.offset(GetEntity().getLocation(), GetTarget()) < 10 ||
|
||||
UtilMath.offset2d(GetEntity().getLocation(), GetTarget()) < 6 ||
|
||||
UtilTime.elapsed(GetTargetTime(), 10000))
|
||||
{
|
||||
SetTarget(GetRoamTarget());
|
||||
return;
|
||||
}
|
||||
|
||||
//Untarget
|
||||
if (GetEntity().getTarget() != null)
|
||||
{
|
||||
if (UtilMath.offset2d(GetEntity(), GetEntity().getTarget()) > 10)
|
||||
{
|
||||
GetEntity().setTarget(null);
|
||||
}
|
||||
}
|
||||
//Move
|
||||
else
|
||||
{
|
||||
EntityCreature ec = ((CraftCreature)GetEntity()).getHandle();
|
||||
Navigation nav = ec.getNavigation();
|
||||
|
||||
if (UtilMath.offset(GetEntity().getLocation(), GetTarget()) > 12)
|
||||
{
|
||||
Location target = GetEntity().getLocation();
|
||||
|
||||
target.add(UtilAlg.getTrajectory(GetEntity().getLocation(), GetTarget()).multiply(12));
|
||||
|
||||
nav.a(target.getX(), target.getY(), target.getZ(), 1.6f);
|
||||
}
|
||||
else
|
||||
{
|
||||
nav.a(GetTarget().getX(), GetTarget().getY(), GetTarget().getZ(), 1.2f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,106 @@
|
||||
package nautilus.game.arcade.game.games.halloween.creatures;
|
||||
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.game.Game;
|
||||
import net.minecraft.server.v1_6_R3.EntityCreature;
|
||||
import net.minecraft.server.v1_6_R3.Navigation;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftCreature;
|
||||
import org.bukkit.entity.ThrownPotion;
|
||||
import org.bukkit.entity.Witch;
|
||||
import org.bukkit.event.entity.EntityTargetEvent;
|
||||
|
||||
public class MobWitch extends CreatureBase<Witch>
|
||||
{
|
||||
public MobWitch(Game game, Location loc)
|
||||
{
|
||||
super(game, null, Witch.class, loc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void SpawnCustom(Witch ent)
|
||||
{
|
||||
Move();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Damage(CustomDamageEvent event)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Update(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() == UpdateType.SEC)
|
||||
Move();
|
||||
|
||||
if (event.getType() == UpdateType.SLOW)
|
||||
Potion();
|
||||
}
|
||||
|
||||
private void Potion()
|
||||
{
|
||||
if (GetEntity().getTarget() == null)
|
||||
return;
|
||||
|
||||
ThrownPotion pot = GetEntity().launchProjectile(ThrownPotion.class);
|
||||
|
||||
Host.Announce("THROWN");
|
||||
UtilAction.velocity(pot, UtilAlg.getTrajectory(GetEntity(), GetEntity().getTarget()), 1.2, false, 0, 0.3, 10, false);
|
||||
}
|
||||
|
||||
private void Move()
|
||||
{
|
||||
//New Target via Distance
|
||||
if (GetTarget() == null ||
|
||||
UtilMath.offset(GetEntity().getLocation(), GetTarget()) < 10 ||
|
||||
UtilMath.offset2d(GetEntity().getLocation(), GetTarget()) < 6 ||
|
||||
UtilTime.elapsed(GetTargetTime(), 10000))
|
||||
{
|
||||
SetTarget(GetRoamTarget());
|
||||
return;
|
||||
}
|
||||
|
||||
//Untarget
|
||||
if (GetEntity().getTarget() != null)
|
||||
{
|
||||
if (UtilMath.offset2d(GetEntity(), GetEntity().getTarget()) > 10)
|
||||
{
|
||||
GetEntity().setTarget(null);
|
||||
}
|
||||
}
|
||||
//Move
|
||||
else
|
||||
{
|
||||
EntityCreature ec = ((CraftCreature)GetEntity()).getHandle();
|
||||
Navigation nav = ec.getNavigation();
|
||||
|
||||
if (UtilMath.offset(GetEntity().getLocation(), GetTarget()) > 12)
|
||||
{
|
||||
Location target = GetEntity().getLocation();
|
||||
|
||||
target.add(UtilAlg.getTrajectory(GetEntity().getLocation(), GetTarget()).multiply(12));
|
||||
|
||||
nav.a(target.getX(), target.getY(), target.getZ(), 1.6f);
|
||||
}
|
||||
else
|
||||
{
|
||||
nav.a(GetTarget().getX(), GetTarget().getY(), GetTarget().getZ(), 1.2f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Target(EntityTargetEvent event)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -25,7 +25,7 @@ public class MobZombie extends CreatureBase<Zombie>
|
||||
@Override
|
||||
public void SpawnCustom(Zombie ent)
|
||||
{
|
||||
|
||||
Move();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -37,9 +37,12 @@ public class MobZombie extends CreatureBase<Zombie>
|
||||
@Override
|
||||
public void Update(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.FAST)
|
||||
return;
|
||||
if (event.getType() == UpdateType.SEC)
|
||||
Move();
|
||||
}
|
||||
|
||||
private void Move()
|
||||
{
|
||||
//New Target via Distance
|
||||
if (GetTarget() == null ||
|
||||
UtilMath.offset(GetEntity().getLocation(), GetTarget()) < 10 ||
|
||||
|
@ -129,7 +129,7 @@ public class PumpkinKing extends CreatureBase<Skeleton>
|
||||
{
|
||||
event.SetCancelled("Shield Break");
|
||||
|
||||
if (event.GetProjectile() == null)
|
||||
if (event.GetCause() != DamageCause.PROJECTILE && event.GetCause() != DamageCause.LIGHTNING)
|
||||
return;
|
||||
|
||||
event.GetProjectile().remove();
|
||||
|
@ -0,0 +1,88 @@
|
||||
package nautilus.game.arcade.game.games.halloween.kits;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.kit.KitAvailability;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
import nautilus.game.arcade.kit.SmashKit;
|
||||
import nautilus.game.arcade.kit.perks.*;
|
||||
|
||||
public class KitFinn extends SmashKit
|
||||
{
|
||||
public KitFinn(ArcadeManager manager)
|
||||
{
|
||||
super(manager, "Finn the Human", KitAvailability.Free,
|
||||
|
||||
new String[]
|
||||
{
|
||||
"Jake is hiding in his pocket.",
|
||||
"",
|
||||
},
|
||||
|
||||
new Perk[]
|
||||
{
|
||||
new PerkInfernoFinn(),
|
||||
new PerkBlizzardFinn(),
|
||||
new PerkFletcher(4, 4, false),
|
||||
},
|
||||
|
||||
EntityType.ZOMBIE, new ItemStack(Material.GOLD_SWORD));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void GiveItems(Player player)
|
||||
{
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.GOLD_SWORD, (byte)0, 1, "Flaming Sword"));
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.DIAMOND_SWORD, (byte)0, 1, "Icy Sword"));
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW, (byte)0, 1, "Bow"));
|
||||
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
|
||||
|
||||
|
||||
player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.JACK_O_LANTERN));
|
||||
player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.IRON_CHESTPLATE));
|
||||
player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.IRON_LEGGINGS));
|
||||
player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.IRON_BOOTS));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void SpawnCustom(LivingEntity ent)
|
||||
{
|
||||
ent.getEquipment().setHelmet(new ItemStack(Material.JACK_O_LANTERN));
|
||||
ent.getEquipment().setChestplate(new ItemStack(Material.IRON_CHESTPLATE));
|
||||
ent.getEquipment().setLeggings(new ItemStack(Material.IRON_LEGGINGS));
|
||||
ent.getEquipment().setBoots(new ItemStack(Material.IRON_BOOTS));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void FireItemResist(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.FAST)
|
||||
return;
|
||||
|
||||
if (Manager.GetGame() == null)
|
||||
return;
|
||||
|
||||
for (Player player : Manager.GetGame().GetPlayers(true))
|
||||
{
|
||||
if (!HasKit(player))
|
||||
continue;
|
||||
|
||||
Manager.GetCondition().Factory().FireItemImmunity(GetName(), player, player, 1.9, false);
|
||||
}
|
||||
}
|
||||
}
|
@ -4,43 +4,54 @@ import org.bukkit.Material;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.kit.KitAvailability;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
import nautilus.game.arcade.kit.SmashKit;
|
||||
import nautilus.game.arcade.kit.perks.*;
|
||||
|
||||
public class KitDefault extends Kit
|
||||
public class KitRobinHood extends SmashKit
|
||||
{
|
||||
public KitDefault(ArcadeManager manager)
|
||||
public KitRobinHood(ArcadeManager manager)
|
||||
{
|
||||
super(manager, "Halloween Dude", KitAvailability.Free,
|
||||
super(manager, "Robin Hood", KitAvailability.Free,
|
||||
|
||||
new String[]
|
||||
{
|
||||
"Just a dude, at halloween."
|
||||
"Trick or treating from the rich...",
|
||||
"",
|
||||
},
|
||||
|
||||
new Perk[]
|
||||
{
|
||||
|
||||
new PerkSpeed(1),
|
||||
new PerkRegeneration(0),
|
||||
new PerkFletcher(1, 4, false),
|
||||
new PerkBarrage(4, 250, false),
|
||||
new PerkQuickshotRobinHood()
|
||||
},
|
||||
|
||||
EntityType.ZOMBIE, new ItemStack(Material.IRON_SWORD));
|
||||
EntityType.ZOMBIE, new ItemStack(Material.BOW));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void GiveItems(Player player)
|
||||
{
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD));
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW));
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.ARROW, 64));
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD, (byte)0, 1, "Sword"));
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW, (byte)0, 1, "Bow"));
|
||||
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
|
||||
|
||||
|
||||
player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.JACK_O_LANTERN));
|
||||
@ -57,4 +68,22 @@ public class KitDefault extends Kit
|
||||
ent.getEquipment().setLeggings(new ItemStack(Material.CHAINMAIL_LEGGINGS));
|
||||
ent.getEquipment().setBoots(new ItemStack(Material.CHAINMAIL_BOOTS));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void FireItemResist(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.FAST)
|
||||
return;
|
||||
|
||||
if (Manager.GetGame() == null)
|
||||
return;
|
||||
|
||||
for (Player player : Manager.GetGame().GetPlayers(true))
|
||||
{
|
||||
if (!HasKit(player))
|
||||
continue;
|
||||
|
||||
Manager.GetCondition().Factory().FireItemImmunity(GetName(), player, player, 1.9, false);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,88 @@
|
||||
package nautilus.game.arcade.game.games.halloween.kits;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.kit.KitAvailability;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
import nautilus.game.arcade.kit.SmashKit;
|
||||
import nautilus.game.arcade.kit.perks.*;
|
||||
|
||||
public class KitThor extends SmashKit
|
||||
{
|
||||
public KitThor(ArcadeManager manager)
|
||||
{
|
||||
super(manager, "Thor Costume", KitAvailability.Free,
|
||||
|
||||
new String[]
|
||||
{
|
||||
"Dress up as Thor, and smash those monsters!",
|
||||
"",
|
||||
},
|
||||
|
||||
new Perk[]
|
||||
{
|
||||
new PerkKnockbackAttack(2),
|
||||
new PerkFletcher(4, 4, false),
|
||||
new PerkSeismicHammer(),
|
||||
new PerkHammerThrow(),
|
||||
},
|
||||
|
||||
EntityType.ZOMBIE, new ItemStack(Material.IRON_SWORD));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void GiveItems(Player player)
|
||||
{
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1, "Seismic Hammer"));
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.DIAMOND_AXE, (byte)0, 1, "Thor Hammer"));
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW, (byte)0, 1, "Bow"));
|
||||
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP));
|
||||
|
||||
player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.JACK_O_LANTERN));
|
||||
player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.DIAMOND_CHESTPLATE));
|
||||
player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.DIAMOND_LEGGINGS));
|
||||
player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.DIAMOND_BOOTS));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void SpawnCustom(LivingEntity ent)
|
||||
{
|
||||
ent.getEquipment().setHelmet(new ItemStack(Material.JACK_O_LANTERN));
|
||||
ent.getEquipment().setChestplate(new ItemStack(Material.DIAMOND_CHESTPLATE));
|
||||
ent.getEquipment().setLeggings(new ItemStack(Material.DIAMOND_LEGGINGS));
|
||||
ent.getEquipment().setBoots(new ItemStack(Material.DIAMOND_BOOTS));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void FireItemResist(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.FAST)
|
||||
return;
|
||||
|
||||
if (Manager.GetGame() == null)
|
||||
return;
|
||||
|
||||
for (Player player : Manager.GetGame().GetPlayers(true))
|
||||
{
|
||||
if (!HasKit(player))
|
||||
continue;
|
||||
|
||||
Manager.GetCondition().Factory().FireItemImmunity(GetName(), player, player, 1.9, false);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,31 @@
|
||||
package nautilus.game.arcade.game.games.halloween.waves;
|
||||
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import nautilus.game.arcade.game.games.halloween.Halloween;
|
||||
import nautilus.game.arcade.game.games.halloween.creatures.MobCreeper;
|
||||
import nautilus.game.arcade.game.games.halloween.creatures.MobSkeletonArcher;
|
||||
import nautilus.game.arcade.game.games.halloween.creatures.MobZombie;
|
||||
|
||||
public class Wave1 extends WaveBase
|
||||
{
|
||||
public Wave1(Halloween host)
|
||||
{
|
||||
super(host, "Zombies and Skeletons and Creepers! OH MY!", 60000, host.GetSpawnSet(1));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Spawn(int tick)
|
||||
{
|
||||
if (UtilTime.elapsed(_start, 20000))
|
||||
return;
|
||||
|
||||
if (tick % 10 == 0)
|
||||
Host.AddCreature(new MobZombie(Host, GetSpawn()));
|
||||
|
||||
if (tick % 20 == 0)
|
||||
Host.AddCreature(new MobSkeletonArcher(Host, GetSpawn()));
|
||||
|
||||
if (tick % 30 == 0)
|
||||
Host.AddCreature(new MobCreeper(Host, GetSpawn()));
|
||||
}
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
package nautilus.game.arcade.game.games.halloween.waves;
|
||||
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import nautilus.game.arcade.game.games.halloween.Halloween;
|
||||
import nautilus.game.arcade.game.games.halloween.creatures.MobCreeper;
|
||||
import nautilus.game.arcade.game.games.halloween.creatures.MobGiant;
|
||||
import nautilus.game.arcade.game.games.halloween.creatures.MobSkeletonArcher;
|
||||
import nautilus.game.arcade.game.games.halloween.creatures.MobZombie;
|
||||
|
||||
public class Wave2 extends WaveBase
|
||||
{
|
||||
public Wave2(Halloween host)
|
||||
{
|
||||
super(host, "A GIANT!? Better kill that guy fast!", 60000, host.GetSpawnSet(0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Spawn(int tick)
|
||||
{
|
||||
if (UtilTime.elapsed(_start, 20000))
|
||||
return;
|
||||
|
||||
if (tick == 0)
|
||||
Host.AddCreature(new MobGiant(Host, GetSpawn()));
|
||||
|
||||
if (tick % 10 == 0)
|
||||
Host.AddCreature(new MobZombie(Host, GetSpawn()));
|
||||
|
||||
if (tick % 20 == 0)
|
||||
Host.AddCreature(new MobSkeletonArcher(Host, GetSpawn()));
|
||||
|
||||
if (tick % 30 == 0)
|
||||
Host.AddCreature(new MobCreeper(Host, GetSpawn()));
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package nautilus.game.arcade.game.games.halloween.waves;
|
||||
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import nautilus.game.arcade.game.games.halloween.Halloween;
|
||||
import nautilus.game.arcade.game.games.halloween.creatures.MobSpiderLeaper;
|
||||
import nautilus.game.arcade.game.games.halloween.creatures.MobSpiderWebber;
|
||||
|
||||
public class Wave3 extends WaveBase
|
||||
{
|
||||
public Wave3(Halloween host)
|
||||
{
|
||||
super(host, "Spiders Spiders Spiders!", 60000, host.GetSpawnSet(2));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Spawn(int tick)
|
||||
{
|
||||
if (UtilTime.elapsed(_start, 20000))
|
||||
return;
|
||||
|
||||
if (tick % 10 == 0)
|
||||
Host.AddCreature(new MobSpiderWebber(Host, GetSpawn()));
|
||||
|
||||
if (tick % 10 == 0)
|
||||
Host.AddCreature(new MobSpiderLeaper(Host, GetSpawn()));
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package nautilus.game.arcade.game.games.halloween.waves;
|
||||
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import nautilus.game.arcade.game.games.halloween.Halloween;
|
||||
import nautilus.game.arcade.game.games.halloween.creatures.MobGhast;
|
||||
import nautilus.game.arcade.game.games.halloween.creatures.MobPigZombie;
|
||||
|
||||
public class Wave4 extends WaveBase
|
||||
{
|
||||
public Wave4(Halloween host)
|
||||
{
|
||||
super(host, "Ghasts (and friends)", 60000, host.GetSpawnSet(3));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Spawn(int tick)
|
||||
{
|
||||
if (UtilTime.elapsed(_start, 20000))
|
||||
return;
|
||||
|
||||
if (tick % 100 == 0)
|
||||
Host.AddCreature(new MobGhast(Host, GetSpawn().clone().add(0, 30, 0)));
|
||||
|
||||
if (tick % 20 == 0)
|
||||
Host.AddCreature(new MobPigZombie(Host, GetSpawn()));
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package nautilus.game.arcade.game.games.halloween.waves;
|
||||
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import nautilus.game.arcade.game.games.halloween.Halloween;
|
||||
import nautilus.game.arcade.game.games.halloween.creatures.MobCreeper;
|
||||
import nautilus.game.arcade.game.games.halloween.creatures.MobGiant;
|
||||
import nautilus.game.arcade.game.games.halloween.creatures.MobSkeletonArcher;
|
||||
import nautilus.game.arcade.game.games.halloween.creatures.MobWitch;
|
||||
import nautilus.game.arcade.game.games.halloween.creatures.MobZombie;
|
||||
|
||||
public class Wave5 extends WaveBase
|
||||
{
|
||||
public Wave5(Halloween host)
|
||||
{
|
||||
super(host, "Witches and Wolves", 60000, host.GetSpawnSet(3));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Spawn(int tick)
|
||||
{
|
||||
if (UtilTime.elapsed(_start, 20000))
|
||||
return;
|
||||
|
||||
if (tick == 0)
|
||||
Host.AddCreature(new MobWitch(Host, GetSpawn()));
|
||||
}
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
package nautilus.game.arcade.game.games.halloween.waves;
|
||||
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import nautilus.game.arcade.game.games.halloween.Halloween;
|
||||
import nautilus.game.arcade.game.games.halloween.creatures.MobCreeper;
|
||||
import nautilus.game.arcade.game.games.halloween.creatures.MobGiant;
|
||||
import nautilus.game.arcade.game.games.halloween.creatures.MobSkeletonArcher;
|
||||
import nautilus.game.arcade.game.games.halloween.creatures.MobZombie;
|
||||
|
||||
public class Wave6 extends WaveBase
|
||||
{
|
||||
public Wave6(Halloween host)
|
||||
{
|
||||
super(host, "Fiery Night", 60000, host.GetSpawnSet(3));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Spawn(int tick)
|
||||
{
|
||||
if (UtilTime.elapsed(_start, 20000))
|
||||
return;
|
||||
|
||||
if (tick == 0)
|
||||
Host.AddCreature(new MobGiant(Host, GetSpawn()));
|
||||
|
||||
if (tick % 10 == 0)
|
||||
Host.AddCreature(new MobZombie(Host, GetSpawn()));
|
||||
|
||||
if (tick % 20 == 0)
|
||||
Host.AddCreature(new MobSkeletonArcher(Host, GetSpawn()));
|
||||
|
||||
if (tick % 30 == 0)
|
||||
Host.AddCreature(new MobCreeper(Host, GetSpawn()));
|
||||
}
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
package nautilus.game.arcade.game.games.halloween.waves;
|
||||
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import nautilus.game.arcade.game.games.halloween.Halloween;
|
||||
import nautilus.game.arcade.game.games.halloween.creatures.MobCreeper;
|
||||
import nautilus.game.arcade.game.games.halloween.creatures.MobGiant;
|
||||
import nautilus.game.arcade.game.games.halloween.creatures.MobSkeletonArcher;
|
||||
import nautilus.game.arcade.game.games.halloween.creatures.MobZombie;
|
||||
|
||||
public class Wave7 extends WaveBase
|
||||
{
|
||||
public Wave7(Halloween host)
|
||||
{
|
||||
super(host, "Giants, Zombies, Witches and Ghasts...", 60000, host.GetSpawnSet(0));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Spawn(int tick)
|
||||
{
|
||||
if (UtilTime.elapsed(_start, 20000))
|
||||
return;
|
||||
|
||||
if (tick == 0)
|
||||
Host.AddCreature(new MobGiant(Host, GetSpawn()));
|
||||
|
||||
if (tick % 10 == 0)
|
||||
Host.AddCreature(new MobZombie(Host, GetSpawn()));
|
||||
|
||||
if (tick % 20 == 0)
|
||||
Host.AddCreature(new MobSkeletonArcher(Host, GetSpawn()));
|
||||
|
||||
if (tick % 30 == 0)
|
||||
Host.AddCreature(new MobCreeper(Host, GetSpawn()));
|
||||
}
|
||||
}
|
@ -0,0 +1,118 @@
|
||||
package nautilus.game.arcade.game.games.halloween.waves;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import nautilus.game.arcade.game.games.halloween.Halloween;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
|
||||
public abstract class WaveBase
|
||||
{
|
||||
protected Halloween Host;
|
||||
|
||||
protected String _name;
|
||||
|
||||
protected long _start;
|
||||
protected long _duration;
|
||||
|
||||
private int _tick = 0;
|
||||
|
||||
protected ArrayList<Location> _spawns;
|
||||
|
||||
public WaveBase(Halloween host, String name, long duration, ArrayList<Location> spawns)
|
||||
{
|
||||
Host = host;
|
||||
|
||||
_name = name;
|
||||
|
||||
_start = System.currentTimeMillis();
|
||||
_duration = duration;
|
||||
|
||||
_spawns = spawns;
|
||||
}
|
||||
|
||||
public Location GetSpawn()
|
||||
{
|
||||
return _spawns.get(UtilMath.r(_spawns.size()));
|
||||
}
|
||||
|
||||
public boolean Update(int wave)
|
||||
{
|
||||
//End
|
||||
if (_tick > 0 && UtilTime.elapsed(_start, _duration) && CanEnd())
|
||||
{
|
||||
System.out.println("Wave " + wave + " has ended.");
|
||||
return true;
|
||||
}
|
||||
|
||||
//Start
|
||||
if (_tick == 0)
|
||||
_start = System.currentTimeMillis();
|
||||
|
||||
//Announce
|
||||
if (_tick == 0)
|
||||
{
|
||||
System.out.println("Wave " + wave + " has started.");
|
||||
Host.Announce(C.cRed + C.Bold + "Wave " + wave + ": " + C.cYellow + _name);
|
||||
}
|
||||
|
||||
//Display
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
player.setExp(Math.min(0.999f, (float)(_duration - (System.currentTimeMillis() - _start)) / (float)_duration));
|
||||
|
||||
//Spawn Beacons
|
||||
if (_tick == 0)
|
||||
SpawnBeacons(_spawns);
|
||||
|
||||
//Spawn
|
||||
Host.CreatureAllowOverride = true;
|
||||
Spawn(_tick++);
|
||||
Host.CreatureAllowOverride = false;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void SpawnBeacons(ArrayList<Location> locs)
|
||||
{
|
||||
//Average Location
|
||||
Vector total = new Vector(0,0,0);
|
||||
for (Location loc : locs)
|
||||
total.add(loc.toVector());
|
||||
total.multiply((double)1/(double)locs.size());
|
||||
|
||||
//Beacon
|
||||
Block block = total.toLocation(locs.get(0).getWorld()).getBlock().getRelative(BlockFace.DOWN);
|
||||
Host.Manager.GetBlockRestore().Add(block, 138, (byte)0, _duration);
|
||||
|
||||
for (int x=-1 ; x<=1 ; x++)
|
||||
for (int z=-1 ; z<=1 ; z++)
|
||||
Host.Manager.GetBlockRestore().Add(block.getRelative(x, -1, z), 42, (byte)0, _duration);
|
||||
|
||||
//Lightning
|
||||
block.getWorld().strikeLightningEffect(block.getLocation());
|
||||
|
||||
//Clear Laser
|
||||
while (block.getY() < 250)
|
||||
{
|
||||
block = block.getRelative(BlockFace.UP);
|
||||
if (block.getType() != Material.AIR)
|
||||
Host.Manager.GetBlockRestore().Add(block, 0, (byte)0, _duration);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean CanEnd()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public abstract void Spawn(int tick);
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
package nautilus.game.arcade.game.games.halloween.waves;
|
||||
|
||||
import nautilus.game.arcade.game.games.halloween.Halloween;
|
||||
import nautilus.game.arcade.game.games.halloween.creatures.MobZombie;
|
||||
import nautilus.game.arcade.game.games.halloween.creatures.PumpkinKing;
|
||||
|
||||
public class WaveBoss extends WaveBase
|
||||
{
|
||||
private PumpkinKing _king;
|
||||
|
||||
public WaveBoss(Halloween host)
|
||||
{
|
||||
super(host, "The Pumpkin King", 0, host.GetSpawnSet(3));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Spawn(int tick)
|
||||
{
|
||||
if (tick == 0)
|
||||
{
|
||||
_king = new PumpkinKing(Host, Host.WorldData.GetDataLocs("BLACK").get(0));
|
||||
Host.AddCreature(_king);
|
||||
}
|
||||
|
||||
if (Host.GetCreatures().size() < 30)
|
||||
if (tick % 20 == 0)
|
||||
Host.AddCreature(new MobZombie(Host, Host.GetRandomSpawn()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean CanEnd()
|
||||
{
|
||||
return _king == null || !_king.GetEntity().isValid();
|
||||
}
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
package nautilus.game.arcade.game.games.halloween.waves;
|
||||
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import nautilus.game.arcade.game.games.halloween.Halloween;
|
||||
import nautilus.game.arcade.game.games.halloween.creatures.CreatureBase;
|
||||
|
||||
public class WaveVictory extends WaveBase
|
||||
{
|
||||
public WaveVictory(Halloween host)
|
||||
{
|
||||
super(host, "Celebration!", 0, host.GetSpawnSet(3));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Spawn(int tick)
|
||||
{
|
||||
if (UtilTime.elapsed(_start, 20000))
|
||||
return;
|
||||
|
||||
//Play
|
||||
if (tick == 0)
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
player.playEffect(Host.WorldData.GetDataLocs("BLACK").get(0), Effect.RECORD_PLAY, 2259);
|
||||
|
||||
//Mobs
|
||||
for (CreatureBase mob : Host.GetCreatures())
|
||||
mob.GetEntity().damage(1);
|
||||
|
||||
//Time
|
||||
if (Host.WorldTimeSet != 6000)
|
||||
{
|
||||
Host.WorldTimeSet = (Host.WorldTimeSet + 50)%24000;
|
||||
Host.WorldData.World.setTime(Host.WorldTimeSet);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean CanEnd()
|
||||
{
|
||||
return Host.WorldTimeSet == 6000;
|
||||
}
|
||||
}
|
@ -0,0 +1,154 @@
|
||||
package nautilus.game.arcade.kit.perks;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.WeakHashMap;
|
||||
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Projectile;
|
||||
import org.bukkit.entity.Snowball;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.entity.ProjectileHitEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
|
||||
public class PerkBlizzardFinn extends Perk
|
||||
{
|
||||
private HashMap<Player, Long> _active = new HashMap<Player, Long>();
|
||||
private WeakHashMap<Projectile, Player> _snowball = new WeakHashMap<Projectile, Player>();
|
||||
|
||||
public PerkBlizzardFinn()
|
||||
{
|
||||
super("Blizzard", new String[]
|
||||
{
|
||||
C.cYellow + "Block" + C.cGray + " with Diamond Sword to use " + C.cGreen + "Blizzard"
|
||||
});
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void Activate(PlayerInteractEvent event)
|
||||
{
|
||||
if (event.isCancelled())
|
||||
return;
|
||||
|
||||
if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK)
|
||||
return;
|
||||
|
||||
if (UtilBlock.usable(event.getClickedBlock()))
|
||||
return;
|
||||
|
||||
if (!event.getPlayer().getItemInHand().getType().toString().contains("DIAMOND_SWORD"))
|
||||
return;
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (!Kit.HasKit(player))
|
||||
return;
|
||||
|
||||
if (!Recharge.Instance.use(player, GetName(), 4000, true))
|
||||
return;
|
||||
|
||||
_active.put(player, System.currentTimeMillis());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void Update(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
return;
|
||||
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
{
|
||||
if (!_active.containsKey(player))
|
||||
continue;
|
||||
|
||||
if (!player.isBlocking())
|
||||
{
|
||||
_active.remove(player);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (UtilTime.elapsed(_active.get(player), 1500))
|
||||
{
|
||||
_active.remove(player);
|
||||
continue;
|
||||
}
|
||||
|
||||
//Snowball
|
||||
for (int i=0 ; i<4 ; i++)
|
||||
{
|
||||
Snowball snow = player.getWorld().spawn(player.getEyeLocation().add(player.getLocation().getDirection()), Snowball.class);
|
||||
double x = 0.1 - (UtilMath.r(20)/100d);
|
||||
double y = UtilMath.r(20)/100d;
|
||||
double z = 0.1 - (UtilMath.r(20)/100d);
|
||||
snow.setVelocity(player.getLocation().getDirection().add(new Vector(x,y,z)).multiply(2));
|
||||
_snowball.put(snow, player);
|
||||
}
|
||||
|
||||
//Effect
|
||||
player.getWorld().playSound(player.getLocation(), Sound.STEP_SNOW, 0.1f, 0.5f);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOW)
|
||||
public void Snowball(CustomDamageEvent event)
|
||||
{
|
||||
if (event.GetCause() != DamageCause.PROJECTILE)
|
||||
return;
|
||||
|
||||
Projectile proj = event.GetProjectile();
|
||||
if (proj == null) return;
|
||||
|
||||
if (!(proj instanceof Snowball))
|
||||
return;
|
||||
|
||||
if (!_snowball.containsKey(proj))
|
||||
return;
|
||||
|
||||
LivingEntity damagee = event.GetDamageeEntity();
|
||||
if (damagee == null) return;
|
||||
|
||||
event.SetCancelled("Blizzard");
|
||||
|
||||
if (damagee instanceof Player)
|
||||
return;
|
||||
|
||||
damagee.setVelocity(proj.getVelocity().multiply(0.15).add(new Vector(0, 0.15, 0)));
|
||||
|
||||
//Damage Event
|
||||
if (damagee instanceof Player)
|
||||
if (Recharge.Instance.use((Player)damagee, GetName(), 250, false))
|
||||
Manager.GetDamage().NewDamageEvent(damagee, event.GetDamagerEntity(true), null,
|
||||
DamageCause.PROJECTILE, 1.5, false, true, false,
|
||||
UtilEnt.getName(event.GetDamagerEntity(true)), GetName());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void SnowballForm(ProjectileHitEvent event)
|
||||
{
|
||||
if (!(event.getEntity() instanceof Snowball))
|
||||
return;
|
||||
|
||||
if (_snowball.remove(event.getEntity()) == null)
|
||||
return;
|
||||
|
||||
Manager.GetBlockRestore().Snow(event.getEntity().getLocation().getBlock(), (byte)1, (byte)7, 2000, 250, 0);
|
||||
}
|
||||
}
|
@ -0,0 +1,170 @@
|
||||
package nautilus.game.arcade.kit.perks;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Item;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerPickupItemEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
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.UtilMath;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.core.projectile.IThrown;
|
||||
import mineplex.core.projectile.ProjectileUser;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
|
||||
public class PerkHammerThrow extends Perk implements IThrown
|
||||
{
|
||||
private HashMap<Item, Player> _thrown = new HashMap<Item, Player>();
|
||||
|
||||
public PerkHammerThrow()
|
||||
{
|
||||
super("Hammer Throw", new String[]
|
||||
{
|
||||
C.cYellow + "Right-Click" + C.cGray + " with Diamond Axe to " + C.cGreen + "Hammer Throw"
|
||||
});
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void Skill(PlayerInteractEvent event)
|
||||
{
|
||||
if (event.isCancelled())
|
||||
return;
|
||||
|
||||
if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK)
|
||||
return;
|
||||
|
||||
if (UtilBlock.usable(event.getClickedBlock()))
|
||||
return;
|
||||
|
||||
if (event.getPlayer().getItemInHand() == null)
|
||||
return;
|
||||
|
||||
if (!event.getPlayer().getItemInHand().getType().toString().contains("DIAMOND_AXE"))
|
||||
return;
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (!Kit.HasKit(player))
|
||||
return;
|
||||
|
||||
player.setItemInHand(null);
|
||||
|
||||
//Inform
|
||||
UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + "."));
|
||||
|
||||
//Throw
|
||||
Item item = player.getWorld().dropItem(player.getEyeLocation(), new ItemStack(Material.DIAMOND_AXE));
|
||||
UtilAction.velocity(item, player.getLocation().getDirection(), 1.2, false, 0, 0.2, 10, true);
|
||||
|
||||
//Projectile
|
||||
Manager.GetProjectile().AddThrow(item, player, this, -1, true, true, true, false, 2.5d);
|
||||
|
||||
//Store
|
||||
_thrown.put(item, player);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void Pickup(PlayerPickupItemEvent event)
|
||||
{
|
||||
if (!_thrown.containsKey(event.getItem()))
|
||||
return;
|
||||
|
||||
event.setCancelled(true);
|
||||
event.getItem().remove();
|
||||
|
||||
Player player = _thrown.remove(event.getItem());
|
||||
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.DIAMOND_AXE, (byte)0, 1, "Thor Hammer"));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void Timeout(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.FAST)
|
||||
return;
|
||||
|
||||
Iterator<Item> itemIterator = _thrown.keySet().iterator();
|
||||
|
||||
while (itemIterator.hasNext())
|
||||
{
|
||||
Item item = itemIterator.next();
|
||||
|
||||
if (item.getTicksLived() > 200)
|
||||
{
|
||||
_thrown.get(item).getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.DIAMOND_AXE, (byte)0, 1, "Thor Hammer"));
|
||||
item.remove();
|
||||
itemIterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Collide(LivingEntity target, Block block, ProjectileUser data)
|
||||
{
|
||||
Rebound(data.GetThrower(), data.GetThrown());
|
||||
|
||||
if (target == null)
|
||||
return;
|
||||
|
||||
//Damage Event
|
||||
Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null,
|
||||
DamageCause.LIGHTNING, 12, true, true, false,
|
||||
UtilEnt.getName(data.GetThrower()), GetName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Idle(ProjectileUser data)
|
||||
{
|
||||
Rebound(data.GetThrower(), data.GetThrown());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Expire(ProjectileUser data)
|
||||
{
|
||||
Rebound(data.GetThrower(), data.GetThrown());
|
||||
}
|
||||
|
||||
public void Rebound(LivingEntity player, Entity ent)
|
||||
{
|
||||
ent.getWorld().playSound(ent.getLocation(), Sound.ZOMBIE_METAL, 0.6f, 0.5f);
|
||||
|
||||
double mult = 0.5 + (0.6 * (UtilMath.offset(player.getLocation(), ent.getLocation())/16d));
|
||||
|
||||
//Velocity
|
||||
ent.setVelocity(player.getLocation().toVector().subtract(ent.getLocation().toVector()).normalize().add(new Vector(0, 0.4, 0)).multiply(mult));
|
||||
|
||||
//Ticks
|
||||
if (ent instanceof Item)
|
||||
((Item)ent).setPickupDelay(5);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void Knockback(CustomDamageEvent event)
|
||||
{
|
||||
if (event.GetReason() == null || !event.GetReason().contains(GetName()))
|
||||
return;
|
||||
|
||||
event.AddKnockback(GetName(), 2);
|
||||
}
|
||||
}
|
@ -0,0 +1,119 @@
|
||||
package nautilus.game.arcade.kit.perks;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Item;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
|
||||
public class PerkInfernoFinn extends Perk
|
||||
{
|
||||
private HashMap<Player, Long> _active = new HashMap<Player, Long>();
|
||||
|
||||
public PerkInfernoFinn()
|
||||
{
|
||||
super("Inferno", new String[]
|
||||
{
|
||||
C.cYellow + "Block" + C.cGray + " with Gold Sword to use " + C.cGreen + "Inferno"
|
||||
});
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void Activate(PlayerInteractEvent event)
|
||||
{
|
||||
if (event.isCancelled())
|
||||
return;
|
||||
|
||||
if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK)
|
||||
return;
|
||||
|
||||
if (UtilBlock.usable(event.getClickedBlock()))
|
||||
return;
|
||||
|
||||
if (!event.getPlayer().getItemInHand().getType().toString().contains("GOLD_SWORD"))
|
||||
return;
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (!Kit.HasKit(player))
|
||||
return;
|
||||
|
||||
if (!Recharge.Instance.use(player, "Inferno", 4000, true))
|
||||
return;
|
||||
|
||||
_active.put(player, System.currentTimeMillis());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void Update(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
return;
|
||||
|
||||
for (Player cur : UtilServer.getPlayers())
|
||||
{
|
||||
if (!_active.containsKey(cur))
|
||||
continue;
|
||||
|
||||
if (!cur.isBlocking())
|
||||
{
|
||||
_active.remove(cur);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (UtilTime.elapsed(_active.get(cur), 1500))
|
||||
{
|
||||
_active.remove(cur);
|
||||
continue;
|
||||
}
|
||||
|
||||
//Fire
|
||||
Item fire = cur.getWorld().dropItem(cur.getEyeLocation(), ItemStackFactory.Instance.CreateStack(Material.FIRE));
|
||||
Manager.GetFire().Add(fire, cur, 0.7, 0, 0.5, 2, "Inferno");
|
||||
|
||||
fire.teleport(cur.getEyeLocation());
|
||||
double x = 0.07 - (UtilMath.r(14)/100d);
|
||||
double y = 0.07 - (UtilMath.r(14)/100d);
|
||||
double z = 0.07 - (UtilMath.r(14)/100d);
|
||||
fire.setVelocity(cur.getLocation().getDirection().add(new Vector(x,y,z)).multiply(1.6));
|
||||
|
||||
//Effect
|
||||
cur.getWorld().playSound(cur.getLocation(), Sound.GHAST_FIREBALL, 0.1f, 1f);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void Refresh(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.SLOWER)
|
||||
return;
|
||||
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
{
|
||||
if (_active.containsKey(player))
|
||||
continue;
|
||||
|
||||
if (!Kit.HasKit(player))
|
||||
continue;
|
||||
|
||||
player.getInventory().remove(Material.GOLD_SWORD);
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.GOLD_SWORD, (byte)0, 1, "Flaming Sword"));
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
package nautilus.game.arcade.kit.perks;
|
||||
|
||||
import org.bukkit.entity.Arrow;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import mineplex.core.common.util.C;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
|
||||
public class PerkKnockbackAttack extends Perk
|
||||
{
|
||||
private double _power;
|
||||
|
||||
public PerkKnockbackAttack(double power)
|
||||
{
|
||||
super("Melee Knockback", new String[]
|
||||
{
|
||||
C.cGray + "Melee attacks deal " + (int)(power*100) + "% Knockback.",
|
||||
});
|
||||
|
||||
_power = power;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void Knockback(CustomDamageEvent event)
|
||||
{
|
||||
if (event.GetCause() != DamageCause.ENTITY_ATTACK)
|
||||
return;
|
||||
|
||||
Player damager = event.GetDamagerPlayer(true);
|
||||
if (damager == null) return;
|
||||
|
||||
if (!Kit.HasKit(damager))
|
||||
return;
|
||||
|
||||
if (!Manager.IsAlive(damager))
|
||||
return;
|
||||
|
||||
event.AddKnockback("Knockback Melee", _power);
|
||||
}
|
||||
}
|
@ -22,7 +22,7 @@ public class PerkQuickshot extends Perk
|
||||
|
||||
public PerkQuickshot(String name, double power, long recharge)
|
||||
{
|
||||
super("Leaper", new String[]
|
||||
super("Quickshot", new String[]
|
||||
{
|
||||
C.cYellow + "Left-Click" + C.cGray + " with Bow to " + C.cGreen + name
|
||||
});
|
||||
|
@ -0,0 +1,56 @@
|
||||
package nautilus.game.arcade.kit.perks;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Arrow;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
|
||||
public class PerkQuickshotRobinHood extends Perk
|
||||
{
|
||||
public PerkQuickshotRobinHood()
|
||||
{
|
||||
super("Quick Shot", new String[]
|
||||
{
|
||||
C.cYellow + "Left-Click" + C.cGray + " with Bow to " + C.cGreen + "Quick Shot"
|
||||
});
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void Leap(PlayerInteractEvent event)
|
||||
{
|
||||
if (event.isCancelled())
|
||||
return;
|
||||
|
||||
if (event.getAction() != Action.LEFT_CLICK_AIR && event.getAction() != Action.LEFT_CLICK_BLOCK)
|
||||
return;
|
||||
|
||||
if (UtilBlock.usable(event.getClickedBlock()))
|
||||
return;
|
||||
|
||||
if (event.getPlayer().getItemInHand() == null)
|
||||
return;
|
||||
|
||||
if (event.getPlayer().getItemInHand().getType() != Material.BOW)
|
||||
return;
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (!Kit.HasKit(player))
|
||||
return;
|
||||
|
||||
if (!player.getInventory().contains(Material.ARROW))
|
||||
return;
|
||||
|
||||
UtilInv.remove(player, Material.ARROW, (byte)1, 1);
|
||||
|
||||
Arrow arrow = player.launchProjectile(Arrow.class);
|
||||
arrow.setVelocity(player.getLocation().getDirection().multiply(2));
|
||||
}
|
||||
}
|
@ -0,0 +1,92 @@
|
||||
package nautilus.game.arcade.kit.perks;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.bukkit.Effect;
|
||||
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.Action;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
|
||||
public class PerkSeismicHammer extends Perk
|
||||
{
|
||||
public PerkSeismicHammer()
|
||||
{
|
||||
super("Seismic Slam", new String[]
|
||||
{
|
||||
C.cYellow + "Right-Click" + C.cGray + " with Iron Axe to " + C.cGreen + "Seismic Hammer"
|
||||
});
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void Skill(PlayerInteractEvent event)
|
||||
{
|
||||
if (event.isCancelled())
|
||||
return;
|
||||
|
||||
if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK)
|
||||
return;
|
||||
|
||||
if (UtilBlock.usable(event.getClickedBlock()))
|
||||
return;
|
||||
|
||||
if (event.getPlayer().getItemInHand() == null)
|
||||
return;
|
||||
|
||||
if (!event.getPlayer().getItemInHand().getType().toString().contains("IRON_AXE"))
|
||||
return;
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (!Kit.HasKit(player))
|
||||
return;
|
||||
|
||||
if (!Recharge.Instance.use(player, GetName(), 10000, true))
|
||||
return;
|
||||
|
||||
//Action
|
||||
int damage = 10;
|
||||
double range = 10;
|
||||
|
||||
HashMap<LivingEntity, Double> targets = UtilEnt.getInRadius(player.getLocation(), range);
|
||||
for (LivingEntity cur : targets.keySet())
|
||||
{
|
||||
if (cur instanceof Player)
|
||||
continue;
|
||||
|
||||
//Damage Event
|
||||
Manager.GetDamage().NewDamageEvent(cur, player, null,
|
||||
DamageCause.CUSTOM, damage * targets.get(cur) + 0.5, false, true, false,
|
||||
player.getName(), GetName());
|
||||
|
||||
//Velocity
|
||||
UtilAction.velocity(cur,
|
||||
UtilAlg.getTrajectory2d(player.getLocation().toVector(), cur.getLocation().toVector()),
|
||||
2.2 * targets.get(cur), true, 0, 0.4 + 1.0 * targets.get(cur), 1.6, true);
|
||||
}
|
||||
|
||||
//Effect
|
||||
player.getWorld().playSound(player.getLocation(), Sound.ZOMBIE_METAL, 2f, 0.2f);
|
||||
for (Block cur : UtilBlock.getInRadius(player.getLocation(), 4d).keySet())
|
||||
if (UtilBlock.airFoliage(cur.getRelative(BlockFace.UP)) && !UtilBlock.airFoliage(cur))
|
||||
cur.getWorld().playEffect(cur.getLocation(), Effect.STEP_SOUND, cur.getTypeId());
|
||||
|
||||
//Inform
|
||||
UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + "."));
|
||||
}
|
||||
}
|
@ -19,6 +19,7 @@ import nautilus.game.arcade.game.Game;
|
||||
import nautilus.minecraft.core.utils.ZipUtil;
|
||||
import net.minecraft.server.v1_6_R3.ChunkPreLoadEvent;
|
||||
|
||||
import org.bukkit.Difficulty;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.WorldCreator;
|
||||
@ -78,6 +79,7 @@ public class WorldData
|
||||
{
|
||||
//Start World
|
||||
World = WorldUtil.LoadWorld(new WorldCreator(GetFolder()));
|
||||
World.setDifficulty(Difficulty.HARD);
|
||||
|
||||
//Load World Data
|
||||
worldData.LoadWorldConfig();
|
||||
|
Loading…
Reference in New Issue
Block a user