arcade: fixed kit material NPE

SSM: added knight
SSM: added placeholder for wither skel
This commit is contained in:
Chiss 2013-09-04 11:55:19 +10:00
parent 23ac045a41
commit e3eae200ae
23 changed files with 678 additions and 83 deletions

View File

@ -81,8 +81,12 @@ public class GameTeam
}
public Location GetSpawn()
{
{
ArrayList<Location> valid = new ArrayList<Location>();
Location best = null;
double bestDist = 0;
for (Location loc : _spawns)
{
double closestPlayer = -1;
@ -95,6 +99,12 @@ public class GameTeam
closestPlayer = playerDist;
}
if (best == null || closestPlayer > bestDist)
{
best = loc;
bestDist = closestPlayer;
}
if (closestPlayer > _spawnDistance)
{
valid.add(loc);
@ -104,6 +114,9 @@ public class GameTeam
if (valid.size() > 0)
valid.get(UtilMath.r(valid.size()));
if (best != null)
return best;
return _spawns.get(UtilMath.r(_spawns.size()));
}

View File

@ -13,6 +13,7 @@ import org.bukkit.event.entity.EntityRegainHealthEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
@ -21,6 +22,7 @@ import mineplex.core.common.util.UtilPlayer;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeFormat;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent;
@ -50,9 +52,12 @@ public class SuperSmash extends SoloGame
new KitSnowman(manager),
new KitBlaze(manager),
new KitWitherSkeleton(manager),
new KitChicken(manager),
new KitKnight(manager),
new KitSkySquid(manager),
},
new String[]
@ -73,6 +78,10 @@ public class SuperSmash extends SoloGame
this.PrepareFreeze = false;
this.CompassEnabled = true;
this.SpawnDistanceRequirement = 16;
this.InventoryOpen = true;
}
@EventHandler(priority = EventPriority.HIGH)
@ -193,6 +202,9 @@ public class SuperSmash extends SoloGame
if (event.GetCause() == DamageCause.VOID || event.GetCause() == DamageCause.LAVA)
{
event.GetDamageeEntity().eject();
event.GetDamageeEntity().leaveVehicle();
if (event.GetDamageePlayer() != null)
event.GetDamageeEntity().getWorld().strikeLightningEffect(event.GetDamageeEntity().getLocation());
@ -237,4 +249,47 @@ public class SuperSmash extends SoloGame
UtilInv.Update(player);
}
}
@EventHandler(priority = EventPriority.LOWEST)
public void AbilityDescription(PlayerInteractEvent event)
{
if (event.isCancelled())
return;
Player player = event.getPlayer();
if (player.getItemInHand() == null)
return;
if (player.getItemInHand().getItemMeta() == null)
return;
if (player.getItemInHand().getItemMeta().getDisplayName() == null)
return;
if (player.getItemInHand().getItemMeta().getLore() == null)
return;
if (Manager.GetGame() == null || Manager.GetGame().GetState() != GameState.Recruit)
return;
for (int i=player.getItemInHand().getItemMeta().getLore().size() ; i<=7 ; i++)
UtilPlayer.message(player, " ");
UtilPlayer.message(player, ArcadeFormat.Line);
UtilPlayer.message(player, "§aAbility - §f§l" + player.getItemInHand().getItemMeta().getDisplayName());
//Perk Descs
for (String line : player.getItemInHand().getItemMeta().getLore())
{
UtilPlayer.message(player, line);
}
UtilPlayer.message(player, ArcadeFormat.Line);
player.playSound(player.getLocation(), Sound.NOTE_PLING, 1f, 2f);
event.setCancelled(true);
}
}

View File

@ -5,6 +5,7 @@ import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
import mineplex.core.disguise.disguises.DisguiseBlaze;
@ -42,8 +43,7 @@ public class KitBlaze extends SmashKit
new PerkFirefly()
},
EntityType.BLAZE,
null,
Material.BLAZE_ROD);
new ItemStack(Material.BLAZE_ROD));
}

