Changes from Joe

This commit is contained in:
Sam 2017-12-04 23:10:19 +00:00 committed by Alexander Meech
parent 7496a90034
commit d95a8fe787
7 changed files with 24 additions and 39 deletions

View File

@ -73,6 +73,7 @@ public class ChristmasNew extends ChristmasCommon
new KitPlayer(manager) new KitPlayer(manager)
}, DESCRIPTION); }, DESCRIPTION);
StrictAntiHack = true;
WorldTimeSet = 4000; WorldTimeSet = 4000;
WinEffectEnabled = false; 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 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 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 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 Section5(this, targets.remove(0), presents.remove(0), presents.remove(0)));
_sections.add(new Section6(this, targets.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; TextAlign align = TextAlign.CENTER;
UtilBlockText.MakeText("Merry Christmas", location, face, blockId, (byte) 14, align); 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("from", location.subtract(0, 6, 0), face, blockId, (byte) 5, align);
UtilBlockText.MakeText("Mineplex", location.subtract(0, 6, 0), BlockFace.WEST, blockId, (byte) 4, align); UtilBlockText.MakeText("Mineplex", location.subtract(0, 6, 0), face, blockId, (byte) 4, align);
for (Player player : UtilServer.getPlayersCollection()) for (Player player : UtilServer.getPlayersCollection())
{ {

View File

@ -1,8 +1,5 @@
package nautilus.game.arcade.game.games.christmasnew.present; package nautilus.game.arcade.game.games.christmasnew.present;
import java.util.ArrayList;
import java.util.List;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.entity.ArmorStand; import org.bukkit.entity.ArmorStand;
@ -18,7 +15,6 @@ import mineplex.core.lifetimes.Component;
public class Present implements 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 ItemStack PRESENT = SkinData.PRESENT.getSkull();
private static final int ROTATION_ITERATIONS = 20; private static final int ROTATION_ITERATIONS = 20;
private static final double ROTATION_DELTA_Y = 1D / ROTATION_ITERATIONS; 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 Location _location;
private final ArmorStand _stand; private final ArmorStand _stand;
private final List<Player> _collectedPlayers;
private int _iterations; private int _iterations;
private boolean _down; private boolean _down;
private int _collected; private boolean _collected;
public Present(Location location) public Present(Location location)
{ {
@ -45,8 +39,6 @@ public class Present implements Component
_stand.setRemoveWhenFarAway(false); _stand.setRemoveWhenFarAway(false);
UtilEnt.setTickWhenFarAway(_stand, true); UtilEnt.setTickWhenFarAway(_stand, true);
_collectedPlayers = new ArrayList<>(PRESENTS_PER_COLLECTION);
MapUtil.QuickChangeBlockAt(_location, Material.SNOW_BLOCK); MapUtil.QuickChangeBlockAt(_location, Material.SNOW_BLOCK);
} }
@ -94,24 +86,16 @@ public class Present implements Component
public boolean isColliding(Player player) 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 = true;
_collected++;
return isCollected();
} }
public boolean isCollected() public boolean isCollected()
{ {
return _collected == PRESENTS_PER_COLLECTION; return _collected;
}
public int getLeft()
{
return PRESENTS_PER_COLLECTION - _collected;
} }
} }

View File

