Squid Shooters!

This commit is contained in:
Sam 2018-06-10 15:56:10 +01:00 committed by Alexander Meech
parent 42865efcc7
commit b72bf772e2
16 changed files with 522 additions and 43 deletions

View File

@ -1,9 +1,6 @@
package mineplex.core.common.util.particles.effects; package mineplex.core.common.util.particles.effects;
import java.util.Set;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -22,31 +19,25 @@ import mineplex.core.common.util.UtilParticle.ViewDist;
public class LineParticle public class LineParticle
{ {
private Location _start; private final Location _start;
private Vector _direction; private Vector _direction;
private Location _lastLocation; private Location _lastLocation;
private double _curRange; private double _curRange;
private double _incrementedRange; private final double _incrementedRange;
private double _maxRange; private final double _maxRange;
private Set<Material> _ignoredTypes;
private boolean _ignoreAllBlocks; private boolean _ignoreAllBlocks;
private ParticleType _particleType; private final ParticleType _particleType;
private Player[] _toDisplay; private final Player[] _toDisplay;
public LineParticle(Location start, Vector direction, double incrementedRange, double maxRange, ParticleType particleType, Player... toDisplay) public LineParticle(Location start, Vector direction, double incrementedRange, double maxRange, ParticleType particleType, Player... toDisplay)
{ {
this(start, null, direction, incrementedRange, maxRange, null, particleType, toDisplay); this(start, null, direction, incrementedRange, maxRange, particleType, toDisplay);
} }
public LineParticle(Location start, Vector direction, double incrementedRange, double maxRange, Set<Material> ignoredTypes, ParticleType particleType, Player... toDisplay) public LineParticle(Location start, Location end, Vector direction, double incrementedRange, double maxRange, 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; _start = start;
_direction = direction; _direction = direction;
@ -55,7 +46,6 @@ public class LineParticle
_curRange = 0; _curRange = 0;
_incrementedRange = incrementedRange; _incrementedRange = incrementedRange;
_maxRange = maxRange; _maxRange = maxRange;
_ignoredTypes = ignoredTypes;
_particleType = particleType; _particleType = particleType;
_toDisplay = toDisplay; _toDisplay = toDisplay;
@ -69,8 +59,7 @@ public class LineParticle
/** /**
* Advances the line. * Advances the line.
* *
* @return true when the line has reached its target or has collided with a * @return true when the line has reached its target or has collided with a solid block.
* block with a type contained in _ignoredTypes.
*/ */
public boolean update() public boolean update()
{ {
@ -84,17 +73,14 @@ public class LineParticle
_lastLocation = newTarget; _lastLocation = newTarget;
if (!_ignoreAllBlocks && !(UtilBlock.airFoliage(newTarget.getBlock()) && UtilBlock.airFoliage(newTarget.getBlock().getRelative(BlockFace.UP)))) if (!_ignoreAllBlocks && UtilBlock.solid(newTarget.getBlock()) && UtilBlock.solid(newTarget.getBlock().getRelative(BlockFace.UP)))
{ {
if (_ignoredTypes == null || !_ignoredTypes.contains(newTarget.getBlock().getType())) done = true;
{
done = true;
}
} }
_curRange += _incrementedRange; _curRange += _incrementedRange;
UtilParticle.PlayParticle(_particleType, newTarget, 0, 0, 0, 0.001F, 1, ViewDist.LONG, _toDisplay); UtilParticle.PlayParticle(_particleType, newTarget, null, 0, 1, ViewDist.LONG, _toDisplay);
return done; return done;
} }

View File

@ -119,7 +119,7 @@ public class MorphAnath extends MorphGadget
player.getWorld().playSound(player.getLocation(), Sound.BLAZE_BREATH, 2, 0.5F); player.getWorld().playSound(player.getLocation(), Sound.BLAZE_BREATH, 2, 0.5F);
LineParticle particle = new LineParticle(player.getLocation().add(direction), direction, 0.2, 9, null, ParticleType.LAVA, UtilServer.getPlayers()); LineParticle particle = new LineParticle(player.getLocation().add(direction), direction, 0.2, 9, ParticleType.LAVA, UtilServer.getPlayers());
particle.setIgnoreAllBlocks(true); particle.setIgnoreAllBlocks(true);
Manager.runSyncTimer(new BukkitRunnable() Manager.runSyncTimer(new BukkitRunnable()

View File

@ -144,7 +144,7 @@ public class MorphHattori extends MorphGadget
return; return;
} }
LineParticle lineParticle = new LineParticle(start, start.getDirection(), 0.8, 15, null, ParticleType.FIREWORKS_SPARK, UtilServer.getPlayers()); LineParticle lineParticle = new LineParticle(start, start.getDirection(), 0.8, 15, ParticleType.FIREWORKS_SPARK, UtilServer.getPlayers());
while (!lineParticle.update()) while (!lineParticle.update())
{ {

View File

@ -3476,6 +3476,24 @@ public enum GameKit
) )
), ),
// Squid Shooter
SQUID_SHOOTER
(
0,
GameDisplay.SquidShooter,
"Retro Squid",
null,
new String[]
{
},
new KitEntityData<>
(
Squid.class,
new ItemStack(Material.INK_SACK)
)
),
// Survival Games // Survival Games
SG_AXEMAN SG_AXEMAN

View File

@ -92,6 +92,7 @@ import nautilus.game.arcade.game.games.sneakyassassins.SneakyAssassins;
import nautilus.game.arcade.game.games.snowfight.SnowFight; import nautilus.game.arcade.game.games.snowfight.SnowFight;
import nautilus.game.arcade.game.games.speedbuilders.SpeedBuilders; import nautilus.game.arcade.game.games.speedbuilders.SpeedBuilders;
import nautilus.game.arcade.game.games.spleef.Spleef; import nautilus.game.arcade.game.games.spleef.Spleef;
import nautilus.game.arcade.game.games.squidshooters.SquidShooters;
import nautilus.game.arcade.game.games.survivalgames.SurvivalGamesNewSolo; import nautilus.game.arcade.game.games.survivalgames.SurvivalGamesNewSolo;
import nautilus.game.arcade.game.games.survivalgames.SurvivalGamesNewTeams; import nautilus.game.arcade.game.games.survivalgames.SurvivalGamesNewTeams;
import nautilus.game.arcade.game.games.turfforts.TurfForts; import nautilus.game.arcade.game.games.turfforts.TurfForts;
@ -224,6 +225,8 @@ public enum GameType implements Voteable
CakeWars4(CakeWars.class, GameDisplay.CakeWars4), CakeWars4(CakeWars.class, GameDisplay.CakeWars4),
CakeWarsDuos(CakeWarsDuos.class, GameDisplay.CakeWarsDuos), CakeWarsDuos(CakeWarsDuos.class, GameDisplay.CakeWarsDuos),
SquidShooters(SquidShooters.class, GameDisplay.SquidShooter),
Event(EventGame.class, GameDisplay.Event, new GameType[]{ Event(EventGame.class, GameDisplay.Event, new GameType[]{
GameType.BaconBrawl, GameType.Barbarians, GameType.Bridge, GameType.Build, GameType.Build, GameType.BaconBrawl, GameType.Barbarians, GameType.Bridge, GameType.Build, GameType.Build,
GameType.CastleSiege, GameType.ChampionsDominate, GameType.ChampionsTDM, GameType.Christmas, GameType.CastleSiege, GameType.ChampionsDominate, GameType.ChampionsTDM, GameType.Christmas,

View File

@ -25,7 +25,7 @@ public class Beam extends LineParticle
public Beam(ArcadeManager manager, int id, BeamSource source, Location target) public Beam(ArcadeManager manager, int id, BeamSource source, Location target)
{ {
super(source.getSource(), target, null, 1, Integer.MAX_VALUE, null, ParticleType.FIREWORKS_SPARK, UtilServer.getPlayers()); super(source.getSource(), target, null, 1, Integer.MAX_VALUE, ParticleType.FIREWORKS_SPARK, UtilServer.getPlayers());
_manager = manager; _manager = manager;
_id = id; _id = id;

View File

@ -54,7 +54,7 @@ public class SkillBurnBeam extends HeroSkill
useSkill(player); useSkill(player);
LineParticle particle = new LineParticle(player.getLocation().add(direction), direction, 0.2, 9, null, ParticleType.LAVA, UtilServer.getPlayers()); LineParticle particle = new LineParticle(player.getLocation().add(direction), direction, 0.2, 9, ParticleType.LAVA, UtilServer.getPlayers());
particle.setIgnoreAllBlocks(true); particle.setIgnoreAllBlocks(true);

View File

@ -99,7 +99,7 @@ public class DashSkill extends HeroSkill
direction.setY(0); direction.setY(0);
} }
LineParticle particle = new LineParticle(player.getEyeLocation(), direction, 0.8, _range, null, _particleType, UtilServer.getPlayers()); LineParticle particle = new LineParticle(player.getEyeLocation(), direction, 0.8, _range, _particleType, UtilServer.getPlayers());
while (!particle.update()) while (!particle.update())
{ {

View File

@ -18,8 +18,6 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.potion.PotionEffect; import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType; import org.bukkit.potion.PotionEffectType;
import com.google.common.collect.Sets;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilFirework; import mineplex.core.common.util.UtilFirework;
@ -35,6 +33,7 @@ import mineplex.core.itemstack.ItemBuilder;
import mineplex.core.recharge.Recharge; import mineplex.core.recharge.Recharge;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.game.Game; import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.games.quiver.Quiver; import nautilus.game.arcade.game.games.quiver.Quiver;
@ -157,7 +156,7 @@ public class UltimateSkyWarrior extends UltimatePerk
player.getWorld().playSound(player.getLocation(), Sound.FIREWORK_BLAST, 5, 1); 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()); LineParticle lineParticle = new LineParticle(player.getEyeLocation(), player.getLocation().getDirection(), 0.5, _rangeLauncher, ParticleType.FIREWORKS_SPARK, UtilServer.getPlayers());
while (!lineParticle.update()) while (!lineParticle.update())
{ {

View File

@ -78,7 +78,7 @@ public class PerkMagnetism extends SkywarsPerk
Manager.GetDamage().NewDamageEvent(target, player, null, DamageCause.CUSTOM, 1, false, true, true, player.getName(), GetName()); Manager.GetDamage().NewDamageEvent(target, player, null, DamageCause.CUSTOM, 1, false, true, true, player.getName(), GetName());
LineParticle lineParticle = new LineParticle(player.getEyeLocation(), player.getLocation().getDirection(), 0.5, UtilMath.offset(player, target), null, ParticleType.FIREWORKS_SPARK, UtilServer LineParticle lineParticle = new LineParticle(player.getEyeLocation(), player.getLocation().getDirection(), 0.5, UtilMath.offset(player, target), ParticleType.FIREWORKS_SPARK, UtilServer
.getPlayers()); .getPlayers());
while (!lineParticle.update()) while (!lineParticle.update())

View File

@ -91,7 +91,7 @@ public class PerkBlink extends SmashPerk
return; return;
} }
LineParticle lineParticle = new LineParticle(player.getEyeLocation(), player.getLocation().getDirection(), INCREMENTATION, _range, null, ParticleType.SMOKE, UtilServer.getPlayers()); LineParticle lineParticle = new LineParticle(player.getEyeLocation(), player.getLocation().getDirection(), INCREMENTATION, _range, ParticleType.SMOKE, UtilServer.getPlayers());
while (!lineParticle.update()) while (!lineParticle.update())
{ {

View File

@ -132,7 +132,7 @@ public class SmashAnimationData
continue; continue;
} }
LineParticle lineParticle = new LineParticle(player.getEyeLocation(), _target.getEyeLocation(), vector, 0.2, offset, null, ParticleType.WITCH_MAGIC, UtilServer.getPlayers()); LineParticle lineParticle = new LineParticle(player.getEyeLocation(), _target.getEyeLocation(), vector, 0.2, offset, ParticleType.WITCH_MAGIC, UtilServer.getPlayers());
while (!lineParticle.update()) while (!lineParticle.update())
{ {

View File

@ -0,0 +1,350 @@
package nautilus.game.arcade.game.games.squidshooters;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import java.util.stream.Collectors;
import org.bukkit.Location;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.util.Vector;
import com.mineplex.anticheat.checks.move.Glide;
import com.mineplex.anticheat.checks.move.HeadRoll;
import com.mineplex.anticheat.checks.move.Speed;
import mineplex.core.Managers;
import mineplex.core.antihack.AntiHack;
import mineplex.core.common.Pair;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTextMiddle;
import mineplex.core.disguise.disguises.DisguiseSquid;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.combat.CombatComponent;
import mineplex.minecraft.game.core.combat.event.CombatDeathEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.events.PlayerPrepareTeleportEvent;
import nautilus.game.arcade.game.SoloGame;
import nautilus.game.arcade.game.games.squidshooters.kit.KitRetroSquid;
import nautilus.game.arcade.kit.Kit;
public class SquidShooters extends SoloGame
{
private static final int KILLS_TO_WIN = 5;
private static final int MAX_DISPLAY = 14;
private static final String[] DESCRIPTION =
{
"Hold " + C.cYellow + "Sneak" + C.Reset + " to swim.",
"Stay in the Water.",
"You cannot swim when hit.",
"First squid to " + C.cYellow + KILLS_TO_WIN + C.Reset + " kills wins."
};
private final Map<UUID, Integer> _kills = new HashMap<>();
private final Set<Player> _inAir = new HashSet<>();
public SquidShooters(ArcadeManager manager)
{
super(manager, GameType.SquidShooters, new Kit[]
{
new KitRetroSquid(manager),
}, DESCRIPTION);
PrepareFreeze = false;
DamageTeamSelf = true;
DeathOut = false;
NightVision = true;
WorldTimeSet = 6000;
GlideCheckEnabled = false;
AntiHack antiHack = Managers.get(AntiHack.class);
antiHack.addIgnoredCheck(Speed.class);
antiHack.addIgnoredCheck(Glide.class);
antiHack.addIgnoredCheck(HeadRoll.class);
}
@Override
@EventHandler
public void ScoreboardUpdate(UpdateEvent event)
{
if (!InProgress())
{
return;
}
Scoreboard.writeNewLine();
List<Player> alive = GetPlayers(true);
if (alive.size() > MAX_DISPLAY)
{
alive = new ArrayList<>(alive);
while (alive.size() > MAX_DISPLAY)
{
alive.remove(alive.size() - 1);
}
}
Scoreboard.writeGroup(alive, player ->
{
Integer kills = _kills.get(player.getUniqueId());
return kills == null ? null : Pair.create(C.cGreen + player.getName(), kills);
}, true);
Scoreboard.draw();
}
@EventHandler
public void playerTeleportIn(PlayerPrepareTeleportEvent event)
{
Player player = event.GetPlayer();
player.setWalkSpeed(0.05F);
DisguiseSquid disguise = new DisguiseSquid(player);
disguise.setName(getPlayersTeam().GetColor() + player.getName());
disguise.setCustomNameVisible(true);
Manager.GetDisguise().disguise(disguise);
}
@EventHandler
public void prepare(GameStateChangeEvent event)
{
if (event.GetState() != GameState.Prepare)
{
return;
}
Manager.runSyncLater(() -> UtilTextMiddle.display(null, C.cYellow + "Hold Sneak to Swim", 10, 40, 10, UtilServer.getPlayers()), 20);
}
@EventHandler
public void updateMovement(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK || !IsLive())
{
return;
}
for (Player player : GetPlayers(true))
{
if (!player.isSneaking() || player.hasPotionEffect(PotionEffectType.SLOW))
{
continue;
}
Vector direction = player.getLocation().getDirection();
boolean inAirPast = _inAir.contains(player);
boolean inAirNow = !UtilEnt.isInWater(player);
// Entering water
if (inAirPast && !inAirNow)
{
_inAir.remove(player);
}
// Leaving water
else if (!inAirPast && inAirNow)
{
_inAir.add(player);
}
// Already in air
else if (inAirNow)
{
continue;
}
// Already in water
else
{
direction.multiply(0.5);
}
// If players are sneaking on the edge of a block and looking down (positive pitch).
// They won't have downwards velocity applied to them. So for one tick we give them a
// slight vertical velocity to fix this.
if (direction.getY() < 0)
{
Pair<Location, Location> box = UtilEnt.getSideStandingBox(player);
Location min = box.getLeft(), max = box.getRight();
outerLoop:
for (int x = min.getBlockX(); x <= max.getBlockX(); x++)
{
for (int z = min.getBlockZ(); z <= max.getBlockZ(); z++)
{
Block block = player.getLocation().add(x, -0.5, z).getBlock();
if (UtilBlock.solid(block))
{
direction.setY(0.01);
break outerLoop;
}
}
}
}
UtilAction.velocity(player, direction);
}
}
@EventHandler
public void updateHunger(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST || !InProgress())
{
return;
}
for (Player player : GetPlayers(true))
{
if (UtilEnt.isInWater(player))
{
UtilPlayer.hunger(player, 2);
}
else
{
UtilPlayer.hunger(player, -2);
if (player.getFoodLevel() == 0)
{
Manager.GetDamage().NewDamageEvent(player, null, null, DamageCause.SUFFOCATION, 2, false, true, true, GetName(), "Suffocation");
}
}
if (!player.hasPotionEffect(PotionEffectType.WATER_BREATHING))
{
player.addPotionEffect(new PotionEffect(PotionEffectType.WATER_BREATHING, Integer.MAX_VALUE, 0, false, false));
}
}
}
@EventHandler(priority = EventPriority.HIGHEST)
public void playerDeath(CombatDeathEvent event)
{
CombatComponent killer = event.GetLog().GetKiller();
if (killer == null || !killer.IsPlayer())
{
return;
}
_kills.compute(killer.getUniqueIdOfEntity(), (k, v) -> _kills.getOrDefault(k, 0) + 1);
}
@EventHandler
public void playerQuit(PlayerQuitEvent event)
{
Player player = event.getPlayer();
_kills.remove(player.getUniqueId());
_inAir.remove(player);
}
@EventHandler
public void damage(CustomDamageEvent event)
{
if (!IsLive())
{
return;
}
if (event.GetCause() == DamageCause.ENTITY_ATTACK)
{
event.SetCancelled("Squid Melee Attack");
}
}
@Override
public void EndCheck()
{
if (!IsLive())
{
return;
}
List<Player> alive = GetPlayers(true);
if (alive.isEmpty())
{
SetState(GameState.End);
return;
}
boolean end = alive.size() == 1;
for (int kills : _kills.values())
{
if (kills >= KILLS_TO_WIN)
{
end = true;
break;
}
}
if (!end)
{
return;
}
List<Player> places = alive.stream()
.sorted(Comparator.comparing(player -> _kills.getOrDefault(((Player) player).getUniqueId(), 0)).reversed())
.collect(Collectors.toList());
if (!places.isEmpty())
{
AddGems(places.get(0), 20, "1st Place", false, false);
}
if (places.size() > 1)
{
AddGems(places.get(1), 15, "2nd Place", false, false);
}
if (places.size() > 2)
{
AddGems(places.get(2), 10, "3rd Place", false, false);
}
AnnounceEnd(places);
SetState(GameState.End);
}
@EventHandler(priority = EventPriority.HIGHEST)
public void preventMovement(CustomDamageEvent event)
{
if (!IsLive())
{
return;
}
Player damagee = event.GetDamageePlayer();
if (event.IsCancelled() || damagee == null)
{
return;
}
damagee.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 15, 0, false, false), true);
}
}

View File

@ -0,0 +1,112 @@
package nautilus.game.arcade.game.games.squidshooters.kit;
import org.bukkit.Color;
import org.bukkit.FireworkEffect;
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.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.ItemStack;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilEvent.ActionType;
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.game.kit.GameKit;
import mineplex.core.itemstack.ItemBuilder;
import mineplex.core.recharge.Recharge;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.kit.Kit;
public class KitRetroSquid extends Kit
{
private static final String NAME = "Squid Laser";
private static final ItemStack[] PLAYER_ITEMS =
{
new ItemBuilder(Material.IRON_AXE)
.setTitle(C.cYellowB + "Right-Click" + C.cWhiteB + " - " + C.cGreenB + NAME)
.setUnbreakable(true)
.build()
};
public KitRetroSquid(ArcadeManager manager)
{
super(manager, GameKit.SQUID_SHOOTER);
}
@Override
public void GiveItems(Player player)
{
player.getInventory().addItem(PLAYER_ITEMS);
}
@EventHandler(priority = EventPriority.HIGH)
public void playerInteract(PlayerInteractEvent event)
{
if (event.isCancelled() || !UtilEvent.isAction(event, ActionType.R))
{
return;
}
Player player = event.getPlayer();
ItemStack itemStack = player.getItemInHand();
Block block = event.getClickedBlock();
if (!HasKit(player) || !UtilItem.isAxe(itemStack) || UtilBlock.usable(block) || !Recharge.Instance.use(player, NAME, 1000, false, true))
{
return;
}
event.setCancelled(true);
Location location = player.getEyeLocation();
location.add(location.getDirection());
location.getWorld().playSound(location, Sound.FIREWORK_LAUNCH, 1, 1);
LineParticle lineParticle = new LineParticle(location, location.getDirection(), 0.3, 40, ParticleType.FIREWORKS_SPARK, UtilServer.getPlayers());
while (!lineParticle.update())
{
Location from = lineParticle.getLastLocation().subtract(0, 1, 0);
Player closet = UtilPlayer.getClosest(from, 2, player);
if (closet == null)
{
continue;
}
from = closet.getLocation();
UtilFirework.playFirework(from.clone().add(0, 1, 0), FireworkEffect.builder()
.with(Type.BALL_LARGE)
.withColor(Color.AQUA)
.build());
UtilPlayer.getInRadius(from, 2).forEach((hit, scale) ->
{
if (player.equals(hit))
{
return;
}
Manager.GetDamage().NewDamageEvent(hit, player, null, DamageCause.CUSTOM, 15 * scale, true, true, true, player.getName(), GetName());
});
break;
}
}
}

View File

@ -6,7 +6,6 @@ import java.util.UUID;
import org.bukkit.FireworkEffect.Type; import org.bukkit.FireworkEffect.Type;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
@ -14,8 +13,6 @@ import org.bukkit.event.block.Action;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerInteractEvent;
import com.google.common.collect.Sets;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilFirework; import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilItem; import mineplex.core.common.util.UtilItem;
@ -24,6 +21,7 @@ import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.particles.effects.LineParticle; import mineplex.core.common.util.particles.effects.LineParticle;
import mineplex.core.recharge.Recharge; import mineplex.core.recharge.Recharge;
import nautilus.game.arcade.game.Game; import nautilus.game.arcade.game.Game;
import nautilus.game.arcade.game.TeamGame; import nautilus.game.arcade.game.TeamGame;
import nautilus.game.arcade.kit.Perk; import nautilus.game.arcade.kit.Perk;
@ -81,7 +79,7 @@ public class PerkDash extends Perk
return; return;
} }
LineParticle lineParticle = new LineParticle(player.getEyeLocation(), player.getLocation().getDirection(), 0.8, _distance, Sets.newHashSet(Material.RAILS), ParticleType.FIREWORKS_SPARK, LineParticle lineParticle = new LineParticle(player.getEyeLocation(), player.getLocation().getDirection(), 0.8, _distance, ParticleType.FIREWORKS_SPARK,
UtilServer.getPlayers()); UtilServer.getPlayers());
Set<UUID> hitPlayers = new HashSet<>(); Set<UUID> hitPlayers = new HashSet<>();

View File

@ -52,13 +52,26 @@ public class PerkLazer extends Perk
private float _knockbackMagnitude; private float _knockbackMagnitude;
private double _range; private double _range;
private Set<UUID> _active = new HashSet<>(); private final Set<UUID> _active = new HashSet<>();
public PerkLazer() public PerkLazer()
{ {
super("Static Laser", new String[] { C.cYellow + "Hold Block" + C.cGray + " with Sword to use " + C.cGreen + "Static Laser" }); super("Static Laser", new String[] { C.cYellow + "Hold Block" + C.cGray + " with Sword to use " + C.cGreen + "Static Laser" });
} }
public PerkLazer(String name, long recharge, float chargePerTick, float hitBoxRadius, float damageRadius, int damage, float knockbackMagnitude, double range)
{
super(name);
_recharge = recharge;
_chargePerTick = chargePerTick;
_hitBoxRadius = hitBoxRadius;
_damageRadius = damageRadius;
_damage = damage;
_knockbackMagnitude = knockbackMagnitude;
_range = range;
}
@Override @Override
public void setupValues() public void setupValues()
{ {
@ -180,7 +193,7 @@ public class PerkLazer extends Perk
return; return;
} }
LineParticle lineParticle = new LineParticle(player.getEyeLocation(), player.getLocation().getDirection(), INCREMENTATION, _range * player.getExp(), null, ParticleType.FIREWORKS_SPARK, LineParticle lineParticle = new LineParticle(player.getEyeLocation(), player.getLocation().getDirection(), INCREMENTATION, _range * player.getExp(), ParticleType.FIREWORKS_SPARK,
UtilServer.getPlayers()); UtilServer.getPlayers());
particleLoop: while (!lineParticle.update()) particleLoop: while (!lineParticle.update())
@ -237,7 +250,7 @@ public class PerkLazer extends Perk
event.AddKnockback(GetName(), _knockbackMagnitude); event.AddKnockback(GetName(), _knockbackMagnitude);
} }
public void setWoolColor(Player player, DyeColor color) private void setWoolColor(Player player, DyeColor color)
{ {
DisguiseBase disguise = Manager.GetDisguise().getActiveDisguise(player); DisguiseBase disguise = Manager.GetDisguise().getActiveDisguise(player);