View File

@ -4,6 +4,7 @@ import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
import mineplex.core.disguise.disguises.DisguiseChicken;
@ -36,8 +37,7 @@ public class KitChicken extends SmashKit
},
EntityType.CHICKEN,
null,
Material.EGG);
new ItemStack(Material.EGG));
}

View File

@ -8,6 +8,7 @@ import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
import mineplex.core.disguise.disguises.DisguiseEnderman;
@ -43,8 +44,7 @@ public class KitEnderman extends SmashKit
new PerkBlockToss()
},
EntityType.ENDERMAN,
null,
Material.ENDER_PEARL);
new ItemStack(Material.ENDER_PEARL));
}

View File

@ -4,6 +4,7 @@ import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
import mineplex.core.disguise.disguises.DisguiseIronGolem;
@ -34,8 +35,7 @@ public class KitGolem extends SmashKit
},
EntityType.IRON_GOLEM,
null,
Material.IRON_BLOCK);
new ItemStack(Material.IRON_BLOCK));
}
@Override

View File

@ -1,25 +1,54 @@
package nautilus.game.arcade.game.standalone.smash.kits;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Horse;
import org.bukkit.entity.Horse.Color;
import org.bukkit.entity.Horse.Style;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Horse.Variant;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.PlayerInteractEntityEvent;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
import mineplex.core.disguise.disguises.DisguiseSpider;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
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.PerkDoubleJump;
import nautilus.game.arcade.kit.perks.PerkDoubleJumpHorse;
import nautilus.game.arcade.kit.perks.PerkFletcher;
import nautilus.game.arcade.kit.perks.PerkHorseKick;
import nautilus.game.arcade.kit.perks.PerkKnockbackArrow;
import nautilus.game.arcade.kit.perks.PerkSmashStats;
public class KitKnight extends SmashKit
{
private HashMap<Player, Horse> _mounts = new HashMap<Player, Horse>();
private HashSet<Horse> _horses = new HashSet<Horse>();
private HashSet<CustomDamageEvent> _calledEvents = new HashSet<CustomDamageEvent>();
public KitKnight(ArcadeManager manager)
{
super(manager, ChatColor.RED + "Undead Knight", KitAvailability.Blue,
super(manager, "Undead Knight", KitAvailability.Blue,
new String[]
{
@ -27,42 +56,206 @@ public class KitKnight extends SmashKit
new Perk[]
{
new PerkSmashStats(7, 1.6, 0.25, 7),
new PerkDoubleJump("Double Jump", 0.9, 0.9, false),
new PerkSmashStats(6, 1.2, 0.25, 7.5),
new PerkFletcher(1, 2, false),
new PerkKnockbackArrow(2),
new PerkDoubleJumpHorse(),
new PerkHorseKick(),
},
EntityType.HORSE,
null,
Material.IRON_CHESTPLATE);
new ItemStack(Material.IRON_BARDING));
}
@Override
public void GiveItems(Player player)
{
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD, (byte)0, 1,
C.cYellow + C.Bold + "Hold/Release Block" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "???",
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1,
C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Horse Kick",
new String[]
{
ChatColor.RESET + "",
ChatColor.RESET + "",
}));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1,
C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "???",
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW, (byte)0, 1,
C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Coming Soon...",
new String[]
{
ChatColor.RESET + "",
ChatColor.RESET + "",
}));
player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.IRON_HELMET));
player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.IRON_CHESTPLATE));
player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS));
player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.IRON_LEGGINGS));
player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.IRON_BOOTS));
//Disguise
DisguiseSpider disguise = new DisguiseSpider(player);
disguise.SetName(C.cYellow + player.getName());
disguise.SetCustomNameVisible(true);
Manager.GetDisguise().disguise(disguise);
Manager.GetGame().CreatureAllowOverride = true;
final Horse horse = player.getWorld().spawn(player.getLocation(), Horse.class);
Manager.GetGame().CreatureAllowOverride = false;
//Owner
horse.setTamed(true);
horse.setOwner(player);
horse.setMaxDomestication(1);
//Visual
horse.setColor(Color.DARK_BROWN);
horse.setStyle(Style.WHITE_DOTS);
horse.setVariant(Variant.UNDEAD_HORSE);
horse.getInventory().setSaddle(new ItemStack(Material.SADDLE));
horse.getInventory().setArmor(new ItemStack(Material.IRON_BARDING));
//Stats
horse.setAdult();
horse.setJumpStrength(1);
horse.setMaxHealth(100);
horse.setHealth(horse.getMaxHealth());
_horses.add(horse);
_mounts.put(player, horse);
final Player fPlayer = player;
Manager.GetPlugin().getServer().getScheduler().scheduleSyncDelayedTask(Manager.GetPlugin(), new Runnable()
{
public void run()
{
horse.setPassenger(fPlayer);
}
}, 1);
}
@EventHandler
public void HorseUpdate(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
Iterator<Horse> horseIterator = _horses.iterator();
while (horseIterator.hasNext())
{
Horse horse = horseIterator.next();
if (horse.isValid() && _mounts.containsValue(horse))
continue;
horseIterator.remove();
horse.remove();
}
}
@EventHandler
public void HorseUpdate(PlayerInteractEntityEvent event)
{
if (!(event.getRightClicked() instanceof Horse))
return;
Player player = event.getPlayer();
Horse horse = (Horse)event.getRightClicked();
if (_mounts.containsKey(player) && _mounts.get(player).equals(horse))
return;
UtilPlayer.message(player, F.main("Game", "This is not your " + F.elem("Skeletal Horse") + "!"));
event.setCancelled(true);
}
@EventHandler(priority = EventPriority.LOWEST)
public void PlayerDamage(CustomDamageEvent event)
{
if (_calledEvents.contains(event))
return;
Player damagee = event.GetDamageePlayer();
if (damagee == null) return;
if (damagee.getVehicle() == null)
return;
if (!(damagee.getVehicle() instanceof Horse))
return;
if (event.GetCause() == DamageCause.SUFFOCATION)
{
event.SetCancelled("Horse Suffocation");
return;
}
Horse horse = (Horse)damagee.getVehicle();
//Damage Event
CustomDamageEvent newEvent = new CustomDamageEvent(horse, event.GetDamagerEntity(true), event.GetProjectile(),
event.GetCause(), event.GetDamageInitial(), true, false, false,
UtilEnt.getName(event.GetDamagerPlayer(true)), event.GetReason(), false);
_calledEvents.add(newEvent);
Manager.GetPlugin().getServer().getPluginManager().callEvent(newEvent);
}
@EventHandler(priority = EventPriority.LOWEST)
public void HorseDamage(CustomDamageEvent event)
{
if (_calledEvents.contains(event))
return;
if (event.GetCause() == DamageCause.THORNS)
return;
if (!(event.GetDamageeEntity() instanceof Horse))
return;
Horse horse = (Horse)event.GetDamageeEntity();
if (horse.getPassenger() == null)
return;
if (!(horse.getPassenger() instanceof Player))
return;
Player player = (Player)horse.getPassenger();
//Damage Event
CustomDamageEvent newEvent = new CustomDamageEvent(player, event.GetDamagerEntity(true), event.GetProjectile(),
event.GetCause(), event.GetDamageInitial(), true, false, false,
UtilEnt.getName(event.GetDamagerPlayer(true)), event.GetReason(), false);
_calledEvents.add(newEvent);
Manager.GetPlugin().getServer().getPluginManager().callEvent(newEvent);
//Add Knockback
event.AddKnockback("Knockback Multiplier", 1.2);
}
@Override
public Entity SpawnEntity(Location loc)
{
EntityType type = _entityType;
if (type == EntityType.PLAYER)
type = EntityType.ZOMBIE;
LivingEntity entity = (LivingEntity) Manager.GetCreature().SpawnEntity(loc, type);
entity.setRemoveWhenFarAway(false);
entity.setCustomName(GetAvailability().GetColor() + GetName() + " Kit" + (GetAvailability() == KitAvailability.Blue ? ChatColor.GRAY + " (" + ChatColor.WHITE + "Ultra" + ChatColor.GRAY + ")" : ""));
entity.setCustomNameVisible(true);
entity.getEquipment().setItemInHand(_itemInHand);
if (type == EntityType.HORSE)
{
Horse horse = (Horse)entity;
horse.setAdult();
horse.setColor(Color.DARK_BROWN);
horse.setStyle(Style.WHITE_DOTS);
horse.setVariant(Variant.UNDEAD_HORSE);
horse.getInventory().setSaddle(new ItemStack(Material.SADDLE));
horse.getInventory().setArmor(new ItemStack(Material.IRON_BARDING));
}
UtilEnt.Vegetate(entity);
SpawnCustom(entity);
return entity;
}
}

