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

This commit is contained in:
CoderTim 2014-09-05 06:06:13 -04:00
commit 3830ab8e0f
40 changed files with 858 additions and 216 deletions

View File

@ -54,6 +54,12 @@ public class UtilInv
public static boolean contains(Player player, Material item, byte data, int required)
{
return contains(player, null, item, data, required);
}
public static boolean contains(Player player, String itemNameContains, Material item, byte data, int required)
{
for (int i : player.getInventory().all(item).keySet())
{
if (required <= 0)
@ -61,10 +67,21 @@ public class UtilInv
ItemStack stack = player.getInventory().getItem(i);
if (stack != null && stack.getAmount() > 0 && (stack.getData() == null || stack.getData().getData() == data))
{
required -= stack.getAmount();
}
if (stack == null)
continue;
if (stack.getAmount() <= 0)
continue;
if (data >=0 &&
stack.getData() != null && stack.getData().getData() != data)
continue;
if (itemNameContains != null &&
(stack.getItemMeta().getDisplayName() == null || !stack.getItemMeta().getDisplayName().contains(itemNameContains)))
continue;
required -= stack.getAmount();
}
if (required <= 0)
@ -196,10 +213,15 @@ public class UtilInv
public static boolean IsItem(ItemStack item, Material type, byte data)
{
return IsItem(item, type.getId(), data);
return IsItem(item, null, type.getId(), data);
}
public static boolean IsItem(ItemStack item, int id, byte data)
public static boolean IsItem(ItemStack item, String name, Material type, byte data)
{
return IsItem(item, name, type.getId(), data);
}
public static boolean IsItem(ItemStack item, String name, int id, byte data)
{
if (item == null)
return false;
@ -210,6 +232,9 @@ public class UtilInv
if (data != -1 && GetData(item) != data)
return false;
if (name != null && (item.getItemMeta().getDisplayName() == null || !item.getItemMeta().getDisplayName().contains(name)))
return false;
return true;
}
@ -247,12 +272,12 @@ public class UtilInv
{
boolean match = false;
if (IsItem(event.getCurrentItem(), type, data))
if (IsItem(event.getCurrentItem(), name, type, data))
match = true;
if (IsItem(event.getWhoClicked().getInventory().getItem(event.getHotbarButton()), type, data))
if (IsItem(event.getWhoClicked().getInventory().getItem(event.getHotbarButton()), name, type, data))
match = true;
if (!match)
return;
@ -266,10 +291,10 @@ public class UtilInv
if (event.getCurrentItem() == null)
return;
IsItem(event.getCurrentItem(), type, data);
IsItem(event.getCurrentItem(), name, type, data);
//Type
if (!IsItem(event.getCurrentItem(), type, data))
if (!IsItem(event.getCurrentItem(), name, type, data))
return;
//Inform
UtilPlayer.message(event.getWhoClicked(), F.main("Inventory", "You cannot move " + F.item(name) + "."));

View File

@ -54,7 +54,7 @@ import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilWorld;
import mineplex.core.treasure.TreasureManager;
import mineplex.core.treasure.TreasureManager;
import mineplex.minecraft.game.core.condition.ConditionManager;
import mineplex.core.cosmetic.CosmeticManager;
import mineplex.core.disguise.DisguiseManager;

View File

@ -109,7 +109,7 @@ public class CompassAddon extends MiniPlugin
" " + C.cWhite + C.Bold + "Distance: " + targetTeam.GetColor() + UtilMath.trim(1, bestDist) +
" " + C.cWhite + C.Bold + "Height: " + targetTeam.GetColor() + UtilMath.trim(1, heightDiff));
stack.setItemMeta(itemMeta);
player.getInventory().setItem(i, stack);
}
}

View File

