Merge pull request #187 from Mineplex-LLC/update/oitq

Skywars Update Patch
This commit is contained in:
Shaun Bennett 2016-09-07 20:08:08 -04:00 committed by GitHub
commit 7fbd6087eb
49 changed files with 4388 additions and 181 deletions

View File

@ -0,0 +1,105 @@
package mineplex.core.common.util.particles.effects;
import java.util.Set;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
/**
* Creates a line of particles with customise able traits.
*
* Most noticeable with Blink skills.
*/
public class LineParticle
{
private Location _start;
private Vector _direction;
private Location _lastLocation;
private double _curRange;
private double _incrementedRange;
private double _maxRange;
private Set<Material> _ignoredTypes;
private ParticleType _particleType;
private Player[] _toDisplay;
public LineParticle(Location start, Vector direction, double incrementedRange, double maxRange, Set<Material> ignoredTypes, ParticleType particleType, Player... toDisplay)
{
this(start, null, direction, incrementedRange, maxRange, ignoredTypes, particleType, toDisplay);
}
public LineParticle(Location start, Location end, Vector direction, double incrementedRange, double maxRange, Set<Material> ignoredTypes, ParticleType particleType, Player... toDisplay)
{
_start = start;
_direction = direction;
_lastLocation = start;
_curRange = 0;
_incrementedRange = incrementedRange;
_maxRange = maxRange;
_ignoredTypes = ignoredTypes;
_particleType = particleType;
_toDisplay = toDisplay;
if (_direction == null)
{
direction = UtilAlg.getTrajectory(start, end).normalize();
}
}
/**
* Advances the line.
*
* @return true when the line has reached its target or has collided with a
* block with a type contained in _ignoredTypes.
*/
public boolean update()
{
boolean done = _curRange > _maxRange;
Location newTarget = _start.clone().add(new Vector(0, 0.2, 0)).add(_direction.clone().multiply(_curRange));
_lastLocation = newTarget;
if (!(UtilBlock.airFoliage(newTarget.getBlock()) || UtilBlock.airFoliage(newTarget.getBlock().getRelative(BlockFace.UP))))
{
if (_ignoredTypes == null)
{
done = true;
}
if (!_ignoredTypes.contains(newTarget.getBlock().getType()))
{
done = true;
}
}
_curRange += _incrementedRange;
UtilParticle.PlayParticle(_particleType, newTarget, 0, 0, 0, 0.001F, 1, ViewDist.LONG, _toDisplay);
return done;
}
public Location getLastLocation()
{
return _lastLocation;
}
public Location getDestination()
{
return _lastLocation.subtract(_direction);
}
}

View File

@ -0,0 +1,94 @@
package mineplex.core.common.util.particles.effects;
import org.bukkit.Location;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
import mineplex.core.common.util.UtilAlg;
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;
/**
* Creates a particle curve that bends towards a location.
*
* Most noticeable in Gladiators and TOITQ.
*/
public class ObjectiveParticle
{
private Location _current;
private Location _target;
private Vector _direction;
private float _turnMultipler;
private float _blocksToAdvance;
private float _particleOffset;
private int _particleCount;
private float _soundVolume;
private float _soundPitch;
private double _stopAtDistance;
private Sound _sound;
private ParticleType _particleType;
private Player[] _toDisplay;
public ObjectiveParticle(Location start, Vector startVector, Location target, Player... toDisplay)
{
this(start, startVector, target, 0.15F, 0.5F, 0.03F, 3, ParticleType.HAPPY_VILLAGER, 0.2F, 3F, null, 4, toDisplay);
}
public ObjectiveParticle(Location start, Vector startVector, Location target, float turnMutlipler, float blocksToAdvance, float particleOffset, int particleCount, ParticleType particleType,
float soundVolume, float soundPitch, Sound sound, double stopAtDistance, Player... toDisplay)
{
_current = start;
_target = target;
_turnMultipler = turnMutlipler;
_blocksToAdvance = blocksToAdvance;
_particleOffset = particleOffset;
_particleCount = particleCount;
_particleType = particleType;
_soundVolume = soundVolume;
_soundPitch = soundPitch;
_sound = sound;
_stopAtDistance = stopAtDistance;
_toDisplay = toDisplay;
_direction = startVector;
if (_direction.getY() < 0)
{
_direction.setY(0);
}
_direction.normalize();
}
/**
* Advances the curve.
*
* @return true when the curve is within _stopAtDistance blocks of the
* target.
*/
public boolean update()
{
_direction.add(UtilAlg.getTrajectory(_current, _target).multiply(_turnMultipler));
_direction.normalize();
_current.add(_direction.clone().multiply(_blocksToAdvance));
UtilParticle.PlayParticle(_particleType, _current, _particleOffset, _particleOffset, _particleOffset, 0, _particleCount, ViewDist.LONG, _toDisplay);
if (_sound != null)
{
for (Player player : _toDisplay)
{
player.playSound(_current, _sound, _soundVolume, _soundPitch);
}
}
return UtilMath.offset(_current, _target) < _stopAtDistance;
}
}

View File

@ -83,6 +83,8 @@ public enum GameDisplay
Valentines("Valentines Vendetta", Material.LEATHER, (byte)0, GameCategory.EXTRA, 61),
Basketball("Hoops", Material.SLIME_BALL, (byte)0, GameCategory.EXTRA, 63),
QuiverPayload("One in the Quiver Payload", Material.ARROW, (byte)0, GameCategory.ARCADE, 64),
Event("Mineplex Event", Material.CAKE, (byte)0, GameCategory.EVENT, 999),

View File

@ -2,6 +2,7 @@ package mineplex.core.progression;
import mineplex.core.MiniClientPlugin;
import mineplex.core.account.CoreClientManager;
import mineplex.core.donation.DonationManager;
import mineplex.core.progression.data.PlayerKit;
import mineplex.core.progression.data.PlayerKitDataManager;
import org.bukkit.plugin.java.JavaPlugin;
@ -16,16 +17,23 @@ public class KitProgressionManager extends MiniClientPlugin<PlayerKit>
private PlayerKitDataManager _dataManager;
private KitProgressionRepository _kitProgressionRepository;
private DonationManager _donationManager;
private CoreClientManager _coreClientManager;
public KitProgressionManager(JavaPlugin plugin, CoreClientManager clientManager)
public KitProgressionManager(JavaPlugin plugin, DonationManager donationManager, CoreClientManager clientManager)
{
super("Kit Progression", plugin);
_dataManager = new PlayerKitDataManager();
_kitProgressionRepository = new KitProgressionRepository(this);
_donationManager = donationManager;
_coreClientManager = clientManager;
}
public DonationManager getDonationManager()
{
return _donationManager;
}
public CoreClientManager getClientManager()
{
return _coreClientManager;

View File

@ -285,4 +285,4 @@ public interface ProgressiveKit
ViewDist.NORMAL, displayTo);
}
}
}
}

View File

@ -0,0 +1,56 @@
package mineplex.core.progression.data;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.inventory.Inventory;
import mineplex.core.common.currency.GlobalCurrency;
import mineplex.core.common.util.F;
import mineplex.core.progression.KitProgressionManager;
import mineplex.core.progression.ProgressiveKit;
import mineplex.core.progression.math.Calculations;
import mineplex.core.shop.confirmation.ConfirmationCallback;
import mineplex.core.shop.confirmation.ConfirmationProcessor;
public class KitUpgradeProcessor implements ConfirmationProcessor
{
private KitProgressionManager _manager;
private Player _player;
private ProgressiveKit _kit;
private int _upgradeLevel;
public KitUpgradeProcessor(KitProgressionManager manager, Player player, ProgressiveKit kit, int upgradeLevel)
{
_manager = manager;
_player = player;
_kit = kit;
_upgradeLevel = upgradeLevel;
}
@Override
public void init(Inventory inventory)
{
}
@Override
public void process(ConfirmationCallback callback)
{
int gems = _manager.getDonationManager().Get(_player).getBalance(GlobalCurrency.GEM);
int cost = Calculations.getGemsCost(_upgradeLevel);
if (gems >= cost)
{
_kit.upgrade(_upgradeLevel, _player.getUniqueId());
_player.playSound(_player.getLocation(), Sound.CAT_MEOW, 5.0f, 1.0f);
_player.sendMessage(F.main("Kit Progression", "Purchased upgrades for " + _kit.getDisplayName() + " level " + _upgradeLevel));
_manager.getDonationManager().Get(_player).DeductCost(cost, GlobalCurrency.GEM);
callback.resolve("Success! You now own this upgrade!");
return;
}
callback.reject("Insufficient funds!");
}
}

View File

@ -0,0 +1,28 @@
package mineplex.core.progression.data;
import org.bukkit.entity.Player;
import mineplex.core.account.CoreClientManager;
import mineplex.core.donation.DonationManager;
import mineplex.core.progression.KitProgressionManager;
import mineplex.core.shop.ShopBase;
import mineplex.core.shop.page.ShopPageBase;
/*
* This is currently just used to open a confirmation menu and no other references should be made to this.
*/
public class KitUpgradeShop extends ShopBase<KitProgressionManager>
{
public KitUpgradeShop(KitProgressionManager plugin, CoreClientManager clientManager, DonationManager donationManager)
{
super(plugin, clientManager, donationManager, "Kit Upgrade");
}
@Override
protected ShopPageBase<KitProgressionManager, ? extends ShopBase<KitProgressionManager>> buildPagesFor(Player player)
{
return null;
}
}

View File

@ -1,14 +1,19 @@
package mineplex.core.progression.gui.buttons;
import mineplex.core.common.util.F;
import mineplex.core.menu.Menu;
import mineplex.core.progression.ProgressiveKit;
import java.util.UUID;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.inventory.ClickType;
import org.bukkit.inventory.ItemStack;
import java.util.UUID;
import mineplex.core.common.util.F;
import mineplex.core.menu.Menu;
import mineplex.core.progression.KitProgressionManager;
import mineplex.core.progression.ProgressiveKit;
import mineplex.core.progression.data.KitUpgradeProcessor;
import mineplex.core.progression.data.KitUpgradeShop;
import mineplex.core.shop.confirmation.ConfirmationPage;
/**
* @author Timothy Andis (TadahTech) on 4/7/2016.
@ -16,11 +21,13 @@ import java.util.UUID;
public class KitUpgradeButton extends KitButton
{
private KitProgressionManager _plugin;
private int _upgradeLevel;
public KitUpgradeButton(ProgressiveKit kit, ItemStack itemStack, int upgradeLevel)
public KitUpgradeButton(KitProgressionManager plugin, ProgressiveKit kit, ItemStack itemStack, int upgradeLevel)
{
super(kit, itemStack);
_plugin = plugin;
_upgradeLevel = upgradeLevel;
}
@ -35,15 +42,15 @@ public class KitUpgradeButton extends KitButton
player.sendMessage(F.main("Kit Progression", "You cannot purchase this upgrade!"));
return;
}
getKit().upgrade(_upgradeLevel, uuid);
player.playSound(player.getLocation(), Sound.CAT_MEOW, 5.0f, 1.0f);
player.sendMessage(F.main("Kit Progression", "Purchased upgrades for " + getKit().getDisplayName() + " level " + _upgradeLevel));
KitUpgradeShop shop = new KitUpgradeShop(_plugin, _plugin.getClientManager(), _plugin.getDonationManager());
KitUpgradeProcessor processor = new KitUpgradeProcessor(_plugin, player, getKit(), _upgradeLevel);
ConfirmationPage<KitProgressionManager, KitUpgradeShop> page = new ConfirmationPage<KitProgressionManager, KitUpgradeShop>(player, _plugin, shop, _plugin.getClientManager(), _plugin.getDonationManager(), processor, getItemStack());
shop.openPageForPlayer(player, page);
Menu.remove(uuid);
player.closeInventory();
//player.closeInventory();
}
}

View File

@ -2,6 +2,7 @@ package mineplex.core.progression.gui.buttons;
import com.google.common.collect.Lists;
import mineplex.core.itemstack.ItemBuilder;
import mineplex.core.progression.KitProgressionManager;
import mineplex.core.progression.ProgressiveKit;
import mineplex.core.progression.gui.guis.KitInformationTrackerMenu;
import mineplex.core.progression.gui.guis.KitMenu;
@ -23,9 +24,9 @@ public class KitXPButton extends KitButton
private ItemStack _item;
public KitXPButton(ProgressiveKit kit, Player player)
public KitXPButton(ProgressiveKit kit, Player player, KitProgressionManager plugin)
{
super(kit, null);
super(kit, null, plugin);
ItemBuilder builder = new ItemBuilder(Material.EXP_BOTTLE);
builder.setTitle(ChatColor.YELLOW + "XP and Level");

View File

@ -63,7 +63,7 @@ public class KitDisplayMenu extends KitMenu
*/
private void setUpNextMenuButtons(Button[] buttons, Player player)
{
buttons[48] = new KitXPButton(getKit(), player);
buttons[48] = new KitXPButton(getKit(), player, getPlugin());
buttons[50] = new KitUpgradeMenuButton(getKit(), player, getPlugin());
}