View File

@ -13,6 +13,7 @@ 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.PerkBarrage;
import nautilus.game.arcade.kit.perks.PerkBoneExplosion;
import nautilus.game.arcade.kit.perks.PerkDoubleJump;
import nautilus.game.arcade.kit.perks.PerkFletcher;
@ -37,8 +38,8 @@ public class KitSkeleton extends SmashKit
new PerkFletcher(1, 2, false),
new PerkKnockbackArrow(2),
new PerkBoneExplosion(),
new PerkRopedArrow("Roped Arrow", 1.2, 3000),
//new PerkBarrage(5, 250, true),
new PerkRopedArrow("Roped Arrow", 1, 2500),
new PerkBarrage(5, 250, true),
},
EntityType.SKELETON,
new ItemStack(Material.BOW));
@ -63,6 +64,15 @@ public class KitSkeleton extends SmashKit
ChatColor.RESET + "collides with something, you are pulled",
ChatColor.RESET + "towards it, with great power.",
}));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.ARROW, (byte)0, 1,
C.cYellow + C.Bold + "Charge Bow" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Barrage",
new String[]
{
ChatColor.RESET + "Slowly load more arrows into your bow.",
ChatColor.RESET + "When you release, you will quickly fire",
ChatColor.RESET + "all the arrows in succession.",
}));
player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_HELMET));
player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_CHESTPLATE));

