From d95a8fe78790ee6bf95cb407332f1283fb21a0ee Mon Sep 17 00:00:00 2001 From: Sam Date: Mon, 4 Dec 2017 23:10:19 +0000 Subject: [PATCH] Changes from Joe --- .../game/games/christmasnew/ChristmasNew.java | 7 ++--- .../games/christmasnew/present/Present.java | 26 ++++--------------- .../games/christmasnew/section/Section.java | 12 ++++----- .../section/five/SnowmenKong.java | 2 +- .../christmasnew/section/four/MobDefense.java | 6 ++--- .../christmasnew/section/four/Section4.java | 6 ++--- .../christmasnew/section/two/RockParkour.java | 4 +++ 7 files changed, 24 insertions(+), 39 deletions(-) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmasnew/ChristmasNew.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmasnew/ChristmasNew.java index 62da08cf1..907f70cd1 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmasnew/ChristmasNew.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmasnew/ChristmasNew.java @@ -73,6 +73,7 @@ public class ChristmasNew extends ChristmasCommon new KitPlayer(manager) }, DESCRIPTION); + StrictAntiHack = true; WorldTimeSet = 4000; WinEffectEnabled = false; } @@ -93,7 +94,7 @@ public class ChristmasNew extends ChristmasCommon _sections.add(new Section1(this, targets.remove(0), presents.remove(0), presents.remove(0))); _sections.add(new Section2(this, targets.remove(0), presents.remove(0), presents.remove(0))); _sections.add(new Section3(this, targets.remove(0), presents.remove(0))); - _sections.add(new Section4(this, targets.remove(0), presents.remove(0), presents.remove(0))); + _sections.add(new Section4(this, targets.remove(0))); _sections.add(new Section5(this, targets.remove(0), presents.remove(0), presents.remove(0))); _sections.add(new Section6(this, targets.remove(0), presents.remove(0))); @@ -137,8 +138,8 @@ public class ChristmasNew extends ChristmasCommon TextAlign align = TextAlign.CENTER; UtilBlockText.MakeText("Merry Christmas", location, face, blockId, (byte) 14, align); - UtilBlockText.MakeText("from", location.subtract(0, 6, 0), BlockFace.WEST, blockId, (byte) 5, align); - UtilBlockText.MakeText("Mineplex", location.subtract(0, 6, 0), BlockFace.WEST, blockId, (byte) 4, align); + UtilBlockText.MakeText("from", location.subtract(0, 6, 0), face, blockId, (byte) 5, align); + UtilBlockText.MakeText("Mineplex", location.subtract(0, 6, 0), face, blockId, (byte) 4, align); for (Player player : UtilServer.getPlayersCollection()) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmasnew/present/Present.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmasnew/present/Present.java index 31d034d4b..f13178758 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmasnew/present/Present.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmasnew/present/Present.java @@ -1,8 +1,5 @@ package nautilus.game.arcade.game.games.christmasnew.present; -import java.util.ArrayList; -import java.util.List; - import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.entity.ArmorStand; @@ -18,7 +15,6 @@ import mineplex.core.lifetimes.Component; public class Present implements Component { - private static final int PRESENTS_PER_COLLECTION = 2; private static final ItemStack PRESENT = SkinData.PRESENT.getSkull(); private static final int ROTATION_ITERATIONS = 20; private static final double ROTATION_DELTA_Y = 1D / ROTATION_ITERATIONS; @@ -27,12 +23,10 @@ public class Present implements Component private final Location _location; private final ArmorStand _stand; - private final List _collectedPlayers; - private int _iterations; private boolean _down; - private int _collected; + private boolean _collected; public Present(Location location) { @@ -45,8 +39,6 @@ public class Present implements Component _stand.setRemoveWhenFarAway(false); UtilEnt.setTickWhenFarAway(_stand, true); - _collectedPlayers = new ArrayList<>(PRESENTS_PER_COLLECTION); - MapUtil.QuickChangeBlockAt(_location, Material.SNOW_BLOCK); } @@ -94,24 +86,16 @@ public class Present implements Component public boolean isColliding(Player player) { - return !_collectedPlayers.contains(player) && UtilMath.offsetSquared(player, _stand) < 4; + return UtilMath.offsetSquared(player, _stand) < 4; } - public boolean setCollected(Player player) + public void setCollected() { - _collectedPlayers.add(player); - _collected++; - - return isCollected(); + _collected = true; } public boolean isCollected() { - return _collected == PRESENTS_PER_COLLECTION; - } - - public int getLeft() - { - return PRESENTS_PER_COLLECTION - _collected; + return _collected; } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmasnew/section/Section.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmasnew/section/Section.java index dfe7a08f0..1191ec140 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmasnew/section/Section.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmasnew/section/Section.java @@ -98,11 +98,6 @@ public abstract class Section extends SimpleLifetime implements Listener, Sectio { int left = 0; - if (present.setCollected(player)) - { - present.deactivate(); - } - for (SectionChallenge challenge : _challenges) { Present otherPresent = challenge.getPresent(); @@ -116,10 +111,13 @@ public abstract class Section extends SimpleLifetime implements Listener, Sectio { challenge.onPresentCollect(); } - - left += present.getLeft(); + else if (!otherPresent.isCollected()) + { + left++; + } } + present.setCollected(); Location location = present.getLocation(); _host.sendSantaMessage("Well done " + player.getName() + " you found a present!" + (left > 0 ? " Only " + left + " to go!" : ""), null); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmasnew/section/five/SnowmenKong.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmasnew/section/five/SnowmenKong.java index 99677e8ab..ab66aa663 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmasnew/section/five/SnowmenKong.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmasnew/section/five/SnowmenKong.java @@ -148,7 +148,7 @@ class SnowmenKong extends SectionChallenge } Location target = entity.getLocation().add(0, -1, (wave.PositiveZ ? 2 : -2)); - UtilEnt.CreatureMove(entity, target, 1.6F); + UtilEnt.CreatureMove(entity, target, 1.8F); if (entity.getTicksLived() < MIN_TICKS_BEFORE_HIT) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmasnew/section/four/MobDefense.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmasnew/section/four/MobDefense.java index 2c2d77d2c..74b68b4d3 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmasnew/section/four/MobDefense.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmasnew/section/four/MobDefense.java @@ -56,9 +56,9 @@ class MobDefense extends SectionChallenge private int _wave; private Ghast _ghast; - MobDefense(ChristmasNew host, Location present, Section section, List mobSpawns, Location ghastSpawn, Location generator, List healthIndicators, List particles) + MobDefense(ChristmasNew host, Section section, List mobSpawns, Location ghastSpawn, Location generator, List healthIndicators, List particles) { - super(host, present, section); + super(host, null, section); _mobSpawns = mobSpawns; _generator = generator; @@ -197,7 +197,7 @@ class MobDefense extends SectionChallenge Location location = _ghast.getLocation().add(0, 0.5, 0); Fireball fireball = _ghast.launchProjectile(LargeFireball.class); fireball.setBounce(false); - fireball.setDirection(UtilAlg.getTrajectory(location, _generator).multiply(0.5)); + fireball.setDirection(UtilAlg.getTrajectory(location, _generator).multiply(0.01)); } @EventHandler diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmasnew/section/four/Section4.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmasnew/section/four/Section4.java index c56955ace..6bb35df81 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmasnew/section/four/Section4.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmasnew/section/four/Section4.java @@ -24,14 +24,13 @@ public class Section4 extends Section private long _lastWave; private int _wave; - public Section4(ChristmasNew host, Location sleighTarget, Location... presents) + public Section4(ChristmasNew host, Location sleighTarget) { super(host, sleighTarget); registerChallenges( new MobDefense( host, - presents[0], this, _worldData.GetDataLocs("SILVER"), _worldData.GetCustomLocs("GHAST LEFT").get(0), @@ -41,7 +40,6 @@ public class Section4 extends Section ), new MobDefense( host, - presents[1], this, _worldData.GetDataLocs("GRAY"), _worldData.GetCustomLocs("GHAST RIGHT").get(0), @@ -67,7 +65,7 @@ public class Section4 extends Section @Override public boolean isComplete() { - return super.isComplete() && _wave > WAVES; + return _wave > WAVES; } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmasnew/section/two/RockParkour.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmasnew/section/two/RockParkour.java index 78093e168..f4a47d72e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmasnew/section/two/RockParkour.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/christmasnew/section/two/RockParkour.java @@ -5,6 +5,8 @@ import java.util.List; import org.bukkit.Location; import org.bukkit.entity.Spider; import org.bukkit.event.EventHandler; +import org.bukkit.potion.PotionEffect; +import org.bukkit.potion.PotionEffectType; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilPlayer; @@ -19,6 +21,7 @@ class RockParkour extends SectionChallenge { private static final int MAX_MOBS = 25; + private static final PotionEffect SPEED = new PotionEffect(PotionEffectType.SPEED, Integer.MAX_VALUE, 0, false, false); private final List _mobSpawns; @@ -59,6 +62,7 @@ class RockParkour extends SectionChallenge Spider spawned = spawn(UtilAlg.Random(_mobSpawns), Spider.class); spawned.setRemoveWhenFarAway(false); + spawned.addPotionEffect(SPEED); _entities.forEach(entity -> {