@ -24,9 +24,9 @@ import org.bukkit.entity.Player;
public class GameTeam
{
private Game Host;
private double _respawnTime = 0;
public enum PlayerState
{
IN("In", ChatColor.GREEN),
@ -66,14 +66,14 @@ public class GameTeam
private int _spawnDistance = 0;
private boolean _visible = true;
//Records order players go out in
protected ArrayList<Player> _places = new ArrayList<Player>();
public GameTeam(Game host, String name, ChatColor color, ArrayList<Location> spawns)
{
Host = host;
_name = name;
_color = color;
_spawns = spawns;
@ -96,7 +96,7 @@ public class GameTeam
public Location GetSpawn()
{
// ArrayList<Location> valid = new ArrayList<Location>();
// ArrayList<Location> valid = new ArrayList<Location>();
Location best = null;
double bestDist = 0;
@ -119,14 +119,14 @@ public class GameTeam
bestDist = closestPlayer;
}
// if (closestPlayer > _spawnDistance * _spawnDistance)
// {
// valid.add(loc);
// }
// if (closestPlayer > _spawnDistance * _spawnDistance)
// {
// valid.add(loc);
// }
}
// if (valid.size() > 0)
// valid.get(UtilMath.r(valid.size()));
// if (valid.size() > 0)
// valid.get(UtilMath.r(valid.size()));
if (best != null)
return best;
@ -228,7 +228,7 @@ public class GameTeam
{
SpawnTeleport(true);
}
public void SpawnTeleport(boolean aliveOnly)
{
for (Player player : GetPlayers(aliveOnly))
@ -342,7 +342,7 @@ public class GameTeam
{
_respawnTime = i;
}
public double GetRespawnTime()
{
return _respawnTime;
@ -351,32 +351,33 @@ public class GameTeam
public void SetPlacement(Player player, PlayerState state)
{
if (state == PlayerState.OUT)
{
if (!_places.contains(player))
_places.add(0, player);
else
_places.remove(player);
_places.add(0, player);
}
else
_places.remove(player);
}
public ArrayList<Player> GetPlacements(boolean includeAlivePlayers)
{
if (includeAlivePlayers)
{
ArrayList<Player> placesClone = new ArrayList<Player>();
for (Player player : _places)
{
placesClone.add(player);
}
for (Player player : GetPlayers(true))
{
placesClone.add(0, player);
}
return placesClone;
}
return _places;
}
}

View File

@ -73,6 +73,7 @@ import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.events.PlayerPrepareTeleportEvent;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.TeamGame;
import nautilus.game.arcade.game.GameTeam.PlayerState;
import nautilus.game.arcade.game.games.hideseek.forms.BlockForm;
import nautilus.game.arcade.game.games.hideseek.forms.CreatureForm;
import nautilus.game.arcade.game.games.hideseek.forms.Form;
@ -958,6 +959,10 @@ public class HideSeek extends TeamGame
public void SetSeeker(Player player, boolean forced)
{
GameTeam pastTeam = GetTeam(player);
if (pastTeam != null && pastTeam.equals(_hiders))
pastTeam.SetPlacement(player, PlayerState.OUT);
SetPlayerTeam(player, _seekers, true);
Manager.GetDisguise().undisguise(player);
@ -1011,12 +1016,25 @@ public class HideSeek extends TeamGame
if (_hiders.GetPlayers(true).isEmpty())
{
SetState(GameState.End);
AnnounceEnd(_seekers);
ArrayList<Player> places = _hiders.GetPlacements(true);
AnnounceEnd(_hiders.GetPlacements(true));
//Gems
if (places.size() >= 1)
AddGems(places.get(0), 20, "1st Place", false);
if (places.size() >= 2)
AddGems(places.get(1), 15, "2nd Place", false);
if (places.size() >= 3)
AddGems(places.get(2), 10, "3rd Place", false);
for (Player player : GetPlayers(false))
if (player.isOnline())
AddGems(player, 10, "Participation", false);
SetState(GameState.End);
}
}
@ -1084,8 +1102,7 @@ public class HideSeek extends TeamGame
if (timeLeft <= 0)
{
WriteScoreboard();
SetState(GameState.End);
AnnounceEnd(_hiders);
for (Player player : _hiders.GetPlayers(true))
@ -1094,6 +1111,8 @@ public class HideSeek extends TeamGame
for (Player player : GetPlayers(false))
if (player.isOnline())
AddGems(player, 10, "Participation", false);
SetState(GameState.End);
}
}
}

View File

@ -22,6 +22,8 @@ import org.bukkit.entity.Item;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Painting;
import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile;
import org.bukkit.entity.Snowball;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.entity.EntityRegainHealthEvent;
@ -51,6 +53,7 @@ import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAction;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilEvent;
import mineplex.core.common.util.UtilGear;
@ -87,6 +90,7 @@ import nautilus.game.arcade.game.games.minestrike.items.StrikeItemType;
import nautilus.game.arcade.game.games.minestrike.items.equipment.armor.Armor;
import nautilus.game.arcade.game.games.minestrike.items.grenades.Grenade;
import nautilus.game.arcade.game.games.minestrike.items.guns.Gun;
import nautilus.game.arcade.game.games.minestrike.items.guns.GunType;
import nautilus.game.arcade.game.games.minestrike.items.guns.pistol.Glock18;
import nautilus.game.arcade.game.games.minestrike.items.guns.pistol.P2000;
import nautilus.game.arcade.game.games.minestrike.items.guns.rifle.AWP;
@ -104,8 +108,11 @@ public class MineStrike extends TeamGame
private int _roundsToWin = 10;
private long _roundTime = 120000;
private boolean _bulletInstant = true;
private boolean _debug = false;
private int _bulletInstant = 2; //0 = Slow, 1 = Instant, 2 = Mix
private boolean _customHitbox = true;
private boolean _bulletAlternate = false;
//Map Data
private ArrayList<Location> _bombSites;
@ -123,7 +130,7 @@ public class MineStrike extends TeamGame
private HashMap<Entity, Bullet> _bullets = new HashMap<Entity, Bullet>();
private HashMap<Entity, Grenade> _grenadesThrown = new HashMap<Entity, Grenade>();
private HashMap<Location, Long> _incendiary = new HashMap<Location, Long>();
private Bomb _bomb = null;
@ -177,16 +184,20 @@ public class MineStrike extends TeamGame
this._help = new String[]
{
"Tap Crouch when close to an ally to Boost",
//"Tap Crouch when close to an ally to Boost",
"Open Inventory at spawn to buy guns",
"Hold Right-Click to Plant Bomb",
"Hold Right-Click with knife to Defuse Bomb",
"Moving decreases accuracy",
"Sprinting heavily decreases accuracy",
"Jumping massively decreases accuracy",
"Crouching increases accuracy",
"Hold Right-Click to Plant Bomb",
"Hold Right-Click with knife to Defuse Bomb",
"Left-Click to roll Grenades",
"Right-Click to throw Grenades",
"Burst Fire for greater accuracy",
"Sniper Rifles are only accurate while scoped",
"Rifles have 30% recoil reduction while scoped",
"Pick up better weapons from dead players"
};
}
@ -228,7 +239,7 @@ public class MineStrike extends TeamGame
//Sneak
disguiseSneak(event.GetPlayer(), team);
//Armor
giveTeamArmor(event.GetPlayer(), Color.fromRGB(255, 0, 0));
}
@ -244,7 +255,7 @@ public class MineStrike extends TeamGame
//Sneak
disguiseSneak(event.GetPlayer(), team);
//Armor
giveTeamArmor(event.GetPlayer(), Color.fromRGB(0, 0, 255));
}
@ -441,7 +452,7 @@ public class MineStrike extends TeamGame
{
_grenadesThrown.put(ent, grenade);
}
public void registerIncendiary(Location loc, long endTime)
{
_incendiary.put(loc, endTime);
@ -652,7 +663,7 @@ public class MineStrike extends TeamGame
primaryDropped = true;
}
}
//Drop Remaining
boolean grenadeDropped = false;
for (StrikeItem item : toDrop)
@ -660,14 +671,14 @@ public class MineStrike extends TeamGame
//Record Primary Dropped
if (item.getType() == StrikeItemType.PRIMARY_WEAPON)
continue;
//Pistol
if (item.getType() == StrikeItemType.SECONDARY_WEAPON)
{
item.drop(this, player, true, primaryDropped);
continue;
}
//Grenade
if (item.getType() == StrikeItemType.GRENADE)
{
@ -675,7 +686,7 @@ public class MineStrike extends TeamGame
grenadeDropped = true;
continue;
}
//Other
item.drop(this, player, true, false);
}
@ -761,31 +772,106 @@ public class MineStrike extends TeamGame
gun.reduceCone();
}
}
@EventHandler
public void slowBulletHit(final ProjectileHitEvent event)
{
if (!(event.getEntity() instanceof Snowball))
return;
Bullet bullet = _bullets.get(event.getEntity());
//Particle
if (bullet != null && bullet.Shooter != null)
UtilParticle.PlayParticle(bullet.Shooter, ParticleType.FIREWORKS_SPARK, event.getEntity().getLocation(), 0, 0, 0, 0, 1);
//Hit Block Sound
event.getEntity().getWorld().playSound(event.getEntity().getLocation(), Sound.ENDERMAN_HIT, 1f, 1f);
//Block Particle
Location loc = event.getEntity().getLocation().add(event.getEntity().getVelocity().multiply(0.8));
Block block = loc.getBlock();
if (block.getType() == Material.AIR)
{
Block closest = null;
double closestDist = 0;
for (Block other : UtilBlock.getSurrounding(block, true))
{
if (other.getType() == Material.AIR)
continue;
double dist = UtilMath.offset(loc, other.getLocation().add(0.5, 0.5, 0.5));
if (closest == null || dist < closestDist)
{
closest = other;
closestDist = dist;
}
}
if (closest != null)
block = closest;
}
block.getWorld().playEffect(block.getLocation(), Effect.STEP_SOUND, block.getType());
}
@EventHandler
public void slowBulletWhizz(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
for (Entity ent : _bullets.keySet())
{
if (ent instanceof Snowball)
continue;
if (ent.getTicksLived() < 10)
continue;
Bullet bullet = _bullets.get(ent);
for (Player player : UtilServer.getPlayers())
{
if (UtilMath.offset(ent, player) < 4)
{
if (!bullet.WhizzSound.contains(player))
{
player.playSound(ent.getLocation(), Sound.BAT_IDLE, (float)(0.5 + Math.random() * 0.5), 1f);
bullet.WhizzSound.add(player);
}
}
}
}
}
@EventHandler(priority = EventPriority.MONITOR)
public void projectileHitParticle(final ProjectileHitEvent event)
public void instantBulletHit(final ProjectileHitEvent event)
{
if (!(event.getEntity() instanceof Arrow))
return;
UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(Manager.GetPlugin(), new Runnable()
{
public void run()
{
Arrow arrow = (Arrow)event.getEntity();
Bullet bullet = _bullets.get(arrow);
//Particle
if (bullet != null && bullet.Shooter != null)
UtilParticle.PlayParticle(bullet.Shooter, ParticleType.FIREWORKS_SPARK, arrow.getLocation(), 0, 0, 0, 0, 1);
//Hit Block Sound
arrow.getWorld().playSound(arrow.getLocation(), Sound.ENDERMAN_HIT, 1f, 1f);
//Bullet Whiz Sound
bulletWhizzSound(arrow.getLocation(), bullet);
instantBulletWhizz(arrow.getLocation(), bullet);
//Block Particle
try
{
@ -810,61 +896,72 @@ public class MineStrike extends TeamGame
{
e.printStackTrace();
}
_bullets.remove(arrow);
arrow.remove();
}
}, 0);
}
private void bulletWhizzSound(Location bulletEndLocation, Bullet bullet)
private void instantBulletWhizz(Location bulletEndLocation, Bullet bullet)
{
if (bullet == null)
return;
Location loc = bullet.Origin.clone();
HashSet<Player> hasPlayedFor = new HashSet<Player>();
if (bullet.Shooter != null)
hasPlayedFor.add(bullet.Shooter);
bullet.WhizzSound.add(bullet.Shooter);
//Move between points, check players
while (UtilMath.offset(loc, bulletEndLocation) > 1)
{
//This is used to calculate whether players are between current/end.
//Add 5 so you still hear the whizz if it hits just infront of you.
double offsetStartToEnd = UtilMath.offset(loc, bulletEndLocation) + 4;
for (Player player : UtilServer.getPlayers())
{
if (hasPlayedFor.contains(player))
if (bullet.WhizzSound.contains(player))
continue;
//Remove players who are not between current/end points
if (offsetStartToEnd < UtilMath.offset(player.getEyeLocation(), loc) &&
offsetStartToEnd < UtilMath.offset(player.getEyeLocation(), bulletEndLocation))
offsetStartToEnd < UtilMath.offset(player.getEyeLocation(), bulletEndLocation))
{
hasPlayedFor.add(player);
bullet.WhizzSound.add(player);
continue;
}
//Check
if (UtilMath.offset(player.getEyeLocation(), loc) < 4)
{
player.playSound(loc, Sound.BAT_IDLE, (float)(0.5 + Math.random() * 0.5), 1f);
hasPlayedFor.add(player);
bullet.WhizzSound.add(player);
}
}
//Move Closer
loc.add(UtilAlg.getTrajectory(loc, bulletEndLocation));
}
}
@EventHandler(priority=EventPriority.MONITOR)
public void removeArrowsFromPlayer(CustomDamageEvent event)
{
if (event.GetDamageePlayer() != null)
((CraftPlayer) event.GetDamageePlayer()).getHandle().p(0);
}
@EventHandler(priority=EventPriority.HIGH)
public void damage(CustomDamageEvent event)
{
if (event.GetDamageePlayer() == null)
return;
if (event.GetCause() == DamageCause.FALL)
{
event.AddMod(GetName(), "Fall Reduction", -2, false);
@ -927,16 +1024,33 @@ public class MineStrike extends TeamGame
return;
}
//Gun
Bullet bullet = _bullets.remove(event.GetProjectile());
if (bullet == null)
return;
//Get Hit Area
int hitArea = 0;
if (_customHitbox)
{
if (event.GetProjectile() instanceof Arrow)
hitArea = getArrowHitArea(event.GetDamageePlayer(), bullet.Origin.clone(), bullet.Direction.clone());
else
hitArea = getSnowballHitArea(event.GetDamageePlayer(), event.GetProjectile());
}
if (hitArea == -1)
{
event.SetCancelled("Miss");
return;
}
//Bullet Whiz Sound
bulletWhizzSound(event.GetDamageePlayer().getEyeLocation(), bullet);
if (event.GetProjectile() instanceof Arrow)
instantBulletWhizz(event.GetDamageePlayer().getEyeLocation(), bullet);
//Wipe previous data!
event.GetCancellers().clear();
@ -945,28 +1059,107 @@ public class MineStrike extends TeamGame
if (!Manager.CanHurt(event.GetDamageePlayer(), event.GetDamagerPlayer(true)))
event.SetCancelled("Team Damage");
event.AddMod(GetName(), "Negate Arrow", -event.GetDamageInitial(), false);
event.AddMod(GetName(), bullet.Gun.getName(), bullet.getDamage(event.GetDamageeEntity().getLocation()), true);
event.AddMod(GetName(), "Negate Default", -event.GetDamageInitial(), false);
if (event.GetDamageePlayer() != null)
//Damage + Dropoff
double damage = bullet.getDamage();
double damageDropoff = bullet.getDamageDropoff(event.GetDamageeEntity().getLocation());
//Add Damages
event.AddMod(bullet.Shooter.getName(), bullet.Gun.getName(), damage, true);
event.AddMod(bullet.Shooter.getName(), "Distance Dropoff", damageDropoff, false);
//Headshot
if (hitArea == 1)
{
//Damage Reduction
if (Armor.isArmor(event.GetDamageePlayer().getInventory().getChestplate()))
event.AddMod(bullet.Shooter.getName(), "Headshot", damage*2, true);
if (Armor.isArmor(event.GetDamageePlayer().getInventory().getHelmet()))
{
event.AddMod(GetName(), "Kevlar", -0.25 * bullet.getDamage(event.GetDamageeEntity().getLocation()), false);
event.AddMod(event.GetDamageePlayer().getName(), "Helmet", -damage*1, false);
event.GetDamageePlayer().getWorld().playSound(event.GetDamageePlayer().getEyeLocation(), Sound.SPIDER_DEATH, 1f, 1f);
}
//Mini-Stun
else
{
event.GetDamageePlayer().setVelocity(new Vector(0,0,0));
event.GetDamageePlayer().getWorld().playSound(event.GetDamageePlayer().getEyeLocation(), Sound.SLIME_ATTACK, 1f, 1f);
}
}
//Kevlar - Body Hit
if (hitArea == 0 && Armor.isArmor(event.GetDamageePlayer().getInventory().getChestplate()))
{
double damageArmor = -(1 - bullet.Gun.getArmorPenetration()) * (damage + damageDropoff);
event.AddMod(event.GetDamageePlayer().getName(), "Kevlar", damageArmor, false);
}
//Mini-Stun
else
{
event.GetDamageePlayer().setVelocity(new Vector(0,0,0));
}
event.SetKnockback(false);
event.SetIgnoreRate(true);
event.SetIgnoreArmor(true);
}
public int getArrowHitArea(Player damagee, Location origin, Vector trajectory)
{
//Move to near-player
Location start = origin.clone().add(trajectory.multiply(UtilMath.offset(origin, damagee.getEyeLocation()) - 2));
Location loc = start.clone();
while (!hitHead(damagee, loc) && !hitBody(damagee, loc) && UtilMath.offset(damagee.getLocation(), loc) < 6)
{
loc.add(trajectory.clone().multiply(0.1));
}
if (hitHead(damagee, loc))
return 1;
if (hitBody(damagee, loc))
return 0;
return -1;
}
public int getSnowballHitArea(Player damagee, Projectile snowball)
{
//Move to near-player
Location start = snowball.getLocation();
Location loc = start.clone();
while (!hitHead(damagee, loc) && !hitBody(damagee, loc) && UtilMath.offset(damagee.getLocation(), loc) < 6)
{
loc.add(snowball.getVelocity().clone().multiply(0.1));
}
if (hitHead(damagee, loc))
return 1;
if (hitBody(damagee, loc))
return 0;
return -1;
}
public boolean hitBody(Player player, Location loc)
{
return UtilMath.offset2d(loc, player.getLocation()) < 0.6 && //0.6 is ideal
loc.getY() > player.getLocation().getY() &&
loc.getY() < player.getEyeLocation().getY() - 0.2;
}
public boolean hitHead(Player player, Location loc)
{
return UtilMath.offset2d(loc, player.getLocation()) < 0.3 && //0.3 is ideal
loc.getY() >= player.getEyeLocation().getY() - 0.2 &&
loc.getY() < player.getEyeLocation().getY() + 0.2;
}
@EventHandler
public void killReward(CombatDeathEvent event)
@ -1223,6 +1416,8 @@ public class MineStrike extends TeamGame
_bombDefuser.setExp(0f);
UtilPlayer.message(player, F.main("Game", "You are defusing the Bomb."));
_bombDefuser.getWorld().playSound(_bombDefuser.getLocation(), Sound.PISTON_RETRACT, 2f, 1f);
}
@EventHandler
@ -1251,9 +1446,6 @@ public class MineStrike extends TeamGame
_bombDefuser.setExp(Math.min(_bombDefuser.getExp() + defuseRate, 0.99999f));
if (Math.random() > 0.95)
_bombDefuser.getWorld().playSound(_bombDefuser.getLocation(), Sound.PISTON_RETRACT, 1f, (float)(Math.random() + 1f));
if (_bombDefuser.getExp() >= 0.98f)
{
_bomb.defuse();
@ -1528,6 +1720,28 @@ public class MineStrike extends TeamGame
for (GameTeam team : GetTeamList())
for (Player teamMember : team.GetPlayers(true))
GetScoreboard().SetPlayerTeam(teamMember, team.GetName().toUpperCase());
//Alternate Bullets
if (_bulletAlternate)
_bulletInstant = (_bulletInstant + 1)%3;
//Debug Details
if (_debug)
{
Announce(C.cDPurple + C.Bold + "ROUND SETTINGS:");
if (_customHitbox)
Announce(C.cPurple + C.Bold + "Hitbox: " + ChatColor.RESET + "Accurate with Headshots");
else
Announce(C.cPurple + C.Bold + "Hitbox: " + ChatColor.RESET + "Default with No Headshot");
if (_bulletInstant == 0)
Announce(C.cPurple + C.Bold + "Bullets: " + ChatColor.RESET + "Slow and Visible");
else if (_bulletInstant == 1)
Announce(C.cPurple + C.Bold + "Bullets: " + ChatColor.RESET + "Instant and Invisible");
else
Announce(C.cPurple + C.Bold + "Bullets: " + ChatColor.RESET + "Slow and Visible with Instant Sniper");
}
}
public void giveMoney()
@ -1612,7 +1826,7 @@ public class MineStrike extends TeamGame
for (Entity ent : _bullets.keySet())
ent.remove();
_bullets.clear();
//Incendiary
_incendiary.clear();
@ -1620,6 +1834,10 @@ public class MineStrike extends TeamGame
for (Gun gun : _gunsEquipped.keySet())
gun.restockAmmo(_gunsEquipped.get(gun));
//Health
for (Player player : UtilServer.getPlayers())
player.setHealth(20);
//Reset Shop
for (Player player : UtilServer.getPlayers())
_shopManager.leaveShop(player, false, false);
@ -1628,7 +1846,7 @@ public class MineStrike extends TeamGame
@EventHandler(priority = EventPriority.HIGHEST)
public void specToTeam(PlayerJoinEvent event)
{
if (GetState() == GameState.Recruit)
if (GetState() == GameState.Recruit || GetState() == GameState.Loading)
return;
//Target Team
@ -1691,7 +1909,7 @@ public class MineStrike extends TeamGame
event.setTo(event.getFrom());
}
@EventHandler
//@EventHandler
public void boostClimb(PlayerToggleSneakEvent event)
{
if (!IsLive())
@ -1742,7 +1960,7 @@ public class MineStrike extends TeamGame
if (gun == null)
return;
if (!(gun instanceof AWP))
if (!gun.hasScope())
return;
//Enable
@ -1752,9 +1970,11 @@ public class MineStrike extends TeamGame
Manager.GetCondition().Factory().Slow("Scope", event.getPlayer(), null, 9999, 2, false, false, false, false);
event.getPlayer().getInventory().setHelmet(new ItemStack(Material.PUMPKIN));
event.getPlayer().getWorld().playSound(event.getPlayer().getEyeLocation(), Sound.GHAST_DEATH, 0.8f, 1f);
Manager.GetCondition().Factory().Blind("Scope Blind", event.getPlayer(), null, 1, 1, false, false, false);
if (gun.getGunType() == GunType.SNIPER)
{
event.getPlayer().getWorld().playSound(event.getPlayer().getEyeLocation(), Sound.GHAST_DEATH, 0.8f, 1f);
Manager.GetCondition().Factory().Blind("Scope Blind", event.getPlayer(), null, 1, 1, false, false, false);
}
}
else
{
@ -1777,13 +1997,13 @@ public class MineStrike extends TeamGame
continue;
Gun gun = getGunInHand(player, null);
if (gun == null || !(gun instanceof AWP) || !player.isSneaking())
if (!gun.hasScope() || !player.isSneaking())
{
removeScope(player);
}
}
}
public void removeScope(Player player)
{
ItemStack stack = _scoped.remove(player);
@ -1792,8 +2012,8 @@ public class MineStrike extends TeamGame
player.getWorld().playSound(player.getEyeLocation(), Sound.GHAST_DEATH, 0.8f, 1f);
}
@EventHandler
//@EventHandler
public void speedUpdate(UpdateEvent event)
{
if (!IsLive())
@ -1810,32 +2030,49 @@ public class MineStrike extends TeamGame
Manager.GetCondition().EndCondition(player, ConditionType.SPEED, null);
}
}
@EventHandler
public void incendiaryUpdate(UpdateEvent event)
{
if (event.getType() == UpdateType.TICK)
for (Player player : UtilServer.getPlayers())
player.setFireTicks(0);
if (event.getType() != UpdateType.SLOW)
return;
Iterator<Location> fireIterator = _incendiary.keySet().iterator();
while (fireIterator.hasNext())
{
Location loc = fireIterator.next();
if (_incendiary.get(loc) < System.currentTimeMillis())
fireIterator.remove();
else
loc.getWorld().playSound(loc, Sound.PIG_DEATH, 1f, 1f);
}
}
@EventHandler
public void bombBurnUpdate(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
if (_bombItem == null)
return;
if (!_bombItem.isValid())
{
Location loc = _bombItem.getLocation();
_bombItem.remove();
_bombItem = loc.getWorld().dropItemNaturally(loc, new ItemStack(Material.GOLD_SWORD));
}
}
@Override
@EventHandler
@ -2028,6 +2265,9 @@ public class MineStrike extends TeamGame
{
if (!IsLive())
return;
if (event.getType() != UpdateType.TICK)
return;
Location target = null;
if (_bombItem != null)
@ -2113,34 +2353,71 @@ public class MineStrike extends TeamGame
event.setCancelled(true);
}
public boolean isInstantBullets()
public int getBulletType()
{
return _bulletInstant;
}
@EventHandler
public void debugBullets(PlayerCommandPreprocessEvent event)
{
if (!event.getPlayer().isOp())
return;
if (event.getMessage().contains("debugbullets"))
{
_bulletInstant = !_bulletInstant;
Announce(C.cPurple + C.Bold + "Instant Bullets: " + ChatColor.RESET + _bulletInstant);
event.setCancelled(true);
}
}
//Cleans entities that may not have been removed due to unloaded chunks
@EventHandler
public void debug(PlayerCommandPreprocessEvent event)
{
if (!event.getPlayer().isOp())
return;
if (event.getMessage().contains("money"))
{
_shopManager.addMoney(event.getPlayer(), 16000, "Debug");
event.setCancelled(true);
}
if (event.getMessage().contains("instant"))
{
_bulletInstant = (_bulletInstant + 1)%3;
if (_bulletInstant == 0)
Announce(C.cPurple + C.Bold + "Bullets: " + ChatColor.RESET + "Slow and Visible");
else if (_bulletInstant == 1)
Announce(C.cPurple + C.Bold + "Bullets: " + ChatColor.RESET + "Instant and Invisible");
else
Announce(C.cPurple + C.Bold + "Bullets: " + ChatColor.RESET + "Slow and Visible with Instant Sniper");
event.setCancelled(true);
}
if (event.getMessage().contains("hitbox"))
{
_customHitbox = !_customHitbox;
if (_customHitbox)
Announce(C.cPurple + C.Bold + "Hitbox: " + ChatColor.RESET + "Accurate with Headshots");
else
Announce(C.cPurple + C.Bold + "Hitbox: " + ChatColor.RESET + "Default with No Headshot");
event.setCancelled(true);
}
if (event.getMessage().contains("alternate"))
{
_bulletAlternate = !_bulletAlternate;
Announce(C.cPurple + C.Bold + "Alternate Bullet Type: " + ChatColor.RESET + _bulletAlternate);
event.setCancelled(true);
}
if (event.getMessage().contains("god"))
{
if (HealthSet == 20)
HealthSet = -1;
else
HealthSet = 20;
Announce(C.cPurple + C.Bold + "God Mode: " + ChatColor.RESET + (HealthSet == 20));
event.setCancelled(true);
}
if (event.getMessage().contains("debugplayer"))
{
Announce(C.Bold + "PLAYER DEBUG:");
@ -2176,6 +2453,4 @@ public class MineStrike extends TeamGame
event.setCancelled(true);
}
}
}

