Merge branch 'master' of ssh://184.154.0.242:7999/min/Mineplex

This commit is contained in:
Jonathan Williams 2015-08-02 17:00:49 -05:00
commit d3ba621e86
43 changed files with 385 additions and 85 deletions

View File

@ -1,14 +1,23 @@
package mineplex.core.common.util;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
public class UtilAction
{
private static VelocityReceiver _velocityFix;
public static void velocity(Entity ent, Vector vec)
{
velocity(ent, vec, 1, false, 0, 0, vec.length(), false);
}
public static void registerVelocityFix(VelocityReceiver velocityFix)
{
_velocityFix = velocityFix;
}
public static void velocity(Entity ent, double str, double yAdd, double yMax, boolean groundBoost)
{
velocity(ent, ent.getLocation().getDirection(), str, false, 0, yAdd, yMax, groundBoost);
@ -17,8 +26,11 @@ public class UtilAction
public static void velocity(Entity ent, Vector vec, double str, boolean ySet, double yBase, double yAdd, double yMax, boolean groundBoost)
{
if (Double.isNaN(vec.getX()) || Double.isNaN(vec.getY()) || Double.isNaN(vec.getZ()) || vec.length() == 0)
{
zeroVelocity(ent);
return;
}
//YSet
if (ySet)
vec.setY(yBase);
@ -26,28 +38,43 @@ public class UtilAction
//Modify
vec.normalize();
vec.multiply(str);
//YAdd
vec.setY(vec.getY() + yAdd);
//Limit
if (vec.getY() > yMax)
vec.setY(yMax);
if (groundBoost)
if (UtilEnt.isGrounded(ent))
vec.setY(vec.getY() + 0.2);
//Velocity
ent.setFallDistance(0);
//Debug
if (ent instanceof Player && UtilGear.isMat(((Player)ent).getItemInHand(), Material.SUGAR))
//Store It!
if (ent instanceof Player && _velocityFix != null)
{
Bukkit.broadcastMessage(F.main("Debug", "Velocity Sent: " + vec.length()));
}
_velocityFix.setPlayerVelocity(((Player)ent), vec);
}
ent.setVelocity(vec);
}
public static void zeroVelocity(Entity ent)
{
Vector vec = new Vector(0,0,0);
ent.setFallDistance(0);
//Store It!
if (ent instanceof Player && _velocityFix != null)
{
_velocityFix.setPlayerVelocity(((Player)ent), vec);
}
ent.setVelocity(vec);
}
}

View File

@ -0,0 +1,9 @@
package mineplex.core.common.util;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
public interface VelocityReceiver
{
public void setPlayerVelocity(Player player, Vector velocity);
}

View File

@ -88,7 +88,7 @@ public enum Achievement
SKYWARS_WINS("Sky King",2000,
new String[]{"Skywars.Wins"},
new String[]{"Win 20 Games of Skywars"},
new int[]{30},
new int[]{20},
AchievementCategory.SKYWARS),
SKYWARS_BOMBER("Master Bomber",500,

View File

@ -170,7 +170,7 @@ public class MorphWither extends MorphGadget
player.setFlying(true);
if (UtilEnt.isGrounded(player))
player.setVelocity(new Vector(0,1,0));
UtilAction.velocity(player, new Vector(0,1,0), 1, false, 0, 0, 1, true);
}
}

View File

@ -20,6 +20,7 @@ import mineplex.core.common.jsonchat.JsonMessage;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilWorld;
@ -285,7 +286,7 @@ public class Teleport extends MiniPlugin
}
player.setFallDistance(0);
player.setVelocity(new Vector(0,0,0));
UtilAction.velocity(player, new Vector(0,1,0), 0, false, 0, 0, 0, false);
player.teleport(loc);
}

View File

