More tweaks and fixes
This commit is contained in:
parent
dc5c2430cd
commit
e6530a6f44
@ -0,0 +1,73 @@
|
||||
package mineplex.core.common.util;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||
|
||||
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, Sound.FIZZ, 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();
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
_current.getWorld().playSound(_current, _sound, _soundVolume, _soundPitch);
|
||||
|
||||
return UtilMath.offset(_current, _target) < _stopAtDistance;
|
||||
}
|
||||
|
||||
}
|
@ -3,6 +3,7 @@ package nautilus.game.arcade.game.games.quiver;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
@ -21,7 +22,6 @@ import org.bukkit.event.entity.EntityCombustEvent;
|
||||
import org.bukkit.event.entity.EntityRegainHealthEvent;
|
||||
import org.bukkit.event.entity.ProjectileHitEvent;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.event.player.PlayerDropItemEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
import org.bukkit.event.player.PlayerPickupItemEvent;
|
||||
import org.bukkit.event.player.PlayerToggleSneakEvent;
|
||||
@ -37,6 +37,7 @@ import org.bukkit.util.Vector;
|
||||
import mineplex.core.common.MinecraftVersion;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.ObjectiveParticle;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilItem;
|
||||
@ -107,6 +108,8 @@ public class QuiverPayload extends TeamGame
|
||||
|
||||
private static final long KILLSTREAK_TIME_PERIOD = 1500;
|
||||
private static final long TEAM_KILL_MINIMUM_DELAY = 20000;
|
||||
|
||||
private static final long OBJECTIVE_PARTICLES_TIME = 10000;
|
||||
|
||||
public static final String DATA_POINT_MARKER_START = "PINK";
|
||||
public static final String DATA_POINT_RED = "RED";
|
||||
@ -137,6 +140,8 @@ public class QuiverPayload extends TeamGame
|
||||
private Map<UUID, Integer> _killstreakAmount = new HashMap<>();
|
||||
private Map<UUID, Long> _killstreamLast = new HashMap<>();
|
||||
private long _lastTeamKill;
|
||||
|
||||
private List<ObjectiveParticle> _objectiveParticles = new ArrayList<>();
|
||||
|
||||
private boolean _coloredMessage;
|
||||
|
||||
@ -153,6 +158,7 @@ public class QuiverPayload extends TeamGame
|
||||
|
||||
});
|
||||
|
||||
this.PlayersPerTeam = 5;
|
||||
this.DeathOut = false;
|
||||
this.DeathSpectateSecs = RESPAWN_INITAL_SECONDS;
|
||||
this.DamageSelf = false;
|
||||
@ -207,12 +213,12 @@ public class QuiverPayload extends TeamGame
|
||||
Scoreboard.writeNewLine();
|
||||
|
||||
Scoreboard.write(C.cRedB + "Team Red");
|
||||
Scoreboard.write(_teamAScore + " Point" + (_teamAScore == 1 ? "" : "s") + " (" + (MAX_SCORE - _teamAScore) + " needed)");
|
||||
Scoreboard.write(_teamAScore + " Point" + (_teamAScore == 1 ? "" : "s") + " (" + (MAX_SCORE - _teamAScore) + ")");
|
||||
|
||||
Scoreboard.writeNewLine();
|
||||
|
||||
Scoreboard.write(C.cAquaB + "Team Blue");
|
||||
Scoreboard.write(_teamBScore + " Point" + (_teamBScore == 1 ? "" : "s") + " (" + (MAX_SCORE - _teamBScore) + " needed)");
|
||||
Scoreboard.write(_teamBScore + " Point" + (_teamBScore == 1 ? "" : "s") + " (" + (MAX_SCORE - _teamBScore) + ")");
|
||||
|
||||
Scoreboard.writeNewLine();
|
||||
|
||||
@ -377,12 +383,17 @@ public class QuiverPayload extends TeamGame
|
||||
@EventHandler
|
||||
public void onUpdate(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() == UpdateType.MIN_01 && IsLive())
|
||||
if (!IsLive())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (event.getType() == UpdateType.MIN_01)
|
||||
{
|
||||
this.DeathSpectateSecs++;
|
||||
}
|
||||
|
||||
if (event.getType() == UpdateType.SEC && IsLive())
|
||||
if (event.getType() == UpdateType.SEC)
|
||||
{
|
||||
|
||||
/*
|
||||
@ -494,8 +505,37 @@ public class QuiverPayload extends TeamGame
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (event.getType() == UpdateType.FAST && IsLive())
|
||||
|
||||
if (event.getType() == UpdateType.TICK)
|
||||
{
|
||||
Iterator<ObjectiveParticle> iterator = _objectiveParticles.iterator();
|
||||
|
||||
while (iterator.hasNext())
|
||||
{
|
||||
ObjectiveParticle objectiveParticle = iterator.next();
|
||||
|
||||
if (objectiveParticle.update())
|
||||
{
|
||||
iterator.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (event.getType() == UpdateType.TWOSEC)
|
||||
{
|
||||
if (UtilTime.elapsed(GetStateTime(), OBJECTIVE_PARTICLES_TIME))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
for (Player player : GetPlayers(true))
|
||||
{
|
||||
_objectiveParticles.add(new ObjectiveParticle(player.getEyeLocation(), player.getLocation().getDirection(), _minecart.getLocation().add(0, 1, 0), player));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (event.getType() == UpdateType.FAST)
|
||||
{
|
||||
for (GameTeam gameTeam : GetTeamList())
|
||||
{
|
||||
@ -552,9 +592,6 @@ public class QuiverPayload extends TeamGame
|
||||
case 5:
|
||||
name = "PENTA";
|
||||
break;
|
||||
case 6:
|
||||
name = "HEXA";
|
||||
break;
|
||||
}
|
||||
|
||||
if (name != null)
|
||||
@ -574,7 +611,7 @@ public class QuiverPayload extends TeamGame
|
||||
}
|
||||
}
|
||||
|
||||
if (event.getType() == UpdateType.FAST && _minecart != null && !_isRestarting && IsLive())
|
||||
if (event.getType() == UpdateType.FAST && _minecart != null && !_isRestarting)
|
||||
{
|
||||
|
||||
/*
|
||||
|
@ -1,5 +1,8 @@
|
||||
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;
|
||||
@ -12,6 +15,7 @@ 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;
|
||||
@ -92,5 +96,18 @@ public class KitBarrage extends ProgressingKit
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@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);
|
||||
}
|
||||
}
|
||||
|
@ -101,6 +101,11 @@ public class KitBeserker extends ProgressingKit
|
||||
{
|
||||
super.onSelected(player);
|
||||
|
||||
if (!Manager.GetGame().IsLive())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QuiverPayload quiverPayload = (QuiverPayload) Manager.GetGame();
|
||||
|
||||
quiverPayload.resetUltimate(Bukkit.getPlayer(player), true);
|
||||
|
@ -1,5 +1,8 @@
|
||||
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;
|
||||
@ -12,6 +15,7 @@ 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.UltimateHeadHunter;
|
||||
import nautilus.game.arcade.kit.KitAvailability;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
@ -84,5 +88,18 @@ public class KitHeadHunter extends ProgressingKit
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@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);
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,8 @@
|
||||
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;
|
||||
@ -8,6 +11,7 @@ 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;
|
||||
@ -81,10 +85,20 @@ public class KitNewNinja extends ProgressingKit
|
||||
public void GiveItems(Player player)
|
||||
{
|
||||
player.getInventory().addItem(PLAYER_ITEMS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSelected(UUID player)
|
||||
{
|
||||
super.onSelected(player);
|
||||
|
||||
// if (Manager.GetGame().GetState() == GameState.Live)
|
||||
// {
|
||||
// UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(Manager.getPlugin(), () -> UtilInv.Update(player), 10);
|
||||
// }
|
||||
if (!Manager.GetGame().IsLive())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
QuiverPayload quiverPayload = (QuiverPayload) Manager.GetGame();
|
||||
|
||||
quiverPayload.resetUltimate(Bukkit.getPlayer(player), true);
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,8 @@
|
||||
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;
|
||||
@ -12,6 +15,7 @@ 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;
|
||||
@ -95,5 +99,18 @@ public class KitPyromancer extends ProgressingKit
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@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);
|
||||
}
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ public class UltimateNinja extends Ultimate
|
||||
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, 50, ViewDist.NORMAL);
|
||||
UtilParticle.PlayParticleToAll(ParticleType.FIREWORKS_SPARK, player.getEyeLocation(), 0, 0, 0, 1F, 100, ViewDist.NORMAL);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user