View File

@ -61,19 +61,25 @@ public class ShopManager
//Pistols
slot = 9;
addItem(team.GetColor() == ChatColor.RED ? new Glock18() : new P2000(), player, slot++);
addItem(new P250(), player, slot++);
addItem(new CZ75(), player, slot++);
addItem(new Deagle(), player, slot++);
//Shotgun
slot = 18;
addItem(new Nova(), player, slot++);
addItem(new XM1014(), player, slot++);
//SMG
addItem(new PPBizon(), player, slot++);
addItem(new P90(), player, slot++);
//Rifles
slot = 27;
addItem(team.GetColor() == ChatColor.RED ? new AK47() : new M4A1(), player, slot++);
addItem(team.GetColor() == ChatColor.RED ? new Galil() : new Famas(), player, slot++);
addItem(team.GetColor() == ChatColor.RED ? new AK47() : new M4A4(), player, slot++);
addItem(team.GetColor() == ChatColor.RED ? new SG553() : new AUG(), player, slot++);
addItem(new SSG08(), player, slot++);
addItem(new AWP(), player, slot++);
//Grenades

View File

@ -1,11 +1,14 @@
package nautilus.game.arcade.game.games.minestrike.data;
import java.util.HashSet;
import nautilus.game.arcade.game.games.minestrike.MineStrike;
import nautilus.game.arcade.game.games.minestrike.items.guns.Gun;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilTime;
@ -16,15 +19,18 @@ public class Bullet
public Entity Bullet;
public Gun Gun;
public Location Origin;
public Vector Direction;
public long LastSound = System.currentTimeMillis() - 100;
public HashSet<Player> WhizzSound = new HashSet<Player>();
public Bullet(Entity bullet, Gun gun, Player shooter, MineStrike game)
{
Bullet = bullet;
Gun = gun;
Origin = shooter.getEyeLocation();
Direction = shooter.getLocation().getDirection();
Shooter = shooter;
}
@ -33,9 +39,14 @@ public class Bullet
return Bullet.isValid();
}
public double getDamage(Location destination)
public double getDamage()
{
return Gun.getDamage() * (1 - (Gun.getDropOff() * UtilMath.offset(Origin, destination)));
return Gun.getDamage();
}
public double getDamageDropoff(Location destination)
{
return -Gun.getDamage() * (Gun.getDropOff() * UtilMath.offset(Origin, destination));
}
public boolean bulletSound()

