Merge branch 'master' of ssh://184.154.0.242:7999/min/Mineplex
This commit is contained in:
commit
5038edc46b
@ -33,7 +33,6 @@ import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
|
||||
|
||||
public class UtilEnt
|
||||
{
|
||||
private static int entityIdCount = 455000;
|
||||
|
||||
//Custom Entity Names
|
||||
private static HashMap<Entity, String> _nameMap = new HashMap<Entity, String>();
|
||||
@ -574,6 +573,30 @@ public class UtilEnt
|
||||
|
||||
public static int getNewEntityId()
|
||||
{
|
||||
return entityIdCount++;
|
||||
return getNewEntityId(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Use false if you don't want to modify the next entityid to be used.
|
||||
*
|
||||
* Normally you want true if you want a unique entityid to use.
|
||||
**/
|
||||
public static int getNewEntityId(boolean modifynumber)
|
||||
{
|
||||
try
|
||||
{
|
||||
Field field = net.minecraft.server.v1_7_R4.Entity.class.getDeclaredField("entityCount");
|
||||
field.setAccessible(true);
|
||||
int entityId = field.getInt(null);
|
||||
if (modifynumber) {
|
||||
field.set(null, entityId+1);
|
||||
}
|
||||
return entityId;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ex.printStackTrace();
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
@ -1,113 +0,0 @@
|
||||
package mineplex.core.itemstack;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class ComplexItemLayout
|
||||
{
|
||||
|
||||
private int _invSize = 0;
|
||||
private HashMap<Character, ArrayList<Integer>> placing = new HashMap<Character, ArrayList<Integer>>();
|
||||
|
||||
public ComplexItemLayout(String... strings)
|
||||
{
|
||||
_invSize = strings.length * 9;
|
||||
for (int row = 0; row < strings.length; row++)
|
||||
{
|
||||
final String string = strings[row];
|
||||
char[] cArray = string.toCharArray();
|
||||
int entries = 0;
|
||||
for (int i = 0; i < cArray.length; i++)
|
||||
{
|
||||
entries++;
|
||||
if (cArray[i] == '(')
|
||||
{
|
||||
for (; i < cArray.length; i++)
|
||||
{
|
||||
if (cArray[i] == ')')
|
||||
{
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!placing.containsKey(cArray[i]))
|
||||
{
|
||||
placing.put(cArray[i], new ArrayList<Integer>());
|
||||
}
|
||||
placing.get(cArray[i]).add((row * 9) + i);
|
||||
}
|
||||
if (i + 1 >= cArray.length)
|
||||
{
|
||||
throw new IllegalArgumentException("String '" + string + "' does not have a enclosing ) after the (");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!placing.containsKey(cArray[i]))
|
||||
{
|
||||
placing.put(cArray[i], new ArrayList<Integer>());
|
||||
}
|
||||
placing.get(cArray[i]).add((row * 9) + i);
|
||||
}
|
||||
}
|
||||
if (entries != 9)
|
||||
throw new IllegalArgumentException("String '" + string + "' does not 9 entries but instead has " + entries
|
||||
+ " entries");
|
||||
}
|
||||
}
|
||||
|
||||
public ItemStack[] generate(char toReplace, ArrayList<ItemStack> items, boolean replaceExistingItems)
|
||||
{
|
||||
return generate(toReplace, items.toArray(new ItemStack[0]), replaceExistingItems);
|
||||
}
|
||||
|
||||
public ItemStack[] generate(ItemStack[] existingItems, char toReplace, ItemStack[] items, boolean replaceExistingItems)
|
||||
{
|
||||
ArrayList<Integer> list = placing.get(toReplace);
|
||||
for (int i = 0; i < list.size(); i++)
|
||||
{
|
||||
if (i < items.length && i < existingItems.length)
|
||||
{
|
||||
ItemStack item = existingItems[list.get(i)];
|
||||
if (replaceExistingItems || item == null || item.getType() == Material.AIR)
|
||||
{
|
||||
existingItems[list.get(i)] = items[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
return existingItems;
|
||||
}
|
||||
|
||||
public ItemStack[] generate(char toReplace, ItemStack[] items, boolean replaceExistingItems)
|
||||
{
|
||||
return generate(new ItemStack[this._invSize], toReplace, items, replaceExistingItems);
|
||||
}
|
||||
|
||||
public ItemStack[] generate(ItemStack[] existingItems, char toReplace, ItemStack item, boolean replaceExistingItems)
|
||||
{
|
||||
ArrayList<Integer> list = placing.get(toReplace);
|
||||
for (int i = 0; i < list.size(); i++)
|
||||
{
|
||||
if (i < existingItems.length)
|
||||
{
|
||||
ItemStack checkItem = existingItems[list.get(i)];
|
||||
if (replaceExistingItems || checkItem == null || checkItem.getType() == Material.AIR)
|
||||
{
|
||||
existingItems[list.get(i)] = item;
|
||||
}
|
||||
}
|
||||
}
|
||||
return existingItems;
|
||||
}
|
||||
|
||||
public ItemStack[] generate(char toReplace, ItemStack item, boolean replaceExistingItems)
|
||||
{
|
||||
return generate(new ItemStack[this._invSize], toReplace, item, replaceExistingItems);
|
||||
}
|
||||
|
||||
}
|
@ -1,10 +1,6 @@
|
||||
package mineplex.minecraft.game.classcombat.Skill.Ranger;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Projectile;
|
||||
import org.bukkit.event.*;
|
||||
@ -13,92 +9,75 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
|
||||
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.minecraft.game.classcombat.Skill.Skill;
|
||||
import mineplex.minecraft.game.classcombat.Skill.SkillFactory;
|
||||
import org.bukkit.event.player.*;
|
||||
|
||||
import org.bukkit.metadata.FixedMetadataValue;
|
||||
|
||||
public class Longshot extends Skill
|
||||
{
|
||||
private HashMap<Entity, Location> _arrows = new HashMap<Entity, Location>();
|
||||
|
||||
public Longshot(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels)
|
||||
{
|
||||
super(skills, name, classType, skillType, cost, levels);
|
||||
public Longshot(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int levels)
|
||||
{
|
||||
super(skills, name, classType, skillType, cost, levels);
|
||||
|
||||
SetDesc(new String[]
|
||||
{
|
||||
"Arrows do an additional 1 damage",
|
||||
"for every #4#-0.5 Blocks they travelled,",
|
||||
"however, their base damage is",
|
||||
"reduced by 3.",
|
||||
"",
|
||||
"Maximum of #5#5 additional damage."
|
||||
});
|
||||
}
|
||||
SetDesc(new String[]
|
||||
{
|
||||
"Arrows do an additional 1 damage", "for every #4#-0.5 Blocks they travelled,",
|
||||
"however, their base damage is", "reduced by 3.", "", "Maximum of #5#5 additional damage."
|
||||
});
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void ShootBow(EntityShootBowEvent event)
|
||||
{
|
||||
if (!(event.getEntity() instanceof Player))
|
||||
return;
|
||||
|
||||
int level = getLevel((Player)event.getEntity());
|
||||
if (level == 0) return;
|
||||
|
||||
//Save
|
||||
_arrows.put(event.getProjectile(), event.getProjectile().getLocation());
|
||||
}
|
||||
@EventHandler
|
||||
public void ShootBow(EntityShootBowEvent event)
|
||||
{
|
||||
if (!(event.getEntity() instanceof Player))
|
||||
return;
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void Damage(CustomDamageEvent event)
|
||||
{
|
||||
if (event.IsCancelled())
|
||||
return;
|
||||
|
||||
if (event.GetCause() != DamageCause.PROJECTILE)
|
||||
return;
|
||||
int level = getLevel((Player) event.getEntity());
|
||||
if (level == 0)
|
||||
return;
|
||||
|
||||
Projectile projectile = event.GetProjectile();
|
||||
if (projectile == null) return;
|
||||
// Save
|
||||
event.getProjectile().setMetadata("ShotFrom",
|
||||
new FixedMetadataValue(this.Factory.GetPlugin(), event.getProjectile().getLocation()));
|
||||
}
|
||||
|
||||
if (!_arrows.containsKey(projectile))
|
||||
return;
|
||||
|
||||
Player damager = event.GetDamagerPlayer(true);
|
||||
if (damager == null) return;
|
||||
|
||||
int level = getLevel(damager);
|
||||
|
||||
Location loc = _arrows.remove(projectile);
|
||||
double length = UtilMath.offset(loc, projectile.getLocation());
|
||||
|
||||
//Damage
|
||||
double damage = Math.min(5 + 5 * level, (length / (4 - 0.5 * level)) - 3);
|
||||
|
||||
event.AddMod(damager.getName(), GetName(), damage, damage > 0);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void Clean(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.SEC)
|
||||
return;
|
||||
|
||||
for (Iterator<Entity> arrowIterator = _arrows.keySet().iterator(); arrowIterator.hasNext();)
|
||||
{
|
||||
Entity arrow = arrowIterator.next();
|
||||
|
||||
if (arrow.isDead() || !arrow.isValid())
|
||||
arrowIterator.remove();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Reset(Player player)
|
||||
{
|
||||
|
||||
}
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void Damage(CustomDamageEvent event)
|
||||
{
|
||||
if (event.IsCancelled())
|
||||
return;
|
||||
|
||||
if (event.GetCause() != DamageCause.PROJECTILE)
|
||||
return;
|
||||
|
||||
Projectile projectile = event.GetProjectile();
|
||||
if (projectile == null)
|
||||
return;
|
||||
|
||||
if (!projectile.hasMetadata("ShotFrom"))
|
||||
return;
|
||||
|
||||
Player damager = event.GetDamagerPlayer(true);
|
||||
if (damager == null)
|
||||
return;
|
||||
|
||||
int level = getLevel(damager);
|
||||
|
||||
Location loc = (Location) projectile.getMetadata("ShotFrom").get(0).value();
|
||||
double length = UtilMath.offset(loc, projectile.getLocation());
|
||||
|
||||
// Damage
|
||||
double damage = Math.min(5 + 5 * level, (length / (4 - 0.5 * level)) - 3);
|
||||
|
||||
event.AddMod(damager.getName(), GetName(), damage, damage > 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Reset(Player player)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -311,7 +311,8 @@ public class SkillPage extends ShopPageBase<ClassShopManager, ClassCombatShop>
|
||||
itemLore.add("");
|
||||
|
||||
itemLore.add(C.cYellow + "Item Token Cost: " + C.cWhite + item.getTokenCost());
|
||||
itemLore.add(C.cYellow + "Item Tokens Remaining: " + C.cWhite + clientClass.GetSavingCustomBuild().ItemTokens + "/" + CustomBuildToken.MAX_ITEM_TOKENS);
|
||||
itemLore.add(C.cYellow + "Item Tokens Remaining: " + C.cWhite + clientClass.GetSavingCustomBuild().ItemTokens + "/" +
|
||||
(CustomBuildToken.MAX_ITEM_TOKENS - (_pvpClass.GetType() == ClassType.Assassin || _pvpClass.GetType() == ClassType.Ranger ? 0 : 2)));
|
||||
itemLore.add("");
|
||||
|
||||
if (clientClass.GetSavingCustomBuild().ItemTokens >= item.getTokenCost())
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -4,6 +4,7 @@ import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.MapUtil;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
@ -13,6 +14,15 @@ import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import nautilus.game.arcade.game.games.hideseek.HideSeek;
|
||||
import nautilus.game.arcade.game.games.hideseek.kits.KitHiderQuick;
|
||||
import net.minecraft.server.v1_7_R4.DataWatcher;
|
||||
import net.minecraft.server.v1_7_R4.EntityPlayer;
|
||||
import net.minecraft.server.v1_7_R4.Packet;
|
||||
import net.minecraft.server.v1_7_R4.PacketPlayOutAttachEntity;
|
||||
import net.minecraft.server.v1_7_R4.PacketPlayOutEntityDestroy;
|
||||
import net.minecraft.server.v1_7_R4.PacketPlayOutEntityTeleport;
|
||||
import net.minecraft.server.v1_7_R4.PacketPlayOutRelEntityMove;
|
||||
import net.minecraft.server.v1_7_R4.PacketPlayOutSpawnEntity;
|
||||
import net.minecraft.server.v1_7_R4.PacketPlayOutSpawnEntityLiving;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Effect;
|
||||
@ -23,234 +33,321 @@ import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftFallingSand;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.FallingBlock;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class BlockForm extends Form
|
||||
{
|
||||
private Material _mat;
|
||||
private Material _mat;
|
||||
|
||||
private Block _block;
|
||||
private Block _block;
|
||||
private int _entityId;
|
||||
|
||||
private Location _loc;
|
||||
private Location _loc;
|
||||
private int _selfEntityId1;
|
||||
private int _selfEntityId2;
|
||||
private Location _lastSaw;
|
||||
private Vector _sawDiff = new Vector();
|
||||
|
||||
public BlockForm(HideSeek host, Player player, Material mat)
|
||||
{
|
||||
super(host, player);
|
||||
public BlockForm(HideSeek host, Player player, Material mat)
|
||||
{
|
||||
super(host, player);
|
||||
|
||||
_mat = mat;
|
||||
_loc = player.getLocation();
|
||||
|
||||
System.out.println("Block Form: " + _mat + " " + _mat.getId());
|
||||
_mat = mat;
|
||||
_loc = player.getLocation();
|
||||
_selfEntityId1 = UtilEnt.getNewEntityId();
|
||||
_selfEntityId2 = UtilEnt.getNewEntityId();
|
||||
System.out.println("Block Form: " + _mat + " " + _mat.getId());
|
||||
}
|
||||
|
||||
Apply();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Apply()
|
||||
{
|
||||
//Remove Old
|
||||
if (Player.getPassenger() != null)
|
||||
{
|
||||
Recharge.Instance.useForce(Player, "PassengerChange", 100);
|
||||
@Override
|
||||
public void Apply()
|
||||
{
|
||||
// Remove Old
|
||||
if (Player.getPassenger() != null)
|
||||
{
|
||||
Recharge.Instance.useForce(Player, "PassengerChange", 100);
|
||||
|
||||
Player.getPassenger().remove();
|
||||
Player.eject();
|
||||
}
|
||||
Player.getPassenger().remove();
|
||||
Player.eject();
|
||||
}
|
||||
|
||||
((CraftEntity)Player).getHandle().getDataWatcher().watch(0, Byte.valueOf((byte) 32));
|
||||
EntityPlayer player = ((CraftPlayer) Player).getHandle();
|
||||
player.getDataWatcher().watch(0, Byte.valueOf((byte) 32));
|
||||
|
||||
//Player > Chicken
|
||||
DisguiseChicken disguise = new DisguiseChicken(Player);
|
||||
disguise.setBaby();
|
||||
disguise.setSoundDisguise(new DisguiseCat(Player));
|
||||
Host.Manager.GetDisguise().disguise(disguise);
|
||||
// Player > Chicken
|
||||
DisguiseChicken disguise = new DisguiseChicken(Player);
|
||||
disguise.setBaby();
|
||||
disguise.setSoundDisguise(new DisguiseCat(Player));
|
||||
Host.Manager.GetDisguise().disguise(disguise);
|
||||
|
||||
//Apply Falling Block
|
||||
FallingBlockCheck();
|
||||
// Apply Falling Block
|
||||
FallingBlockCheck();
|
||||
|
||||
//Inform
|
||||
String blockName = F.elem(ItemStackFactory.Instance.GetName(_mat, (byte)0, false));
|
||||
if (!blockName.contains("Block"))
|
||||
UtilPlayer.message(Player, F.main("Game", C.cWhite + "You are now a " + F.elem(ItemStackFactory.Instance.GetName(_mat, (byte)0, false) + " Block") + "!"));
|
||||
else
|
||||
UtilPlayer.message(Player, F.main("Game", C.cWhite + "You are now a " + F.elem(ItemStackFactory.Instance.GetName(_mat, (byte)0, false)) + "!"));
|
||||
PacketPlayOutSpawnEntityLiving packet1 = new PacketPlayOutSpawnEntityLiving();
|
||||
packet1.a = _selfEntityId1;
|
||||
packet1.b = EntityType.SILVERFISH.getTypeId();
|
||||
packet1.c = (int) Math.floor(_lastSaw.getX() * 32);
|
||||
packet1.d = (int) Math.floor(_lastSaw.getY() * 32);
|
||||
packet1.e = (int) Math.floor(_lastSaw.getZ() * 32);
|
||||
DataWatcher watcher = new DataWatcher(null);
|
||||
watcher.a(0, (byte) 32);
|
||||
watcher.a(1, 0);
|
||||
packet1.l = watcher;
|
||||
player.playerConnection.sendPacket(packet1);
|
||||
|
||||
//Give Item
|
||||
Player.getInventory().setItem(8, new ItemStack(Host.GetItemEquivilent(_mat)));
|
||||
UtilInv.Update(Player);
|
||||
PacketPlayOutSpawnEntity packet2 = new PacketPlayOutSpawnEntity(player, 70, _mat.getId());
|
||||
packet2.a = _selfEntityId2;
|
||||
player.playerConnection.sendPacket(packet2);
|
||||
|
||||
//Sound
|
||||
Player.playSound(Player.getLocation(), Sound.ZOMBIE_UNFECT, 2f, 2f);
|
||||
}
|
||||
PacketPlayOutAttachEntity packet3 = new PacketPlayOutAttachEntity();
|
||||
|
||||
@Override
|
||||
public void Remove()
|
||||
{
|
||||
SolidifyRemove();
|
||||
packet3.b = _selfEntityId2;
|
||||
packet3.c = _selfEntityId1;
|
||||
player.playerConnection.sendPacket(packet3);
|
||||
|
||||
Host.Manager.GetDisguise().undisguise(Player);
|
||||
// Inform
|
||||
String blockName = F.elem(ItemStackFactory.Instance.GetName(_mat, (byte) 0, false));
|
||||
if (!blockName.contains("Block"))
|
||||
UtilPlayer.message(
|
||||
Player,
|
||||
F.main("Game",
|
||||
C.cWhite + "You are now a "
|
||||
+ F.elem(ItemStackFactory.Instance.GetName(_mat, (byte) 0, false) + " Block") + "!"));
|
||||
else
|
||||
UtilPlayer.message(
|
||||
Player,
|
||||
F.main("Game", C.cWhite + "You are now a " + F.elem(ItemStackFactory.Instance.GetName(_mat, (byte) 0, false))
|
||||
+ "!"));
|
||||
|
||||
//Remove FB
|
||||
if (Player.getPassenger() != null)
|
||||
{
|
||||
Recharge.Instance.useForce(Player, "PassengerChange", 100);
|
||||
// Give Item
|
||||
Player.getInventory().setItem(8, new ItemStack(Host.GetItemEquivilent(_mat)));
|
||||
UtilInv.Update(Player);
|
||||
|
||||
Player.getPassenger().remove();
|
||||
Player.eject();
|
||||
}
|
||||
// Sound
|
||||
Player.playSound(Player.getLocation(), Sound.ZOMBIE_UNFECT, 2f, 2f);
|
||||
}
|
||||
|
||||
((CraftEntity)Player).getHandle().getDataWatcher().watch(0, Byte.valueOf((byte) 0));
|
||||
}
|
||||
@Override
|
||||
public void Remove()
|
||||
{
|
||||
SolidifyRemove();
|
||||
|
||||
public void SolidifyUpdate()
|
||||
{
|
||||
if (!Player.isSprinting())
|
||||
((CraftEntity)Player).getHandle().getDataWatcher().watch(0, Byte.valueOf((byte) 32));
|
||||
|
||||
//Not a Block
|
||||
if (_block == null)
|
||||
{
|
||||
//Moved
|
||||
if (!_loc.getBlock().equals(Player.getLocation().getBlock()))
|
||||
{
|
||||
Player.setExp(0);
|
||||
_loc = Player.getLocation();
|
||||
}
|
||||
//Unmoved
|
||||
else
|
||||
{
|
||||
double hideBoost = 0.025;
|
||||
if (Host.GetKit(Player) instanceof KitHiderQuick)
|
||||
hideBoost = 0.1;
|
||||
Host.Manager.GetDisguise().undisguise(Player);
|
||||
|
||||
Player.setExp((float) Math.min(0.999f, Player.getExp() + hideBoost));
|
||||
// Remove FB
|
||||
if (Player.getPassenger() != null)
|
||||
{
|
||||
Recharge.Instance.useForce(Player, "PassengerChange", 100);
|
||||
|
||||
//Set Block
|
||||
if (Player.getExp() >= 0.999f)
|
||||
{
|
||||
Block block = Player.getLocation().getBlock();
|
||||
Player.getPassenger().remove();
|
||||
Player.eject();
|
||||
|
||||
//Not Able
|
||||
if (block.getType() != Material.AIR || !UtilBlock.solid(block.getRelative(BlockFace.DOWN)))
|
||||
{
|
||||
UtilPlayer.message(Player, F.main("Game", "You cannot become a Solid Block here."));
|
||||
Player.setExp(0f);
|
||||
return;
|
||||
}
|
||||
((CraftPlayer) Player).getHandle().playerConnection.sendPacket(new PacketPlayOutEntityDestroy(new int[]
|
||||
{
|
||||
_selfEntityId1, _selfEntityId2
|
||||
}));
|
||||
}
|
||||
|
||||
Bukkit.getPluginManager().callEvent(new HideSeek.PlayerSolidifyEvent(Player));
|
||||
((CraftEntity) Player).getHandle().getDataWatcher().watch(0, Byte.valueOf((byte) 0));
|
||||
}
|
||||
|
||||
//Set Block
|
||||
_block = block;
|
||||
public void SolidifyUpdate()
|
||||
{
|
||||
if (!Player.isSprinting())
|
||||
((CraftEntity) Player).getHandle().getDataWatcher().watch(0, Byte.valueOf((byte) 32));
|
||||
|
||||
//Effect
|
||||
Player.playEffect(Player.getLocation(), Effect.STEP_SOUND, _mat);
|
||||
//block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, _mat);
|
||||
// Not a Block
|
||||
if (_block == null)
|
||||
{
|
||||
// Moved
|
||||
if (!_loc.getBlock().equals(Player.getLocation().getBlock()))
|
||||
{
|
||||
Player.setExp(0);
|
||||
_loc = Player.getLocation();
|
||||
}
|
||||
// Unmoved
|
||||
else
|
||||
{
|
||||
double hideBoost = 0.025;
|
||||
if (Host.GetKit(Player) instanceof KitHiderQuick)
|
||||
hideBoost = 0.1;
|
||||
|
||||
//Display
|
||||
SolidifyVisual();
|
||||
Player.setExp((float) Math.min(0.999f, Player.getExp() + hideBoost));
|
||||
|
||||
//Invisible
|
||||
//Host.Manager.GetCondition().Factory().Cloak("Disguised as Block", Player, Player, 60000, false, false);
|
||||
// Set Block
|
||||
if (Player.getExp() >= 0.999f)
|
||||
{
|
||||
Block block = Player.getLocation().getBlock();
|
||||
|
||||
//Sound
|
||||
Player.playSound(Player.getLocation(), Sound.NOTE_PLING, 1f, 2f);
|
||||
}
|
||||
}
|
||||
}
|
||||
//Is a Block
|
||||
else
|
||||
{
|
||||
//Moved
|
||||
if (!_loc.getBlock().equals(Player.getLocation().getBlock()))
|
||||
{
|
||||
SolidifyRemove();
|
||||
}
|
||||
//Send Packets
|
||||
else
|
||||
{
|
||||
SolidifyVisual();
|
||||
}
|
||||
}
|
||||
}
|
||||
// Not Able
|
||||
if (block.getType() != Material.AIR || !UtilBlock.solid(block.getRelative(BlockFace.DOWN)))
|
||||
{
|
||||
UtilPlayer.message(Player, F.main("Game", "You cannot become a Solid Block here."));
|
||||
Player.setExp(0f);
|
||||
return;
|
||||
}
|
||||
|
||||
public void SolidifyRemove()
|
||||
{
|
||||
if (_block != null)
|
||||
{
|
||||
MapUtil.QuickChangeBlockAt(_block.getLocation(), 0, (byte)0);
|
||||
_block = null;
|
||||
}
|
||||
Bukkit.getPluginManager().callEvent(new HideSeek.PlayerSolidifyEvent(Player));
|
||||
|
||||
Player.setExp(0f);
|
||||
// Set Block
|
||||
_block = block;
|
||||
|
||||
//Host.Manager.GetCondition().EndCondition(Player, null, "Disguised as Block");
|
||||
// Effect
|
||||
Player.playEffect(Player.getLocation(), Effect.STEP_SOUND, _mat);
|
||||
// block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, _mat);
|
||||
|
||||
//Inform
|
||||
Player.playSound(Player.getLocation(), Sound.NOTE_PLING, 1f, 0.5f);
|
||||
// Display
|
||||
SolidifyVisual();
|
||||
|
||||
FallingBlockCheck();
|
||||
}
|
||||
// Invisible
|
||||
// Host.Manager.GetCondition().Factory().Cloak("Disguised as Block", Player, Player, 60000, false, false);
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public void SolidifyVisual()
|
||||
{
|
||||
if (_block == null)
|
||||
return;
|
||||
// Sound
|
||||
Player.playSound(Player.getLocation(), Sound.NOTE_PLING, 1f, 2f);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Is a Block
|
||||
else
|
||||
{
|
||||
// Moved
|
||||
if (!_loc.getBlock().equals(Player.getLocation().getBlock()))
|
||||
{
|
||||
SolidifyRemove();
|
||||
}
|
||||
// Send Packets
|
||||
else
|
||||
{
|
||||
SolidifyVisual();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Remove Old
|
||||
if (Player.getPassenger() != null)
|
||||
{
|
||||
Recharge.Instance.useForce(Player, "PassengerChange", 100);
|
||||
public void SolidifyRemove()
|
||||
{
|
||||
if (_block != null)
|
||||
{
|
||||
MapUtil.QuickChangeBlockAt(_block.getLocation(), 0, (byte) 0);
|
||||
_block = null;
|
||||
}
|
||||
|
||||
Player.getPassenger().remove();
|
||||
Player.eject();
|
||||
}
|
||||
Player.setExp(0f);
|
||||
|
||||
//Others
|
||||
for (Player other : UtilServer.getPlayers())
|
||||
other.sendBlockChange(Player.getLocation(), _mat, (byte)0);
|
||||
// Host.Manager.GetCondition().EndCondition(Player, null, "Disguised as Block");
|
||||
|
||||
//Self
|
||||
Player.sendBlockChange(Player.getLocation(), 36, (byte)0);
|
||||
// Inform
|
||||
Player.playSound(Player.getLocation(), Sound.NOTE_PLING, 1f, 0.5f);
|
||||
|
||||
FallingBlockCheck();
|
||||
}
|
||||
FallingBlockCheck();
|
||||
}
|
||||
|
||||
public void FallingBlockCheck()
|
||||
{
|
||||
//Block Form (Hide Falling)
|
||||
if (_block != null)
|
||||
return;
|
||||
@SuppressWarnings("deprecation")
|
||||
public void SolidifyVisual()
|
||||
{
|
||||
if (_block == null)
|
||||
return;
|
||||
|
||||
//Recreate Falling
|
||||
if (Player.getPassenger() == null || !Player.getPassenger().isValid())
|
||||
{
|
||||
if (!Recharge.Instance.use(Player, "PassengerChange", 100, false, false))
|
||||
return;
|
||||
// Remove Old
|
||||
if (Player.getPassenger() != null)
|
||||
{
|
||||
Recharge.Instance.useForce(Player, "PassengerChange", 100);
|
||||
|
||||
//Falling Block
|
||||
FallingBlock block = Player.getWorld().spawnFallingBlock(Player.getEyeLocation(), _mat, (byte)0);
|
||||
|
||||
//No Arrow Collision
|
||||
((CraftFallingSand)block).getHandle().spectating = true;
|
||||
|
||||
Player.setPassenger(block);
|
||||
}
|
||||
Player.getPassenger().remove();
|
||||
Player.eject();
|
||||
}
|
||||
|
||||
//Ensure Falling doesnt Despawn
|
||||
else
|
||||
{
|
||||
((CraftFallingSand)Player.getPassenger()).getHandle().ticksLived = 1;
|
||||
Player.getPassenger().setTicksLived(1);
|
||||
}
|
||||
// Others
|
||||
for (Player other : UtilServer.getPlayers())
|
||||
if (!other.equals(Player))
|
||||
other.sendBlockChange(Player.getLocation(), _mat, (byte) 0);
|
||||
|
||||
}
|
||||
// Self
|
||||
Player.sendBlockChange(Player.getLocation(), 36, (byte) 0);
|
||||
|
||||
public Block GetBlock()
|
||||
{
|
||||
return _block;
|
||||
}
|
||||
FallingBlockCheck();
|
||||
}
|
||||
|
||||
public void FallingBlockCheck()
|
||||
{
|
||||
|
||||
EntityPlayer player = ((CraftPlayer) Player).getHandle();
|
||||
|
||||
// Block Form (Hide Falling)
|
||||
if (_block == null)
|
||||
{
|
||||
// Recreate Falling
|
||||
if (Player.getPassenger() == null || !Player.getPassenger().isValid())
|
||||
{
|
||||
if (Recharge.Instance.use(Player, "PassengerChange", 100, false, false))
|
||||
{
|
||||
_entityId = UtilEnt.getNewEntityId(false);
|
||||
// Falling Block
|
||||
FallingBlock block = Player.getWorld().spawnFallingBlock(Player.getEyeLocation(), _mat, (byte) 0);
|
||||
|
||||
// No Arrow Collision
|
||||
((CraftFallingSand) block).getHandle().spectating = true;
|
||||
|
||||
Player.setPassenger(block);
|
||||
}
|
||||
}
|
||||
|
||||
// Ensure Falling doesnt Despawn
|
||||
else
|
||||
{
|
||||
((CraftFallingSand) Player.getPassenger()).getHandle().ticksLived = 1;
|
||||
Player.getPassenger().setTicksLived(1);
|
||||
}
|
||||
}
|
||||
|
||||
if (_lastSaw == null || _lastSaw.getWorld() != Player.getWorld())
|
||||
{
|
||||
_lastSaw = Player.getLocation();
|
||||
}
|
||||
this._sawDiff.add(Player.getLocation().subtract(_lastSaw).toVector());
|
||||
_lastSaw = Player.getLocation();
|
||||
|
||||
int x = (int) Math.floor(_sawDiff.getX() * 32);
|
||||
int y = (int) Math.floor(_sawDiff.getY() * 32);
|
||||
int z = (int) Math.floor(_sawDiff.getZ() * 32);
|
||||
if (x != 0 || y != 0 || z != 0)
|
||||
{
|
||||
Packet packet;
|
||||
if (x >= -128 && x <= 127 && y >= -128 && y <= 127 && z >= -128 && z <= 127)
|
||||
{
|
||||
_sawDiff.subtract(new Vector(x / 32D, y / 32D, z / 32D));
|
||||
PacketPlayOutRelEntityMove relMove = new PacketPlayOutRelEntityMove();
|
||||
relMove.a = this._selfEntityId1;
|
||||
relMove.b = (byte) x;
|
||||
relMove.c = (byte) y;
|
||||
relMove.d = (byte) z;
|
||||
packet = relMove;
|
||||
}
|
||||
else
|
||||
{
|
||||
_sawDiff = new Vector();
|
||||
PacketPlayOutEntityTeleport teleportPacket = new PacketPlayOutEntityTeleport();
|
||||
teleportPacket.a = _selfEntityId1;
|
||||
teleportPacket.b = (int) Math.floor(32 * _lastSaw.getX());
|
||||
teleportPacket.c = (int) Math.floor(32 * _lastSaw.getY());
|
||||
teleportPacket.d = (int) Math.floor(32 * _lastSaw.getZ());
|
||||
packet = teleportPacket;
|
||||
}
|
||||
player.playerConnection.sendPacket(packet);
|
||||
}
|
||||
}
|
||||
|
||||
public Block GetBlock()
|
||||
{
|
||||
return _block;
|
||||
}
|
||||
|
||||
public int getEntityId()
|
||||
{
|
||||
return _entityId;
|
||||
}
|
||||
}
|
||||
|
@ -3,11 +3,8 @@ package nautilus.game.arcade.game.games.searchanddestroy;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.game.games.searchanddestroy.kits.bow.KitBow;
|
||||
import nautilus.game.arcade.game.games.searchanddestroy.kits.bow.KitPinner;
|
||||
import nautilus.game.arcade.game.games.searchanddestroy.kits.bow.KitPunch;
|
||||
import nautilus.game.arcade.game.games.searchanddestroy.kits.bow.KitSniper;
|
||||
import nautilus.game.arcade.game.games.searchanddestroy.kits.bow.KitStitcher;
|
||||
import nautilus.game.arcade.game.games.searchanddestroy.kits.bow.*;
|
||||
import nautilus.game.arcade.game.games.searchanddestroy.kits.trooper.*;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
|
||||
public class KitManager
|
||||
@ -36,7 +33,7 @@ public class KitManager
|
||||
public KitManager(SearchAndDestroy search)
|
||||
{
|
||||
ArcadeManager man = search.getArcadeManager();
|
||||
{
|
||||
{ // Register bow kits
|
||||
ArrayList<UpgradeKit> children1 = new ArrayList<UpgradeKit>();
|
||||
ArrayList<UpgradeKit> children2 = new ArrayList<UpgradeKit>();
|
||||
ArrayList<UpgradeKit> children3 = new ArrayList<UpgradeKit>();
|
||||
@ -49,11 +46,11 @@ public class KitManager
|
||||
_kits.add(bow3);
|
||||
UpgradeKit bow4 = new UpgradeKit(bow2, new KitSniper(man), new ArrayList<UpgradeKit>(), 46, 29, 37);
|
||||
_kits.add(bow4);
|
||||
UpgradeKit bow5 = new UpgradeKit(bow2, new KitBow(man), new ArrayList<UpgradeKit>(), 48, 29, 39);
|
||||
UpgradeKit bow5 = new UpgradeKit(bow2, new KitSharpshooter(man), new ArrayList<UpgradeKit>(), 48, 29, 39);
|
||||
_kits.add(bow5);
|
||||
UpgradeKit bow6 = new UpgradeKit(bow3, new KitPinner(man), new ArrayList<UpgradeKit>(), 50, 33, 41);
|
||||
_kits.add(bow6);
|
||||
UpgradeKit bow7 = new UpgradeKit(bow3, new KitBow(man), new ArrayList<UpgradeKit>(), 52, 33, 43);
|
||||
UpgradeKit bow7 = new UpgradeKit(bow3, new KitThunderstorm(man), new ArrayList<UpgradeKit>(), 52, 33, 43);
|
||||
_kits.add(bow7);
|
||||
children1.add(bow2);
|
||||
children1.add(bow3);
|
||||
@ -64,6 +61,34 @@ public class KitManager
|
||||
|
||||
}
|
||||
|
||||
{ // Register sword kits
|
||||
ArrayList<UpgradeKit> children1 = new ArrayList<UpgradeKit>();
|
||||
ArrayList<UpgradeKit> children2 = new ArrayList<UpgradeKit>();
|
||||
ArrayList<UpgradeKit> children3 = new ArrayList<UpgradeKit>();
|
||||
|
||||
UpgradeKit sword1 = new UpgradeKit(null, new KitTrooper(man), children1, 4);
|
||||
_kits.add(sword1);
|
||||
UpgradeKit sword2 = new UpgradeKit(sword1, new KitTrooper(man), children2, 20, 12);
|
||||
_kits.add(sword2);
|
||||
UpgradeKit sword3 = new UpgradeKit(sword1, new KitTrooper(man), children3, 24, 14);
|
||||
_kits.add(sword3);
|
||||
UpgradeKit sword4 = new UpgradeKit(sword2, new KitTrooper(man), new ArrayList<UpgradeKit>(), 46, 29, 37);
|
||||
_kits.add(sword4);
|
||||
UpgradeKit sword5 = new UpgradeKit(sword2, new KitTrooper(man), new ArrayList<UpgradeKit>(), 48, 29, 39);
|
||||
_kits.add(sword5);
|
||||
UpgradeKit sword6 = new UpgradeKit(sword3, new KitTrooper(man), new ArrayList<UpgradeKit>(), 50, 33, 41);
|
||||
_kits.add(sword6);
|
||||
UpgradeKit sword7 = new UpgradeKit(sword3, new KitTrooper(man), new ArrayList<UpgradeKit>(), 52, 33, 43);
|
||||
_kits.add(sword7);
|
||||
children1.add(sword2);
|
||||
children1.add(sword3);
|
||||
children2.add(sword4);
|
||||
children2.add(sword5);
|
||||
children3.add(sword6);
|
||||
children3.add(sword7);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public Kit[] get_kits()
|
||||
|
@ -1,30 +1,19 @@
|
||||
package nautilus.game.arcade.game.games.searchanddestroy.kits.bow;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.game.games.castlesiege.kits.KitHuman;
|
||||
import nautilus.game.arcade.kit.KitAvailability;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
import nautilus.game.arcade.kit.perks.PerkPinned;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
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.inventory.PlayerInventory;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class KitPinner extends KitHuman
|
||||
{
|
||||
@ -33,56 +22,11 @@ public class KitPinner extends KitHuman
|
||||
{
|
||||
super(manager, "Pinner", KitAvailability.Hide, new String[]
|
||||
{
|
||||
"Your arrows have been enchanted with gravity magic.", "As such, the player will find it hard to lift",
|
||||
"their body and move around for a few seconds."
|
||||
}, new Perk[0], EntityType.SKELETON, new ItemStack(Material.OBSIDIAN));
|
||||
}
|
||||
|
||||
private NautHashMap<LivingEntity, Integer> _secondsPinned = new NautHashMap<LivingEntity, Integer>();
|
||||
|
||||
@EventHandler
|
||||
public void onSecond(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.FASTER)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Iterator<LivingEntity> itel = _secondsPinned.keySet().iterator();
|
||||
while (itel.hasNext())
|
||||
{
|
||||
LivingEntity entity = itel.next();
|
||||
if (entity.isDead() || (entity instanceof Player && !Manager.IsAlive((Player) entity)))
|
||||
"Your arrows enchanted with gravity magic.", "Victims find it hard to lift", "Their bodies are sluggish"
|
||||
}, new Perk[]
|
||||
{
|
||||
itel.remove();
|
||||
continue;
|
||||
}
|
||||
entity.setVelocity(entity.getVelocity().add(new Vector(0, -1, 0)));
|
||||
if (_secondsPinned.get(entity) <= 1)
|
||||
{
|
||||
itel.remove();
|
||||
}
|
||||
else
|
||||
{
|
||||
_secondsPinned.put(entity, _secondsPinned.get(entity) - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onDamage(CustomDamageEvent event)
|
||||
{
|
||||
if (event.GetCause() == DamageCause.PROJECTILE)
|
||||
{
|
||||
Player player = event.GetDamagerPlayer(true);
|
||||
if (player != null && this.HasKit(player))
|
||||
{
|
||||
LivingEntity entity = event.GetDamageeEntity();
|
||||
entity.setVelocity(entity.getVelocity().add(new Vector(0, -1, 0)));
|
||||
entity.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 40, 1), true);
|
||||
_secondsPinned.put(entity, 8);
|
||||
}
|
||||
}
|
||||
new PerkPinned()
|
||||
}, EntityType.SKELETON, new ItemStack(Material.OBSIDIAN));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -6,6 +6,7 @@ import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.game.games.castlesiege.kits.KitHuman;
|
||||
import nautilus.game.arcade.kit.KitAvailability;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
import nautilus.game.arcade.kit.perks.PerkKnockbackArrow;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
@ -26,20 +27,10 @@ public class KitPunch extends KitHuman
|
||||
{
|
||||
"Your bow is super stretchy", "Your arrows are huge", "What does this mean?",
|
||||
"Your arrows will knock em flying!"
|
||||
}, new Perk[0], EntityType.SKELETON, new ItemStack(Material.FENCE));
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onDamage(CustomDamageEvent event)
|
||||
{
|
||||
if (event.GetCause() == DamageCause.PROJECTILE)
|
||||
{
|
||||
Player player = event.GetDamagerPlayer(true);
|
||||
if (player != null && this.HasKit(player))
|
||||
}, new Perk[]
|
||||
{
|
||||
event.AddKnockback("Punch", 2.5D);
|
||||
}
|
||||
}
|
||||
new PerkKnockbackArrow(2.5D)
|
||||
}, EntityType.SKELETON, new ItemStack(Material.FENCE));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -0,0 +1,41 @@
|
||||
package nautilus.game.arcade.game.games.searchanddestroy.kits.bow;
|
||||
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.game.games.castlesiege.kits.KitHuman;
|
||||
import nautilus.game.arcade.kit.KitAvailability;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
import nautilus.game.arcade.kit.perks.PerkSharpshooter;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.PlayerInventory;
|
||||
|
||||
public class KitSharpshooter extends KitHuman
|
||||
{
|
||||
public KitSharpshooter(ArcadeManager manager)
|
||||
{
|
||||
super(manager, "Sharpshooter", KitAvailability.Hide, new String[]
|
||||
{
|
||||
"Each consecutive arrow hit deals an additional 2 damage.",
|
||||
"Max of +6. Missing an arrow resets the count to 0."
|
||||
}, new Perk[]
|
||||
{
|
||||
new PerkSharpshooter()
|
||||
}, EntityType.SKELETON, new ItemStack(Material.FLINT));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void GiveItems(Player player)
|
||||
{
|
||||
PlayerInventory inv = player.getInventory();
|
||||
inv.addItem(new ItemBuilder(Material.BLAZE_POWDER).setTitle(ChatColor.GOLD + "Fuse").build());
|
||||
inv.addItem(new ItemBuilder(Material.BOW).setUnbreakable(true).addEnchantment(Enchantment.ARROW_INFINITE, 1).build());
|
||||
inv.setItem(9, new ItemStack(Material.ARROW, 1));
|
||||
}
|
||||
|
||||
}
|
@ -6,6 +6,7 @@ import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.game.games.castlesiege.kits.KitHuman;
|
||||
import nautilus.game.arcade.kit.KitAvailability;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
import nautilus.game.arcade.kit.perks.PerkSniper;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
@ -31,37 +32,10 @@ public class KitSniper extends KitHuman
|
||||
super(manager, "Sniper", KitAvailability.Hide, new String[]
|
||||
{
|
||||
"Arrows do 0.1 damage per block travelled.", "Shoot from afar to score major damage!"
|
||||
}, new Perk[0], EntityType.SKELETON, new ItemStack(Material.ARROW));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onShoot(ProjectileLaunchEvent event)
|
||||
{
|
||||
Projectile entity = event.getEntity();
|
||||
if (entity instanceof Arrow && entity.getShooter() instanceof Player && HasKit((Player) entity.getShooter()))
|
||||
{
|
||||
entity.setMetadata("ShotFrom",
|
||||
new FixedMetadataValue(Manager.GetPlugin(), ((Player) entity.getShooter()).getLocation()));
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onDamage(CustomDamageEvent event)
|
||||
{
|
||||
if (event.GetCause() == DamageCause.PROJECTILE)
|
||||
{
|
||||
Entity entity = event.GetProjectile();
|
||||
if (entity != null && entity.hasMetadata("ShotFrom"))
|
||||
}, new Perk[]
|
||||
{
|
||||
// TODO Remove orig damage
|
||||
event.AddMod("AntiNormal", "AntiNormal", -event.GetDamageInitial(), false);
|
||||
event.AddMod(
|
||||
"Sniper",
|
||||
"Sniper",
|
||||
event.GetDamageeEntity().getLocation().distance((Location) entity.getMetadata("ShotFrom").get(0).value()) / 10,
|
||||
true);
|
||||
}
|
||||
}
|
||||
new PerkSniper()
|
||||
}, EntityType.SKELETON, new ItemStack(Material.ARROW));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,91 +1,31 @@
|
||||
package nautilus.game.arcade.game.games.searchanddestroy.kits.bow;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.game.games.castlesiege.kits.KitHuman;
|
||||
import nautilus.game.arcade.kit.KitAvailability;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
import nautilus.game.arcade.kit.perks.PerkRangedBleeding;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
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.inventory.PlayerInventory;
|
||||
|
||||
public class KitStitcher extends KitHuman
|
||||
{
|
||||
|
||||
private NautHashMap<LivingEntity, Integer> _secondsBleeding = new NautHashMap<LivingEntity, Integer>();
|
||||
|
||||
public KitStitcher(ArcadeManager manager)
|
||||
{
|
||||
super(manager, "Stitcher", KitAvailability.Hide, new String[]
|
||||
{
|
||||
"Your arrows tend to hit people in tender places.",
|
||||
"Its only logical they are going to start bleeding isn't it?"
|
||||
}, new Perk[0], EntityType.SKELETON, new ItemStack(Material.INK_SACK, 1, (short) 14));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onSecond(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.SEC)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Iterator<LivingEntity> itel = _secondsBleeding.keySet().iterator();
|
||||
while (itel.hasNext())
|
||||
{
|
||||
LivingEntity entity = itel.next();
|
||||
if (entity.isDead() || (entity instanceof Player && !Manager.IsAlive((Player) entity)))
|
||||
"People bleed when your arrows hit them","1 heart per second, 2 seconds per arrow."
|
||||
}, new Perk[]
|
||||
{
|
||||
itel.remove();
|
||||
continue;
|
||||
}
|
||||
Manager.GetDamage().NewDamageEvent(entity, null, null, DamageCause.CUSTOM, 2, false, true, true, "Bleed",
|
||||
"Stitcher Bleeding");
|
||||
if (_secondsBleeding.get(entity) <= 1)
|
||||
{
|
||||
itel.remove();
|
||||
}
|
||||
else
|
||||
{
|
||||
_secondsBleeding.put(entity, _secondsBleeding.get(entity) - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onDamage(CustomDamageEvent event)
|
||||
{
|
||||
if (event.GetCause() == DamageCause.PROJECTILE)
|
||||
{
|
||||
Player player = event.GetDamagerPlayer(true);
|
||||
if (player != null && this.HasKit(player))
|
||||
{
|
||||
LivingEntity entity = event.GetDamageeEntity();
|
||||
if (!_secondsBleeding.containsKey(entity))
|
||||
{
|
||||
_secondsBleeding.put(entity, 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
_secondsBleeding.put(entity, _secondsBleeding.get(entity) + 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
new PerkRangedBleeding()
|
||||
}, EntityType.SKELETON, new ItemStack(Material.INK_SACK, 1, (short) 14));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -0,0 +1,41 @@
|
||||
package nautilus.game.arcade.game.games.searchanddestroy.kits.bow;
|
||||
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.game.games.castlesiege.kits.KitHuman;
|
||||
import nautilus.game.arcade.kit.KitAvailability;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
import nautilus.game.arcade.kit.perks.PerkBarrage;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.PlayerInventory;
|
||||
|
||||
public class KitThunderstorm extends KitHuman
|
||||
{
|
||||
public KitThunderstorm(ArcadeManager manager)
|
||||
{
|
||||
super(manager, "Thunderstorm", KitAvailability.Hide, new String[]
|
||||
{
|
||||
"Chargeup your bow to release a barrage of arrows." + "The longer you charge your bow"
|
||||
+ "The more arrows are added to the barrage."
|
||||
}, new Perk[]
|
||||
{
|
||||
new PerkBarrage(10, 400, false, false, true)
|
||||
}, EntityType.SKELETON, new ItemStack(Material.ARROW, 16));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void GiveItems(Player player)
|
||||
{
|
||||
PlayerInventory inv = player.getInventory();
|
||||
inv.addItem(new ItemBuilder(Material.BLAZE_POWDER).setTitle(ChatColor.GOLD + "Fuse").build());
|
||||
inv.addItem(new ItemBuilder(Material.BOW).setUnbreakable(true).addEnchantment(Enchantment.ARROW_INFINITE, 1).build());
|
||||
inv.setItem(9, new ItemStack(Material.ARROW, 1));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package nautilus.game.arcade.game.games.searchanddestroy.kits.rogue;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.kit.KitAvailability;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
|
||||
public class KitRogue extends Kit
|
||||
{
|
||||
|
||||
public KitRogue(ArcadeManager manager)
|
||||
{
|
||||
super(manager, "Rogue", KitAvailability.Free, new String[]
|
||||
{}, new Perk[0], EntityType.ZOMBIE, new ItemStack(Material.WOOD_SWORD));
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
@Override
|
||||
public void GiveItems(Player player)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package nautilus.game.arcade.game.games.searchanddestroy.kits.trooper;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.PlayerInventory;
|
||||
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.kit.KitAvailability;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
|
||||
public class KitAssault extends Kit
|
||||
{
|
||||
|
||||
public KitAssault(ArcadeManager manager)
|
||||
{
|
||||
super(manager, "Assault", KitAvailability.Free, new String[]
|
||||
{
|
||||
"Bulls Charge ability.", "Temperary speed boost when activated.", "When attacking with the boost on",
|
||||
"The victim is stunned and slows down"
|
||||
}, new Perk[0], EntityType.ZOMBIE, new ItemStack(Material.IRON_SWORD));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void GiveItems(Player player)
|
||||
{
|
||||
PlayerInventory inv = player.getInventory();
|
||||
inv.addItem(new ItemStack(Material.IRON_SWORD));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package nautilus.game.arcade.game.games.searchanddestroy.kits.trooper;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.PlayerInventory;
|
||||
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.kit.KitAvailability;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
|
||||
public class KitTrooper extends Kit
|
||||
{
|
||||
|
||||
public KitTrooper(ArcadeManager manager)
|
||||
{
|
||||
super(manager, "Trooper", KitAvailability.Free, new String[]
|
||||
{
|
||||
"Full iron armor and 2 golden apples"
|
||||
}, new Perk[0], EntityType.ZOMBIE, new ItemStack(Material.IRON_SWORD));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void GiveItems(Player player)
|
||||
{
|
||||
PlayerInventory inv = player.getInventory();
|
||||
inv.addItem(new ItemStack(Material.IRON_SWORD));
|
||||
inv.addItem(new ItemStack(Material.GOLDEN_APPLE, 2));
|
||||
}
|
||||
|
||||
}
|
@ -30,237 +30,259 @@ import nautilus.game.arcade.kit.Perk;
|
||||
|
||||
public class PerkBarrage extends Perk
|
||||
{
|
||||
private WeakHashMap<Player, Integer> _charge = new WeakHashMap<Player, Integer>();
|
||||
private WeakHashMap<Player, Long> _chargeLast = new WeakHashMap<Player, Long>();
|
||||
private WeakHashMap<Player, Integer> _charge = new WeakHashMap<Player, Integer>();
|
||||
private WeakHashMap<Player, Long> _chargeLast = new WeakHashMap<Player, Long>();
|
||||
|
||||
private HashSet<Player> _firing = new HashSet<Player>();
|
||||
private HashSet<Projectile> _arrows = new HashSet<Projectile>();
|
||||
private HashSet<Player> _firing = new HashSet<Player>();
|
||||
private HashSet<Projectile> _arrows = new HashSet<Projectile>();
|
||||
|
||||
private int _max;
|
||||
private long _tick;
|
||||
private boolean _remove;
|
||||
private boolean _noDelay;
|
||||
|
||||
public PerkBarrage(int max, long tick, boolean remove, boolean noDelay)
|
||||
{
|
||||
super("Barrage", new String[]
|
||||
{
|
||||
C.cYellow + "Charge" + C.cGray + " your Bow to use " + C.cGreen + "Barrage"
|
||||
});
|
||||
|
||||
_max = max;
|
||||
_tick = tick;
|
||||
_remove = remove;
|
||||
_noDelay = noDelay;
|
||||
}
|
||||
private int _max;
|
||||
private long _tick;
|
||||
private boolean _remove;
|
||||
private boolean _noDelay;
|
||||
private boolean _useExp;
|
||||
|
||||
@EventHandler
|
||||
public void BarrageDrawBow(PlayerInteractEvent event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
public PerkBarrage(int max, long tick, boolean remove, boolean noDelay)
|
||||
{
|
||||
this(max, tick, remove, noDelay, false);
|
||||
}
|
||||
|
||||
if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK)
|
||||
return;
|
||||
public PerkBarrage(int max, long tick, boolean remove, boolean noDelay, boolean useExpAndBar)
|
||||
{
|
||||
super("Barrage", new String[]
|
||||
{
|
||||
C.cYellow + "Charge" + C.cGray + " your Bow to use " + C.cGreen + "Barrage"
|
||||
});
|
||||
_useExp = useExpAndBar;
|
||||
_max = max;
|
||||
_tick = tick;
|
||||
_remove = remove;
|
||||
_noDelay = noDelay;
|
||||
}
|
||||
|
||||
if (player.getItemInHand() == null || player.getItemInHand().getType() != Material.BOW)
|
||||
return;
|
||||
@EventHandler
|
||||
public void BarrageDrawBow(PlayerInteractEvent event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (!Kit.HasKit(player))
|
||||
return;
|
||||
if (event.getAction() != Action.RIGHT_CLICK_AIR && event.getAction() != Action.RIGHT_CLICK_BLOCK)
|
||||
return;
|
||||
|
||||
if (!player.getInventory().contains(Material.ARROW))
|
||||
return;
|
||||
if (player.getItemInHand() == null || player.getItemInHand().getType() != Material.BOW)
|
||||
return;
|
||||
|
||||
if (event.getClickedBlock() != null)
|
||||
if (UtilBlock.usable(event.getClickedBlock()))
|
||||
return;
|
||||
if (!Kit.HasKit(player))
|
||||
return;
|
||||
|
||||
//Start Charge
|
||||
_charge.put(player, 0);
|
||||
_chargeLast.put(player, System.currentTimeMillis());
|
||||
_firing.remove(player);
|
||||
}
|
||||
if (!player.getInventory().contains(Material.ARROW))
|
||||
return;
|
||||
|
||||
@EventHandler
|
||||
public void BarrageCharge(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
return;
|
||||
if (event.getClickedBlock() != null)
|
||||
if (UtilBlock.usable(event.getClickedBlock()))
|
||||
return;
|
||||
|
||||
for (Player cur : UtilServer.getPlayers())
|
||||
{
|
||||
//Not Charging
|
||||
if (!_charge.containsKey(cur))
|
||||
continue;
|
||||
// Start Charge
|
||||
_charge.put(player, 0);
|
||||
_chargeLast.put(player, System.currentTimeMillis());
|
||||
_firing.remove(player);
|
||||
}
|
||||
|
||||
if (_firing.contains(cur))
|
||||
continue;
|
||||
@EventHandler
|
||||
public void BarrageCharge(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
return;
|
||||
|
||||
//Max Charge
|
||||
if (_charge.get(cur) >= _max)
|
||||
continue;
|
||||
for (Player cur : UtilServer.getPlayers())
|
||||
{
|
||||
// Not Charging
|
||||
if (!_charge.containsKey(cur))
|
||||
continue;
|
||||
|
||||
//Charge Interval
|
||||
if (_charge.get(cur) == 0)
|
||||
{
|
||||
if (!UtilTime.elapsed(_chargeLast.get(cur), 1000))
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!UtilTime.elapsed(_chargeLast.get(cur), _tick))
|
||||
continue;
|
||||
}
|
||||
if (_firing.contains(cur))
|
||||
continue;
|
||||
|
||||
//No Longer Holding Bow
|
||||
if (cur.getItemInHand() == null || cur.getItemInHand().getType() != Material.BOW)
|
||||
{
|
||||
_charge.remove(cur);
|
||||
_chargeLast.remove(cur);
|
||||
continue;
|
||||
}
|
||||
// Max Charge
|
||||
if (_charge.get(cur) >= _max)
|
||||
continue;
|
||||
|
||||
//Increase Charge
|
||||
_charge.put(cur, _charge.get(cur) + 1);
|
||||
_chargeLast.put(cur, System.currentTimeMillis());
|
||||
// Charge Interval
|
||||
if (_charge.get(cur) == 0)
|
||||
{
|
||||
if (!UtilTime.elapsed(_chargeLast.get(cur), 1000))
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!UtilTime.elapsed(_chargeLast.get(cur), _tick))
|
||||
continue;
|
||||
}
|
||||
|
||||
//Effect
|
||||
cur.playSound(cur.getLocation(), Sound.CLICK, 1f, 1f + (0.1f * _charge.get(cur)));
|
||||
}
|
||||
}
|
||||
// No Longer Holding Bow
|
||||
if (cur.getItemInHand() == null || cur.getItemInHand().getType() != Material.BOW)
|
||||
{
|
||||
if (_useExp)
|
||||
{
|
||||
cur.setLevel(_charge.get(cur));
|
||||
}
|
||||
_charge.remove(cur);
|
||||
_chargeLast.remove(cur);
|
||||
continue;
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void BarrageFireBow(EntityShootBowEvent event)
|
||||
{
|
||||
if (event.isCancelled())
|
||||
return;
|
||||
|
||||
if (!Manager.GetGame().IsLive())
|
||||
return;
|
||||
|
||||
if (!(event.getEntity() instanceof Player))
|
||||
return;
|
||||
// Increase Charge
|
||||
_charge.put(cur, _charge.get(cur) + 1);
|
||||
|
||||
if (!(event.getProjectile() instanceof Arrow))
|
||||
return;
|
||||
if (_useExp)
|
||||
{
|
||||
cur.setLevel(_charge.get(cur));
|
||||
}
|
||||
_chargeLast.put(cur, System.currentTimeMillis());
|
||||
|
||||
Player player = (Player)event.getEntity();
|
||||
// Effect
|
||||
cur.playSound(cur.getLocation(), Sound.CLICK, 1f, 1f + (0.1f * _charge.get(cur)));
|
||||
}
|
||||
}
|
||||
|
||||
if (!_charge.containsKey(player))
|
||||
return;
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void BarrageFireBow(EntityShootBowEvent event)
|
||||
{
|
||||
if (event.isCancelled())
|
||||
return;
|
||||
|
||||
//Start Barrage
|
||||
_firing.add(player);
|
||||
_chargeLast.put(player, System.currentTimeMillis());
|
||||
}
|
||||
if (!Manager.GetGame().IsLive())
|
||||
return;
|
||||
|
||||
@EventHandler
|
||||
public void BarrageArrows(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
return;
|
||||
if (!(event.getEntity() instanceof Player))
|
||||
return;
|
||||
|
||||
HashSet<Player> remove = new HashSet<Player>();
|
||||
if (!(event.getProjectile() instanceof Arrow))
|
||||
return;
|
||||
|
||||
for (Player cur : _firing)
|
||||
{
|
||||
if (!_charge.containsKey(cur) || !_chargeLast.containsKey(cur))
|
||||
{
|
||||
remove.add(cur);
|
||||
continue;
|
||||
}
|
||||
Player player = (Player) event.getEntity();
|
||||
|
||||
if (cur.getItemInHand() == null || cur.getItemInHand().getType() != Material.BOW)
|
||||
{
|
||||
remove.add(cur);
|
||||
continue;
|
||||
}
|
||||
if (!_charge.containsKey(player))
|
||||
return;
|
||||
|
||||
int arrows = _charge.get(cur);
|
||||
if (arrows <= 0)
|
||||
{
|
||||
remove.add(cur);
|
||||
continue;
|
||||
}
|
||||
// Start Barrage
|
||||
_firing.add(player);
|
||||
_chargeLast.put(player, System.currentTimeMillis());
|
||||
}
|
||||
|
||||
_charge.put(cur, arrows-1);
|
||||
@EventHandler
|
||||
public void BarrageArrows(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.TICK)
|
||||
return;
|
||||
|
||||
//Fire Arrow
|
||||
Vector random = new Vector((Math.random()-0.5)/10, (Math.random()-0.5)/10, (Math.random()-0.5)/10);
|
||||
Projectile arrow = cur.launchProjectile(Arrow.class);
|
||||
arrow.setVelocity(cur.getLocation().getDirection().add(random).multiply(3));
|
||||
_arrows.add(arrow);
|
||||
cur.getWorld().playSound(cur.getLocation(), Sound.SHOOT_ARROW, 1f, 1f);
|
||||
}
|
||||
HashSet<Player> remove = new HashSet<Player>();
|
||||
|
||||
for (Player cur : remove)
|
||||
{
|
||||
_charge.remove(cur);
|
||||
_chargeLast.remove(cur);
|
||||
_firing.remove(cur);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void BarrageDamageTime(CustomDamageEvent event)
|
||||
{
|
||||
if (!_noDelay)
|
||||
return;
|
||||
|
||||
if (event.GetProjectile() == null)
|
||||
return;
|
||||
for (Player cur : _firing)
|
||||
{
|
||||
if (!_charge.containsKey(cur) || !_chargeLast.containsKey(cur))
|
||||
{
|
||||
remove.add(cur);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (event.GetDamagerPlayer(true) == null)
|
||||
return;
|
||||
if (cur.getItemInHand() == null || cur.getItemInHand().getType() != Material.BOW)
|
||||
{
|
||||
remove.add(cur);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!(event.GetProjectile() instanceof Arrow))
|
||||
return;
|
||||
int arrows = _charge.get(cur);
|
||||
if (arrows <= 0)
|
||||
{
|
||||
remove.add(cur);
|
||||
continue;
|
||||
}
|
||||
|
||||
Player damager = event.GetDamagerPlayer(true);
|
||||
_charge.put(cur, arrows - 1);
|
||||
if (_useExp)
|
||||
{
|
||||
cur.setLevel(_charge.get(cur));
|
||||
}
|
||||
|
||||
if (!Kit.HasKit(damager))
|
||||
return;
|
||||
// Fire Arrow
|
||||
Vector random = new Vector((Math.random() - 0.5) / 10, (Math.random() - 0.5) / 10, (Math.random() - 0.5) / 10);
|
||||
Projectile arrow = cur.launchProjectile(Arrow.class);
|
||||
arrow.setVelocity(cur.getLocation().getDirection().add(random).multiply(3));
|
||||
_arrows.add(arrow);
|
||||
cur.getWorld().playSound(cur.getLocation(), Sound.SHOOT_ARROW, 1f, 1f);
|
||||
}
|
||||
|
||||
event.SetCancelled("Barrage Cancel");
|
||||
|
||||
event.GetProjectile().remove();
|
||||
|
||||
//Damage Event
|
||||
Manager.GetDamage().NewDamageEvent(event.GetDamageeEntity(), damager, null,
|
||||
DamageCause.THORNS, event.GetDamage(), true, true, false,
|
||||
damager.getName(), GetName());
|
||||
}
|
||||
for (Player cur : remove)
|
||||
{
|
||||
if (_useExp)
|
||||
{
|
||||
cur.setLevel(0);
|
||||
}
|
||||
_charge.remove(cur);
|
||||
_chargeLast.remove(cur);
|
||||
_firing.remove(cur);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void BarrageProjectileHit(ProjectileHitEvent event)
|
||||
{
|
||||
if (_remove)
|
||||
if (_arrows.remove(event.getEntity()))
|
||||
event.getEntity().remove();
|
||||
}
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void BarrageDamageTime(CustomDamageEvent event)
|
||||
{
|
||||
if (!_noDelay)
|
||||
return;
|
||||
|
||||
@EventHandler
|
||||
public void BarrageClean(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.SEC)
|
||||
return;
|
||||
if (event.GetProjectile() == null)
|
||||
return;
|
||||
|
||||
for (Iterator<Projectile> arrowIterator = _arrows.iterator(); arrowIterator.hasNext();)
|
||||
{
|
||||
Projectile arrow = arrowIterator.next();
|
||||
if (event.GetDamagerPlayer(true) == null)
|
||||
return;
|
||||
|
||||
if (arrow.isDead() || !arrow.isValid())
|
||||
arrowIterator.remove();
|
||||
}
|
||||
}
|
||||
if (!(event.GetProjectile() instanceof Arrow))
|
||||
return;
|
||||
|
||||
@EventHandler
|
||||
public void Quit(PlayerQuitEvent event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
Player damager = event.GetDamagerPlayer(true);
|
||||
|
||||
_charge.remove(player);
|
||||
_chargeLast.remove(player);
|
||||
_firing.remove(player);
|
||||
}
|
||||
if (!Kit.HasKit(damager))
|
||||
return;
|
||||
|
||||
event.SetCancelled("Barrage Cancel");
|
||||
|
||||
event.GetProjectile().remove();
|
||||
|
||||
// Damage Event
|
||||
Manager.GetDamage().NewDamageEvent(event.GetDamageeEntity(), damager, null, DamageCause.THORNS, event.GetDamage(), true,
|
||||
true, false, damager.getName(), GetName());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void BarrageProjectileHit(ProjectileHitEvent event)
|
||||
{
|
||||
if (_remove)
|
||||
if (_arrows.remove(event.getEntity()))
|
||||
event.getEntity().remove();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void BarrageClean(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.SEC)
|
||||
return;
|
||||
|
||||
for (Iterator<Projectile> arrowIterator = _arrows.iterator(); arrowIterator.hasNext();)
|
||||
{
|
||||
Projectile arrow = arrowIterator.next();
|
||||
|
||||
if (arrow.isDead() || !arrow.isValid())
|
||||
arrowIterator.remove();
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void Quit(PlayerQuitEvent event)
|
||||
{
|
||||
Player player = event.getPlayer();
|
||||
|
||||
_charge.remove(player);
|
||||
_chargeLast.remove(player);
|
||||
_firing.remove(player);
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,76 @@
|
||||
package nautilus.game.arcade.kit.perks;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class PerkPinned extends Perk
|
||||
{
|
||||
|
||||
public PerkPinned()
|
||||
{
|
||||
super("Pinned", new String[]
|
||||
{
|
||||
"Gravity is suddenly much stronger", "You also have a hard time moving"
|
||||
});
|
||||
}
|
||||
|
||||
private NautHashMap<LivingEntity, Integer> _secondsPinned = new NautHashMap<LivingEntity, Integer>();
|
||||
|
||||
@EventHandler
|
||||
public void onSecond(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.FASTER)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Iterator<LivingEntity> itel = _secondsPinned.keySet().iterator();
|
||||
while (itel.hasNext())
|
||||
{
|
||||
LivingEntity entity = itel.next();
|
||||
if (entity.isDead() || (entity instanceof Player && !Manager.IsAlive((Player) entity)))
|
||||
{
|
||||
itel.remove();
|
||||
continue;
|
||||
}
|
||||
entity.setVelocity(entity.getVelocity().add(new Vector(0, -1, 0)));
|
||||
if (_secondsPinned.get(entity) <= 1)
|
||||
{
|
||||
itel.remove();
|
||||
}
|
||||
else
|
||||
{
|
||||
_secondsPinned.put(entity, _secondsPinned.get(entity) - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onDamage(CustomDamageEvent event)
|
||||
{
|
||||
if (event.GetCause() == DamageCause.PROJECTILE)
|
||||
{
|
||||
Player player = event.GetDamagerPlayer(true);
|
||||
if (player != null && this.Kit.HasKit(player))
|
||||
{
|
||||
LivingEntity entity = event.GetDamageeEntity();
|
||||
entity.setVelocity(entity.getVelocity().add(new Vector(0, -1, 0)));
|
||||
entity.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 40, 1), true);
|
||||
_secondsPinned.put(entity, 8);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,80 @@
|
||||
package nautilus.game.arcade.kit.perks;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
|
||||
public class PerkRangedBleeding extends Perk
|
||||
{
|
||||
|
||||
public PerkRangedBleeding()
|
||||
{
|
||||
super("Bleeding", new String[]
|
||||
{
|
||||
"After being hit by a arrow", "You will bleed for a few seconds"
|
||||
});
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onSecond(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.FAST)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Iterator<LivingEntity> itel = _secondsBleeding.keySet().iterator();
|
||||
while (itel.hasNext())
|
||||
{
|
||||
LivingEntity entity = itel.next();
|
||||
if (entity.isDead() || (entity instanceof Player && !Manager.IsAlive((Player) entity)))
|
||||
{
|
||||
itel.remove();
|
||||
continue;
|
||||
}
|
||||
Manager.GetDamage().NewDamageEvent(entity, null, null, DamageCause.CUSTOM, 2, false, true, true, "Bleed",
|
||||
"Stitcher Bleeding");
|
||||
if (_secondsBleeding.get(entity) <= 1)
|
||||
{
|
||||
itel.remove();
|
||||
}
|
||||
else
|
||||
{
|
||||
_secondsBleeding.put(entity, _secondsBleeding.get(entity) - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private NautHashMap<LivingEntity, Integer> _secondsBleeding = new NautHashMap<LivingEntity, Integer>();
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onDamage(CustomDamageEvent event)
|
||||
{
|
||||
if (event.GetCause() == DamageCause.PROJECTILE)
|
||||
{
|
||||
Player player = event.GetDamagerPlayer(true);
|
||||
if (player != null && Kit.HasKit(player))
|
||||
{
|
||||
LivingEntity entity = event.GetDamageeEntity();
|
||||
if (!_secondsBleeding.containsKey(entity))
|
||||
{
|
||||
_secondsBleeding.put(entity, 4);
|
||||
}
|
||||
else
|
||||
{
|
||||
_secondsBleeding.put(entity, _secondsBleeding.get(entity) + 4);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,121 @@
|
||||
package nautilus.game.arcade.kit.perks;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.WeakHashMap;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Projectile;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.entity.EntityShootBowEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
|
||||
public class PerkSharpshooter extends Perk
|
||||
{
|
||||
private WeakHashMap<Player, Integer> _hitCount = new WeakHashMap<Player, Integer>();
|
||||
private HashMap<Entity, Player> _arrows = new HashMap<Entity, Player>();
|
||||
|
||||
public PerkSharpshooter()
|
||||
{
|
||||
super("Sharpshooter", new String[]
|
||||
{
|
||||
"Consecutive arrow hits deal an", "additional 2 damage.", "", "Stacks up to 6 times", "",
|
||||
"Missing an arrow resets the bonus.",
|
||||
});
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void ShootBow(EntityShootBowEvent event)
|
||||
{
|
||||
if (!(event.getEntity() instanceof Player))
|
||||
return;
|
||||
|
||||
if (!Kit.HasKit((Player) event.getEntity()))
|
||||
return;
|
||||
|
||||
// Store
|
||||
_arrows.put(event.getProjectile(), (Player) event.getEntity());
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void Damage(CustomDamageEvent event)
|
||||
{
|
||||
if (event.IsCancelled())
|
||||
return;
|
||||
|
||||
if (event.GetCause() != DamageCause.PROJECTILE)
|
||||
return;
|
||||
|
||||
Projectile projectile = event.GetProjectile();
|
||||
if (projectile == null)
|
||||
return;
|
||||
|
||||
if (!_arrows.containsKey(projectile))
|
||||
return;
|
||||
|
||||
Player player = _arrows.remove(projectile);
|
||||
|
||||
if (_hitCount.containsKey(player))
|
||||
{
|
||||
// Damage
|
||||
event.AddMod(player.getName(), GetName(), _hitCount.get(player) * 2, true);
|
||||
|
||||
int limit = Math.min(6, _hitCount.get(player) + 1);
|
||||
|
||||
_hitCount.put(player, limit);
|
||||
|
||||
// Inform
|
||||
UtilPlayer.message(
|
||||
(Entity) projectile.getShooter(),
|
||||
GetName() + ": " + F.elem(_hitCount.get(player) + " Consecutive Hits") + C.cGray + " ("
|
||||
+ F.skill("+" + (limit * 2) + " Damage") + C.cGray + ")");
|
||||
}
|
||||
else
|
||||
{
|
||||
_hitCount.put(player, 1);
|
||||
}
|
||||
|
||||
projectile.remove();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void Clean(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.FAST)
|
||||
return;
|
||||
|
||||
HashSet<Entity> remove = new HashSet<Entity>();
|
||||
|
||||
Iterator<Player>itel = this._hitCount.keySet().iterator();
|
||||
while (itel.hasNext()) {
|
||||
Player p = itel.next();
|
||||
if (!Kit.HasKit(p) || !this.Manager.IsAlive(p)) {
|
||||
itel.remove();
|
||||
}
|
||||
}
|
||||
|
||||
for (Entity cur : _arrows.keySet())
|
||||
if (cur.isDead() || !cur.isValid() || cur.isOnGround())
|
||||
remove.add(cur);
|
||||
|
||||
for (Entity cur : remove)
|
||||
{
|
||||
Player player = _arrows.remove(cur);
|
||||
|
||||
if (player != null)
|
||||
if (_hitCount.remove(player) != null)
|
||||
UtilPlayer.message(player, GetName() + ": " + F.elem("0 Consecutive Hits"));
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
package nautilus.game.arcade.kit.perks;
|
||||
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Projectile;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.entity.EntityShootBowEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.metadata.FixedMetadataValue;
|
||||
|
||||
public class PerkSniper extends Perk
|
||||
{
|
||||
public PerkSniper()
|
||||
{
|
||||
super("Sniper", new String[]
|
||||
{
|
||||
"The further your arrow travels", "The more damage it does!"
|
||||
});
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void ShootBow(EntityShootBowEvent event)
|
||||
{
|
||||
if (!(event.getEntity() instanceof Player))
|
||||
return;
|
||||
|
||||
if (!Kit.HasKit((Player) event.getEntity()))
|
||||
return;
|
||||
|
||||
// Save
|
||||
event.getProjectile().setMetadata("ShotFrom",
|
||||
new FixedMetadataValue(this.Manager.GetPlugin(), event.getProjectile().getLocation()));
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.HIGH)
|
||||
public void Damage(CustomDamageEvent event)
|
||||
{
|
||||
if (event.IsCancelled())
|
||||
return;
|
||||
|
||||
if (event.GetCause() != DamageCause.PROJECTILE)
|
||||
return;
|
||||
|
||||
Projectile projectile = event.GetProjectile();
|
||||
if (projectile == null)
|
||||
return;
|
||||
|
||||
if (!projectile.hasMetadata("ShotFrom"))
|
||||
return;
|
||||
|
||||
Player damager = event.GetDamagerPlayer(true);
|
||||
if (damager == null)
|
||||
return;
|
||||
|
||||
Location loc = (Location) projectile.getMetadata("ShotFrom").get(0).value();
|
||||
double length = UtilMath.offset(loc, projectile.getLocation());
|
||||
|
||||
length /= 13;
|
||||
// Damage
|
||||
double damage = Math.max(event.GetDamageInitial(), Math.pow(length, length));
|
||||
|
||||
event.AddMod(damager.getName(), "Sniper", damage, damage > 0);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user