Experimental Skywars Kits

This commit is contained in:
Sam 2016-07-15 23:07:17 +01:00
parent 2f6e140b34
commit d901fce3ac
14 changed files with 1033 additions and 11 deletions

View File

@ -72,6 +72,7 @@ import mineplex.core.common.util.UtilTime;
import mineplex.core.explosion.ExplosionEvent;
import mineplex.core.loot.ChestLoot;
import mineplex.core.loot.RandomItem;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.combat.CombatComponent;
@ -84,11 +85,14 @@ import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.games.skywars.data.TNTGenerator;
import nautilus.game.arcade.game.games.skywars.events.PlayerKillZombieEvent;
import nautilus.game.arcade.game.games.skywars.kits.KitDevourer;
import nautilus.game.arcade.game.games.skywars.kits.KitGatherer;
import nautilus.game.arcade.game.games.skywars.kits.KitPricklyPete;
import nautilus.game.arcade.game.games.skywars.kits.KitRock;
import nautilus.game.arcade.game.games.skywars.kits.KitSharpshooter;
import nautilus.game.arcade.game.games.skywars.kits.KitAir;
import nautilus.game.arcade.game.games.skywars.kits.KitBuilder;
import nautilus.game.arcade.game.games.skywars.kits.KitEarth;
import nautilus.game.arcade.game.games.skywars.kits.KitFire;
import nautilus.game.arcade.game.games.skywars.kits.KitGrappler;
import nautilus.game.arcade.game.games.skywars.kits.KitIce;
import nautilus.game.arcade.game.games.skywars.kits.KitJumper;
import nautilus.game.arcade.game.games.skywars.kits.KitTank;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.ore.OreHider;
import nautilus.game.arcade.stats.DeathBomberStatTracker;
@ -102,6 +106,8 @@ public abstract class Skywars extends Game
{
//./parse 19 30 56
public static boolean ELEMENTAL = false;
private long _crumbleTime = 150000;
private ArrayList<Block> _worldBlocks = new ArrayList<Block>();
@ -157,13 +163,27 @@ public abstract class Skywars extends Game
{
super(manager, type, new Kit[]
{
new KitGatherer(manager),
new KitDevourer(manager),
new KitRock(manager),
new KitPricklyPete(manager),
new KitSharpshooter(manager)
}, description);
if (ELEMENTAL)
{
setKits(new Kit[] {
new KitIce(manager),
new KitFire(manager),
new KitAir(manager),
new KitEarth(manager),
});
}
else
{
setKits(new Kit[] {
new KitJumper(manager),
new KitBuilder(manager),
new KitGrappler(manager),
new KitTank(manager),
});
}
PrepareFreeze = true;
@ -550,6 +570,24 @@ public abstract class Skywars extends Game
_lastChicken = System.currentTimeMillis();
}
@EventHandler
public void onGameStateChangeLeap(GameStateChangeEvent event)
{
if (event.GetState() != GameState.Live)
{
return;
}
for (Player player : GetPlayers(true))
{
if (GetKit(player).GetFormattedName().equals("Jumper"))
{
Recharge.Instance.use(player, "Leap", 30000, true, false);
}
}
}
@EventHandler
public void onGameStateChangeMapWarning(GameStateChangeEvent event)
{
@ -1575,8 +1613,15 @@ public abstract class Skywars extends Game
{
if (event.getMessage().startsWith("/crumble"))
{
event.setCancelled(true);
_crumbleTime = 1000;
}
else if (event.getMessage().startsWith("/elemental"))
{
event.setCancelled(true);
Announce(C.cAquaB + event.getPlayer().getName() + " changed the skywars mode.", true);
ELEMENTAL = !ELEMENTAL;
}
}
public TNTGenerator getTnTGen()

View File

@ -0,0 +1,45 @@
package nautilus.game.arcade.game.games.skywars.kits;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
import mineplex.core.itemstack.ItemBuilder;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.ProgressingKit;
import nautilus.game.arcade.kit.perks.PerkDoubleJump;
import nautilus.game.arcade.kit.perks.PerkVoidSaver;
public class KitAir extends ProgressingKit
{
private static final String[] DESCRIPTION = {
"Start with " + C.cGreen + "Wood Sword" + C.cGray + " and " + C.cGreen + "Eye of Ender",
"",
};
private static final ItemStack[] PLAYER_ITEMS = { new ItemStack(Material.WOOD_SWORD), new ItemBuilder(Material.EYE_OF_ENDER).setTitle(C.cGreen + "Eye of Ender").build() };
private static final ItemStack IN_HAND = new ItemStack(Material.EYE_OF_ENDER);
public KitAir(ArcadeManager manager)
{
super(manager, "Air", "skywarsair", KitAvailability.Free, DESCRIPTION, new Perk[] { new PerkVoidSaver(), new PerkDoubleJump("Leap", 1, 1, true, 30000, true) }, EntityType.ZOMBIE, IN_HAND);
setPerks(1, new Perk[] { new PerkVoidSaver(), new PerkDoubleJump("Leap", 1, 1, true, 29000, true) });
setPerks(2, new Perk[] { new PerkVoidSaver(), new PerkDoubleJump("Leap", 1.1, 1, true, 29000, true) });
setPerks(3, new Perk[] { new PerkVoidSaver(), new PerkDoubleJump("Leap", 1.1, 1, true, 28000, true) });
setPerks(4, new Perk[] { new PerkVoidSaver(), new PerkDoubleJump("Leap", 1.2, 1, true, 28000, true) });
setPerks(5, new Perk[] { new PerkVoidSaver(), new PerkDoubleJump("Leap", 1.2, 1, true, 27000, true) });
}
@Override
public void GiveItems(Player player)
{
player.getInventory().addItem(PLAYER_ITEMS);
}
}

View File

@ -0,0 +1,68 @@
package nautilus.game.arcade.game.games.skywars.kits;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.ProgressingKit;
public class KitBuilder extends ProgressingKit
{
private static final String[] DESCRIPTION = {
"Start with " + C.cGreen + "Wood Axe" + C.cGray + " and " + C.cGreen + "Wooden Pickaxe",
"",
};
private static final ItemStack[] PLAYER_ITEMS = {
new ItemStack(Material.WOOD_AXE),
new ItemStack(Material.WOOD_PICKAXE)
};
private static final ItemStack IN_HAND = new ItemStack(Material.COBBLESTONE);
public KitBuilder(ArcadeManager manager)
{
super(manager, "Bulider", "skywarsbuilder", KitAvailability.Free, DESCRIPTION, new Perk[] { }, EntityType.ZOMBIE, IN_HAND);
}
@Override
public void GiveItems(Player player)
{
int level = getUpgradeLevel(player.getUniqueId());
int amount = 1;
player.getInventory().addItem(PLAYER_ITEMS);
switch (level)
{
case 0:
amount = 15;
break;
case 1:
amount = 20;
break;
case 2:
amount = 25;
break;
case 3:
amount = 30;
break;
case 4:
amount = 35;
break;
case 5:
amount = 40;
break;
default:
break;
}
player.getInventory().addItem(new ItemStack(Material.COBBLESTONE, amount));
}
}

View File

@ -0,0 +1,44 @@
package nautilus.game.arcade.game.games.skywars.kits;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
import mineplex.core.itemstack.ItemBuilder;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.ProgressingKit;
import nautilus.game.arcade.kit.perks.PerkDirtCannon;
public class KitEarth extends ProgressingKit
{
private static final String[] DESCRIPTION = {
"Start with " + C.cGreen + "Wood Sword" + C.cGray + " and " + C.cGreen + "Wood Shovel",
"",
};
private static final ItemStack[] PLAYER_ITEMS = { new ItemStack(Material.WOOD_SWORD), new ItemBuilder(Material.WOOD_SPADE).setTitle(C.cGreen + "Dirt Cannon").build() };
private static final ItemStack IN_HAND = new ItemStack(Material.DIRT);
public KitEarth(ArcadeManager manager)
{
super(manager, "Earth", "skywarsearth", KitAvailability.Free, DESCRIPTION, new Perk[] { new PerkDirtCannon(20000, 2, 1) }, EntityType.ZOMBIE, IN_HAND);
setPerks(1, new Perk[] { new PerkDirtCannon(19000, 2, .25) });
setPerks(2, new Perk[] { new PerkDirtCannon(19000, 2, .2) });
setPerks(3, new Perk[] { new PerkDirtCannon(18000, 2, .2) });
setPerks(4, new Perk[] { new PerkDirtCannon(18000, 2.5, .2) });
setPerks(5, new Perk[] { new PerkDirtCannon(17000, 2.5, .2) });
}
@Override
public void GiveItems(Player player)
{
player.getInventory().addItem(PLAYER_ITEMS);
}
}

View File

@ -0,0 +1,45 @@
package nautilus.game.arcade.game.games.skywars.kits;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
import mineplex.core.itemstack.ItemBuilder;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.ProgressingKit;
import nautilus.game.arcade.kit.perks.PerkFireBurst;
public class KitFire extends ProgressingKit
{
private static final String[] DESCRIPTION = {
"Start with " + C.cGreen + "Wood Sword" + C.cGray + " and " + C.cGreen + "Blaze Rod",
"",
"Right click blaze rod to send a ring of fire burst around you for 3 blocks. Provides knockback and 3 damage. 45 second cooldown."
};
private static final ItemStack[] PLAYER_ITEMS = { new ItemStack(Material.WOOD_SWORD), new ItemBuilder(Material.BLAZE_ROD).setTitle(C.cGreen + "Fire Burst").build() };
private static final ItemStack IN_HAND = new ItemStack(Material.BLAZE_ROD);
public KitFire(ArcadeManager manager)
{
super(manager, "Fire", "skywarsfire", KitAvailability.Free, DESCRIPTION, new Perk[] { new PerkFireBurst(45000, 3, 3) }, EntityType.ZOMBIE, IN_HAND);
setPerks(1, new Perk[] { new PerkFireBurst(44000, 3, 3) });
setPerks(2, new Perk[] { new PerkFireBurst(44000, 4, 3) });
setPerks(3, new Perk[] { new PerkFireBurst(43000, 4, 3) });
setPerks(4, new Perk[] { new PerkFireBurst(43000, 4, 4) });
setPerks(5, new Perk[] { new PerkFireBurst(42000, 4, 4) });
}
@Override
public void GiveItems(Player player)
{
player.getInventory().addItem(PLAYER_ITEMS);
}
}

View File

@ -0,0 +1,45 @@
package nautilus.game.arcade.game.games.skywars.kits;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
import mineplex.core.itemstack.ItemBuilder;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.ProgressingKit;
import nautilus.game.arcade.kit.perks.PerkGrapple;
public class KitGrappler extends ProgressingKit
{
private static final String[] DESCRIPTION = {
"Start with " + C.cGreen + "Wood Axe" + C.cGray + " and " + C.cGreen + "Wood Pickaxe",
"",
"Hook has a 10 block radius. Fires a lead that sticks into the ground. Pulls the player to it with a second right click. 45 Second cooldown."
};
private static final ItemStack[] PLAYER_ITEMS = { new ItemStack(Material.WOOD_AXE), new ItemStack(Material.WOOD_PICKAXE), new ItemBuilder(Material.TRIPWIRE_HOOK).setTitle(C.cGreen + "Grapple").build() };
private static final ItemStack IN_HAND = new ItemStack(Material.TRIPWIRE_HOOK);
public KitGrappler(ArcadeManager manager)
{
super(manager, "Grappler", "skywarsgrappler", KitAvailability.Free, DESCRIPTION, new Perk[] { new PerkGrapple(45) }, EntityType.ZOMBIE, IN_HAND);
setPerks(1, new Perk[] { new PerkGrapple(44) });
setPerks(2, new Perk[] { new PerkGrapple(43) });
setPerks(3, new Perk[] { new PerkGrapple(42) });
setPerks(4, new Perk[] { new PerkGrapple(41) });
setPerks(5, new Perk[] { new PerkGrapple(40) });
}
@Override
public void GiveItems(Player player)
{
player.getInventory().addItem(PLAYER_ITEMS);
}
}

View File

@ -0,0 +1,71 @@
package nautilus.game.arcade.game.games.skywars.kits;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.itemstack.ItemBuilder;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.ProgressingKit;
import nautilus.game.arcade.kit.perks.PerkIceBridge;
public class KitIce extends ProgressingKit
{
private static final String[] DESCRIPTION = {
"Start with " + C.cGreen + "Wood Sword" + C.cGray + " and " + C.cGreen + "Snow Block",
"",
"Right Click snowblock to create an ice bridge that extendes from you for 12x2 blocks and lasts 4 seconds. 30 second cooldown"
};
private static final ItemStack[] PLAYER_ITEMS = { new ItemStack(Material.WOOD_SWORD), new ItemBuilder(Material.SNOW_BLOCK).setTitle(C.cGreen + "Ice Bridge").build() };
private static final ItemStack IN_HAND = new ItemStack(Material.SNOW_BLOCK);
public KitIce(ArcadeManager manager)
{
super(manager, "Ice", "skywarsice", KitAvailability.Free, DESCRIPTION, new Perk[] { new PerkIceBridge(30000, 4000) }, EntityType.ZOMBIE, IN_HAND);
setPerks(1, new Perk[] { new PerkIceBridge(29000, 4000) });
setPerks(2, new Perk[] { new PerkIceBridge(29000, 5000) });
setPerks(3, new Perk[] { new PerkIceBridge(28000, 5000) });
setPerks(4, new Perk[] { new PerkIceBridge(28000, 6000) });
setPerks(5, new Perk[] { new PerkIceBridge(27000, 6000) });
}
@Override
public void GiveItems(Player player)
{
player.getInventory().addItem(PLAYER_ITEMS);
}
@EventHandler
public void onBlockPlace(BlockPlaceEvent event)
{
Player player = event.getPlayer();
ItemStack itemStack = player.getItemInHand();
if (itemStack == null)
{
return;
}
if (itemStack.getItemMeta() == null)
{
return;
}
if (itemStack.getItemMeta().getDisplayName().contains("Ice Bridge"))
{
event.setCancelled(true);
player.sendMessage(F.main("Game", "You cannot place your skill item."));
}
}
}

View File

@ -0,0 +1,44 @@
package nautilus.game.arcade.game.games.skywars.kits;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.ProgressingKit;
import nautilus.game.arcade.kit.perks.PerkLeap;
public class KitJumper extends ProgressingKit
{
private static final String[] DESCRIPTION = {
"Start with " + C.cGreen + "Stone Axe" + C.cGray + " and " + C.cGreen + "Wooden Pickaxe",
"",
"Right click Axe to use Leap. Cannot use in the first 30 seconds of the game. 30 second cooldown"
};
private static final ItemStack[] PLAYER_ITEMS = { new ItemStack(Material.STONE_AXE), new ItemStack(Material.WOOD_PICKAXE) };
private static final ItemStack IN_HAND = new ItemStack(Material.STONE_AXE);
public KitJumper(ArcadeManager manager)
{
super(manager, "Jumper", "skywarsjumper", KitAvailability.Free, DESCRIPTION, new Perk[] { new PerkLeap("Leap", 1, 1, 30000) }, EntityType.ZOMBIE, IN_HAND);
setPerks(1, new Perk[] { new PerkLeap("Leap", 1, 1, 29000) });
setPerks(2, new Perk[] { new PerkLeap("Leap", 1, 1, 28000) });
setPerks(3, new Perk[] { new PerkLeap("Leap", 1, 1, 27000) });
setPerks(4, new Perk[] { new PerkLeap("Leap", 1, 1, 26000) });
setPerks(5, new Perk[] { new PerkLeap("Leap", 1, 1, 25000) });
}
@Override
public void GiveItems(Player player)
{
player.getInventory().addItem(PLAYER_ITEMS);
}
}

View File

@ -0,0 +1,44 @@
package nautilus.game.arcade.game.games.skywars.kits;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.ProgressingKit;
import nautilus.game.arcade.kit.perks.PerkKnockback;
public class KitTank extends ProgressingKit
{
private static final String[] DESCRIPTION = {
"Start with " + C.cGreen + "Wood Sword",
"",
"Take 25% Less Knockback from all sources"
};
private static final ItemStack[] PLAYER_ITEMS = { new ItemStack(Material.WOOD_SWORD), };
private static final ItemStack IN_HAND = new ItemStack(Material.WOOD_SWORD);
public KitTank(ArcadeManager manager)
{
super(manager, "Tank", "skywarstank", KitAvailability.Free, DESCRIPTION, new Perk[] { new PerkKnockback(0.75) }, EntityType.ZOMBIE, IN_HAND);
setPerks(1, new Perk[] { new PerkKnockback(0.76) });
setPerks(2, new Perk[] { new PerkKnockback(0.77) });
setPerks(3, new Perk[] { new PerkKnockback(0.78) });
setPerks(4, new Perk[] { new PerkKnockback(0.79) });
setPerks(5, new Perk[] { new PerkKnockback(0.80) });
}
@Override
public void GiveItems(Player player)
{
player.getInventory().addItem(PLAYER_ITEMS);
}
}

View File

@ -0,0 +1,111 @@
package nautilus.game.arcade.kit.perks;
import org.bukkit.EntityEffect;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.FallingBlock;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityChangeBlockEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.projectile.IThrown;
import mineplex.core.projectile.ProjectileUser;
import mineplex.core.recharge.Recharge;
import nautilus.game.arcade.kit.Perk;
public class PerkDirtCannon extends Perk implements IThrown
{
private long _cooldown;
private double _targetKnockback;
private double _playerKnockback;
public PerkDirtCannon(long cooldown, double targetKnockback, double playerKnockback)
{
super("Dirt Cannon", new String[] { C.cYellow + "Right-Click" + C.cGray + " to fire " + C.cGreen + "Dirt Cannon" });
_cooldown = cooldown;
_targetKnockback = targetKnockback;
_playerKnockback = playerKnockback;
}
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event)
{
if (event.isCancelled())
return;
if (event.getAction() != Action.RIGHT_CLICK_AIR)
return;
Player player = event.getPlayer();
if (player.getItemInHand() == null)
return;
if (player.getItemInHand().getType() != Material.WOOD_SPADE)
return;
if (!Kit.HasKit(player))
return;
if (!Recharge.Instance.use(player, GetName(), _cooldown, true, true))
return;
if (UtilEnt.isGrounded(player))
{
player.setVelocity(player.getLocation().getDirection().setY(0).multiply(-_playerKnockback));
}
@SuppressWarnings("deprecation")
FallingBlock fallingBlock = player.getWorld().spawnFallingBlock(player.getEyeLocation(), Material.DIRT, (byte) 0);
fallingBlock.setDropItem(false);
fallingBlock.setVelocity(player.getLocation().getDirection().multiply(2));
Manager.GetProjectile().AddThrow(fallingBlock, player, this, -1, true, true, true, true, false, 0);
}
@EventHandler
public void onEntityChangeBlock(EntityChangeBlockEvent event)
{
if (event.getBlock().getType() == Material.DIRT)
{
event.setCancelled(true);
}
}
@Override
public void Collide(LivingEntity target, Block block, ProjectileUser data)
{
if (target == null)
return;
if (target instanceof Player)
{
if (!Manager.GetGame().IsAlive(target))
{
return;
}
}
target.setVelocity(UtilAlg.getTrajectory(data.getThrown(), target).setY(0.5).multiply(_targetKnockback));
target.playEffect(EntityEffect.HURT);
}
@Override
public void Idle(ProjectileUser data)
{
}
@Override
public void Expire(ProjectileUser data)
{
}
}

View File

@ -0,0 +1,110 @@
package nautilus.game.arcade.kit.perks;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
import org.bukkit.Location;
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.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.scheduler.BukkitRunnable;
import mineplex.core.common.util.C;
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.recharge.Recharge;
import nautilus.game.arcade.kit.Perk;
public class PerkFireBurst extends Perk
{
private long _cooldown;
private double _range;
private double _damage;
public PerkFireBurst(long cooldown, double range, double damage)
{
super("Fire Burst", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Snowblock to " + C.cGreen + "Fire Burst" });
_cooldown = cooldown;
_range = range;
_damage = damage;
}
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event)
{
if (event.isCancelled())
return;
if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK)
return;
Player player = event.getPlayer();
if (player.getItemInHand() == null)
return;
if (player.getItemInHand().getType() != Material.BLAZE_ROD)
return;
if (!Kit.HasKit(player))
return;
if (!Recharge.Instance.use(player, GetName(), _cooldown, true, true))
return;
final Location location = player.getLocation().add(0, .25, 0);
Set<UUID> _damagedPlayers = new HashSet<>();
new BukkitRunnable()
{
double curRange = 0;
@Override
public void run()
{
if (curRange >= _range)
{
cancel();
return;
}
for (double theta = 0; theta < 2 * Math.PI; theta += Math.PI / 20)
{
double x = curRange * Math.cos(theta);
double z = curRange * Math.sin(theta);
location.add(x, 0, z);
UtilParticle.PlayParticleToAll(ParticleType.FLAME, location, 0, 0, 0, 0.01F, 1, ViewDist.NORMAL);
location.subtract(x, 0, z);
}
curRange += 0.5;
for (Player other : UtilPlayer.getNearby(location, _range, true))
{
if (_damagedPlayers.contains(other.getUniqueId()) || other.getUniqueId().equals(player.getUniqueId()))
{
continue;
}
_damagedPlayers.add(other.getUniqueId());
Manager.GetDamage().NewDamageEvent(other, player, null, DamageCause.FIRE, _damage, true, false, true, player.getName(), "Fire Burst");
}
}
}.runTaskTimer(Manager.getPlugin(), 0, 5);
}
}

