more ssm update

This commit is contained in:
Cheese 2015-10-12 16:32:23 +11:00
parent 6a173073a4
commit 2b9a66e7b2
8 changed files with 90 additions and 80 deletions

View File

@ -11,6 +11,7 @@ import mineplex.core.common.util.UtilServer;
import mineplex.core.updater.UpdateType; import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.event.UpdateEvent;
import net.minecraft.server.v1_7_R4.AxisAlignedBB; import net.minecraft.server.v1_7_R4.AxisAlignedBB;
import net.minecraft.server.v1_7_R4.EntityPlayer;
import net.minecraft.server.v1_7_R4.MathHelper; import net.minecraft.server.v1_7_R4.MathHelper;
import net.minecraft.server.v1_7_R4.MovingObjectPosition; import net.minecraft.server.v1_7_R4.MovingObjectPosition;
import net.minecraft.server.v1_7_R4.Vec3D; import net.minecraft.server.v1_7_R4.Vec3D;
@ -184,7 +185,10 @@ public class ProjectileUser
((CraftEntity)_thrown).getHandle().motY, ((CraftEntity)_thrown).getHandle().motY,
((CraftEntity)_thrown).getHandle().motZ).grow(_hitboxGrow, _hitboxGrow, _hitboxGrow))) ((CraftEntity)_thrown).getHandle().motZ).grow(_hitboxGrow, _hitboxGrow, _hitboxGrow)))
{ {
if (!_hitNonPlayerEntity && !(entity instanceof Player)) if (!_hitNonPlayerEntity && !(entity instanceof EntityPlayer))
continue;
if (!_hitPlayer && entity instanceof EntityPlayer)
continue; continue;
if (entity instanceof net.minecraft.server.v1_7_R4.Entity) if (entity instanceof net.minecraft.server.v1_7_R4.Entity)

View File

@ -7,6 +7,7 @@ import mineplex.core.common.util.C;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile; import org.bukkit.entity.Projectile;
@ -36,6 +37,7 @@ public class CustomDamageEvent extends Event implements Cancellable
private Player _damagerPlayer; private Player _damagerPlayer;
private Projectile _projectile; private Projectile _projectile;
private Location _knockbackOrigin = null; private Location _knockbackOrigin = null;
private Entity _knockbackSource = null;
//Flags //Flags
private boolean _ignoreArmor = false; private boolean _ignoreArmor = false;
@ -46,7 +48,7 @@ public class CustomDamageEvent extends Event implements Cancellable
public CustomDamageEvent(LivingEntity damagee, LivingEntity damager, Projectile projectile, public CustomDamageEvent(LivingEntity damagee, LivingEntity damager, Projectile projectile,
DamageCause cause, double damage, boolean knockback, boolean ignoreRate, boolean ignoreArmor, DamageCause cause, double damage, boolean knockback, boolean ignoreRate, boolean ignoreArmor,
String initialSource, String initialReason, boolean cancelled) String initialSource, String initialReason, boolean cancelled, Entity knockbackSource)
{ {
_eventCause = cause; _eventCause = cause;
@ -65,6 +67,8 @@ public class CustomDamageEvent extends Event implements Cancellable
_ignoreRate = ignoreRate; _ignoreRate = ignoreRate;
_ignoreArmor = ignoreArmor; _ignoreArmor = ignoreArmor;
_knockbackSource = knockbackSource;
if (initialSource != null && initialReason != null) if (initialSource != null && initialReason != null)
AddMod(initialSource, initialReason, 0, true); AddMod(initialSource, initialReason, 0, true);
@ -266,6 +270,9 @@ public class CustomDamageEvent extends Event implements Cancellable
public Location getKnockbackOrigin() public Location getKnockbackOrigin()
{ {
if (_knockbackSource != null)
return _knockbackSource.getLocation();
return _knockbackOrigin; return _knockbackOrigin;
} }

View File

@ -32,6 +32,7 @@ import org.bukkit.Sound;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftLivingEntity; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftLivingEntity;
import org.bukkit.enchantments.Enchantment; import org.bukkit.enchantments.Enchantment;
import org.bukkit.entity.Arrow; import org.bukkit.entity.Arrow;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Fish; import org.bukkit.entity.Fish;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -167,17 +168,35 @@ public class DamageManager extends MiniPlugin
{ {
NewDamageEvent(damagee, damager, proj, NewDamageEvent(damagee, damager, proj,
cause, damage, knockback, ignoreRate, ignoreArmor, cause, damage, knockback, ignoreRate, ignoreArmor,
source, reason, false); source, reason, false, null);
}
public void NewDamageEvent(LivingEntity damagee, LivingEntity damager, Projectile proj,
DamageCause cause, double damage, boolean knockback, boolean ignoreRate, boolean ignoreArmor,
String source, String reason, Entity knockbackSource)
{
NewDamageEvent(damagee, damager, proj,
cause, damage, knockback, ignoreRate, ignoreArmor,
source, reason, false, knockbackSource);
} }
public void NewDamageEvent(LivingEntity damagee, LivingEntity damager, Projectile proj, public void NewDamageEvent(LivingEntity damagee, LivingEntity damager, Projectile proj,
DamageCause cause, double damage, boolean knockback, boolean ignoreRate, boolean ignoreArmor, DamageCause cause, double damage, boolean knockback, boolean ignoreRate, boolean ignoreArmor,
String source, String reason, boolean cancelled) String source, String reason, boolean cancelled)
{
NewDamageEvent(damagee, damager, proj,
cause, damage, knockback, ignoreRate, ignoreArmor,
source, reason, cancelled, null);
}
public void NewDamageEvent(LivingEntity damagee, LivingEntity damager, Projectile proj,
DamageCause cause, double damage, boolean knockback, boolean ignoreRate, boolean ignoreArmor,
String source, String reason, boolean cancelled, Entity knockbackSource)
{ {
_plugin.getServer().getPluginManager().callEvent( _plugin.getServer().getPluginManager().callEvent(
new CustomDamageEvent(damagee, damager, proj, cause, damage, new CustomDamageEvent(damagee, damager, proj, cause, damage,
knockback, ignoreRate, ignoreArmor, knockback, ignoreRate, ignoreArmor,
source, reason, cancelled)); source, reason, cancelled, knockbackSource));
} }
@EventHandler(priority = EventPriority.LOW) @EventHandler(priority = EventPriority.LOW)

View File

@ -46,7 +46,7 @@ public class KitCow extends SmashKit
UtilInv.Clear(player); UtilInv.Clear(player);
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1, player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE, (byte)0, 1,
C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Stampede", C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Angry Herd",
new String[] new String[]
{ {
ChatColor.RESET + "", ChatColor.RESET + "",

View File

@ -214,13 +214,13 @@ public class KitKnight extends SmashKit
Horse horse = (Horse)damagee.getVehicle(); Horse horse = (Horse)damagee.getVehicle();
//Damage Event //Damage Event
CustomDamageEvent newEvent = new CustomDamageEvent(horse, event.GetDamagerEntity(true), event.GetProjectile(), // CustomDamageEvent newEvent = new CustomDamageEvent(horse, event.GetDamagerEntity(true), event.GetProjectile(),
event.GetCause(), event.GetDamageInitial(), true, false, false, // event.GetCause(), event.GetDamageInitial(), true, false, false,
UtilEnt.getName(event.GetDamagerPlayer(true)), event.GetReason(), false); // UtilEnt.getName(event.GetDamagerPlayer(true)), event.GetReason(), false);
_calledEvents.add(newEvent); // _calledEvents.add(newEvent);
Manager.getPlugin().getServer().getPluginManager().callEvent(newEvent); // Manager.getPlugin().getServer().getPluginManager().callEvent(newEvent);
_calledEvents.remove(newEvent); // _calledEvents.remove(newEvent);
} }
@EventHandler(priority = EventPriority.LOWEST) @EventHandler(priority = EventPriority.LOWEST)
@ -246,13 +246,13 @@ public class KitKnight extends SmashKit
Player player = (Player)horse.getPassenger(); Player player = (Player)horse.getPassenger();
//Damage Event //Damage Event
final CustomDamageEvent newEvent = new CustomDamageEvent(player, event.GetDamagerEntity(true), event.GetProjectile(), // final CustomDamageEvent newEvent = new CustomDamageEvent(player, event.GetDamagerEntity(true), event.GetProjectile(),
event.GetCause(), event.GetDamageInitial(), true, false, false, // event.GetCause(), event.GetDamageInitial(), true, false, false,
UtilEnt.getName(event.GetDamagerPlayer(true)), event.GetReason(), false); // UtilEnt.getName(event.GetDamagerPlayer(true)), event.GetReason(), false);
//
_calledEvents.add(newEvent); // _calledEvents.add(newEvent);
Manager.getPlugin().getServer().getPluginManager().callEvent(newEvent); // Manager.getPlugin().getServer().getPluginManager().callEvent(newEvent);
_calledEvents.remove(newEvent); // _calledEvents.remove(newEvent);
//Add Knockback //Add Knockback
event.AddKnockback("Knockback Multiplier", 1.2); event.AddKnockback("Knockback Multiplier", 1.2);
} }

View File

@ -1,17 +1,11 @@
package nautilus.game.arcade.game.games.smash.perks; package nautilus.game.arcade.game.games.smash.perks;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.entity.Cow; import org.bukkit.entity.Cow;
import org.bukkit.entity.Item;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.block.Action; import org.bukkit.event.block.Action;
@ -21,7 +15,6 @@ import org.bukkit.util.Vector;
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.UtilAction;
import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilEnt;
@ -32,24 +25,21 @@ import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilParticle.ParticleType; import mineplex.core.common.util.UtilParticle.ParticleType;
import mineplex.core.common.util.UtilParticle.ViewDist; import mineplex.core.common.util.UtilParticle.ViewDist;
import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.projectile.IThrown;
import mineplex.core.projectile.ProjectileUser;
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 mineplex.minecraft.game.core.damage.CustomDamageEvent; import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.kit.SmashPerk; import nautilus.game.arcade.kit.SmashPerk;
public class PerkCowStampede extends SmashPerk implements IThrown public class PerkCowStampede extends SmashPerk
{ {
private ArrayList<DataCowCharge> _active = new ArrayList<DataCowCharge>(); private ArrayList<DataCowCharge> _active = new ArrayList<DataCowCharge>();
public PerkCowStampede() public PerkCowStampede()
{ {
super("Fish Flurry", new String[] super("Angry Herd", new String[]
{ {
C.cYellow + "Right-Click" + C.cGray + " with Spade to use " + C.cGreen + "Fish Flurry" C.cYellow + "Right-Click" + C.cGray + " with Axe to use " + C.cGreen + "Angry Herd"
}); });
} }
@ -94,17 +84,12 @@ public class PerkCowStampede extends SmashPerk implements IThrown
Location loc = player.getLocation(); Location loc = player.getLocation();
loc.add(dir); loc.add(dir);
loc.add(UtilAlg.getLeft(dir).multiply(i*1.5)); loc.add(UtilAlg.getLeft(dir).multiply(i*1.25));
Manager.GetGame().CreatureAllowOverride = true; Manager.GetGame().CreatureAllowOverride = true;
Cow cow = player.getWorld().spawn(loc, Cow.class); Cow cow = player.getWorld().spawn(loc, Cow.class);
Manager.GetGame().CreatureAllowOverride = false; Manager.GetGame().CreatureAllowOverride = false;
Manager.GetProjectile().AddThrow(cow, player, this,
-1, true, false, false, false,
null, 1f, 1f,
null, UpdateType.TICK, 2.5f);
_active.add(new DataCowCharge(player, cow)); _active.add(new DataCowCharge(player, cow));
} }
@ -149,12 +134,12 @@ public class PerkCowStampede extends SmashPerk implements IThrown
} }
//Stuck Remove //Stuck Remove
if (UtilTime.elapsed(data.LastMoveTime, 2000)) if (UtilTime.elapsed(data.LastMoveTime, 1000))
{ {
if (data.Cow.isValid()) if (data.Cow.isValid())
{ {
data.Cow.remove(); data.Cow.remove();
UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, data.Cow.getLocation().add(0, 1, 0), 0, 0, 0, 0, 1, ViewDist.NORMAL, UtilServer.getPlayers()); UtilParticle.PlayParticle(ParticleType.EXPLODE, data.Cow.getLocation().add(0, 1, 0), 0, 0, 0, 0, 1, ViewDist.NORMAL, UtilServer.getPlayers());
} }
activeIter.remove(); activeIter.remove();
@ -172,54 +157,49 @@ public class PerkCowStampede extends SmashPerk implements IThrown
} }
//Move //Move
data.Cow.setVelocity(data.Direction); if (UtilTime.elapsed(data.LastMoveTime, 350))
data.Cow.setVelocity(data.Direction.clone().add(new Vector(0,0.75,0)));
else
data.Cow.setVelocity(data.Direction);
if (Math.random() > 0.99) if (Math.random() > 0.99)
data.Cow.getWorld().playSound(data.Cow.getLocation(), Sound.COW_IDLE, 1f, 1f); data.Cow.getWorld().playSound(data.Cow.getLocation(), Sound.COW_IDLE, 1f, 1f);
if (Math.random() > 0.97) if (Math.random() > 0.97)
data.Cow.getWorld().playSound(data.Cow.getLocation(), Sound.COW_WALK, 1f, 1.2f); data.Cow.getWorld().playSound(data.Cow.getLocation(), Sound.COW_WALK, 1f, 1.2f);
//Hit
for (Player player : Manager.GetGame().GetPlayers(true))
{
if (player.equals(data.Player))
continue;
if (UtilMath.offset(player, data.Cow) < 2.2)
{
if (Recharge.Instance.use(player, "Hit by " + data.Player.getName(), 600, false, false))
{
//Damage Event
Manager.GetDamage().NewDamageEvent(player, data.Player, null,
DamageCause.CUSTOM, 7, true, true, false,
UtilEnt.getName(data.Player), GetName(),
data.Cow);
UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, data.Cow.getLocation().add(0, 1, 0), 1f, 1f, 1f, 0, 12, ViewDist.LONG, UtilServer.getPlayers());
data.Cow.getWorld().playSound(data.Cow.getLocation(), Sound.ZOMBIE_WOOD, 0.75f, 0.8f);
data.Cow.getWorld().playSound(data.Cow.getLocation(), Sound.COW_HURT, 1.5f, 0.75f);
}
}
}
} }
} }
@Override
public void Collide(LivingEntity target, Block block, ProjectileUser data)
{
if (target != null && target instanceof Player)
{
//Damage Event
Manager.GetDamage().NewDamageEvent(target, data.GetThrower(), null,
DamageCause.PROJECTILE, 6, true, true, false,
UtilEnt.getName(data.GetThrower()), GetName());
UtilParticle.PlayParticle(ParticleType.EXPLODE, target.getLocation().add(0, 1, 0), 1f, 1f, 1f, 0, 12, ViewDist.LONG, UtilServer.getPlayers());
}
Manager.GetProjectile().AddThrow(data.GetThrown(), data.GetThrower(), this,
-1, true, false, false, false,
null, 1f, 1f,
null, UpdateType.TICK, 2.5f);
}
@Override
public void Idle(ProjectileUser data)
{
}
@Override
public void Expire(ProjectileUser data)
{
}
@EventHandler @EventHandler
public void Knockback(CustomDamageEvent event) public void Knockback(CustomDamageEvent event)
{ {
if (event.GetReason() == null || !event.GetReason().contains(GetName())) if (event.GetReason() == null || !event.GetReason().contains(GetName()))
return; return;
event.AddKnockback(GetName(), 2); event.AddKnockback(GetName(), 1.5);
} }
} }

