Make some more changes, cause QA got angry

This commit is contained in:
Sam 2018-05-07 23:45:05 +01:00 committed by Alexander Meech
parent 5a8ca2f387
commit 2f77f53648
11 changed files with 51 additions and 39 deletions

View File

@ -187,11 +187,11 @@ public class Condition
_ent.removePotionEffect(type);
//Add
PotionEffect effect = new PotionEffect(type, _ticks, _mult, _ambient);
PotionEffect effect = new PotionEffect(type, _ticks, _mult, _ambient, _showIndicator);
if (_ticks == -1)
_ent.addPotionEffect(new PotionEffect(type, 72000, _mult, _ambient), true);
_ent.addPotionEffect(new PotionEffect(type, 72000, _mult, _ambient, _showIndicator), true);
else
((CraftLivingEntity) _ent).getHandle().addEffect(new MobEffect(effect.getType().getId(), effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), true));
((CraftLivingEntity) _ent).getHandle().addEffect(new MobEffect(effect.getType().getId(), effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), _showIndicator));
}
catch (Exception e)
{

View File

@ -402,6 +402,8 @@ public abstract class Game extends ListenerComponent implements Lifetimed
// Split Kit XP
public boolean SplitKitXP = false;
public boolean NightVision = false;
private IPacketHandler _useEntityPacketHandler;
private int _deadBodyCount;
private NautHashMap<String, Entity> _deadBodies = new NautHashMap<String, Entity>();

View File

@ -2,7 +2,6 @@ package nautilus.game.arcade.game.games.baconbrawl.kits;
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityDestroy;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Pig;
@ -38,7 +37,7 @@ public class KitMamaPig extends Kit
}
@Override
public void GiveItems(final Player player)
public void GiveItems(Player player)
{
player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE));
@ -49,7 +48,7 @@ public class KitMamaPig extends Kit
Manager.GetDisguise().disguise(disguise);
Manager.GetGame().CreatureAllowOverride = true;
final Pig pig = player.getWorld().spawn(player.getEyeLocation(), Pig.class);
Pig pig = player.getWorld().spawn(player.getEyeLocation(), Pig.class);
pig.setBaby();
pig.setAgeLock(true);
pig.setCustomName(C.cYellow + player.getName());
@ -58,7 +57,7 @@ public class KitMamaPig extends Kit
player.setPassenger(pig);
Bukkit.getScheduler().runTaskLater(Manager.getPlugin(), () -> UtilPlayer.sendPacket(player, new PacketPlayOutEntityDestroy(new int[]{pig.getEntityId()})), 2);
// Manager.runSyncLater(() -> UtilPlayer.sendPacket(player, new PacketPlayOutEntityDestroy(new int[]{pig.getEntityId()})), 2);
}
@EventHandler(priority = EventPriority.LOWEST)

View File

@ -60,7 +60,7 @@ public class PerkCrispyBacon extends Perk
Item item = player.getWorld().dropItem(location, new ItemBuilder(Material.GRILLED_PORK)
.setTitle(String.valueOf(UtilMath.r(1000)))
.build());
item.setVelocity(new Vector((Math.random() - 0.5) * 0.3, 0.4, (Math.random() - 0.5) * 0.3));
item.setVelocity(new Vector((Math.random() - 0.5) * 0.5, 0.4, (Math.random() - 0.5) * 0.5));
Manager.GetFire().Add(item, player, 10, 1, 2, 2, GetName(), false);
}
}

View File

@ -71,7 +71,7 @@ public class BombLobbers extends TeamGame implements IThrown
"Fight against your enemies using",
"the power of " + C.cRed + "Explosives!",
C.cGreen + "Left-Click" + C.Reset + " TNT to throw at your enemy.",
C.cYellow + "Last Team" + " alive wins!"
C.cYellow + "Last Team" + C.Reset + " alive wins!"
};
private final Map<GameTeam, Location> _averageSpawns = new HashMap<>();
@ -230,7 +230,7 @@ public class BombLobbers extends TeamGame implements IThrown
Player player = event.getPlayer();
ItemStack itemStack = player.getItemInHand();
if (!IsAlive(player) || itemStack == null || itemStack.getType() == Material.TNT)
if (!IsAlive(player) || itemStack == null || itemStack.getType() != Material.TNT)
{
return;
}

View File

