Merge branch 'master' of ssh://184.154.0.242:7999/min/Mineplex
This commit is contained in:
commit
ad4ba010b7
@ -69,6 +69,11 @@ public class MapUtil
|
||||
{
|
||||
QuickChangeBlockAt(location.getWorld(), location.getBlockX(), location.getBlockY(), location.getBlockZ(), setTo);
|
||||
}
|
||||
|
||||
public static void QuickChangeBlockAt(Location location, Material setTo, byte data)
|
||||
{
|
||||
QuickChangeBlockAt(location.getWorld(), location.getBlockX(), location.getBlockY(), location.getBlockZ(), setTo, data);
|
||||
}
|
||||
|
||||
public static void QuickChangeBlockAt(Location location, int id, byte data)
|
||||
{
|
||||
|
@ -5,10 +5,8 @@ import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
|
||||
|
||||
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.Vector;
|
||||
@ -251,6 +249,25 @@ public class UtilAlg
|
||||
return bestLoc;
|
||||
}
|
||||
|
||||
public static Location findFurthest(Location mid, ArrayList<Location> locs)
|
||||
{
|
||||
Location bestLoc = null;
|
||||
double bestDist = 0;
|
||||
|
||||
for (Location loc : locs)
|
||||
{
|
||||
double dist = UtilMath.offset(mid, loc);
|
||||
|
||||
if (bestLoc == null || dist > bestDist)
|
||||
{
|
||||
bestLoc = loc;
|
||||
bestDist = dist;
|
||||
}
|
||||
}
|
||||
|
||||
return bestLoc;
|
||||
}
|
||||
|
||||
public static boolean isInPyramid(Vector a, Vector b, double angleLimit)
|
||||
{
|
||||
return (Math.abs(GetPitch(a) - GetPitch(b)) < angleLimit) && (Math.abs(GetYaw(a) - GetYaw(b)) < angleLimit);
|
||||
@ -298,6 +315,42 @@ public class UtilAlg
|
||||
return bestLoc;
|
||||
}
|
||||
|
||||
public static Location getLocationAwayFromOtherLocations(ArrayList<Location> locs, ArrayList<Location> players)
|
||||
{
|
||||
Location bestLoc = null;
|
||||
double bestDist = 0;
|
||||
|
||||
for (Location loc : locs)
|
||||
{
|
||||
double closest = -1;
|
||||
|
||||
for (Location player : players)
|
||||
{
|
||||
//Different Worlds
|
||||
if (!player.getWorld().equals(loc.getWorld()))
|
||||
continue;
|
||||
|
||||
double dist = UtilMath.offsetSquared(player, loc);
|
||||
|
||||
if (closest == -1 || dist < closest)
|
||||
{
|
||||
closest = dist;
|
||||
}
|
||||
}
|
||||
|
||||
if (closest == -1)
|
||||
continue;
|
||||
|
||||
if (bestLoc == null || closest > bestDist)
|
||||
{
|
||||
bestLoc = loc;
|
||||
bestDist = closest;
|
||||
}
|
||||
}
|
||||
|
||||
return bestLoc;
|
||||
}
|
||||
|
||||
public static Location getLocationNearPlayers(ArrayList<Location> locs, ArrayList<Player> players, ArrayList<Player> dontOverlap)
|
||||
{
|
||||
Location bestLoc = null;
|
||||
@ -353,4 +406,21 @@ public class UtilAlg
|
||||
|
||||
return bestLoc;
|
||||
}
|
||||
|
||||
public static Location getNearestCornerLocation(Location near, Block block)
|
||||
{
|
||||
ArrayList<Location> corners = new ArrayList<Location>();
|
||||
|
||||
corners.add(block.getLocation().clone());
|
||||
corners.add(block.getLocation().clone().add(.999, 0, 0));
|
||||
corners.add(block.getLocation().clone().add(.999, 0, .999));
|
||||
corners.add(block.getLocation().clone().add(0, 0, .999));
|
||||
|
||||
corners.add(block.getLocation().clone().add(0, .999, 0));
|
||||
corners.add(block.getLocation().clone().add(.999, .999, 0));
|
||||
corners.add(block.getLocation().clone().add(.999, .999, .999));
|
||||
corners.add(block.getLocation().clone().add(0, .999, .999));
|
||||
|
||||
return UtilAlg.findClosest(near, corners);
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
package mineplex.core.common.util;
|
||||
|
||||
import net.minecraft.server.v1_7_R4.PacketPlayOutEntityDestroy;
|
||||
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.FireworkEffect;
|
||||
import org.bukkit.FireworkEffect.Type;
|
||||
@ -8,6 +10,7 @@ import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftFirework;
|
||||
import org.bukkit.entity.Firework;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.meta.FireworkMeta;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
@ -68,5 +71,29 @@ public class UtilFirework
|
||||
public static void playFirework(Location loc, Type type, Color color, boolean flicker, boolean trail)
|
||||
{
|
||||
playFirework(loc, FireworkEffect.builder().flicker(flicker).withColor(color).with(type).trail(trail).build());
|
||||
}
|
||||
|
||||
public static void packetPlayFirework(Player player, Location loc, Type type, Color color, boolean flicker, boolean trail)
|
||||
{
|
||||
Firework firework = (Firework) loc.getWorld().spawn(loc, Firework.class);
|
||||
FireworkEffect effect = FireworkEffect.builder().flicker(flicker).withColor(color).with(type).trail(trail).build();
|
||||
|
||||
FireworkMeta data = (FireworkMeta) firework.getFireworkMeta();
|
||||
data.clearEffects();
|
||||
data.setPower(1);
|
||||
data.addEffect(effect);
|
||||
firework.setFireworkMeta(data);
|
||||
|
||||
((CraftFirework) firework).getHandle().expectedLifespan = 1;
|
||||
|
||||
PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy(firework.getEntityId());
|
||||
|
||||
for (Player viewing : UtilServer.getPlayers())
|
||||
{
|
||||
if (player == viewing)
|
||||
continue;
|
||||
|
||||
UtilPlayer.sendPacket(viewing, packet);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,23 +6,23 @@ public class UtilSkull
|
||||
{
|
||||
public static byte getSkullData(Entity entity)
|
||||
{
|
||||
if (entity instanceof Skeleton)
|
||||
{
|
||||
Skeleton sk = ((Skeleton) entity);
|
||||
if (sk.getSkeletonType() == Skeleton.SkeletonType.WITHER)
|
||||
return 1;
|
||||
else return 0;
|
||||
}
|
||||
else if (entity instanceof Zombie || entity instanceof Giant)
|
||||
{
|
||||
if (entity == null)
|
||||
return 0;
|
||||
|
||||
return getSkullData(entity.getType());
|
||||
}
|
||||
|
||||
public static byte getSkullData(EntityType type)
|
||||
{
|
||||
if (type == EntityType.SKELETON)
|
||||
return 0;
|
||||
if (type == EntityType.WITHER)
|
||||
return 1;
|
||||
if (type == EntityType.ZOMBIE || type == EntityType.GIANT)
|
||||
return 2;
|
||||
}
|
||||
else if (entity instanceof Creeper)
|
||||
{
|
||||
if (type == EntityType.CREEPER)
|
||||
return 4;
|
||||
}
|
||||
else
|
||||
return 3;
|
||||
return 3;
|
||||
}
|
||||
|
||||
public static boolean isPlayerHead(byte data)
|
||||
@ -31,52 +31,54 @@ public class UtilSkull
|
||||
}
|
||||
|
||||
public static String getPlayerHeadName(Entity entity)
|
||||
{
|
||||
return getPlayerHeadName(entity.getType());
|
||||
}
|
||||
|
||||
public static String getPlayerHeadName(EntityType entity)
|
||||
{
|
||||
String name = "MHF_Alex";
|
||||
|
||||
// order is important for some of these
|
||||
if (entity instanceof Blaze)
|
||||
if (entity == EntityType.BLAZE)
|
||||
name = "MHF_Blaze";
|
||||
else if (entity instanceof CaveSpider)
|
||||
else if (entity == EntityType.CAVE_SPIDER)
|
||||
name = "MHF_CaveSpider";
|
||||
else if (entity instanceof Spider)
|
||||
else if (entity == EntityType.SPIDER)
|
||||
name = "MHF_Spider";
|
||||
else if (entity instanceof Chicken)
|
||||
else if (entity == EntityType.CHICKEN)
|
||||
name = "MHF_Chicken";
|
||||
else if (entity instanceof MushroomCow)
|
||||
else if (entity == EntityType.MUSHROOM_COW)
|
||||
name = "MHF_MushroomCow";
|
||||
else if (entity instanceof Cow)
|
||||
else if (entity == EntityType.COW)
|
||||
name = "MHF_Cow";
|
||||
else if (entity instanceof Creeper)
|
||||
else if (entity == EntityType.CREEPER)
|
||||
name = "MHF_Creeper";
|
||||
else if (entity instanceof Enderman)
|
||||
else if (entity == EntityType.ENDERMAN)
|
||||
name = "MHF_Enderman";
|
||||
else if (entity instanceof Ghast)
|
||||
else if (entity == EntityType.GHAST)
|
||||
name = "MHF_Ghast";
|
||||
else if (entity instanceof Golem)
|
||||
else if (entity == EntityType.IRON_GOLEM)
|
||||
name = "MHF_Golem";
|
||||
else if (entity instanceof PigZombie)
|
||||
else if (entity == EntityType.PIG_ZOMBIE)
|
||||
name = "MHF_PigZombie";
|
||||
else if (entity instanceof MagmaCube)
|
||||
else if (entity == EntityType.MAGMA_CUBE)
|
||||
name = "MHF_LavaSlime";
|
||||
else if (entity instanceof Slime)
|
||||
else if (entity == EntityType.SLIME)
|
||||
name = "MHF_Slime";
|
||||
else if (entity instanceof Ocelot)
|
||||
else if (entity == EntityType.OCELOT)
|
||||
name = "MHF_Ocelot";
|
||||
else if (entity instanceof PigZombie)
|
||||
name = "MHF_PigZombie";
|
||||
else if (entity instanceof Pig)
|
||||
else if (entity == EntityType.PIG)
|
||||
name = "MHF_Pig";
|
||||
else if (entity instanceof Sheep)
|
||||
name = "MHF_Pig";
|
||||
else if (entity instanceof Squid)
|
||||
else if (entity == EntityType.SHEEP)
|
||||
name = "MHF_Sheep";
|
||||
else if (entity == EntityType.SQUID)
|
||||
name = "MHF_Squid";
|
||||
else if (entity instanceof HumanEntity)
|
||||
else if (entity == EntityType.PLAYER)
|
||||
name = "MHF_Steve";
|
||||
else if (entity instanceof Villager)
|
||||
else if (entity == EntityType.VILLAGER)
|
||||
name = "MHF_Villager";
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -666,7 +666,49 @@ public enum Achievement
|
||||
new String[]{"Bomb Lobbers.Direct Hit"},
|
||||
new String[]{"Get 50 direct hits"},
|
||||
new int[]{50},
|
||||
AchievementCategory.BOMB_LOBBERS)
|
||||
AchievementCategory.BOMB_LOBBERS),
|
||||
|
||||
EVOLUTION_WINS("Expert Evolver", 1200,
|
||||
new String[]{"Evolution.Wins"},
|
||||
new String[]{"Win 20 games of Evolution"},
|
||||
new int[]{20},
|
||||
AchievementCategory.EVOLUTION),
|
||||
|
||||
EVOLUTION_NO_DEATHS("Perfect Game", 2000,
|
||||
new String[]{"Evolution.NoDeaths"},
|
||||
new String[]{"Win a game without dying"},
|
||||
new int[]{1},
|
||||
AchievementCategory.EVOLUTION),
|
||||
|
||||
EVOLUTION_STEALTH("Stealth Mastah", 1000,
|
||||
new String[]{"Evolution.Stealth"},
|
||||
new String[]{"Win without taking any", "damage while evolving"},
|
||||
new int[1],
|
||||
AchievementCategory.EVOLUTION),
|
||||
|
||||
EVOLUTION_RAMPAGE("Rampage", 800,
|
||||
new String[]{"Evolution.Rampage"},
|
||||
new String[]{"Get 3 kills within 5 seconds", "of each other"},
|
||||
new int[1],
|
||||
AchievementCategory.EVOLUTION),
|
||||
|
||||
EVOLUTION_MELEE("Melee Monster", 1000,
|
||||
new String[]{"Evolution.MeleeOnly"},
|
||||
new String[]{"Win without using any abilities"},
|
||||
new int[1],
|
||||
AchievementCategory.EVOLUTION),
|
||||
|
||||
EVOLUTION_SKILLS("Ability Assassin", 1000,
|
||||
new String[]{"Evolution.AbilityOnly"},
|
||||
new String[]{"Win without any melee attacks"},
|
||||
new int[1],
|
||||
AchievementCategory.EVOLUTION),
|
||||
|
||||
EVOLUTION_EVOLVEKILL("No Evolve 5 U", 800,
|
||||
new String[]{"Evolution.EvolveKill"},
|
||||
new String[]{"Kill 25 people while they", "Are trying to evolve"},
|
||||
new int[]{25},
|
||||
AchievementCategory.EVOLUTION)
|
||||
|
||||
;
|
||||
|
||||
|
@ -2,9 +2,6 @@ package mineplex.core.achievement;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.C;
|
||||
@ -12,6 +9,9 @@ import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.stats.PlayerStats;
|
||||
import mineplex.core.stats.StatsManager;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public enum AchievementCategory
|
||||
{
|
||||
GLOBAL("Global", null,
|
||||
@ -123,7 +123,11 @@ public enum AchievementCategory
|
||||
|
||||
BOMB_LOBBERS("Bomb Lobbers", null,
|
||||
new StatDisplay[] { StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED },
|
||||
Material.FIREBALL, 0, GameCategory.ARCADE, "Waller Kit");
|
||||
Material.FIREBALL, 0, GameCategory.ARCADE, "Waller Kit"),
|
||||
|
||||
EVOLUTION("Evolution", null,
|
||||
new StatDisplay[] {StatDisplay.WINS, StatDisplay.GAMES_PLAYED, StatDisplay.KILLS, StatDisplay.DEATHS, StatDisplay.GEMS_EARNED},
|
||||
Material.MONSTER_EGG, 0, GameCategory.ARCADE, "Harvester Kit");
|
||||
|
||||
private String _name;
|
||||
private String[] _statsToPull;
|
||||
|
@ -308,9 +308,10 @@ public class ItemBuilder
|
||||
return this;
|
||||
}
|
||||
|
||||
public void setData(short newData)
|
||||
public ItemBuilder setData(short newData)
|
||||
{
|
||||
this._data = newData;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ItemBuilder setPotion(Potion potion)
|
||||
|
@ -712,6 +712,9 @@ public class ServerManager extends MiniPlugin
|
||||
System.out.println("ServerManager - Error parsing servergroups : " + e.getMessage());
|
||||
}
|
||||
|
||||
// AddServerNpc("Event Servers", "EVENT");
|
||||
// AddServerNpc("Mineplex Player Servers", "MPS");
|
||||
|
||||
ServerGroup eventGroup = new ServerGroup("Event", "Event Servers", "EVENT");
|
||||
ServerGroup mpsGroup = new ServerGroup("MPS", "Mineplex Player Servers", "MPS");
|
||||
|
||||
|
@ -4,19 +4,19 @@ import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.minecraft.game.core.condition.ConditionManager;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
|
||||
import mineplex.minecraft.game.core.condition.ConditionManager;
|
||||
import mineplex.minecraft.game.core.damage.DamageManager;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.EntityEffect;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Item;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -25,12 +25,8 @@ import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.inventory.InventoryPickupItemEvent;
|
||||
import org.bukkit.event.player.PlayerPickupItemEvent;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.metadata.FixedMetadataValue;
|
||||
import org.bukkit.metadata.MetadataValue;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
||||
|
||||
public class Fire extends MiniPlugin
|
||||
{
|
||||
@ -46,9 +42,9 @@ public class Fire extends MiniPlugin
|
||||
_damageManager = damageManager;
|
||||
}
|
||||
|
||||
public void Add(Item item, LivingEntity owner, double expireTime, double delayTime, double burnTime, int damage, String skillName)
|
||||
public void Add(Item item, LivingEntity owner, double expireTime, double delayTime, double burnTime, double d, String skillName)
|
||||
{
|
||||
_fire.put(item, new FireData(owner, expireTime, delayTime, burnTime, damage, skillName));
|
||||
_fire.put(item, new FireData(owner, expireTime, delayTime, burnTime, d, skillName));
|
||||
item.setPickupDelay(0);
|
||||
}
|
||||
|
||||
|
@ -8,10 +8,10 @@ public class FireData
|
||||
private long _expireTime;
|
||||
private long _delayTime;
|
||||
private double _burnTime;
|
||||
private int _damage;
|
||||
private double _damage;
|
||||
private String _skillName;
|
||||
|
||||
public FireData(LivingEntity owner, double expireTime, double delayTime, double burnTime, int damage, String skillName)
|
||||
public FireData(LivingEntity owner, double expireTime, double delayTime, double burnTime, double damage, String skillName)
|
||||
{
|
||||
_owner = owner;
|
||||
_expireTime = System.currentTimeMillis() + (long)(1000 * expireTime);
|
||||
@ -31,7 +31,7 @@ public class FireData
|
||||
return _burnTime;
|
||||
}
|
||||
|
||||
public int GetDamage()
|
||||
public double GetDamage()
|
||||
{
|
||||
return _damage;
|
||||
}
|
||||
|
@ -106,9 +106,9 @@ import mineplex.minecraft.game.core.IRelation;
|
||||
import mineplex.minecraft.game.core.condition.ConditionManager;
|
||||
import mineplex.minecraft.game.core.damage.DamageManager;
|
||||
import mineplex.minecraft.game.core.fire.Fire;
|
||||
import nautilus.game.arcade.addons.CompassAddon;
|
||||
import nautilus.game.arcade.addons.SoupAddon;
|
||||
import nautilus.game.arcade.addons.TeamArmorAddon;
|
||||
import nautilus.game.arcade.addons.compass.CompassAddon;
|
||||
import nautilus.game.arcade.command.DisguiseCommand;
|
||||
import nautilus.game.arcade.command.GameCommand;
|
||||
import nautilus.game.arcade.command.WriteCommand;
|
||||
|
@ -1,21 +1,7 @@
|
||||
package nautilus.game.arcade.addons;
|
||||
package nautilus.game.arcade.addons.compass;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.player.PlayerDropItemEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
@ -34,6 +20,18 @@ import nautilus.game.arcade.game.Game;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.gui.spectatorMenu.SpectatorShop;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.block.Action;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
import org.bukkit.event.player.PlayerDropItemEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
public class CompassAddon extends MiniPlugin
|
||||
{
|
||||
public ArcadeManager Manager;
|
||||
@ -87,6 +85,12 @@ public class CompassAddon extends MiniPlugin
|
||||
|
||||
if (target == null || dist < bestDist)
|
||||
{
|
||||
CompassAttemptTargetEvent tE = new CompassAttemptTargetEvent(player, other);
|
||||
Bukkit.getServer().getPluginManager().callEvent(tE);
|
||||
|
||||
if (tE.isCancelled())
|
||||
continue;
|
||||
|
||||
target = other;
|
||||
targetTeam = otherTeam;
|
||||
bestDist = dist;
|
@ -0,0 +1,49 @@
|
||||
package nautilus.game.arcade.addons.compass;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.player.PlayerEvent;
|
||||
|
||||
public class CompassAttemptTargetEvent extends PlayerEvent implements Cancellable
|
||||
{
|
||||
private static HandlerList _handlers = new HandlerList();
|
||||
private boolean _cancelled = false;
|
||||
|
||||
private Player _target;
|
||||
|
||||
public CompassAttemptTargetEvent(Player player, Player target)
|
||||
{
|
||||
super(player);
|
||||
|
||||
_target = target;
|
||||
}
|
||||
|
||||
public Player getTarget()
|
||||
{
|
||||
return _target;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList()
|
||||
{
|
||||
return _handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers()
|
||||
{
|
||||
return getHandlerList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled()
|
||||
{
|
||||
return _cancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancelled)
|
||||
{
|
||||
_cancelled = cancelled;
|
||||
}
|
||||
}
|
@ -263,14 +263,21 @@ public abstract class Game implements Listener
|
||||
public boolean GiveClock = true;
|
||||
|
||||
public boolean AllowParticles = true;
|
||||
|
||||
|
||||
public long PrepareTime = 9000;
|
||||
public boolean PlaySoundGameStart = true;
|
||||
|
||||
//Gems
|
||||
public double GemMultiplier = 1;
|
||||
public boolean GemHunterEnabled = true;
|
||||
public boolean GemBoosterEnabled = true;
|
||||
public boolean GemDoubleEnabled = true;
|
||||
|
||||
public double GemKillDeathRespawn = .5;
|
||||
public double GemAssistDeathRespawn = .5;
|
||||
|
||||
public long PrepareTime = 9000;
|
||||
public boolean PlaySoundGameStart = true;
|
||||
public double GemKillDeathOut = 4;
|
||||
public double GemAssistDeathOut = 1;
|
||||
|
||||
//Gameplay Data
|
||||
public HashMap<Location, Player> PrivateBlockMap = new HashMap<Location, Player>();
|
||||
@ -719,18 +726,27 @@ public abstract class Game implements Listener
|
||||
|
||||
public double GetKillsGems(Player killer, Player killed, boolean assist)
|
||||
{
|
||||
if (!DeathOut)
|
||||
if (DeathOut)
|
||||
{
|
||||
return 0.5;
|
||||
}
|
||||
|
||||
if (!assist)
|
||||
{
|
||||
return 4;
|
||||
if (!assist)
|
||||
{
|
||||
return GemKillDeathOut;
|
||||
}
|
||||
else
|
||||
{
|
||||
return GemAssistDeathOut;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return 1;
|
||||
if (!assist)
|
||||
{
|
||||
return GemKillDeathRespawn;
|
||||
}
|
||||
else
|
||||
{
|
||||
return GemAssistDeathRespawn;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,193 @@
|
||||
package nautilus.game.arcade.game.games.evolution;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilSkull;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.ArcadeFormat;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.kit.KitAvailability;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.EntityType;
|
||||
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.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.SkullMeta;
|
||||
|
||||
public abstract class EvoKit extends Kit
|
||||
{
|
||||
/**
|
||||
* @author Mysticate
|
||||
*/
|
||||
|
||||
private EntityType _entity;
|
||||
|
||||
protected final double _health;
|
||||
protected final double _damage;
|
||||
|
||||
public EvoKit(ArcadeManager manager, String name, String[] desc, double health, double damage, Perk[] kitPerks, EntityType type)
|
||||
{
|
||||
this(manager, name, desc, health, damage, kitPerks, type, false);
|
||||
}
|
||||
|
||||
public EvoKit(ArcadeManager manager, String name, String[] desc, double health, double damage, Perk[] kitPerks, EntityType type, boolean visible)
|
||||
{
|
||||
super(manager, name, visible ? KitAvailability.Free : KitAvailability.Hide, 0, desc, kitPerks, type, null);
|
||||
|
||||
_entity = type;
|
||||
|
||||
_health = health;
|
||||
_damage = damage;
|
||||
}
|
||||
|
||||
public EntityType getEntity()
|
||||
{
|
||||
return _entity;
|
||||
}
|
||||
|
||||
public double getHealth()
|
||||
{
|
||||
return _health;
|
||||
}
|
||||
|
||||
public double getDamage()
|
||||
{
|
||||
return _damage;
|
||||
}
|
||||
|
||||
public String[] buildHologram()
|
||||
{
|
||||
ArrayList<String> text = new ArrayList<String>();
|
||||
|
||||
text.add(C.cAqua + C.Bold + GetName());
|
||||
text.add(C.cYellow + "Melee: " + C.cWhite + _damage + " " + C.cYellow + "Health: " + C.cWhite + _health);
|
||||
|
||||
if (GetDesc().length > 0)
|
||||
{
|
||||
text.add(C.Line);
|
||||
|
||||
for (String desc : GetDesc())
|
||||
text.add(desc);
|
||||
}
|
||||
|
||||
return text.toArray(new String[0]);
|
||||
}
|
||||
|
||||
@Override
|
||||
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());
|
||||
|
||||
UtilPlayer.message(player, C.Line);
|
||||
|
||||
UtilPlayer.message(player, C.cYellow + " Melee: " + C.cWhite + _damage + " " + C.cYellow + "Health: " + C.cWhite + _health);
|
||||
|
||||
UtilPlayer.message(player, C.Line);
|
||||
|
||||
for (String desc : GetDesc())
|
||||
UtilPlayer.message(player, C.cGray + " " + desc);
|
||||
|
||||
UtilPlayer.message(player, ArcadeFormat.Line);
|
||||
|
||||
}
|
||||
|
||||
public void upgradeGive(Player player)
|
||||
{
|
||||
String def = C.cWhite + C.Bold + "You evolved into " + ("aeiou".indexOf(GetName().toLowerCase().substring(0, 1)) == -1 ? "a " : "an ") + F.elem(C.cGreen + C.Bold + GetName());
|
||||
|
||||
player.playSound(player.getLocation(), Sound.LEVEL_UP, 1.0F, 0.1F);
|
||||
|
||||
for (int i=0 ; i<3 ; i++)
|
||||
UtilPlayer.message(player, "");
|
||||
|
||||
UtilPlayer.message(player, ArcadeFormat.Line);
|
||||
UtilPlayer.message(player, def);
|
||||
|
||||
UtilPlayer.message(player, C.Line);
|
||||
|
||||
UtilPlayer.message(player, C.cYellow + " Melee: " + C.cWhite + _damage + " " + C.cYellow + "Health: " + C.cWhite + _health);
|
||||
|
||||
UtilPlayer.message(player, C.Line);
|
||||
|
||||
for (String desc : GetDesc())
|
||||
UtilPlayer.message(player, C.cGray + " " + desc);
|
||||
|
||||
UtilPlayer.message(player, ArcadeFormat.Line);
|
||||
|
||||
// UtilTextMiddle.display(null, def, player);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void onDamage(CustomDamageEvent event)
|
||||
{
|
||||
if (event.GetCause() != DamageCause.ENTITY_ATTACK)
|
||||
return;
|
||||
|
||||
Player damager = event.GetDamagerPlayer(false);
|
||||
if (damager == null) return;
|
||||
|
||||
if (!HasKit(damager))
|
||||
return;
|
||||
|
||||
if (!Manager.IsAlive(damager))
|
||||
return;
|
||||
|
||||
double mod = _damage - event.GetDamageInitial();
|
||||
|
||||
event.AddMod(damager.getName(), "Attack", mod, true);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public final void GiveItems(final Player player)
|
||||
{
|
||||
player.setMaxHealth(_health);
|
||||
player.setHealth(player.getMaxHealth());
|
||||
player.getInventory().setHeldItemSlot(0);
|
||||
|
||||
player.setLevel(0);
|
||||
player.setExp(0F);
|
||||
|
||||
if (UtilSkull.isPlayerHead(UtilSkull.getSkullData(getEntity())))
|
||||
{
|
||||
|
||||
final ItemStack skull = ItemStackFactory.Instance.CreateStack(Material.SKULL_ITEM.getId(), (byte) 3, 1, C.cGreen + C.Bold + GetName());
|
||||
SkullMeta meta = (SkullMeta) skull.getItemMeta();
|
||||
meta.setOwner(UtilSkull.getPlayerHeadName(getEntity()));
|
||||
skull.setItemMeta(meta);
|
||||
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(Manager.getPlugin(), new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
player.getInventory().setItem(8, skull);
|
||||
}
|
||||
}, 4);
|
||||
}
|
||||
else
|
||||
{
|
||||
player.getInventory().setItem(8, ItemStackFactory.Instance.CreateStack(Material.SKULL_ITEM.getId(), (byte) UtilSkull.getSkullData(getEntity()), 1, C.cGreen + C.Bold + GetName()));
|
||||
}
|
||||
|
||||
giveItems(player);
|
||||
}
|
||||
|
||||
protected abstract void giveItems(Player player);
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
package nautilus.game.arcade.game.games.evolution;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class EvoScore
|
||||
{
|
||||
public org.bukkit.entity.Player Player;
|
||||
public int Kills;
|
||||
|
||||
public EvoScore(Player player, int i)
|
||||
{
|
||||
Player = player;
|
||||
Kills = i;
|
||||
}
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package nautilus.game.arcade.game.games.evolution;
|
||||
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class EvoToken implements Comparable<EvoToken>
|
||||
{
|
||||
/**
|
||||
* @author Mysticate
|
||||
*/
|
||||
|
||||
public final Player Player;
|
||||
|
||||
public final Kit SupplementKit;
|
||||
|
||||
public int Level = 0;
|
||||
public int LifeKills = 0;
|
||||
|
||||
public EvoToken(Player player, Kit kit)
|
||||
{
|
||||
Player = player;
|
||||
SupplementKit = kit;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(EvoToken o)
|
||||
{
|
||||
if (Level == o.Level)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if (Level > o.Level)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
}
|
@ -1,293 +1,806 @@
|
||||
package nautilus.game.arcade.game.games.evolution;
|
||||
|
||||
import java.util.AbstractMap.SimpleEntry;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.FireworkEffect.Type;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.scoreboard.DisplaySlot;
|
||||
import org.bukkit.scoreboard.Objective;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilFirework;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilEvent;
|
||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTextMiddle;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.core.combat.CombatComponent;
|
||||
import mineplex.minecraft.game.core.combat.DeathMessageType;
|
||||
import mineplex.minecraft.game.core.combat.CombatManager.AttackReason;
|
||||
import mineplex.minecraft.game.core.combat.DeathMessageType;
|
||||
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
|
||||
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
|
||||
import mineplex.minecraft.game.core.condition.ConditionActive;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.game.Game;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.SoloGame;
|
||||
import nautilus.game.arcade.game.games.evolution.kits.*;
|
||||
import nautilus.game.arcade.game.games.evolution.mobs.*;
|
||||
import nautilus.game.arcade.game.games.evolution.events.EvolutionAbilityUseEvent;
|
||||
import nautilus.game.arcade.game.games.evolution.events.EvolutionAttemptingTickEvent;
|
||||
import nautilus.game.arcade.game.games.evolution.events.EvolutionBeginEvent;
|
||||
import nautilus.game.arcade.game.games.evolution.events.EvolutionEndEvent;
|
||||
import nautilus.game.arcade.game.games.evolution.events.EvolutionPostEvolveEvent;
|
||||
import nautilus.game.arcade.game.games.evolution.evolve.EvolveManager;
|
||||
import nautilus.game.arcade.game.games.evolution.kits.KitAbility;
|
||||
import nautilus.game.arcade.game.games.evolution.kits.KitEvolveSpeed;
|
||||
import nautilus.game.arcade.game.games.evolution.kits.KitHealth;
|
||||
import nautilus.game.arcade.game.games.evolution.mobs.KitBlaze;
|
||||
import nautilus.game.arcade.game.games.evolution.mobs.KitChicken;
|
||||
import nautilus.game.arcade.game.games.evolution.mobs.KitCreeper;
|
||||
import nautilus.game.arcade.game.games.evolution.mobs.KitGolem;
|
||||
import nautilus.game.arcade.game.games.evolution.mobs.KitSlime;
|
||||
import nautilus.game.arcade.game.games.evolution.mobs.KitSpider;
|
||||
import nautilus.game.arcade.game.games.evolution.trackers.EvoWinWithoutDyingTracker;
|
||||
import nautilus.game.arcade.game.games.evolution.trackers.KillsWhileEvolvingTracker;
|
||||
import nautilus.game.arcade.game.games.evolution.trackers.NoAbilityTracker;
|
||||
import nautilus.game.arcade.game.games.evolution.trackers.NoDamageWhileEvolvingTracker;
|
||||
import nautilus.game.arcade.game.games.evolution.trackers.NoMeleeTracker;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.stats.KillFastStatTracker;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.entity.EntityCombustEvent;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.event.player.PlayerItemHeldEvent;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class Evolution extends SoloGame
|
||||
{
|
||||
private ArrayList<EvoScore> _ranks = new ArrayList<EvoScore>();
|
||||
private ArrayList<String> _lastScoreboard = new ArrayList<String>();
|
||||
|
||||
private HashMap<Player, Kit> _bonusKit = new HashMap<Player, Kit>();
|
||||
|
||||
private Objective _scoreObj;
|
||||
/**
|
||||
* @author Mysticate
|
||||
* Reworked from Original Code.
|
||||
*/
|
||||
|
||||
private EvolveManager _evolve;
|
||||
|
||||
private ArrayList<EvoKit> _mobKits = new ArrayList<EvoKit>();
|
||||
private ArrayList<Kit> _kits = new ArrayList<Kit>();
|
||||
|
||||
private NautHashMap<String, EvoToken> _tokens = new NautHashMap<String, EvoToken>();
|
||||
|
||||
private NautHashMap<Location, SimpleEntry<Location, Location>> _evoPlatforms = new NautHashMap<Location, SimpleEntry<Location, Location>>();
|
||||
private ArrayList<Location> _spawns = new ArrayList<Location>();
|
||||
|
||||
private ArrayList<Player> _evolutionsAvailable = new ArrayList<Player>();
|
||||
private NautHashMap<String, Float> _chargingExp = new NautHashMap<String, Float>();
|
||||
|
||||
public Player Winner = null;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public Evolution(ArcadeManager manager)
|
||||
{
|
||||
super(manager, GameType.Evolution,
|
||||
super(manager, GameType.Evolution, new EvoKit[0], new String[0]);
|
||||
//
|
||||
// //Custom kit stuff to make other things easiet
|
||||
_mobKits.add(new KitGolem(manager));
|
||||
_mobKits.add(new KitBlaze(manager));
|
||||
_mobKits.add(new KitSpider(manager));
|
||||
_mobKits.add(new KitCreeper(manager));
|
||||
_mobKits.add(new KitSlime(manager));
|
||||
// _mobKits.add(new KitEnderman(manager));
|
||||
// _mobKits.add(new KitSnowman(manager));
|
||||
// _mobKits.add(new KitWolf(manager));
|
||||
_mobKits.add(new KitChicken(manager));
|
||||
// _mobKits.add(new KitSkeleton(manager));
|
||||
|
||||
_kits.add(new KitAbility(Manager));
|
||||
_kits.add(new KitEvolveSpeed(Manager));
|
||||
_kits.add(new KitHealth(Manager));
|
||||
|
||||
ArrayList<Kit> allKits = new ArrayList<Kit>();
|
||||
allKits.addAll(_mobKits);
|
||||
allKits.addAll(_kits);
|
||||
|
||||
setKits(allKits.toArray(new Kit[0]));
|
||||
|
||||
new Kit[]
|
||||
{
|
||||
new KitHealth(manager),
|
||||
new KitAgility(manager),
|
||||
new KitRecharge(manager),
|
||||
|
||||
new KitGolem(manager), //Iron
|
||||
new KitBlaze(manager), //Chainmail
|
||||
new KitSlime(manager), //Chainmail
|
||||
new KitCreeper(manager), //None
|
||||
new KitEnderman(manager), //Chainmail
|
||||
new KitSkeleton(manager), //Leather
|
||||
new KitSpider(manager), //Chainmail
|
||||
new KitSnowman(manager), //Leather
|
||||
new KitWolf(manager), //Leather
|
||||
new KitChicken(manager),
|
||||
|
||||
},
|
||||
|
||||
new String[]
|
||||
{
|
||||
"You evolve when you get a kill.",
|
||||
_gameDesc = new String[]
|
||||
{
|
||||
"You can evolve every kill.",
|
||||
"Each evolution has unique skills.",
|
||||
"",
|
||||
"First to get through 10 evolutions wins!"
|
||||
});
|
||||
"First to get through " + _mobKits.size() + " evolutions wins!"
|
||||
};
|
||||
|
||||
DamageTeamSelf = true;
|
||||
|
||||
HungerSet = 20;
|
||||
|
||||
DeathOut = false;
|
||||
|
||||
PrepareFreeze = false;
|
||||
|
||||
GemKillDeathRespawn = 2;
|
||||
GemAssistDeathRespawn = .5;
|
||||
|
||||
this.DamageTeamSelf = true;
|
||||
CompassEnabled = true;
|
||||
CompassGiveItem = false;
|
||||
|
||||
this.HungerSet = 20;
|
||||
AutomaticRespawn = false;
|
||||
DeathSpectateSecs = 4.0;
|
||||
|
||||
this.DeathOut = false;
|
||||
VersionRequire1_8 = true;
|
||||
|
||||
this.PrepareFreeze = false;
|
||||
CreatureAllow = false;
|
||||
InventoryClick = false;
|
||||
|
||||
_scoreObj = Scoreboard.GetScoreboard().registerNewObjective("Evolutions", "dummy");
|
||||
_scoreObj.setDisplaySlot(DisplaySlot.BELOW_NAME);
|
||||
InventoryOpenBlock = false;
|
||||
|
||||
Manager.GetDamage().GetCombatManager().setUseWeaponName(AttackReason.Attack);
|
||||
|
||||
registerStatTrackers(
|
||||
new EvoWinWithoutDyingTracker(this),
|
||||
new NoDamageWhileEvolvingTracker(this),
|
||||
new KillFastStatTracker(this, 3, 5, "Rampage"),
|
||||
new NoAbilityTracker(this),
|
||||
new NoMeleeTracker(this),
|
||||
new KillsWhileEvolvingTracker(this)
|
||||
);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void RegisterMobKits(GameStateChangeEvent event)
|
||||
public EvolveManager getEvolve()
|
||||
{
|
||||
if (event.GetState() != GameState.Live)
|
||||
return;
|
||||
return _evolve;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void ParseData()
|
||||
{
|
||||
for (Location platform : WorldData.GetDataLocs("RED"))
|
||||
{
|
||||
platform.getBlock().setType(Material.AIR);
|
||||
|
||||
for (Location viewing : WorldData.GetDataLocs("GREEN"))
|
||||
{
|
||||
viewing.getBlock().setType(Material.AIR);
|
||||
|
||||
Iterator<Location> iS = WorldData.GetDataLocs("YELLOW").iterator();
|
||||
while (iS.hasNext())
|
||||
{
|
||||
Location store = iS.next();
|
||||
|
||||
store.getBlock().setType(Material.AIR);
|
||||
|
||||
if (UtilMath.offset(store, platform) > 8 || UtilMath.offset(platform, viewing) > 8)
|
||||
continue;
|
||||
|
||||
iS.remove();
|
||||
_evoPlatforms.put(platform, new SimpleEntry<Location, Location>(loadAngle(platform, viewing), store));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (GameTeam team : GetTeamList())
|
||||
{
|
||||
_spawns.addAll(team.GetSpawns());
|
||||
}
|
||||
}
|
||||
|
||||
private Location loadAngle(Location platform, Location viewing)
|
||||
{
|
||||
Vector b = UtilAlg.getTrajectory(viewing, platform.clone().subtract(0, 1.1, 0)).normalize();
|
||||
|
||||
viewing.setPitch(UtilAlg.GetPitch(b));
|
||||
viewing.setYaw(UtilAlg.GetYaw(b));
|
||||
|
||||
return viewing;
|
||||
}
|
||||
|
||||
//Double Kit
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void StoreBonusKits(GameStateChangeEvent event)
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void storeTokens(GameStateChangeEvent event)
|
||||
{
|
||||
if (event.GetState() != GameState.Live)
|
||||
if (event.GetState() != GameState.Prepare)
|
||||
return;
|
||||
|
||||
for (Player player : GetPlayers(true))
|
||||
{
|
||||
_bonusKit.put(player, GetKit(player));
|
||||
UpgradeKit(player, true);
|
||||
_tokens.put(player.getName(), new EvoToken(player, GetKit(player) == null ? _kits.get(0) : GetKit(player)));
|
||||
|
||||
upgradeKit(player, false);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void setKit(GameStateChangeEvent event)
|
||||
{
|
||||
if (event.GetState() != GameState.Prepare)
|
||||
return;
|
||||
|
||||
for (Player player : GetPlayers(true))
|
||||
{
|
||||
if (GetKit(player) != null)
|
||||
continue;
|
||||
|
||||
this.SetKit(player, GetKits()[0], false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void showKit(GameStateChangeEvent event)
|
||||
{
|
||||
if (event.GetState() != GameState.Live)
|
||||
return;
|
||||
|
||||
for (Player player : GetPlayers(true))
|
||||
{
|
||||
Kit kit = GetKit(player);
|
||||
|
||||
if (!(kit instanceof EvoKit))
|
||||
continue;
|
||||
|
||||
((EvoKit) kit).upgradeGive(player);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void endNoEvolve(GameStateChangeEvent event)
|
||||
{
|
||||
if (event.GetState() != GameState.Live)
|
||||
return;
|
||||
|
||||
if (_evoPlatforms.size() <= 0)
|
||||
{
|
||||
Announce(C.cWhite + C.Bold + GetName() + " ended, map not set up properly!");
|
||||
SetState(GameState.Dead);
|
||||
return;
|
||||
}
|
||||
|
||||
_evolve = new EvolveManager(this, _evoPlatforms);
|
||||
}
|
||||
|
||||
public void upgradeKit(Player player, boolean give)
|
||||
{
|
||||
if (!IsAlive(player))
|
||||
return;
|
||||
|
||||
EvoKit newKit = _mobKits.get(getScore(player));
|
||||
|
||||
_tokens.get(player.getName()).SupplementKit.ApplyKit(player);
|
||||
SetKit(player, newKit, false);
|
||||
|
||||
if (give)
|
||||
{
|
||||
newKit.upgradeGive(player);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean HasKit(Player player, Kit kit)
|
||||
{
|
||||
if (GetKit(player) == null)
|
||||
return false;
|
||||
|
||||
if (GetKit(player).equals(kit))
|
||||
if (super.HasKit(player, kit))
|
||||
return true;
|
||||
|
||||
if (!_tokens.containsKey(player.getName()))
|
||||
return false;
|
||||
|
||||
return _tokens.get(player.getName()).SupplementKit.equals(kit);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void startEvolve(EvolutionBeginEvent event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
|
||||
Recharge.Instance.Get(player).clear();
|
||||
|
||||
player.setSprinting(false);
|
||||
player.setSneaking(false);
|
||||
|
||||
//Bonus Kit
|
||||
if (_bonusKit.containsKey(player))
|
||||
if (_bonusKit.get(player).equals(kit))
|
||||
return true;
|
||||
player.setHealth(player.getMaxHealth());
|
||||
|
||||
return false;
|
||||
player.setFireTicks(0);
|
||||
player.setFallDistance(0);
|
||||
|
||||
player.eject();
|
||||
player.leaveVehicle();
|
||||
|
||||
((CraftPlayer) player).getHandle().p(0);
|
||||
|
||||
//Freeze
|
||||
Manager.GetCondition().Factory().Cloak("Evolving", player, null, 10, false, false);
|
||||
|
||||
((Player) player).playSound(player.getLocation(), Sound.ORB_PICKUP, 1f, 1.25f);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void PlayerKillAward(CombatDeathEvent event)
|
||||
public void stopEvolve(EvolutionEndEvent event)
|
||||
{
|
||||
Game game = Manager.GetGame();
|
||||
if (game == null) return;
|
||||
if (Manager.GetCondition().GetActiveConditions().containsKey(event.getPlayer()))
|
||||
{
|
||||
for (ConditionActive cond : Manager.GetCondition().GetActiveConditions().get(event.getPlayer()))
|
||||
{
|
||||
if (cond.GetCondition().GetType() == ConditionType.CLOAK)
|
||||
continue;
|
||||
|
||||
cond.GetCondition().Expire();
|
||||
}
|
||||
}
|
||||
|
||||
if (increaseScore(event.getPlayer()) >= _mobKits.size())
|
||||
{
|
||||
ScoreboardUpdate(new UpdateEvent(UpdateType.FAST));
|
||||
|
||||
if (!(event.GetEvent().getEntity() instanceof Player))
|
||||
event.setCancelled(true);
|
||||
|
||||
End();
|
||||
}
|
||||
else
|
||||
{
|
||||
upgradeKit(event.getPlayer(), true);
|
||||
event.getPlayer().playSound(event.getPlayer().getLocation(), Sound.LEVEL_UP, 1, 0.6F);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void endEvolve(final EvolutionPostEvolveEvent event)
|
||||
{
|
||||
//Make sure they're not invis when they're done evolving
|
||||
while (Manager.GetCondition().IsCloaked(event.getPlayer()))
|
||||
{
|
||||
Manager.GetCondition().GetActiveCondition(event.getPlayer(), ConditionType.CLOAK).Expire();
|
||||
}
|
||||
|
||||
if (getScore(event.getPlayer()) >= _mobKits.size())
|
||||
{
|
||||
End();
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onDamage(CustomDamageEvent event)
|
||||
{
|
||||
if (!IsLive())
|
||||
return;
|
||||
|
||||
if (!IsAlive(event.GetDamageeEntity()))
|
||||
return;
|
||||
|
||||
if (!_chargingExp.containsKey(event.GetDamageePlayer().getName()))
|
||||
return;
|
||||
|
||||
_chargingExp.put(event.GetDamageePlayer().getName(), (float) Math.max(0, _chargingExp.get(event.GetDamageePlayer().getName()) * .92));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onDeath(PlayerDeathEvent event)
|
||||
{
|
||||
if (!IsLive())
|
||||
return;
|
||||
|
||||
if (!IsAlive(event.getEntity()))
|
||||
return;
|
||||
|
||||
if (_evolutionsAvailable.contains(event.getEntity()))
|
||||
{
|
||||
_evolutionsAvailable.remove(event.getEntity());
|
||||
}
|
||||
|
||||
if (_chargingExp.containsKey(event.getEntity().getName()))
|
||||
{
|
||||
_chargingExp.remove(event.getEntity().getName());
|
||||
}
|
||||
|
||||
if (hasEvolvingEffects(event.getEntity()))
|
||||
{
|
||||
removeEvolvingEffects(event.getEntity());
|
||||
}
|
||||
|
||||
if (_tokens.containsKey(event.getEntity().getName()))
|
||||
{
|
||||
_tokens.get(event.getEntity().getName()).LifeKills = 0;
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onKill(CombatDeathEvent event)
|
||||
{
|
||||
event.SetBroadcastType(DeathMessageType.Simple);
|
||||
|
||||
if (!IsLive())
|
||||
return;
|
||||
|
||||
if (event.GetLog().GetKiller() == null)
|
||||
CombatComponent damager = event.GetLog().GetKiller();
|
||||
if (damager == null)
|
||||
return;
|
||||
|
||||
if (!damager.IsPlayer())
|
||||
return;
|
||||
|
||||
final Player killer = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName());
|
||||
if (killer == null)
|
||||
Player player = UtilPlayer.searchExact(damager.GetName());
|
||||
|
||||
if (player == null || !player.isOnline())
|
||||
return;
|
||||
|
||||
if (killer.equals(event.GetEvent().getEntity()))
|
||||
if (!IsAlive(player))
|
||||
return;
|
||||
|
||||
if (UtilPlayer.isSpectator(player))
|
||||
return;
|
||||
|
||||
if (((Player) event.GetEvent().getEntity()) == player)
|
||||
return;
|
||||
|
||||
if (!_evolutionsAvailable.contains(player))
|
||||
{
|
||||
_evolutionsAvailable.add(player);
|
||||
|
||||
if (_chargingExp.containsKey(player.getName()))
|
||||
_chargingExp.remove(player.getName());
|
||||
}
|
||||
|
||||
if (_tokens.containsKey(player.getName()))
|
||||
{
|
||||
EvoToken token = _tokens.get(player.getName());
|
||||
token.LifeKills++;
|
||||
|
||||
UtilPlayer.message(player, "");
|
||||
UtilPlayer.message(player, F.main("Game", F.elem(token.LifeKills + " Kill" + (token.LifeKills == 1 ? "" : "s")) + C.cWhite + " - " + C.cGreen + Math.max(1.0, 6.0 - (1.5 * (token.LifeKills - 1))) + "s evolve speed" + (token.SupplementKit instanceof KitEvolveSpeed ? C.cGreen + " - 30% (Quick Evolver)" : "")));
|
||||
UtilPlayer.message(player, "");
|
||||
}
|
||||
|
||||
//Buffs
|
||||
Manager.GetCondition().Factory().Speed("Kill", player, null, 3, 0, true, false, false);
|
||||
UtilPlayer.health(player, player.getMaxHealth() / 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void RespawnPlayer(final Player player)
|
||||
{
|
||||
player.eject();
|
||||
player.teleport(getSpawn());
|
||||
|
||||
Manager.Clear(player);
|
||||
|
||||
//Re-Give Kit
|
||||
Manager.getPlugin().getServer().getScheduler().scheduleSyncDelayedTask(Manager.getPlugin(), new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
UpgradeKit(killer, false);
|
||||
{
|
||||
if (_tokens.containsKey(player.getName()))
|
||||
_tokens.get(player.getName()).SupplementKit.ApplyKit(player);
|
||||
|
||||
GetKit(player).ApplyKit(player);
|
||||
}
|
||||
}, 0);
|
||||
}
|
||||
|
||||
public void UpgradeKit(Player player, boolean first)
|
||||
|
||||
@EventHandler
|
||||
public void onEgg(PlayerInteractEvent event)
|
||||
{
|
||||
if (!Recharge.Instance.use(player, "Evolve", 500, false, false))
|
||||
if (!IsLive())
|
||||
return;
|
||||
|
||||
//Remove Old Recharges
|
||||
Recharge.Instance.Reset(player);
|
||||
Recharge.Instance.useForce(player, "Evolve", 500);
|
||||
if (!UtilEvent.isAction(event, ActionType.R_BLOCK) && !UtilEvent.isAction(event, ActionType.L_BLOCK))
|
||||
return;
|
||||
|
||||
Kit kit = GetKit(player);
|
||||
|
||||
for (int i=3 ; i<GetKits().length ; i++)
|
||||
if (event.getClickedBlock().getType() == Material.DRAGON_EGG)
|
||||
{
|
||||
if (kit.equals(GetKits()[i]) || first)
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void updateAvailableEvolutions(UpdateEvent event)
|
||||
{
|
||||
if (!IsLive())
|
||||
return;
|
||||
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
return;
|
||||
|
||||
Iterator<Player> iterator = _evolutionsAvailable.iterator();
|
||||
while (iterator.hasNext())
|
||||
{
|
||||
Player player = iterator.next();
|
||||
|
||||
if (player == null || !player.isOnline())
|
||||
{
|
||||
if (!first)
|
||||
i++;
|
||||
iterator.remove();
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!IsAlive(player))
|
||||
{
|
||||
iterator.remove();
|
||||
continue;
|
||||
}
|
||||
|
||||
if (i<GetKits().length)
|
||||
if (player.isSneaking())
|
||||
{
|
||||
if (player.getLocation().getBlock().isLiquid())
|
||||
{
|
||||
SetKit(player, GetKits()[i], false);
|
||||
|
||||
//Store Level
|
||||
SetScore(player, i-3);
|
||||
|
||||
//Apply
|
||||
GetKits()[i].ApplyKit(player);
|
||||
|
||||
//Firework
|
||||
UtilFirework.playFirework(player.getEyeLocation(), Type.BALL, Color.LIME, false, false);
|
||||
|
||||
//Teleport
|
||||
player.teleport(GetTeam(player).GetSpawn());
|
||||
|
||||
return;
|
||||
if (Recharge.Instance.use(player, "No Evolve Water Message", 2000, false, false))
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Game", "You cannot evolve in water!"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
End();
|
||||
return;
|
||||
if (onEvolveAttempting(player))
|
||||
{
|
||||
iterator.remove();
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void SetScore(Player player, int level)
|
||||
{
|
||||
_scoreObj.getScore(player).setScore(level);
|
||||
|
||||
//Rank
|
||||
for (EvoScore score : _ranks)
|
||||
{
|
||||
if (score.Player.equals(player))
|
||||
if (_chargingExp.containsKey(player.getName()))
|
||||
_chargingExp.remove(player.getName());
|
||||
|
||||
if (hasEvolvingEffects(player))
|
||||
removeEvolvingEffects(player);
|
||||
|
||||
if (Recharge.Instance.use(player, "Evolve Available", 2000, false, false))
|
||||
{
|
||||
score.Kills = level;
|
||||
return;
|
||||
UtilTextMiddle.display("", C.cGreen + C.Bold + "Hold Crouch to Evolve", 0, 60, 20, player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isAttemptingEvolve(Player player)
|
||||
{
|
||||
return _chargingExp.containsKey(player.getName());
|
||||
}
|
||||
|
||||
//Boolean remove
|
||||
private boolean onEvolveAttempting(Player player)
|
||||
{
|
||||
if (!_chargingExp.containsKey(player.getName()))
|
||||
_chargingExp.put(player.getName(), 0F);
|
||||
|
||||
_ranks.add(new EvoScore(player, level));
|
||||
float exp = _chargingExp.get(player.getName());
|
||||
|
||||
if (exp >= .9999F)
|
||||
{
|
||||
|
||||
UtilTextMiddle.display("", "", player);
|
||||
|
||||
_chargingExp.remove(player.getName());
|
||||
|
||||
if (hasEvolvingEffects(player))
|
||||
removeEvolvingEffects(player);
|
||||
|
||||
EvoToken token = _tokens.get(player.getName());
|
||||
|
||||
token.LifeKills = 0;
|
||||
|
||||
EvoKit from = (EvoKit) _mobKits.get(token.Level);
|
||||
EvoKit to = (EvoKit) _mobKits.get(token.Level + 1 >= _mobKits.size() ? token.Level : token.Level + 1); //Account for the score increase after evolve
|
||||
|
||||
_evolve.addEvolve(Manager.getHologramManager(), player, from, to);
|
||||
|
||||
player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 1, 1);
|
||||
return true;
|
||||
}
|
||||
|
||||
Manager.GetCondition().EndCondition(player, ConditionType.SPEED, "Kill");
|
||||
|
||||
if (!hasEvolvingEffects(player))
|
||||
addEvolvingEffects(player);
|
||||
|
||||
int kills = _tokens.get(player.getName()).LifeKills;
|
||||
|
||||
if (UtilEnt.isGrounded(player) && player.getLocation().getBlock().getRelative(BlockFace.DOWN).getType() != Material.DRAGON_EGG)
|
||||
{
|
||||
EvolutionAttemptingTickEvent tickEvent = new EvolutionAttemptingTickEvent(player, (float) Math.min(.022, .012 + (kills <= 0 ? 0 : (.003 * (kills - 1)))));
|
||||
Bukkit.getPluginManager().callEvent(tickEvent);
|
||||
|
||||
_chargingExp.put(player.getName(), (float) Math.min(exp + tickEvent.getProgress(), .9999F));
|
||||
}
|
||||
|
||||
UtilTextMiddle.display("", UtilTextMiddle.progress(_chargingExp.get(player.getName())).trim(), player);
|
||||
player.playSound(player.getLocation(), Sound.NOTE_BASS, 1, _chargingExp.get(player.getName()) + 1);
|
||||
|
||||
UtilParticle.PlayParticle(ParticleType.HAPPY_VILLAGER, player.getLocation().clone().add(0, 1, 0), 0.4F, 0.56F, 0.4F, 0, 3, ViewDist.NORMAL, UtilServer.getPlayers());
|
||||
return false;
|
||||
}
|
||||
|
||||
private boolean hasEvolvingEffects(Player player)
|
||||
{
|
||||
if (!Manager.GetCondition().GetActiveConditions().containsKey(player))
|
||||
return false;
|
||||
|
||||
for (ConditionActive active : Manager.GetCondition().GetActiveConditions().get(player))
|
||||
{
|
||||
if (!active.GetCondition().GetReason().equalsIgnoreCase("Charging"))
|
||||
continue;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private void removeEvolvingEffects(Player player)
|
||||
{
|
||||
if (!Manager.GetCondition().GetActiveConditions().containsKey(player))
|
||||
return;
|
||||
|
||||
for (ConditionActive active : Manager.GetCondition().GetActiveConditions().get(player))
|
||||
{
|
||||
if (!active.GetCondition().GetReason().equalsIgnoreCase("Charging"))
|
||||
continue;
|
||||
|
||||
active.GetCondition().Expire();
|
||||
}
|
||||
}
|
||||
|
||||
private void addEvolvingEffects(Player player)
|
||||
{
|
||||
Manager.GetCondition().Factory().Jump("Charging", player, null, 20, 128, false, false, false);
|
||||
Manager.GetCondition().Factory().Slow("Charging", player, null, 20, 1, false, false, false, false);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onEvolveAttemptingAbility(EvolutionAbilityUseEvent event)
|
||||
{
|
||||
if (!IsLive())
|
||||
return;
|
||||
|
||||
if (_chargingExp.containsKey(event.getPlayer().getName()))
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
public int GetScore(Player player)
|
||||
private int increaseScore(Player player)
|
||||
{
|
||||
if (!IsAlive(player))
|
||||
return 0;
|
||||
|
||||
if (!_tokens.containsKey(player.getName()))
|
||||
return 0;
|
||||
|
||||
_tokens.get(player.getName()).Level++;
|
||||
return getScore(player);
|
||||
}
|
||||
|
||||
//Rank
|
||||
for (EvoScore score : _ranks)
|
||||
public int getScore(Player player)
|
||||
{
|
||||
if (!IsPlaying(player))
|
||||
return 0;
|
||||
|
||||
return _tokens.get(player.getName()).Level;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onSlot(PlayerItemHeldEvent event)
|
||||
{
|
||||
if (!Manager.GetGame().InProgress())
|
||||
return;
|
||||
|
||||
if (!IsAlive(event.getPlayer()))
|
||||
return;
|
||||
|
||||
if (UtilPlayer.isSpectator(event.getPlayer()))
|
||||
return;
|
||||
|
||||
if (event.getNewSlot() != 0)
|
||||
{
|
||||
if (score.Player.equals(player))
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
||||
public Location getSpawn()
|
||||
{
|
||||
ArrayList<Location> allPlayers = new ArrayList<Location>();
|
||||
|
||||
for (Player cur : GetPlayers(true))
|
||||
{
|
||||
if (UtilPlayer.isSpectator(cur))
|
||||
continue;
|
||||
|
||||
if (_evolve.isEvolving(cur))
|
||||
{
|
||||
return score.Kills;
|
||||
allPlayers.add(_evolve.getEvolve(cur).getEggLocation());
|
||||
}
|
||||
else
|
||||
{
|
||||
allPlayers.add(cur.getLocation());
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
return UtilAlg.getLocationAwayFromOtherLocations(_spawns, allPlayers);
|
||||
}
|
||||
|
||||
private void SortScores()
|
||||
|
||||
@EventHandler
|
||||
public void onCombust(EntityCombustEvent event)
|
||||
{
|
||||
for (int i=0 ; i<_ranks.size() ; i++)
|
||||
{
|
||||
for (int j=_ranks.size()-1 ; j>0 ; j--)
|
||||
{
|
||||
if (_ranks.get(j).Kills > _ranks.get(j-1).Kills)
|
||||
{
|
||||
EvoScore temp = _ranks.get(j);
|
||||
_ranks.set(j, _ranks.get(j-1));
|
||||
_ranks.set(j-1, temp);
|
||||
}
|
||||
}
|
||||
}
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
|
||||
private void End()
|
||||
{
|
||||
SortScores();
|
||||
ArrayList<EvoToken> tokens = new ArrayList<EvoToken>(_tokens.values());
|
||||
Collections.sort(tokens);
|
||||
|
||||
//Set Places
|
||||
ArrayList<Player> places = new ArrayList<Player>();
|
||||
for (int i=0 ; i<_ranks.size() ; i++)
|
||||
places.add(i, _ranks.get(i).Player);
|
||||
List<Player> players = new ArrayList<Player>();
|
||||
|
||||
for (int i = 0 ; i < tokens.size() ; i++)
|
||||
{
|
||||
players.add(tokens.get(i).Player);
|
||||
}
|
||||
|
||||
//Award Gems
|
||||
if (_ranks.size() >= 1)
|
||||
AddGems(_ranks.get(0).Player, 20, "1st Place", false, false);
|
||||
if (tokens.size() >= 1)
|
||||
AddGems(players.get(0), 20, "1st Place", false, false);
|
||||
|
||||
if (_ranks.size() >= 2)
|
||||
AddGems(_ranks.get(1).Player, 15, "2nd Place", false, false);
|
||||
if (tokens.size() >= 2)
|
||||
AddGems(players.get(1), 15, "2nd Place", false, false);
|
||||
|
||||
if (_ranks.size() >= 3)
|
||||
AddGems(_ranks.get(2).Player, 10, "3rd Place", false, false);
|
||||
if (tokens.size() >= 3)
|
||||
AddGems(players.get(2), 10, "3rd Place", false, false);
|
||||
|
||||
//Participation
|
||||
for (Player player : GetPlayers(false))
|
||||
if (player.isOnline())
|
||||
AddGems(player, 10, "Participation", false, false);
|
||||
|
||||
|
||||
if (players.size() >= 1)
|
||||
Winner = players.get(0);
|
||||
|
||||
_tokens.clear();
|
||||
_evoPlatforms.clear();
|
||||
_evolutionsAvailable.clear();
|
||||
|
||||
_evolve.end();
|
||||
|
||||
SetState(GameState.End);
|
||||
AnnounceEnd(places);
|
||||
AnnounceEnd(players);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void EndCheck()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@EventHandler
|
||||
public void ScoreboardUpdate(UpdateEvent event)
|
||||
{
|
||||
if (!InProgress())
|
||||
return;
|
||||
|
||||
if (event.getType() != UpdateType.FAST)
|
||||
return;
|
||||
|
||||
Scoreboard.Reset();
|
||||
|
||||
|
||||
Scoreboard.WriteBlank();
|
||||
|
||||
Scoreboard.Write(C.cYellow + C.Bold + "First to " + _mobKits.size());
|
||||
|
||||
Scoreboard.WriteBlank();
|
||||
|
||||
for (Player player : GetPlayers(true))
|
||||
{
|
||||
Scoreboard.WriteOrdered("Score", C.cGreen + player.getName(), GetScore(player), true);
|
||||
Scoreboard.WriteOrdered("Score", C.cGreen + player.getName(), getScore(player), true);
|
||||
}
|
||||
|
||||
|
||||
Scoreboard.Draw();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,66 @@
|
||||
package nautilus.game.arcade.game.games.evolution.events;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.player.PlayerEvent;
|
||||
|
||||
public class EvolutionAbilityUseEvent extends PlayerEvent implements Cancellable
|
||||
{
|
||||
/**
|
||||
* @author Mysticate
|
||||
*/
|
||||
|
||||
private static HandlerList _handlers = new HandlerList();
|
||||
|
||||
private boolean _cancelled = false;
|
||||
|
||||
private String _ability;
|
||||
private long _cooldown;
|
||||
|
||||
public EvolutionAbilityUseEvent(Player who, String ability, long cooldown)
|
||||
{
|
||||
super(who);
|
||||
|
||||
_ability = ability;
|
||||
_cooldown = cooldown;
|
||||
}
|
||||
|
||||
public String getAbility()
|
||||
{
|
||||
return _ability;
|
||||
}
|
||||
|
||||
public long getCooldown()
|
||||
{
|
||||
return _cooldown;
|
||||
}
|
||||
|
||||
public void setCooldown(long cooldown)
|
||||
{
|
||||
_cooldown = cooldown;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled()
|
||||
{
|
||||
return _cancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancelled)
|
||||
{
|
||||
_cancelled = cancelled;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList()
|
||||
{
|
||||
return _handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers()
|
||||
{
|
||||
return getHandlerList();
|
||||
}
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
package nautilus.game.arcade.game.games.evolution.events;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.player.PlayerEvent;
|
||||
|
||||
public class EvolutionAttemptingTickEvent extends PlayerEvent
|
||||
{
|
||||
/**
|
||||
* @author Mysticate
|
||||
*/
|
||||
|
||||
private static HandlerList _handlers = new HandlerList();
|
||||
|
||||
private static HandlerList getHandlerList()
|
||||
{
|
||||
return _handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers()
|
||||
{
|
||||
return getHandlerList();
|
||||
}
|
||||
|
||||
private float _progress;
|
||||
|
||||
public EvolutionAttemptingTickEvent(Player who, float progress)
|
||||
{
|
||||
super(who);
|
||||
|
||||
_progress = progress;
|
||||
}
|
||||
|
||||
public float getProgress()
|
||||
{
|
||||
return _progress;
|
||||
}
|
||||
|
||||
public void setProgress(float progress)
|
||||
{
|
||||
_progress = progress;
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package nautilus.game.arcade.game.games.evolution.events;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.player.PlayerEvent;
|
||||
|
||||
public class EvolutionBeginEvent extends PlayerEvent
|
||||
{
|
||||
/**
|
||||
* @author Mysticate
|
||||
*/
|
||||
|
||||
private static HandlerList _handlers = new HandlerList();
|
||||
|
||||
public EvolutionBeginEvent(Player who)
|
||||
{
|
||||
super(who);
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList()
|
||||
{
|
||||
return _handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers()
|
||||
{
|
||||
return getHandlerList();
|
||||
}
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
package nautilus.game.arcade.game.games.evolution.events;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.player.PlayerEvent;
|
||||
|
||||
public class EvolutionEndEvent extends PlayerEvent implements Cancellable
|
||||
{
|
||||
/**
|
||||
* @author Mysticate
|
||||
*/
|
||||
|
||||
private static HandlerList _handlers = new HandlerList();
|
||||
|
||||
private boolean _cancelled = false;
|
||||
|
||||
public EvolutionEndEvent(Player who)
|
||||
{
|
||||
super(who);
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList()
|
||||
{
|
||||
return _handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers()
|
||||
{
|
||||
return getHandlerList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled()
|
||||
{
|
||||
return _cancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean flag)
|
||||
{
|
||||
_cancelled = flag;
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package nautilus.game.arcade.game.games.evolution.events;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.player.PlayerEvent;
|
||||
|
||||
public class EvolutionPostEvolveEvent extends PlayerEvent
|
||||
{
|
||||
/**
|
||||
* @author Mysticate
|
||||
*/
|
||||
|
||||
private static HandlerList _handlers = new HandlerList();
|
||||
|
||||
public EvolutionPostEvolveEvent(Player who)
|
||||
{
|
||||
super(who);
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList()
|
||||
{
|
||||
return _handlers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public HandlerList getHandlers()
|
||||
{
|
||||
return getHandlerList();
|
||||
}
|
||||
}
|
@ -0,0 +1,422 @@
|
||||
package nautilus.game.arcade.game.games.evolution.evolve;
|
||||
|
||||
import java.util.AbstractMap.SimpleEntry;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.MapUtil;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilFirework;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.hologram.Hologram;
|
||||
import mineplex.core.hologram.Hologram.HologramTarget;
|
||||
import mineplex.core.hologram.HologramManager;
|
||||
import nautilus.game.arcade.game.games.evolution.EvoKit;
|
||||
import nautilus.game.arcade.game.games.evolution.events.EvolutionBeginEvent;
|
||||
import nautilus.game.arcade.game.games.evolution.events.EvolutionEndEvent;
|
||||
import nautilus.game.arcade.game.games.evolution.events.EvolutionPostEvolveEvent;
|
||||
import net.minecraft.server.v1_7_R4.EntityBlaze;
|
||||
import net.minecraft.server.v1_7_R4.EntityChicken;
|
||||
import net.minecraft.server.v1_7_R4.EntityCreeper;
|
||||
import net.minecraft.server.v1_7_R4.EntityEnderman;
|
||||
import net.minecraft.server.v1_7_R4.EntityInsentient;
|
||||
import net.minecraft.server.v1_7_R4.EntityIronGolem;
|
||||
import net.minecraft.server.v1_7_R4.EntitySkeleton;
|
||||
import net.minecraft.server.v1_7_R4.EntitySlime;
|
||||
import net.minecraft.server.v1_7_R4.EntitySnowman;
|
||||
import net.minecraft.server.v1_7_R4.EntitySpider;
|
||||
import net.minecraft.server.v1_7_R4.EntityWolf;
|
||||
import net.minecraft.server.v1_7_R4.EntityZombie;
|
||||
import net.minecraft.server.v1_7_R4.PacketPlayOutEntityDestroy;
|
||||
import net.minecraft.server.v1_7_R4.PacketPlayOutSpawnEntityLiving;
|
||||
import net.minecraft.server.v1_7_R4.World;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.FireworkEffect.Type;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class EvolveData
|
||||
{
|
||||
/**
|
||||
* @author Mysticate
|
||||
*/
|
||||
|
||||
private boolean _ended = false;
|
||||
|
||||
private final long _timestamp = System.currentTimeMillis();
|
||||
private long _endTime = System.currentTimeMillis();
|
||||
|
||||
private final long _preEvolve = 2200;
|
||||
private final long _postEvolve = 4800;
|
||||
|
||||
// private EvolveManager _manager;
|
||||
private HologramManager _holoManager;
|
||||
|
||||
private final PlatformToken _token;
|
||||
|
||||
private boolean _active = true;
|
||||
|
||||
private final Player _player;
|
||||
// private Zombie _zombie;
|
||||
// private DisguiseArmorStand _disguise;
|
||||
|
||||
private final Location _eggLoc;
|
||||
private final SimpleEntry<Material, Byte> _eggLocData;
|
||||
|
||||
private final Hologram _eggHolo;
|
||||
|
||||
private final EvoKit _to;
|
||||
|
||||
private Hologram _holo;
|
||||
|
||||
private final EntityInsentient _eFrom;
|
||||
private EntityInsentient _eTo;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public EvolveData(EvolveManager manager, HologramManager holo, PlatformToken token, Player player, EvoKit from, EvoKit to)
|
||||
{
|
||||
|
||||
// _manager = manager;
|
||||
_holoManager = holo;
|
||||
|
||||
_token = token;
|
||||
|
||||
_player = player;
|
||||
|
||||
_eggLoc = player.getLocation();
|
||||
_eggLocData = new SimpleEntry<Material, Byte>(_eggLoc.getBlock().getType(), _eggLoc.getBlock().getData());
|
||||
|
||||
_eggHolo = new Hologram(holo, _eggLoc.getBlock().getLocation().clone().add(0.5, 1.0, 0.5), C.cYellow + _player.getName()).start();
|
||||
|
||||
_to = to;
|
||||
|
||||
_eFrom = spawn(from.getEntity(), token.Platform, false);
|
||||
|
||||
Bukkit.getServer().getPluginManager().callEvent(new EvolutionBeginEvent(_player));
|
||||
|
||||
setupViewingToken(_eFrom);
|
||||
// spawnZombie();
|
||||
// setupZombie();
|
||||
setupPlayer();
|
||||
setupEgg();
|
||||
setupHologram(holo, _eFrom, from);
|
||||
}
|
||||
|
||||
private void setupEgg()
|
||||
{
|
||||
MapUtil.QuickChangeBlockAt(_eggLoc, Material.DRAGON_EGG);
|
||||
}
|
||||
|
||||
private void restoreEgg()
|
||||
{
|
||||
MapUtil.QuickChangeBlockAt(_eggLoc, _eggLocData.getKey(), _eggLocData.getValue());
|
||||
}
|
||||
|
||||
public Location getEggLocation()
|
||||
{
|
||||
return _eggLoc;
|
||||
}
|
||||
|
||||
private void setupViewingToken(EntityInsentient ent)
|
||||
{
|
||||
Location playerEye = _token.Viewing.clone().add(.5, .62, .5);
|
||||
Location entityHalf = _token.Platform.clone().add(.5, -1, .5).add(0, (ent.boundingBox.e - ent.boundingBox.b) * .75, 0);
|
||||
|
||||
Vector viewing = UtilAlg.getTrajectory(playerEye, entityHalf);
|
||||
_token.Viewing.setPitch(UtilAlg.GetPitch(viewing));
|
||||
}
|
||||
|
||||
// private void spawnZombie()
|
||||
// {
|
||||
// _manager.Host.CreatureAllowOverride = true;
|
||||
// _zombie = (Zombie) _player.getWorld().spawnEntity(_token.Viewing, EntityType.ZOMBIE);
|
||||
// _manager.Host.CreatureAllowOverride = true;
|
||||
// UtilEnt.Vegetate(_zombie, true);
|
||||
// UtilEnt.ghost(_zombie, true, true);
|
||||
//
|
||||
// _disguise = new DisguiseArmorStand(_zombie);
|
||||
//
|
||||
// _disguise.setInvisible(true);
|
||||
// _disguise.Global = false;
|
||||
//
|
||||
// _manager.Host.Manager.GetDisguise().disguise(_disguise, _player);
|
||||
// }
|
||||
//
|
||||
// private void setupZombie()
|
||||
// {
|
||||
// _zombie.teleport(_token.Viewing);
|
||||
//
|
||||
// _disguise.setHeadPosition(_token.Viewing.getDirection());
|
||||
//
|
||||
//// _disguise.UpdateDataWatcher();
|
||||
// _manager.Host.Manager.GetDisguise().updateDisguise(_disguise);
|
||||
//
|
||||
// }
|
||||
|
||||
private void setupPlayer()
|
||||
{
|
||||
if (_token.Viewing.getX() != _player.getLocation().getX())
|
||||
{
|
||||
_player.teleport(_token.Viewing);
|
||||
return;
|
||||
}
|
||||
|
||||
if (_token.Viewing.getY() != _player.getLocation().getY())
|
||||
{
|
||||
_player.teleport(_token.Viewing);
|
||||
return;
|
||||
}
|
||||
|
||||
if (_token.Viewing.getZ() != _player.getLocation().getZ())
|
||||
{
|
||||
_player.teleport(_token.Viewing);
|
||||
return;
|
||||
}
|
||||
|
||||
if (_token.Viewing.getPitch() != _player.getLocation().getPitch())
|
||||
{
|
||||
_player.teleport(_token.Viewing);
|
||||
return;
|
||||
}
|
||||
|
||||
if (_token.Viewing.getYaw() != _player.getLocation().getYaw())
|
||||
{
|
||||
_player.teleport(_token.Viewing);
|
||||
return;
|
||||
}
|
||||
|
||||
// _player.teleport(_token.Store);
|
||||
// _player.teleport(_token.Viewing);
|
||||
|
||||
// UtilPlayer.sendPacket(_player, new PacketPlayOutCamera(_zombie.getEntityId()));
|
||||
}
|
||||
|
||||
private void setupHologram(HologramManager manager, EntityInsentient entity, EvoKit kit)
|
||||
{
|
||||
if (_holo == null)
|
||||
_holo = new Hologram(manager, _token.Platform);
|
||||
|
||||
double add = entity.boundingBox.e - entity.boundingBox.b + .3;
|
||||
|
||||
_holo.setLocation(_token.Platform.clone().add(0, add, 0));
|
||||
|
||||
_holo.setText(kit.buildHologram());
|
||||
|
||||
_holo.setHologramTarget(HologramTarget.WHITELIST);
|
||||
_holo.addPlayer(_player);
|
||||
|
||||
_holo.start();
|
||||
}
|
||||
|
||||
//Boolean completed
|
||||
public boolean tick()
|
||||
{
|
||||
//Failsafe
|
||||
if (_ended)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
// setupZombie();
|
||||
teleport();
|
||||
|
||||
//Hasn't ended yet
|
||||
if (_active)
|
||||
{
|
||||
//If 3 seconds past
|
||||
if (UtilTime.elapsed(_timestamp, _preEvolve))
|
||||
{
|
||||
_active = false;
|
||||
_endTime = System.currentTimeMillis();
|
||||
|
||||
EvolutionEndEvent event = new EvolutionEndEvent(_player);
|
||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (event.isCancelled())
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
_eTo = spawn(_to.getEntity(), _token.Platform, false);
|
||||
despawn(_eFrom);
|
||||
|
||||
setupViewingToken(_eTo);
|
||||
// setupZombie();
|
||||
setupPlayer();
|
||||
|
||||
setupHologram(_holoManager, _eTo, _to);
|
||||
|
||||
UtilFirework.packetPlayFirework(_player, _token.Platform.clone().add(0.0, 1.5, 0.0), Type.BALL, Color.GREEN, false, false);
|
||||
}
|
||||
else
|
||||
{
|
||||
//Play particles
|
||||
if (UtilTime.elapsed(_timestamp, 500))
|
||||
{
|
||||
UtilParticle.PlayParticle(ParticleType.FIREWORKS_SPARK, _token.Platform.clone().add(0.0, 1.0, 0.0), 0.5F, 1.0F, 0.5F, 0, 5, ViewDist.SHORT, _player);
|
||||
UtilParticle.PlayParticle(ParticleType.HAPPY_VILLAGER, _eggLoc.getBlock().getLocation().clone().add(0.5, 0.5, 0.5), 0.5F, 0.5F, 0.5F, 0, 3, ViewDist.NORMAL, UtilServer.getPlayers());
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!UtilTime.elapsed(_endTime, _postEvolve))
|
||||
return false;
|
||||
|
||||
end();
|
||||
|
||||
UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, _eggLoc.clone().add(0.0, 1.0, 0.0), 1.4F, 3.0F, 1.4F, 0, 12, ViewDist.NORMAL, UtilServer.getPlayers());
|
||||
knockback();
|
||||
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(Bukkit.getPluginManager().getPlugins()[0], new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
Bukkit.getServer().getPluginManager().callEvent(new EvolutionPostEvolveEvent(_player));
|
||||
}
|
||||
}, 2);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public void end()
|
||||
{
|
||||
_active = false;
|
||||
|
||||
if (_eFrom != null)
|
||||
despawn(_eFrom);
|
||||
|
||||
if (_eTo != null)
|
||||
despawn(_eTo);
|
||||
|
||||
_eggHolo.stop();
|
||||
restoreEgg();
|
||||
|
||||
if (_holo != null)
|
||||
_holo.stop();
|
||||
|
||||
// UtilPlayer.sendPacket(_player, new PacketPlayOutCamera(_player));
|
||||
// _zombie.remove();
|
||||
|
||||
try
|
||||
{
|
||||
_player.teleport(_eggLoc.clone().add(0.5, 0.0, 0.5));
|
||||
}
|
||||
catch (NullPointerException ex)
|
||||
{}
|
||||
|
||||
_ended = true;
|
||||
}
|
||||
|
||||
public void teleport()
|
||||
{
|
||||
setupPlayer();
|
||||
}
|
||||
|
||||
private void knockback()
|
||||
{
|
||||
HashMap<Player, Double> radius = UtilPlayer.getInRadius(_eggLoc, 8.0);
|
||||
|
||||
for (Entry<Player, Double> entry : radius.entrySet())
|
||||
{
|
||||
if (entry.getKey() == _player)
|
||||
continue;
|
||||
|
||||
UtilAction.velocity(entry.getKey(), UtilAlg.getTrajectory2d(_eggLoc, entry.getKey().getLocation()), 1.6 - (entry.getValue() / 10), true, 0.8, 0, 10, true);
|
||||
}
|
||||
}
|
||||
|
||||
private EntityInsentient spawn(EntityType type, Location loc, boolean invisible)
|
||||
{
|
||||
try
|
||||
{
|
||||
EntityInsentient entity = getEntity(type).getConstructor(World.class).newInstance(((CraftWorld) loc.getWorld()).getHandle());
|
||||
entity.setLocation(loc.getX(), loc.getY(), loc.getZ(), loc.getYaw(), loc.getPitch());
|
||||
PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving(entity);
|
||||
entity.setCustomNameVisible(false);
|
||||
|
||||
if (entity instanceof EntitySlime)
|
||||
{
|
||||
((EntitySlime) entity).setSize(2);
|
||||
}
|
||||
|
||||
if (invisible)
|
||||
{
|
||||
entity.Invisible = true;
|
||||
}
|
||||
|
||||
entity.ghost = true;
|
||||
|
||||
UtilPlayer.sendPacket(_player, packet);
|
||||
return entity;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ex.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private void despawn(EntityInsentient entity)
|
||||
{
|
||||
if (entity == null)
|
||||
return;
|
||||
|
||||
PacketPlayOutEntityDestroy packet = new PacketPlayOutEntityDestroy(new int[]
|
||||
{
|
||||
entity.getId()
|
||||
});
|
||||
|
||||
UtilPlayer.sendPacket(_player, packet);
|
||||
}
|
||||
|
||||
private Class<? extends EntityInsentient> getEntity(EntityType type)
|
||||
{
|
||||
if (type == EntityType.BLAZE)
|
||||
return EntityBlaze.class;
|
||||
|
||||
if (type == EntityType.CHICKEN)
|
||||
return EntityChicken.class;
|
||||
|
||||
if (type == EntityType.CREEPER)
|
||||
return EntityCreeper.class;
|
||||
|
||||
if (type == EntityType.ENDERMAN)
|
||||
return EntityEnderman.class;
|
||||
|
||||
if (type == EntityType.IRON_GOLEM)
|
||||
return EntityIronGolem.class;
|
||||
|
||||
if (type == EntityType.SKELETON)
|
||||
return EntitySkeleton.class;
|
||||
|
||||
if (type == EntityType.SLIME)
|
||||
return EntitySlime.class;
|
||||
|
||||
if (type == EntityType.SNOWMAN)
|
||||
return EntitySnowman.class;
|
||||
|
||||
if (type == EntityType.SPIDER)
|
||||
return EntitySpider.class;
|
||||
|
||||
if (type == EntityType.WOLF)
|
||||
return EntityWolf.class;
|
||||
|
||||
return EntityZombie.class;
|
||||
}
|
||||
}
|
@ -0,0 +1,236 @@
|
||||
package nautilus.game.arcade.game.games.evolution.evolve;
|
||||
|
||||
import java.util.AbstractMap.SimpleEntry;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.hologram.HologramManager;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.addons.compass.CompassAttemptTargetEvent;
|
||||
import nautilus.game.arcade.game.games.evolution.EvoKit;
|
||||
import nautilus.game.arcade.game.games.evolution.Evolution;
|
||||
import nautilus.game.arcade.game.games.evolution.events.EvolutionAbilityUseEvent;
|
||||
import nautilus.game.arcade.kit.perks.event.PerkConstructorEvent;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.FallingBlock;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.block.BlockPhysicsEvent;
|
||||
import org.bukkit.event.entity.EntityChangeBlockEvent;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
|
||||
public class EvolveManager implements Listener
|
||||
{
|
||||
/**
|
||||
* @author Mysticate
|
||||
*/
|
||||
|
||||
public final Evolution Host;
|
||||
|
||||
private final NautHashMap<Location, SimpleEntry<Location, Location>> _evolveLocs;
|
||||
|
||||
private NautHashMap<String, EvolveData> _data = new NautHashMap<String, EvolveData>();
|
||||
|
||||
public EvolveManager(Evolution evolution, NautHashMap<Location, SimpleEntry<Location, Location>> evolveLocs)
|
||||
{
|
||||
Host = evolution;
|
||||
_evolveLocs = evolveLocs;
|
||||
|
||||
Bukkit.getPluginManager().registerEvents(this, Host.Manager.getPlugin());
|
||||
}
|
||||
|
||||
private PlatformToken getLocation()
|
||||
{
|
||||
ArrayList<Entry<Location, SimpleEntry<Location, Location>>> locs = new ArrayList<Entry<Location, SimpleEntry<Location, Location>>>(_evolveLocs.entrySet());
|
||||
Entry<Location, SimpleEntry<Location, Location>> entry = locs.get(UtilMath.r(locs.size()));
|
||||
|
||||
return new PlatformToken(entry.getKey(), entry.getValue().getKey(), entry.getValue().getValue());
|
||||
}
|
||||
|
||||
public boolean isEvolving(Player player)
|
||||
{
|
||||
return _data.containsKey(player.getName());
|
||||
}
|
||||
|
||||
public void addEvolve(HologramManager holo, Player player, EvoKit from, EvoKit to)
|
||||
{
|
||||
if (_data.containsKey(player.getName()))
|
||||
return;
|
||||
|
||||
_data.put(player.getName(), new EvolveData(this, holo, getLocation(), player, from, to));
|
||||
}
|
||||
|
||||
public EvolveData getEvolve(Player player)
|
||||
{
|
||||
return _data.get(player.getName());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void tick(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
return;
|
||||
|
||||
if (!Host.IsLive())
|
||||
return;
|
||||
|
||||
Iterator<Entry<String, EvolveData>> iterator = _data.entrySet().iterator();
|
||||
while (iterator.hasNext())
|
||||
{
|
||||
Entry<String, EvolveData> entry = iterator.next();
|
||||
|
||||
Player player = UtilPlayer.searchExact(entry.getKey());
|
||||
|
||||
if (player == null || !player.isOnline())
|
||||
{
|
||||
try
|
||||
{
|
||||
entry.getValue().end();
|
||||
}
|
||||
catch (NullPointerException ex) {}
|
||||
|
||||
iterator.remove();
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!Host.IsAlive(player))
|
||||
{
|
||||
try
|
||||
{
|
||||
entry.getValue().end();
|
||||
}
|
||||
catch (NullPointerException ex) {}
|
||||
|
||||
iterator.remove();
|
||||
continue;
|
||||
}
|
||||
|
||||
if (entry.getValue().tick())
|
||||
{
|
||||
try
|
||||
{
|
||||
entry.getValue().end();
|
||||
}
|
||||
catch (NullPointerException ex) {}
|
||||
|
||||
iterator.remove();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void end()
|
||||
{
|
||||
for (EvolveData data : _data.values())
|
||||
{
|
||||
data.end();
|
||||
}
|
||||
|
||||
HandlerList.unregisterAll(this);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onEvolveDamageRecieve(CustomDamageEvent event)
|
||||
{
|
||||
if (!Host.IsLive())
|
||||
return;
|
||||
|
||||
if (!(event.GetDamageeEntity() instanceof Player))
|
||||
return;
|
||||
|
||||
if (isEvolving(event.GetDamageePlayer()))
|
||||
event.SetCancelled("Player is evolving!");
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onEvolveDamageDeal(CustomDamageEvent event)
|
||||
{
|
||||
if (!Host.IsLive())
|
||||
return;
|
||||
|
||||
if (!(event.GetDamagerEntity(true) instanceof Player))
|
||||
return;
|
||||
|
||||
if (isEvolving(event.GetDamagerPlayer(true)))
|
||||
event.SetCancelled("Player is evolving!");
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onEvolveAbility(EvolutionAbilityUseEvent event)
|
||||
{
|
||||
if (!Host.IsLive())
|
||||
return;
|
||||
|
||||
if (isEvolving(event.getPlayer()))
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onEvolveCompass(CompassAttemptTargetEvent event)
|
||||
{
|
||||
if (!Host.IsLive())
|
||||
return;
|
||||
|
||||
if (isEvolving(event.getTarget()))
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onEvolveConstruct(PerkConstructorEvent event)
|
||||
{
|
||||
if (!Host.IsLive())
|
||||
return;
|
||||
|
||||
if (isEvolving(event.getPlayer()))
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onEvolveMove(PlayerMoveEvent event)
|
||||
{
|
||||
if (!Host.IsLive())
|
||||
return;
|
||||
|
||||
if (isEvolving(event.getPlayer()))
|
||||
event.setTo(event.getFrom());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onEggFall(BlockPhysicsEvent event)
|
||||
{
|
||||
if (!Host.IsLive())
|
||||
return;
|
||||
|
||||
if (event.getChangedType() == Material.DRAGON_EGG || event.getBlock().getType() == Material.DRAGON_EGG)
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onEggSolidify(EntityChangeBlockEvent event)
|
||||
{
|
||||
if (!Host.IsLive())
|
||||
return;
|
||||
|
||||
if (!(event.getEntity() instanceof FallingBlock))
|
||||
return;
|
||||
|
||||
if (((FallingBlock) event.getEntity()).getMaterial() != Material.DRAGON_EGG)
|
||||
return;
|
||||
|
||||
event.setCancelled(true);
|
||||
event.getEntity().remove();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package nautilus.game.arcade.game.games.evolution.evolve;
|
||||
|
||||
import org.bukkit.Location;
|
||||
|
||||
public class PlatformToken
|
||||
{
|
||||
/**
|
||||
* @author Mysticate
|
||||
* August 8, 2015
|
||||
*/
|
||||
|
||||
public final Location Platform;
|
||||
public final Location Viewing; /**This was when I was using a spectate packet. Will be used again once I can have teh armorstand : >>>>>>>>*/
|
||||
public final Location Store;
|
||||
|
||||
public PlatformToken(Location platform, Location viewing, Location store)
|
||||
{
|
||||
Platform = platform.clone();
|
||||
Viewing = viewing.clone();
|
||||
Store = store.clone();
|
||||
}
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
package nautilus.game.arcade.game.games.evolution.kits;
|
||||
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.game.games.evolution.kits.perks.PerkCooldownEVO;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.kit.KitAvailability;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class KitAbility extends Kit
|
||||
{
|
||||
/**
|
||||
* @author Mysticate
|
||||
*/
|
||||
|
||||
public KitAbility(ArcadeManager manager)
|
||||
{
|
||||
super(manager, "Darwinist", KitAvailability.Free, new String[]
|
||||
{
|
||||
"Your DNA allows you to chop cooldown times!"
|
||||
}, new Perk[]
|
||||
{
|
||||
new PerkCooldownEVO()
|
||||
}, EntityType.ZOMBIE, ItemStackFactory.Instance.CreateStack(Material.FEATHER));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void GiveItems(Player player)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -1,38 +0,0 @@
|
||||
package nautilus.game.arcade.game.games.evolution.kits;
|
||||
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
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.perks.PerkDoubleJump;
|
||||
import nautilus.game.arcade.kit.perks.PerkSpeed;
|
||||
|
||||
public class KitAgility extends Kit
|
||||
{
|
||||
public KitAgility(ArcadeManager manager)
|
||||
{
|
||||
super(manager, "Agility", KitAvailability.Free,
|
||||
|
||||
new String[]
|
||||
{
|
||||
"You are extremely agile and can double jump!"
|
||||
},
|
||||
|
||||
new Perk[]
|
||||
{
|
||||
new PerkDoubleJump("Double Jump", 0.8, 0.8, false),
|
||||
new PerkSpeed(0),
|
||||
},
|
||||
EntityType.ZOMBIE,
|
||||
null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void GiveItems(Player player)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
package nautilus.game.arcade.game.games.evolution.kits;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.game.games.evolution.kits.perks.PerkEvolveSpeedEVO;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.kit.KitAvailability;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class KitEvolveSpeed extends Kit
|
||||
{
|
||||
/**
|
||||
* @author Mysticate
|
||||
*/
|
||||
|
||||
public KitEvolveSpeed(ArcadeManager manager)
|
||||
{
|
||||
super(manager, "Quick Evolver", KitAvailability.Gem, 4000, new String[]
|
||||
{
|
||||
C.cGray + "You always had dreams of growing up..."
|
||||
}, new Perk[]
|
||||
{
|
||||
new PerkEvolveSpeedEVO()
|
||||
}, EntityType.ZOMBIE, ItemStackFactory.Instance.CreateStack(Material.LEATHER_BOOTS));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void GiveItems(Player player)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -1,38 +1,79 @@
|
||||
package nautilus.game.arcade.game.games.evolution.kits;
|
||||
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.achievement.Achievement;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
|
||||
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.perks.PerkRegeneration;
|
||||
import nautilus.game.arcade.kit.perks.PerkVampire;
|
||||
import nautilus.game.arcade.kit.perks.PerkDummy;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
|
||||
public class KitHealth extends Kit
|
||||
{
|
||||
/**
|
||||
* @author Mysticate
|
||||
*/
|
||||
|
||||
public KitHealth(ArcadeManager manager)
|
||||
{
|
||||
super(manager, "Vitality", KitAvailability.Free,
|
||||
|
||||
new String[]
|
||||
super(manager, "Health Harvester", KitAvailability.Achievement, new String[]
|
||||
{
|
||||
"Harvest health every day..."
|
||||
}, new Perk[]
|
||||
{
|
||||
"You have improved survivability."
|
||||
},
|
||||
|
||||
new Perk[]
|
||||
{
|
||||
new PerkRegeneration(0),
|
||||
new PerkVampire(6),
|
||||
},
|
||||
EntityType.ZOMBIE,
|
||||
null);
|
||||
new PerkDummy("Health Haravester", new String[]
|
||||
{
|
||||
"Recieve " + F.elem("100%") + " health on kill."
|
||||
})
|
||||
}, EntityType.ZOMBIE, ItemStackFactory.Instance.CreateStack(Material.BLAZE_POWDER));
|
||||
|
||||
setAchievementRequirements(new Achievement[]
|
||||
{
|
||||
Achievement.EVOLUTION_EVOLVEKILL,
|
||||
Achievement.EVOLUTION_MELEE,
|
||||
Achievement.EVOLUTION_NO_DEATHS,
|
||||
Achievement.EVOLUTION_RAMPAGE,
|
||||
Achievement.EVOLUTION_SKILLS,
|
||||
Achievement.EVOLUTION_STEALTH,
|
||||
Achievement.EVOLUTION_WINS
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void GiveItems(Player player)
|
||||
public void GiveItems(Player player)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void onKill(CombatDeathEvent event)
|
||||
{
|
||||
if (!Manager.GetGame().IsLive())
|
||||
return;
|
||||
|
||||
Player killer = UtilPlayer.searchExact(event.GetLog().GetPlayer().GetName());
|
||||
if (killer == null || !killer.isOnline())
|
||||
return;
|
||||
|
||||
if (!Manager.IsAlive(killer))
|
||||
return;
|
||||
|
||||
if (UtilPlayer.isSpectator(killer))
|
||||
return;
|
||||
|
||||
if (!HasKit(killer))
|
||||
return;
|
||||
|
||||
killer.setHealth(killer.getMaxHealth());
|
||||
}
|
||||
}
|
||||
|
@ -1,37 +0,0 @@
|
||||
package nautilus.game.arcade.game.games.evolution.kits;
|
||||
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
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.perks.PerkRecharge;
|
||||
|
||||
public class KitRecharge extends Kit
|
||||
{
|
||||
public KitRecharge(ArcadeManager manager)
|
||||
{
|
||||
super(manager, "Stamina", KitAvailability.Free,
|
||||
|
||||
new String[]
|
||||
{
|
||||
"You are able to use your abilities more often!"
|
||||
},
|
||||
|
||||
new Perk[]
|
||||
{
|
||||
new PerkRecharge(0.5),
|
||||
},
|
||||
EntityType.ZOMBIE,
|
||||
null);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void GiveItems(Player player)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
package nautilus.game.arcade.game.games.evolution.kits.perks;
|
||||
|
||||
import mineplex.core.common.util.F;
|
||||
import nautilus.game.arcade.game.games.evolution.events.EvolutionAbilityUseEvent;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
||||
public class PerkCooldownEVO extends Perk
|
||||
{
|
||||
/**
|
||||
* @author Mysticate
|
||||
*/
|
||||
|
||||
public PerkCooldownEVO()
|
||||
{
|
||||
super("Cooldown", new String[]
|
||||
{
|
||||
"All ability cooldowns are reduced by " + F.elem("33%") + "."
|
||||
});
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onAbility(EvolutionAbilityUseEvent event)
|
||||
{
|
||||
if (!Manager.GetGame().IsLive())
|
||||
return;
|
||||
|
||||
if (!Manager.IsAlive(event.getPlayer()))
|
||||
return;
|
||||
|
||||
if (!Kit.HasKit(event.getPlayer()))
|
||||
return;
|
||||
|
||||
event.setCooldown((long) (event.getCooldown() * .666));
|
||||
}
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
package nautilus.game.arcade.game.games.evolution.kits.perks;
|
||||
|
||||
import mineplex.core.common.util.F;
|
||||
import nautilus.game.arcade.game.games.evolution.events.EvolutionAttemptingTickEvent;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
||||
public class PerkEvolveSpeedEVO extends Perk
|
||||
{
|
||||
/**
|
||||
* @author Mysticate
|
||||
*/
|
||||
|
||||
public PerkEvolveSpeedEVO()
|
||||
{
|
||||
super("Speedy", new String[]
|
||||
{
|
||||
"You evolve " + F.elem("25%") + " faster."
|
||||
});
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onAbility(EvolutionAttemptingTickEvent event)
|
||||
{
|
||||
if (!Manager.GetGame().IsLive())
|
||||
return;
|
||||
|
||||
if (!Manager.IsAlive(event.getPlayer()))
|
||||
return;
|
||||
|
||||
if (!Kit.HasKit(event.getPlayer()))
|
||||
return;
|
||||
|
||||
event.setProgress((float) (event.getProgress() * 1.25));
|
||||
}
|
||||
}
|
@ -1,57 +1,51 @@
|
||||
package nautilus.game.arcade.game.games.evolution.mobs;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.disguise.disguises.DisguiseBlaze;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.game.games.evolution.EvoKit;
|
||||
import nautilus.game.arcade.game.games.evolution.mobs.perks.PerkFlamingSwordEVO;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
import nautilus.game.arcade.kit.perks.PerkNoFallDamage;
|
||||
import nautilus.game.arcade.kit.perks.PerkWaterDamage;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.disguise.disguises.DisguiseBlaze;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
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.perks.PerkFlamingSword;
|
||||
|
||||
public class KitBlaze extends Kit
|
||||
public class KitBlaze extends EvoKit
|
||||
{
|
||||
/**
|
||||
* @author Mysticate
|
||||
*/
|
||||
|
||||
public KitBlaze(ArcadeManager manager)
|
||||
{
|
||||
super(manager, "Blaze", KitAvailability.Hide,
|
||||
|
||||
new String[]
|
||||
{
|
||||
""
|
||||
},
|
||||
|
||||
new Perk[]
|
||||
{
|
||||
new PerkFlamingSword()
|
||||
},
|
||||
EntityType.SLIME,
|
||||
null);
|
||||
|
||||
super(manager, "Blaze", new String[]
|
||||
{
|
||||
C.cYellow + "Ability: " + C.cWhite + "Flamethrower", C.Line,
|
||||
C.cGreen + "No Fall Damage", C.cRed + "Water Damage"
|
||||
}, 36, 5, new Perk[]
|
||||
{
|
||||
new PerkFlamingSwordEVO(), new PerkWaterDamage(1, 0.25), new PerkNoFallDamage()
|
||||
}, EntityType.BLAZE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void GiveItems(Player player)
|
||||
protected void giveItems(Player player)
|
||||
{
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.GOLD_SWORD));
|
||||
|
||||
UtilPlayer.message(player, C.Line);
|
||||
UtilPlayer.message(player, C.Bold + "You evolved into " + F.elem(C.cGreen + C.Bold + GetName()) + "!");
|
||||
UtilPlayer.message(player, F.elem("Hold Block") + " to use " + F.elem("Inferno"));
|
||||
UtilPlayer.message(player, C.Line);
|
||||
|
||||
player.getWorld().playSound(player.getLocation(), Sound.BLAZE_BREATH, 4f, 1f);
|
||||
player.getInventory().setItem(0, new ItemBuilder(Material.BLAZE_ROD).setTitle(C.cYellow + C.Bold + "Right Click" + C.cWhite + " - " + C.cGreen + C.Bold + "Flamethrower").build());
|
||||
|
||||
//Disguise
|
||||
DisguiseBlaze disguise = new DisguiseBlaze(player);
|
||||
disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName());
|
||||
disguise.setCustomNameVisible(true);
|
||||
Manager.GetDisguise().disguise(disguise);
|
||||
}
|
||||
|
||||
Manager.GetDisguise().undisguise(player);
|
||||
Manager.GetDisguise().disguise(disguise);
|
||||
|
||||
player.getWorld().playSound(player.getLocation(), Sound.BLAZE_BREATH, 4f, 1f);
|
||||
}
|
||||
}
|
||||
|
@ -1,74 +1,145 @@
|
||||
package nautilus.game.arcade.game.games.evolution.mobs;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilEvent;
|
||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||
import mineplex.core.common.util.UtilGear;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.disguise.disguises.DisguiseChicken;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.game.games.evolution.EvoKit;
|
||||
import nautilus.game.arcade.game.games.evolution.events.EvolutionAbilityUseEvent;
|
||||
import nautilus.game.arcade.game.games.evolution.mobs.perks.PerkDoubleJumpEVO;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
import nautilus.game.arcade.kit.perks.PerkConstructor;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Egg;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.disguise.disguises.DisguiseChicken;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
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.perks.PerkConstructor;
|
||||
import nautilus.game.arcade.kit.perks.PerkFallDamage;
|
||||
|
||||
public class KitChicken extends Kit
|
||||
public class KitChicken extends EvoKit
|
||||
{
|
||||
/**
|
||||
* @author Mysticate
|
||||
*/
|
||||
|
||||
public KitChicken(ArcadeManager manager)
|
||||
{
|
||||
super(manager, "Chicken", KitAvailability.Hide,
|
||||
|
||||
new String[]
|
||||
{
|
||||
""
|
||||
},
|
||||
|
||||
new Perk[]
|
||||
{
|
||||
new PerkConstructor("Egg Pouch", 0.8, 8, Material.EGG, "Egg", false),
|
||||
new PerkFallDamage(-2),
|
||||
},
|
||||
EntityType.SLIME,
|
||||
null);
|
||||
|
||||
super(manager, "Chicken", new String[]
|
||||
{
|
||||
C.cYellow + "Ability: " + C.cWhite + "Egg Throw", C.Line,
|
||||
C.cGreen + "No Fall Damage", C.cGreen + "Double Jump"
|
||||
}, 16, 3,
|
||||
new Perk[]
|
||||
{
|
||||
new PerkConstructor("Egg Pouch", 2.0, 3, Material.EGG,
|
||||
"Egg Launcher Ammo", false), new PerkDoubleJumpEVO("Double Jump", 0.6, 0.9, false)
|
||||
}, EntityType.CHICKEN);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void GiveItems(Player player)
|
||||
protected void giveItems(Player player)
|
||||
{
|
||||
UtilPlayer.message(player, C.Line);
|
||||
UtilPlayer.message(player, C.Bold + "You evolved into " + F.elem(C.cGreen + C.Bold + GetName()) + "!");
|
||||
UtilPlayer.message(player, F.elem("Right-Click with Eggs") + " to use " + F.elem("Throw Egg"));
|
||||
UtilPlayer.message(player, C.Line);
|
||||
|
||||
player.getWorld().playSound(player.getLocation(), Sound.CHICKEN_IDLE, 4f, 1f);
|
||||
player.getInventory().setItem(0, new ItemBuilder(Material.FEATHER).setTitle(C.cYellow + C.Bold + "Right Click" + C.cWhite + " - " + C.cGreen + C.Bold + "Egg Launch").build());
|
||||
|
||||
//Disguise
|
||||
DisguiseChicken disguise = new DisguiseChicken(player);
|
||||
disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName());
|
||||
disguise.setCustomNameVisible(true);
|
||||
|
||||
Manager.GetDisguise().undisguise(player);
|
||||
Manager.GetDisguise().disguise(disguise);
|
||||
|
||||
player.getWorld().playSound(player.getLocation(), Sound.CHICKEN_IDLE, 4f, 1f);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onLaunch(PlayerInteractEvent event)
|
||||
{
|
||||
if (!UtilEvent.isAction(event, ActionType.R))
|
||||
return;
|
||||
|
||||
if (!Manager.GetGame().IsLive())
|
||||
return;
|
||||
|
||||
if (!HasKit(event.getPlayer()))
|
||||
return;
|
||||
|
||||
if (!UtilGear.isMat(event.getItem(), Material.FEATHER))
|
||||
return;
|
||||
|
||||
EvolutionAbilityUseEvent useEvent = new EvolutionAbilityUseEvent(event.getPlayer(), "Egg", 0);
|
||||
Bukkit.getServer().getPluginManager().callEvent(useEvent);
|
||||
|
||||
if (useEvent.isCancelled())
|
||||
{
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!UtilInv.contains(event.getPlayer(), Material.EGG, (byte) 0, 1))
|
||||
return;
|
||||
|
||||
UtilInv.remove(event.getPlayer(), Material.EGG, (byte) 0, 1);
|
||||
event.getPlayer().launchProjectile(Egg.class);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onEggLaunch(final PlayerInteractEvent event)
|
||||
{
|
||||
if (!UtilEvent.isAction(event, ActionType.R))
|
||||
return;
|
||||
|
||||
if (!Manager.GetGame().IsLive())
|
||||
return;
|
||||
|
||||
if (!HasKit(event.getPlayer()))
|
||||
return;
|
||||
|
||||
if (!UtilGear.isMat(event.getItem(), Material.EGG))
|
||||
return;
|
||||
|
||||
event.setCancelled(true);
|
||||
Bukkit.getScheduler().runTaskLater(Manager.getPlugin(), new Runnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
UtilInv.Update(event.getPlayer());
|
||||
}
|
||||
}, 2);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void EggHit(CustomDamageEvent event)
|
||||
{
|
||||
if (event.IsCancelled())
|
||||
if (!Manager.GetGame().IsLive())
|
||||
return;
|
||||
|
||||
|
||||
if (!(event.GetDamagerEntity(true) instanceof Player))
|
||||
return;
|
||||
|
||||
Player player = event.GetDamagerPlayer(true);
|
||||
|
||||
if (!Manager.IsAlive(player))
|
||||
return;
|
||||
|
||||
if (!HasKit(player))
|
||||
return;
|
||||
|
||||
if (event.GetProjectile() == null)
|
||||
return;
|
||||
|
||||
if (!(event.GetProjectile() instanceof Egg))
|
||||
return;
|
||||
|
||||
event.AddMod("Chicken Kit", "Egg", 1, true);
|
||||
|
||||
event.AddMod("Chicken Kit", "Egg", 2, true);
|
||||
}
|
||||
}
|
||||
|
@ -1,59 +1,48 @@
|
||||
package nautilus.game.arcade.game.games.evolution.mobs;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.disguise.disguises.DisguiseCreeper;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.game.games.evolution.EvoKit;
|
||||
import nautilus.game.arcade.game.games.evolution.mobs.perks.PerkSulphurBombEVO;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.disguise.disguises.DisguiseCreeper;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
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.perks.PerkExplode;
|
||||
import nautilus.game.arcade.kit.perks.PerkFood;
|
||||
|
||||
public class KitCreeper extends Kit
|
||||
public class KitCreeper extends EvoKit
|
||||
{
|
||||
/**
|
||||
* @author Mysticate
|
||||
*/
|
||||
|
||||
public KitCreeper(ArcadeManager manager)
|
||||
{
|
||||
super(manager, "Creeper", KitAvailability.Hide,
|
||||
|
||||
new String[]
|
||||
{
|
||||
""
|
||||
},
|
||||
|
||||
new Perk[]
|
||||
{
|
||||
new PerkFood(1),
|
||||
new PerkExplode("Detonate", 1, 6000)
|
||||
},
|
||||
EntityType.SLIME,
|
||||
null);
|
||||
|
||||
super(manager, "Creeper", new String[]
|
||||
{
|
||||
C.cYellow + "Ability: " + C.cWhite + "Sulphur Bomb"
|
||||
}, 28, 4, new Perk[]
|
||||
{
|
||||
new PerkSulphurBombEVO()
|
||||
}, EntityType.CREEPER);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void GiveItems(Player player)
|
||||
protected void giveItems(Player player)
|
||||
{
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.TNT));
|
||||
|
||||
UtilPlayer.message(player, C.Line);
|
||||
UtilPlayer.message(player, C.Bold + "You evolved into " + F.elem(C.cGreen + C.Bold + GetName()) + "!");
|
||||
UtilPlayer.message(player, F.elem("Attack") + " to use " + F.elem("Detonate"));
|
||||
UtilPlayer.message(player, C.Line);
|
||||
|
||||
player.getWorld().playSound(player.getLocation(), Sound.CREEPER_HISS, 4f, 1f);
|
||||
player.getInventory().setItem(0, new ItemBuilder(Material.SULPHUR).setTitle(C.cYellow + C.Bold + "Right Click" + C.cWhite + " - " + C.cGreen + C.Bold + "Sulphur Bomb").build());
|
||||
|
||||
//Disguise
|
||||
DisguiseCreeper disguise = new DisguiseCreeper(player);
|
||||
disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName());
|
||||
disguise.setCustomNameVisible(true);
|
||||
|
||||
Manager.GetDisguise().undisguise(player);
|
||||
Manager.GetDisguise().disguise(disguise);
|
||||
|
||||
player.getWorld().playSound(player.getLocation(), Sound.CREEPER_HISS, 4f, 1f);
|
||||
}
|
||||
}
|
||||
|
@ -1,52 +1,34 @@
|
||||
package nautilus.game.arcade.game.games.evolution.mobs;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
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.perks.PerkBlink;
|
||||
|
||||
public class KitEnderman extends Kit
|
||||
public class KitEnderman
|
||||
//extends EvoKit
|
||||
{
|
||||
public KitEnderman(ArcadeManager manager)
|
||||
{
|
||||
super(manager, "Enderman", KitAvailability.Hide,
|
||||
|
||||
new String[]
|
||||
{
|
||||
""
|
||||
},
|
||||
|
||||
new Perk[]
|
||||
{
|
||||
new PerkBlink("Blink", 12, 4000)
|
||||
},
|
||||
EntityType.SLIME,
|
||||
null);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void GiveItems(Player player)
|
||||
{
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE));
|
||||
|
||||
UtilPlayer.message(player, C.Line);
|
||||
UtilPlayer.message(player, C.Bold + "You evolved into " + F.elem(C.cGreen + C.Bold + GetName()) + "!");
|
||||
UtilPlayer.message(player, F.elem("Right-Click with Axe") + " to use " + F.elem("Blink"));
|
||||
UtilPlayer.message(player, C.Line);
|
||||
|
||||
player.getWorld().playSound(player.getLocation(), Sound.ENDERMAN_IDLE, 4f, 1f);
|
||||
|
||||
|
||||
}
|
||||
/**
|
||||
* @author Mysticate
|
||||
*/
|
||||
|
||||
// public KitEnderman(ArcadeManager manager)
|
||||
// {
|
||||
// super(manager, "Enderman", new String[]{""}, 20, 10, new Perk[]{
|
||||
// new PerkBlockTossEVO(),
|
||||
// new PerkWaterDamage(2, 1)
|
||||
// }, EntityType.ENDERMAN);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// protected void giveItems(Player player)
|
||||
// {
|
||||
// player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD));
|
||||
//
|
||||
// player.getWorld().playSound(player.getLocation(), Sound.ENDERMAN_IDLE, 4f, 1f);
|
||||
//
|
||||
// //Disguise
|
||||
// DisguiseEnderman disguise = new DisguiseEnderman(player);
|
||||
// disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName());
|
||||
// disguise.setCustomNameVisible(true);
|
||||
//
|
||||
// Manager.GetDisguise().undisguise(player);
|
||||
// Manager.GetDisguise().disguise(disguise);
|
||||
// }
|
||||
}
|
||||
|
@ -1,57 +1,50 @@
|
||||
package nautilus.game.arcade.game.games.evolution.mobs;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.disguise.disguises.DisguiseIronGolem;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.game.games.evolution.EvoKit;
|
||||
import nautilus.game.arcade.game.games.evolution.mobs.perks.PerkSiesmicSlamEVO;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
import nautilus.game.arcade.kit.perks.PerkKnockbackTaken;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.disguise.disguises.DisguiseIronGolem;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
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.perks.PerkSlam;
|
||||
|
||||
public class KitGolem extends Kit
|
||||
public class KitGolem extends EvoKit
|
||||
{
|
||||
/**
|
||||
* @author Mysticate
|
||||
*/
|
||||
|
||||
public KitGolem(ArcadeManager manager)
|
||||
{
|
||||
super(manager, "Iron Golem", KitAvailability.Hide,
|
||||
|
||||
new String[]
|
||||
{
|
||||
""
|
||||
},
|
||||
|
||||
new Perk[]
|
||||
{
|
||||
new PerkSlam("Ground Pound", 1, 1.2, 10000),
|
||||
},
|
||||
EntityType.SLIME,
|
||||
null);
|
||||
|
||||
super(manager, "Iron Golem", new String[]
|
||||
{
|
||||
C.cYellow + "Abililty: " + C.cWhite + "Seismic Slam", C.Line,
|
||||
C.cGreen + "50% Knockback"
|
||||
}, 40, 6, new Perk[]
|
||||
{
|
||||
new PerkSiesmicSlamEVO(), new PerkKnockbackTaken(.5)
|
||||
}, EntityType.IRON_GOLEM);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void GiveItems(Player player)
|
||||
protected void giveItems(Player player)
|
||||
{
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.DIAMOND_AXE));
|
||||
|
||||
UtilPlayer.message(player, C.Line);
|
||||
UtilPlayer.message(player, C.Bold + "You evolved into " + F.elem(C.cGreen + C.Bold + GetName()) + "!");
|
||||
UtilPlayer.message(player, F.elem("Right-Click with Axe") + " to use " + F.elem("Ground Pound"));
|
||||
UtilPlayer.message(player, C.Line);
|
||||
|
||||
player.getWorld().playSound(player.getLocation(), Sound.IRONGOLEM_DEATH, 4f, 1f);
|
||||
|
||||
player.getInventory().setItem(0, new ItemBuilder(Material.IRON_INGOT).setTitle(C.cYellow + C.Bold + "Right Click" + C.cWhite + " - " + C.cGreen + C.Bold + "Seismic Slam").build());
|
||||
|
||||
//Disguise
|
||||
DisguiseIronGolem disguise = new DisguiseIronGolem(player);
|
||||
disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName());
|
||||
disguise.setCustomNameVisible(true);
|
||||
|
||||
Manager.GetDisguise().undisguise(player);
|
||||
Manager.GetDisguise().disguise(disguise);
|
||||
|
||||
player.getWorld().playSound(player.getLocation(), Sound.IRONGOLEM_DEATH, 4f, 1f);
|
||||
}
|
||||
}
|
||||
|
@ -1,59 +1,84 @@
|
||||
package nautilus.game.arcade.game.games.evolution.mobs;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.disguise.disguises.DisguiseSkeleton;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
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.perks.PerkBarrage;
|
||||
import nautilus.game.arcade.kit.perks.PerkFletcher;
|
||||
|
||||
public class KitSkeleton extends Kit
|
||||
public class KitSkeleton
|
||||
//extends EvoKit
|
||||
{
|
||||
public KitSkeleton(ArcadeManager manager)
|
||||
{
|
||||
super(manager, "Skeletal Archer", KitAvailability.Hide,
|
||||
|
||||
new String[]
|
||||
{
|
||||
""
|
||||
},
|
||||
|
||||
new Perk[]
|
||||
{
|
||||
new PerkFletcher(3, 2, false),
|
||||
new PerkBarrage(5, 250, true, false)
|
||||
},
|
||||
EntityType.SLIME,
|
||||
null);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void GiveItems(Player player)
|
||||
{
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW));
|
||||
|
||||
UtilPlayer.message(player, C.Line);
|
||||
UtilPlayer.message(player, C.Bold + "You evolved into " + F.elem(C.cGreen + C.Bold + GetName()) + "!");
|
||||
UtilPlayer.message(player, F.elem("Charge Bow") + " to use " + F.elem("Barrage"));
|
||||
UtilPlayer.message(player, C.Line);
|
||||
|
||||
player.getWorld().playSound(player.getLocation(), Sound.SKELETON_IDLE, 4f, 1f);
|
||||
|
||||
//Disguise
|
||||
DisguiseSkeleton disguise = new DisguiseSkeleton(player);
|
||||
disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName());
|
||||
disguise.setCustomNameVisible(true);
|
||||
Manager.GetDisguise().disguise(disguise);
|
||||
}
|
||||
/**
|
||||
* @author Mysticate
|
||||
*/
|
||||
|
||||
// public KitSkeleton(ArcadeManager manager)
|
||||
// {
|
||||
// super(manager, "Skeletal Archer",
|
||||
// new String[]
|
||||
// {
|
||||
// F.elem("Charge Bow") + " to use " + F.elem("Barrage")
|
||||
// },
|
||||
// new String[]
|
||||
// {
|
||||
// F.elem("Charge Bow") + C.cWhite + " - " + F.elem("Barrage")
|
||||
// },
|
||||
// new Perk[]
|
||||
// {
|
||||
// new PerkConstructor("Fletcher", 3, 2, Material.ARROW, "Fletched Arrow", false),
|
||||
// new PerkBarrage(5, 250, true, false)
|
||||
// }, EntityType.SKELETON);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void GiveItems(Player player)
|
||||
// {
|
||||
// player.getInventory().setHelmet(new ItemBuilder(Material.CHAINMAIL_HELMET).build());
|
||||
// player.getInventory().setChestplate(new ItemBuilder(Material.CHAINMAIL_CHESTPLATE).build());
|
||||
// player.getInventory().setLeggings(new ItemBuilder(Material.CHAINMAIL_LEGGINGS).build());
|
||||
// player.getInventory().setBoots(new ItemBuilder(Material.IRON_BOOTS).build());
|
||||
//
|
||||
// player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW));
|
||||
//
|
||||
// player.getWorld().playSound(player.getLocation(), Sound.SKELETON_IDLE, 4f, 1f);
|
||||
//
|
||||
// //Disguise
|
||||
// DisguiseSkeleton disguise = new DisguiseSkeleton(player);
|
||||
// disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName());
|
||||
// disguise.setCustomNameVisible(true);
|
||||
//
|
||||
// Manager.GetDisguise().undisguise(player);
|
||||
// Manager.GetDisguise().disguise(disguise);
|
||||
//
|
||||
// player.getInventory().setItem(8, new ItemBuilder(Material.COMPASS).setTitle(F.item("Tracking Compass")).build());
|
||||
// }
|
||||
//
|
||||
// @EventHandler
|
||||
// public void onBowShoot(final EntityShootBowEvent event)
|
||||
// {
|
||||
// if (!(event.getEntity() instanceof Player))
|
||||
// return;
|
||||
//
|
||||
// if (!Manager.GetGame().IsLive())
|
||||
// return;
|
||||
//
|
||||
// final Player player = (Player) event.getEntity();
|
||||
//
|
||||
// if (!HasKit(player))
|
||||
// return;
|
||||
//
|
||||
// EvolutionAbilityUseEvent useEvent = new EvolutionAbilityUseEvent(player);
|
||||
// Bukkit.getServer().getPluginManager().callEvent(useEvent);
|
||||
//
|
||||
// if (useEvent.isCancelled())
|
||||
// {
|
||||
// event.setCancelled(true);
|
||||
//
|
||||
// Manager.getPlugin().getServer().getScheduler().scheduleSyncDelayedTask(Manager.getPlugin(), new Runnable()
|
||||
// {
|
||||
// @Override
|
||||
// public void run()
|
||||
// {
|
||||
// UtilInv.Update(player);
|
||||
// }
|
||||
// }, 10);
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
@ -1,60 +1,51 @@
|
||||
package nautilus.game.arcade.game.games.evolution.mobs;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.disguise.disguises.DisguiseSlime;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.game.games.evolution.EvoKit;
|
||||
import nautilus.game.arcade.game.games.evolution.mobs.perks.PerkBounceEVO;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
import nautilus.game.arcade.kit.perks.PerkFallModifier;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.disguise.disguises.DisguiseSlime;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
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.perks.PerkFallDamage;
|
||||
import nautilus.game.arcade.kit.perks.PerkLeap;
|
||||
|
||||
public class KitSlime extends Kit
|
||||
public class KitSlime extends EvoKit
|
||||
{
|
||||
/**
|
||||
* @author Mysticate
|
||||
*/
|
||||
|
||||
public KitSlime(ArcadeManager manager)
|
||||
{
|
||||
super(manager, "Slime", KitAvailability.Hide,
|
||||
|
||||
new String[]
|
||||
{
|
||||
""
|
||||
},
|
||||
|
||||
new Perk[]
|
||||
{
|
||||
new PerkLeap("Bounce", 2, 2, 8000),
|
||||
new PerkFallDamage(-40)
|
||||
},
|
||||
EntityType.SLIME,
|
||||
null);
|
||||
|
||||
super(manager, "Slime", new String[]
|
||||
{
|
||||
C.cYellow + "Ability: " + C.cWhite + "Slime Slam", C.Line,
|
||||
C.cGreen + "50% Fall Damage"
|
||||
}, 22, 4, new Perk[]
|
||||
{
|
||||
new PerkBounceEVO(), new PerkFallModifier(.5)
|
||||
}, EntityType.SLIME);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void GiveItems(Player player)
|
||||
protected void giveItems(Player player)
|
||||
{
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE));
|
||||
player.getInventory().setItem(0, new ItemBuilder(Material.SLIME_BALL).setTitle(C.cYellow + C.Bold + "Right Click" + C.cWhite + " - " + C.cGreen + C.Bold + "Slime Slam").build());
|
||||
|
||||
UtilPlayer.message(player, C.Line);
|
||||
UtilPlayer.message(player, C.Bold + "You evolved into " + F.elem(C.cGreen + C.Bold + GetName()) + "!");
|
||||
UtilPlayer.message(player, F.elem("Right-Click with Axe") + " to use " + F.elem("Bounce"));
|
||||
UtilPlayer.message(player, C.Line);
|
||||
|
||||
player.getWorld().playSound(player.getLocation(), Sound.SLIME_WALK, 4f, 1f);
|
||||
|
||||
//Disguise
|
||||
DisguiseSlime disguise = new DisguiseSlime(player);
|
||||
disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName());
|
||||
disguise.setCustomNameVisible(true);
|
||||
disguise.SetSize(3);
|
||||
disguise.SetSize(2);
|
||||
|
||||
Manager.GetDisguise().undisguise(player);
|
||||
Manager.GetDisguise().disguise(disguise);
|
||||
|
||||
player.getWorld().playSound(player.getLocation(), Sound.SLIME_WALK, 4f, 1f);
|
||||
}
|
||||
}
|
||||
|
@ -1,74 +1,110 @@
|
||||
package nautilus.game.arcade.game.games.evolution.mobs;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Snowball;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.disguise.disguises.DisguiseSnowman;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
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.perks.PerkConstructor;
|
||||
import nautilus.game.arcade.kit.perks.PerkFallDamage;
|
||||
|
||||
public class KitSnowman extends Kit
|
||||
public class KitSnowman
|
||||
//extends EvoKit
|
||||
{
|
||||
public KitSnowman(ArcadeManager manager)
|
||||
{
|
||||
super(manager, "Snowman", KitAvailability.Hide,
|
||||
|
||||
new String[]
|
||||
{
|
||||
""
|
||||
},
|
||||
|
||||
new Perk[]
|
||||
{
|
||||
new PerkConstructor("Snowballer", 0.5, 16, Material.SNOW_BALL, "Snowball", false),
|
||||
new PerkFallDamage(-2),
|
||||
},
|
||||
EntityType.SLIME,
|
||||
null);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void GiveItems(Player player)
|
||||
{
|
||||
UtilPlayer.message(player, C.Line);
|
||||
UtilPlayer.message(player, C.Bold + "You evolved into " + F.elem(C.cGreen + C.Bold + GetName()) + "!");
|
||||
UtilPlayer.message(player, F.elem("Right-Click with Snowball") + " to use " + F.elem("Throw Snowball"));
|
||||
UtilPlayer.message(player, C.Line);
|
||||
|
||||
player.getWorld().playSound(player.getLocation(), Sound.STEP_SNOW, 4f, 1f);
|
||||
|
||||
//Disguise
|
||||
DisguiseSnowman disguise = new DisguiseSnowman(player);
|
||||
disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName());
|
||||
disguise.setCustomNameVisible(true);
|
||||
Manager.GetDisguise().disguise(disguise);
|
||||
}
|
||||
/**
|
||||
* @author Mysticate
|
||||
*/
|
||||
|
||||
@EventHandler
|
||||
public void SnowballHit(CustomDamageEvent event)
|
||||
{
|
||||
if (event.IsCancelled())
|
||||
return;
|
||||
|
||||
if (event.GetProjectile() == null)
|
||||
return;
|
||||
|
||||
if (!(event.GetProjectile() instanceof Snowball))
|
||||
return;
|
||||
|
||||
event.AddMod("Snowman Kit", "Snowball", 3, true);
|
||||
}
|
||||
// public KitSnowman(ArcadeManager manager)
|
||||
// {
|
||||
// super(manager, "Snowman",
|
||||
// new String[]
|
||||
// {
|
||||
// F.elem("Right-Click with Snowball") + " to use " + F.elem("Throw Snowball")
|
||||
// },
|
||||
// new String[]
|
||||
// {
|
||||
// F.elem("Recieve ") + C.cWhite + "1 Snowball / 1 Second",
|
||||
// },
|
||||
// new Perk[]
|
||||
// {
|
||||
// new PerkConstructor("Snowballer", 1, 16, Material.SNOW_BALL, "Snowball", false)
|
||||
// }, EntityType.SNOWMAN);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void GiveItems(Player player)
|
||||
// {
|
||||
// player.getInventory().setHelmet(new ItemBuilder(Material.LEATHER_HELMET).build());
|
||||
// player.getInventory().setChestplate(new ItemBuilder(Material.LEATHER_CHESTPLATE).build());
|
||||
// player.getInventory().setLeggings(new ItemBuilder(Material.LEATHER_LEGGINGS).build());
|
||||
// player.getInventory().setBoots(new ItemBuilder(Material.IRON_BOOTS).build());
|
||||
//
|
||||
// player.getInventory().setItem(0, new ItemBuilder(Material.WOOD_SPADE).build());
|
||||
//
|
||||
// player.getWorld().playSound(player.getLocation(), Sound.STEP_SNOW, 4f, 1f);
|
||||
//
|
||||
// //Disguise
|
||||
// DisguiseSnowman disguise = new DisguiseSnowman(player);
|
||||
// disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName());
|
||||
// disguise.setCustomNameVisible(true);
|
||||
//
|
||||
// Manager.GetDisguise().undisguise(player);
|
||||
// Manager.GetDisguise().disguise(disguise);
|
||||
//
|
||||
// player.getInventory().setItem(8, new ItemBuilder(Material.COMPASS).setTitle(F.item("Tracking Compass")).build());
|
||||
// }
|
||||
//
|
||||
// @EventHandler
|
||||
// public void onInteract(final PlayerInteractEvent event)
|
||||
// {
|
||||
// if (!UtilEvent.isAction(event, ActionType.R))
|
||||
// return;
|
||||
//
|
||||
// if (!Manager.GetGame().IsLive())
|
||||
// return;
|
||||
//
|
||||
// if (!HasKit(event.getPlayer()))
|
||||
// return;
|
||||
//
|
||||
// if (!UtilGear.isMat(event.getItem(), Material.SNOW_BALL))
|
||||
// return;
|
||||
//
|
||||
// EvolutionAbilityUseEvent useEvent = new EvolutionAbilityUseEvent(event.getPlayer());
|
||||
// Bukkit.getServer().getPluginManager().callEvent(useEvent);
|
||||
//
|
||||
// if (useEvent.isCancelled())
|
||||
// {
|
||||
// event.setCancelled(true);
|
||||
//
|
||||
// Manager.getPlugin().getServer().getScheduler().scheduleSyncDelayedTask(Manager.getPlugin(), new Runnable()
|
||||
// {
|
||||
// @Override
|
||||
// public void run()
|
||||
// {
|
||||
// UtilInv.Update(event.getPlayer());
|
||||
// }
|
||||
// }, 10);
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @EventHandler
|
||||
// public void SnowballHit(CustomDamageEvent event)
|
||||
// {
|
||||
// if (!Manager.GetGame().IsLive())
|
||||
// return;
|
||||
//
|
||||
// if (!(event.GetDamagerEntity(true) instanceof Player))
|
||||
// return;
|
||||
//
|
||||
// Player player = event.GetDamagerPlayer(true);
|
||||
//
|
||||
// if (!Manager.IsAlive(player))
|
||||
// return;
|
||||
//
|
||||
// if (!HasKit(player))
|
||||
// return;
|
||||
//
|
||||
// if (event.GetProjectile() == null)
|
||||
// return;
|
||||
//
|
||||
// if (!(event.GetProjectile() instanceof Snowball))
|
||||
// return;
|
||||
//
|
||||
// event.AddMod("Snowman Kit", "Snowball", 3, true);
|
||||
// }
|
||||
}
|
||||
|
@ -1,57 +1,56 @@
|
||||
package nautilus.game.arcade.game.games.evolution.mobs;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.disguise.disguises.DisguiseSpider;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.game.games.evolution.EvoKit;
|
||||
import nautilus.game.arcade.game.games.evolution.mobs.perks.PerkWebEVO;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
import nautilus.game.arcade.kit.perks.PerkConstructor;
|
||||
import nautilus.game.arcade.kit.perks.PerkNoFallDamage;
|
||||
import nautilus.game.arcade.kit.perks.PerkSpeed;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.disguise.disguises.DisguiseSpider;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
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.perks.PerkWeb;
|
||||
|
||||
public class KitSpider extends Kit
|
||||
public class KitSpider extends EvoKit
|
||||
{
|
||||
/**
|
||||
* @author Mysticate
|
||||
*/
|
||||
|
||||
public KitSpider(ArcadeManager manager)
|
||||
{
|
||||
super(manager, "Spider", KitAvailability.Hide,
|
||||
|
||||
new String[]
|
||||
{
|
||||
""
|
||||
},
|
||||
|
||||
new Perk[]
|
||||
{
|
||||
new PerkWeb(2,8)
|
||||
},
|
||||
EntityType.SLIME,
|
||||
null);
|
||||
super(manager, "Spider", new String[]
|
||||
{
|
||||
C.cYellow + "Ability: " + C.cWhite + "Web Shot", C.Line,
|
||||
C.cGreen + "Speed 1", C.cGreen + "No Fall Damage"
|
||||
}, 32, 5, new Perk[]
|
||||
{
|
||||
new PerkWebEVO(),
|
||||
new PerkConstructor("Web Weaver", 3.0, 4, Material.WEB,
|
||||
"Spiderweb", false), new PerkSpeed(0),
|
||||
new PerkNoFallDamage()
|
||||
|
||||
}, EntityType.SPIDER);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void GiveItems(Player player)
|
||||
protected void giveItems(Player player)
|
||||
{
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.STONE_AXE));
|
||||
player.getInventory().setItem(0, new ItemBuilder(Material.SPIDER_EYE).setTitle(C.cYellow + C.Bold + "Right Click" + C.cWhite + " - " + C.cGreen + C.Bold + "Web Shot").build());
|
||||
|
||||
UtilPlayer.message(player, C.Line);
|
||||
UtilPlayer.message(player, C.Bold + "You evolved into " + F.elem(C.cGreen + C.Bold + GetName()) + "!");
|
||||
UtilPlayer.message(player, F.elem("Right-Click with Axe/Web") + " to use " + F.elem("Throw Web"));
|
||||
UtilPlayer.message(player, C.Line);
|
||||
|
||||
player.getWorld().playSound(player.getLocation(), Sound.SPIDER_IDLE, 4f, 1f);
|
||||
|
||||
//Disguise
|
||||
DisguiseSpider disguise = new DisguiseSpider(player);
|
||||
disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName());
|
||||
disguise.setCustomNameVisible(true);
|
||||
Manager.GetDisguise().disguise(disguise);
|
||||
|
||||
Manager.GetDisguise().undisguise(player);
|
||||
Manager.GetDisguise().disguise(disguise);
|
||||
}
|
||||
}
|
||||
|
@ -1,59 +1,51 @@
|
||||
package nautilus.game.arcade.game.games.evolution.mobs;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.disguise.disguises.DisguiseBat;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
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.perks.PerkLeap;
|
||||
import nautilus.game.arcade.kit.perks.PerkSpeed;
|
||||
|
||||
public class KitWolf extends Kit
|
||||
public class KitWolf
|
||||
//extends EvoKit
|
||||
{
|
||||
public KitWolf(ArcadeManager manager)
|
||||
{
|
||||
super(manager, "Wolf", KitAvailability.Hide,
|
||||
|
||||
new String[]
|
||||
{
|
||||
""
|
||||
},
|
||||
|
||||
new Perk[]
|
||||
{
|
||||
new PerkSpeed(2),
|
||||
new PerkLeap("Pounce", 1.2, 1, 4000)
|
||||
},
|
||||
EntityType.SLIME,
|
||||
null);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void GiveItems(Player player)
|
||||
{
|
||||
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.WOOD_AXE));
|
||||
|
||||
UtilPlayer.message(player, C.Line);
|
||||
UtilPlayer.message(player, C.Bold + "You evolved into " + F.elem(C.cGreen + C.Bold + GetName()) + "!");
|
||||
UtilPlayer.message(player, F.elem("Right-Click with Axe") + " to use " + F.elem("Pounce"));
|
||||
UtilPlayer.message(player, C.Line);
|
||||
|
||||
player.getWorld().playSound(player.getLocation(), Sound.WOLF_BARK, 4f, 1f);
|
||||
|
||||
//Disguise
|
||||
DisguiseBat disguise = new DisguiseBat(player);
|
||||
disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName());
|
||||
disguise.setCustomNameVisible(true);
|
||||
Manager.GetDisguise().disguise(disguise);
|
||||
}
|
||||
/**
|
||||
* @author Mysticate
|
||||
*/
|
||||
|
||||
// public KitWolf(ArcadeManager manager)
|
||||
// {
|
||||
// super(manager, "Wolf",
|
||||
// new String[]
|
||||
// {
|
||||
// F.elem("Right-Click with Axe") + " to use " + F.elem("Pounce")
|
||||
// },
|
||||
// new String[]
|
||||
// {
|
||||
// F.elem("Interact w/ Axe") + C.cWhite + " - " + F.elem("Pounce")
|
||||
// },
|
||||
// new Perk[]
|
||||
// {
|
||||
// new PerkSpeed(1),
|
||||
// new PerkPounceEVO()
|
||||
// }, EntityType.WOLF);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void GiveItems(Player player)
|
||||
// {
|
||||
// player.getInventory().setHelmet(new ItemBuilder(Material.CHAINMAIL_HELMET).build());
|
||||
// player.getInventory().setChestplate(new ItemBuilder(Material.CHAINMAIL_CHESTPLATE).build());
|
||||
// player.getInventory().setLeggings(new ItemBuilder(Material.CHAINMAIL_LEGGINGS).build());
|
||||
// player.getInventory().setBoots(new ItemBuilder(Material.IRON_BOOTS).build());
|
||||
//
|
||||
// player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.WOOD_AXE));
|
||||
//
|
||||
// player.getWorld().playSound(player.getLocation(), Sound.WOLF_BARK, 4f, 1f);
|
||||
//
|
||||
// //Disguise
|
||||
// DisguiseWolf disguise = new DisguiseWolf(player);
|
||||
// disguise.setName(Manager.GetGame().GetTeam(player).GetColor() + player.getName());
|
||||
// disguise.setCustomNameVisible(true);
|
||||
//
|
||||
// Manager.GetDisguise().undisguise(player);
|
||||
// Manager.GetDisguise().disguise(disguise);
|
||||
//
|
||||
// player.getInventory().setItem(8, new ItemBuilder(Material.COMPASS).setTitle(F.item("Tracking Compass")).build());
|
||||
// }
|
||||
}
|
||||
|
@ -0,0 +1,238 @@
|
||||
package nautilus.game.arcade.game.games.evolution.mobs.perks;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
||||
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.UtilEvent;
|
||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.projectile.IThrown;
|
||||
import mineplex.core.projectile.ProjectileUser;
|
||||
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.game.games.evolution.events.EvolutionAbilityUseEvent;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
import nautilus.game.arcade.kit.perks.data.BlockTossData;
|
||||
import nautilus.game.arcade.kit.perks.event.PerkBlockThrowEvent;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.FallingBlock;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.EntityChangeBlockEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
|
||||
public class PerkBlockTossEVO extends Perk implements IThrown
|
||||
{
|
||||
/**
|
||||
* @author Mysticate
|
||||
*/
|
||||
|
||||
private HashMap<Player, BlockTossData> _hold = new HashMap<Player, BlockTossData>();
|
||||
private HashMap<Player, Long> _charge = new HashMap<Player, Long>();
|
||||
private HashSet<Player> _charged = new HashSet<Player>();
|
||||
private HashMap<FallingBlock, Player> _falling = new HashMap<FallingBlock, Player>();
|
||||
|
||||
public PerkBlockTossEVO()
|
||||
{
|
||||
super("Block Toss", new String[]
|
||||
{
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@EventHandler
|
||||
public void Grab(PlayerInteractEvent event)
|
||||
{
|
||||
if (!Manager.GetGame().IsLive())
|
||||
return;
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (!UtilEvent.isAction(event, ActionType.R_BLOCK))
|
||||
return;
|
||||
|
||||
if (!Manager.IsAlive(player))
|
||||
return;
|
||||
|
||||
if (!Kit.HasKit(player))
|
||||
return;
|
||||
|
||||
EvolutionAbilityUseEvent useEvent = new EvolutionAbilityUseEvent(player, GetName(), 6000);
|
||||
Bukkit.getServer().getPluginManager().callEvent(useEvent);
|
||||
|
||||
if (useEvent.isCancelled())
|
||||
return;
|
||||
|
||||
if (!UtilInv.IsItem(event.getItem(), Material.IRON_SWORD, (byte) 0))
|
||||
return;
|
||||
|
||||
if (_hold.containsKey(player))
|
||||
return;
|
||||
|
||||
Block grab = event.getClickedBlock();
|
||||
|
||||
if (UtilBlock.usable(grab))
|
||||
return;
|
||||
|
||||
if (!UtilBlock.airFoliage(grab.getRelative(BlockFace.UP)) || Manager.GetBlockRestore().Contains(grab.getRelative(BlockFace.UP)))
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Game", "You may not pick up that block!"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!Recharge.Instance.use(event.getPlayer(), useEvent.getAbility(), useEvent.getCooldown(), true, true))
|
||||
return;
|
||||
|
||||
//Block to Data
|
||||
int id = grab.getTypeId();
|
||||
byte data = grab.getData();
|
||||
|
||||
//Remove Block
|
||||
//Manager.GetBlockRestore().Add(event.getClickedBlock(), 0, (byte)0, 10000);
|
||||
event.getClickedBlock().getWorld().playEffect(event.getClickedBlock().getLocation(), Effect.STEP_SOUND, event.getClickedBlock().getType());
|
||||
|
||||
_hold.put(player, new BlockTossData(id, data));
|
||||
|
||||
_charge.put(player, System.currentTimeMillis());
|
||||
|
||||
//Effect
|
||||
player.getWorld().playEffect(event.getClickedBlock().getLocation(), Effect.STEP_SOUND, id);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@EventHandler
|
||||
public void Throw(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
return;
|
||||
|
||||
HashSet<Player> throwSet = new HashSet<Player>();
|
||||
|
||||
for (Player cur : _hold.keySet())
|
||||
{
|
||||
//Throw
|
||||
if (!cur.isBlocking())
|
||||
throwSet.add(cur);
|
||||
|
||||
//Charged Tick
|
||||
if (!_charged.contains(cur))
|
||||
if (System.currentTimeMillis() - _charge.get(cur) > 1200)
|
||||
{
|
||||
_charged.add(cur);
|
||||
cur.playEffect(cur.getLocation(), Effect.CLICK1, 0);
|
||||
}
|
||||
}
|
||||
|
||||
for (Player cur : throwSet)
|
||||
{
|
||||
BlockTossData data = _hold.remove(cur);
|
||||
|
||||
FallingBlock block = cur.getWorld().spawnFallingBlock(cur.getEyeLocation().add(cur.getLocation().getDirection()), data.Type, data.Data);
|
||||
|
||||
_falling.put(block, cur);
|
||||
|
||||
_charged.remove(cur);
|
||||
|
||||
long charge = System.currentTimeMillis() - _charge.remove(cur);
|
||||
|
||||
//Throw
|
||||
double mult = 1.4;
|
||||
if (charge < 1200)
|
||||
mult = mult * ((double)charge/1200d);
|
||||
|
||||
//Action
|
||||
UtilAction.velocity(block, cur.getLocation().getDirection(), mult, false, 0.2, 0, 1, true);
|
||||
Manager.GetProjectile().AddThrow(block, cur, this, -1, true, true, true,
|
||||
null, 0, 0, null, 0, UpdateType.FASTEST, 1f);
|
||||
|
||||
//Event
|
||||
PerkBlockThrowEvent blockEvent = new PerkBlockThrowEvent(cur);
|
||||
UtilServer.getServer().getPluginManager().callEvent(blockEvent);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public void Collide(LivingEntity target, Block block, ProjectileUser data)
|
||||
{
|
||||
if (target == null)
|
||||
return;
|
||||
|
||||
//Damage Event
|
||||
Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null,
|
||||
DamageCause.PROJECTILE, data.GetThrown().getVelocity().length() * 4, true, true, false,
|
||||
UtilEnt.getName(data.GetThrower()), GetName());
|
||||
|
||||
//Block to Item
|
||||
if (data.GetThrown() instanceof FallingBlock)
|
||||
{
|
||||
FallingBlock thrown = (FallingBlock) data.GetThrown();
|
||||
|
||||
FallingBlock newThrown = data.GetThrown().getWorld().spawnFallingBlock(data.GetThrown().getLocation(), thrown.getMaterial(), (byte)0);
|
||||
|
||||
//Remove Old
|
||||
_falling.remove(thrown);
|
||||
thrown.remove();
|
||||
|
||||
//Add New
|
||||
if (data.GetThrower() instanceof Player)
|
||||
_falling.put(newThrown, (Player)data.GetThrower());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Idle(ProjectileUser data)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Expire(ProjectileUser data)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@EventHandler
|
||||
public void BlockForm(EntityChangeBlockEvent event)
|
||||
{
|
||||
if (!(event.getEntity() instanceof FallingBlock))
|
||||
return;
|
||||
|
||||
FallingBlock falling = (FallingBlock)event.getEntity();
|
||||
|
||||
falling.getWorld().playEffect(event.getBlock().getLocation(), Effect.STEP_SOUND, falling.getBlockId());
|
||||
|
||||
_falling.remove(falling);
|
||||
falling.remove();
|
||||
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void Knockback(CustomDamageEvent event)
|
||||
{
|
||||
if (event.GetReason() == null || !event.GetReason().contains(GetName()))
|
||||
return;
|
||||
|
||||
event.AddKnockback(GetName(), 2.5);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,181 @@
|
||||
package nautilus.game.arcade.game.games.evolution.mobs.perks;
|
||||
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilEvent;
|
||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
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.game.games.evolution.events.EvolutionAbilityUseEvent;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class PerkBounceEVO extends Perk
|
||||
{
|
||||
/**
|
||||
* @author Mysticate
|
||||
*/
|
||||
|
||||
private NautHashMap<LivingEntity, Long> _live = new NautHashMap<LivingEntity, Long>();
|
||||
|
||||
public PerkBounceEVO()
|
||||
{
|
||||
super("Slime Slam", new String[]
|
||||
{
|
||||
});
|
||||
}
|
||||
|
||||
//Literally just the slime slam code ;D
|
||||
@EventHandler
|
||||
public void Leap(PlayerInteractEvent event)
|
||||
{
|
||||
if (!Manager.GetGame().IsLive())
|
||||
return;
|
||||
|
||||
if (!UtilEvent.isAction(event, ActionType.R))
|
||||
return;
|
||||
|
||||
if (UtilBlock.usable(event.getClickedBlock()))
|
||||
return;
|
||||
|
||||
if (!UtilInv.IsItem(event.getItem(), Material.SLIME_BALL, (byte) 0))
|
||||
return;
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (!Kit.HasKit(player))
|
||||
return;
|
||||
|
||||
EvolutionAbilityUseEvent useEvent = new EvolutionAbilityUseEvent(player, GetName(), 7000);
|
||||
Bukkit.getServer().getPluginManager().callEvent(useEvent);
|
||||
|
||||
if (useEvent.isCancelled())
|
||||
return;
|
||||
|
||||
if (!Recharge.Instance.use(player, useEvent.getAbility(), useEvent.getCooldown(), true, true))
|
||||
return;
|
||||
|
||||
UtilAction.velocity(player, player.getLocation().getDirection(), 1.6, false, 0, 0.4, .4, true);
|
||||
|
||||
//Record
|
||||
_live.put(player, System.currentTimeMillis());
|
||||
|
||||
//Inform
|
||||
UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + "."));
|
||||
player.playSound(player.getLocation(), Sound.SLIME_WALK, 1, 1);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void collide(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
return;
|
||||
|
||||
if (!Manager.GetGame().IsLive())
|
||||
return;
|
||||
|
||||
//Collide
|
||||
for (Player player : Manager.GetGame().GetPlayers(true))
|
||||
{
|
||||
if (UtilPlayer.isSpectator(player))
|
||||
{
|
||||
_live.remove(player);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!_live.containsKey(player))
|
||||
continue;
|
||||
|
||||
for (Player cur : UtilPlayer.getNearby(player.getLocation(), 2.0))
|
||||
{
|
||||
if (!Manager.IsAlive(cur))
|
||||
continue;
|
||||
|
||||
if (UtilPlayer.isSpectator(cur))
|
||||
{
|
||||
_live.remove(player);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (cur == player)
|
||||
continue;
|
||||
|
||||
DoSlam(player, cur);
|
||||
_live.remove(player);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void end(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
return;
|
||||
|
||||
if (!Manager.GetGame().IsLive())
|
||||
return;
|
||||
|
||||
//End
|
||||
for (Player player : Manager.GetGame().GetPlayers(true))
|
||||
{
|
||||
if (UtilPlayer.isSpectator(player))
|
||||
continue;
|
||||
|
||||
if (!UtilEnt.isGrounded(player))
|
||||
continue;
|
||||
|
||||
if (!_live.containsKey(player))
|
||||
continue;
|
||||
|
||||
if (!UtilTime.elapsed(_live.get(player), 1000))
|
||||
continue;
|
||||
|
||||
_live.remove(player);
|
||||
}
|
||||
}
|
||||
|
||||
public void DoSlam(Player damager, LivingEntity damagee)
|
||||
{
|
||||
int damage = 8;
|
||||
|
||||
//Damage Event
|
||||
Manager.GetDamage().NewDamageEvent(damagee, damager, null,
|
||||
DamageCause.CUSTOM, damage, true, true, false,
|
||||
damager.getName(), GetName());
|
||||
|
||||
UtilAction.velocity(damager, new Vector());
|
||||
|
||||
//Inform
|
||||
UtilPlayer.message(damager, F.main("Game", "You hit " + F.name(UtilEnt.getName(damagee)) + " with " + F.skill(GetName()) + "."));
|
||||
UtilPlayer.message(damagee, F.main("Game", F.name(damager.getName()) + " hit you with " + F.skill(GetName()) + "."));
|
||||
|
||||
damager.playSound(damager.getLocation(), Sound.SLIME_ATTACK, 1, 1);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void Knockback(CustomDamageEvent event)
|
||||
{
|
||||
if (event.GetReason() == null || !event.GetReason().contains(GetName()))
|
||||
return;
|
||||
|
||||
event.AddKnockback(GetName(), 2);
|
||||
}
|
||||
}
|
@ -0,0 +1,137 @@
|
||||
package nautilus.game.arcade.game.games.evolution.mobs.perks;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
||||
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.recharge.Recharge;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.game.games.evolution.events.EvolutionAbilityUseEvent;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
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;
|
||||
|
||||
public class PerkDoubleJumpEVO extends Perk
|
||||
{
|
||||
private double _power;
|
||||
private double _heightMax;
|
||||
private boolean _control;
|
||||
private long _recharge;
|
||||
private boolean _displayForce;
|
||||
|
||||
private HashSet<Player> _disabled = new HashSet<Player>();
|
||||
|
||||
public PerkDoubleJumpEVO(String name, double power, double heightLimit, boolean control)
|
||||
{
|
||||
super(name, new String[0]);
|
||||
|
||||
_power = power;
|
||||
_heightMax = heightLimit;
|
||||
_control = control;
|
||||
_recharge = 0;
|
||||
_displayForce = false;
|
||||
}
|
||||
|
||||
public PerkDoubleJumpEVO(String name, double power, double heightLimit, boolean control, long recharge, boolean displayForce)
|
||||
{
|
||||
super(name, new String[0]);
|
||||
|
||||
_power = power;
|
||||
_heightMax = heightLimit;
|
||||
_control = control;
|
||||
_recharge = recharge;
|
||||
_displayForce = displayForce;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void FlightHop(PlayerToggleFlightEvent event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (!Kit.HasKit(player))
|
||||
return;
|
||||
|
||||
if (Manager.isSpectator(player))
|
||||
return;
|
||||
|
||||
if (player.getGameMode() == GameMode.CREATIVE)
|
||||
return;
|
||||
|
||||
EvolutionAbilityUseEvent useEvent = new EvolutionAbilityUseEvent(player, GetName(), 0);
|
||||
Bukkit.getServer().getPluginManager().callEvent(useEvent);
|
||||
|
||||
if (useEvent.isCancelled())
|
||||
return;
|
||||
|
||||
event.setCancelled(true);
|
||||
player.setFlying(false);
|
||||
|
||||
//Disable Flight
|
||||
player.setAllowFlight(false);
|
||||
|
||||
//Velocity
|
||||
if (_control)
|
||||
{
|
||||
UtilAction.velocity(player, _power, 0.2, _heightMax, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
UtilAction.velocity(player, player.getLocation().getDirection(), _power, true, _power, 0, _heightMax, true);
|
||||
}
|
||||
|
||||
//Sound
|
||||
player.getWorld().playEffect(player.getLocation(), Effect.BLAZE_SHOOT, 0);
|
||||
|
||||
//Recharge
|
||||
if (_recharge > 0)
|
||||
{
|
||||
Recharge.Instance.useForce(player, GetName(), _recharge);
|
||||
|
||||
if (_displayForce)
|
||||
{
|
||||
Recharge.Instance.setDisplayForce(player, GetName(), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void FlightUpdate(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
return;
|
||||
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
{
|
||||
if (Manager.isSpectator(player))
|
||||
continue;
|
||||
|
||||
if (!Kit.HasKit(player))
|
||||
continue;
|
||||
|
||||
if (_recharge > 0 && !Recharge.Instance.usable(player, GetName()))
|
||||
continue;
|
||||
|
||||
if (UtilEnt.isGrounded(player) || UtilBlock.solid(player.getLocation().getBlock().getRelative(BlockFace.DOWN)))
|
||||
player.setAllowFlight(true);
|
||||
}
|
||||
}
|
||||
|
||||
public void disableForPlayer(Player player)
|
||||
{
|
||||
_disabled.add(player);
|
||||
}
|
||||
|
||||
public void enableForPlayer(Player player)
|
||||
{
|
||||
_disabled.remove(player);
|
||||
}
|
||||
}
|
@ -0,0 +1,139 @@
|
||||
package nautilus.game.arcade.game.games.evolution.mobs.perks;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.common.util.UtilEvent;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
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.game.games.evolution.events.EvolutionAbilityUseEvent;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
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.player.PlayerInteractEvent;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class PerkFlamingSwordEVO extends Perk
|
||||
{
|
||||
/**
|
||||
* @author Mysticate
|
||||
*/
|
||||
|
||||
private NautHashMap<Player, Long> _active = new NautHashMap<Player, Long>();
|
||||
|
||||
public PerkFlamingSwordEVO()
|
||||
{
|
||||
super("Flamethrower", new String[]
|
||||
{
|
||||
C.cYellow + "Block" + C.cGray + " to use " + C.cGreen + "Flamethrower"
|
||||
});
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onInteract(PlayerInteractEvent event)
|
||||
{
|
||||
if (!UtilEvent.isAction(event, ActionType.R))
|
||||
return;
|
||||
|
||||
if (!Manager.GetGame().IsLive())
|
||||
return;
|
||||
|
||||
if (!UtilInv.IsItem(event.getItem(), Material.BLAZE_ROD, (byte) 0))
|
||||
return;
|
||||
|
||||
if (!Manager.IsAlive(event.getPlayer()))
|
||||
return;
|
||||
|
||||
if (_active.containsKey(event.getPlayer()))
|
||||
return;
|
||||
|
||||
EvolutionAbilityUseEvent useEvent = new EvolutionAbilityUseEvent(event.getPlayer(), GetName(), 5000);
|
||||
Bukkit.getServer().getPluginManager().callEvent(useEvent);
|
||||
|
||||
if (useEvent.isCancelled())
|
||||
return;
|
||||
|
||||
if (!Recharge.Instance.use(event.getPlayer(), useEvent.getAbility(), useEvent.getCooldown(), true, true))
|
||||
return;
|
||||
|
||||
_active.put(event.getPlayer(), System.currentTimeMillis());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void update(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
return;
|
||||
|
||||
if (!Manager.GetGame().IsLive())
|
||||
return;
|
||||
|
||||
Iterator<Entry<Player, Long>> iterator = _active.entrySet().iterator();
|
||||
while (iterator.hasNext())
|
||||
{
|
||||
Entry<Player, Long> entry = iterator.next();
|
||||
|
||||
if (entry.getKey() == null || !entry.getKey().isOnline())
|
||||
{
|
||||
iterator.remove();
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!Manager.IsAlive(entry.getKey()))
|
||||
{
|
||||
iterator.remove();
|
||||
continue;
|
||||
}
|
||||
|
||||
if (UtilPlayer.isSpectator(entry.getKey()))
|
||||
{
|
||||
iterator.remove();
|
||||
continue;
|
||||
}
|
||||
|
||||
if (UtilTime.elapsed(entry.getValue(), 1000))
|
||||
{
|
||||
iterator.remove();
|
||||
continue;
|
||||
}
|
||||
|
||||
EvolutionAbilityUseEvent useEvent = new EvolutionAbilityUseEvent(entry.getKey(), GetName(), 0);
|
||||
Bukkit.getServer().getPluginManager().callEvent(useEvent);
|
||||
|
||||
if (useEvent.isCancelled())
|
||||
continue;
|
||||
|
||||
flame(entry.getKey());
|
||||
}
|
||||
}
|
||||
|
||||
private void flame(Player player)
|
||||
{
|
||||
//Fire
|
||||
Item fire = player.getWorld().dropItem(player.getEyeLocation(), ItemStackFactory.Instance.CreateStack(Material.BLAZE_POWDER));
|
||||
Manager.GetFire().Add(fire, player, 0.7, 0, 0.5, 1.5, "Inferno");
|
||||
|
||||
fire.teleport(player.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(player.getLocation().getDirection().add(new Vector(x,y,z)).multiply(1.6));
|
||||
|
||||
//Effect
|
||||
player.getWorld().playSound(player.getLocation(), Sound.GHAST_FIREBALL, 0.1f, 1f);
|
||||
}
|
||||
}
|
@ -0,0 +1,162 @@
|
||||
package nautilus.game.arcade.game.games.evolution.mobs.perks;
|
||||
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilEvent;
|
||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
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.game.games.evolution.events.EvolutionAbilityUseEvent;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class PerkPounceEVO extends Perk
|
||||
{
|
||||
/**
|
||||
* @author Mysticate
|
||||
*/
|
||||
|
||||
private NautHashMap<LivingEntity, Long> _live = new NautHashMap<LivingEntity, Long>();
|
||||
|
||||
public PerkPounceEVO()
|
||||
{
|
||||
super("Pounce", new String[]
|
||||
{
|
||||
});
|
||||
}
|
||||
|
||||
//Literally just the slime slam code ;D
|
||||
@EventHandler
|
||||
public void Leap(PlayerInteractEvent event)
|
||||
{
|
||||
if (!Manager.GetGame().IsLive())
|
||||
return;
|
||||
|
||||
if (!UtilEvent.isAction(event, ActionType.R))
|
||||
return;
|
||||
|
||||
if (UtilBlock.usable(event.getClickedBlock()))
|
||||
return;
|
||||
|
||||
if (!UtilInv.IsItem(event.getItem(), Material.WOOD_AXE, (byte) 0))
|
||||
return;
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (!Kit.HasKit(player))
|
||||
return;
|
||||
|
||||
EvolutionAbilityUseEvent useEvent = new EvolutionAbilityUseEvent(player, GetName(), 6000);
|
||||
Bukkit.getServer().getPluginManager().callEvent(useEvent);
|
||||
|
||||
if (useEvent.isCancelled())
|
||||
return;
|
||||
|
||||
if (!Recharge.Instance.use(player, useEvent.getAbility(), useEvent.getCooldown(), true, true))
|
||||
return;
|
||||
|
||||
UtilAction.velocity(player, player.getLocation().getDirection(), 1.4, false, 0, 0.3, 1.8, false);
|
||||
|
||||
//Record
|
||||
_live.put(player, System.currentTimeMillis());
|
||||
|
||||
//Inform
|
||||
UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + "."));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void collide(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
return;
|
||||
|
||||
if (!Manager.GetGame().IsLive())
|
||||
return;
|
||||
|
||||
//Collide
|
||||
for (Player player : Manager.GetGame().GetPlayers(true))
|
||||
{
|
||||
if (!_live.containsKey(player))
|
||||
continue;
|
||||
|
||||
for (Player cur : UtilPlayer.getNearby(player.getLocation(), 2.0))
|
||||
{
|
||||
if (!Manager.IsAlive(cur))
|
||||
continue;
|
||||
|
||||
if (cur == player)
|
||||
continue;
|
||||
|
||||
DoSlam(player, cur);
|
||||
_live.remove(player);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void end(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
return;
|
||||
|
||||
if (!Manager.GetGame().IsLive())
|
||||
return;
|
||||
|
||||
//End
|
||||
for (Player player : Manager.GetGame().GetPlayers(true))
|
||||
{
|
||||
if (!UtilEnt.isGrounded(player))
|
||||
continue;
|
||||
|
||||
if (!_live.containsKey(player))
|
||||
continue;
|
||||
|
||||
if (!UtilTime.elapsed(_live.get(player), 1000))
|
||||
continue;
|
||||
|
||||
_live.remove(player);
|
||||
}
|
||||
}
|
||||
|
||||
public void DoSlam(Player damager, LivingEntity damagee)
|
||||
{
|
||||
int damage = 6;
|
||||
|
||||
//Damage Event
|
||||
Manager.GetDamage().NewDamageEvent(damagee, damager, null,
|
||||
DamageCause.CUSTOM, damage, true, true, false,
|
||||
damager.getName(), GetName());
|
||||
|
||||
UtilAction.velocity(damager, new Vector());
|
||||
|
||||
//Inform
|
||||
UtilPlayer.message(damager, F.main("Game", "You hit " + F.name(UtilEnt.getName(damagee)) + " with " + F.skill(GetName()) + "."));
|
||||
UtilPlayer.message(damagee, F.main("Game", F.name(damager.getName()) + " hit you with " + F.skill(GetName()) + "."));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void Knockback(CustomDamageEvent event)
|
||||
{
|
||||
if (event.GetReason() == null || !event.GetReason().contains(GetName()))
|
||||
return;
|
||||
|
||||
event.AddKnockback(GetName(), .5);
|
||||
}
|
||||
}
|
@ -0,0 +1,172 @@
|
||||
package nautilus.game.arcade.game.games.evolution.mobs.perks;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilEvent;
|
||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
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.game.games.evolution.events.EvolutionAbilityUseEvent;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class PerkSiesmicSlamEVO extends Perk
|
||||
{
|
||||
/**
|
||||
* @author Mysticate
|
||||
*/
|
||||
|
||||
private HashMap<LivingEntity, Long> _live = new HashMap<LivingEntity, Long>();
|
||||
|
||||
public PerkSiesmicSlamEVO()
|
||||
{
|
||||
super("Seismic Slam", new String[0]);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void deactivateDeath(PlayerDeathEvent event)
|
||||
{
|
||||
if (!Manager.GetGame().IsLive())
|
||||
return;
|
||||
|
||||
if (!Kit.HasKit(event.getEntity()))
|
||||
return;
|
||||
|
||||
if (_live.containsKey(event.getEntity()))
|
||||
{
|
||||
_live.remove(event.getEntity());
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void Leap(PlayerInteractEvent event)
|
||||
{
|
||||
if (event.isCancelled())
|
||||
return;
|
||||
|
||||
if (!Manager.GetGame().IsLive())
|
||||
return;
|
||||
|
||||
if (!UtilEvent.isAction(event, ActionType.R))
|
||||
return;
|
||||
|
||||
if (!UtilInv.IsItem(event.getItem(), Material.IRON_INGOT, (byte) 0))
|
||||
return;
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (!Kit.HasKit(player))
|
||||
return;
|
||||
|
||||
EvolutionAbilityUseEvent useEvent = new EvolutionAbilityUseEvent(player, GetName(), 7000);
|
||||
Bukkit.getServer().getPluginManager().callEvent(useEvent);
|
||||
|
||||
if (useEvent.isCancelled())
|
||||
return;
|
||||
|
||||
if (!Recharge.Instance.use(player, useEvent.getAbility(), useEvent.getCooldown(), true, true))
|
||||
return;
|
||||
|
||||
//Action
|
||||
Vector vec = player.getLocation().getDirection();
|
||||
if (vec.getY() < 0)
|
||||
vec.setY(vec.getY() * -1);
|
||||
|
||||
UtilAction.velocity(player, vec, 1, true, 1, 0, 1, true);
|
||||
|
||||
//Record
|
||||
_live.put(player, System.currentTimeMillis());
|
||||
|
||||
//Inform
|
||||
UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + "."));
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@EventHandler
|
||||
public void Slam(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
return;
|
||||
|
||||
if (!Manager.GetGame().IsLive())
|
||||
return;
|
||||
|
||||
for (Player player : Manager.GetGame().GetPlayers(true))
|
||||
{
|
||||
if (!_live.containsKey(player))
|
||||
continue;
|
||||
|
||||
if (UtilPlayer.isSpectator(player))
|
||||
{
|
||||
_live.remove(player);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!player.isOnGround())
|
||||
continue;
|
||||
|
||||
if (!UtilTime.elapsed(_live.get(player), 1000))
|
||||
continue;
|
||||
|
||||
_live.remove(player);
|
||||
|
||||
//Action
|
||||
int damage = 16;
|
||||
double range = 6;
|
||||
|
||||
HashMap<Player, Double> targets = UtilPlayer.getInRadius(player.getLocation(), range);
|
||||
for (Player cur : targets.keySet())
|
||||
{
|
||||
if (cur == player)
|
||||
continue;
|
||||
|
||||
if (!Manager.IsAlive((Player) cur))
|
||||
continue;
|
||||
|
||||
//Damage Event
|
||||
Manager.GetDamage().NewDamageEvent(cur, player, null,
|
||||
DamageCause.CUSTOM, damage * targets.get(cur) + 0.5, true, true, false,
|
||||
player.getName(), GetName());
|
||||
|
||||
//Condition
|
||||
Manager.GetCondition().Factory().Falling(GetName(), cur, player, 10, false, true);
|
||||
}
|
||||
|
||||
//Effect
|
||||
player.getWorld().playSound(player.getLocation(), Sound.ZOMBIE_WOOD, 2f, 0.2f);
|
||||
for (Block cur : UtilBlock.getInRadius(player.getLocation(), range).keySet())
|
||||
if (UtilBlock.airFoliage(cur.getRelative(BlockFace.UP)) && !UtilBlock.airFoliage(cur))
|
||||
cur.getWorld().playEffect(cur.getLocation(), Effect.STEP_SOUND, cur.getTypeId());
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void Knockback(CustomDamageEvent event)
|
||||
{
|
||||
if (event.GetReason() == null || !event.GetReason().contains(GetName()))
|
||||
return;
|
||||
|
||||
event.AddKnockback(GetName(), 2.4);
|
||||
}
|
||||
}
|
@ -0,0 +1,135 @@
|
||||
package nautilus.game.arcade.game.games.evolution.mobs.perks;
|
||||
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilEvent;
|
||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.core.projectile.IThrown;
|
||||
import mineplex.core.projectile.ProjectileUser;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.game.games.evolution.events.EvolutionAbilityUseEvent;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Item;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
|
||||
public class PerkSulphurBombEVO extends Perk implements IThrown
|
||||
{
|
||||
/**
|
||||
* @author Mysticate
|
||||
*/
|
||||
|
||||
public PerkSulphurBombEVO()
|
||||
{
|
||||
super("Sulphur Bomb", new String[]
|
||||
{
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void fire(PlayerInteractEvent event)
|
||||
{
|
||||
if (event.isCancelled())
|
||||
return;
|
||||
|
||||
if (!UtilEvent.isAction(event, ActionType.R))
|
||||
return;
|
||||
|
||||
if (!UtilInv.IsItem(event.getItem(), Material.SULPHUR, (byte) 0))
|
||||
return;
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (!Kit.HasKit(player))
|
||||
return;
|
||||
|
||||
EvolutionAbilityUseEvent useEvent = new EvolutionAbilityUseEvent(player, GetName(), 3000);
|
||||
Bukkit.getServer().getPluginManager().callEvent(useEvent);
|
||||
|
||||
if (useEvent.isCancelled())
|
||||
return;
|
||||
|
||||
if (!Recharge.Instance.use(player, useEvent.getAbility(), useEvent.getCooldown(), true, true))
|
||||
return;
|
||||
|
||||
event.setCancelled(true);
|
||||
|
||||
Item ent = player.getWorld().dropItem(player.getEyeLocation(), ItemStackFactory.Instance.CreateStack(Material.COAL, (byte)0));
|
||||
|
||||
UtilAction.velocity(ent, player.getLocation().getDirection(), 1, false, 0, 0.2, 10, false);
|
||||
|
||||
Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true,
|
||||
null, 1f, 1f,
|
||||
null, 1, UpdateType.SLOW,
|
||||
1f);
|
||||
|
||||
//Inform
|
||||
UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + "."));
|
||||
|
||||
//Effect
|
||||
player.getWorld().playSound(player.getLocation(), Sound.CREEPER_DEATH, 2f, 1.5f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Collide(LivingEntity target, Block block, ProjectileUser data)
|
||||
{
|
||||
Explode(data);
|
||||
|
||||
if (target == null)
|
||||
return;
|
||||
|
||||
//Damage Event
|
||||
Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null,
|
||||
DamageCause.PROJECTILE, 5, true, true, false,
|
||||
UtilEnt.getName(data.GetThrower()), GetName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Idle(ProjectileUser data)
|
||||
{
|
||||
Explode(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Expire(ProjectileUser data)
|
||||
{
|
||||
Explode(data);
|
||||
}
|
||||
|
||||
public void Explode(ProjectileUser data)
|
||||
{
|
||||
UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, data.GetThrown().getLocation(), 0, 0, 0, 0, 1,
|
||||
ViewDist.MAX, UtilServer.getPlayers());
|
||||
data.GetThrown().getWorld().playSound(data.GetThrown().getLocation(), Sound.EXPLODE, 1f, 1.5f);
|
||||
data.GetThrown().remove();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void Knockback(CustomDamageEvent event)
|
||||
{
|
||||
if (event.GetReason() == null || !event.GetReason().contains(GetName()))
|
||||
return;
|
||||
|
||||
event.AddKnockback(GetName(), 1.5);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,116 @@
|
||||
package nautilus.game.arcade.game.games.evolution.mobs.perks;
|
||||
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilEvent;
|
||||
import mineplex.core.common.util.UtilEvent.ActionType;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.core.projectile.IThrown;
|
||||
import mineplex.core.projectile.ProjectileUser;
|
||||
import nautilus.game.arcade.game.games.evolution.events.EvolutionAbilityUseEvent;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.EntityEffect;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Item;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
|
||||
public class PerkWebEVO extends Perk implements IThrown
|
||||
{
|
||||
/**
|
||||
* @author Mysticate
|
||||
*/
|
||||
|
||||
public PerkWebEVO()
|
||||
{
|
||||
super("Web Shot", new String[0]);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void Throw(PlayerInteractEvent event)
|
||||
{
|
||||
if (!UtilEvent.isAction(event, ActionType.R))
|
||||
return;
|
||||
|
||||
if (!Manager.GetGame().IsLive())
|
||||
return;
|
||||
|
||||
if (!Manager.IsAlive(event.getPlayer()))
|
||||
return;
|
||||
|
||||
if (!UtilInv.contains(event.getPlayer(), Material.WEB, (byte) 0, 1))
|
||||
return;
|
||||
|
||||
if (!UtilInv.IsItem(event.getItem(), Material.SPIDER_EYE, (byte) 0))
|
||||
return;
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (!Kit.HasKit(player))
|
||||
return;
|
||||
|
||||
EvolutionAbilityUseEvent useEvent = new EvolutionAbilityUseEvent(player, GetName(), 0);
|
||||
Bukkit.getServer().getPluginManager().callEvent(useEvent);
|
||||
|
||||
if (useEvent.isCancelled())
|
||||
return;
|
||||
|
||||
event.setCancelled(true);
|
||||
|
||||
UtilInv.remove(player, Material.WEB, (byte) 0, 1);
|
||||
UtilInv.Update(player);
|
||||
|
||||
Item ent = player.getWorld().dropItem(player.getEyeLocation(), ItemStackFactory.Instance.CreateStack(Material.WEB));
|
||||
UtilAction.velocity(ent, player.getLocation().getDirection(), 0.8, false, 0, 0.2, 10, false);
|
||||
Manager.GetProjectile().AddThrow(ent, player, this, -1, true, true, true, false, 1f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Collide(LivingEntity target, Block block, ProjectileUser data)
|
||||
{
|
||||
if (target != null)
|
||||
{
|
||||
if (target instanceof Player)
|
||||
{
|
||||
if (Manager.GetGame().IsAlive((Player)target))
|
||||
{
|
||||
Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null, DamageCause.CUSTOM, 8, false, false, false, "Web Shot", "Webbed Net");
|
||||
target.playEffect(EntityEffect.HURT);
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Web(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Idle(ProjectileUser data)
|
||||
{
|
||||
Web(data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Expire(ProjectileUser data)
|
||||
{
|
||||
Web(data);
|
||||
}
|
||||
|
||||
public void Web(ProjectileUser data)
|
||||
{
|
||||
Location loc = data.GetThrown().getLocation();
|
||||
data.GetThrown().remove();
|
||||
|
||||
Manager.GetBlockRestore().Add(loc.getBlock(), 30, (byte)0, 4000);
|
||||
}
|
||||
}
|
@ -0,0 +1,60 @@
|
||||
package nautilus.game.arcade.game.games.evolution.trackers;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.game.Game.GameState;
|
||||
import nautilus.game.arcade.game.games.evolution.Evolution;
|
||||
import nautilus.game.arcade.stats.StatTracker;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
|
||||
public class EvoWinWithoutDyingTracker extends StatTracker<Evolution>
|
||||
{
|
||||
private ArrayList<String> _out = new ArrayList<String>();
|
||||
|
||||
public EvoWinWithoutDyingTracker(Evolution evo)
|
||||
{
|
||||
super(evo);
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true, priority = EventPriority.MONITOR)
|
||||
public void onCombatDeath(CombatDeathEvent event)
|
||||
{
|
||||
if (!getGame().IsLive())
|
||||
return;
|
||||
|
||||
if (event.GetLog().GetPlayer() == null)
|
||||
return;
|
||||
|
||||
if (!event.GetLog().GetPlayer().IsPlayer())
|
||||
return;
|
||||
|
||||
Player player = UtilPlayer.searchExact(event.GetLog().GetPlayer().GetName());
|
||||
if (player == null || !player.isOnline())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_out.add(player.getName());
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onGameStateChange(GameStateChangeEvent event)
|
||||
{
|
||||
if (event.GetState() != GameState.End)
|
||||
return;
|
||||
|
||||
if (getGame().Winner == null)
|
||||
return;
|
||||
|
||||
if (_out.contains(getGame().Winner.getName()))
|
||||
return;
|
||||
|
||||
addStat(getGame().Winner, "NoDeaths", 1, true, false);
|
||||
}
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package nautilus.game.arcade.game.games.evolution.trackers;
|
||||
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
|
||||
import nautilus.game.arcade.game.games.evolution.Evolution;
|
||||
import nautilus.game.arcade.stats.StatTracker;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
||||
public class KillsWhileEvolvingTracker extends StatTracker<Evolution>
|
||||
{
|
||||
/**
|
||||
* @author Mysticate
|
||||
*/
|
||||
|
||||
public KillsWhileEvolvingTracker(Evolution game)
|
||||
{
|
||||
super(game);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onDamage(CombatDeathEvent event)
|
||||
{
|
||||
if (!getGame().IsLive())
|
||||
return;
|
||||
|
||||
Player damagee = UtilPlayer.searchExact(event.GetLog().GetPlayer().GetName());
|
||||
Player damager = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName());
|
||||
if (damagee == null || damager == null)
|
||||
return;
|
||||
|
||||
if (!getGame().IsAlive(damagee) || !getGame().IsAlive(damager))
|
||||
return;
|
||||
|
||||
if (getGame().isAttemptingEvolve(damagee))
|
||||
addStat(damager, "EvolveKill", 1, false, false);
|
||||
}
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
package nautilus.game.arcade.game.games.evolution.trackers;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.game.Game.GameState;
|
||||
import nautilus.game.arcade.game.games.evolution.Evolution;
|
||||
import nautilus.game.arcade.game.games.evolution.events.EvolutionAbilityUseEvent;
|
||||
import nautilus.game.arcade.stats.StatTracker;
|
||||
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
|
||||
public class NoAbilityTracker extends StatTracker<Evolution>
|
||||
{
|
||||
/**
|
||||
* @author Mysticate
|
||||
*/
|
||||
|
||||
private ArrayList<String> _out = new ArrayList<String>();
|
||||
|
||||
public NoAbilityTracker(Evolution game)
|
||||
{
|
||||
super(game);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onEvolutionAbility(EvolutionAbilityUseEvent event)
|
||||
{
|
||||
if (!getGame().IsLive())
|
||||
return;
|
||||
|
||||
if (!getGame().IsAlive(event.getPlayer()))
|
||||
return;
|
||||
|
||||
if (!_out.contains(event.getPlayer().getName()))
|
||||
_out.add(event.getPlayer().getName());
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onGameStateChange(GameStateChangeEvent event)
|
||||
{
|
||||
if (event.GetState() != GameState.End)
|
||||
return;
|
||||
|
||||
if (getGame().Winner == null)
|
||||
return;
|
||||
|
||||
if (_out.contains(getGame().Winner.getName()))
|
||||
return;
|
||||
|
||||
addStat(getGame().Winner, "MeleeOnly", 1, true, false);
|
||||
}
|
||||
}
|
@ -0,0 +1,68 @@
|
||||
package nautilus.game.arcade.game.games.evolution.trackers;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.game.Game.GameState;
|
||||
import nautilus.game.arcade.game.games.evolution.Evolution;
|
||||
import nautilus.game.arcade.stats.StatTracker;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
|
||||
public class NoDamageWhileEvolvingTracker extends StatTracker<Evolution>
|
||||
{
|
||||
/**
|
||||
* @author Mysticate
|
||||
*/
|
||||
|
||||
private ArrayList<String> _out = new ArrayList<String>();
|
||||
|
||||
public NoDamageWhileEvolvingTracker(Evolution game)
|
||||
{
|
||||
super(game);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onDamage(CustomDamageEvent event)
|
||||
{
|
||||
if (!getGame().IsLive())
|
||||
return;
|
||||
|
||||
Player player = event.GetDamageePlayer();
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
if (!getGame().IsAlive(player))
|
||||
return;
|
||||
|
||||
if (getGame().isAttemptingEvolve(player))
|
||||
{
|
||||
if (!_out.contains(player.getName()))
|
||||
_out.add(player.getName());
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onGameStateChange(GameStateChangeEvent event)
|
||||
{
|
||||
if (event.GetState() != GameState.End)
|
||||
return;
|
||||
|
||||
List<Player> winners = getGame().getWinners();
|
||||
|
||||
if (winners == null)
|
||||
return;
|
||||
|
||||
for (Player winner : winners)
|
||||
{
|
||||
if (_out.contains(winner.getName()))
|
||||
continue;
|
||||
|
||||
addStat(winner, "Stealth", 1, true, false);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
package nautilus.game.arcade.game.games.evolution.trackers;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.game.Game.GameState;
|
||||
import nautilus.game.arcade.game.games.evolution.Evolution;
|
||||
import nautilus.game.arcade.stats.StatTracker;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
|
||||
public class NoMeleeTracker extends StatTracker<Evolution>
|
||||
{
|
||||
/**
|
||||
* @author Mysticate
|
||||
*/
|
||||
|
||||
private ArrayList<String> _out = new ArrayList<String>();
|
||||
|
||||
public NoMeleeTracker(Evolution game)
|
||||
{
|
||||
super(game);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onDamage(CustomDamageEvent event)
|
||||
{
|
||||
if (!getGame().IsLive())
|
||||
return;
|
||||
|
||||
Player player = event.GetDamagerPlayer(false);
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
if (!getGame().IsAlive(player))
|
||||
return;
|
||||
|
||||
if (event.GetReason() == null || event.GetReason().trim().equals("") || event.GetReason().contains("Attack"))
|
||||
{
|
||||
if (!_out.contains(player.getName()))
|
||||
_out.add(player.getName());
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onGameStateChange(GameStateChangeEvent event)
|
||||
{
|
||||
if (event.GetState() != GameState.End)
|
||||
return;
|
||||
|
||||
if (getGame().Winner == null)
|
||||
return;
|
||||
|
||||
if (_out.contains(getGame().Winner.getName()))
|
||||
return;
|
||||
|
||||
addStat(getGame().Winner, "AbilityOnly", 1, true, false);
|
||||
}
|
||||
}
|
@ -1,13 +1,14 @@
|
||||
package nautilus.game.arcade.gui.spectatorMenu;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.common.CurrencyType;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.shop.ShopBase;
|
||||
import mineplex.core.shop.page.ShopPageBase;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.addons.CompassAddon;
|
||||
import nautilus.game.arcade.addons.compass.CompassAddon;
|
||||
import nautilus.game.arcade.gui.spectatorMenu.page.SpectatorPage;
|
||||
|
||||
/**
|
||||
|
@ -21,7 +21,7 @@ import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.shop.item.ShopItem;
|
||||
import mineplex.core.shop.page.ShopPageBase;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.addons.CompassAddon;
|
||||
import nautilus.game.arcade.addons.compass.CompassAddon;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.gui.spectatorMenu.SpectatorShop;
|
||||
import nautilus.game.arcade.gui.spectatorMenu.button.SpectatorButton;
|
||||
|
@ -2,15 +2,6 @@ package nautilus.game.arcade.kit.perks;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.player.PlayerDropItemEvent;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
@ -18,10 +9,20 @@ import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
import nautilus.game.arcade.kit.perks.event.PerkConstructorEvent;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.player.PlayerDropItemEvent;
|
||||
|
||||
public class PerkConstructor extends Perk
|
||||
{
|
||||
@ -71,6 +72,12 @@ public class PerkConstructor extends Perk
|
||||
if (UtilInv.contains(cur, _type, (byte)0, _max))
|
||||
continue;
|
||||
|
||||
PerkConstructorEvent cE = new PerkConstructorEvent(cur);
|
||||
Bukkit.getServer().getPluginManager().callEvent(cE);
|
||||
|
||||
if (cE.isCancelled())
|
||||
continue;
|
||||
|
||||
//Add
|
||||
byte data = 0;
|
||||
if (_type == Material.WOOL)
|
||||
@ -83,7 +90,7 @@ public class PerkConstructor extends Perk
|
||||
continue;
|
||||
|
||||
cur.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.WOOL, team.GetColorData(), 1));
|
||||
return;
|
||||
continue;
|
||||
}
|
||||
|
||||
cur.getInventory().addItem(ItemStackFactory.Instance.CreateStack(_type, data, 1, F.item(_name)));
|
||||
|
@ -0,0 +1,45 @@
|
||||
|
||||
package nautilus.game.arcade.kit.perks;
|
||||
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
|
||||
public class PerkExplosionModifier extends Perk
|
||||
{
|
||||
private double _explosion;
|
||||
|
||||
public PerkExplosionModifier(double explosion)
|
||||
{
|
||||
super("Enforced Armor", new String[]{"You take " + explosion * 100 + "% explosion damage!"});
|
||||
|
||||
_explosion = explosion;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void Knockback(CustomDamageEvent event)
|
||||
{
|
||||
if (event.GetCause() != DamageCause.ENTITY_EXPLOSION && event.GetCause() != DamageCause.BLOCK_EXPLOSION)
|
||||
return;
|
||||
|
||||
if (!(event.GetDamageeEntity() instanceof Player))
|
||||
return;
|
||||
|
||||
Player player = event.GetDamageePlayer();
|
||||
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
if (!Kit.HasKit(player))
|
||||
return;
|
||||
|
||||
if (!Manager.IsAlive(player))
|
||||
return;
|
||||
|
||||
event.AddMod("Explosion Modifier", "Reduce damage", (-event.GetDamage()) + event.GetDamageInitial() * _explosion, false);
|
||||
}
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
package nautilus.game.arcade.kit.perks;
|
||||
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
|
||||
public class PerkFallModifier extends Perk
|
||||
{
|
||||
private double _fall;
|
||||
|
||||
public PerkFallModifier(double fall)
|
||||
{
|
||||
super("Feathered Boots", new String[]{"You take " + fall * 100 + "% fall damage!"});
|
||||
|
||||
_fall = fall;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void Knockback(CustomDamageEvent event)
|
||||
{
|
||||
if (event.GetCause() != DamageCause.FALL)
|
||||
return;
|
||||
|
||||
if (!(event.GetDamageeEntity() instanceof Player))
|
||||
return;
|
||||
|
||||
Player player = event.GetDamageePlayer();
|
||||
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
if (!Kit.HasKit(player))
|
||||
return;
|
||||
|
||||
if (!Manager.IsAlive(player))
|
||||
return;
|
||||
|
||||
event.AddMod("Fall Modifier", "Reduce damage", _fall, false);
|
||||
}
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
package nautilus.game.arcade.kit.perks;
|
||||
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
|
||||
public class PerkKnockbackTaken extends Perk
|
||||
{
|
||||
private double _knockback;
|
||||
|
||||
public PerkKnockbackTaken(double knockback)
|
||||
{
|
||||
super("Knockback", new String[]{"You take " + knockback * 100 + "% knockback!"});
|
||||
|
||||
_knockback = knockback;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void Knockback(CustomDamageEvent event)
|
||||
{
|
||||
if (!(event.GetDamageeEntity() instanceof Player))
|
||||
return;
|
||||
|
||||
Player player = event.GetDamageePlayer();
|
||||
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
if (!Kit.HasKit(player))
|
||||
return;
|
||||
|
||||
if (!Manager.IsAlive(player))
|
||||
return;
|
||||
|
||||
//Multiply all knockback
|
||||
for (Entry<String, Double> entry : event.GetKnockback().entrySet())
|
||||
entry.setValue(entry.getValue() * _knockback);
|
||||
}
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package nautilus.game.arcade.kit.perks;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
|
||||
public class PerkNoFallDamage extends Perk
|
||||
{
|
||||
public PerkNoFallDamage()
|
||||
{
|
||||
super("Feathered Boots", new String[]{"You take no fall damage!"});
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onDamage(CustomDamageEvent event)
|
||||
{
|
||||
if (!Manager.GetGame().IsLive())
|
||||
return;
|
||||
|
||||
if (!(event.GetDamageeEntity() instanceof Player))
|
||||
return;
|
||||
|
||||
if (!Kit.HasKit(event.GetDamageePlayer()))
|
||||
return;
|
||||
|
||||
if (event.GetCause() == DamageCause.FALL)
|
||||
{
|
||||
event.SetCancelled("Feathered Boots");
|
||||
}
|
||||
}
|
||||
}
|
@ -17,7 +17,7 @@ public class PerkVampire extends Perk
|
||||
{
|
||||
super("Vampire", new String[]
|
||||
{
|
||||
C.cGray + "You heal " + recover + "HP when you kill someone",
|
||||
C.cGray + "You heal " + C.cYellow + recover + " Hearts" + C.cGray + " when you kill someone",
|
||||
});
|
||||
|
||||
_recover = recover;
|
||||
|
@ -0,0 +1,47 @@
|
||||
package nautilus.game.arcade.kit.perks;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
|
||||
public class PerkWaterDamage extends Perk
|
||||
{
|
||||
private double _damage;
|
||||
private long _time;
|
||||
|
||||
public PerkWaterDamage(double damage, double time)
|
||||
{
|
||||
super("(Not) Water Bender", new String[]
|
||||
{
|
||||
"You are deathly afraid of water.",
|
||||
"Entering water deals " + C.cYellow + "2 Damage" + C.cGray + " every " + C.cGreen + "1 Second"
|
||||
});
|
||||
|
||||
_damage = damage;
|
||||
_time = (long) (time * 1000);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void update(UpdateEvent event)
|
||||
{
|
||||
if (!Manager.GetGame().IsLive())
|
||||
return;
|
||||
|
||||
for (Player player : Manager.GetGame().GetPlayers(true)){
|
||||
if (!Kit.HasKit(player))
|
||||
continue;
|
||||
|
||||
if (!Recharge.Instance.use(player, "Not Water Bender Damage", _time, false, false))
|
||||
continue;
|
||||
|
||||
if (UtilEnt.inWater(player))
|
||||
Manager.GetDamage().NewDamageEvent(player, null, null, DamageCause.DROWNING, _damage, false, false, true, "Water", "Water Hating Kit");
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package nautilus.game.arcade.kit.perks.event;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Cancellable;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.player.PlayerEvent;
|
||||
|
||||
public class PerkConstructorEvent extends PlayerEvent implements Cancellable
|
||||
{
|
||||
private static HandlerList _handlers = new HandlerList();
|
||||
|
||||
private boolean _cancelled = false;
|
||||
|
||||
public PerkConstructorEvent(Player who)
|
||||
{
|
||||
super(who);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCancelled(boolean cancelled)
|
||||
{
|
||||
_cancelled = cancelled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCancelled()
|
||||
{
|
||||
return _cancelled;
|
||||
}
|
||||
|
||||
public static HandlerList getHandlerList()
|
||||
{
|
||||
return _handlers;
|
||||
}
|
||||
|
||||
public HandlerList getHandlers()
|
||||
{
|
||||
return getHandlerList();
|
||||
}
|
||||
}
|
@ -23,8 +23,8 @@ import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.events.PlayerDeathOutEvent;
|
||||
import nautilus.game.arcade.game.Game;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.Game.GameState;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.GameTeam.PlayerState;
|
||||
import nautilus.game.arcade.kit.perks.event.PerkDestructorBlockEvent;
|
||||
|
||||
@ -33,6 +33,8 @@ import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.Chest;
|
||||
import org.bukkit.block.DoubleChest;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -46,8 +48,8 @@ import org.bukkit.event.block.BlockIgniteEvent;
|
||||
import org.bukkit.event.block.BlockPlaceEvent;
|
||||
import org.bukkit.event.block.LeavesDecayEvent;
|
||||
import org.bukkit.event.entity.CreatureSpawnEvent;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.inventory.InventoryOpenEvent;
|
||||
import org.bukkit.event.inventory.InventoryType;
|
||||
@ -274,7 +276,8 @@ public class GameFlagManager implements Listener
|
||||
|
||||
if (!game.InProgress())
|
||||
return;
|
||||
|
||||
|
||||
//normal inventories
|
||||
if (!game.InventoryOpenBlock)
|
||||
{
|
||||
if (event.getInventory().getType() == InventoryType.ANVIL ||
|
||||
@ -287,22 +290,37 @@ public class GameFlagManager implements Listener
|
||||
event.getInventory().getType() == InventoryType.HOPPER ||
|
||||
event.getInventory().getType() == InventoryType.MERCHANT ||
|
||||
event.getInventory().getType() == InventoryType.ENDER_CHEST ||
|
||||
event.getInventory().getType() == InventoryType.WORKBENCH)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
event.getPlayer().closeInventory();
|
||||
event.getInventory().getType() == InventoryType.WORKBENCH ||
|
||||
event.getInventory().getType() == InventoryType.CHEST)
|
||||
{
|
||||
if (event.getInventory().getType() == InventoryType.CHEST)
|
||||
{
|
||||
if (event.getInventory().getHolder() != null && event.getInventory().getHolder() instanceof Chest || event.getInventory().getHolder() instanceof DoubleChest)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
event.getPlayer().closeInventory();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
event.setCancelled(true);
|
||||
event.getPlayer().closeInventory();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//deal with chests
|
||||
if (!game.InventoryOpenChest)
|
||||
{
|
||||
if (event.getInventory().getType() == InventoryType.CHEST)
|
||||
{
|
||||
if (event.getInventory().getHolder() instanceof Chest || event.getInventory().getHolder() instanceof DoubleChest)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
event.getPlayer().closeInventory();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// if (!game.InventoryOpenChest)
|
||||
// {
|
||||
// if (event.getInventory().getType() == InventoryType.CHEST)
|
||||
// {
|
||||
// event.setCancelled(true);
|
||||
// event.getPlayer().closeInventory();
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
@ -1187,10 +1205,10 @@ public class GameFlagManager implements Listener
|
||||
{
|
||||
if (Manager.GetGame() == null)
|
||||
return;
|
||||
|
||||
if (Manager.GetGame().GetType().getResourcePackUrl() == null)
|
||||
return;
|
||||
|
||||
//
|
||||
// if (Manager.GetGame().GetType().getResourcePackUrl() == null)
|
||||
// return;
|
||||
//
|
||||
UtilPlayer.message(player, " ");
|
||||
UtilPlayer.message(player, C.cGold + C.Bold + Manager.GetGame().GetType().GetName() + " requires you to be using Minecraft 1.8!");
|
||||
UtilPlayer.message(player, " ");
|
||||
|
@ -9,6 +9,7 @@ import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.minecraft.game.core.combat.CombatComponent;
|
||||
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
|
||||
import nautilus.game.arcade.ArcadeFormat;
|
||||
@ -36,8 +37,9 @@ public class GameGemManager implements Listener
|
||||
{
|
||||
ArcadeManager Manager;
|
||||
|
||||
boolean DoubleGem = true;
|
||||
|
||||
boolean DoubleGem = false;
|
||||
boolean TimeReward = true;
|
||||
|
||||
public GameGemManager(ArcadeManager manager)
|
||||
{
|
||||
Manager = manager;
|
||||
@ -184,8 +186,21 @@ public class GameGemManager implements Listener
|
||||
total += (int)(earned * (gemFinder * 0.25));
|
||||
}
|
||||
}
|
||||
|
||||
//Time Reward
|
||||
if (TimeReward)
|
||||
{
|
||||
long timeOnline = 7980000;
|
||||
|
||||
double hoursOnline = timeOnline/3600000d;
|
||||
|
||||
if (hoursOnline > 5)
|
||||
hoursOnline = 5;
|
||||
|
||||
total += (int)(earned * (hoursOnline * 0.2));
|
||||
}
|
||||
|
||||
if (DoubleGem && game.GemDoubleEnabled && UtilPlayer.is1_8(player))
|
||||
if (DoubleGem && game.GemDoubleEnabled)
|
||||
total += earned;
|
||||
|
||||
Manager.GetDonation().RewardGems(null, "Earned " + game.GetName(), player.getName(), player.getUniqueId(), total);
|
||||
@ -290,8 +305,29 @@ public class GameGemManager implements Listener
|
||||
}
|
||||
}
|
||||
|
||||
//Time Reward
|
||||
if (TimeReward)
|
||||
{
|
||||
long timeOnline = 7980000;
|
||||
|
||||
double hoursOnline = timeOnline/3600000d;
|
||||
|
||||
if (hoursOnline > 5)
|
||||
hoursOnline = 5;
|
||||
|
||||
int extraGems = (int)(earnedGems * (hoursOnline * 0.2));
|
||||
|
||||
if (extraGems > 0)
|
||||
{
|
||||
UtilPlayer.message(player, F.elem(C.cGreen + "+" + extraGems + " Gems") + " for " +
|
||||
F.elem("Online for " + UtilTime.MakeStr(timeOnline) + C.cGreen + " +" + (int)(hoursOnline * 20) + "%"));
|
||||
|
||||
totalGems += extraGems;
|
||||
}
|
||||
}
|
||||
|
||||
//Double Gem
|
||||
if (DoubleGem && game.GemDoubleEnabled && UtilPlayer.is1_8(player))
|
||||
if (DoubleGem && game.GemDoubleEnabled)
|
||||
{
|
||||
UtilPlayer.message(player, F.elem(C.cGreen + "+" + (earnedGems) + " Gems") + " for " + F.elem(C.cDGreen + "Double Gem Weekend"));
|
||||
|
||||
|
@ -2,26 +2,6 @@ package nautilus.game.arcade.managers;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.inventory.InventoryType;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerRespawnEvent;
|
||||
|
||||
import mineplex.core.common.CurrencyType;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.util.C;
|
||||
@ -45,6 +25,25 @@ import nautilus.game.arcade.shop.ArcadeShop;
|
||||
import nautilus.game.arcade.shop.KitPackage;
|
||||
import net.minecraft.server.v1_7_R4.PacketPlayOutEntityMetadata;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
import org.bukkit.event.inventory.InventoryType;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerRespawnEvent;
|
||||
|
||||
public class GamePlayerManager implements Listener
|
||||
{
|
||||
ArcadeManager Manager;
|
||||
@ -60,7 +59,7 @@ public class GamePlayerManager implements Listener
|
||||
public void PlayerDeath(CombatDeathEvent event)
|
||||
{
|
||||
//Don't actually die
|
||||
event.GetEvent().getEntity().setHealth(20);
|
||||
event.GetEvent().getEntity().setHealth(event.GetEvent().getEntity().getMaxHealth());
|
||||
|
||||
//Dont display message
|
||||
if (Manager.GetGame() != null)
|
||||
|
Loading…
Reference in New Issue
Block a user