View File

@ -4,6 +4,7 @@ import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
import mineplex.core.disguise.disguises.DisguiseSquid;
@ -35,8 +36,7 @@ public class KitSkySquid extends SmashKit
new PerkInkBlast(),
},
EntityType.SQUID,
null,
Material.INK_SACK);
new ItemStack(Material.INK_SACK));
}
@Override

View File

@ -4,6 +4,7 @@ import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
import mineplex.core.disguise.disguises.DisguiseSlime;
@ -35,8 +36,7 @@ public class KitSlime extends SmashKit
new PerkSlimeRocket(),
},
EntityType.SLIME,
null,
Material.SLIME_BALL);
new ItemStack(Material.SLIME_BALL));
}
@Override

View File

@ -4,6 +4,7 @@ import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
import mineplex.core.disguise.disguises.DisguiseSnowman;
@ -14,9 +15,9 @@ import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.SmashKit;
import nautilus.game.arcade.kit.perks.PerkArcticAura;
import nautilus.game.arcade.kit.perks.PerkBlizzard;
import nautilus.game.arcade.kit.perks.PerkDamageSnow;
import nautilus.game.arcade.kit.perks.PerkDoubleJump;
import nautilus.game.arcade.kit.perks.PerkIcePath;
import nautilus.game.arcade.kit.perks.PerkKnockbackSnow;
import nautilus.game.arcade.kit.perks.PerkSmashStats;
public class KitSnowman extends SmashKit
@ -31,16 +32,15 @@ public class KitSnowman extends SmashKit
new Perk[]
{
new PerkSmashStats(6, 1.4, 0.25, 6),
new PerkSmashStats(6, 1.4, 0.4, 6),
new PerkDoubleJump("Double Jump", 0.9, 0.9, false),
new PerkKnockbackSnow(1.5),
new PerkDamageSnow(3, 1.5),
new PerkArcticAura(),
new PerkBlizzard(),
new PerkIcePath(),
},
EntityType.SNOWMAN,
null,
Material.SNOW_BALL);
new ItemStack(Material.SNOW_BALL));
}