@ -50,12 +50,26 @@ public class KitPitcher extends Kit
}
@Override
public void GiveItems(Player player)
public void ApplyKit(Player player)
{
UtilInv.Clear(player);
for (Perk perk : GetPerks())
{
perk.Apply(player);
}
GiveItemsCall(player);
player.getInventory().setItem(1, PLAYER_ITEMS[0]);
player.getInventory().setArmorContents(PLAYER_ARMOR);
}
@Override
public void GiveItems(Player player)
{
}
@EventHandler
public void setFuse(TNTThrowEvent event)
{

View File

@ -17,8 +17,6 @@ import org.bukkit.event.EventHandler;
import org.bukkit.event.entity.EntityChangeBlockEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import com.mineplex.anticheat.checks.move.Glide;
import com.mineplex.anticheat.checks.move.HeadRoll;
@ -40,7 +38,6 @@ import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.PlayerPrepareTeleportEvent;
import nautilus.game.arcade.game.SoloGame;
import nautilus.game.arcade.game.games.runner.kits.KitArcher;
import nautilus.game.arcade.game.games.runner.kits.KitFrosty;
@ -78,6 +75,7 @@ public class Runner extends SoloGame implements IThrown
HungerSet = 20;
WorldWaterDamage = 4;
PrepareFreeze = false;
NightVision = true;
new CompassModule()
.register(this);
@ -99,12 +97,6 @@ public class Runner extends SoloGame implements IThrown
antiHack.addIgnoredCheck(HeadRoll.class);
}
@EventHandler
public void teleportIn(PlayerPrepareTeleportEvent event)
{
event.GetPlayer().addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION, Integer.MAX_VALUE, 0, false, false));
}
@EventHandler
public void arrowDamage(ProjectileHitEvent event)
{

View File

@ -1,6 +1,5 @@
package nautilus.game.arcade.game.games.runner.kits;
import org.bukkit.EntityEffect;
import org.bukkit.Material;
import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
@ -26,7 +25,6 @@ public class KitFrosty extends Kit
public KitFrosty(ArcadeManager manager)
{
super(manager, GameKit.RUNNER_FROSTY, PERKS);
}
@Override
@ -38,14 +36,12 @@ public class KitFrosty extends Kit
@EventHandler
public void SnowballHit(CustomDamageEvent event)
{
if (event.GetProjectile() == null)
if (event.GetProjectile() == null || !(event.GetProjectile() instanceof Snowball))
{
return;
}
if (!(event.GetProjectile() instanceof Snowball))
return;
event.GetDamageeEntity().playEffect(EntityEffect.HURT);
Manager.GetCondition().Factory().Slow("Snowball Slow", event.GetDamageeEntity(), (LivingEntity) event.GetProjectile().getShooter(), 2, 1, false, false, true, false);
event.SetKnockback(false);
Manager.GetCondition().Factory().Slow("Snowball Slow", event.GetDamageeEntity(), (LivingEntity) event.GetProjectile().getShooter(), 2, 2, false, false, true, false);
}
}

View File

@ -12,8 +12,6 @@ import org.bukkit.event.EventPriority;
import org.bukkit.event.block.BlockDamageEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import mineplex.core.common.util.C;
import mineplex.core.common.util.F;
@ -31,7 +29,6 @@ import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.PlayerPrepareTeleportEvent;
import nautilus.game.arcade.game.SoloGame;
import nautilus.game.arcade.game.games.spleef.kits.KitArcher;
import nautilus.game.arcade.game.games.spleef.kits.KitBrawler;
@ -63,6 +60,7 @@ public class Spleef extends SoloGame
DamagePvP = false;
WorldWaterDamage = 4;
PrepareFreeze = false;
NightVision = true;
registerStatTrackers(
new SpleefBlockDestroyStatTracker(this)
@ -81,12 +79,6 @@ public class Spleef extends SoloGame
.register(this);
}
@EventHandler
public void teleportIn(PlayerPrepareTeleportEvent event)
{
event.GetPlayer().addPotionEffect(new PotionEffect(PotionEffectType.NIGHT_VISION, Integer.MAX_VALUE, 0, false, false));
}
@EventHandler
public void snowballHit(ProjectileHitEvent event)
{

View File

@ -153,6 +153,7 @@ public class TurfForts extends TeamGame
DamageFall = false;
DeathSpectateSecs = 4;
GameTimeout = TimeUnit.MINUTES.toMillis(15);
InventoryClick = true;
_breakStatTracker = new BlockBreakStatTracker(this, false);

View File

@ -45,6 +45,7 @@ import org.bukkit.event.player.PlayerPickupItemEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.inventory.ItemStack;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.util.Vector;
import mineplex.core.Managers;
@ -919,8 +920,10 @@ public class GameFlagManager implements Listener
}
}
if (game == null || !game.IsLive())
if (game == null || !game.InProgress())
{
return;
}
if (game.HungerSet != -1)
{
@ -941,6 +944,19 @@ public class GameFlagManager implements Listener
player.setHealth(Math.min(game.HealthSet, player.getMaxHealth()));
}
}
if (game.NightVision)
{
for (Player player : UtilServer.getPlayersCollection())
{
if (player.hasPotionEffect(PotionEffectType.NIGHT_VISION))
{
continue;
}
Manager.GetCondition().Factory().NightVision("Night Vision", player, player, Integer.MAX_VALUE, 0, false, false, false);
}
}
}
@EventHandler(priority = EventPriority.LOWEST)