Merge branches 'develop' and 'feature/report-v2' of github.com:Mineplex-LLC/Minecraft-PC into feature/report-v2

This commit is contained in:
Keir Nellyer 2016-07-15 23:56:08 +01:00
commit 6756d04aa7
2 changed files with 96 additions and 6 deletions

View File

@ -136,6 +136,8 @@ public class GunModule implements Listener
public boolean CustomHitbox = true;
public boolean BulletAlternate = false;
public boolean EnableNormalArmor = false;
public boolean BlockRegeneration = true;
public boolean EnablePickup = true;
public boolean EnableDrop = true;
public boolean EnableCleaning = true;
@ -1021,6 +1023,29 @@ public class GunModule implements Listener
{
UtilAction.zeroVelocity(event.GetDamageeEntity());
}
if (EnableNormalArmor)
{
double armomrDamage = 0;
for (ItemStack item : event.GetDamageePlayer().getInventory().getArmorContents())
{
if (item == null)
continue;
if (item.getType().toString().contains("DIAMOND")) armomrDamage -= 1;
if (item.getType().toString().contains("GOLD")) armomrDamage -= 0.5;
if (item.getType().toString().contains("IRON")) armomrDamage -= 0.75;
if (item.getType().toString().contains("LEATHER")) armomrDamage -= 0.25;
if (item.getType().toString().contains("CHAIN")) armomrDamage -= 0.5;
}
if (event.GetDamage() - armomrDamage <= 0)
armomrDamage = -(event.GetDamage() - 1);
event.AddMod(event.GetDamageePlayer().getName(), "Armor", armomrDamage, false);
}
event.SetKnockback(false);
event.SetIgnoreRate(true);
@ -1293,6 +1318,9 @@ public class GunModule implements Listener
@EventHandler
public void healthCancel(EntityRegainHealthEvent event)
{
if (!BlockRegeneration)
return;
if (event.getRegainReason() == RegainReason.SATIATED)
event.setCancelled(true);
}
@ -1379,12 +1407,19 @@ public class GunModule implements Listener
if (event.getType() != UpdateType.TICK)
return;
for (Player player : _host.GetPlayers(true))
for (Player player : UtilServer.getPlayers())
{
if (UtilGear.isMat(player.getItemInHand(), Material.IRON_AXE) || UtilGear.isMat(player.getItemInHand(), Material.IRON_SWORD))
Manager.GetCondition().Factory().Speed("Knife", player, player, 1.9, 0, false, false, false);
if (_host.IsAlive(player))
{
if (UtilGear.isMat(player.getItemInHand(), Material.IRON_AXE) || UtilGear.isMat(player.getItemInHand(), Material.IRON_SWORD))
player.setWalkSpeed(0.2F);
else
player.setWalkSpeed(0.1F);
}
else
Manager.GetCondition().EndCondition(player, ConditionType.SPEED, null);
{
player.setWalkSpeed(0.1F);
}
}
}

View File

@ -11,11 +11,14 @@ import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.enchantment.EnchantItemEvent;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.event.entity.ItemSpawnEvent;
import org.bukkit.event.entity.PlayerDeathEvent;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.player.PlayerDropItemEvent;
import org.bukkit.event.player.PlayerEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerItemConsumeEvent;
import org.bukkit.event.player.PlayerItemDamageEvent;
import org.bukkit.event.player.PlayerPickupItemEvent;
import org.bukkit.event.player.PlayerToggleSneakEvent;
@ -33,12 +36,14 @@ import mineplex.core.itemstack.ItemStackFactory;
import mineplex.core.loot.RandomItem;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.events.PlayerKitGiveEvent;
import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.games.minestrike.GunModule;
import nautilus.game.arcade.game.games.minestrike.items.StrikeItemType;
import nautilus.game.arcade.game.games.minestrike.items.grenades.FlashBang;
import nautilus.game.arcade.game.games.minestrike.items.grenades.Grenade;
import nautilus.game.arcade.game.games.minestrike.items.grenades.HighExplosive;
@ -47,6 +52,8 @@ import nautilus.game.arcade.game.games.minestrike.items.grenades.Molotov;
import nautilus.game.arcade.game.games.minestrike.items.grenades.Smoke;
import nautilus.game.arcade.game.games.minestrike.items.guns.Gun;
import nautilus.game.arcade.game.games.minestrike.items.guns.GunStats;
import nautilus.game.arcade.game.games.minestrike.items.guns.GunType;
import nautilus.game.arcade.game.games.minestrike.items.guns.Shotgun;
import nautilus.game.arcade.game.games.survivalgames.SoloSurvivalGames;
import nautilus.game.arcade.game.games.survivalgames.SupplyChestOpenEvent;
import nautilus.game.arcade.game.games.survivalgames.kit.KitLooter;
@ -64,6 +71,7 @@ public class StrikeGames extends SoloSurvivalGames
private GunModule _gunModule;
private long _peacePhase;
private boolean _peace = false;
private HashMap<Player, ItemStack> _helmets;
@ -84,6 +92,8 @@ public class StrikeGames extends SoloSurvivalGames
_gunModule.EnableCleaning = false;
_gunModule.EnableDrop = false;
_gunModule.EnablePickup = false;
_gunModule.BlockRegeneration = false;
_gunModule.EnableNormalArmor = true;
}
@EventHandler
@ -98,19 +108,56 @@ public class StrikeGames extends SoloSurvivalGames
if (!UtilTime.elapsed(GetStateTime(), _peacePhase))
return;
if (Damage)
if (!_peace)
return;
_peace = false;
Announce(F.main("Game", "The Peace Phase has ended! You can now fight each other!"));
Damage = true;
}
@EventHandler
public void eatingGrenades(PlayerItemConsumeEvent event)
{
if (event.getItem().getType() == Material.POTATO_ITEM
|| event.getItem().getType() == Material.CARROT_ITEM
|| event.getItem().getType() == Material.APPLE
|| event.getItem().getType() == Material.PORK
|| event.getItem().getType() == Material.GRILLED_PORK)
{
event.setCancelled(true);
}
}
@EventHandler(priority = EventPriority.LOWEST)
public void DeathmatchDamage(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST)
return;
if (!isDeathMatchTeleported())
return;
if (getDeathMatchTime() <= 0)
{
Damage = true;
}
else
{
Damage = false;
}
}
@EventHandler
public void informPeace(GameStateChangeEvent event)
{
if (event.GetState() != GameState.Live)
return;
_peace = true;
Announce(F.main("Game", "A Peace Phase of " + F.time((_peacePhase/1000) + "") + " seconds has started!"));
}
@ -417,7 +464,15 @@ public class StrikeGames extends SoloSurvivalGames
{
if (stat.getSkin() == stack.getType())
{
Gun gun = new Gun(stat, _gunModule);
Gun gun = null;
if (stat.getGunType() == GunType.SHOTGUN)
{
gun = new Shotgun(stat, _gunModule);
}
else
{
gun = new Gun(stat, _gunModule);
}
gun.setStack(stack);
gun.updateWeaponName(player, null, false);
gun.addID();