View File

@ -0,0 +1,154 @@
package nautilus.game.arcade.kit.perks;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Bat;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.util.Vector;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilEnt;
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.UtilTime;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.kit.Perk;
public class PerkGrapple extends Perk
{
private long _cooldown;
private Map<UUID, Entity> _hooks = new HashMap<>();
private Map<UUID, Long> _lastUse = new HashMap<>();
public PerkGrapple(long cooldown)
{
super("Grapple", new String[] { "Hook has a 10 block radius. Fires a lead that sticks into the ground.", "Pulls the player to it with a second right click. 45 Second cooldown." });
_cooldown = cooldown;
}
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event)
{
if (event.getAction() != Action.RIGHT_CLICK_AIR)
{
return;
}
Player player = event.getPlayer();
if (!Kit.HasKit(player))
{
return;
}
if (player.getItemInHand() == null)
{
return;
}
if (player.getItemInHand().getType() != Material.TRIPWIRE_HOOK)
{
return;
}
if (_hooks.get(player.getUniqueId()) == null)
{
if (!Recharge.Instance.use(player, GetName(), _cooldown, true, true))
{
return;
}
Vector direction = player.getLocation().getDirection();
Location location = player.getEyeLocation().add(direction);
for (int i = 0; i < 14; i++)
{
if (location.getBlock().getType() != Material.AIR)
{
Manager.GetGame().CreatureAllowOverride = true;
Bat bat = location.getWorld().spawn(location, Bat.class);
bat.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, Integer.MAX_VALUE, 0));
UtilEnt.Vegetate(bat);
bat.setLeashHolder(player);
_hooks.put(player.getUniqueId(), bat);
player.sendMessage(F.main("Game", "Your graple caught a block!"));
Manager.GetGame().CreatureAllowOverride = false;
break;
}
UtilParticle.PlayParticleToAll(ParticleType.CLOUD, location, 0F, 0F, 0F, 0.01F, 4, ViewDist.NORMAL);
location.add(direction);
}
}
else
{
Bat bat = (Bat) _hooks.get(player.getUniqueId());
Vector vector = UtilAlg.getTrajectory(player, bat).multiply(1.5);
if (vector.getY() < 1)
{
vector.setY(Math.max(1, 1 + vector.getY()));
}
player.setVelocity(vector);
bat.setLeashHolder(null);
bat.remove();
_hooks.put(player.getUniqueId(), null);
_lastUse.put(player.getUniqueId(), System.currentTimeMillis());
player.sendMessage(F.main("Game", "You used " + F.skill(GetName())));
}
}
@EventHandler
public void onUpdate(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
{
return;
}
for (UUID uuid : _lastUse.keySet())
{
if (UtilTime.elapsed(_lastUse.get(uuid), 3000))
{
continue;
}
Player player = Bukkit.getPlayer(uuid);
if (UtilEnt.isGrounded(player))
{
continue;
}
UtilParticle.PlayParticleToAll(ParticleType.CLOUD, player.getLocation(), 0F, 0F, 0F, 0.01F, 4, ViewDist.NORMAL);
}
}
@EventHandler
public void onEntityDamage(EntityDamageEvent event)
{
if (_hooks.containsValue(event.getEntity()))
{
event.setCancelled(true);
}
}
}