View File

@ -9,7 +9,7 @@ public class Helmet extends Armor
{
super("Helmet", new String[]
{
"Reduces damage from headshots"
"Reduces damage from head shots"
},
350, 0, Material.LEATHER_HELMET);
}

View File

@ -9,7 +9,7 @@ public class Kevlar extends Armor
{
super("Kevlar", new String[]
{
"Reduces bullet damage by 25%"
"Reduces damage from body shots"
},
650, 0, Material.LEATHER_CHESTPLATE);
}

View File

@ -140,8 +140,8 @@ public abstract class Grenade extends StrikeItem
*/
//X Rebound
if ((_vel.getX() > 0 && ent.getLocation().getX() - _lastLoc.getX() <= 0) ||
(_vel.getX() < 0 && ent.getLocation().getX() - _lastLoc.getX() >= 0))
if ((_vel.getX() > 0.05 && ent.getLocation().getX() - _lastLoc.getX() <= 0) ||
(_vel.getX() < 0.05 && ent.getLocation().getX() - _lastLoc.getX() >= 0))
{
_vel = _velHistory.get(0);
_vel.setX(-_vel.getX());
@ -153,8 +153,8 @@ public abstract class Grenade extends StrikeItem
}
//Z Rebound
else if ((_vel.getZ() > 0 && ent.getLocation().getZ() - _lastLoc.getZ() <= 0) ||
(_vel.getZ() < 0 && ent.getLocation().getZ() - _lastLoc.getZ() >= 0))
else if ((_vel.getZ() > 0.05 && ent.getLocation().getZ() - _lastLoc.getZ() <= 0) ||
(_vel.getZ() < 0.05 && ent.getLocation().getZ() - _lastLoc.getZ() >= 0))
{
_vel = _velHistory.get(0);
_vel.setZ(-_vel.getZ());

View File

@ -17,7 +17,7 @@ public class HighExplosive extends Grenade
{
public HighExplosive()
{
super("HE Grenade", new String[]
super("High Explosive", new String[]
{
},
@ -34,8 +34,7 @@ public class HighExplosive extends Grenade
ent.getWorld().playSound(ent.getLocation(),
Sound.EXPLODE, 3f, 0.8f);
HashMap<Player, Double> players = UtilPlayer.getInRadius(
ent.getLocation(), 8);
HashMap<Player, Double> players = UtilPlayer.getInRadius(ent.getLocation(), 10);
for (Player player : players.keySet())
{
if (!game.IsAlive(player))

View File

@ -6,6 +6,6 @@ public class Incendiary extends FireGrenadeBase
{
public Incendiary()
{
super("Incendiary", 600, 0, Material.PORK, 10000);
super("Incendiary", 600, 0, Material.PORK, 6000);
}
}

View File

@ -6,6 +6,6 @@ public class Molotov extends FireGrenadeBase
{
public Molotov()
{
super("Molotov", 400, 0, Material.GRILLED_PORK, 8000);
super("Molotov", 400, 0, Material.GRILLED_PORK, 6000);
}
}

View File

@ -12,7 +12,7 @@ public class Smoke extends Grenade
{
public Smoke()
{
super("Smoke Grenade", new String[]
super("Smoke", new String[]
{
},

View File

@ -4,6 +4,7 @@ import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilParticle;
import mineplex.core.common.util.UtilPlayer;
@ -24,6 +25,7 @@ import org.bukkit.Sound;
import org.bukkit.entity.Arrow;
import org.bukkit.entity.Entity;
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;
@ -40,13 +42,15 @@ public abstract class Gun extends StrikeItem
protected long _reloadTime;
protected double _damage;
protected double _dropOffPerBlock;
protected double _bulletSpeed;
protected double _armorPen;
protected Sound _fireSound;
protected double _coneMin;
protected double _coneMax;
protected double _coneReduceRate;
protected double _coneIncreaseRate;
protected boolean _scope = false;
//Active Data
@ -60,7 +64,7 @@ public abstract class Gun extends StrikeItem
int cost, int gemCost,
int clipSize, int clipReserve,
long fireRate, long reloadTime,
double damage, double dropOffPerBlock, double bulletSpeed,
double damage, double dropOffPerBlock, double armorPen,
double coneMin, double coneMax,
double coneIncrease, double coneReduce,
Material skin, Sound sound)
@ -80,7 +84,7 @@ public abstract class Gun extends StrikeItem
_reloadTime = reloadTime;
_damage = damage;
_dropOffPerBlock = dropOffPerBlock;
_bulletSpeed = bulletSpeed;
_armorPen = armorPen;
_fireSound = sound;
@ -158,8 +162,15 @@ public abstract class Gun extends StrikeItem
public Bullet fireBullet(Player player, MineStrike game)
{
//Instant?
boolean instant = game.getBulletType() == 1 || (game.getBulletType() == 2 && _gunType == GunType.SNIPER);
//Shoot
Entity bullet = player.launchProjectile(Arrow.class);
Entity bullet;
if (instant)
bullet = player.launchProjectile(Arrow.class);
else
bullet = player.launchProjectile(Snowball.class);
//COF
double cone = getCone(player);
@ -172,13 +183,19 @@ public abstract class Gun extends StrikeItem
cof.add(player.getLocation().getDirection());
cof.normalize();
bullet.setVelocity(cof.multiply(game.isInstantBullets() ? 200 : _bulletSpeed));
//Velocity
bullet.setVelocity(cof.multiply(instant ? 200 : 4));
//Increase COF
_cone = Math.min(_coneMax, _cone + _coneIncreaseRate);
return new Bullet(bullet, this, player, game);
}
public double getArmorPenetration()
{
return _armorPen;
}
public double getCone(Player player)
{
@ -202,11 +219,20 @@ public abstract class Gun extends StrikeItem
//Sniper Zoomed
if (_gunType == GunType.SNIPER)
if (_scope && UtilGear.isMat(player.getInventory().getHelmet(), Material.PUMPKIN))
{
if (player.isSneaking())
//Snipers Perfectly Accurate if not jumping
if (_gunType == GunType.SNIPER)
{
cone -= _cone;
cone = 0;
if (!UtilEnt.isGrounded(player))
cone += _gunType.getJumpPenalty();
}
//30% Recoil Decrease
else
{
cone = cone * 0.7;
}
}
@ -224,6 +250,11 @@ public abstract class Gun extends StrikeItem
return false;
}
public long getReloadTime()
{
return _reloadTime;
}
public void reload(Player player)
{
@ -242,8 +273,8 @@ public abstract class Gun extends StrikeItem
_reserveAmmo = Math.max(0, ammo - _clipSize);
//Recharge
Recharge.Instance.useForce(player, getName() + " Shoot", _reloadTime);
Recharge.Instance.use(player, getName() + " Reload", _reloadTime, false, true);
Recharge.Instance.useForce(player, getName() + " Shoot", getReloadTime());
Recharge.Instance.use(player, getName() + " Reload", getReloadTime(), false, true);
//Sound
soundReload(player.getLocation());
@ -268,11 +299,6 @@ public abstract class Gun extends StrikeItem
player.getInventory().setItem(_slot, getStack());
}
public double getDamage()
{
return _damage;
}
public double getDropOff()
{
return _dropOffPerBlock;
@ -363,8 +389,11 @@ public abstract class Gun extends StrikeItem
_reserveAmmo = _clipReserve * _clipSize;
updateWeaponName(player);
player.setHealth(20);
}
public double getDamage()
{
return _damage/5d;
}
@Override
@ -372,4 +401,28 @@ public abstract class Gun extends StrikeItem
{
return C.cDGreen + C.Bold + _gunType.getName() + ChatColor.RESET;
}
@Override
public String[] getShopItemCustom()
{
return new String[]
{
C.cYellow + C.Bold + "Clip / Spare Ammo: " + ChatColor.RESET + _clipSize + "/" + _clipReserve*_clipSize,
C.cYellow + C.Bold + "Damage per Bullet: " + ChatColor.RESET + UtilMath.trim(1, getDamage()),
C.cYellow + C.Bold + "Armor Penetration: " + ChatColor.RESET + (int)(_armorPen*100) + "%",
C.cYellow + C.Bold + "Damage Dropoff: " + ChatColor.RESET + (int)(_dropOffPerBlock*1000d) + "% per 10 Blocks",
C.cYellow + C.Bold + "Recoil per Shot: " + ChatColor.RESET + _coneIncreaseRate,
C.cYellow + C.Bold + "Recoil Recovery: " + ChatColor.RESET + _coneReduceRate + " per Second",
};
}
public boolean hasScope()
{
return _scope;
}
public GunType getGunType()
{
return _gunType;
}
}

View File

@ -56,8 +56,11 @@ public abstract class Shotgun extends Gun
@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);
if (_fireRate >= 500)
{
loc.getWorld().playSound(loc, Sound.PISTON_RETRACT, 0.8f, 1.2f);
loc.getWorld().playSound(loc, Sound.PISTON_RETRACT, 0.8f, 1.2f);
}
}
@Override
@ -71,4 +74,10 @@ public abstract class Shotgun extends Gun
{
}
@Override
public long getReloadTime()
{
return _reloadTime * Math.min(_reserveAmmo, _clipSize - _loadedAmmo);
}
}

View File

@ -16,12 +16,12 @@ public class CZ75 extends Gun
{
},
300, 0, //Cost, Gem Cost
500, 0, //Cost, Gem Cost
12, 1, //Clip Size, Spare Ammo
80, 2700, //ROF, Reload Time
6, 0.01, 3.5, //Damage, Dropoff, Bullet Speed
0, 0.15, //COF Min, COF Max
0.06, 0.4, //COF Inc per Bullet, COF Dec per Second
35, 0.006, 0.77, //Damage, Dropoff, Armor Penetration
0, 0.25, //COF Min, COF Max
0.06, 0.3, //COF Inc per Bullet, COF Dec per Second
Material.IRON_HOE, Sound.ENDERMAN_DEATH);
}
}

View File

@ -18,10 +18,10 @@ public class Deagle extends Gun
},
800, 0, //Cost, Gem Cost
7, 5, //Clip Size, Spare Ammo
300, 2000, //ROF, Reload Time
9, 0.01, 3.5, //Damage, Dropoff, Bullet Speed
0, 0.2, //COF Min, COF Max
0.12, 0.2, //COF Inc per Bullet, COF Dec per Second
300, 2200, //ROF, Reload Time
68, 0.007, 0.85, //Damage, Dropoff, Armor Penetration
0, 0.25, //COF Min, COF Max
0.18, 0.2, //COF Inc per Bullet, COF Dec per Second
Material.GOLD_HOE, Sound.BAT_DEATH);
}
}