View File

@ -4,6 +4,7 @@ import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
import mineplex.core.disguise.disguises.DisguiseSpider;
@ -35,8 +36,7 @@ public class KitSpider extends SmashKit
new PerkWebShot(),
},
EntityType.SPIDER,
null,
Material.STRING);
new ItemStack(Material.WEB));
}
@Override
@ -75,6 +75,7 @@ public class KitSpider extends SmashKit
new String[]
{
ChatColor.RESET + "While crouching, you stick to walls.",
ChatColor.RESET + "",
ChatColor.RESET + "Grasping onto a wall allows you to",
ChatColor.RESET + "use Spider Leap again.",
ChatColor.RESET + "",

View File

@ -4,15 +4,17 @@ import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.entity.Skeleton.SkeletonType;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
import mineplex.core.disguise.disguises.DisguiseSpider;
import mineplex.core.disguise.disguises.DisguiseSkeleton;
import mineplex.core.itemstack.ItemStackFactory;
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.PerkComingSoon;
import nautilus.game.arcade.kit.perks.PerkDoubleJump;
import nautilus.game.arcade.kit.perks.PerkSmashStats;
@ -20,7 +22,7 @@ public class KitWitherSkeleton extends SmashKit
{
public KitWitherSkeleton(ArcadeManager manager)
{
super(manager, ChatColor.RED + "Wither Skeleton", KitAvailability.Blue,
super(manager, "Wither Skeleton", KitAvailability.Green,
new String[]
{
@ -28,8 +30,9 @@ public class KitWitherSkeleton extends SmashKit
new Perk[]
{
new PerkSmashStats(7, 1.6, 0.25, 7),
new PerkSmashStats(7, 1.6, 0.25, 7.5),
new PerkDoubleJump("Double Jump", 0.9, 0.9, false),
new PerkComingSoon(),
},
EntityType.SKELETON,
new ItemStack(Material.IRON_SWORD));
@ -39,7 +42,7 @@ public class KitWitherSkeleton extends SmashKit
public void GiveItems(Player player)
{
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD, (byte)0, 1,
C.cYellow + C.Bold + "Hold/Release Block" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "???",
C.cYellow + C.Bold + "Hold/Release Block" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Coming Soon...",
new String[]
{
ChatColor.RESET + "",
@ -47,7 +50,7 @@ public class KitWitherSkeleton extends SmashKit
}));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1,
C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "???",
C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Coming Soon...",
new String[]
{
ChatColor.RESET + "",
@ -56,13 +59,14 @@ public class KitWitherSkeleton extends SmashKit
player.getInventory().setHelmet(ItemStackFactory.Instance.CreateStack(Material.IRON_HELMET));
player.getInventory().setChestplate(ItemStackFactory.Instance.CreateStack(Material.IRON_CHESTPLATE));
player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.CHAINMAIL_LEGGINGS));
player.getInventory().setLeggings(ItemStackFactory.Instance.CreateStack(Material.IRON_LEGGINGS));
player.getInventory().setBoots(ItemStackFactory.Instance.CreateStack(Material.IRON_BOOTS));
//Disguise
DisguiseSpider disguise = new DisguiseSpider(player);
DisguiseSkeleton disguise = new DisguiseSkeleton(player);
disguise.SetName(C.cYellow + player.getName());
disguise.SetCustomNameVisible(true);
disguise.SetSkeletonType(SkeletonType.WITHER);
Manager.GetDisguise().disguise(disguise);
}
}

View File

@ -34,7 +34,7 @@ public abstract class Kit implements Listener
protected Material _displayItem;
public Kit(ArcadeManager manager, String name, KitAvailability kitAvailability, String[] kitDesc, Perk[] kitPerks, EntityType entityType, ItemStack itemInHand, Material displayItem)
public Kit(ArcadeManager manager, String name, KitAvailability kitAvailability, String[] kitDesc, Perk[] kitPerks, EntityType entityType, ItemStack itemInHand)
{
Manager = manager;
@ -49,12 +49,10 @@ public abstract class Kit implements Listener
_entityType = entityType;
_itemInHand = itemInHand;
_displayItem = displayItem;
}
public Kit(ArcadeManager manager, String name, KitAvailability kitAvailability, String[] kitDesc, Perk[] kitPerks, EntityType entityType, ItemStack itemInHand)
{
this(manager, name, kitAvailability, kitDesc, kitPerks, entityType, itemInHand, itemInHand.getType());
_displayItem = Material.BOOK;
if (itemInHand != null)
_displayItem = itemInHand.getType();
}
public String GetFormattedName()

View File

@ -11,27 +11,19 @@ import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
public abstract class SmashKit extends Kit
{
{
public SmashKit(ArcadeManager manager, String name,
KitAvailability kitAvailability, String[] kitDesc, Perk[] kitPerks,
EntityType entityType, ItemStack itemInHand)
{
super(manager, name, kitAvailability, kitDesc, kitPerks, entityType, itemInHand);
}
public SmashKit(ArcadeManager manager, String name,
KitAvailability kitAvailability, String[] kitDesc, Perk[] kitPerks,
EntityType entityType, ItemStack itemInHand, Material displayItem)
{
super(manager, name, kitAvailability, kitDesc, kitPerks, entityType, itemInHand, displayItem);
}
public void DisplayDesc(Player player)
{
for (int i=0 ; i<3 ; i++)
UtilPlayer.message(player, "");
UtilPlayer.message(player, ArcadeFormat.Line);
UtilPlayer.message(player, "§aKit - §f§l" + GetName());

View File

@ -0,0 +1,15 @@
package nautilus.game.arcade.kit.perks;
import mineplex.core.common.util.C;
import nautilus.game.arcade.kit.Perk;
public class PerkComingSoon extends Perk
{
public PerkComingSoon()
{
super("Digger", new String[]
{
C.cRed + C.Bold + "COMING SOON...",
});
}
}

View File

@ -0,0 +1,45 @@
package nautilus.game.arcade.kit.perks;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import mineplex.core.common.util.C;
import nautilus.game.arcade.kit.Perk;
public class PerkDamageSnow extends Perk
{
private int _damage;
private double _knockback;
public PerkDamageSnow(int damage, double knockback)
{
super("Snow Attack", new String[]
{
C.cGray + "+" + damage + " Damage and +" + (int)((knockback-1)*100) + "% Knockback to enemies on snow.",
});
_damage = damage;
_knockback = knockback;
}
@EventHandler(priority = EventPriority.HIGH)
public void Knockback(CustomDamageEvent event)
{
if (event.GetDamageeEntity().getLocation().getBlock().getTypeId() != 78)
return;
Player damager = event.GetDamagerPlayer(true);
if (damager == null) return;
if (!Kit.HasKit(damager))
return;
if (!Manager.IsAlive(damager))
return;
event.AddMod(damager.getName(), GetName(), _damage, false);
event.AddKnockback("Knockback Snow", _knockback);
}
}

View File

@ -0,0 +1,84 @@
package nautilus.game.arcade.kit.perks;
import org.bukkit.Effect;
import org.bukkit.GameMode;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerToggleFlightEvent;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilServer;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.kit.Perk;
public class PerkDoubleJumpHorse extends Perk
{
public PerkDoubleJumpHorse()
{
super("Jumper", new String[]
{
C.cYellow + "Tap Jump Twice" + C.cGray + " to " + C.cGreen + "Double Jump"
});
}
@EventHandler
public void FlightHop(PlayerToggleFlightEvent event)
{
Player player = event.getPlayer();
if (!Kit.HasKit(player))
return;
if (player.getGameMode() == GameMode.CREATIVE)
return;
event.setCancelled(true);
player.setFlying(false);
//Disable Flight
player.setAllowFlight(false);
//Velocity
if (player.getVehicle() == null)
UtilAction.velocity(player, player.getLocation().getDirection(), 1.2, true, 1.2, 0, 1.2, true);
else
UtilAction.velocity(player.getVehicle(), player.getLocation().getDirection(), 0.8, true, 0.8, 0, 0.8, true);
//Sound
player.getWorld().playEffect(player.getLocation(), Effect.BLAZE_SHOOT, 0);
}
@EventHandler
public void FlightUpdate(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
for (Player player : UtilServer.getPlayers())
{
if (player.getGameMode() == GameMode.CREATIVE)
continue;
if (!Kit.HasKit(player))
continue;
if (player.getVehicle() == null)
{
if (UtilEnt.isGrounded(player) || UtilBlock.solid(player.getLocation().getBlock().getRelative(BlockFace.DOWN)))
player.setAllowFlight(true);
}
else
{
if (UtilEnt.isGrounded(player.getVehicle()) || UtilBlock.solid(player.getVehicle().getLocation().getBlock().getRelative(BlockFace.DOWN)))
player.setAllowFlight(true);
}
}
}
}

View File

@ -0,0 +1,164 @@
package nautilus.game.arcade.kit.perks;
import java.util.HashMap;
import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_6_R2.entity.CraftHorse;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Horse;
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.UtilBlock;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.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 PerkHorseKick extends Perk
{
private HashMap<Player, Long> _active = new HashMap<Player, Long>();
public PerkHorseKick()
{
super("Horse Kick", new String[]
{
C.cYellow + "Hold Block" + C.cGray + " to use " + C.cGreen + "Horse Kick"
});
}
@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("_AXE"))
return;
Player player = event.getPlayer();
if (!Kit.HasKit(player))
return;
if (!Recharge.Instance.use(player, GetName(), 6000, true))
return;
Horse horse = GetHorse(player);
//Horse Skill
if (horse != null)
{
//Animation
_active.put(player, System.currentTimeMillis());
((CraftHorse)horse).getHandle().p(true);
//Attack
Location loc = horse.getLocation().add(horse.getLocation().getDirection().multiply(1.5));
for (Entity other : horse.getWorld().getEntities())
{
if (!(other instanceof LivingEntity))
continue;
if (other.equals(horse.getPassenger()))
continue;
if (other.equals(horse))
continue;
if (UtilMath.offset(loc, other.getLocation()) > 2)
continue;
//Damage Event
Manager.GetDamage().NewDamageEvent((LivingEntity)other, (LivingEntity)horse.getPassenger(), null,
DamageCause.ENTITY_ATTACK, 8, true, false, false,
UtilEnt.getName(horse.getPassenger()), GetName());
}
UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + "."));
}
//Player Skill
else
{
}
}
@EventHandler
public void Update(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
for (Player cur : UtilServer.getPlayers())
{
if (!_active.containsKey(cur))
continue;
Horse horse = GetHorse(cur);
//Horse Skill
if (horse != null)
{
if (horse.getPassenger() == null || !(horse.getPassenger() instanceof LivingEntity))
{
_active.remove(cur);
((CraftHorse)horse).getHandle().p(false);
continue;
}
if (UtilTime.elapsed(_active.get(cur), 1000))
{
_active.remove(cur);
((CraftHorse)horse).getHandle().p(false);
continue;
}
}
//Player Skill
else
{
}
}
}
public Horse GetHorse(Player player)
{
if (player.getVehicle() == null)
return null;
if (player.getVehicle() instanceof Horse)
return (Horse)player.getVehicle();
return null;
}
@EventHandler
public void Knockback(CustomDamageEvent event)
{
if (event.GetReason() == null || !event.GetReason().contains(GetName()))
return;
event.AddKnockback(GetName(), 2);
}
}