View File

@ -1,6 +1,17 @@
package mineplex.core.progression.gui.guis;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import org.bukkit.ChatColor;
import org.bukkit.DyeColor;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import com.google.common.collect.Lists;
import mineplex.core.common.util.C;
import mineplex.core.itemstack.ItemBuilder;
import mineplex.core.menu.Button;
@ -11,15 +22,6 @@ import mineplex.core.progression.gui.buttons.KitUpgradeButton;
import mineplex.core.progression.gui.buttons.KitUpgradeDetailsButton;
import mineplex.core.progression.gui.buttons.misc.BackButton;
import mineplex.core.progression.math.Calculations;
import org.bukkit.ChatColor;
import org.bukkit.DyeColor;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import java.util.List;
import java.util.Map;
import java.util.UUID;
/**
* This is the secondary menu access by either the Enchantment table or XP Bottle
@ -174,8 +176,8 @@ public class KitInformationTrackerMenu extends KitMenu
itemStack.addLore("Costs " + C.cGreen + Calculations.getGemsCost(index) + C.cGray + " gems");
itemStack.addLore(C.cRed + "You cannot purchase this upgrade!");
}
KitUpgradeButton upgradeButton = new KitUpgradeButton(getKit(), itemStack.build(), index);
KitUpgradeButton upgradeButton = new KitUpgradeButton(getPlugin(), getKit(), itemStack.build(), index);
buttons[i] = upgradeButton;
}
return;

View File

@ -376,7 +376,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
_punishmentManager = punish;
_kitProgressionManager = new KitProgressionManager(getPlugin(), clientManager);
_kitProgressionManager = new KitProgressionManager(getPlugin(), donationManager, clientManager);
_progressionKitManager = new ProgressingKitManager(this);
_serverUptimeManager = new ServerUptimeManager(this);

View File

@ -59,6 +59,7 @@ import nautilus.game.arcade.game.games.monstermaze.MonsterMaze;
import nautilus.game.arcade.game.games.oldmineware.OldMineWare;
import nautilus.game.arcade.game.games.paintball.Paintball;
import nautilus.game.arcade.game.games.quiver.Quiver;
import nautilus.game.arcade.game.games.quiver.QuiverPayload;
import nautilus.game.arcade.game.games.quiver.QuiverTeams;
import nautilus.game.arcade.game.games.quiver.modes.BunnyHop;
import nautilus.game.arcade.game.games.rings.ElytraRings;
@ -157,6 +158,7 @@ public enum GameType
OldMineWare(OldMineWare.class, GameDisplay.OldMineWare),
Paintball(Paintball.class, GameDisplay.Paintball),
Quiver(Quiver.class, GameDisplay.Quiver),
QuiverPayload(QuiverPayload.class, GameDisplay.QuiverPayload),
QuiverTeams(QuiverTeams.class, GameDisplay.QuiverTeams),
Runner(Runner.class, GameDisplay.Runner),
SearchAndDestroy(SearchAndDestroy.class, GameDisplay.SearchAndDestroy),

View File

@ -5,17 +5,29 @@ import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityShootBowEvent;
import org.bukkit.event.player.PlayerPickupItemEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.scoreboard.DisplaySlot;
import org.bukkit.scoreboard.Objective;
import mineplex.core.common.Pair;
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.core.itemstack.ItemStackFactory;
import mineplex.core.itemstack.ItemBuilder;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import mineplex.minecraft.game.core.condition.Condition.ConditionType;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
@ -31,19 +43,6 @@ import nautilus.game.arcade.stats.SharpShooterStatTracker;
import nautilus.game.arcade.stats.WinWithoutBowStatTracker;
import nautilus.game.arcade.stats.WinWithoutDyingStatTracker;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityShootBowEvent;
import org.bukkit.event.player.PlayerPickupItemEvent;
import org.bukkit.scoreboard.DisplaySlot;
import org.bukkit.scoreboard.Objective;
public class Quiver extends SoloGame
{
private ArrayList<QuiverScore> _ranks = new ArrayList<QuiverScore>();
@ -52,7 +51,10 @@ public class Quiver extends SoloGame
private HashMap<Player, Long> _deathTime = new HashMap<Player, Long>();
private Objective _scoreObj;
public static final ItemStack SUPER_ARROW = new ItemBuilder(Material.ARROW).setTitle(C.cYellow + "Super Arrow").build();
@SuppressWarnings("unchecked")
public Quiver(ArcadeManager manager)
{
this(manager, new Kit[]
@ -62,6 +64,12 @@ public class Quiver extends SoloGame
new KitEnchanter(manager),
new KitSlamShot(manager),
new KitNinja(manager)
// new KitBeserker(manager),
// new KitNewNinja(manager),
// new KitBarrage(manager),
// new KitHeadHunter(manager),
// new KitPyromancer(manager),
// new KitNecromancer(manager),
}, GameType.Quiver);
registerStatTrackers(
@ -81,6 +89,7 @@ public class Quiver extends SoloGame
);
}
@SuppressWarnings("deprecation")
public Quiver(ArcadeManager manager, Kit[] kits, GameType type)
{
super(manager, type, kits,
@ -97,8 +106,6 @@ public class Quiver extends SoloGame
this.DamageSelf = false;
this.DamageTeamSelf = true;
this.PrepareFreeze = false;
this.BlockBreakAllow.add(102);
this.BlockBreakAllow.add(20);
this.BlockBreakAllow.add(Material.STAINED_GLASS_PANE.getId());
this.BlockBreakAllow.add(Material.STAINED_GLASS.getId());
@ -116,7 +123,7 @@ public class Quiver extends SoloGame
for (Player player : GetPlayers(true))
{
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(262, (byte)0, 1, F.item("Super Arrow")));
player.getInventory().addItem(SUPER_ARROW);
player.playSound(player.getLocation(), Sound.PISTON_EXTEND, 3f, 2f);
}
}
@ -150,7 +157,7 @@ public class Quiver extends SoloGame
public void run()
{
if (!player.getInventory().contains(Material.ARROW))
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(262, (byte)0, 1, F.item("Super Arrow")));
player.getInventory().addItem(SUPER_ARROW);
}
}, 10);
@ -173,18 +180,18 @@ public class Quiver extends SoloGame
Player player = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName());
if (player == null) return;
int amount = 1;
if (GetKit(player) instanceof KitSlamShot)
{
if (Manager.GetCondition().HasCondition(event.GetEvent().getEntity(), ConditionType.FALLING, null))
{
amount = 2;
}
}
// int amount = 1;
//
// if (GetKit(player) instanceof KitSlamShot)
// {
// if (Manager.GetCondition().HasCondition(event.GetEvent().getEntity(), ConditionType.FALLING, null))
// {
// amount = 2;
// }
// }
//New Arrow
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(262, (byte)0, amount, F.item("Super Arrow")));
player.getInventory().addItem(SUPER_ARROW);
player.playSound(player.getLocation(), Sound.PISTON_EXTEND, 3f, 2f);
//Score
@ -280,17 +287,14 @@ public class Quiver extends SoloGame
@EventHandler
public void ArrowDamage(CustomDamageEvent event)
{
if (!(event.GetDamagerEntity(true) instanceof Arrow)
&& !(event.GetDamagerEntity(true) instanceof Player)
&& (event.GetDamagerEntity(true) instanceof Entity))
{
event.setCancelled(true);
return;
}
{
if (event.GetProjectile() == null)
return;
if (!(event.GetProjectile() instanceof Arrow))
{
return;
}
event.AddMod("Projectile", "Instagib", 9001, false);
event.SetKnockback(false);
@ -312,6 +316,7 @@ public class Quiver extends SoloGame
Scoreboard.writeNewLine();
//Write New
Scoreboard.writeGroup(_ranks, score -> Pair.create(C.cGreen + score.Player.getName(), score.Kills), true);
Scoreboard.draw();

View File

@ -0,0 +1,122 @@
package nautilus.game.arcade.game.games.quiver.data;
import org.bukkit.Color;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Item;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import org.bukkit.util.Vector;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.games.quiver.Quiver;
import nautilus.game.arcade.game.games.quiver.QuiverPayload;
public class PowerupGenerator
{
private static final int ARROWS_TO_GIVE = 1;
private static final int FIREWORK_VIEW_DISTANCE = 10;
private QuiverPayload _game;
private Location _location;
private Item _item;
private long _lastPickup;
private long _respawnDelay;
public PowerupGenerator(QuiverPayload game, Location location, long respawnDelay)
{
_game = game;
_location = location;
_lastPickup = System.currentTimeMillis();
_respawnDelay = respawnDelay;
_location.getBlock().getRelative(BlockFace.DOWN).setType(Material.IRON_BLOCK);
}
public void update()
{
if (_item != null)
{
if (!_item.isValid())
{
_item.remove();
_item = null;
}
return;
}
if (UtilTime.elapsed(_lastPickup, _respawnDelay))
{
_item = _location.getWorld().dropItem(_location, new ItemStack(Material.ARROW));
_item.setVelocity(new Vector(0, 1, 0));
_item.getLocation().getBlock().getRelative(BlockFace.DOWN).setType(Material.GOLD_BLOCK);
playFirework();
}
}
public void pickup(Player player, Item item)
{
if (_item == null)
{
return;
}
if (!_item.equals(item))
{
return;
}
if (!_game.IsAlive(player))
{
return;
}
GameTeam gameTeam = _game.GetTeam(player);
if (gameTeam == null)
{
return;
}
_item.remove();
_item = null;
_lastPickup = System.currentTimeMillis();
_location.getBlock().getRelative(BlockFace.DOWN).setType(Material.IRON_BLOCK);
player.sendMessage(F.main("Game", "You collected the resupply powerup."));
playFirework();
ItemStack itemStack = Quiver.SUPER_ARROW.clone();
itemStack.setAmount(ARROWS_TO_GIVE);
player.getInventory().addItem(itemStack);
}
private void playFirework()
{
for (Player player : UtilServer.getPlayers())
{
if (UtilMath.offset(_location, player.getLocation()) < FIREWORK_VIEW_DISTANCE)
{
UtilFirework.packetPlayFirework(player, _location, Type.BALL_LARGE, Color.YELLOW, false, true);
}
}
}
}

View File

@ -0,0 +1,101 @@
package nautilus.game.arcade.game.games.quiver.data;
import java.util.Set;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.GameTeam;
public class SpawnBarrier
{
private Game _game;
private GameTeam _gameTeam;
private Set<Location> _barriers;
public SpawnBarrier(Game game, GameTeam gameTeam, Set<Location> barriers)
{
_game = game;
_gameTeam = gameTeam;
_barriers = barriers;
for (Location location : _barriers)
{
location.getBlock().setType(Material.AIR);
}
}
public void update()
{
for (Player player : _game.GetPlayers(true))
{
if (UtilPlayer.isSpectator(player))
{
continue;
}
if (_game.GetTeam(player).equals(_gameTeam))
{
continue;
}
for (Location location : _gameTeam.GetSpawns())
{
if (UtilMath.offset(player.getLocation(), location) < 5)
{
_game.Manager.GetDamage().NewDamageEvent(player, null, null, DamageCause.VOID, 9001, false, true, true, _game.GetName(), "Spawn Shield");
}
}
for (Location location : _barriers)
{
if (UtilMath.offset(player.getLocation(), location) < 4)
{
UtilAction.velocity(player, UtilAlg.getTrajectory(location, player.getLocation()).normalize().setY(0.4));
}
}
}
}
public void playParticles()
{
for (Player player : _game.GetPlayers(true))
{
if (UtilPlayer.isSpectator(player))
{
continue;
}
if (_game.GetTeam(player).equals(_gameTeam))
{
continue;
}
for (Location location : _barriers)
{
UtilParticle.PlayParticle(ParticleType.BARRIER, location.clone().add(0, 0.5, 0), 0, 0, 0, 0.1F, 1, ViewDist.SHORT, player);
}
}
}
public GameTeam getGameTeam()
{
return _gameTeam;
}
public Set<Location> getBlocks()
{
return _barriers;
}
}

View File

@ -0,0 +1,144 @@
package nautilus.game.arcade.game.games.quiver.kits;
import java.util.UUID;
import org.bukkit.Bukkit;
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.common.util.UtilInv;
import mineplex.core.common.util.UtilServer;
import mineplex.core.itemstack.ItemBuilder;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.games.quiver.Quiver;
import nautilus.game.arcade.game.games.quiver.QuiverPayload;
import nautilus.game.arcade.game.games.quiver.ultimates.UltimateBarrage;
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.PerkFletcher;
public class KitBarrage extends ProgressingKit
{
private static final String[] DESCRIPTION = {
"Oooo look an arrow... ooo look an arrow...",
"",
"Gain an arrow every " + C.cGreen + "5" + C.cWhite + " seconds.",
"",
C.cGreenB + "ULTIMATE",
"When you fire your next arrow you fire an additional",
C.cGreen + "10" + C.cWhite + " arrows."
};
private static final String DOUBLE_JUMP = "Double Jump";
private static final String ULTIMATE = "Ultimate";
private static final String SUPER_ARROW = "Super Arrow";
private static final Perk[][] PERKS = {
{
new PerkDoubleJump(DOUBLE_JUMP, 0.9, 0.9, true),
new PerkFletcher(5, 1, true, -1, true, SUPER_ARROW),
new UltimateBarrage(10)
},
{
new PerkDoubleJump(DOUBLE_JUMP, 0.9, 0.9, true),
new PerkFletcher(5, 1, true, -1, true, SUPER_ARROW),
new UltimateBarrage(12)
},
{
new PerkDoubleJump(DOUBLE_JUMP, 0.9, 0.9, true),
new PerkFletcher(5, 1, true, -1, true, SUPER_ARROW),
new UltimateBarrage(14)
},
{
new PerkDoubleJump(DOUBLE_JUMP, 0.9, 0.9, true),
new PerkFletcher(5, 1, true, -1, true, SUPER_ARROW),
new UltimateBarrage(16)
},
{
new PerkDoubleJump(DOUBLE_JUMP, 0.9, 0.9, true),
new PerkFletcher(5, 1, true, -1, true, SUPER_ARROW),
new UltimateBarrage(18)
},
{
new PerkDoubleJump(DOUBLE_JUMP, 0.9, 0.9, true),
new PerkFletcher(5, 1, true, -1, true, SUPER_ARROW),
new UltimateBarrage(20)
}
};
private static final String[][] UPGRADE_DETAILS = {
{
increaseArrows(2),
},
{
increaseArrows(2),
},
{
increaseArrows(2),
},
{
increaseArrows(2),
},
{
increaseArrows(2),
},
};
private static final String increaseArrows(int arrows)
{
return C.cWhite + "Increase arrows fired from " + C.cGreen + ULTIMATE + C.cWhite + " by " + C.cGreen + arrows + C.cWhite + ".";
}
private static final ItemStack IN_HAND = new ItemStack(Material.IRON_AXE);
private static final ItemStack[] PLAYER_ITEMS = {
new ItemBuilder(Material.IRON_AXE).setUnbreakable(true).build(),
new ItemBuilder(Material.BOW).setUnbreakable(true).build(),
};
public KitBarrage(ArcadeManager manager)
{
super(manager, "Barrage", "quiverbarrage", KitAvailability.Free, DESCRIPTION, PERKS, UPGRADE_DETAILS, EntityType.ZOMBIE, IN_HAND);
}
@Override
public void GiveItems(Player player)
{
player.getInventory().addItem(PLAYER_ITEMS);
if (Manager.GetGame().GetState() == GameState.Live)
{
player.getInventory().addItem(Quiver.SUPER_ARROW);
UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(Manager.getPlugin(), () -> UtilInv.Update(player), 10);
}
}
@Override
public void onSelected(UUID player)
{
super.onSelected(player);
if (!Manager.GetGame().IsLive())
{
return;
}
QuiverPayload quiverPayload = (QuiverPayload) Manager.GetGame();
quiverPayload.resetUltimate(Bukkit.getPlayer(player), true);
}
@Override
public boolean showUpgrades()
{
return true;
}
}

View File

@ -0,0 +1,139 @@
package nautilus.game.arcade.game.games.quiver.kits;
import java.util.UUID;
import org.bukkit.Bukkit;
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.common.util.UtilInv;
import mineplex.core.common.util.UtilServer;
import mineplex.core.itemstack.ItemBuilder;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.games.quiver.Quiver;
import nautilus.game.arcade.game.games.quiver.QuiverPayload;
import nautilus.game.arcade.game.games.quiver.ultimates.UltimateBeserker;
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.PerkStrength;
public class KitBeserker extends ProgressingKit
{
private static final String[] DESCRIPTION = {
"Missed your arrow? Not a big deal.",
"",
"Deal " + C.cGreen + "+1" + C.cWhite + " more damage",
"",
C.cGreenB + "ULTIMATE",
"You equip " + C.cGreen + "iron" + C.cWhite + " chestplate, leggings and boots.",
"Arrows do not one hit you.",
"Lasts for " + C.cGreen + "6" + C.cWhite + " seconds."
};
private static final String DOUBLE_JUMP = "Double Jump";
private static final String ULTIMATE = "Ultimate";
private static final String DURATION = "Duration";
private static final Perk[][] PERKS = {
{
new PerkDoubleJump(DOUBLE_JUMP, 0.9, 0.9, true),
new PerkStrength(1),
new UltimateBeserker(6000)
},
{
new PerkDoubleJump(DOUBLE_JUMP, 0.9, 0.9, true),
new PerkStrength(1),
new UltimateBeserker(6500)
},
{
new PerkDoubleJump(DOUBLE_JUMP, 0.9, 0.9, true),
new PerkStrength(1),
new UltimateBeserker(7000)
},
{
new PerkDoubleJump(DOUBLE_JUMP, 0.9, 0.9, true),
new PerkStrength(1),
new UltimateBeserker(7500)
},
{
new PerkDoubleJump(DOUBLE_JUMP, 0.9, 0.9, true),
new PerkStrength(1),
new UltimateBeserker(8000)
},
{
new PerkDoubleJump(DOUBLE_JUMP, 0.9, 0.9, true),
new PerkStrength(1),
new UltimateBeserker(8500)
}
};
private static final String[][] UPGRADE_DETAILS = {
{
increase(ULTIMATE, DURATION, 12)
},
{
increase(ULTIMATE, DURATION, 12)
},
{
increase(ULTIMATE, DURATION, 12)
},
{
increase(ULTIMATE, DURATION, 12)
},
{
increase(ULTIMATE, DURATION, 12)
},
};
private static final ItemStack IN_HAND = new ItemStack(Material.IRON_SWORD);
private static final ItemStack[] PLAYER_ITEMS = {
new ItemBuilder(Material.IRON_SWORD).setUnbreakable(true).build(),
new ItemBuilder(Material.BOW).setUnbreakable(true).build(),
};
public KitBeserker(ArcadeManager manager)
{
super(manager, "Berserker", "quiverbeserker", KitAvailability.Free, DESCRIPTION, PERKS, UPGRADE_DETAILS, EntityType.ZOMBIE, IN_HAND);
}
@Override
public void GiveItems(Player player)
{
player.getInventory().addItem(PLAYER_ITEMS);
if (Manager.GetGame().GetState() == GameState.Live)
{
player.getInventory().addItem(Quiver.SUPER_ARROW);
UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(Manager.getPlugin(), () -> UtilInv.Update(player), 10);
}
}
@Override
public void onSelected(UUID player)
{
super.onSelected(player);
if (!Manager.GetGame().IsLive())
{
return;
}
QuiverPayload quiverPayload = (QuiverPayload) Manager.GetGame();
quiverPayload.resetUltimate(Bukkit.getPlayer(player), true);
}
@Override
public boolean showUpgrades()
{
return true;
}
}

View File

@ -1,5 +1,10 @@
package nautilus.game.arcade.game.games.quiver.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.common.util.F;
import mineplex.core.common.util.UtilInv;
@ -13,22 +18,17 @@ import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.ProgressingKit;
import nautilus.game.arcade.kit.perks.PerkArrowRebound;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
public class KitEnchanter extends ProgressingKit
{
private static final String[] DESCRIPTION = {
"3 Kills, 1 Arrow.",
"",
"Arrows bounce " + C.cGreen + "2" + C.cWhite + " times upon hitting your target"
"Arrows bounce " + C.cGreen + "once" + C.cWhite + " upon hitting your target"
};
private static final Perk[] PERKS = {
new PerkArrowRebound(2, 1.2f)
};
new PerkArrowRebound(1, 1.2F, 1)
};
private static final ItemStack IN_HAND = new ItemStack(Material.BOW);

View File

@ -38,7 +38,6 @@ public class KitLeaper extends ProgressingKit
public KitLeaper(ArcadeManager manager)
{
super(manager, "Jumper", "quiverjumper", KitAvailability.Free, DESCRIPTION, PERKS, EntityType.ZOMBIE, IN_HAND);
}
@Override

View File

@ -0,0 +1,139 @@
package nautilus.game.arcade.game.games.quiver.kits;
import java.util.UUID;
import org.bukkit.Bukkit;
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.common.util.UtilInv;
import mineplex.core.common.util.UtilServer;
import mineplex.core.itemstack.ItemBuilder;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.games.quiver.Quiver;
import nautilus.game.arcade.game.games.quiver.QuiverPayload;
import nautilus.game.arcade.game.games.quiver.ultimates.UltimateNecromancer;
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.PerkLifestealArrows;
public class KitNecromancer extends ProgressingKit
{
private static final String[] DESCRIPTION = {
"Spooky scary skeletons",
"",
"Successful arrow hits restore " + C.cGreen + "2" + C.cWhite + " hearts.",
"",
C.cGreenB + "ULTIMATE",
"Summon " + C.cGreen + "4 Undead Minions" + C.cWhite + " that shoot at other players",
"Lasts for " + C.cGreen + "10" + C.cWhite + " seconds."
};
private static final String DOUBLE_JUMP = "Double Jump";
private static final String ULTIMATE = "Ultimate";
private static final String DURATION = "Duration";
private static final Perk[][] PERKS = {
{
new PerkDoubleJump(DOUBLE_JUMP, 0.9, 0.9, true),
new PerkLifestealArrows(8),
new UltimateNecromancer(10000, 4)
},
{
new PerkDoubleJump(DOUBLE_JUMP, 0.9, 0.9, true),
new PerkLifestealArrows(8),
new UltimateNecromancer(10500, 4)
},
{
new PerkDoubleJump(DOUBLE_JUMP, 0.9, 0.9, true),
new PerkLifestealArrows(8),
new UltimateNecromancer(11000, 4)
},
{
new PerkDoubleJump(DOUBLE_JUMP, 0.9, 0.9, true),
new PerkLifestealArrows(8),
new UltimateNecromancer(11500, 4)
},
{
new PerkDoubleJump(DOUBLE_JUMP, 0.9, 0.9, true),
new PerkLifestealArrows(8),
new UltimateNecromancer(12000, 4)
},
{
new PerkDoubleJump(DOUBLE_JUMP, 0.9, 0.9, true),
new PerkLifestealArrows(8),
new UltimateNecromancer(12500, 4)
}
};
private static final String[][] UPGRADE_DETAILS = {
{
increase(ULTIMATE, DURATION, 10)
},
{
increase(ULTIMATE, DURATION, 10)
},
{
increase(ULTIMATE, DURATION, 10)
},
{
increase(ULTIMATE, DURATION, 10)
},
{
increase(ULTIMATE, DURATION, 10)
},
};
private static final ItemStack IN_HAND = new ItemStack(Material.BONE);
private static final ItemStack[] PLAYER_ITEMS = {
new ItemBuilder(Material.IRON_AXE).setUnbreakable(true).build(),
new ItemBuilder(Material.BOW).setUnbreakable(true).build(),
};
public KitNecromancer(ArcadeManager manager)
{
super(manager, "Necromancer", "quivernecromancer", KitAvailability.Free, DESCRIPTION, PERKS, UPGRADE_DETAILS, EntityType.ZOMBIE, IN_HAND);
}
@Override
public void GiveItems(Player player)
{
player.getInventory().addItem(PLAYER_ITEMS);
if (Manager.GetGame().GetState() == GameState.Live)
{
player.getInventory().addItem(Quiver.SUPER_ARROW);
UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(Manager.getPlugin(), () -> UtilInv.Update(player), 10);
}
}
@Override
public void onSelected(UUID player)
{
super.onSelected(player);
if (!Manager.GetGame().IsLive())
{
return;
}
QuiverPayload quiverPayload = (QuiverPayload) Manager.GetGame();
quiverPayload.resetUltimate(Bukkit.getPlayer(player), true);
}
@Override
public boolean showUpgrades()
{
return true;
}
}

View File

@ -0,0 +1,130 @@
package nautilus.game.arcade.game.games.quiver.kits;
import java.util.UUID;
import org.bukkit.Bukkit;
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.game.games.quiver.QuiverPayload;
import nautilus.game.arcade.game.games.quiver.ultimates.UltimateNinja;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.ProgressingKit;
import nautilus.game.arcade.kit.perks.PerkDash;
import nautilus.game.arcade.kit.perks.PerkDoubleJump;
public class KitNewNinja extends ProgressingKit
{
private static final String[] DESCRIPTION = {
"Zip zap boing around the map!",
"You do not spawn with an arrow!",
"",
C.cYellow + "Right-click " + C.cGreen + "Sword" + C.cWhite + " to dash.",
"",
C.cGreenB + "ULTIMATE",
"Your " + C.cGreen + "Gold Sword" + C.cWhite + " changes into a " + C.cGreen + "Diamond Sword" + C.cWhite + ".",
"This new sword kills players in " + C.cRedB + "ONE" + C.cWhite + " hit!",
"Lasts for " + C.cGreen + "6" + C.cWhite + " seconds."
};
private static final String DOUBLE_JUMP = "Double Jump";
private static final String ULTIMATE = "Ultimate";
private static final String DURATION = "Duration";
private static final Perk[][] PERKS = {
{
new PerkDoubleJump(DOUBLE_JUMP, 0.9, 0.9, true),
new PerkDash(5000, 10, 8),
new UltimateNinja(6000)
},
{
new PerkDoubleJump(DOUBLE_JUMP, 0.9, 0.9, true),
new PerkDash(5000, 10, 8),
new UltimateNinja(6500)
},
{
new PerkDoubleJump(DOUBLE_JUMP, 0.9, 0.9, true),
new PerkDash(5000, 10, 8),
new UltimateNinja(7000)
},
{
new PerkDoubleJump(DOUBLE_JUMP, 0.9, 0.9, true),
new PerkDash(5000, 10, 8),
new UltimateNinja(7500)
},
{
new PerkDoubleJump(DOUBLE_JUMP, 0.9, 0.9, true),
new PerkDash(5000, 10, 8),
new UltimateNinja(8000)
},
{
new PerkDoubleJump(DOUBLE_JUMP, 0.9, 0.9, true),
new PerkDash(5000, 10, 8),
new UltimateNinja(8500)
}
};
private static final String[][] UPGRADE_DETAILS = {
{
increase(ULTIMATE, DURATION, 12)
},
{
increase(ULTIMATE, DURATION, 12)
},
{
increase(ULTIMATE, DURATION, 12)
},
{
increase(ULTIMATE, DURATION, 12)
},
{
increase(ULTIMATE, DURATION, 12)
},
};
private static final ItemStack IN_HAND = new ItemStack(Material.GOLD_SWORD);
private static final ItemStack[] PLAYER_ITEMS = {
new ItemBuilder(Material.GOLD_SWORD).setUnbreakable(true).build(),
new ItemBuilder(Material.BOW).setUnbreakable(true).build(),
};
public KitNewNinja(ArcadeManager manager)
{
super(manager, "Ninja", "quivernewninja", KitAvailability.Free, DESCRIPTION, PERKS, UPGRADE_DETAILS, EntityType.ZOMBIE, IN_HAND);
}
@Override
public void GiveItems(Player player)
{
player.getInventory().addItem(PLAYER_ITEMS);
}
@Override
public void onSelected(UUID player)
{
super.onSelected(player);
if (!Manager.GetGame().IsLive())
{
return;
}
QuiverPayload quiverPayload = (QuiverPayload) Manager.GetGame();
quiverPayload.resetUltimate(Bukkit.getPlayer(player), true);
}
@Override
public boolean showUpgrades()
{
return true;
}
}

View File

@ -0,0 +1,142 @@
package nautilus.game.arcade.game.games.quiver.kits;
import java.util.UUID;
import org.bukkit.Bukkit;
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.common.util.UtilInv;
import mineplex.core.common.util.UtilServer;
import mineplex.core.itemstack.ItemBuilder;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.games.quiver.Quiver;
import nautilus.game.arcade.game.games.quiver.QuiverPayload;
import nautilus.game.arcade.game.games.quiver.ultimates.UltimatePyromancer;
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.PerkFireArrows;
public class KitPyromancer extends ProgressingKit
{
private static final String[] DESCRIPTION = {
"Hot! Hot! Hot!",
"",
"When your arrows land, players within " + C.cGreen + "2" + C.cWhite + " blocks are set on",
"fire for " + C.cGreen + "3" + C.cWhite + " seconds.",
"",
C.cGreenB + "ULTIMATE",
"You begin to fire " + C.cGreen + "20" + C.cWhite + " arrows per second in all directions around you.",
"During this time you have " + C.cGreen + "75%" + C.cWhite + " reduced movement speed and are",
"unable to jump.",
"Lasts for " + C.cGreen + "5" + C.cWhite + " seconds"
};
private static final String DOUBLE_JUMP = "Double Jump";
private static final String ULTIMATE = "Ultimate";
private static final String DURATION = "Duration";
private static final Perk[][] PERKS = {
{
new PerkDoubleJump(DOUBLE_JUMP, 0.9, 0.9, true),
new PerkFireArrows(3, 60),
new UltimatePyromancer(5000)
},
{
new PerkDoubleJump(DOUBLE_JUMP, 0.9, 0.9, true),
new PerkFireArrows(3, 60),
new UltimatePyromancer(5500)
},
{
new PerkDoubleJump(DOUBLE_JUMP, 0.9, 0.9, true),
new PerkFireArrows(3, 60),
new UltimatePyromancer(6000)
},
{
new PerkDoubleJump(DOUBLE_JUMP, 0.9, 0.9, true),
new PerkFireArrows(3, 60),
new UltimatePyromancer(6500)
},
{
new PerkDoubleJump(DOUBLE_JUMP, 0.9, 0.9, true),
new PerkFireArrows(3, 60),
new UltimatePyromancer(7000)
},
{
new PerkDoubleJump(DOUBLE_JUMP, 0.9, 0.9, true),
new PerkFireArrows(2, 60),
new UltimatePyromancer(7500)
}
};
private static final String[][] UPGRADE_DETAILS = {
{
increase(ULTIMATE, DURATION, 10)
},
{
increase(ULTIMATE, DURATION, 10)
},
{
increase(ULTIMATE, DURATION, 10)
},
{
increase(ULTIMATE, DURATION, 10)
},
{
increase(ULTIMATE, DURATION, 10)
},
};
private static final ItemStack IN_HAND = new ItemStack(Material.BLAZE_POWDER);
private static final ItemStack[] PLAYER_ITEMS = {
new ItemBuilder(Material.IRON_AXE).setUnbreakable(true).build(),
new ItemBuilder(Material.BOW).setUnbreakable(true).build(),
};
public KitPyromancer(ArcadeManager manager)
{
super(manager, "Pyromancer", "quiverpyromancer", KitAvailability.Free, DESCRIPTION, PERKS, UPGRADE_DETAILS, EntityType.ZOMBIE, IN_HAND);
}
@Override
public void GiveItems(Player player)
{
player.getInventory().addItem(PLAYER_ITEMS);
if (Manager.GetGame().GetState() == GameState.Live)
{
player.getInventory().addItem(Quiver.SUPER_ARROW);
UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(Manager.getPlugin(), () -> UtilInv.Update(player), 10);
}
}
@Override
public void onSelected(UUID player)
{
super.onSelected(player);
if (!Manager.GetGame().IsLive())
{
return;
}
QuiverPayload quiverPayload = (QuiverPayload) Manager.GetGame();
quiverPayload.resetUltimate(Bukkit.getPlayer(player), true);
}
@Override
public boolean showUpgrades()
{
return true;
}
}

View File

@ -0,0 +1,154 @@
package nautilus.game.arcade.game.games.quiver.kits;
import java.util.UUID;
import org.bukkit.Bukkit;
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.common.util.UtilInv;
import mineplex.core.common.util.UtilServer;
import mineplex.core.itemstack.ItemBuilder;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.games.quiver.Quiver;
import nautilus.game.arcade.game.games.quiver.QuiverPayload;
import nautilus.game.arcade.game.games.quiver.ultimates.UltimateSkyWarrior;
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.PerkSpeed;
public class KitSkyWarrior extends ProgressingKit
{
private static final String[] DESCRIPTION = {
"We\'ll see you in the sky.",
"",
"Gain permanent Speed I",
"",
C.cGreenB + "ULTIMATE",
"You fly up into the air and are given a launcher.",
"Clicking the launcher fires a Astral Arrow.",
"When it hits a block a pulse of energy is fired",
"damaging all players within " + C.cGreen + "5" + C.cWhite + " blocks",
"for " + C.cGreen + "10" + C.cWhite + " damage.",
"",
"Total of " + C.cRed + "3" + C.cWhite + " uses!",
"",
"Once all arrows are fired you teleport to a random",
"teammate dealing damage to all players within",
C.cGreen + "10" + C.cWhite + " blocks for " + C.cGreen + "5" + C.cWhite + " damage."
};
private static final String DOUBLE_JUMP = "Double Jump";
private static final String ULTIMATE = "Ultimate";
private static final String DAMAGE = "Damage";
private static final String DAMAGE_TELEPORT = "Teleportation Damage";
private static final Perk[][] PERKS = {
{
new PerkDoubleJump(DOUBLE_JUMP, 0.9, 0.9, true),
new PerkSpeed(0),
new UltimateSkyWarrior(5, 10, 10, 5, 30)
},
{
new PerkDoubleJump(DOUBLE_JUMP, 0.9, 0.9, true),
new PerkSpeed(0),
new UltimateSkyWarrior(5.5, 10, 11, 5, 30)
},
{
new PerkDoubleJump(DOUBLE_JUMP, 0.9, 0.9, true),
new PerkSpeed(0),
new UltimateSkyWarrior(6, 10, 12, 5, 30)
},
{
new PerkDoubleJump(DOUBLE_JUMP, 0.9, 0.9, true),
new PerkSpeed(0),
new UltimateSkyWarrior(6.5, 10, 13, 5, 30)
},
{
new PerkDoubleJump(DOUBLE_JUMP, 0.9, 0.9, true),
new PerkSpeed(0),
new UltimateSkyWarrior(7, 10, 14, 5, 30)
},
{
new PerkDoubleJump(DOUBLE_JUMP, 0.9, 0.9, true),
new PerkSpeed(0),
new UltimateSkyWarrior(7.5, 10, 15, 5, 30)
}
};
private static final String[][] UPGRADE_DETAILS = {
{
increase(ULTIMATE, DAMAGE, 10),
increase(ULTIMATE, DAMAGE_TELEPORT, 10),
},
{
increase(ULTIMATE, DAMAGE, 10),
increase(ULTIMATE, DAMAGE_TELEPORT, 10),
},
{
increase(ULTIMATE, DAMAGE, 10),
increase(ULTIMATE, DAMAGE_TELEPORT, 10),
},
{
increase(ULTIMATE, DAMAGE, 10),
increase(ULTIMATE, DAMAGE_TELEPORT, 10),
},
{
increase(ULTIMATE, DAMAGE, 10),
increase(ULTIMATE, DAMAGE_TELEPORT, 10),
},
};
private static final ItemStack IN_HAND = new ItemStack(Material.FEATHER);
private static final ItemStack[] PLAYER_ITEMS = {
new ItemBuilder(Material.IRON_AXE).setUnbreakable(true).build(),
new ItemBuilder(Material.BOW).setUnbreakable(true).build(),
};
public KitSkyWarrior(ArcadeManager manager)
{
super(manager, "Sky Warrior", "quiverskywarrior", KitAvailability.Free, DESCRIPTION, PERKS, UPGRADE_DETAILS, EntityType.ZOMBIE, IN_HAND);
}
@Override
public void GiveItems(Player player)
{
player.getInventory().addItem(PLAYER_ITEMS);
if (Manager.GetGame().GetState() == GameState.Live)
{
player.getInventory().addItem(Quiver.SUPER_ARROW);
UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(Manager.getPlugin(), () -> UtilInv.Update(player), 10);
}
}
@Override
public void onSelected(UUID player)
{
super.onSelected(player);
if (!Manager.GetGame().IsLive())
{
return;
}
QuiverPayload quiverPayload = (QuiverPayload) Manager.GetGame();
quiverPayload.resetUltimate(Bukkit.getPlayer(player), true);
}
@Override
public boolean showUpgrades()
{
return true;
}
}

View File

@ -25,9 +25,9 @@ public class KitSlamShot extends ProgressingKit
};
private static final Perk[] PERKS = {
new PerkSeismicSlamOITQ()
new PerkSeismicSlamOITQ()
};
private static final ItemStack IN_HAND = new ItemStack(Material.DIAMOND_SPADE);
private static final ItemStack[] PLAYER_ITEMS = {

View File

@ -0,0 +1,126 @@
package nautilus.game.arcade.game.games.quiver.ultimates;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import org.bukkit.ChatColor;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.game.games.quiver.Quiver;
import nautilus.game.arcade.game.games.quiver.kits.KitNewNinja;
import nautilus.game.arcade.kit.Perk;
public abstract class Ultimate extends Perk
{
private Map<UUID, Long> _lastUltimate = new HashMap<>();
public Ultimate(String name, String[] perkDesc)
{
super(name, perkDesc);
}
public void activate(Player player)
{
_lastUltimate.put(player.getUniqueId(), System.currentTimeMillis());
if (!(Manager.GetGame().GetKit(player) instanceof KitNewNinja))
{
player.getInventory().addItem(Quiver.SUPER_ARROW);
}
ChatColor teamColor = Manager.GetGame().GetTeam(player).GetColor();
UtilServer.broadcast(teamColor + C.Bold + player.getName() + C.cWhiteB + " activated their " + teamColor + C.Bold + GetName() + C.cWhiteB + ".");
for (Player other : UtilServer.getPlayers())
{
other.playSound(other.getLocation(), Sound.ENDERDRAGON_GROWL, 1, 0);
}
}
public void cancel(Player player)
{
_lastUltimate.remove(player.getUniqueId());
player.playSound(player.getLocation(), Sound.BLAZE_DEATH, 1, 0);
}
public boolean isUsable(Player player)
{
return true;
}
public abstract double getChargeIncreasePerSecond();
public abstract long getLength();
@EventHandler
public void onUpdate(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST || getLength() == 0)
{
return;
}
for (Player player : UtilServer.getPlayers())
{
if (!_lastUltimate.containsKey(player.getUniqueId()))
{
continue;
}
if (UtilTime.elapsed(_lastUltimate.get(player.getUniqueId()), getLength()))
{
cancel(player);
}
}
}
@EventHandler
public void onCombatDeath(CombatDeathEvent event)
{
if (!(event.GetEvent().getEntity() instanceof Player))
{
return;
}
Player player = (Player) event.GetEvent().getEntity();
if (!_lastUltimate.containsKey(player.getUniqueId()))
{
return;
}
cancel(player);
}
@EventHandler
public void onGameStateChange(GameStateChangeEvent event)
{
if (event.GetState() != GameState.End)
{
for (UUID uuid : _lastUltimate.keySet())
{
cancel(UtilPlayer.searchExact(uuid));
}
}
}
public Map<UUID, Long> getLastUltimate()
{
return _lastUltimate;
}
}

View File

@ -0,0 +1,63 @@
package nautilus.game.arcade.game.games.quiver.ultimates;
import org.bukkit.Sound;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityShootBowEvent;
import org.bukkit.util.Vector;
public class UltimateBarrage extends Ultimate
{
private static final double CHARGE_PER_SECOND = 0.8;
private static final float VELOCITY_MULTIPLIER = 3;
private int _arrows;
public UltimateBarrage(int arrows)
{
super("Arrow Barrage", new String[] {});
_arrows = arrows;
}
@EventHandler
public void onEntityShootBow(EntityShootBowEvent event)
{
if (event.isCancelled() || !(event.getEntity() instanceof Player))
{
return;
}
Player player = (Player) event.getEntity();
if (getLastUltimate().containsKey(player.getUniqueId()))
{
for (int i = 0; i < _arrows; i++)
{
Vector random = new Vector((Math.random() - 0.5) / 3, (Math.random() - 0.5) / 3, (Math.random() - 0.5) / 3);
Arrow arrow = player.launchProjectile(Arrow.class);
arrow.setCritical(true);
arrow.setVelocity(player.getLocation().getDirection().add(random).multiply(VELOCITY_MULTIPLIER));
player.getWorld().playSound(player.getLocation(), Sound.SHOOT_ARROW, 1F, 1F);
}
cancel(player);
}
}
@Override
public double getChargeIncreasePerSecond()
{
return CHARGE_PER_SECOND;
}
@Override
public long getLength()
{
return 0;
}
}

View File

@ -0,0 +1,95 @@
package nautilus.game.arcade.game.games.quiver.ultimates;
import java.util.Iterator;
import org.bukkit.Color;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.inventory.ItemStack;
import mineplex.core.itemstack.ItemBuilder;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import mineplex.minecraft.game.core.damage.DamageChange;
public class UltimateBeserker extends Ultimate
{
private static final double CHARGE_PER_SECOND = 0.4;
private long _length;
public UltimateBeserker(long length)
{
super("Berserker Shield", new String[] {});
_length = length;
}
@EventHandler(priority = EventPriority.HIGHEST)
public void onCustomDamage(CustomDamageEvent event)
{
if (event.isCancelled())
{
return;
}
if (event.GetDamageePlayer() == null)
{
return;
}
if (!getLastUltimate().containsKey(event.GetDamageePlayer().getUniqueId()))
{
return;
}
Iterator<DamageChange> iterator = event.GetDamageMod().iterator();
while (iterator.hasNext())
{
DamageChange damageChange = iterator.next();
if (damageChange.GetReason().equals("Instagib"))
{
iterator.remove();
}
}
}
@Override
public void activate(Player player)
{
super.activate(player);
player.getInventory().setChestplate(new ItemStack(Material.IRON_CHESTPLATE));
player.getInventory().setLeggings(new ItemStack(Material.IRON_LEGGINGS));
player.getInventory().setBoots(new ItemStack(Material.IRON_BOOTS));
}
@Override
public void cancel(Player player)
{
super.cancel(player);
Color color = Manager.GetGame().GetTeam(player).GetColorBase();
player.getInventory().setChestplate(new ItemBuilder(Material.LEATHER_CHESTPLATE).setColor(color).build());
player.getInventory().setLeggings(new ItemBuilder(Material.LEATHER_LEGGINGS).setColor(color).build());
player.getInventory().setBoots(new ItemBuilder(Material.LEATHER_BOOTS).setColor(color).build());
}
@Override
public double getChargeIncreasePerSecond()
{
return CHARGE_PER_SECOND;
}
@Override
public long getLength()
{
return _length;
}
}

View File

@ -0,0 +1,176 @@
package nautilus.game.arcade.game.games.quiver.ultimates;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import org.bukkit.Material;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Creature;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Skeleton;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.EntityTargetEvent;
import org.bukkit.inventory.ItemStack;
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.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.game.Game;
public class UltimateNecromancer extends Ultimate
{
private static final double CHARGE_PER_SECOND = 0.4;
private long _length;
private int _skeletons;
private Map<UUID, Set<LivingEntity>> _entities = new HashMap<>();
public UltimateNecromancer(long length, int skeletons)
{
super("Summon Undead", new String[] {});
_length = length;
_skeletons = skeletons;
}
@EventHandler
public void onEntityDamage(EntityDamageEvent event)
{
for (Set<LivingEntity> entityList : _entities.values())
{
for (LivingEntity livingEntity : entityList)
{
if (event.getEntity().equals(livingEntity))
{
event.setCancelled(true);
event.getEntity().setFireTicks(0);
}
}
}
}
@EventHandler
public void onEntityTarget(EntityTargetEvent event)
{
for (Set<LivingEntity> livingEntities : _entities.values())
{
if (event.getTarget() instanceof Player && livingEntities.contains(event.getEntity()))
{
Game game = Manager.GetGame();
Player source = getPlayerFromEntity(event.getEntity());
Player targetPlayer = (Player) event.getTarget();
if (game.GetTeam(targetPlayer).equals(game.GetTeam(source)))
{
event.setCancelled(true);
}
}
}
}
@EventHandler
public void onCustomDamage(CustomDamageEvent event)
{
if (event.GetProjectile() != null)
{
if (event.GetProjectile() instanceof Arrow)
{
LivingEntity livingEntity = event.GetDamagerEntity(true);
for (UUID uuid : _entities.keySet())
{
Set<LivingEntity> entities = _entities.get(uuid);
Player player = UtilPlayer.searchExact(uuid);
for (LivingEntity livingEntity2 : entities)
{
if (livingEntity.equals(livingEntity2))
{
event.SetDamager(player);
}
}
}
}
}
}
@Override
public void activate(Player player)
{
super.activate(player);
Set<LivingEntity> entities = new HashSet<>();
Manager.GetGame().CreatureAllowOverride = true;
for (int i = 0; i < _skeletons; i++)
{
LivingEntity livingEntity = player.getWorld().spawn(player.getLocation().add((Math.random() - 0.5) * 3, 0, (Math.random() - 0.5) * 3), Skeleton.class);
livingEntity.getEquipment().setItemInHand(new ItemStack(Material.BOW));
entities.add(livingEntity);
UtilParticle.PlayParticleToAll(ParticleType.LARGE_SMOKE, livingEntity.getEyeLocation(), 1F, 1F, 1F, 0.1F, 20, ViewDist.NORMAL);
((Creature) livingEntity).setTarget(UtilPlayer.getClosest(livingEntity.getLocation(), Manager.GetGame().GetTeam(player).GetPlayers(true)));
}
Manager.GetGame().CreatureAllowOverride = false;
_entities.put(player.getUniqueId(), entities);
}
@Override
public void cancel(Player player)
{
super.cancel(player);
for (LivingEntity entity : _entities.get(player.getUniqueId()))
{
entity.getEquipment().clear();
entity.remove();
}
_entities.remove(player.getUniqueId());
}
public Player getPlayerFromEntity(Entity entity)
{
for (UUID uuid : _entities.keySet())
{
Set<LivingEntity> livingEntities = _entities.get(uuid);
for (LivingEntity livingEntity : livingEntities)
{
if (livingEntity.equals(livingEntity))
{
return UtilPlayer.searchExact(uuid);
}
}
}
return null;
}
@Override
public double getChargeIncreasePerSecond()
{
return CHARGE_PER_SECOND;
}
@Override
public long getLength()
{
return _length;
}
}

View File

@ -0,0 +1,76 @@
package nautilus.game.arcade.game.games.quiver.ultimates;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.inventory.ItemStack;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
public class UltimateNinja extends Ultimate
{
private static final double CHARGE_PER_SECOND = 0.4;
private static final int SPEED_AMPLIFIER = 1;
private long _length;
public UltimateNinja(long length)
{
super("Ancient Blade", new String[] {});
_length = length;
}
@EventHandler
public void onCustomDamage(CustomDamageEvent event)
{
if (event.GetCause() != DamageCause.ENTITY_ATTACK)
{
return;
}
if (getLastUltimate().containsKey(event.GetDamagerPlayer(false).getUniqueId()) && event.GetDamagerPlayer(false).getItemInHand().getType() == Material.DIAMOND_SWORD)
{
event.AddMod(event.GetDamagerPlayer(false).getName(), GetName(), 9001, true);
}
}
@Override
public void activate(Player player)
{
super.activate(player);
player.getInventory().setItem(0, new ItemStack(Material.DIAMOND_SWORD));
player.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, (int) ((_length / 1000) * 20), SPEED_AMPLIFIER));
UtilParticle.PlayParticleToAll(ParticleType.FIREWORKS_SPARK, player.getEyeLocation(), 0, 0, 0, 1F, 100, ViewDist.NORMAL);
}
@Override
public void cancel(Player player)
{
super.cancel(player);
player.getInventory().setItem(0, new ItemStack(Material.GOLD_SWORD));
}
@Override
public double getChargeIncreasePerSecond()
{
return CHARGE_PER_SECOND;
}
@Override
public long getLength()
{
return _length;
}
}

View File

@ -0,0 +1,80 @@
package nautilus.game.arcade.game.games.quiver.ultimates;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Player;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.scheduler.BukkitRunnable;
import org.bukkit.util.Vector;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
public class UltimatePyromancer extends Ultimate
{
private static final double CHARGE_PER_SECOND = 0.4;
private long _length;
private Map<UUID, Integer> _tasks = new HashMap<>();
public UltimatePyromancer(long length)
{
super("Fire Blossom", new String[] {});
_length = length;
}
@Override
public void activate(Player player)
{
super.activate(player);
player.setWalkSpeed(0.05F);
player.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, (int) ((getLength() / 1000) * 20), -10));
_tasks.put(player.getUniqueId(), (new BukkitRunnable()
{
@Override
public void run()
{
UtilParticle.PlayParticleToAll(ParticleType.LARGE_SMOKE, player.getLocation().add(0, 0.5, 0), 2F, 0, 2F, 0.01F, 5, ViewDist.LONG);
UtilParticle.PlayParticleToAll(ParticleType.FLAME, player.getLocation().add(0, 0.5, 0), 2F, 0, 2F, 0.01F, 5, ViewDist.LONG);
Arrow arrow = player.launchProjectile(Arrow.class);
arrow.setCritical(true);
arrow.setVelocity(new Vector((Math.random() - 0.5) * 9, 0.1, (Math.random() - 0.5) * 9));
}
}.runTaskTimer(Manager.getPlugin(), 0, 1)).getTaskId());
}
@Override
public void cancel(Player player)
{
super.cancel(player);
player.setWalkSpeed(0.2F);
Bukkit.getScheduler().cancelTask(_tasks.get(player.getUniqueId()));
}
@Override
public double getChargeIncreasePerSecond()
{
return CHARGE_PER_SECOND;
}
@Override
public long getLength()
{
return _length;
}
}

View File

@ -0,0 +1,342 @@
package nautilus.game.arcade.game.games.quiver.ultimates;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.FireworkEffect.Type;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
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.event.player.PlayerMoveEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import com.google.common.collect.Sets;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilFirework;
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.common.util.UtilTime;
import mineplex.core.common.util.particles.effects.LineParticle;
import mineplex.core.itemstack.ItemBuilder;
import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.games.quiver.Quiver;
public class UltimateSkyWarrior extends Ultimate
{
private static final double CHARGE_PER_SECOND = 0.4;
private static final long LAUNCHER_FIRE_DELAY = 500;
private static final long LAUNCHER_MAX_TIME = 15000;
private static final int Y_INCREASE = 10;
private double _damageTeleport;
private double _radiusTeleport;
private double _damageLauncher;
private double _radiusLauncher;
private int _rangeLauncher;
private List<SkyWarriorData> _data = new ArrayList<>();
public UltimateSkyWarrior(double damageTeleport, double radiusTeleport, double damageLauncher, double radiusLauncher, int rangeLauncher)
{
super("Bombardment", new String[] {});
_damageTeleport = damageTeleport;
_radiusTeleport = radiusTeleport;
_damageLauncher = damageLauncher;
_radiusLauncher = radiusLauncher;
_rangeLauncher = rangeLauncher;
}
@Override
public void activate(Player player)
{
super.activate(player);
Location playerLocation = player.getLocation();
// This is to stop the players getting killed by the border if they were
// teleported above it.
Location toTeleport = new Location(player.getWorld(), playerLocation.getX(), Math.min(Manager.GetGame().WorldData.MaxY - 3, playerLocation.getY() + Y_INCREASE), playerLocation.getZ());
toTeleport.setYaw(playerLocation.getYaw());
toTeleport.setPitch(playerLocation.getPitch());
Block block = toTeleport.getBlock().getRelative(BlockFace.DOWN);
block.setType(Material.BARRIER);
player.setWalkSpeed(0);
player.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, Integer.MAX_VALUE, -10));
player.teleport(toTeleport);
_data.add(new SkyWarriorData(player, block, 3, UtilInv.getAmount(player, Material.ARROW), System.currentTimeMillis()));
player.getInventory().clear();
ItemStack itemStack = new ItemBuilder(Material.IRON_HOE).setTitle(C.cGreenB + GetName() + C.cDGreenB + " Click To Fire!").build();
for (int i = 0; i < 9; i++)
{
player.getInventory().addItem(itemStack);
}
Game game = Manager.GetGame();
UtilFirework.playFirework(playerLocation, Type.BALL, game.GetTeam(player).GetColorBase(), false, false);
UtilFirework.playFirework(toTeleport, Type.BALL, game.GetTeam(player).GetColorBase(), false, false);
}
@EventHandler
public void onUpdate(UpdateEvent event)
{
if (event.getType() == UpdateType.TICK)
{
for (SkyWarriorData data : _data)
{
UtilParticle.PlayParticleToAll(ParticleType.CLOUD, data.getPlayer().getLocation().subtract(0, 0.5, 0), 0.5F, 0.25F, 0.5F, 0.01F, 6, ViewDist.MAX);
}
}
else if (event.getType() == UpdateType.FAST)
{
for (SkyWarriorData data : _data)
{
if (UtilTime.elapsed(data.getStartTimeStamp(), LAUNCHER_MAX_TIME))
{
cancel(data.getPlayer());
}
}
}
}
@EventHandler
public void onPlayerInteract(PlayerInteractEvent event)
{
Player player = event.getPlayer();
SkyWarriorData data = getData(player);
if (data == null)
{
return;
}
if (player.getItemInHand().getType() != Material.IRON_HOE)
{
return;
}
if (!hasPerk(player))
{
return;
}
if (!Recharge.Instance.use(player, GetName(), LAUNCHER_FIRE_DELAY, true, false))
{
return;
}
player.getWorld().playSound(player.getLocation(), Sound.FIREWORK_BLAST, 5, 1);
LineParticle lineParticle = new LineParticle(player.getEyeLocation(), player.getLocation().getDirection(), 0.5, _rangeLauncher, Sets.newHashSet(Material.BARRIER), ParticleType.FIREWORKS_SPARK, UtilServer.getPlayers());
while (!lineParticle.update())
{
}
Location location = lineParticle.getDestination();
// Damage Players
for (Player other : UtilPlayer.getNearby(location, _radiusLauncher))
{
Manager.GetDamage().NewDamageEvent(other, player, null, DamageCause.CUSTOM, _damageLauncher, true, true, false, player.getName(), GetName());
}
UtilParticle.PlayParticleToAll(ParticleType.HUGE_EXPLOSION, location, 0, 0, 0, 1F, 1, ViewDist.LONG);
data.setShotsLeft(data.getShotsLeft() - 1);
if (data.getShotsLeft() == 0)
{
cancel(player);
}
}
@EventHandler
public void onPlayerMove(PlayerMoveEvent event)
{
if (!getLastUltimate().containsKey(event.getPlayer().getUniqueId()))
{
return;
}
Location from = event.getFrom();
Location to = event.getTo();
if (from.getX() == to.getX() && from.getZ() == to.getZ())
{
return;
}
event.setTo(from);
}
@Override
public void cancel(Player player)
{
super.cancel(player);
player.getInventory().clear();
Kit.GiveItems(player);
player.setWalkSpeed(0.2F);
player.removePotionEffect(PotionEffectType.JUMP);
SkyWarriorData data = getData(player);
Game game = Manager.GetGame();
data.getBlock().setType(Material.AIR);
for (int i = 0; i < data.getPreviousArrows(); i++)
{
player.getInventory().addItem(Quiver.SUPER_ARROW);
}
boolean found = false;
for (Player other : game.GetPlayers(true))
{
if (UtilPlayer.isSpectator(other) || player.equals(other))
{
continue;
}
if (game.GetTeam(player).equals(game.GetTeam(other)))
{
player.sendMessage(F.main("Game", "You were teleported to " + F.elem(other.getName()) + "."));
player.teleport(other);
other.getWorld().strikeLightningEffect(other.getLocation());
UtilFirework.playFirework(other.getLocation(), Type.STAR, game.GetTeam(player).GetColorBase(), false, false);
for (Player toDamage : UtilPlayer.getNearby(other.getEyeLocation(), _radiusTeleport))
{
Manager.GetDamage().NewDamageEvent(toDamage, player, null, DamageCause.CUSTOM, _damageTeleport, false, true, false, player.getName(), GetName() + " Teleportation");
}
found = true;
break;
}
}
if (!found)
{
player.sendMessage(F.main("Game", "A player could not be found!"));
}
_data.remove(data);
}
@Override
public boolean isUsable(Player player)
{
for (int i = 2; i <= Y_INCREASE; i++)
{
if (player.getLocation().add(0, i, 0).getBlock().getType() != Material.AIR)
{
player.sendMessage(F.main("Game", "You do not have enough room to use this!"));;
return false;
}
}
return true;
}
@Override
public double getChargeIncreasePerSecond()
{
return CHARGE_PER_SECOND;
}
@Override
public long getLength()
{
return 0;
}
private SkyWarriorData getData(Player player)
{
for (SkyWarriorData data : _data)
{
if (data.getPlayer().equals(player))
{
return data;
}
}
return null;
}
private final class SkyWarriorData
{
private Player _player;
private Block _block;
private int _shotsLeft;
private int _previousArrows;
private long _startTimeStamp;
public SkyWarriorData(Player player, Block block, int shots, int previousArrows, long startTimeStamp)
{
_player = player;
_block = block;
_shotsLeft = shots;
_previousArrows = previousArrows;
_startTimeStamp = startTimeStamp;
}
public void setShotsLeft(int slotsLeft)
{
_shotsLeft = slotsLeft;
}
public Player getPlayer()
{
return _player;
}
public Block getBlock()
{
return _block;
}
public int getShotsLeft()
{
return _shotsLeft;
}
public int getPreviousArrows()
{
return _previousArrows;
}
public long getStartTimeStamp()
{
return _startTimeStamp;
}
}
}

View File

@ -301,16 +301,18 @@ public abstract class Skywars extends Game
private void parseCreateConnectorChests()
{
for (int i = 0; i < 4 && !WorldData.GetDataLocs("GRAY").isEmpty(); i++)
Iterator<Location> iterator = WorldData.GetDataLocs("GRAY").iterator();
while (iterator.hasNext())
{
Location loc = UtilAlg.Random(WorldData.GetDataLocs("GRAY"));
WorldData.GetDataLocs("GRAY").remove(loc);
Location loc = iterator.next();
loc.getBlock().setTypeIdAndData(Material.CHEST.getId(), (byte) UtilMath.r(4), true);
_connectorChests.add(loc.getBlock());
_worldBlocks.add(loc.getBlock());
iterator.remove();
}
}
@ -392,15 +394,15 @@ public abstract class Skywars extends Game
private void setupBookEnchantments()
{
_commonBookEnchantments.put(Enchantment.DAMAGE_ALL, 3);
_commonBookEnchantments.put(Enchantment.DAMAGE_ALL, 1);
_commonBookEnchantments.put(Enchantment.FIRE_ASPECT, 1);
_commonBookEnchantments.put(Enchantment.ARROW_DAMAGE, 3);
_commonBookEnchantments.put(Enchantment.PROTECTION_ENVIRONMENTAL, 2);
_commonBookEnchantments.put(Enchantment.ARROW_DAMAGE, 1);
_commonBookEnchantments.put(Enchantment.PROTECTION_ENVIRONMENTAL, 1);
_rareBookEnchantments.put(Enchantment.DAMAGE_ALL, 4);
_rareBookEnchantments.put(Enchantment.PROTECTION_ENVIRONMENTAL, 3);
_rareBookEnchantments.put(Enchantment.DAMAGE_ALL, 2);
_rareBookEnchantments.put(Enchantment.PROTECTION_ENVIRONMENTAL, 2);
_rareBookEnchantments.put(Enchantment.ARROW_DAMAGE, 2);
_rareBookEnchantments.put(Enchantment.ARROW_FIRE, 1);
//_rareBookEnchantments.put(Enchantment.FIRE_ASPECT, 2);
_rareBookEnchantments.put(Enchantment.ARROW_KNOCKBACK, 1);
_rareBookEnchantments.put(Enchantment.KNOCKBACK, 2);
_rareBookEnchantments.put(Enchantment.THORNS, 1);
@ -1156,28 +1158,31 @@ public abstract class Skywars extends Game
chest.getBlockInventory().setItem(getIndex(used), _middleBlock.getLoot());
// Books
ItemStack itemStack = _middleBooks.getLoot();
EnchantmentStorageMeta meta = (EnchantmentStorageMeta) itemStack.getItemMeta();
Enchantment enchantment = null;
for (Enchantment cur : meta.getStoredEnchants().keySet())
for (int i = 0; i < UtilMath.r(2); i++)
{
meta.removeStoredEnchant(cur);
}
ItemStack itemStack = _middleBooks.getLoot();
EnchantmentStorageMeta meta = (EnchantmentStorageMeta) itemStack.getItemMeta();
Enchantment enchantment = null;
if (UtilMath.r(4) == 0)
{
enchantment = UtilAlg.Random(_rareBookEnchantments.keySet());
meta.addStoredEnchant(enchantment, _rareBookEnchantments.get(enchantment), true);
}
else
{
enchantment = UtilAlg.Random(_commonBookEnchantments.keySet());
meta.addStoredEnchant(enchantment, _commonBookEnchantments.get(enchantment), true);
}
for (Enchantment cur : meta.getStoredEnchants().keySet())
{
meta.removeStoredEnchant(cur);
}
itemStack.setItemMeta(meta);
chest.getBlockInventory().setItem(getIndex(used), itemStack);
if (UtilMath.r(4) == 0)
{
enchantment = UtilAlg.Random(_rareBookEnchantments.keySet());
meta.addStoredEnchant(enchantment, _rareBookEnchantments.get(enchantment), true);
}
else
{
enchantment = UtilAlg.Random(_commonBookEnchantments.keySet());
meta.addStoredEnchant(enchantment, _commonBookEnchantments.get(enchantment), true);
}
itemStack.setItemMeta(meta);
chest.getBlockInventory().setItem(getIndex(used), itemStack);
}
// Misc
chest.getBlockInventory().setItem(getIndex(used), _middleMisc.getLoot());

View File

@ -22,9 +22,9 @@ public class KitFire extends ProgressingKit
"Start with " + C.cGreen + "Wood Sword" + C.cGray + " and " + C.cGreen + "Blaze Rod",
"",
C.cYellow + "Right Click" + C.cWhite + " with Blaze Rod to use " + C.cGreen + "Fire Burst",
"Sends out a pulse of fire that deals " + C.cGreen + 3 + C.cWhite + " damage to",
"Sends out a pulse of fire that deals " + C.cGreen + 5 + C.cWhite + " damage to",
"all players within " + C.cGreen + 4 + C.cWhite + " blocks.",
"Cooldown " + C.cGreen + UtilTime.convertString(45000, 0, TimeUnit.SECONDS) + C.cWhite + "."
"Cooldown " + C.cGreen + UtilTime.convertString(40000, 0, TimeUnit.SECONDS) + C.cWhite + "."
};
private static final String FIRE_BURST = "Fire Burst";
@ -32,22 +32,22 @@ public class KitFire extends ProgressingKit
private static final Perk[][] PERKS =
{
{
new PerkFireBurst(45000, 4, 3)
new PerkFireBurst(40000, 4, 5)
},
{
new PerkFireBurst(44000, 4, 3)
new PerkFireBurst(39000, 4, 5)
},
{
new PerkFireBurst(43000, 4, 3)
new PerkFireBurst(38000, 4, 5)
},
{
new PerkFireBurst(42000, 4, 4)
new PerkFireBurst(37000, 4, 6)
},
{
new PerkFireBurst(41000, 4, 4)
new PerkFireBurst(36000, 4, 6)
},
{
new PerkFireBurst(40000, 4, 4)
new PerkFireBurst(35000, 4, 6)
},
};
@ -61,7 +61,7 @@ public class KitFire extends ProgressingKit
},
{
reduceCooldown(FIRE_BURST, 1),
increase(FIRE_BURST, "Range", 20)
increase(FIRE_BURST, "Damage", 25)
},
{
reduceCooldown(FIRE_BURST, 1)

View File

@ -31,7 +31,7 @@ public class KitMetal extends ProgressingKit
"Cooldown " + C.cGreen + UtilTime.convertString(15000, 0, TimeUnit.SECONDS) + C.cWhite + ".",
"",
"For each piece of metal armor you wear you gain",
"a level of " + C.cGreen + "Damage Resistance" + C.cWhite + ".",
"a " + C.cGreen + 7.5 + C.cWhite + "% damage resistance.",
};
private static final String MAGNET = "Magnet";

View File

@ -0,0 +1,57 @@
package nautilus.game.arcade.game.modules;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.player.PlayerJoinEvent;
import mineplex.core.common.MinecraftVersion;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
/**
* This module functions as a checkpoint for any client connecting a game
* server. Making sure they have the minimum client version for your game.
*
* @see MinecraftVersion
*/
public class VersionModule extends Module
{
private MinecraftVersion _minecraftVersion;
private String _kickMessage;
public VersionModule(MinecraftVersion minecraftVersion)
{
this(minecraftVersion, "You have an outdated client for this game!");
}
public VersionModule(MinecraftVersion minecraftVersion, String kickMessage)
{
_minecraftVersion = minecraftVersion;
_kickMessage = kickMessage;
for (Player player : UtilServer.getPlayers())
{
if (!hasVersion(player))
{
player.kickPlayer(kickMessage);
}
}
}
@EventHandler(priority = EventPriority.LOWEST)
public void onPlayerJoin(PlayerJoinEvent event)
{
if (!hasVersion(event.getPlayer()))
{
event.getPlayer().kickPlayer(_kickMessage);
}
}
private boolean hasVersion(Player player)
{
return UtilPlayer.getVersion(player) == _minecraftVersion;
}
}