View File

@ -0,0 +1,102 @@
package nautilus.game.arcade.kit.perks;
import java.util.HashSet;
import java.util.Iterator;
import org.bukkit.Effect;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.util.Vector;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.perks.data.IcePathData;
public class PerkIceBridge extends Perk
{
private HashSet<IcePathData> _data = new HashSet<IcePathData>();
private long _cooldown;
private long _bridgeUpTime;
public PerkIceBridge(long cooldown, long bridgeUpTime)
{
super("Ice Bridge", new String[] { C.cYellow + "Right-Click" + C.cGray + " with Snowblock to " + C.cGreen + "Ice Bridge" });
_cooldown = cooldown;
_bridgeUpTime = bridgeUpTime;
}
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event)
{
if (event.isCancelled())
return;
if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK)
return;
if (UtilBlock.usable(event.getClickedBlock()))
return;
Player player = event.getPlayer();
if (player.getItemInHand() == null)
return;
if (player.getItemInHand().getType() != Material.SNOW_BLOCK)
return;
if (!Kit.HasKit(player))
return;
if (!Recharge.Instance.use(player, GetName(), _cooldown, true, true))
return;
player.teleport(player.getLocation().add(0, 1, 0));
UtilAction.velocity(player, new Vector(0, 0.5, 0));
_data.add(new IcePathData(player));
// Inform
UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + "."));
}
@EventHandler
public void onUpdate(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
Iterator<IcePathData> dataIterator = _data.iterator();
while (dataIterator.hasNext())
{
IcePathData data = dataIterator.next();
Block block = data.GetNextBlock();
if (block == null)
{
dataIterator.remove();
}
else
{
block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, 79);
Manager.GetBlockRestore().add(block, 79, (byte) 0, _bridgeUpTime);
}
}
}
}