View File

@ -18,10 +18,10 @@ public class Glock18 extends Gun
},
200, 0, //Cost, Gem Cost
20, 6, //Clip Size, Spare Ammo
120, 2000, //ROF, Reload Time
5, 0.01, 3.5, //Damage, Dropoff, Bullet Speed
0, 0.15, //COF Min, COF Max
0.08, 0.3, //COF Inc per Bullet, COF Dec per Second
120, 2200, //ROF, Reload Time
28, 0.008, 0.47, //Damage, Dropoff, Armor Penetration
0, 0.18, //COF Min, COF Max
0.07, 0.3, //COF Inc per Bullet, COF Dec per Second
Material.STONE_HOE, Sound.BAT_LOOP);
}
}

View File

@ -19,9 +19,9 @@ public class P2000 extends Gun
200, 0, //Cost, Gem Cost
13, 4, //Clip Size, Spare Ammo
130, 2200, //ROF, Reload Time
6, 0.01, 3.5, //Damage, Dropoff, Bullet Speed
0, 0.15, //COF Min, COF Max
0.08, 0.3, //COF Inc per Bullet, COF Dec per Second
35, 0.008, 0.50, //Damage, Dropoff, Armor Penetration
0, 0.18, //COF Min, COF Max
0.07, 0.3, //COF Inc per Bullet, COF Dec per Second
Material.WOOD_HOE, Sound.GHAST_SCREAM2);
}
}