@ -98,11 +98,6 @@ public abstract class Section extends SimpleLifetime implements Listener, Sectio
{ {
int left = 0; int left = 0;
if (present.setCollected(player))
{
present.deactivate();
}
for (SectionChallenge challenge : _challenges) for (SectionChallenge challenge : _challenges)
{ {
Present otherPresent = challenge.getPresent(); Present otherPresent = challenge.getPresent();
@ -116,10 +111,13 @@ public abstract class Section extends SimpleLifetime implements Listener, Sectio
{ {
challenge.onPresentCollect(); challenge.onPresentCollect();
} }
else if (!otherPresent.isCollected())
left += present.getLeft(); {
left++;
}
} }
present.setCollected();
Location location = present.getLocation(); Location location = present.getLocation();
_host.sendSantaMessage("Well done " + player.getName() + " you found a present!" + (left > 0 ? " Only " + left + " to go!" : ""), null); _host.sendSantaMessage("Well done " + player.getName() + " you found a present!" + (left > 0 ? " Only " + left + " to go!" : ""), null);

View File

@ -148,7 +148,7 @@ class SnowmenKong extends SectionChallenge
} }
Location target = entity.getLocation().add(0, -1, (wave.PositiveZ ? 2 : -2)); 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) if (entity.getTicksLived() < MIN_TICKS_BEFORE_HIT)
{ {

View File

@ -56,9 +56,9 @@ class MobDefense extends SectionChallenge
private int _wave; private int _wave;
private Ghast _ghast; private Ghast _ghast;
MobDefense(ChristmasNew host, Location present, Section section, List<Location> mobSpawns, Location ghastSpawn, Location generator, List<Location> healthIndicators, List<Location> particles) MobDefense(ChristmasNew host, Section section, List<Location> mobSpawns, Location ghastSpawn, Location generator, List<Location> healthIndicators, List<Location> particles)
{ {
super(host, present, section); super(host, null, section);
_mobSpawns = mobSpawns; _mobSpawns = mobSpawns;
_generator = generator; _generator = generator;
@ -197,7 +197,7 @@ class MobDefense extends SectionChallenge
Location location = _ghast.getLocation().add(0, 0.5, 0); Location location = _ghast.getLocation().add(0, 0.5, 0);
Fireball fireball = _ghast.launchProjectile(LargeFireball.class); Fireball fireball = _ghast.launchProjectile(LargeFireball.class);
fireball.setBounce(false); fireball.setBounce(false);
fireball.setDirection(UtilAlg.getTrajectory(location, _generator).multiply(0.5)); fireball.setDirection(UtilAlg.getTrajectory(location, _generator).multiply(0.01));
} }
@EventHandler @EventHandler

View File

@ -24,14 +24,13 @@ public class Section4 extends Section
private long _lastWave; private long _lastWave;
private int _wave; private int _wave;
public Section4(ChristmasNew host, Location sleighTarget, Location... presents) public Section4(ChristmasNew host, Location sleighTarget)
{ {
super(host, sleighTarget); super(host, sleighTarget);
registerChallenges( registerChallenges(
new MobDefense( new MobDefense(
host, host,
presents[0],
this, this,
_worldData.GetDataLocs("SILVER"), _worldData.GetDataLocs("SILVER"),
_worldData.GetCustomLocs("GHAST LEFT").get(0), _worldData.GetCustomLocs("GHAST LEFT").get(0),
@ -41,7 +40,6 @@ public class Section4 extends Section
), ),
new MobDefense( new MobDefense(
host, host,
presents[1],
this, this,
_worldData.GetDataLocs("GRAY"), _worldData.GetDataLocs("GRAY"),
_worldData.GetCustomLocs("GHAST RIGHT").get(0), _worldData.GetCustomLocs("GHAST RIGHT").get(0),
@ -67,7 +65,7 @@ public class Section4 extends Section
@Override @Override
public boolean isComplete() public boolean isComplete()
{ {
return super.isComplete() && _wave > WAVES; return _wave > WAVES;
} }
@Override @Override

View File

@ -5,6 +5,8 @@ import java.util.List;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.entity.Spider; import org.bukkit.entity.Spider;
import org.bukkit.event.EventHandler; 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.UtilAlg;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
@ -19,6 +21,7 @@ class RockParkour extends SectionChallenge
{ {
private static final int MAX_MOBS = 25; 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<Location> _mobSpawns; private final List<Location> _mobSpawns;
@ -59,6 +62,7 @@ class RockParkour extends SectionChallenge
Spider spawned = spawn(UtilAlg.Random(_mobSpawns), Spider.class); Spider spawned = spawn(UtilAlg.Random(_mobSpawns), Spider.class);
spawned.setRemoveWhenFarAway(false); spawned.setRemoveWhenFarAway(false);
spawned.addPotionEffect(SPEED);
_entities.forEach(entity -> _entities.forEach(entity ->
{ {