View File

@ -0,0 +1,94 @@
package nautilus.game.arcade.kit.perks;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.kit.Perk;
public class PerkVoidSaver extends Perk
{
private Map<UUID, Location> _safeLocations = new HashMap<>();
public PerkVoidSaver()
{
super("Void Saver", new String[] { C.cGray + "If you fall into the void you are teleported to a safe location" });
}
@EventHandler
public void onUpdate(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST)
{
return;
}
for (Player player : Manager.GetGame().GetPlayers(true))
{
if (!Kit.HasKit(player) || !player.getInventory().contains(Material.EYE_OF_ENDER))
{
continue;
}
if (player.getFallDistance() > 20)
{
if (_safeLocations.get(player.getUniqueId()) == null)
{
continue;
}
player.setFallDistance(0);
player.teleport(_safeLocations.get(player.getUniqueId()));
player.getInventory().remove(Material.EYE_OF_ENDER);
player.sendMessage(F.main("Game", "You used your safe teleport."));
player.playSound(player.getLocation(), Sound.ENDERMAN_TELEPORT, 1, 0);
UtilParticle.PlayParticleToAll(ParticleType.WITCH_MAGIC, player.getEyeLocation(), 0.5F, 0.5F, 0.5F, 0.5F, 10, ViewDist.NORMAL);
continue;
}
if (!UtilEnt.isGrounded(player))
{
continue;
}
_safeLocations.put(player.getUniqueId(), player.getLocation());
}
}
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event)
{
if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK)
{
return;
}
Player player = event.getPlayer();
if (player.getItemInHand() == null)
return;
if (player.getItemInHand().getType() != Material.EYE_OF_ENDER)
return;
event.setCancelled(true);
}
}