View File

@ -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 P250 extends Gun
{
public P250()
{
super(StrikeItemType.SECONDARY_WEAPON, GunType.PISTOL, "P250", new String[]
{
},
300, 0, //Cost, Gem Cost
13, 4, //Clip Size, Spare Ammo
130, 2200, //ROF, Reload Time
35, 0.005, 0.77, //Damage, Dropoff, Armor Penetration
0, 0.15, //COF Min, COF Max
0.06, 0.3, //COF Inc per Bullet, COF Dec per Second
Material.DIAMOND_HOE, Sound.SILVERFISH_KILL);
}
}

View File

@ -18,10 +18,10 @@ public class AK47 extends Gun
},
2700, 5000, //Cost, Gem Cost
30, 3, //Clip Size, Spare Ammo
80, 3600, //ROF, Reload Time
7.5, 0.005, 4, //Damage, Dropoff, Bullet Speed
0, 0.25, //COF Min, COF Max
0.050, 0.4, //COF Inc per Bullet, COF Dec per Second
80, 2500, //ROF, Reload Time
36, 0.004, 0.78, //Damage, Dropoff, Armor Penetration
0, 0.3, //COF Min, COF Max
0.051, 0.35, //COF Inc per Bullet, COF Dec per Second
Material.WOOD_SPADE, Sound.BURP);
}
}