@ -0,0 +1,78 @@
package mineplex.core.velocity;
import java.util.Iterator;
import mineplex.core.MiniPlugin;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.VelocityReceiver;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.event.player.PlayerVelocityEvent;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.util.Vector;
public class VelocityFix extends MiniPlugin implements VelocityReceiver
{
/*
* The purpose of this class is to fix a bug inherent in Minecraft,
* where player join order will somehow modify the velocity sent to players.
*
* To fix it, we simply save the velocity that the player should have received,
* then we re-set those values in CB the moment its about to actually apply the velocity to a player.
*
* The problem was caused by the fact that CB does not run a PlayerVelocityEvent the moment we
* set a players velocity, instead it waits until the next tick, and the velocity may have been changed.
*
*/
private NautHashMap<Player, Vector> _velocityData = new NautHashMap<Player,Vector>();
public VelocityFix(JavaPlugin plugin)
{
super("Velocity Fix", plugin);
UtilAction.registerVelocityFix(this);
}
@Override
public void setPlayerVelocity(Player player, Vector velocity)
{
_velocityData.put(player, velocity);
}
@EventHandler(priority = EventPriority.LOWEST)
public void fixVelocity(PlayerVelocityEvent event)
{
if (_velocityData.containsKey(event.getPlayer()))
event.getPlayer().setVelocity(_velocityData.remove(event.getPlayer()));
}
@EventHandler
public void cleanVelocity(PlayerQuitEvent event)
{
_velocityData.remove(event.getPlayer());
}
@EventHandler
public void cleanVelocity(UpdateEvent event)
{
if (event.getType() != UpdateType.SLOW)
return;
Iterator<Player> keyIter = _velocityData.keySet().iterator();
while (keyIter.hasNext())
{
Player player = keyIter.next();
if (player.isOnline())
keyIter.remove();
}
}
}

View File

@ -46,6 +46,7 @@ import mineplex.core.task.TaskManager;
import mineplex.core.teleport.Teleport;
import mineplex.core.updater.FileUpdater;
import mineplex.core.updater.Updater;
import mineplex.core.velocity.VelocityFix;
import mineplex.core.visibility.VisibilityManager;
import mineplex.hub.modules.StackerManager;
import mineplex.hub.poll.PollManager;
@ -78,6 +79,9 @@ public class Hub extends JavaPlugin implements IRelation
//Logger.initialize(this);
//Velocity Fix
new VelocityFix(this);
//Static Modules
CommandCenter.Initialize(this);
CoreClientManager clientManager = new CoreClientManager(this, webServerAddress);

View File

@ -255,7 +255,8 @@ public class StackerManager extends MiniPlugin implements IThrown
Manager.SetPortalDelay(rider);
rider.leaveVehicle();
rider.setVelocity(new Vector(0.25 - Math.random()/2, Math.random()/2, 0.25 - Math.random()/2));
UtilAction.velocity(rider, new Vector(0.25 - Math.random()/2, Math.random()/2, 0.25 - Math.random()/2),
1, false, 0, 0, 0, false);
rider = rider.getPassenger();
}

View File

@ -26,6 +26,7 @@ import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import mineplex.core.common.util.F;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
@ -209,7 +210,8 @@ public class Blizzard extends SkillActive
if (damagee == null) return;
event.SetCancelled(GetName());
damagee.setVelocity(proj.getVelocity().multiply(0.1).add(new Vector(0, 0.15, 0)));
UtilAction.velocity(damagee, proj.getVelocity().multiply(0.1).add(new Vector(0, 0.15, 0)),
1, false, 0, 0, 0, false);
}
@EventHandler

View File

@ -395,7 +395,7 @@ public class DamageManager extends MiniPlugin
if (event.GetDamageeEntity() instanceof Player && UtilGear.isMat(((Player)event.GetDamageeEntity()).getItemInHand(), Material.SUGAR))
{
Bukkit.broadcastMessage("--------- " +
UtilEnt.getName(event.GetDamageeEntity()) + " hurt by " + UtilEnt.getName(event.GetDamagerEntity(true)) + "-----------" );
UtilEnt.getName(event.GetDamageeEntity()) + " hit by " + UtilEnt.getName(event.GetDamagerEntity(true)) + "-----------" );
Bukkit.broadcastMessage(F.main("Debug", "Damage: " + event.GetDamage()));
}
@ -422,15 +422,6 @@ public class DamageManager extends MiniPlugin
}
}
@EventHandler
public void debugVel2(PlayerVelocityEvent event)
{
if (UtilGear.isMat(((Player)event.getPlayer()).getItemInHand(), Material.SUGAR))
{
Bukkit.broadcastMessage(F.main("Debug", "Event: " + event.getVelocity().length()));
}
}
private void DisplayDamage(CustomDamageEvent event)
{
for (Player player : UtilServer.getPlayers())

View File

@ -6,6 +6,7 @@ import java.util.HashSet;
import mineplex.core.MiniPlugin;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.core.updater.UpdateType;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilTime;
import org.bukkit.Material;
@ -54,8 +55,7 @@ public class PistonJump extends MiniPlugin
//Vector
Vector vec = new Vector(0,1.2,0);
player.setVelocity(vec);
player.setFallDistance(0);
UtilAction.velocity(player, vec);
}
final Block block = below;