View File

@ -1,6 +1,8 @@
package nautilus.game.arcade.kit.perks;
import org.bukkit.Effect;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Horse;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
@ -62,7 +64,13 @@ public class PerkLeap extends Perk
if (!Recharge.Instance.use(player, _name, _recharge, true))
return;
UtilAction.velocity(player, _power, 0.2, _heightMax, true);
Entity ent = player;
if (player.getVehicle() != null)
if (player.getVehicle() instanceof Horse)
ent = player.getVehicle();
UtilAction.velocity(ent, _power, 0.2, _heightMax, true);
player.setFallDistance(0);
UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(_name) + "."));

View File

@ -28,18 +28,18 @@ import nautilus.game.arcade.kit.Perk;
public class PerkRopedArrow extends Perk
{
private HashSet<Entity> _arrows = new HashSet<Entity>();
private String _name;
private double _power;
private long _recharge;
public PerkRopedArrow(String name, double power, long recharge)
{
super(name, new String[]
{
C.cYellow + "Left-Click" + C.cGray + " with Bow to " + C.cGreen + name
});
_name = name;
_power = power;
_recharge = recharge;
@ -53,26 +53,35 @@ public class PerkRopedArrow extends Perk
if (event.getPlayer().getItemInHand() == null)
return;
if (event.getPlayer().getItemInHand().getType() != Material.BOW)
return;
Player player = event.getPlayer();
if (!Kit.HasKit(player))
return;
if (!Recharge.Instance.use(player, _name, _recharge, true))
return;
//Arrow
Arrow arrow = player.launchProjectile(Arrow.class);
arrow.setVelocity(player.getLocation().getDirection().multiply(2.4 * _power));
_arrows.add(arrow);
//Leash
//Bat bat = player.getWorld().spawn(player.getEyeLocation(), Bat.class);
//bat.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, 100000, 100000));
//bat.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 100000, 100000));
//bat.setLeashHolder(arrow);
//Inform
UtilPlayer.message(player, F.main("Game", "You fired " + F.skill(_name) + "."));
}
@EventHandler
public void Hit(ProjectileHitEvent event)
{
@ -89,7 +98,7 @@ public class PerkRopedArrow extends Perk
Vector vec = UtilAlg.getTrajectory(proj.getShooter(), proj);
double mult = (proj.getVelocity().length() / 3d);
//Action
UtilAction.velocity(proj.getShooter(), vec,
0.4 + mult * _power, false, 0, 0.6 * mult * _power, 1.2 * mult * _power, true);
@ -103,11 +112,11 @@ public class PerkRopedArrow extends Perk
{
if (event.getType() != UpdateType.SEC)
return;
for (Iterator<Entity> arrowIterator = _arrows.iterator(); arrowIterator.hasNext();)
{
Entity arrow = arrowIterator.next();
if (!arrow.isValid())
arrowIterator.remove();
}

View File

@ -497,6 +497,9 @@ public class GameLobbyManager implements IPacketRunnable, Listener
if (_teams.containsKey(ent))
continue;
if (ent.getPassenger() != null)
continue;
ent.remove();
}
}

View File

@ -106,8 +106,9 @@ public class MiscManager implements Listener
if (Manager.IsAlive(player))
continue;
UtilPlayer.message(player, C.cYellow + C.Bold + "You are out of the game, but " + C.cRed + C.Bold + "DON'T QUIT" + C.cYellow + C.Bold + "!");
UtilPlayer.message(player, C.cYellow + C.Bold + "The next game will be starting soon...");
UtilPlayer.message(player, " ");
UtilPlayer.message(player, C.cWhite + C.Bold + "You are out of the game, but " + C.cGold + C.Bold + "DON'T QUIT" + C.cWhite + C.Bold + "!");
UtilPlayer.message(player, C.cWhite + C.Bold + "The next game will be starting soon...");
}
}