View File

@ -0,0 +1,29 @@
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 AUG extends Gun
{
public AUG()
{
super(StrikeItemType.PRIMARY_WEAPON, GunType.RIFLE, "Steyr AUG", new String[]
{
},
3300, 5000, //Cost, Gem Cost
30, 3, //Clip Size, Spare Ammo
80, 3800, //ROF, Reload Time
28, 0.004, 0.9, //Damage, Dropoff, Armor Penetration
0, 0.25, //COF Min, COF Max
0.05, 0.4, //COF Inc per Bullet, COF Dec per Second
Material.GOLD_PICKAXE, Sound.VILLAGER_DEATH);
_scope = true;
}
}

View File

@ -19,10 +19,12 @@ public class AWP extends Gun
4750, 5000, //Cost, Gem Cost
10, 3, //Clip Size, Spare Ammo
1500, 3600, //ROF, Reload Time
30, 0.002, 4.3, //Damage, Dropoff, Bullet Speed
0.05, 0.05, //COF Min, COF Max
115, 0, 0.97, //Damage, Dropoff, Armor Penetration
0.1, 0.1, //COF Min, COF Max
0, 0, //COF Inc per Bullet, COF Dec per Second
Material.GOLD_SPADE, Sound.DRINK);
_scope = true;
}

View File

@ -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 Famas extends Gun
{
public Famas()
{
super(StrikeItemType.PRIMARY_WEAPON, GunType.RIFLE, "FAMAS", new String[]
{
},
2250, 5000, //Cost, Gem Cost
25, 4, //Clip Size, Spare Ammo
80, 3300, //ROF, Reload Time
30, 0.004, 0.7, //Damage, Dropoff, Armor Penetration
0, 0.28, //COF Min, COF Max
0.040, 0.30, //COF Inc per Bullet, COF Dec per Second
Material.WOOD_PICKAXE, Sound.WITHER_DEATH);
}
}

View File

@ -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 Galil extends Gun
{
public Galil()
{
super(StrikeItemType.PRIMARY_WEAPON, GunType.RIFLE, "Galil AR", new String[]
{
},
2000, 5000, //Cost, Gem Cost
35, 3, //Clip Size, Spare Ammo
80, 2600, //ROF, Reload Time
30, 0.004, 0.75, //Damage, Dropoff, Armor Penetration
0, 0.30, //COF Min, COF Max
0.042, 0.30, //COF Inc per Bullet, COF Dec per Second
Material.STONE_PICKAXE, Sound.WITHER_SHOOT);
}
}

View File

@ -8,9 +8,9 @@ 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 class M4A4 extends Gun
{
public M4A1()
public M4A4()
{
super(StrikeItemType.PRIMARY_WEAPON, GunType.RIFLE, "M4A4", new String[]
{
@ -18,10 +18,10 @@ public class M4A1 extends Gun
},
2900, 5000, //Cost, Gem Cost
30, 3, //Clip Size, Spare Ammo
80, 3600, //ROF, Reload Time
7, 0.005, 4, //Damage, Dropoff, Bullet Speed
0, 0.2, //COF Min, COF Max
0.048, 0.4, //COF Inc per Bullet, COF Dec per Second
80, 3000, //ROF, Reload Time
33, 0.004, 0.7, //Damage, Dropoff, Armor Penetration
0, 0.26, //COF Min, COF Max
0.048, 0.35, //COF Inc per Bullet, COF Dec per Second
Material.STONE_SPADE, Sound.BAT_TAKEOFF);
}
}

View File

@ -0,0 +1,29 @@
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 SG553 extends Gun
{
public SG553()
{
super(StrikeItemType.PRIMARY_WEAPON, GunType.RIFLE, "SG553", new String[]
{
},
3000, 5000, //Cost, Gem Cost
30, 3, //Clip Size, Spare Ammo
80, 3800, //ROF, Reload Time
30, 0.004, 1.00, //Damage, Dropoff, Armor Penetration
0, 0.25, //COF Min, COF Max
0.052, 0.4, //COF Inc per Bullet, COF Dec per Second
Material.IRON_PICKAXE, Sound.WITHER_SPAWN);
_scope = true;
}
}

View File

@ -0,0 +1,31 @@
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 SSG08 extends Gun
{
public SSG08()
{
super(StrikeItemType.PRIMARY_WEAPON, GunType.SNIPER, "SSG 08", new String[]
{
},
1700, 5000, //Cost, Gem Cost
10, 6, //Clip Size, Spare Ammo
1250, 3700, //ROF, Reload Time
88, 0.001, 0.85, //Damage, Dropoff, Armor Penetration
0.08, 0.08, //COF Min, COF Max
0, 0, //COF Inc per Bullet, COF Dec per Second
Material.DIAMOND_PICKAXE, Sound.WOLF_DEATH);
_scope = true;
}
}

View File

@ -17,8 +17,8 @@ public class Nova extends Shotgun
},
1200, 5000, //Cost, Gem Cost
8, 4, //Clip Size, Spare Ammo
1000, 4000, //ROF, Reload Time
5, 0.02, 3.5, //Damage, Dropoff, Bullet Speed
1000, 800, //ROF, Reload Time
26, 0.01, 0.5, //Damage, Dropoff, Armor Penetration
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);