View File

@ -48,6 +48,7 @@ import mineplex.core.status.ServerStatusManager;
import mineplex.core.teleport.Teleport;
import mineplex.core.updater.FileUpdater;
import mineplex.core.updater.Updater;
import mineplex.core.velocity.VelocityFix;
import mineplex.core.visibility.VisibilityManager;
import mineplex.minecraft.game.core.combat.CombatManager;
import mineplex.minecraft.game.core.damage.DamageManager;
@ -86,10 +87,14 @@ public class Arcade extends JavaPlugin
_clientManager = new CoreClientManager(this, webServerAddress);
CommandCenter.Instance.setClientManager(_clientManager);
ItemStackFactory.Initialize(this, false);
Recharge.Initialize(this);
VisibilityManager.Initialize(this);
Give.Initialize(this);
//Velocity Fix
new VelocityFix(this);
_donationManager = new DonationManager(this, _clientManager, webServerAddress);

View File

@ -49,6 +49,7 @@ import mineplex.core.common.jsonchat.JsonMessage;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilPlayer;
@ -1333,7 +1334,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
player.teleport(GetGame().GetSpectatorLocation());
//Set Spec State
player.setVelocity(new Vector(0,1,0));
UtilAction.velocity(player, new Vector(0,1,0));
player.setAllowFlight(true);
player.setFlying(true);
player.setFlySpeed(0.1f);

View File

@ -45,6 +45,7 @@ import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.MapUtil;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEvent;
@ -1178,7 +1179,7 @@ public class Bridge extends TeamGame implements OreObsfucation
UtilPlayer.message(event.getPlayer(), F.main("Game",
"Cannot place blocks in liquids until Bridge is down."));
event.getPlayer().setVelocity(new Vector(0,-0.5,0));
UtilAction.velocity(event.getPlayer(), new Vector(0, -0.5, 0));
event.setCancelled(true);
return;

View File

@ -67,6 +67,7 @@ import mineplex.core.common.Rank;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilEvent.ActionType;
@ -707,7 +708,7 @@ public class Build extends SoloGame
event.setTo(event.getFrom());
//Velocity
event.getPlayer().setVelocity(UtilAlg.getTrajectory(event.getTo(), data.Spawn));
UtilAction.velocity(event.getPlayer(), UtilAlg.getTrajectory(event.getTo(), data.Spawn));
}
}

View File

@ -34,6 +34,7 @@ import org.bukkit.util.Vector;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilServer;
@ -526,8 +527,7 @@ public class DragonEscape extends SoloGame
//Teleport
player.teleport(target.getLocation().add(0, 0.5, 0));
player.setVelocity(new Vector(0,0,0));
player.setFallDistance(0);
UtilAction.velocity(player, new Vector(0,0,0));
//Record
_warpTime.put(player, System.currentTimeMillis());

View File

@ -26,6 +26,7 @@ import org.bukkit.util.Vector;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.NautHashMap;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilInv;
@ -540,8 +541,7 @@ public class DragonEscapeTeams extends TeamGame
//Teleport
player.teleport(target.getLocation().add(0, 0.5, 0));
player.setVelocity(new Vector(0,0,0));
player.setFallDistance(0);
UtilAction.velocity(player, new Vector(0,0,0));
//Record
_warpTime.put(player, System.currentTimeMillis());

View File

