Merge branch 'master' of ssh://184.154.0.242:7999/min/Mineplex
This commit is contained in:
commit
006c7d1e65
@ -505,6 +505,10 @@ public class UtilEnt
|
||||
if (player.getLocation().add(x, -0.5, z).getBlock().getType() != Material.AIR && !player.getLocation().add(x, -0.5, z).getBlock().isLiquid())
|
||||
return true;
|
||||
|
||||
//Inside a Lillypad
|
||||
if (player.getLocation().add(x, 0, z).getBlock().getType() == Material.WATER_LILY)
|
||||
return true;
|
||||
|
||||
//Fences/Walls
|
||||
Material beneath = player.getLocation().add(x, -1.5, z).getBlock().getType();
|
||||
if (player.getLocation().getY() % 0.5 == 0 &&
|
||||
|
@ -23,7 +23,7 @@ public enum Achievement
|
||||
|
||||
BRIDGES_SNIPER("Sniper", 600,
|
||||
new String[] {"The Bridges.Sniper"},
|
||||
new String[] {"Kill an enemy with Bow before Bridges fall"},
|
||||
new String[] {"Kill an enemy with Archery before Bridges fall"},
|
||||
new int[] {1},
|
||||
AchievementCategory.BRIDGES),
|
||||
|
||||
|
@ -543,6 +543,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable
|
||||
});
|
||||
}
|
||||
}
|
||||
/*
|
||||
else if (packet instanceof PacketPlayOutNamedSoundEffect)
|
||||
{
|
||||
try
|
||||
@ -567,6 +568,7 @@ public class DisguiseManager extends MiniPlugin implements IPacketRunnable
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -62,6 +62,7 @@ public class MorphPumpkinKing extends MorphGadget
|
||||
{
|
||||
this.RemoveArmor(player);
|
||||
Manager.getDisguiseManager().undisguise(player);
|
||||
player.getInventory().setHelmet(null);
|
||||
}
|
||||
|
||||
|
||||
|
@ -7,6 +7,7 @@ import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Minecart;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.EntityTargetEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEntityEvent;
|
||||
|
||||
@ -170,4 +171,11 @@ public class MountCart extends Mount<Minecart>
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void cancelBreak(EntityDamageEvent event)
|
||||
{
|
||||
if (GetActive().values().contains(event.getEntity()))
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
@ -647,8 +647,9 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
// Arrows go bye bye.
|
||||
((CraftPlayer) player).getHandle().p(0);
|
||||
|
||||
GetCondition().EndCondition(player, ConditionType.CLOAK, null);
|
||||
|
||||
//Remove all conditions
|
||||
GetCondition().EndCondition(player, null, null);
|
||||
|
||||
HubClock(player);
|
||||
|
||||
GetDisguise().undisguise(player);
|
||||
|
@ -26,7 +26,7 @@ import nautilus.game.arcade.game.games.halloween.Halloween;
|
||||
import nautilus.game.arcade.game.games.hideseek.HideSeek;
|
||||
import nautilus.game.arcade.game.games.micro.Micro;
|
||||
import nautilus.game.arcade.game.games.milkcow.MilkCow;
|
||||
//import nautilus.game.arcade.game.games.minestrike.MineStrike;
|
||||
import nautilus.game.arcade.game.games.minestrike.MineStrike;
|
||||
import nautilus.game.arcade.game.games.mineware.MineWare;
|
||||
import nautilus.game.arcade.game.games.quiver.Quiver;
|
||||
import nautilus.game.arcade.game.games.quiver.QuiverTeams;
|
||||
@ -79,7 +79,7 @@ public class GameFactory
|
||||
else if (gameType == GameType.Halloween) return new Halloween(_manager);
|
||||
else if (gameType == GameType.HideSeek) return new HideSeek(_manager);
|
||||
else if (gameType == GameType.Micro) return new Micro(_manager);
|
||||
//else if (gameType == GameType.MineStrike) return new MineStrike(_manager);
|
||||
else if (gameType == GameType.MineStrike) return new MineStrike(_manager);
|
||||
else if (gameType == GameType.MineWare) return new MineWare(_manager);
|
||||
else if (gameType == GameType.MilkCow) return new MilkCow(_manager);
|
||||
else if (gameType == GameType.Paintball) return new Paintball(_manager);
|
||||
|
@ -6,6 +6,7 @@ import mineplex.core.common.util.*;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.minecraft.game.core.combat.DeathMessageType;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.ArcadeFormat;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
@ -37,10 +38,14 @@ import org.bukkit.Location;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Hanging;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.hanging.HangingBreakEvent;
|
||||
import org.bukkit.event.hanging.HangingPlaceEvent;
|
||||
import org.bukkit.event.player.PlayerLoginEvent;
|
||||
import org.bukkit.scoreboard.Objective;
|
||||
import org.bukkit.util.Vector;
|
||||
@ -1147,4 +1152,25 @@ public abstract class Game implements Listener
|
||||
{
|
||||
return _statTrackers;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onHangingBreak(HangingBreakEvent event)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onHangingPlace(HangingPlaceEvent event)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onDamageHanging(EntityDamageEvent event)
|
||||
{
|
||||
if (event.getEntity() instanceof Hanging)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,305 @@
|
||||
package nautilus.game.arcade.game.games.minestrike;
|
||||
|
||||
import java.util.HashMap;
|
||||
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;
|
||||
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;
|
||||
import nautilus.game.arcade.game.games.minestrike.items.grenades.*;
|
||||
import nautilus.game.arcade.game.games.minestrike.items.guns.Gun;
|
||||
import nautilus.game.arcade.game.games.minestrike.items.guns.pistol.*;
|
||||
import nautilus.game.arcade.game.games.minestrike.items.guns.rifle.*;
|
||||
import nautilus.game.arcade.game.games.minestrike.items.guns.shotgun.*;
|
||||
import nautilus.game.arcade.game.games.minestrike.items.guns.smg.*;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
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;
|
||||
|
||||
public class ShopManager
|
||||
{
|
||||
private MineStrike Host;
|
||||
|
||||
private HashMap<Player, HashMap<Integer, StrikeItem>> _shop = new HashMap<Player, HashMap<Integer, StrikeItem>>();
|
||||
private HashMap<Player, Integer> _money = new HashMap<Player, Integer>();
|
||||
private HashSet<Player> _inShop = new HashSet<Player>();
|
||||
|
||||
public ShopManager(MineStrike host)
|
||||
{
|
||||
Host = host;
|
||||
}
|
||||
|
||||
public void enterShop(Player player)
|
||||
{
|
||||
GameTeam team = Host.GetTeam(player);
|
||||
if (team == null)
|
||||
return;
|
||||
|
||||
clearShopInventory(player);
|
||||
|
||||
_shop.put(player, new HashMap<Integer, StrikeItem>());
|
||||
|
||||
int slot;
|
||||
|
||||
//Pistols
|
||||
slot = 9;
|
||||
//addItem(team.GetColor() == ChatColor.RED ? new Glock18() : new USP(), player, slot++);
|
||||
addItem(new CZ75(), player, slot++);
|
||||
addItem(new Deagle(), player, slot++);
|
||||
|
||||
//Shotgun
|
||||
slot = 18;
|
||||
addItem(new Nova(), player, slot++);
|
||||
|
||||
//SMG
|
||||
addItem(new P90(), player, slot++);
|
||||
|
||||
//Rifles
|
||||
slot = 27;
|
||||
addItem(team.GetColor() == ChatColor.RED ? new AK47() : new M4A1(), player, slot++);
|
||||
addItem(new AWP(), player, slot++);
|
||||
|
||||
//Grenades
|
||||
addItem(new FlashBang(), player, 15);
|
||||
addItem(new HighExplosive(), player, 16);
|
||||
addItem(new Smoke(), player, 17);
|
||||
|
||||
//Gear
|
||||
if (team.GetColor() == ChatColor.AQUA)
|
||||
addItem(new DefusalKit(), player, 26);
|
||||
|
||||
//Equipment
|
||||
addItem(new Helmet(), player, 34);
|
||||
addItem(new Kevlar(), player, 35);
|
||||
|
||||
_inShop.add(player);
|
||||
}
|
||||
|
||||
public void addItem(StrikeItem item, Player player, int slot)
|
||||
{
|
||||
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);
|
||||
|
||||
for (int i=9 ; i<36 ; i++)
|
||||
player.getInventory().setItem(i, null);
|
||||
}
|
||||
|
||||
public int getMoney(Player player)
|
||||
{
|
||||
if (!_money.containsKey(player))
|
||||
_money.put(player, 800);
|
||||
|
||||
return _money.get(player);
|
||||
}
|
||||
|
||||
public void addMoney(Player player, int amount, String reason)
|
||||
{
|
||||
_money.put(player, Math.min(16000, getMoney(player) + amount));
|
||||
|
||||
UtilPlayer.message(player, F.main("Game", "Received " + F.elem(C.cDGreen + "$" + amount) + " for " + reason + "."));
|
||||
}
|
||||
|
||||
public void inventoryClick(InventoryClickEvent event)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
|
||||
Player player = UtilPlayer.searchExact(event.getWhoClicked().getName());
|
||||
if (player == null)
|
||||
return;
|
||||
|
||||
GameTeam team = Host.GetTeam(player);
|
||||
if (team == null)
|
||||
return;
|
||||
|
||||
if (!_shop.containsKey(player))
|
||||
return;
|
||||
|
||||
if (!_shop.get(player).containsKey(event.getSlot()))
|
||||
return;
|
||||
|
||||
//Prevent accidently buying multi
|
||||
if (!Recharge.Instance.use(player, "Shop Purchase", 120, false, false))
|
||||
return;
|
||||
|
||||
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);
|
||||
return;
|
||||
}
|
||||
|
||||
//Gun
|
||||
if (item instanceof Gun)
|
||||
{
|
||||
Gun gun = (Gun)item;
|
||||
Host.dropSlotItem(player, gun.getSlot());
|
||||
gun.giveToPlayer(player);
|
||||
Host.registerGun(gun, player);
|
||||
}
|
||||
|
||||
//Grenade
|
||||
else if (item instanceof Grenade)
|
||||
{
|
||||
Grenade grenade = (Grenade)item;
|
||||
|
||||
if (!grenade.giveToPlayer(player))
|
||||
{
|
||||
player.playSound(player.getLocation(), Sound.NOTE_BASS, 1f, 1f);
|
||||
return;
|
||||
}
|
||||
|
||||
Host.registerGrenade(grenade, player);
|
||||
}
|
||||
|
||||
else if (item instanceof Helmet)
|
||||
{
|
||||
((Helmet)item).giveToPlayer(player, (team.GetColor() == ChatColor.RED) ? Color.fromRGB(100, 0, 0) : Color.fromRGB(0, 0, 100));
|
||||
}
|
||||
|
||||
else if (item instanceof Kevlar)
|
||||
{
|
||||
((Kevlar)item).giveToPlayer(player, (team.GetColor() == ChatColor.RED) ? Color.fromRGB(100, 0, 0) : Color.fromRGB(0, 0, 100));
|
||||
}
|
||||
|
||||
else if (item instanceof DefusalKit)
|
||||
{
|
||||
item.giveToPlayer(player, 8);
|
||||
}
|
||||
|
||||
_money.put(player, getMoney(player) - item.getCost());
|
||||
|
||||
enterShop(player);
|
||||
}
|
||||
|
||||
public void leaveShop(Player player, boolean showShopItem, boolean wipeMoney)
|
||||
{
|
||||
_shop.remove(player);
|
||||
|
||||
_inShop.remove(player);
|
||||
clearShopInventory(player);
|
||||
|
||||
if (wipeMoney)
|
||||
_money.remove(player);
|
||||
|
||||
if (showShopItem)
|
||||
{
|
||||
player.getInventory().setItem(22,
|
||||
ItemStackFactory.Instance.CreateStack(Material.PAPER, (byte)0, 1, C.cRed + "Cannot Purchase Gear",
|
||||
new String[]
|
||||
{
|
||||
C.cWhite + "",
|
||||
C.cWhite + "You can only purchase gear when",
|
||||
C.cWhite + "you are near your spawn point in",
|
||||
C.cWhite + "the first 45 seconds of the round!",
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isBuyTime()
|
||||
{
|
||||
return !UtilTime.elapsed(Host.GetStateTime(), 45000) && Host.InProgress();
|
||||
}
|
||||
|
||||
public void update()
|
||||
{
|
||||
for (Player player : Host.GetPlayers(true))
|
||||
{
|
||||
GameTeam team = Host.GetTeam(player);
|
||||
|
||||
if (team == null)
|
||||
{
|
||||
leaveShop(player, false, false);
|
||||
continue;
|
||||
}
|
||||
|
||||
//Near Shop?
|
||||
boolean nearShop = false;
|
||||
for (Location loc : team.GetSpawns())
|
||||
{
|
||||
if (UtilMath.offset(player.getLocation(), loc) < 5)
|
||||
{
|
||||
nearShop = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//Leave Shop
|
||||
if (_inShop.contains(player) && (!nearShop || !isBuyTime()))
|
||||
{
|
||||
leaveShop(player, true, false);
|
||||
}
|
||||
//Enter Shop
|
||||
else if (!_inShop.contains(player) && (nearShop && isBuyTime()))
|
||||
{
|
||||
enterShop(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,86 @@
|
||||
package nautilus.game.arcade.game.games.minestrike.data;
|
||||
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class Bomb
|
||||
{
|
||||
public long BombTime = 45000;
|
||||
|
||||
public Block Block;
|
||||
public long StartTime;
|
||||
public long LastBeep;
|
||||
|
||||
public long MinBeepTime = 40;
|
||||
public long StartBeepTime = 2000;
|
||||
|
||||
public Player Planter;
|
||||
|
||||
public Bomb(Player planter)
|
||||
{
|
||||
Planter = planter;
|
||||
|
||||
Block = planter.getLocation().getBlock();
|
||||
Block.setType(Material.DAYLIGHT_DETECTOR);
|
||||
|
||||
StartTime = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
public boolean update()
|
||||
{
|
||||
double scale = (double)(System.currentTimeMillis() - StartTime)/(double)BombTime;
|
||||
|
||||
long beepDuration = MinBeepTime + (long)(StartBeepTime * (1-scale));
|
||||
float volume = 1f + 4f*(float)scale;
|
||||
|
||||
if (UtilTime.elapsed(LastBeep, beepDuration))
|
||||
{
|
||||
Block.getWorld().playSound(Block.getLocation(), Sound.ANVIL_BREAK, volume, 1f);
|
||||
UtilParticle.PlayParticle(ParticleType.HAPPY_VILLAGER, Block.getLocation().add(0.5, 0.5, 0.5), 0, 0, 0, 0, 1);
|
||||
|
||||
LastBeep = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
if (UtilTime.elapsed(StartTime, BombTime))
|
||||
{
|
||||
Block.setType(Material.AIR);
|
||||
|
||||
//Effect
|
||||
UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION, Block.getLocation(), 10f, 10f, 10f, 0, 30);
|
||||
|
||||
for (int i=0 ; i<3 ; i++)
|
||||
Block.getWorld().playSound(Block.getLocation(), Sound.ANVIL_LAND, 20f, (float)(Math.random() * 0.5 + 0.5));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean isBlock(Block block)
|
||||
{
|
||||
if (block == null)
|
||||
return false;
|
||||
|
||||
return block.equals(Block);
|
||||
}
|
||||
|
||||
public void defuse()
|
||||
{
|
||||
Block.setType(Material.AIR);
|
||||
|
||||
//Effect
|
||||
UtilParticle.PlayParticle(ParticleType.CLOUD, Block.getLocation().add(0.5, 0.5, 0.5), 0, 0, 0, 0, 1);
|
||||
}
|
||||
|
||||
public void clean()
|
||||
{
|
||||
Block.setType(Material.AIR);
|
||||
}
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
package nautilus.game.arcade.game.games.minestrike.data;
|
||||
|
||||
import nautilus.game.arcade.game.games.minestrike.items.guns.Gun;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.entity.Snowball;
|
||||
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
|
||||
public class Bullet
|
||||
{
|
||||
public Snowball Bullet;
|
||||
public Gun Gun;
|
||||
public Location Origin;
|
||||
|
||||
public long LastSound = System.currentTimeMillis() - 100;
|
||||
|
||||
|
||||
public Bullet(Snowball bullet, Gun gun, Location loc)
|
||||
{
|
||||
Bullet = bullet;
|
||||
Gun = gun;
|
||||
Origin = loc;
|
||||
}
|
||||
|
||||
public boolean isValid()
|
||||
{
|
||||
return Bullet.isValid();
|
||||
}
|
||||
|
||||
public double getDamage(Location destination)
|
||||
{
|
||||
return Gun.getDamage() * (1 - (Gun.getDropOff() * UtilMath.offset(Origin, destination)));
|
||||
}
|
||||
|
||||
public boolean bulletSound()
|
||||
{
|
||||
if (UtilTime.elapsed(LastSound, 250))
|
||||
{
|
||||
LastSound = System.currentTimeMillis();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
@ -0,0 +1,200 @@
|
||||
package nautilus.game.arcade.game.games.minestrike.items;
|
||||
|
||||
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;
|
||||
import nautilus.game.arcade.game.games.minestrike.items.grenades.Grenade;
|
||||
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;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
public abstract class StrikeItem
|
||||
{
|
||||
private StrikeItemType _type;
|
||||
private String _name;
|
||||
private String[] _desc;
|
||||
private int _cost;
|
||||
private int _gemCost;
|
||||
private Material _skin;
|
||||
|
||||
private ItemStack _stack = null;
|
||||
|
||||
public StrikeItem(StrikeItemType type, String name, String[] desc, int cost, int gemCost, Material skin)
|
||||
{
|
||||
_type = type;
|
||||
_name = name;
|
||||
_desc = desc;
|
||||
_cost = cost;
|
||||
_gemCost = gemCost;
|
||||
_skin = skin;
|
||||
|
||||
//Make Stack
|
||||
_stack = new ItemStack(skin);
|
||||
fixStackName();
|
||||
}
|
||||
|
||||
public StrikeItemType getType()
|
||||
{
|
||||
return _type;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
|
||||
public String[] getDesc()
|
||||
{
|
||||
return _desc;
|
||||
}
|
||||
|
||||
public int getCost()
|
||||
{
|
||||
return _cost;
|
||||
}
|
||||
|
||||
public int getGemCost()
|
||||
{
|
||||
return _gemCost;
|
||||
}
|
||||
|
||||
public Material getSkin()
|
||||
{
|
||||
return _skin;
|
||||
}
|
||||
|
||||
public void drop(MineStrike game, Player player, boolean natural)
|
||||
{
|
||||
Entity ent;
|
||||
|
||||
if (natural)
|
||||
{
|
||||
ent = player.getWorld().dropItemNaturally(player.getEyeLocation(), _stack);
|
||||
}
|
||||
else
|
||||
{
|
||||
ent = player.getWorld().dropItem(player.getEyeLocation(), _stack);
|
||||
UtilAction.velocity(ent, player.getLocation().getDirection(), 0.4, false, 0, 0.1, 1, false);
|
||||
}
|
||||
|
||||
if (this instanceof Gun)
|
||||
{
|
||||
game.deregisterGun((Gun)this);
|
||||
game.registerDroppedGun(ent, (Gun)this);
|
||||
}
|
||||
|
||||
else if (this instanceof Grenade)
|
||||
{
|
||||
game.deregisterGrenade((Grenade)this);
|
||||
game.registerDroppedGrenade(ent, (Grenade)this);
|
||||
}
|
||||
}
|
||||
|
||||
public ItemStack getStack()
|
||||
{
|
||||
return _stack;
|
||||
}
|
||||
|
||||
public void setStack(ItemStack stack)
|
||||
{
|
||||
_stack = stack;
|
||||
}
|
||||
|
||||
public boolean isHolding(Player player)
|
||||
{
|
||||
return UtilGear.isMat(player.getItemInHand(), _skin);
|
||||
}
|
||||
|
||||
public boolean isStack(ItemStack stack)
|
||||
{
|
||||
return UtilGear.isMat(stack, _skin);
|
||||
}
|
||||
|
||||
public void giveToPlayer(Player player, int slot)
|
||||
{
|
||||
fixStackName();
|
||||
|
||||
player.getInventory().setItem(slot, getStack());
|
||||
|
||||
UtilPlayer.message(player, F.main("Game", "You equipped " + getName() + "."));
|
||||
|
||||
player.getWorld().playSound(player.getLocation(), Sound.ITEM_PICKUP, 1.5f, 1f);
|
||||
}
|
||||
|
||||
public void fixStackName()
|
||||
{
|
||||
ItemMeta meta = _stack.getItemMeta();
|
||||
meta.setDisplayName(C.Bold + getName());
|
||||
_stack.setItemMeta(meta);
|
||||
}
|
||||
|
||||
public abstract boolean pickup(MineStrike game, Player player);
|
||||
|
||||
public ItemStack getShopItem(int money, boolean alreadyHas)
|
||||
{
|
||||
ArrayList<String> lore = new ArrayList<String>();
|
||||
|
||||
for (String cur : _desc)
|
||||
lore.add(C.cWhite + cur);
|
||||
|
||||
//Custom (Gun Stats)
|
||||
if (getShopItemCustom().length > 0)
|
||||
{
|
||||
lore.add(" ");
|
||||
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");
|
||||
|
||||
}
|
||||
|
||||
String[] loreArray = new String[lore.size()];
|
||||
loreArray = lore.toArray(loreArray);
|
||||
|
||||
String name = getShopItemType() + " " + C.cGreen + getName();
|
||||
|
||||
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 "";
|
||||
}
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
package nautilus.game.arcade.game.games.minestrike.items;
|
||||
|
||||
public enum StrikeItemType
|
||||
{
|
||||
PRIMARY_WEAPON,
|
||||
SECONDARY_WEAPON,
|
||||
GRENADE,
|
||||
EQUIPMENT,
|
||||
ARMOR
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
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;
|
||||
import nautilus.game.arcade.game.games.minestrike.items.StrikeItem;
|
||||
import nautilus.game.arcade.game.games.minestrike.items.StrikeItemType;
|
||||
|
||||
public class DefusalKit extends StrikeItem
|
||||
{
|
||||
public DefusalKit()
|
||||
{
|
||||
super(StrikeItemType.EQUIPMENT, "Defusal Kit", new String[]
|
||||
{
|
||||
"Halves the time it takes to defuse."
|
||||
},
|
||||
400, 0, Material.SHEARS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean pickup(MineStrike game, Player player)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public void giveToPlayer(Player player, int slot)
|
||||
{
|
||||
fixStackName();
|
||||
|
||||
player.getInventory().setItem(slot, getStack());
|
||||
|
||||
UtilPlayer.message(player, F.main("Game", "You equipped " + getName() + "."));
|
||||
|
||||
player.getWorld().playSound(player.getLocation(), Sound.HORSE_ARMOR, 1.5f, 1f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getShopItemType()
|
||||
{
|
||||
return C.cDGreen + C.Bold + "Equipment" + ChatColor.RESET;
|
||||
}
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
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;
|
||||
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;
|
||||
import nautilus.game.arcade.game.games.minestrike.items.StrikeItem;
|
||||
import nautilus.game.arcade.game.games.minestrike.items.StrikeItemType;
|
||||
|
||||
public class Helmet extends StrikeItem
|
||||
{
|
||||
public Helmet()
|
||||
{
|
||||
super(StrikeItemType.EQUIPMENT, "Helmet", new String[]
|
||||
{
|
||||
"Reduces damage from headshots"
|
||||
},
|
||||
350, 0, Material.LEATHER_HELMET);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean pickup(MineStrike game, Player player)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public void giveToPlayer(Player player, Color color)
|
||||
{
|
||||
ItemStack armor = new ItemStack(getSkin());
|
||||
LeatherArmorMeta meta = (LeatherArmorMeta)armor.getItemMeta();
|
||||
meta.setColor(color);
|
||||
meta.setDisplayName(getName());
|
||||
armor.setItemMeta(meta);
|
||||
player.getInventory().setHelmet(armor);
|
||||
|
||||
UtilPlayer.message(player, F.main("Game", "You equipped " + getName() + "."));
|
||||
|
||||
player.getWorld().playSound(player.getLocation(), Sound.HORSE_ARMOR, 1f, 1f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getShopItemType()
|
||||
{
|
||||
return C.cDGreen + C.Bold + "Armor" + ChatColor.RESET;
|
||||
}
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
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;
|
||||
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;
|
||||
import nautilus.game.arcade.game.games.minestrike.items.StrikeItem;
|
||||
import nautilus.game.arcade.game.games.minestrike.items.StrikeItemType;
|
||||
|
||||
public class Kevlar extends StrikeItem
|
||||
{
|
||||
public Kevlar()
|
||||
{
|
||||
super(StrikeItemType.EQUIPMENT, "Kevlar Vest", new String[]
|
||||
{
|
||||
"Reduces damage from bullets"
|
||||
},
|
||||
650, 0, Material.LEATHER_CHESTPLATE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean pickup(MineStrike game, Player player)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
public void giveToPlayer(Player player, Color color)
|
||||
{
|
||||
ItemStack armor = new ItemStack(getSkin());
|
||||
LeatherArmorMeta meta = (LeatherArmorMeta)armor.getItemMeta();
|
||||
meta.setColor(color);
|
||||
meta.setDisplayName(getName());
|
||||
armor.setItemMeta(meta);
|
||||
player.getInventory().setChestplate(armor);
|
||||
|
||||
UtilPlayer.message(player, F.main("Game", "You equipped " + getName() + "."));
|
||||
|
||||
player.getWorld().playSound(player.getLocation(), Sound.HORSE_ARMOR, 1f, 1f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getShopItemType()
|
||||
{
|
||||
return C.cDGreen + C.Bold + "Armor" + ChatColor.RESET;
|
||||
}
|
||||
}
|
@ -0,0 +1,80 @@
|
||||
package nautilus.game.arcade.game.games.minestrike.items.grenades;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilFirework;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import nautilus.game.arcade.game.games.minestrike.MineStrike;
|
||||
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.FireworkEffect;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.FireworkEffect.Type;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class FlashBang extends Grenade
|
||||
{
|
||||
public FlashBang()
|
||||
{
|
||||
super("Flash Bang", new String[]
|
||||
{
|
||||
|
||||
},
|
||||
200, 0, Material.CARROT_ITEM, 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateCustom(MineStrike game, Entity ent)
|
||||
{
|
||||
if (ent.getTicksLived() > 40)
|
||||
{
|
||||
FireworkEffect effect = FireworkEffect.builder().flicker(true).withColor(Color.WHITE).with(Type.BALL_LARGE).trail(false).build();
|
||||
UtilFirework.playFirework(ent.getLocation().add(0, 0.5, 0), effect);
|
||||
|
||||
HashMap<Player, Double> players = UtilPlayer.getInRadius(ent.getLocation(), 48);
|
||||
for (Player player : players.keySet())
|
||||
{
|
||||
if (!game.IsAlive(player))
|
||||
continue;
|
||||
|
||||
//Line of Sight
|
||||
Location loc = player.getEyeLocation();
|
||||
|
||||
boolean sight = true;
|
||||
while (UtilMath.offset(loc, ent.getLocation()) > 0.5)
|
||||
{
|
||||
if (UtilBlock.solid(loc.getBlock()))
|
||||
{
|
||||
sight = false;
|
||||
break;
|
||||
}
|
||||
|
||||
loc.add(UtilAlg.getTrajectory(loc, ent.getLocation()).multiply(0.2));
|
||||
}
|
||||
|
||||
if (!sight)
|
||||
continue;
|
||||
|
||||
//Calculate if player is looking away
|
||||
Location eyeToGrenade = player.getEyeLocation().add(UtilAlg.getTrajectory(player.getEyeLocation(), ent.getLocation()));
|
||||
double flashIntensity = 2 - UtilMath.offset(player.getEyeLocation().add(player.getLocation().getDirection()), eyeToGrenade);
|
||||
|
||||
//Duration
|
||||
double duration = (2 + (3 * (players.get(player)))) * flashIntensity;
|
||||
duration += 1;
|
||||
|
||||
//Blind
|
||||
game.Manager.GetCondition().Factory().Blind(getName(), player, _thrower, duration, 0, false, false, false);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
@ -0,0 +1,198 @@
|
||||
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;
|
||||
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;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import nautilus.game.arcade.game.games.minestrike.MineStrike;
|
||||
import nautilus.game.arcade.game.games.minestrike.items.StrikeItem;
|
||||
import nautilus.game.arcade.game.games.minestrike.items.StrikeItemType;
|
||||
|
||||
public abstract class Grenade extends StrikeItem
|
||||
{
|
||||
protected Player _thrower = null;
|
||||
|
||||
protected Vector _vel;
|
||||
protected Location _lastLoc;
|
||||
protected ArrayList<Vector> _velHistory = new ArrayList<Vector>();
|
||||
|
||||
protected int _limit;
|
||||
|
||||
public Grenade(String name, String[] desc, int cost, int gemCost, Material skin, int limit)
|
||||
{
|
||||
super(StrikeItemType.GRENADE, name, desc, cost, gemCost, skin);
|
||||
|
||||
_limit = limit;
|
||||
}
|
||||
|
||||
public boolean giveToPlayer(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;
|
||||
|
||||
giveToPlayer(player, slot);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
_thrower = player;
|
||||
|
||||
Entity ent = player.getWorld().dropItem(player.getEyeLocation().add(player.getLocation().getDirection()), getStack());
|
||||
|
||||
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();
|
||||
_velHistory.add(_vel);
|
||||
_lastLoc = ent.getLocation();
|
||||
|
||||
UtilPlayer.message(player, F.main("Game", "You threw " + getName() + "."));
|
||||
|
||||
game.registerThrownGrenade(ent, this);
|
||||
game.deregisterGrenade(this);
|
||||
}
|
||||
|
||||
public boolean update(MineStrike game, Entity ent)
|
||||
{
|
||||
//Invalid
|
||||
if (!ent.isValid())
|
||||
return true;
|
||||
|
||||
//Rebound Off Blocks
|
||||
rebound(ent);
|
||||
|
||||
//Custom
|
||||
if (updateCustom(game, ent))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void rebound(Entity ent)
|
||||
{
|
||||
if (UtilEnt.isGrounded(ent) || ent.getVelocity().length() < 0.1 || ent.getTicksLived() < 4)
|
||||
return;
|
||||
|
||||
/*
|
||||
* What we must do here, is record the velocity every tick.
|
||||
* Then when it collides, we get the velocity from a few ticks before and apply it, reversing the direction of collision.
|
||||
* We record history because as soon as it collides the collision direction is set to 0.
|
||||
*/
|
||||
|
||||
//X Rebound
|
||||
if ((_vel.getX() > 0 && ent.getLocation().getX() - _lastLoc.getX() <= 0) ||
|
||||
(_vel.getX() < 0 && ent.getLocation().getX() - _lastLoc.getX() >= 0))
|
||||
{
|
||||
_vel = _velHistory.get(0);
|
||||
_vel.setX(-_vel.getX());
|
||||
_vel.multiply(0.75);
|
||||
|
||||
ent.setVelocity(_vel);
|
||||
|
||||
ent.getWorld().playSound(ent.getLocation(), Sound.ZOMBIE_WOOD, 1f, 2f);
|
||||
}
|
||||
|
||||
//Z Rebound
|
||||
else if ((_vel.getZ() > 0 && ent.getLocation().getZ() - _lastLoc.getZ() <= 0) ||
|
||||
(_vel.getZ() < 0 && ent.getLocation().getZ() - _lastLoc.getZ() >= 0))
|
||||
{
|
||||
_vel = _velHistory.get(0);
|
||||
_vel.setZ(-_vel.getZ());
|
||||
_vel.multiply(0.75);
|
||||
|
||||
ent.setVelocity(_vel);
|
||||
|
||||
ent.getWorld().playSound(ent.getLocation(), Sound.ZOMBIE_WOOD, 1f, 2f);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
_velHistory.add(ent.getVelocity());
|
||||
|
||||
while (_velHistory.size() > 4)
|
||||
_velHistory.remove(0);
|
||||
}
|
||||
|
||||
_lastLoc = ent.getLocation();
|
||||
}
|
||||
|
||||
public abstract boolean updateCustom(MineStrike game, Entity ent);
|
||||
|
||||
@Override
|
||||
public boolean pickup(MineStrike game, Player player)
|
||||
{
|
||||
if (giveToPlayer(player))
|
||||
{
|
||||
game.registerGrenade(this, player);
|
||||
game.deregisterDroppedGrenade(this);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getShopItemType()
|
||||
{
|
||||
return C.cDGreen + C.Bold + "Grenade" + ChatColor.RESET;
|
||||
}
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
package nautilus.game.arcade.game.games.minestrike.items.grenades;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import nautilus.game.arcade.game.games.minestrike.MineStrike;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
|
||||
public class HighExplosive extends Grenade
|
||||
{
|
||||
public HighExplosive()
|
||||
{
|
||||
super("HE Grenade", new String[]
|
||||
{
|
||||
|
||||
},
|
||||
300, 0, Material.APPLE, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateCustom(MineStrike game, Entity ent)
|
||||
{
|
||||
if (ent.getTicksLived() > 40)
|
||||
{
|
||||
UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION,
|
||||
ent.getLocation(), 0, 0, 0, 0, 1);
|
||||
ent.getWorld().playSound(ent.getLocation(),
|
||||
Sound.EXPLODE, 3f, 0.8f);
|
||||
|
||||
HashMap<Player, Double> players = UtilPlayer.getInRadius(
|
||||
ent.getLocation(), 8);
|
||||
for (Player player : players.keySet())
|
||||
{
|
||||
if (!game.IsAlive(player))
|
||||
continue;
|
||||
|
||||
// Damage Event
|
||||
game.Manager.GetDamage().NewDamageEvent(player, _thrower, null,
|
||||
DamageCause.CUSTOM, 1 + (players.get(player) * 18),
|
||||
true, true, false, _thrower.getName(), getName());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
package nautilus.game.arcade.game.games.minestrike.items.grenades;
|
||||
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import nautilus.game.arcade.game.games.minestrike.MineStrike;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Entity;
|
||||
|
||||
public class Smoke extends Grenade
|
||||
{
|
||||
public Smoke()
|
||||
{
|
||||
super("Smoke Grenade", new String[]
|
||||
{
|
||||
|
||||
},
|
||||
300, 0, Material.POTATO_ITEM, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateCustom(MineStrike game, Entity ent)
|
||||
{
|
||||
if (ent.getTicksLived() > 60)
|
||||
{
|
||||
UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION, ent.getLocation(), 0, 0, 0, 0, 1);
|
||||
|
||||
ent.getWorld().playSound(ent.getLocation(), Sound.FIZZ, 0.1f, 0.1f);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return ent.getTicksLived() > 360;
|
||||
}
|
||||
}
|
@ -0,0 +1,367 @@
|
||||
package nautilus.game.arcade.game.games.minestrike.items.guns;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.recharge.RechargedEvent;
|
||||
import nautilus.game.arcade.game.games.minestrike.MineStrike;
|
||||
import nautilus.game.arcade.game.games.minestrike.data.Bullet;
|
||||
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.guns.rifle.AWP;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Snowball;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public abstract class Gun extends StrikeItem
|
||||
{
|
||||
protected GunType _gunType;
|
||||
protected int _slot;
|
||||
|
||||
//Stats
|
||||
protected int _clipSize;
|
||||
protected int _clipReserve;
|
||||
protected long _fireRate;
|
||||
protected long _reloadTime;
|
||||
protected double _damage;
|
||||
protected double _dropOffPerBlock;
|
||||
protected double _bulletSpeed;
|
||||
protected Sound _fireSound;
|
||||
|
||||
protected double _coneMin;
|
||||
protected double _coneMax;
|
||||
protected double _coneReduceRate;
|
||||
protected double _coneIncreaseRate;
|
||||
|
||||
|
||||
//Active Data
|
||||
protected int _loadedAmmo;
|
||||
protected int _reserveAmmo;
|
||||
protected double _cone;
|
||||
protected double _lastMove;
|
||||
protected long _lastMoveTime;
|
||||
|
||||
public Gun(StrikeItemType type, GunType gunType, String name, String[] desc,
|
||||
int cost, int gemCost,
|
||||
int clipSize, int clipReserve,
|
||||
long fireRate, long reloadTime,
|
||||
double damage, double dropOffPerBlock, double bulletSpeed,
|
||||
double coneMin, double coneMax,
|
||||
double coneIncrease, double coneReduce,
|
||||
Material skin, Sound sound)
|
||||
{
|
||||
super(type, name, desc, cost, gemCost, skin);
|
||||
|
||||
_gunType = gunType;
|
||||
|
||||
if (type == StrikeItemType.PRIMARY_WEAPON)
|
||||
_slot = 0;
|
||||
else
|
||||
_slot = 1;
|
||||
|
||||
_clipSize = clipSize;
|
||||
_clipReserve = clipReserve;
|
||||
_fireRate = fireRate;
|
||||
_reloadTime = reloadTime;
|
||||
_damage = damage;
|
||||
_dropOffPerBlock = dropOffPerBlock;
|
||||
_bulletSpeed = bulletSpeed;
|
||||
|
||||
_fireSound = sound;
|
||||
|
||||
_coneMin = coneMin;
|
||||
_coneMax = coneMax;
|
||||
_coneIncreaseRate = coneIncrease;
|
||||
_coneReduceRate = coneReduce;
|
||||
_cone = _coneMin;
|
||||
|
||||
_loadedAmmo = clipSize;
|
||||
_reserveAmmo = clipReserve * clipSize;
|
||||
|
||||
updateWeaponName(null);
|
||||
}
|
||||
|
||||
public void shoot(final Player player, final MineStrike game)
|
||||
{
|
||||
//Standard (300) RPM
|
||||
shootOnce(player, game);
|
||||
|
||||
//600RPM
|
||||
if (_fireRate <= 100 && _fireRate > 50)
|
||||
{
|
||||
UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(game.Manager.GetPlugin(), new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
shootOnce(player, game);
|
||||
}
|
||||
}, 2);
|
||||
}
|
||||
|
||||
//1200RPM
|
||||
if (_fireRate <= 50)
|
||||
{
|
||||
for (int i=1 ; i<4 ; i++)
|
||||
{
|
||||
UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(game.Manager.GetPlugin(), new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
shootOnce(player, game);
|
||||
}
|
||||
}, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void shootOnce(Player player, MineStrike game)
|
||||
{
|
||||
//Check Ammo
|
||||
if (!ammoCheck(player))
|
||||
return;
|
||||
|
||||
if (!Recharge.Instance.use(player, getName() + " Shoot", _fireRate, false, false))
|
||||
return;
|
||||
|
||||
//Use Ammo
|
||||
_loadedAmmo--;
|
||||
updateWeaponName(player);
|
||||
|
||||
//Effect
|
||||
soundFire(player.getLocation());
|
||||
UtilParticle.PlayParticle(ParticleType.CLOUD, player.getEyeLocation().add(player.getLocation().getDirection().multiply(1.5)), 0, 0, 0, 0, 1);
|
||||
|
||||
game.registerBullet(fireBullet(player));
|
||||
}
|
||||
|
||||
public Bullet fireBullet(Player player)
|
||||
{
|
||||
//Shoot
|
||||
Snowball ball = player.launchProjectile(Snowball.class);
|
||||
|
||||
//COF
|
||||
double cone = getCone(player);
|
||||
|
||||
//Calc
|
||||
Vector cof = new Vector(Math.random() - 0.5, (Math.random() - 0.2) * (5d/8d), Math.random() - 0.5);
|
||||
cof.normalize();
|
||||
cof.multiply(cone);
|
||||
|
||||
cof.add(player.getLocation().getDirection());
|
||||
cof.normalize();
|
||||
|
||||
ball.setVelocity(cof.multiply(_bulletSpeed));
|
||||
|
||||
//Increase COF
|
||||
_cone = Math.min(_coneMax, _cone + _coneIncreaseRate);
|
||||
|
||||
return new Bullet(ball, this, player.getEyeLocation());
|
||||
}
|
||||
|
||||
public double getCone(Player player)
|
||||
{
|
||||
double cone = _cone;
|
||||
|
||||
//Move Penalty
|
||||
if (!UtilTime.elapsed(_lastMoveTime, 75))
|
||||
cone += _lastMove * _gunType.getMovePenalty();
|
||||
|
||||
//Sprint Penalty
|
||||
if (player.isSprinting())
|
||||
cone += _gunType.getSprintPenalty();
|
||||
|
||||
//Airborne Penalty
|
||||
else if (!UtilEnt.isGrounded(player))
|
||||
cone += _gunType.getJumpPenalty();
|
||||
|
||||
//Crouch
|
||||
else if (player.isSneaking() && _gunType != GunType.SNIPER)
|
||||
cone = cone * 0.8;
|
||||
|
||||
|
||||
//Sniper Zoomed
|
||||
if (_gunType == GunType.SNIPER)
|
||||
{
|
||||
if (player.isSneaking())
|
||||
{
|
||||
cone -= _cone;
|
||||
}
|
||||
}
|
||||
|
||||
return cone;
|
||||
}
|
||||
|
||||
public boolean ammoCheck(Player player)
|
||||
{
|
||||
if (_loadedAmmo > 0)
|
||||
return true;
|
||||
|
||||
//Sound
|
||||
if (Recharge.Instance.use(player, getName() + " Ammo Tick", 200, false, false))
|
||||
soundEmpty(player.getLocation());
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void reload(Player player)
|
||||
{
|
||||
if (_loadedAmmo == _clipSize)
|
||||
return;
|
||||
|
||||
int ammo = _reserveAmmo + _loadedAmmo;
|
||||
|
||||
if (ammo == 0)
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Gun", "You have no ammo for " + F.name(getName()) + "."));
|
||||
return;
|
||||
}
|
||||
|
||||
_loadedAmmo = Math.min(ammo, _clipSize);
|
||||
_reserveAmmo = Math.max(0, ammo - _clipSize);
|
||||
|
||||
//Recharge
|
||||
Recharge.Instance.useForce(player, getName() + " Shoot", _reloadTime);
|
||||
Recharge.Instance.use(player, getName() + " Reload", _reloadTime, false, true);
|
||||
|
||||
//Sound
|
||||
soundReload(player.getLocation());
|
||||
|
||||
//Update
|
||||
updateWeaponName(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fixStackName()
|
||||
{
|
||||
updateWeaponName(null);
|
||||
}
|
||||
|
||||
public void updateWeaponName(Player player)
|
||||
{
|
||||
ItemMeta meta = getStack().getItemMeta();
|
||||
meta.setDisplayName(C.Bold + getName() + ChatColor.RESET + " " + C.cGreen + _loadedAmmo + ChatColor.RESET + " / " + C.cYellow + _reserveAmmo);
|
||||
getStack().setItemMeta(meta);
|
||||
|
||||
if (player != null)
|
||||
player.getInventory().setItem(_slot, getStack());
|
||||
}
|
||||
|
||||
public double getDamage()
|
||||
{
|
||||
return _damage;
|
||||
}
|
||||
|
||||
public double getDropOff()
|
||||
{
|
||||
return _dropOffPerBlock;
|
||||
}
|
||||
|
||||
public void soundFire(Location loc)
|
||||
{
|
||||
loc.getWorld().playSound(loc, _fireSound, 3f, (float)(Math.random() * 0.2 + 0.9));
|
||||
}
|
||||
|
||||
public void soundEmpty(Location loc)
|
||||
{
|
||||
loc.getWorld().playSound(loc, Sound.NOTE_STICKS, 1f, 2f);
|
||||
loc.getWorld().playSound(loc, Sound.NOTE_STICKS, 1f, 2f);
|
||||
loc.getWorld().playSound(loc, Sound.NOTE_STICKS, 1f, 2f);
|
||||
}
|
||||
|
||||
public void soundReload(Location loc)
|
||||
{
|
||||
loc.getWorld().playSound(loc, Sound.PISTON_RETRACT, 1f, 0.8f);
|
||||
}
|
||||
|
||||
public void soundReloaded(Location loc)
|
||||
{
|
||||
loc.getWorld().playSound(loc, Sound.PISTON_EXTEND, 1f, 1.6f);
|
||||
}
|
||||
|
||||
public void soundRefire(Location loc)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void giveToPlayer(Player player)
|
||||
{
|
||||
giveToPlayer(player, _slot);
|
||||
}
|
||||
|
||||
public int getSlot()
|
||||
{
|
||||
return _slot;
|
||||
}
|
||||
|
||||
public void moveEvent(PlayerMoveEvent event)
|
||||
{
|
||||
double dist = UtilMath.offset(event.getFrom(), event.getTo());
|
||||
|
||||
_lastMove = dist;
|
||||
_lastMoveTime = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
public void reduceCone()
|
||||
{
|
||||
_cone = Math.max(_coneMin, _cone - (_coneReduceRate / 20d));
|
||||
}
|
||||
|
||||
public void reloadEvent(RechargedEvent event)
|
||||
{
|
||||
if (!isHolding(event.GetPlayer()))
|
||||
return;
|
||||
|
||||
if (event.GetAbility().equals(getName() + " Shoot"))
|
||||
{
|
||||
soundRefire(event.GetPlayer().getEyeLocation());
|
||||
}
|
||||
else if (event.GetAbility().equals(getName() + " Reload"))
|
||||
{
|
||||
soundReloaded(event.GetPlayer().getEyeLocation());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean pickup(MineStrike game, Player player)
|
||||
{
|
||||
if (player.getInventory().getItem(_slot) != null && player.getInventory().getItem(_slot).getType() != Material.AIR)
|
||||
return false;
|
||||
|
||||
giveToPlayer(player);
|
||||
|
||||
game.registerGun(this, player);
|
||||
game.deregisterDroppedGun(this);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void restockAmmo(Player player)
|
||||
{
|
||||
_loadedAmmo = _clipSize;
|
||||
_reserveAmmo = _clipReserve * _clipSize;
|
||||
|
||||
updateWeaponName(player);
|
||||
|
||||
player.setHealth(20);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getShopItemType()
|
||||
{
|
||||
return C.cDGreen + C.Bold + _gunType.getName() + ChatColor.RESET;
|
||||
}
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
package nautilus.game.arcade.game.games.minestrike.items.guns;
|
||||
|
||||
public enum GunType
|
||||
{
|
||||
|
||||
|
||||
PISTOL("Pistol", 0.06, 0.04, 0.08),
|
||||
SHOTGUN("Shotgun", 0, 0, 0),
|
||||
SMG("SMG", 0.08, 0.05, 0.1),
|
||||
RIFLE("Rifle", 0.1, 0.06, 0.12),
|
||||
|
||||
SNIPER("Sniper Rifle", 0.16, 0.08, 0.16);
|
||||
|
||||
private String _name;
|
||||
|
||||
private double _movePenalty;
|
||||
private double _sprintPentalty;
|
||||
private double _jumpPenalty;
|
||||
|
||||
GunType(String name, double move, double sprint, double jump)
|
||||
{
|
||||
_name = name;
|
||||
_movePenalty = move;
|
||||
_sprintPentalty = sprint;
|
||||
_jumpPenalty = jump;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
|
||||
public double getMovePenalty()
|
||||
{
|
||||
return _movePenalty;
|
||||
}
|
||||
|
||||
public double getSprintPenalty()
|
||||
{
|
||||
return _sprintPentalty;
|
||||
}
|
||||
|
||||
public double getJumpPenalty()
|
||||
{
|
||||
return _jumpPenalty;
|
||||
}
|
||||
}
|
@ -0,0 +1,74 @@
|
||||
package nautilus.game.arcade.game.games.minestrike.items.guns;
|
||||
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import nautilus.game.arcade.game.games.minestrike.MineStrike;
|
||||
import nautilus.game.arcade.game.games.minestrike.items.StrikeItemType;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.player.PlayerMoveEvent;
|
||||
|
||||
public abstract class Shotgun extends Gun
|
||||
{
|
||||
private int _pellets;
|
||||
|
||||
public Shotgun(StrikeItemType type, String name, String[] desc,
|
||||
int cost, int gemCost,
|
||||
int clipSize, int spareAmmo,
|
||||
long fireRate, long reloadTime, double damage,
|
||||
double dropOffPerBlock, double bulletSpeed, double coneMin,
|
||||
double coneMax, double coneIncrease, double coneReduce,
|
||||
Material skin, Sound sound, int pellets)
|
||||
{
|
||||
super(type, GunType.SHOTGUN, name, desc, cost, gemCost, clipSize, spareAmmo, fireRate, reloadTime, damage,
|
||||
dropOffPerBlock, bulletSpeed, coneMin, coneMax, coneIncrease,
|
||||
coneReduce, skin, sound);
|
||||
|
||||
_pellets = pellets;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void shoot(Player player, MineStrike game)
|
||||
{
|
||||
//Check Ammo
|
||||
if (!ammoCheck(player))
|
||||
return;
|
||||
|
||||
if (!Recharge.Instance.use(player, getName() + " Shoot", _fireRate, false, false))
|
||||
return;
|
||||
|
||||
//Use Ammo
|
||||
_loadedAmmo--;
|
||||
updateWeaponName(player);
|
||||
|
||||
//Effect
|
||||
soundFire(player.getLocation());
|
||||
UtilParticle.PlayParticle(ParticleType.CLOUD, player.getEyeLocation().add(player.getLocation().getDirection().multiply(1.5)), 0, 0, 0, 0, 1);
|
||||
|
||||
for (int i=0 ; i<_pellets ; i++)
|
||||
game.registerBullet(fireBullet(player));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void soundRefire(Location loc)
|
||||
{
|
||||
loc.getWorld().playSound(loc, Sound.PISTON_RETRACT, 0.8f, 1.2f);
|
||||
loc.getWorld().playSound(loc, Sound.PISTON_RETRACT, 0.8f, 1.2f);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getCone(Player player)
|
||||
{
|
||||
return _cone;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void moveEvent(PlayerMoveEvent event)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package nautilus.game.arcade.game.games.minestrike.items.guns.pistol;
|
||||
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
|
||||
import nautilus.game.arcade.game.games.minestrike.items.StrikeItemType;
|
||||
import nautilus.game.arcade.game.games.minestrike.items.guns.Gun;
|
||||
import nautilus.game.arcade.game.games.minestrike.items.guns.GunType;
|
||||
|
||||
public class CZ75 extends Gun
|
||||
{
|
||||
public CZ75()
|
||||
{
|
||||
super(StrikeItemType.SECONDARY_WEAPON, GunType.PISTOL, "CZ75-Auto", new String[]
|
||||
{
|
||||
|
||||
},
|
||||
300, 0, //Cost, Gem Cost
|
||||
12, 1, //Clip Size, Spare Ammo
|
||||
80, 2700, //ROF, Reload Time
|
||||
6, 0.01, 3, //Damage, Dropoff, Bullet Speed
|
||||
0, 0.15, //COF Min, COF Max
|
||||
0.06, 0.4, //COF Inc per Bullet, COF Dec per Second
|
||||
Material.IRON_HOE, Sound.ENDERMAN_DEATH);
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package nautilus.game.arcade.game.games.minestrike.items.guns.pistol;
|
||||
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
|
||||
import nautilus.game.arcade.game.games.minestrike.items.StrikeItemType;
|
||||
import nautilus.game.arcade.game.games.minestrike.items.guns.Gun;
|
||||
import nautilus.game.arcade.game.games.minestrike.items.guns.GunType;
|
||||
|
||||
public class Deagle extends Gun
|
||||
{
|
||||
public Deagle()
|
||||
{
|
||||
super(StrikeItemType.SECONDARY_WEAPON, GunType.PISTOL, "Desert Eagle", new String[]
|
||||
{
|
||||
|
||||
},
|
||||
800, 0, //Cost, Gem Cost
|
||||
7, 5, //Clip Size, Spare Ammo
|
||||
300, 2000, //ROF, Reload Time
|
||||
9, 0.01, 3, //Damage, Dropoff, Bullet Speed
|
||||
0, 0.2, //COF Min, COF Max
|
||||
0.12, 0.2, //COF Inc per Bullet, COF Dec per Second
|
||||
Material.GOLD_HOE, Sound.BAT_DEATH);
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package nautilus.game.arcade.game.games.minestrike.items.guns.pistol;
|
||||
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
|
||||
import nautilus.game.arcade.game.games.minestrike.items.StrikeItemType;
|
||||
import nautilus.game.arcade.game.games.minestrike.items.guns.Gun;
|
||||
import nautilus.game.arcade.game.games.minestrike.items.guns.GunType;
|
||||
|
||||
public class Glock18 extends Gun
|
||||
{
|
||||
public Glock18()
|
||||
{
|
||||
super(StrikeItemType.SECONDARY_WEAPON, GunType.PISTOL, "Glock 18", new String[]
|
||||
{
|
||||
|
||||
},
|
||||
0, 0, //Cost, Gem Cost
|
||||
20, 6, //Clip Size, Spare Ammo
|
||||
120, 2000, //ROF, Reload Time
|
||||
5, 0.01, 3, //Damage, Dropoff, Bullet Speed
|
||||
0, 0.15, //COF Min, COF Max
|
||||
0.08, 0.3, //COF Inc per Bullet, COF Dec per Second
|
||||
Material.STONE_HOE, Sound.BAT_LOOP);
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package nautilus.game.arcade.game.games.minestrike.items.guns.pistol;
|
||||
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
|
||||
import nautilus.game.arcade.game.games.minestrike.items.StrikeItemType;
|
||||
import nautilus.game.arcade.game.games.minestrike.items.guns.Gun;
|
||||
import nautilus.game.arcade.game.games.minestrike.items.guns.GunType;
|
||||
|
||||
public class P2000 extends Gun
|
||||
{
|
||||
public P2000()
|
||||
{
|
||||
super(StrikeItemType.SECONDARY_WEAPON, GunType.PISTOL, "P2000", new String[]
|
||||
{
|
||||
|
||||
},
|
||||
0, 0, //Cost, Gem Cost
|
||||
13, 4, //Clip Size, Spare Ammo
|
||||
130, 2200, //ROF, Reload Time
|
||||
6, 0.01, 3, //Damage, Dropoff, Bullet Speed
|
||||
0, 0.15, //COF Min, COF Max
|
||||
0.08, 0.3, //COF Inc per Bullet, COF Dec per Second
|
||||
Material.WOOD_HOE, Sound.GHAST_SCREAM2);
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package nautilus.game.arcade.game.games.minestrike.items.guns.rifle;
|
||||
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
|
||||
import nautilus.game.arcade.game.games.minestrike.items.StrikeItemType;
|
||||
import nautilus.game.arcade.game.games.minestrike.items.guns.Gun;
|
||||
import nautilus.game.arcade.game.games.minestrike.items.guns.GunType;
|
||||
|
||||
public class AK47 extends Gun
|
||||
{
|
||||
public AK47()
|
||||
{
|
||||
super(StrikeItemType.PRIMARY_WEAPON, GunType.RIFLE, "AK-47", new String[]
|
||||
{
|
||||
|
||||
},
|
||||
2700, 5000, //Cost, Gem Cost
|
||||
30, 3, //Clip Size, Spare Ammo
|
||||
80, 3600, //ROF, Reload Time
|
||||
7.5, 0.005, 3.5, //Damage, Dropoff, Bullet Speed
|
||||
0, 0.25, //COF Min, COF Max
|
||||
0.050, 0.4, //COF Inc per Bullet, COF Dec per Second
|
||||
Material.WOOD_SPADE, Sound.BURP);
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package nautilus.game.arcade.game.games.minestrike.items.guns.rifle;
|
||||
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
|
||||
import nautilus.game.arcade.game.games.minestrike.items.StrikeItemType;
|
||||
import nautilus.game.arcade.game.games.minestrike.items.guns.Gun;
|
||||
import nautilus.game.arcade.game.games.minestrike.items.guns.GunType;
|
||||
|
||||
public class AWP extends Gun
|
||||
{
|
||||
public AWP()
|
||||
{
|
||||
super(StrikeItemType.PRIMARY_WEAPON, GunType.SNIPER, "AWP", new String[]
|
||||
{
|
||||
|
||||
},
|
||||
4750, 5000, //Cost, Gem Cost
|
||||
10, 3, //Clip Size, Spare Ammo
|
||||
1500, 3600, //ROF, Reload Time
|
||||
30, 0.002, 4.4, //Damage, Dropoff, Bullet Speed
|
||||
0.05, 0.05, //COF Min, COF Max
|
||||
0, 0, //COF Inc per Bullet, COF Dec per Second
|
||||
Material.GOLD_SPADE, Sound.DRINK);
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package nautilus.game.arcade.game.games.minestrike.items.guns.rifle;
|
||||
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
|
||||
import nautilus.game.arcade.game.games.minestrike.items.StrikeItemType;
|
||||
import nautilus.game.arcade.game.games.minestrike.items.guns.Gun;
|
||||
import nautilus.game.arcade.game.games.minestrike.items.guns.GunType;
|
||||
|
||||
public class M4A1 extends Gun
|
||||
{
|
||||
public M4A1()
|
||||
{
|
||||
super(StrikeItemType.PRIMARY_WEAPON, GunType.RIFLE, "M4A4", new String[]
|
||||
{
|
||||
|
||||
},
|
||||
2900, 5000, //Cost, Gem Cost
|
||||
30, 3, //Clip Size, Spare Ammo
|
||||
80, 3600, //ROF, Reload Time
|
||||
7, 0.005, 3.5, //Damage, Dropoff, Bullet Speed
|
||||
0, 0.2, //COF Min, COF Max
|
||||
0.048, 0.4, //COF Inc per Bullet, COF Dec per Second
|
||||
Material.STONE_SPADE, Sound.BAT_TAKEOFF);
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package nautilus.game.arcade.game.games.minestrike.items.guns.shotgun;
|
||||
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
|
||||
import nautilus.game.arcade.game.games.minestrike.items.StrikeItemType;
|
||||
import nautilus.game.arcade.game.games.minestrike.items.guns.Shotgun;
|
||||
|
||||
public class Nova extends Shotgun
|
||||
{
|
||||
public Nova()
|
||||
{
|
||||
super(StrikeItemType.PRIMARY_WEAPON, "Nova", new String[]
|
||||
{
|
||||
|
||||
},
|
||||
1200, 5000, //Cost, Gem Cost
|
||||
8, 4, //Clip Size, Spare Ammo
|
||||
1000, 4000, //ROF, Reload Time
|
||||
5, 0.02, 2.5, //Damage, Dropoff, Bullet Speed
|
||||
0.15, 0.15, //COF Min, COF Max
|
||||
0, 0, //COF Inc per Bullet, COF Dec per Second
|
||||
Material.GOLD_AXE, Sound.BLAZE_DEATH, 9);
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package nautilus.game.arcade.game.games.minestrike.items.guns.smg;
|
||||
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
|
||||
import nautilus.game.arcade.game.games.minestrike.items.StrikeItemType;
|
||||
import nautilus.game.arcade.game.games.minestrike.items.guns.Gun;
|
||||
import nautilus.game.arcade.game.games.minestrike.items.guns.GunType;
|
||||
|
||||
public class P90 extends Gun
|
||||
{
|
||||
public P90()
|
||||
{
|
||||
super(StrikeItemType.PRIMARY_WEAPON, GunType.SMG, "P90", new String[]
|
||||
{
|
||||
|
||||
},
|
||||
2350, 5000, //Cost, Gem Cost
|
||||
50, 2, //Clip Size, Spare Ammo
|
||||
35, 2800, //ROF, Reload Time
|
||||
5, 0.01, 2.5, //Damage, Dropoff, Bullet Speed
|
||||
0, 0.2, //COF Min, COF Max
|
||||
0.03, 0.4, //COF Inc per Bullet, COF Dec per Second
|
||||
Material.STONE_AXE, Sound.CREEPER_DEATH);
|
||||
}
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
package nautilus.game.arcade.game.games.minestrike.kits;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
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 KitPlayer extends Kit
|
||||
{
|
||||
public KitPlayer(ArcadeManager manager)
|
||||
{
|
||||
super(manager, "Player", KitAvailability.Free,
|
||||
new String[]
|
||||
{
|
||||
C.cGreen + "Right-Click" + C.cWhite + " - " + C.cYellow + "Fire Gun",
|
||||
C.cGreen + "Left-Click" + C.cWhite + " - " + C.cYellow + "Reload Gun",
|
||||
C.cGreen + "Crouch" + C.cWhite + " - " + C.cYellow + "Sniper Scope",
|
||||
"",
|
||||
C.cGreen + "Hold Right-Click with Bomb" + C.cWhite + " - " + C.cRed + "Plant Bomb",
|
||||
C.cGreen + "Hold Right-Click with Knife" + C.cWhite + " - " + C.cAqua + "Defuse Bomb",
|
||||
},
|
||||
new Perk[]
|
||||
{
|
||||
|
||||
},
|
||||
EntityType.PLAYER,
|
||||
new ItemStack(Material.AIR));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void GiveItems(Player player)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void SpawnCustom(LivingEntity ent)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -278,18 +278,6 @@ public class SneakyAssassins extends SoloGame
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onHangingBreak(HangingBreakEvent event)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onHangingPlace(HangingPlaceEvent event)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onPlayerInteractHanging(PlayerInteractEntityEvent event)
|
||||
{
|
||||
@ -297,13 +285,6 @@ public class SneakyAssassins extends SoloGame
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onDamageHanging(EntityDamageEvent event)
|
||||
{
|
||||
if (event.getEntity() instanceof Hanging)
|
||||
event.setCancelled(true);
|
||||
}
|
||||
|
||||
@EventHandler(ignoreCancelled = true)
|
||||
public void onWitherEffectDamager(CustomDamageEvent event)
|
||||
{
|
||||
|
@ -187,10 +187,12 @@ public class Spleef extends SoloGame
|
||||
|
||||
public void BlockFade(Block block, Player player, boolean slowDamage)
|
||||
{
|
||||
if (block.getTypeId() == 7)
|
||||
return;
|
||||
|
||||
//Prevent Super Hunger from Bow
|
||||
if (Recharge.Instance.use(player, GetName() + " Hunger", 50, false, false))
|
||||
if (block.getTypeId() != 7)
|
||||
UtilPlayer.hunger(player, 1);
|
||||
UtilPlayer.hunger(player, 1);
|
||||
|
||||
if (!slowDamage)
|
||||
{
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
@ -253,7 +253,7 @@ public class GameFlagManager implements Listener
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.LOWEST)
|
||||
public void InventoryOpen(InventoryClickEvent event)
|
||||
public void InventoryClick(InventoryClickEvent event)
|
||||
{
|
||||
Game game = Manager.GetGame();
|
||||
if (game == null)
|
||||
@ -262,6 +262,10 @@ public class GameFlagManager implements Listener
|
||||
if (!game.InProgress())
|
||||
return;
|
||||
|
||||
Player player = UtilPlayer.searchExact(event.getWhoClicked().getName());
|
||||
if (player != null && !game.IsAlive(player))
|
||||
return;
|
||||
|
||||
if (game.InventoryClick)
|
||||
return;
|
||||
|
||||
@ -560,7 +564,7 @@ public class GameFlagManager implements Listener
|
||||
final Player player = event.getEntity();
|
||||
|
||||
//Visual
|
||||
Manager.GetCondition().Factory().Blind("Ghost", player, player, 1.5, 0, false, false, false);
|
||||
Manager.GetCondition().Factory().Blind("Ghost", player, player, 2, 0, false, false, false);
|
||||
|
||||
player.setFireTicks(0);
|
||||
player.setFallDistance(0);
|
||||
|
@ -108,7 +108,7 @@ public class GameManager implements Listener
|
||||
System.out.println("Game Load Expired.");
|
||||
game.SetState(GameState.Dead);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (game.GetState() == GameState.Recruit)
|
||||
{
|
||||
//Stop Countdown!
|
||||
|
@ -68,7 +68,6 @@ public class GamePlayerManager implements Listener
|
||||
event.GetLog().SetKillerColor(Manager.GetColor(player)+"");
|
||||
}
|
||||
|
||||
|
||||
if (event.GetEvent().getEntity() instanceof Player)
|
||||
{
|
||||
Player player = (Player)event.GetEvent().getEntity();
|
||||
|
Loading…
Reference in New Issue
Block a user