MineStrike update
This commit is contained in:
parent
05623b7522
commit
5d6834633f
@ -15,11 +15,14 @@ import org.bukkit.Sound;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Item;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Painting;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Snowball;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.entity.EntityRegainHealthEvent;
|
||||
import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason;
|
||||
import org.bukkit.event.entity.ItemDespawnEvent;
|
||||
import org.bukkit.event.entity.PlayerDeathEvent;
|
||||
import org.bukkit.event.entity.ProjectileHitEvent;
|
||||
@ -121,7 +124,7 @@ public class MineStrike extends TeamGame
|
||||
|
||||
private boolean _bombScoreboardFlash = false;
|
||||
|
||||
private HashSet<Player> _scoped = new HashSet<Player>();
|
||||
private HashMap<Player, ItemStack> _scoped = new HashMap<Player, ItemStack>();
|
||||
|
||||
//Round Data
|
||||
private String _winText = null;
|
||||
@ -154,7 +157,7 @@ public class MineStrike extends TeamGame
|
||||
|
||||
_shopManager = new ShopManager(this);
|
||||
|
||||
this.HungerSet = 18;
|
||||
this.HungerSet = 20;
|
||||
|
||||
this.ItemDrop = true;
|
||||
|
||||
@ -168,7 +171,9 @@ public class MineStrike extends TeamGame
|
||||
"Jumping massively decreases accuracy",
|
||||
"Crouching increases accuracy",
|
||||
"Hold Right-Click to Plant Bomb",
|
||||
"Hold RIght-Click with Knife to Defuse Bomb",
|
||||
"Hold Right-Click with knife to Defuse Bomb",
|
||||
"Left-Click to roll Grenades",
|
||||
"Right-Click to throw Grenades"
|
||||
};
|
||||
}
|
||||
|
||||
@ -235,13 +240,11 @@ public class MineStrike extends TeamGame
|
||||
if (!_disguise.containsKey(player))
|
||||
{
|
||||
_disguise.put(player, new DisguisePlayer(player, ((CraftPlayer)player).getProfile()));
|
||||
|
||||
//Enable Disguise
|
||||
Manager.GetDisguise().disguise(_disguise.get(player));
|
||||
}
|
||||
|
||||
DisguisePlayer disguise = _disguise.get(player);
|
||||
disguise.setSneaking(true);
|
||||
Manager.GetDisguise().disguise(_disguise.get(player));
|
||||
|
||||
for (Player other : UtilServer.getPlayers())
|
||||
{
|
||||
@ -513,13 +516,16 @@ public class MineStrike extends TeamGame
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void triggerGrenade(PlayerItemConsumeEvent event)
|
||||
public void triggerGrenade(PlayerInteractEvent event)
|
||||
{
|
||||
if (_freezeTime > 0)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!UtilEvent.isAction(event, ActionType.L) && !UtilEvent.isAction(event, ActionType.R))
|
||||
return;
|
||||
|
||||
if (!IsLive())
|
||||
return;
|
||||
@ -531,7 +537,7 @@ public class MineStrike extends TeamGame
|
||||
if (grenade == null)
|
||||
return;
|
||||
|
||||
grenade.throwGrenade(event.getPlayer(), this);
|
||||
grenade.throwGrenade(event.getPlayer(), UtilEvent.isAction(event, ActionType.L), this);
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@ -729,24 +735,73 @@ public class MineStrike extends TeamGame
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority=EventPriority.HIGHEST)
|
||||
@EventHandler(priority=EventPriority.HIGH)
|
||||
public void damage(CustomDamageEvent event)
|
||||
{
|
||||
if (event.GetCause() == DamageCause.FALL)
|
||||
{
|
||||
event.AddMod(GetName(), "Fall Reduction", -2, false);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//Knife
|
||||
if (event.GetProjectile() == null)
|
||||
{
|
||||
if (event.IsCancelled())
|
||||
return;
|
||||
|
||||
if (event.GetDamagerPlayer(false) != null)
|
||||
{
|
||||
event.GetDamageeEntity().getWorld().playSound(event.GetDamageeEntity().getLocation(), Sound.BAT_HURT, 1f, 1f);
|
||||
//Cancel Non-Knife Melee
|
||||
if (!UtilGear.isMat(event.GetDamagerPlayer(false).getItemInHand(), Material.IRON_AXE) &&
|
||||
!UtilGear.isMat(event.GetDamagerPlayer(false).getItemInHand(), Material.IRON_SWORD))
|
||||
{
|
||||
event.SetCancelled("Non-Knife");
|
||||
}
|
||||
//Knife Attack
|
||||
else if (!event.IsCancelled())
|
||||
{
|
||||
Player damager = event.GetDamagerPlayer(false);
|
||||
if (damager == null) return;
|
||||
|
||||
LivingEntity damagee = event.GetDamageeEntity();
|
||||
if (damagee == null) return;
|
||||
|
||||
Vector look = damagee.getLocation().getDirection();
|
||||
look.setY(0);
|
||||
look.normalize();
|
||||
|
||||
Vector from = damager.getLocation().toVector().subtract(damagee.getLocation().toVector());
|
||||
from.setY(0);
|
||||
from.normalize();
|
||||
|
||||
Vector check = new Vector(look.getX() * -1, 0, look.getZ() * -1);
|
||||
|
||||
//Backstab
|
||||
if (check.subtract(from).length() < 0.8)
|
||||
{
|
||||
//Damage
|
||||
event.AddMod(damager.getName(), "Knife", 25 - event.GetDamage(), false);
|
||||
|
||||
//Effect
|
||||
damagee.getWorld().playSound(damagee.getLocation(), Sound.HURT_FLESH, 1f, 2f);
|
||||
|
||||
event.SetKnockback(false);
|
||||
}
|
||||
//Standard
|
||||
else
|
||||
{
|
||||
//Damage
|
||||
event.AddMod(damager.getName(), "Knife", 6 - event.GetDamage(), false);
|
||||
|
||||
event.GetDamageeEntity().getWorld().playSound(event.GetDamageeEntity().getLocation(), Sound.BAT_HURT, 1f, 1f);
|
||||
|
||||
event.AddKnockback("Knife", 1.2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
//Gun
|
||||
Bullet bullet = _bullets.remove(event.GetProjectile());
|
||||
if (bullet == null)
|
||||
return;
|
||||
@ -754,7 +809,9 @@ public class MineStrike extends TeamGame
|
||||
//Wipe previous data!
|
||||
event.GetCancellers().clear();
|
||||
event.GetDamageMod().clear();
|
||||
event.GetDamageMult().clear();
|
||||
|
||||
if (!Manager.CanHurt(event.GetDamageePlayer(), event.GetDamagerPlayer(true)))
|
||||
event.SetCancelled("Team Damage");
|
||||
|
||||
event.AddMod(GetName(), bullet.Gun.getName(), bullet.getDamage(event.GetDamageeEntity().getLocation()), true);
|
||||
|
||||
@ -1319,11 +1376,17 @@ public class MineStrike extends TeamGame
|
||||
{
|
||||
player.playSound(player.getLocation(), Sound.HORSE_ARMOR, 1f, 2f);
|
||||
Manager.GetCondition().Factory().Blind("Respawn", player, null, 2, 0, false, false, false);
|
||||
UtilPlayer.message(player, F.main("Game", "You have " + F.elem(C.cGreen + "$" + _shopManager.getMoney(player)) + "."));
|
||||
}
|
||||
|
||||
//Give Bomb
|
||||
Player player = UtilAlg.Random(GetTeam(ChatColor.RED).GetPlayers(true));
|
||||
giveBombToPlayer(player);
|
||||
|
||||
//Update Scoreboard Teams
|
||||
for (GameTeam team : GetTeamList())
|
||||
for (Player teamMember : team.GetPlayers(true))
|
||||
GetScoreboard().SetPlayerTeam(teamMember, team.GetName().toUpperCase());
|
||||
}
|
||||
|
||||
public void giveMoney()
|
||||
@ -1514,35 +1577,13 @@ public class MineStrike extends TeamGame
|
||||
player.getWorld().playEffect(player.getLocation(), Effect.BLAZE_SHOOT, 0);
|
||||
}
|
||||
|
||||
/*
|
||||
@EventHandler
|
||||
public void sneakUpdate(UpdateEvent event)
|
||||
public void healthCancel(EntityRegainHealthEvent event)
|
||||
{
|
||||
if (!IsLive())
|
||||
return;
|
||||
|
||||
if (event.getType() != UpdateType.FAST)
|
||||
return;
|
||||
|
||||
for (Player player : GetPlayers(true))
|
||||
{
|
||||
if (!player.isSneaking())
|
||||
player.setSneaking(true);
|
||||
}
|
||||
if (event.getRegainReason() == RegainReason.SATIATED)
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void sneakUpdate(PlayerToggleSneakEvent event)
|
||||
{
|
||||
if (!IsLive())
|
||||
return;
|
||||
|
||||
event.getPlayer().setSneaking(true);
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void scopeUpdate(PlayerToggleSneakEvent event)
|
||||
{
|
||||
@ -1559,7 +1600,7 @@ public class MineStrike extends TeamGame
|
||||
//Enable
|
||||
if (!event.getPlayer().isSneaking())
|
||||
{
|
||||
_scoped.add(event.getPlayer());
|
||||
_scoped.put(event.getPlayer(), event.getPlayer().getInventory().getHelmet());
|
||||
Manager.GetCondition().Factory().Slow("Scope", event.getPlayer(), null, 9999, 3, false, false, false, false);
|
||||
event.getPlayer().getInventory().setHelmet(new ItemStack(Material.PUMPKIN));
|
||||
|
||||
@ -1567,11 +1608,7 @@ public class MineStrike extends TeamGame
|
||||
}
|
||||
else
|
||||
{
|
||||
_scoped.remove(event.getPlayer());
|
||||
Manager.GetCondition().EndCondition(event.getPlayer(), null, "Scope");
|
||||
event.getPlayer().getInventory().setHelmet(null);
|
||||
|
||||
event.getPlayer().getWorld().playSound(event.getPlayer().getEyeLocation(), Sound.GHAST_DEATH, 0.8f, 0.6f);
|
||||
removeScope(event.getPlayer());
|
||||
}
|
||||
}
|
||||
|
||||
@ -1586,20 +1623,25 @@ public class MineStrike extends TeamGame
|
||||
|
||||
for (Player player : GetPlayers(true))
|
||||
{
|
||||
if (!_scoped.contains(player))
|
||||
if (!_scoped.containsKey(player))
|
||||
continue;
|
||||
|
||||
Gun gun = getGunInHand(player, null);
|
||||
if (gun == null || !(gun instanceof AWP) || !player.isSneaking())
|
||||
{
|
||||
_scoped.remove(player);
|
||||
Manager.GetCondition().EndCondition(player, null, "Scope");
|
||||
player.getInventory().setHelmet(null);
|
||||
|
||||
player.getWorld().playSound(player.getEyeLocation(), Sound.GHAST_DEATH, 0.8f, 0.6f);
|
||||
removeScope(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void removeScope(Player player)
|
||||
{
|
||||
ItemStack stack = _scoped.remove(player);
|
||||
player.getInventory().setHelmet(stack);
|
||||
Manager.GetCondition().EndCondition(player, null, "Scope");
|
||||
|
||||
player.getWorld().playSound(player.getEyeLocation(), Sound.GHAST_DEATH, 0.8f, 0.6f);
|
||||
}
|
||||
|
||||
@Override
|
||||
@EventHandler
|
||||
@ -1620,8 +1662,8 @@ public class MineStrike extends TeamGame
|
||||
|
||||
Scoreboard.WriteBlank();
|
||||
|
||||
Scoreboard.Write(team.GetColor() + C.Bold + team.GetName());
|
||||
Scoreboard.Write(getScore(team) + "" + " Wins" + team.GetColor());
|
||||
Scoreboard.Write(getScore(team) + " " + team.GetColor() + C.Bold + team.GetName());
|
||||
//Scoreboard.Write(team.GetColor() + "" + getScore(team) + "" + " Wins" + team.GetColor());
|
||||
Scoreboard.Write(team.GetPlayers(true).size() + "" + " Alive" + team.GetColor());
|
||||
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import java.util.HashSet;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilGear;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
@ -12,6 +13,7 @@ import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.games.minestrike.items.StrikeItem;
|
||||
import nautilus.game.arcade.game.games.minestrike.items.StrikeItemType;
|
||||
import nautilus.game.arcade.game.games.minestrike.items.equipment.DefusalKit;
|
||||
import nautilus.game.arcade.game.games.minestrike.items.equipment.Helmet;
|
||||
import nautilus.game.arcade.game.games.minestrike.items.equipment.Kevlar;
|
||||
@ -27,6 +29,7 @@ import org.bukkit.Color;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.InventoryClickEvent;
|
||||
|
||||
@ -91,11 +94,48 @@ public class ShopManager
|
||||
|
||||
public void addItem(StrikeItem item, Player player, int slot)
|
||||
{
|
||||
player.getInventory().setItem(slot, item.getShopItem(getMoney(player)));
|
||||
|
||||
player.getInventory().setItem(slot, item.getShopItem(getMoney(player), hasItem(player, item)));
|
||||
|
||||
_shop.get(player).put(slot, item);
|
||||
}
|
||||
|
||||
public boolean hasItem(Player player, StrikeItem item)
|
||||
{
|
||||
|
||||
int count = 0;
|
||||
for (int i=0 ; i<9 ; i++)
|
||||
{
|
||||
if (UtilGear.isMat(player.getInventory().getItem(i), item.getSkin()))
|
||||
count++;
|
||||
|
||||
if (UtilGear.isMat(player.getInventory().getHelmet(), item.getSkin()))
|
||||
count++;
|
||||
|
||||
if (UtilGear.isMat(player.getInventory().getChestplate(), item.getSkin()))
|
||||
count++;
|
||||
}
|
||||
|
||||
if (count > 0)
|
||||
{
|
||||
if (item.getType() == StrikeItemType.PRIMARY_WEAPON ||
|
||||
item.getType() == StrikeItemType.SECONDARY_WEAPON ||
|
||||
item.getType() == StrikeItemType.ARMOR ||
|
||||
item.getType() == StrikeItemType.EQUIPMENT)
|
||||
return true;
|
||||
|
||||
if (item instanceof Grenade)
|
||||
{
|
||||
Grenade grenade = (Grenade)item;
|
||||
|
||||
if (!grenade.canGiveToPlayer(player))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void clearShopInventory(Player player)
|
||||
{
|
||||
_shop.remove(player);
|
||||
@ -143,6 +183,12 @@ public class ShopManager
|
||||
|
||||
StrikeItem item = _shop.get(player).get(event.getSlot());
|
||||
|
||||
if (item == null)
|
||||
return;
|
||||
|
||||
if (hasItem(player, item))
|
||||
return;
|
||||
|
||||
if (getMoney(player) < item.getCost())
|
||||
{
|
||||
player.playSound(player.getLocation(), Sound.NOTE_BASS, 1f, 1f);
|
||||
|
@ -4,7 +4,9 @@ import java.util.ArrayList;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilGear;
|
||||
import mineplex.core.common.util.UtilInv;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import nautilus.game.arcade.game.games.minestrike.MineStrike;
|
||||
@ -14,6 +16,7 @@ import nautilus.game.arcade.game.games.minestrike.items.guns.Gun;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
@ -85,7 +88,7 @@ public abstract class StrikeItem
|
||||
else
|
||||
{
|
||||
ent = player.getWorld().dropItem(player.getEyeLocation(), _stack);
|
||||
ent.setVelocity(player.getLocation().getDirection().multiply(0.6));
|
||||
UtilAction.velocity(ent, player.getLocation().getDirection(), 0.4, false, 0, 0.1, 1, false);
|
||||
}
|
||||
|
||||
if (this instanceof Gun)
|
||||
@ -141,7 +144,7 @@ public abstract class StrikeItem
|
||||
|
||||
public abstract boolean pickup(MineStrike game, Player player);
|
||||
|
||||
public ItemStack getShopItem(int money)
|
||||
public ItemStack getShopItem(int money, boolean alreadyHas)
|
||||
{
|
||||
ArrayList<String> lore = new ArrayList<String>();
|
||||
|
||||
@ -155,24 +158,43 @@ public abstract class StrikeItem
|
||||
for (String cur : getShopItemCustom())
|
||||
lore.add(C.cWhite + cur);
|
||||
}
|
||||
|
||||
if (alreadyHas)
|
||||
{
|
||||
lore.add(" ");
|
||||
lore.add(C.cYellow + C.Bold + "You already have this!");
|
||||
}
|
||||
else
|
||||
{
|
||||
lore.add(" ");
|
||||
lore.add(C.cYellow + C.Bold + "Cost: " + ChatColor.RESET + "$" + _cost);
|
||||
lore.add(" ");
|
||||
lore.add(C.cYellow + C.Bold + "Money: " + ChatColor.RESET + "$" + money);
|
||||
lore.add(" ");
|
||||
lore.add((money >= _cost) ? C.cGreen + C.Bold + "Click to Purchase" : C.cRed + C.Bold + "Not enough Money");
|
||||
|
||||
|
||||
lore.add(" ");
|
||||
lore.add(C.cYellow + C.Bold + "Cost: " + ChatColor.RESET + "$" + _cost);
|
||||
lore.add(" ");
|
||||
lore.add(C.cYellow + C.Bold + "Money: " + ChatColor.RESET + "$" + money);
|
||||
lore.add(" ");
|
||||
lore.add((money >= _cost) ? C.cGreen + C.Bold + "Click to Purchase" : C.cRed + C.Bold + "Not enough Money");
|
||||
|
||||
}
|
||||
|
||||
String[] loreArray = new String[lore.size()];
|
||||
loreArray = lore.toArray(loreArray);
|
||||
|
||||
String name = getShopItemType() + " " + C.cGreen + getName();
|
||||
|
||||
return ItemStackFactory.Instance.CreateStack(_skin, (byte)0, 1, C.cGreen + getName(), loreArray);
|
||||
ItemStack item = ItemStackFactory.Instance.CreateStack(_skin, (byte)0, 1, name, loreArray);
|
||||
|
||||
if (alreadyHas)
|
||||
UtilInv.addDullEnchantment(item);
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
public String[] getShopItemCustom()
|
||||
{
|
||||
return new String[] {};
|
||||
}
|
||||
|
||||
public String getShopItemType()
|
||||
{
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,11 @@
|
||||
package nautilus.game.arcade.game.games.minestrike.items.equipment;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import nautilus.game.arcade.game.games.minestrike.MineStrike;
|
||||
@ -37,4 +39,10 @@ public class DefusalKit extends StrikeItem
|
||||
|
||||
player.getWorld().playSound(player.getLocation(), Sound.HORSE_ARMOR, 1.5f, 1f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getShopItemType()
|
||||
{
|
||||
return C.cDGreen + C.Bold + "Equipment" + ChatColor.RESET;
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package nautilus.game.arcade.game.games.minestrike.items.equipment;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
@ -7,6 +8,7 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.LeatherArmorMeta;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import nautilus.game.arcade.game.games.minestrike.MineStrike;
|
||||
@ -19,7 +21,7 @@ public class Helmet extends StrikeItem
|
||||
{
|
||||
super(StrikeItemType.EQUIPMENT, "Helmet", new String[]
|
||||
{
|
||||
|
||||
"Reduces damage from headshots"
|
||||
},
|
||||
350, 0, Material.LEATHER_HELMET);
|
||||
}
|
||||
@ -43,4 +45,10 @@ public class Helmet extends StrikeItem
|
||||
|
||||
player.getWorld().playSound(player.getLocation(), Sound.HORSE_ARMOR, 1f, 1f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getShopItemType()
|
||||
{
|
||||
return C.cDGreen + C.Bold + "Armor" + ChatColor.RESET;
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
package nautilus.game.arcade.game.games.minestrike.items.equipment;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
@ -7,6 +8,7 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.LeatherArmorMeta;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import nautilus.game.arcade.game.games.minestrike.MineStrike;
|
||||
@ -19,7 +21,7 @@ public class Kevlar extends StrikeItem
|
||||
{
|
||||
super(StrikeItemType.EQUIPMENT, "Kevlar Vest", new String[]
|
||||
{
|
||||
|
||||
"Reduces damage from bullets"
|
||||
},
|
||||
650, 0, Material.LEATHER_CHESTPLATE);
|
||||
}
|
||||
@ -43,4 +45,10 @@ public class Kevlar extends StrikeItem
|
||||
|
||||
player.getWorld().playSound(player.getLocation(), Sound.HORSE_ARMOR, 1f, 1f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getShopItemType()
|
||||
{
|
||||
return C.cDGreen + C.Bold + "Armor" + ChatColor.RESET;
|
||||
}
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ public class FlashBang extends Grenade
|
||||
{
|
||||
|
||||
},
|
||||
300, 0, Material.CARROT_ITEM, 2);
|
||||
200, 0, Material.CARROT_ITEM, 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -34,7 +34,7 @@ public class FlashBang extends Grenade
|
||||
if (ent.getTicksLived() > 40)
|
||||
{
|
||||
FireworkEffect effect = FireworkEffect.builder().flicker(true).withColor(Color.WHITE).with(Type.BALL_LARGE).trail(false).build();
|
||||
UtilFirework.playFirework(ent.getLocation(), effect);
|
||||
UtilFirework.playFirework(ent.getLocation().add(0, 0.5, 0), effect);
|
||||
|
||||
HashMap<Player, Double> players = UtilPlayer.getInRadius(ent.getLocation(), 48);
|
||||
for (Player player : players.keySet())
|
||||
|
@ -2,6 +2,7 @@ package nautilus.game.arcade.game.games.minestrike.items.grenades;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
@ -9,6 +10,7 @@ import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
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.UtilEnt;
|
||||
@ -53,7 +55,6 @@ public abstract class Grenade extends StrikeItem
|
||||
slot++;
|
||||
}
|
||||
|
||||
|
||||
if (slot > 6)
|
||||
return false;
|
||||
|
||||
@ -62,7 +63,32 @@ public abstract class Grenade extends StrikeItem
|
||||
return true;
|
||||
}
|
||||
|
||||
public void throwGrenade(Player player, MineStrike game)
|
||||
public boolean canGiveToPlayer(Player player)
|
||||
{
|
||||
int slot = 3;
|
||||
|
||||
int alreadyHas = 0;
|
||||
|
||||
while (player.getInventory().getItem(slot) != null && player.getInventory().getItem(slot).getType() != Material.AIR && slot <= 6)
|
||||
{
|
||||
if (player.getInventory().getItem(slot).getType() == getSkin())
|
||||
{
|
||||
alreadyHas++;
|
||||
|
||||
if (alreadyHas >= _limit)
|
||||
return false;
|
||||
}
|
||||
|
||||
slot++;
|
||||
}
|
||||
|
||||
if (slot > 6)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void throwGrenade(Player player, boolean wasLeftClick, MineStrike game)
|
||||
{
|
||||
player.setItemInHand(null);
|
||||
|
||||
@ -70,7 +96,10 @@ public abstract class Grenade extends StrikeItem
|
||||
|
||||
Entity ent = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()), getStack());
|
||||
|
||||
UtilAction.velocity(ent, player.getLocation().getDirection(), 1.2, false, 0, 0.2, 2, false);
|
||||
if (wasLeftClick)
|
||||
UtilAction.velocity(ent, player.getLocation().getDirection(), 0.4, false, 0, 0, 2, false);
|
||||
else
|
||||
UtilAction.velocity(ent, player.getLocation().getDirection(), 1.2, false, 0, 0.2, 2, false);
|
||||
|
||||
//Rebound Data
|
||||
_vel = player.getLocation().getDirection();
|
||||
@ -135,6 +164,7 @@ public abstract class Grenade extends StrikeItem
|
||||
|
||||
ent.getWorld().playSound(ent.getLocation(), Sound.ZOMBIE_WOOD, 1f, 2f);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
_velHistory.add(ent.getVelocity());
|
||||
@ -159,4 +189,10 @@ public abstract class Grenade extends StrikeItem
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getShopItemType()
|
||||
{
|
||||
return C.cDGreen + C.Bold + "Grenade" + ChatColor.RESET;
|
||||
}
|
||||
}
|
||||
|
@ -358,4 +358,10 @@ public abstract class Gun extends StrikeItem
|
||||
|
||||
player.setHealth(20);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getShopItemType()
|
||||
{
|
||||
return C.cDGreen + C.Bold + _gunType.getName() + ChatColor.RESET;
|
||||
}
|
||||
}
|
||||
|
@ -119,7 +119,7 @@ public class GameFlagManager implements Listener
|
||||
{
|
||||
if (!Manager.CanHurt((Player)damagee, (Player)damager))
|
||||
{
|
||||
event.SetCancelled("Damage Rules");
|
||||
event.SetCancelled("PvP Disabled");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user