View File

@ -153,7 +153,7 @@ public class SnowFight extends TeamGame
{ {
if(IsOnIce(player)) if(IsOnIce(player))
{ {
Bukkit.getPluginManager().callEvent(new CustomDamageEvent(player, null, null, DamageCause.CUSTOM, 2.0D, false, true, true, "Ice", "Ice", false)); Bukkit.getPluginManager().callEvent(new CustomDamageEvent(player, null, null, DamageCause.CUSTOM, 2.0D, false, true, true, "Ice", "Ice", false, null));
} }
} }
@ -510,7 +510,7 @@ public class SnowFight extends TeamGame
if(player instanceof Player) if(player instanceof Player)
{ {
Player damagee = (Player) player; Player damagee = (Player) player;
Bukkit.getPluginManager().callEvent(new CustomDamageEvent(damagee, null, null, DamageCause.CUSTOM, damage, false, true, true, "Ice Meteoroid", "Ice Meteoroid", false)); Bukkit.getPluginManager().callEvent(new CustomDamageEvent(damagee, null, null, DamageCause.CUSTOM, damage, false, true, true, "Ice Meteoroid", "Ice Meteoroid", false, null));
} }
} }

View File

@ -524,9 +524,9 @@ public class GameLobbyManager implements Listener, IPacketHandler
{ {
//Positions //Positions
double space = 4; double space = 4;
double offset = (divide-1)*space/2d; double offset = (divide)*space/2d;
for (int i=0 ; i<divide ; i++) for (int i=0 ; i<=divide ; i++)
{ {
Kit kit = kits.get(i); Kit kit = kits.get(i);
@ -557,9 +557,9 @@ public class GameLobbyManager implements Listener, IPacketHandler
double space = 4; double space = 4;
double offset = (divide-1)*space/2d; double offset = (divide-1)*space/2d;
for (int i=divide ; i<kits.size() ; i++) for (int i=0 ; i<divide ; i++)
{ {
Kit kit = kits.get(i); Kit kit = kits.get(i + divide);
if (kit.GetAvailability() == KitAvailability.Null) if (kit.GetAvailability() == KitAvailability.Null)
continue; continue;