Get the game into a functional state
This commit is contained in:
parent
f00b774056
commit
c0d530404e
@ -12,7 +12,6 @@ import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftHorse;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -25,10 +24,12 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.entity.EntityDeathEvent;
|
||||
import org.bukkit.event.entity.ItemSpawnEvent;
|
||||
|
||||
import mineplex.core.account.permissions.Permission;
|
||||
import mineplex.core.account.permissions.PermissionGroup;
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.MapUtil;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
@ -52,12 +53,19 @@ import nautilus.game.arcade.kit.Kit;
|
||||
public class ChristmasCommon extends SoloGame
|
||||
{
|
||||
|
||||
private static final int BARRIER_BREAK_SQUARED = 400;
|
||||
private static final int MIN_Y = 50;
|
||||
public enum Perm implements Permission
|
||||
{
|
||||
DEBUG_COMMANDS
|
||||
}
|
||||
|
||||
private static final int BARRIER_BREAK_SQUARED = 600;
|
||||
private static final int MIN_Y = 40;
|
||||
|
||||
protected final List<Section> _sections;
|
||||
private Section _currentSection;
|
||||
|
||||
private boolean _forceSkip;
|
||||
|
||||
private GameTeam _badGuys;
|
||||
|
||||
private List<Location> _barrier;
|
||||
@ -140,6 +148,12 @@ public class ChristmasCommon extends SoloGame
|
||||
|
||||
new CompassModule()
|
||||
.register(this);
|
||||
|
||||
registerDebugCommand("skip", Perm.DEBUG_COMMANDS, PermissionGroup.ADMIN, (player, args) ->
|
||||
{
|
||||
_forceSkip = true;
|
||||
player.sendMessage(F.main("Debug", "Skipping current challenge."));
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -171,7 +185,7 @@ public class ChristmasCommon extends SoloGame
|
||||
return;
|
||||
}
|
||||
|
||||
if (_currentSection == null || _currentSection.isComplete())
|
||||
if (_currentSection == null || _currentSection.isComplete() || _forceSkip)
|
||||
{
|
||||
if (_currentSection != null)
|
||||
{
|
||||
@ -179,6 +193,7 @@ public class ChristmasCommon extends SoloGame
|
||||
_currentSection.end();
|
||||
}
|
||||
|
||||
_forceSkip = false;
|
||||
_currentSection = getNext();
|
||||
|
||||
if (_currentSection == null)
|
||||
@ -331,36 +346,16 @@ public class ChristmasCommon extends SoloGame
|
||||
return;
|
||||
}
|
||||
|
||||
Location breakAt = null;
|
||||
|
||||
for (Location loc : _barrier)
|
||||
_barrier.removeIf(location ->
|
||||
{
|
||||
if (UtilMath.offsetSquared(getSleigh().GetLocation(), loc) > BARRIER_BREAK_SQUARED)
|
||||
if (UtilMath.offsetSquared(getSleigh().GetLocation(), location) > BARRIER_BREAK_SQUARED)
|
||||
{
|
||||
continue;
|
||||
return false;
|
||||
}
|
||||
|
||||
breakAt = loc;
|
||||
}
|
||||
|
||||
if (breakAt != null)
|
||||
{
|
||||
_barrier.remove(breakAt);
|
||||
barrierBreak(breakAt);
|
||||
}
|
||||
}
|
||||
|
||||
private void barrierBreak(Location location)
|
||||
{
|
||||
MapUtil.QuickChangeBlockAt(location, Material.AIR);
|
||||
|
||||
for (Block block : UtilBlock.getSurrounding(location.getBlock(), false))
|
||||
{
|
||||
if (_barrier.remove(block.getLocation()))
|
||||
{
|
||||
barrierBreak(block.getLocation());
|
||||
}
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
@ -4,24 +4,17 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.FireworkEffect;
|
||||
import org.bukkit.FireworkEffect.Type;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Chicken;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilFirework;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
@ -252,10 +245,6 @@ public class Sleigh
|
||||
public void AddPresent(Location loc)
|
||||
{
|
||||
PresentsCollected.add(loc);
|
||||
loc.getBlock().setType(Material.AIR);
|
||||
loc.getBlock().getRelative(BlockFace.DOWN).getRelative(BlockFace.DOWN).setType(Material.IRON_BLOCK);
|
||||
loc.getBlock().getRelative(BlockFace.DOWN).setType(Material.GLASS);
|
||||
UtilFirework.launchFirework(loc.clone().add(0.5, 0.5, 0.5), FireworkEffect.builder().flicker(false).withColor(Color.YELLOW).with(Type.BALL).trail(true).build(), new Vector(0, 1, 0), 0);
|
||||
|
||||
SleighPart part = PresentSlots.remove(0);
|
||||
if (part == null)
|
||||
|
@ -53,7 +53,7 @@ public class ChristmasNew extends ChristmasCommon
|
||||
}
|
||||
|
||||
// Take the parse at the purple bridge
|
||||
// /parse600 129 88 137 165 14 110 179 21 22 121
|
||||
// /parse600 129 88 137 165 14 110 179 21 22 153 103 121
|
||||
@Override
|
||||
public void ParseData()
|
||||
{
|
||||
@ -70,7 +70,7 @@ public class ChristmasNew extends ChristmasCommon
|
||||
_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 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)));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
@ -81,7 +81,7 @@ public class Present implements Component
|
||||
|
||||
public boolean isColliding(Player player)
|
||||
{
|
||||
return UtilMath.offsetSquared(player, _stand) < 9;
|
||||
return UtilMath.offsetSquared(player, _stand) < 4;
|
||||
}
|
||||
|
||||
public boolean isCollected()
|
||||
|
@ -103,10 +103,12 @@ public abstract class Section extends SimpleLifetime implements Listener, Sectio
|
||||
|
||||
_host.sendSantaMessage("Well done " + player.getName() + " you found a present!" + (left > 0 ? " Only " + left + " to go!" : ""), null);
|
||||
|
||||
for (int i = 0; i < 5; i++)
|
||||
for (int i = 0; i < 3; i++)
|
||||
{
|
||||
UtilFirework.launchFirework(location, FIREWORK_EFFECT, null, UtilMath.r(3));
|
||||
}
|
||||
|
||||
_host.getSleigh().AddPresent(location);
|
||||
}
|
||||
|
||||
public Location getSleighTarget()
|
||||
|
@ -18,7 +18,6 @@ import mineplex.core.updater.event.UpdateEvent;
|
||||
|
||||
import nautilus.game.arcade.game.games.christmasnew.ChristmasNew;
|
||||
import nautilus.game.arcade.game.games.christmasnew.section.Section;
|
||||
import nautilus.game.arcade.game.games.christmasnew.section.SectionChallenge;
|
||||
|
||||
public class Section5 extends Section
|
||||
{
|
||||
@ -40,6 +39,7 @@ public class Section5 extends Section
|
||||
_solidifyAt = _bridgeBlocks.get(0).getBlockY();
|
||||
|
||||
registerChallenges(
|
||||
new SwitchParkour(host, presents[0], this),
|
||||
new SnowmenKong(host, presents[1], this)
|
||||
);
|
||||
}
|
||||
@ -78,6 +78,8 @@ public class Section5 extends Section
|
||||
FallingBlock fallingBlock = location.getWorld().spawnFallingBlock(location.add(0, 8, 0), Material.WOOL, colour);
|
||||
fallingBlock.setDropItem(false);
|
||||
fallingBlock.setHurtEntities(false);
|
||||
|
||||
_fallingBlocks.add(fallingBlock);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -112,6 +114,8 @@ public class Section5 extends Section
|
||||
|
||||
if (location.getBlockY() <= _solidifyAt)
|
||||
{
|
||||
block.remove();
|
||||
location.setY(_solidifyAt);
|
||||
MapUtil.QuickChangeBlockAt(location, block.getMaterial(), block.getBlockData());
|
||||
|
||||
if (Math.random() > 0.8)
|
||||
|
@ -68,6 +68,9 @@ class SwitchParkour extends SectionChallenge
|
||||
@Override
|
||||
public void onUnregister()
|
||||
{
|
||||
_white.forEach(location -> MapUtil.QuickChangeBlockAt(location, Material.AIR));
|
||||
_black.forEach(location -> MapUtil.QuickChangeBlockAt(location, Material.AIR));
|
||||
|
||||
_checkpointHologram.stop();
|
||||
}
|
||||
|
||||
@ -136,7 +139,7 @@ class SwitchParkour extends SectionChallenge
|
||||
|
||||
_hasCheckpointed = true;
|
||||
|
||||
_checkpointTrigger.getWorld().playSound(_checkpointTrigger, Sound.LEVEL_UP, 1, 0.5F);
|
||||
_checkpointTrigger.getWorld().playSound(_checkpointTrigger, Sound.LEVEL_UP, 2, 0.5F);
|
||||
MapUtil.QuickChangeBlockAt(_checkpointTrigger, Material.AIR);
|
||||
_checkpointHologram.stop();
|
||||
|
||||
@ -152,7 +155,7 @@ class SwitchParkour extends SectionChallenge
|
||||
{
|
||||
if (location.getY() > y)
|
||||
{
|
||||
location.getWorld().playSound(location, Sound.PISTON_RETRACT, 1, 0.6F);
|
||||
location.getWorld().playSound(location, Sound.PISTON_RETRACT, 2, 0.6F);
|
||||
MapUtil.QuickChangeBlockAt(location, Material.COBBLESTONE_STAIRS, (byte) 1);
|
||||
return true;
|
||||
}
|
||||
@ -169,6 +172,6 @@ class SwitchParkour extends SectionChallenge
|
||||
y--;
|
||||
}
|
||||
}
|
||||
}, 0, 10);
|
||||
}, 0, 6);
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ import org.bukkit.entity.Blaze;
|
||||
import org.bukkit.entity.Creature;
|
||||
import org.bukkit.entity.Creeper;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Golem;
|
||||
import org.bukkit.entity.IronGolem;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Monster;
|
||||
import org.bukkit.entity.Skeleton;
|
||||
@ -130,7 +130,7 @@ class MobDefense extends SectionChallenge
|
||||
spawnMob(Skeleton.class, skeletons);
|
||||
spawnMob(Creeper.class, creepers);
|
||||
spawnMob(Blaze.class, blazes);
|
||||
spawnMob(Golem.class, golems);
|
||||
spawnMob(IronGolem.class, golems);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
@ -36,13 +36,13 @@ class CaveIn extends SectionChallenge
|
||||
{
|
||||
super(host, present, section);
|
||||
|
||||
_triggerZ = _worldData.GetDataLocs("ORANGE").get(0).getBlockY();
|
||||
_triggerZ = _worldData.GetDataLocs("ORANGE").get(0).getBlockZ();
|
||||
_blocksToExplode = _worldData.GetCustomLocs(String.valueOf(Material.GOLD_ORE.getId()));
|
||||
_blocksToFall = _worldData.GetCustomLocs(String.valueOf(Material.MYCEL.getId()));
|
||||
_blocksToClear = _worldData.GetCustomLocs(String.valueOf(Material.RED_SANDSTONE.getId()));
|
||||
|
||||
_blocksToExplode.forEach(location -> MapUtil.QuickChangeBlockAt(location, Material.AIR));
|
||||
_blocksToFall.forEach(location -> MapUtil.QuickChangeBlockAt(location, Material.STONE));
|
||||
_blocksToFall.forEach(location -> MapUtil.QuickChangeBlockAt(location, Material.COBBLESTONE));
|
||||
_blocksToClear.forEach(location -> MapUtil.QuickChangeBlockAt(location, Material.AIR));
|
||||
}
|
||||
|
||||
@ -109,7 +109,7 @@ class CaveIn extends SectionChallenge
|
||||
{
|
||||
MapUtil.QuickChangeBlockAt(location, Material.AIR);
|
||||
|
||||
FallingBlock fallingBlock = location.getWorld().spawnFallingBlock(location.add(0.5, 0, 0.5), Material.STONE, (byte) 0);
|
||||
FallingBlock fallingBlock = location.getWorld().spawnFallingBlock(location.add(0.5, 0, 0.5), ALLOW_BREAK, (byte) 0);
|
||||
fallingBlock.setHurtEntities(false);
|
||||
fallingBlock.setDropItem(false);
|
||||
});
|
||||
|
@ -65,6 +65,37 @@ class IceMaze extends SectionChallenge
|
||||
{
|
||||
int sleighHeight = _host.getSleigh().GetLocation().getBlockY();
|
||||
|
||||
removeMaze(sleighHeight);
|
||||
fillMaze(sleighHeight);
|
||||
}
|
||||
|
||||
private void removeMaze(int sleighHeight)
|
||||
{
|
||||
_host.getArcadeManager().runSyncTimer(new BukkitRunnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
for (int i = 0; i < 30; i++)
|
||||
{
|
||||
Location location = _mazeBlocks.remove(0);
|
||||
|
||||
if (location.getY() < sleighHeight)
|
||||
{
|
||||
cancel();
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
MapUtil.QuickChangeBlockAt(location, Material.AIR);
|
||||
}
|
||||
}
|
||||
}
|
||||
}, 0, 1);
|
||||
}
|
||||
|
||||
private void fillMaze(int sleighHeight)
|
||||
{
|
||||
_host.getArcadeManager().runSyncTimer(new BukkitRunnable()
|
||||
{
|
||||
@Override
|
||||
@ -72,34 +103,22 @@ class IceMaze extends SectionChallenge
|
||||
{
|
||||
for (int i = 0; i < 20; i++)
|
||||
{
|
||||
Location location = _mazeBlocks.remove(0);
|
||||
|
||||
if (location.getY() <= sleighHeight)
|
||||
{
|
||||
cancel();
|
||||
|
||||
_host.getArcadeManager().runSyncTimer(new BukkitRunnable()
|
||||
{
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
for (int i = 0; i < 20 && !_mazeBlocks.isEmpty(); i++)
|
||||
{
|
||||
Location location = _mazeBlocks.remove(_mazeBlocks.size() - 1);
|
||||
|
||||
MapUtil.QuickChangeBlockAt(location, Material.ICE);
|
||||
}
|
||||
|
||||
if (_mazeBlocks.isEmpty())
|
||||
{
|
||||
cancel();
|
||||
return;
|
||||
}
|
||||
}
|
||||
}, 0, 1);
|
||||
|
||||
Location location = _mazeBlocks.remove(_mazeBlocks.size() - 1);
|
||||
|
||||
if (location.getY() > sleighHeight)
|
||||
{
|
||||
cancel();
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
MapUtil.QuickChangeBlockAt(location, Material.AIR);
|
||||
MapUtil.QuickChangeBlockAt(location, Material.ICE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.FireworkEffect;
|
||||
import org.bukkit.FireworkEffect.Type;
|
||||
@ -19,6 +20,7 @@ import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
@ -87,9 +89,15 @@ class SnowTurrets extends SectionChallenge
|
||||
|
||||
Witch witch = spawn(location, Witch.class);
|
||||
|
||||
witch.setCustomName(C.cAquaB + "Snow Witch");
|
||||
witch.setCustomNameVisible(true);
|
||||
witch.setRemoveWhenFarAway(false);
|
||||
|
||||
UtilEnt.vegetate(witch);
|
||||
UtilEnt.ghost(witch, true, false);
|
||||
UtilEnt.setFakeHead(witch, true);
|
||||
|
||||
Bukkit.broadcastMessage("Test");
|
||||
});
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user