View File

@ -30,6 +30,11 @@ public abstract class Perk implements Listener
public boolean hasPerk(Player player)
{
if (!Manager.GetGame().IsLive())
{
return false;
}
if (!(Kit instanceof ProgressingKit))
{
return Kit.HasKit(player);

View File

@ -24,8 +24,9 @@ public class PerkArrowRebound extends Perk
private int _max = 0;
private float _maxPower = 1f;
private float _maxDistance;
public PerkArrowRebound(int max, float maxPower)
public PerkArrowRebound(int max, float maxPower, float maxDistance)
{
super("Chain Arrows", new String[]
{
@ -35,6 +36,7 @@ public class PerkArrowRebound extends Perk
_max = max;
_maxPower = maxPower;
_maxDistance = maxDistance;
}
@EventHandler
@ -65,8 +67,8 @@ public class PerkArrowRebound extends Perk
Player hit = UtilPlayer.getClosest(arrowLoc, data.Ignore);
if (hit == null) return;
if (UtilMath.offset(hit.getLocation(), arrowLoc) > 1 &&
UtilMath.offset(hit.getEyeLocation(), arrowLoc) > 1)
if (UtilMath.offset(hit.getLocation(), arrowLoc) > _maxDistance &&
UtilMath.offset(hit.getEyeLocation(), arrowLoc) > _maxDistance)
return;
data.Ignore.add(hit);

View File

@ -0,0 +1,129 @@
package nautilus.game.arcade.kit.perks;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
import org.bukkit.FireworkEffect.Type;
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.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.PlayerInteractEvent;
import com.google.common.collect.Sets;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilItem;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.particles.effects.LineParticle;
import mineplex.core.recharge.Recharge;
import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.TeamGame;
import nautilus.game.arcade.kit.Perk;
public class PerkDash extends Perk
{
private static final double DAMAGE_RADIUS = 2.5;
private long _cooldown;
private double _damage;
private double _distance;
public PerkDash(long cooldown, double damage, double distance)
{
super("Dash", new String[] {});
_cooldown = cooldown;
_damage = damage;
_distance = distance;
}
@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 (!UtilItem.isSword(player.getItemInHand()))
{
return;
}
if (!hasPerk(player))
{
return;
}
if (!Recharge.Instance.use(player, GetName(), _cooldown, true, true))
{
return;
}
LineParticle lineParticle = new LineParticle(player.getEyeLocation(), player.getLocation().getDirection(), 0.8, _distance, Sets.newHashSet(Material.RAILS), ParticleType.FIREWORKS_SPARK,
UtilServer.getPlayers());
Set<UUID> hitPlayers = new HashSet<>();
while (!lineParticle.update())
{
for (Player other : UtilPlayer.getNearby(lineParticle.getLastLocation(), DAMAGE_RADIUS))
{
if (hitPlayers.contains(other.getUniqueId()) || player.equals(other))
{
continue;
}
if (Manager.GetGame() instanceof TeamGame)
{
Game game = Manager.GetGame();
if (game.GetTeam(player).equals(game.GetTeam(other)))
{
continue;
}
}
hitPlayers.add(other.getUniqueId());
Manager.GetDamage().NewDamageEvent(other, player, null, DamageCause.CUSTOM, _damage, true, true, false, player.getName(), GetName());
player.sendMessage(F.main("Game", "You hit " + F.elem(other.getName()) + " with " + F.skill(GetName()) + "."));
}
}
Game game = Manager.GetGame();
Location location = lineParticle.getDestination();
UtilFirework.playFirework(player.getEyeLocation(), Type.BALL, game.GetTeam(player).GetColorBase(), false, false);
player.playSound(player.getLocation(), Sound.SHOOT_ARROW, 1, 1);
player.teleport(location.add(0, 0.5, 0));
player.playSound(player.getLocation(), Sound.SHOOT_ARROW, 1, 1);
UtilFirework.playFirework(player.getEyeLocation(), Type.BALL, game.GetTeam(player).GetColorBase(), false, false);
player.setFallDistance(0);
player.sendMessage(F.main("Game", "You used " + F.skill(GetName()) + "."));
}
}

View File

@ -25,17 +25,20 @@ import mineplex.core.common.util.UtilTime;
import mineplex.core.itemstack.ItemBuilder;
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 nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.TeamGame;
import nautilus.game.arcade.game.games.skywars.TeamSkywars;
import nautilus.game.arcade.kit.Perk;
public class PerkDirtCannon extends Perk implements IThrown
{
private static final int GIVE_DELAY = 20000;
private static final int MAX_DIRT = 4;
private static final long COOLDOWN = 500;
private static final ItemStack DIRT_ITEM = new ItemBuilder(Material.DIRT).setTitle(C.cGreen + "Throwable Dirt").setGlow(true).build();
private long _lastDirt;
@ -74,6 +77,11 @@ public class PerkDirtCannon extends Perk implements IThrown
return;
}
if (!Recharge.Instance.use(player, GetName(), COOLDOWN, true, true))
{
return;
}
int amount = player.getInventory().getItemInHand().getAmount() - 1;
if (amount == 0)
@ -82,9 +90,9 @@ public class PerkDirtCannon extends Perk implements IThrown
}
else
{
player.getItemInHand().setAmount(amount);
player.getItemInHand().setAmount(Math.min(MAX_DIRT - 1, amount));
}
@SuppressWarnings("deprecation")
FallingBlock fallingBlock = player.getWorld().spawnFallingBlock(player.getEyeLocation().add(player.getLocation().getDirection()), Material.DIRT, (byte) 0);
fallingBlock.setDropItem(false);
@ -104,7 +112,7 @@ public class PerkDirtCannon extends Perk implements IThrown
{
for (Player player : Manager.GetGame().GetPlayers(true))
{
if (!hasPerk(player) || UtilInv.contains(player, "Throwable", Material.DIRT, (byte) 0, 4))
if (!hasPerk(player) || UtilInv.contains(player, "Throwable", Material.DIRT, (byte) 0, MAX_DIRT))
{
continue;
}
@ -143,6 +151,11 @@ public class PerkDirtCannon extends Perk implements IThrown
@EventHandler
public void onPlayerDropItem(PlayerDropItemEvent event)
{
if (!hasPerk(event.getPlayer()))
{
return;
}
if (DIRT_ITEM.isSimilar(event.getItemDrop().getItemStack()))
{
event.getPlayer().sendMessage(F.main("Game", "You cannot drop this item."));
@ -178,16 +191,11 @@ public class PerkDirtCannon extends Perk implements IThrown
return;
}
if (Manager.GetGame() instanceof TeamGame && target instanceof Player && data.getThrower() instanceof Player)
if (Manager.GetGame() instanceof TeamSkywars && target instanceof Player && data.getThrower() instanceof Player)
{
Game game = Manager.GetGame();
if (!game.IsAlive(target))
{
return;
}
if (game.GetTeam((Player) target).equals(game.GetTeam((Player) data.getThrower())))
if (game.GetTeam((Player) target).equals(game.GetTeam((Player) data.getThrower())) || !game.IsAlive(target))
{
return;
}

View File

@ -0,0 +1,49 @@
package nautilus.game.arcade.kit.perks;
import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile;
import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.ProjectileHitEvent;
import mineplex.core.common.util.UtilPlayer;
import nautilus.game.arcade.kit.Perk;
public class PerkFireArrows extends Perk
{
private double _distance;
private int _fireTicks;
public PerkFireArrows(double distance, int fireTicks)
{
super("Fire Arrows", new String[] {});
_distance = distance;
_fireTicks = fireTicks;
}
@EventHandler
public void onProjectileHit(ProjectileHitEvent event)
{
if (event.getEntity().getShooter() instanceof Player)
{
Player player = (Player) event.getEntity().getShooter();
Projectile projectile = event.getEntity();
if (!hasPerk(player))
{
return;
}
for (Player other : UtilPlayer.getNearby(projectile.getLocation(), _distance))
{
if (!Manager.IsAlive(other) || player.equals(other) || Manager.GetGame().GetTeam(player).equals(Manager.GetGame().GetTeam(other)))
{
continue;
}
other.setFireTicks(_fireTicks);
}
}
}
}

View File

@ -38,6 +38,7 @@ public class PerkFletcher extends Perk
private boolean _remove;
private int _slot;
private boolean _instant = true;
private String _name;
public PerkFletcher(int time, int max, boolean remove)
{
@ -55,6 +56,11 @@ public class PerkFletcher extends Perk
}
public PerkFletcher(int time, int max, boolean remove, int slot, boolean instant)
{
this(time, max, remove, slot, instant, "Fletcted Arrow");
}
public PerkFletcher(int time, int max, boolean remove, int slot, boolean instant, String name)
{
super("Fletcher", new String[]
{
@ -66,8 +72,9 @@ public class PerkFletcher extends Perk
_remove = remove;
_slot = slot;
_instant = instant;
_name = name;
}
public boolean isFletchedArrow(ItemStack stack)
{
if (!UtilGear.isMat(stack, Material.ARROW))
@ -78,7 +85,7 @@ public class PerkFletcher extends Perk
if (meta.getDisplayName() == null)
return false;
if (!meta.getDisplayName().contains("Fletched Arrow"))
if (!meta.getDisplayName().contains(_name))
return false;
return true;
@ -92,7 +99,7 @@ public class PerkFletcher extends Perk
Player player = (Player)event.getEntity();
if (!Kit.HasKit(player))
if (!hasPerk(player))
return;
for (int i=0 ; i<=8 ; i++)
@ -129,7 +136,7 @@ public class PerkFletcher extends Perk
if (Manager.isSpectator(cur))
continue;
if (!Kit.HasKit(cur))
if (!hasPerk(cur))
continue;
if (!Manager.GetGame().IsAlive(cur))
@ -145,17 +152,17 @@ public class PerkFletcher extends Perk
if (!Recharge.Instance.use(cur, GetName(), _time * 1000, false, false))
continue;
if (UtilInv.contains(cur, "Fletched Arrow", Material.ARROW, (byte)0, _max))
if (UtilInv.contains(cur, _name, Material.ARROW, (byte)0, _max))
continue;
//Add
if (_slot == -1)
{
cur.getInventory().addItem(ItemStackFactory.Instance.CreateStack(262, (byte)0, 1, F.item("Fletched Arrow")));
cur.getInventory().addItem(ItemStackFactory.Instance.CreateStack(262, (byte)0, 1, F.item(_name)));
}
else
{
cur.getInventory().setItem(_slot, ItemStackFactory.Instance.CreateStack(262, (byte)0, 1, F.item("Fletched Arrow")));
cur.getInventory().setItem(_slot, ItemStackFactory.Instance.CreateStack(262, (byte)0, 1, F.item(_name)));
}
cur.playSound(cur.getLocation(), Sound.ITEM_PICKUP, 2f, 1f);
@ -175,7 +182,7 @@ public class PerkFletcher extends Perk
event.setCancelled(true);
//Inform
UtilPlayer.message(event.getPlayer(), F.main(GetName(), "You cannot drop " + F.item("Fletched Arrow") + "."));
UtilPlayer.message(event.getPlayer(), F.main(GetName(), "You cannot drop " + F.item(_name) + "."));
}
@EventHandler
@ -194,7 +201,7 @@ public class PerkFletcher extends Perk
@EventHandler
public void FletchInvClick(InventoryClickEvent event)
{
UtilInv.DisallowMovementOf(event, "Fletched Arrow", Material.ARROW, (byte)0, true);
UtilInv.DisallowMovementOf(event, _name, Material.ARROW, (byte)0, true);
}
@EventHandler
@ -211,4 +218,4 @@ public class PerkFletcher extends Perk
arrowIterator.remove();
}
}
}
}

View File

@ -0,0 +1,46 @@
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.UtilParticle;
import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.kit.Perk;
public class PerkLifestealArrows extends Perk
{
private double _health;
public PerkLifestealArrows(double health)
{
super("Lifesteal Arrows", new String[] {});
_health = health;
}
@EventHandler
public void onCustomDamage(CustomDamageEvent event)
{
if (event.GetCause() != DamageCause.PROJECTILE)
{
return;
}
Player player = event.GetDamagerPlayer(true);
if (!hasPerk(player))
{
return;
}
player.setHealth(Math.min(player.getMaxHealth(), player.getHealth() + _health));
UtilParticle.PlayParticleToAll(ParticleType.HEART, player.getLocation().add(0, 1, 0), 1, 1, 1, 1, 5, ViewDist.NORMAL);
UtilParticle.PlayParticleToAll(ParticleType.HEART, event.GetDamageeEntity().getLocation().add(0, 1, 0), 1, 1, 1, 1, 5, ViewDist.NORMAL);
}
}

View File

@ -16,30 +16,25 @@ import org.bukkit.event.player.PlayerDropItemEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerPickupItemEvent;
import org.bukkit.inventory.ItemStack;
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.UtilAction;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilItem;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilMath;
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.particles.effects.LineParticle;
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.Game;
import nautilus.game.arcade.game.games.skywars.TeamSkywars;
import nautilus.game.arcade.kit.Perk;
public class PerkMagnetism extends Perk
{
private static final int RESISTANCE_DURATION = 40;
private long _cooldown;
private int _range;
@ -56,30 +51,23 @@ public class PerkMagnetism extends Perk
}
@EventHandler
public void onUpdate(UpdateEvent event)
public void onCustomDamage(CustomDamageEvent event)
{
if (event.getType() != UpdateType.FAST)
if (!(event.GetDamageeEntity() instanceof Player))
{
return;
}
for (Player player : UtilServer.getPlayers())
Player player = event.GetDamageePlayer();
if (!hasPerk(player))
{
if (!hasPerk(player) || UtilPlayer.isSpectator(player))
{
continue;
}
int magnituide = getAmountOfMetalArmor(player);
if (magnituide == 0)
{
continue;
}
player.removePotionEffect(PotionEffectType.DAMAGE_RESISTANCE);
player.addPotionEffect(new PotionEffect(PotionEffectType.DAMAGE_RESISTANCE, RESISTANCE_DURATION, magnituide - 1));
return;
}
int magnitude = getAmountOfMetalArmor(player);
event.AddMod(GetName(), event.GetDamage() * (magnitude * -0.075));
}
@EventHandler
@ -139,8 +127,13 @@ public class PerkMagnetism extends Perk
}
Manager.GetDamage().NewDamageEvent(target, player, null, DamageCause.CUSTOM, 1, false, true, true, player.getName(), GetName());
UtilParticle.PlayParticleToAll(ParticleType.FIREWORKS_SPARK, player.getEyeLocation(), 1, 1, 1, 0.01F, 20, ViewDist.NORMAL);
LineParticle lineParticle = new LineParticle(player.getEyeLocation(), player.getLocation().getDirection(), 0.5, UtilMath.offset(player, target), null, ParticleType.FIREWORKS_SPARK, UtilServer.getPlayers());
while (!lineParticle.update())
{
}
Vector vector = UtilAlg.getTrajectory(target, player).multiply((.5 + magnitude / 4) * _magnituideFactor);
UtilAction.velocity(target, vector.setY(Math.max(.6, vector.getY())));

View File

@ -25,6 +25,7 @@ import nautilus.game.arcade.kit.Perk;
public class PerkSeismicSlamOITQ extends Perk
{
public PerkSeismicSlamOITQ()
{
super("Ground Pound", new String[]

View File

@ -33,7 +33,7 @@ public class PerkSpeed extends Perk
for (Player player : Manager.GetGame().GetPlayers(true))
{
if (!Kit.HasKit(player))
if (!hasPerk(player))
continue;
Manager.GetCondition().Factory().Speed(GetName(), player, player, 8, _level, false, false, true);

View File

@ -31,7 +31,7 @@ public class PerkStrength extends Perk
Player damager = event.GetDamagerPlayer(true);
if (damager == null) return;
if (!Kit.HasKit(damager))
if (!hasPerk(damager))
return;
event.AddMod(damager.getName(), GetName(), _power, false);

View File

@ -1012,7 +1012,17 @@ public class GameLobbyManager implements Listener
public void AddPlayerToScoreboards(Player player, GameTeam gameTeam)
{
Rank rank = Manager.GetClients().Get(player).getRealOrDisguisedRank();
Rank rank;
if (player == null)
{
rank = Rank.ALL;
}
else
{
rank = Manager.GetClients().Get(player).getRealOrDisguisedRank();
}
String teamId = getTeamId(gameTeam, player);
for (MineplexScoreboard scoreboard : Manager.getScoreboardManager().getScoreboards().values())
@ -1040,7 +1050,10 @@ public class GameLobbyManager implements Listener
}
}
}
team.addEntry(player.getName());
if (player != null)
{
team.addEntry(player.getName());
}
}
}
@ -1063,14 +1076,27 @@ public class GameLobbyManager implements Listener
public String getTeamId(GameTeam gameTeam, Player player)
{
Rank rank = Manager.GetClients().Get(player).getRealOrDisguisedRank();
String rankName = rank.Name;
boolean rankIsUltra = !rank.has(Rank.ULTRA) &&
Manager.GetDonation().Get(player).OwnsUnknownPackage(Manager.GetServerConfig().ServerType + " ULTRA");
if (rankIsUltra)
Rank rank;
if (player == null)
{
rankName = Rank.ULTRA.Name;
rank = Rank.ALL;
}
else
{
rank = Manager.GetClients().Get(player).getRealOrDisguisedRank();
}
String rankName = rank.Name;
if (player != null)
{
boolean rankIsUltra = !rank.has(Rank.ULTRA) &&
Manager.GetDonation().Get(player).OwnsUnknownPackage(Manager.GetServerConfig().ServerType + " ULTRA");
if (rankIsUltra)
{
rankName = Rank.ULTRA.Name;
}
}
String teamId;