View File

@ -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 XM1014 extends Shotgun
{
public XM1014()
{
super(StrikeItemType.PRIMARY_WEAPON, "XM1014", new String[]
{
},
2000, 5000, //Cost, Gem Cost
7, 4, //Clip Size, Spare Ammo
260, 800, //ROF, Reload Time
20, 0.01, 0.8, //Damage, Dropoff, Armor Penetration
0.15, 0.15, //COF Min, COF Max
0, 0, //COF Inc per Bullet, COF Dec per Second
Material.DIAMOND_AXE, Sound.SKELETON_DEATH, 6);
}
}

View File

@ -18,10 +18,10 @@ public class P90 extends Gun
},
2350, 5000, //Cost, Gem Cost
50, 2, //Clip Size, Spare Ammo
35, 2800, //ROF, Reload Time
4, 0.02, 3.5, //Damage, Dropoff, Bullet Speed
0, 0.2, //COF Min, COF Max
0.03, 0.4, //COF Inc per Bullet, COF Dec per Second
35, 3300, //ROF, Reload Time
22, 0.006, 0.65, //Damage, Dropoff, Armor Penetration
0, 0.25, //COF Min, COF Max
0.022, 0.3, //COF Inc per Bullet, COF Dec per Second
Material.STONE_AXE, Sound.CREEPER_DEATH);
}
}

View File

@ -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 PPBizon extends Gun
{
public PPBizon()
{
super(StrikeItemType.PRIMARY_WEAPON, GunType.SMG, "PP-Bizon", new String[]
{
},
1400, 5000, //Cost, Gem Cost
64, 2, //Clip Size, Spare Ammo
60, 2400, //ROF, Reload Time
27, 0.007, 0.47, //Damage, Dropoff, Armor Penetration
0, 0.3, //COF Min, COF Max
0.045, 0.3, //COF Inc per Bullet, COF Dec per Second
Material.WOOD_AXE, Sound.SHEEP_SHEAR);
}
}

View File

@ -50,7 +50,7 @@ public abstract class OrderCraft extends Order
if (event.getSlotType() != SlotType.RESULT)
return;
if (!UtilInv.IsItem(event.getCurrentItem(), _id, _data))
if (!UtilInv.IsItem(event.getCurrentItem(), null, _id, _data))
return;
if (!(event.getWhoClicked() instanceof Player))

View File

@ -45,7 +45,7 @@ public abstract class OrderGather extends Order
@EventHandler
public void Pickup(PlayerPickupItemEvent event)
{
if (!UtilInv.IsItem(event.getItem().getItemStack(), _id, _data))
if (!UtilInv.IsItem(event.getItem().getItemStack(), null, _id, _data))
return;
if (Has(event.getPlayer()))

View File

@ -66,7 +66,7 @@ public class PerkCreeperSulphurBomb extends Perk implements IThrown
UtilInv.Update(player);
org.bukkit.entity.Item ent = player.getWorld().dropItem(player.getEyeLocation(), ItemStackFactory.Instance.CreateStack(Material.FIREWORK_CHARGE, (byte)6));
org.bukkit.entity.Item ent = player.getWorld().dropItem(player.getEyeLocation(), ItemStackFactory.Instance.CreateStack(Material.COAL, (byte)0));
UtilAction.velocity(ent, player.getLocation().getDirection(), 1, false, 0, 0.2, 10, false);

View File

@ -14,9 +14,12 @@ import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.player.PlayerDropItemEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.meta.ItemMeta;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
import mineplex.core.common.util.UtilGear;
import mineplex.core.common.util.UtilInv;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
@ -45,6 +48,22 @@ public class PerkFletcher extends Perk
_max = max;
_remove = remove;
}
public boolean isFletchedArrow(ItemStack stack)
{
if (!UtilGear.isMat(stack, Material.ARROW))
return false;
ItemMeta meta = stack.getItemMeta();
if (meta.getDisplayName() == null)
return false;
if (!meta.getDisplayName().contains("Fletched Arrow"))
return false;
return true;
}
@EventHandler
public void FletchShootBow(EntityShootBowEvent event)
@ -58,12 +77,11 @@ public class PerkFletcher extends Perk
return;
for (int i=0 ; i<=8 ; i++)
if (player.getInventory().getItem(i) != null)
if (UtilInv.IsItem(player.getInventory().getItem(i), Material.ARROW, (byte)1))
{
_fletchArrows.add(event.getProjectile());
return;
}
if (isFletchedArrow(player.getInventory().getItem(i)))
{
_fletchArrows.add(event.getProjectile());
return;
}
}
@EventHandler
@ -94,11 +112,11 @@ public class PerkFletcher extends Perk
if (!Recharge.Instance.use(cur, GetName(), _time * 1000, false, false))
continue;
if (UtilInv.contains(cur, Material.ARROW, (byte)1, _max))
if (UtilInv.contains(cur, "Fletched Arrow", Material.ARROW, (byte)0, _max))
continue;
//Add
cur.getInventory().addItem(ItemStackFactory.Instance.CreateStack(262, (byte)1, 1, F.item("Fletched Arrow")));
cur.getInventory().addItem(ItemStackFactory.Instance.CreateStack(262, (byte)0, 1, F.item("Fletched Arrow")));
cur.playSound(cur.getLocation(), Sound.ITEM_PICKUP, 2f, 1f);
}
@ -110,7 +128,7 @@ public class PerkFletcher extends Perk
if (event.isCancelled())
return;
if (!UtilInv.IsItem(event.getItemDrop().getItemStack(), Material.ARROW, (byte)1))
if (!isFletchedArrow(event.getItemDrop().getItemStack()))
return;
//Cancel
@ -126,7 +144,7 @@ public class PerkFletcher extends Perk
HashSet<org.bukkit.inventory.ItemStack> remove = new HashSet<org.bukkit.inventory.ItemStack>();
for (org.bukkit.inventory.ItemStack item : event.getDrops())
if (UtilInv.IsItem(item, Material.ARROW, (byte)1))
if (isFletchedArrow(item))
remove.add(item);
for (org.bukkit.inventory.ItemStack item : remove)
@ -136,7 +154,7 @@ public class PerkFletcher extends Perk
@EventHandler
public void FletchInvClick(InventoryClickEvent event)
{
UtilInv.DisallowMovementOf(event, "Fletched Arrow", Material.ARROW, (byte)1, true);
UtilInv.DisallowMovementOf(event, "Fletched Arrow", Material.ARROW, (byte)0, true);
}
@EventHandler

View File

@ -950,6 +950,9 @@ public class GameFlagManager implements Listener
if (event.getType() != UpdateType.SLOWER)
return;
if (Manager.GetGame().GetType() == GameType.MineStrike)
return;
for (Player player : UtilServer.getPlayers())
{
@ -961,6 +964,4 @@ public class GameFlagManager implements Listener
UtilPlayer.message(player, C.cWhite + C.Bold + "The next game will be starting soon...");
}
}
}

View File

@ -48,7 +48,7 @@ public class GameGemManager implements Listener
Game game = Manager.GetGame();
if (game == null) return;
if (!(event.GetEvent().getEntity() instanceof Player))
return;
@ -109,7 +109,7 @@ public class GameGemManager implements Listener
if (event.GetState() != PlayerState.OUT)
return;
if (event.GetGame().GetType() == GameType.Paintball)
if (event.GetGame().GetType() == GameType.Paintball || event.GetGame().GetType() == GameType.MineStrike)
return;
RewardGems(event.GetGame(), event.GetPlayer(), false);