@ -8,6 +8,7 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.Map.Entry;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilMath;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
@ -15,6 +16,7 @@ import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.game.SoloGame;
import nautilus.game.arcade.kit.Kit;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Material;
@ -225,7 +227,8 @@ public class HoleInTheWall extends SoloGame
{
wall.getKnockedPlayers().add(player.getUniqueId());
player.setVelocity(_wallVector.clone().normalize().multiply(5).setY(0.3));
UtilAction.velocity(player, _wallVector.clone().normalize().multiply(5).setY(0.3));
player.playSound(player.getLocation(), Sound.NOTE_BASS, 2, 1F);
}
/*Location toTeleport = player.getLocation();

View File

@ -1305,7 +1305,7 @@ public class MineStrike extends TeamGame
//Mini-Stun
else
{
event.GetDamageePlayer().setVelocity(new Vector(0,0,0));
UtilAction.velocity(event.GetDamageePlayer(), new Vector(0,0,0));
}
event.SetKnockback(false);

View File

@ -35,6 +35,7 @@ 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.UtilBlock;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
@ -307,7 +308,7 @@ public class Paintball extends TeamGame
((CraftPlayer)player).getHandle().spectating = true;
((CraftPlayer)player).getHandle().k = false;
player.setVelocity(new Vector(0,1.2,0));
UtilAction.velocity(player, new Vector(0,1.2,0));
_doubles.put(player, new PlayerCopy(this, player, GetTeam(player).GetColor()));
}

View File

@ -5,18 +5,6 @@ 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.scoreboard.DisplaySlot;
import org.bukkit.scoreboard.Objective;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilPlayer;
@ -32,12 +20,28 @@ import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.SoloGame;
import nautilus.game.arcade.game.games.quiver.kits.*;
import nautilus.game.arcade.game.games.quiver.kits.KitBrawler;
import nautilus.game.arcade.game.games.quiver.kits.KitEnchanter;
import nautilus.game.arcade.game.games.quiver.kits.KitLeaper;
import nautilus.game.arcade.game.games.quiver.kits.KitNinja;
import nautilus.game.arcade.game.games.quiver.kits.KitSlamShot;
import nautilus.game.arcade.kit.Kit;
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.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>();
@ -56,7 +60,8 @@ public class Quiver extends SoloGame
new KitLeaper(manager),
new KitBrawler(manager),
new KitEnchanter(manager),
new KitSlamShot(manager)
new KitSlamShot(manager),
new KitNinja(manager)
},
new String[]
@ -75,6 +80,8 @@ public class Quiver extends SoloGame
this.BlockBreakAllow.add(102);
this.BlockBreakAllow.add(20);
this.DeathSpectateSecs = 2;
_scoreObj = Scoreboard.GetScoreboard().registerNewObjective("Kills", "dummy");
_scoreObj.setDisplaySlot(DisplaySlot.BELOW_NAME);

View File

@ -0,0 +1,56 @@
package nautilus.game.arcade.game.games.quiver.kits;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilServer;
import mineplex.core.itemstack.ItemBuilder;
import mineplex.core.itemstack.ItemStackFactory;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.game.Game.GameState;
import nautilus.game.arcade.kit.Kit;
import nautilus.game.arcade.kit.KitAvailability;
import nautilus.game.arcade.kit.Perk;
import nautilus.game.arcade.kit.perks.PerkVanishing;
import org.bukkit.Material;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
public class KitNinja extends Kit
{
public KitNinja(ArcadeManager manager)
{
super(manager, "Ninja", KitAvailability.Achievement, 0, new String[]
{
"You're a sneaky one, you!"
}, new Perk[]
{
new PerkVanishing()
}, EntityType.ZOMBIE, new ItemBuilder(Material.GOLD_SWORD).build());
}
@Override
public void GiveItems(Player player)
{
player.getInventory().addItem(new ItemBuilder(Material.GOLD_SWORD).setUnbreakable(true).build());
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW));
if (Manager.GetGame().GetState() == GameState.Live)
{
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(262, (byte)0, 1, F.item("Super Arrow")));
final Player fPlayer = player;
UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(Manager.getPlugin(), new Runnable()
{
public void run()
{
UtilInv.Update(fPlayer);
}
}, 10);
}
}
}

View File

@ -21,9 +21,8 @@ public class KitSlamShot extends Kit
{
public KitSlamShot(ArcadeManager manager)
{
super(manager, "Slam Shooter", KitAvailability.Achievement,
new String[]
super(manager, "Slam Shooter", KitAvailability.Gem,
5000, new String[]
{
"Gets 2 arrows for killing slammed players!"
},
@ -33,7 +32,7 @@ public class KitSlamShot extends Kit
new PerkSeismicSlamOITQ()
},
EntityType.ZOMBIE,
new ItemStack(Material.IRON_SPADE));
new ItemStack(Material.DIAMOND_SPADE));
this.setAchievementRequirements(new Achievement[]
{
@ -47,7 +46,7 @@ public class KitSlamShot extends Kit
@Override
public void GiveItems(Player player)
{
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SPADE));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.DIAMOND_SPADE));
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW));
if (Manager.GetGame().GetState() == GameState.Live)

View File

@ -982,7 +982,7 @@ public abstract class Skywars extends Game
if (vel.getY() < 0.1)
vel.setY(0.1);
event.GetDamageeEntity().setVelocity(vel);
UtilAction.velocity(event.GetDamageeEntity(), vel);
}
}

View File

@ -14,13 +14,13 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.util.Vector;
import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilMath;
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.kit.Perk;
public class PerkBlizzard extends Perk
@ -108,8 +108,9 @@ public class PerkBlizzard extends Perk
if (damagee == null) return;
event.SetCancelled("Blizzard");
damagee.setVelocity(proj.getVelocity().multiply(0.15).add(new Vector(0, 0.15, 0)));
UtilAction.velocity(damagee, proj.getVelocity().multiply(0.15).add(new Vector(0, 0.15, 0)));
//Damage Event
if (damagee instanceof Player)
if (Recharge.Instance.use((Player)damagee, GetName(), 200, false, false))

View File

@ -162,7 +162,7 @@ public class PerkBoneRush extends SmashPerk implements IThrown
DamageCause.CUSTOM, damage, false, true, false,
UtilEnt.getName(data.GetThrower()), reason);
target.setVelocity(data.GetThrown().getVelocity());
UtilAction.velocity(target, data.GetThrown().getVelocity());
}
@Override

View File

@ -106,6 +106,7 @@ public class PerkCreeperExplode extends SmashPerk
//Idle in Air
player.setVelocity(new Vector(0,0,0));
UtilAction.zeroVelocity(player);
//Sound
player.getWorld().playSound(player.getLocation(), Sound.CREEPER_HISS, (float)(0.5 + elapsed), (float)(0.5 + elapsed));

View File

@ -145,7 +145,7 @@ public class PerkDeathsGrasp extends Perk
UtilAction.velocity(damagee, UtilAlg.getTrajectory(damagee, damager), 1.8, false, 0, 1, 1.8, true);
damager.setVelocity(new Vector(0,0,0));
UtilAction.zeroVelocity(damager);
damager.getWorld().playSound(damager.getLocation(), Sound.ZOMBIE_HURT, 1f, 0.7f);

View File

@ -16,6 +16,7 @@ import org.bukkit.util.Vector;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilServer;
@ -126,7 +127,7 @@ public class PerkDisruptor extends Perk
_tntMap.remove(event.getItem());
event.getItem().remove();
event.getPlayer().setVelocity(new Vector(0,0.5,0));
UtilAction.velocity(event.getPlayer(), new Vector(0, 0.5, 0));
event.getPlayer().getWorld().playSound(event.getPlayer().getLocation(), Sound.EXPLODE, 1f, 2f);
event.getPlayer().playEffect(EntityEffect.HURT);

View File

@ -14,6 +14,7 @@ import org.bukkit.util.Vector;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilPlayer;
@ -130,6 +131,6 @@ public class PerkEggGun extends SmashPerk
DamageCause.PROJECTILE, 1, true, true, false,
UtilEnt.getName((LivingEntity)egg.getShooter()), GetName());
event.GetDamageeEntity().setVelocity(new Vector(0,0,0));
UtilAction.zeroVelocity(event.GetDamageeEntity());
}
}

View File

@ -17,6 +17,7 @@ import org.bukkit.util.Vector;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilPlayer;
@ -101,7 +102,7 @@ public class PerkFirefly extends SmashPerk
//Teleport
if (!UtilTime.elapsed(data.Time, 1500) && !superActive)
{
data.Player.setVelocity(new Vector(0,0,0));//.teleport(data.Location);
UtilAction.zeroVelocity(data.Player);
data.Player.getWorld().playSound(data.Player.getLocation(), Sound.EXPLODE, 0.2f, 0.6f);
data.Location = data.Player.getLocation();
@ -115,8 +116,7 @@ public class PerkFirefly extends SmashPerk
//Velocity
else if (!UtilTime.elapsed(data.Time, 2500) || superActive)
{
data.Player.setVelocity(data.Player.getLocation().getDirection().multiply(superActive ? 0.9 : 0.7).add(new Vector(0,0.15,0)));
//data.Player.setVelocity(data.Location.getDirection().multiply(0.7).add(new Vector(0,0.1,0)));
UtilAction.velocity(data.Player, data.Player.getLocation().getDirection().multiply(superActive ? 0.9 : 0.7).add(new Vector(0,0.15,0)));
data.Player.getWorld().playSound(data.Player.getLocation(), Sound.EXPLODE, 0.6f, 1.2f);
if (_tick == 0)

View File

@ -13,6 +13,7 @@ import org.bukkit.util.Vector;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle;
@ -123,7 +124,7 @@ public class PerkFlameDash extends Perk
vel.normalize();
vel.setY(0.05);
data.Player.setVelocity(vel);
UtilAction.velocity(data.Player, vel);
//Sound
data.Player.getWorld().playSound(data.Player.getLocation(), Sound.FIZZ, 0.6f, 1.2f);

View File

@ -100,7 +100,7 @@ public class PerkFlameSlam extends Perk
Vector vel = player.getLocation().getDirection();
vel.setY(0);
UtilAlg.Normalize(vel);
player.setVelocity(vel.multiply(0.8));
UtilAction.velocity(player, vel.multiply(0.8));
//Particle
UtilParticle.PlayParticle(ParticleType.FLAME, player.getLocation().add(0, 1, 0), 0.2f, 0.2f, 0.2f, 0, 5,

View File

@ -92,7 +92,7 @@ public class PerkFleshArrow extends SmashPerk
Manager.GetCondition().Factory().Slow(GetName(), ent, event.GetDamagerEntity(true), 4, 3, false, false, false, false);
ent.setVelocity(new Vector(0,-0.5,0));
UtilAction.velocity(ent, new Vector(0,-0.5,0));
}
@EventHandler

View File

@ -13,6 +13,7 @@ import org.bukkit.util.Vector;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.recharge.Recharge;
@ -59,7 +60,7 @@ public class PerkIcePath extends Perk
if (!Recharge.Instance.use(player, GetName(), 12000, true, true))
return;
player.setVelocity(new Vector(0,0,0));
UtilAction.zeroVelocity(player);
player.teleport(player.getLocation().add(0, 0.75, 0));
_data.add(new IcePathData(player));

View File

@ -132,7 +132,7 @@ public class PerkSnowTurret extends SmashPerk
if (damagee.equals(_snowball.get(proj)))
return;
damagee.setVelocity(proj.getVelocity().multiply(0.3).add(new Vector(0, 0.3, 0)));
UtilAction.velocity(damagee, proj.getVelocity().multiply(0.3).add(new Vector(0, 0.3, 0)));
//Damage Event
if (!(damagee instanceof LivingEntity))

View File

@ -73,7 +73,7 @@ public class PerkSpiderLeap extends Perk
{
if (!UtilBlock.airFoliage(block) && !block.isLiquid())
{
player.setVelocity(new Vector(0,0.2,0));
UtilAction.velocity(player, new Vector(0, 0.2, 0));
if (!_secondJump.contains(player))
{

View File

@ -112,7 +112,7 @@ public class PerkTakedown extends Perk
DamageCause.CUSTOM, 8, true, true, false,
damager.getName(), GetName());
damager.setVelocity(new Vector(0,0,0));
UtilAction.zeroVelocity(damager);
//Inform
UtilPlayer.message(damager, F.main("Game", "You hit " + F.name(UtilEnt.getName(damagee)) + " with " + F.skill(GetName()) + "."));

View File

@ -0,0 +1,107 @@
package nautilus.game.arcade.kit.perks;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilParticle.ParticleType;
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.kit.Perk;
import org.bukkit.Sound;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
public class PerkVanishing extends Perk
{
public PerkVanishing()
{
super("Vanishing Act", new String[]
{
"Become invisible for 2 seconds each kill.",
"Attacking with melee removes invisibility."
});
}
@EventHandler
public void kill(CombatDeathEvent event)
{
if (!Manager.GetGame().IsLive())
return;
// //If it's an arrow kill (OITQ)
// if (!event.GetLog().GetKiller().GetReason().toLowerCase().contains("instagib"))
// return;
if (!event.GetLog().GetKiller().IsPlayer())
return;
Player killer = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName());
if (killer == null)
return;
if (!Manager.IsAlive(killer))
return;
if (!Kit.HasKit(killer))
return;
Manager.GetCondition().Factory().Cloak("Vanishing Act", killer, null, 2, false, true);
UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, killer.getLocation().add(0, 1, 0), 0, 0, 0, 0, 1, ViewDist.LONG, UtilServer.getPlayers());
killer.getWorld().playSound(killer.getLocation(), Sound.FIZZ, 1f, 2f);
}
@EventHandler
public void remove(CustomDamageEvent event)
{
if (event.isCancelled())
return;
if (!Manager.GetGame().IsLive())
return;
//Arrow damage, ignore it!
if (event.GetDamage() > 10)
return;
Player damager = event.GetDamagerPlayer(true);
if (damager == null)
return;
if (!Manager.IsAlive(damager))
return;
if (!Kit.HasKit(damager))
return;
Manager.GetCondition().EndCondition(damager, ConditionType.CLOAK, null);
}
// @EventHandler
// public void remove(UpdateEvent event)
// {
// if (event.getType() != UpdateType.TICK)
// return;
//
// if (!Manager.GetGame().IsLive())
// return;
//
// for (Player player : Manager.GetGame().GetPlayers(true))
// {
// if (!Kit.HasKit(player))
// continue;
//
// if (!UtilPlayer.isChargingBow(player))
// continue;
//
// if (Manager.GetCondition().IsCloaked(player))
// Manager.GetCondition().Clean(player);
// }
// }
}

View File

@ -100,7 +100,7 @@ public class PerkWebShot extends SmashPerk implements IThrown
DamageCause.PROJECTILE, 6, false, false, false,
UtilEnt.getName(data.GetThrower()), GetName());
target.setVelocity(new Vector(0,0,0));
UtilAction.zeroVelocity(target);
return;
}

View File

@ -152,7 +152,7 @@ public class PerkWolf extends SmashPerk
_tackle.put(wolf, damagee);
wolf.setVelocity(new Vector(0,-0.6,0));
damagee.setVelocity(new Vector(0,0,0));
UtilAction.zeroVelocity(damagee);
//Damage
Manager.GetDamage().NewDamageEvent(damagee, damager, null,
@ -190,7 +190,7 @@ public class PerkWolf extends SmashPerk
if (UtilMath.offset(wolf, ent) < 2.5)
{
Manager.GetCondition().Factory().Slow("Cub Table", ent, wolf, 0.9, 1, false, false, false, false);
ent.setVelocity(new Vector(0,-0.3,0));
UtilAction.velocity(ent, new Vector(0,-0.3,0));
}
//Move
@ -305,7 +305,7 @@ public class PerkWolf extends SmashPerk
public void StrikeHit(Player damager, LivingEntity damagee)
{
damager.setVelocity(new Vector(0,0,0));
UtilAction.zeroVelocity(damager);
//Remove Tackle
Iterator<Wolf> wolfIterator = _tackle.keySet().iterator();

View File

@ -538,7 +538,7 @@ public class PerkWolfPack extends Perk
public void TackleHit(Player damager, LivingEntity damagee)
{
damager.setVelocity(new Vector(0,0,0));
UtilAction.zeroVelocity(damager);
Manager.GetDamage().NewDamageEvent(damagee, damager, null,
DamageCause.CUSTOM, 7, false, true, false,

View File

@ -696,7 +696,7 @@ public class GameFlagManager implements Listener
public void run()
{
player.setFireTicks(0);
player.setVelocity(new Vector(0,0,0));
UtilAction.zeroVelocity(player);
}
}, 0);
}
@ -745,7 +745,7 @@ public class GameFlagManager implements Listener
}
player.setFireTicks(0);
player.setVelocity(new Vector(0,0,0));
UtilAction.zeroVelocity(player);
}
}, (int)(time * 20d));
}