Add win room

This commit is contained in:
Sam 2017-11-27 22:23:13 +00:00 committed by Alexander Meech
parent b7d80afb91
commit 3d5164408d
3 changed files with 66 additions and 0 deletions

View File

@ -167,6 +167,11 @@ public class ChristmasCommon extends SoloGame
_forceSkip = true;
player.sendMessage(F.main("Debug", "Skipping current challenge." + (_forceSkipTeleport ? " Teleporting..." : "")));
});
registerDebugCommand("forceend", Perm.DEBUG_COMMANDS, PermissionGroup.ADMIN, (player, args) ->
{
player.sendMessage(F.main("Debug", "Force ending the game."));
endGame(true, "You saved Christmas!");
});
}
@Override

View File

@ -3,10 +3,23 @@ package nautilus.game.arcade.game.games.christmasnew;
import java.util.Comparator;
import java.util.List;
import org.bukkit.Color;
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.Player;
import org.bukkit.event.EventHandler;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilBlockText;
import mineplex.core.common.util.UtilBlockText.TextAlign;
import mineplex.core.common.util.UtilFirework;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilServer;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
@ -30,6 +43,12 @@ public class ChristmasNew extends ChristmasCommon
"Help Santa Claus get them back and",
"find out who stole the presents."
};
private static final FireworkEffect FIREWORK_EFFECT = FireworkEffect.builder()
.with(Type.BALL_LARGE)
.withColor(Color.LIME, Color.RED)
.withFade(Color.WHITE)
.withFlicker()
.build();
private final Comparator<Location> _locationComparator = (o1, o2) ->
{
@ -44,6 +63,9 @@ public class ChristmasNew extends ChristmasCommon
return o1Dist > o2Dist ? 1 : -1;
};
private List<Location> _winSpawns;
private Location _winText;
public ChristmasNew(ArcadeManager manager)
{
super(manager, GameType.ChristmasNew, new Kit[]
@ -74,6 +96,9 @@ public class ChristmasNew extends ChristmasCommon
_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)));
_winSpawns = WorldData.GetCustomLocs("WIN SPAWN");
_winText = WorldData.GetCustomLocs("WIN TEXT").get(0);
}
@EventHandler
@ -97,4 +122,39 @@ public class ChristmasNew extends ChristmasCommon
sendSantaMessage("Follow me, let's find out whos behind this.", ChristmasNewAudio.SANTA_FOLLOW_ME_2);
}
@EventHandler
public void gameEnd(GameStateChangeEvent event)
{
if (event.GetState() != GameState.End || WinnerTeam == null || !WinnerTeam.equals(getPlayersTeam()))
{
return;
}
Location location = WorldData.GetCustomLocs("WIN TEXT").get(0);
BlockFace face = BlockFace.WEST;
int blockId = Material.STAINED_CLAY.getId();
TextAlign align = TextAlign.CENTER;
UtilBlockText.MakeText("Happy Holidays", 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);
for (Player player : UtilServer.getPlayersCollection())
{
player.teleport(UtilAlg.Random(_winSpawns));
player.getInventory().clear();
}
}
@EventHandler
public void gameEndUpdate(UpdateEvent event)
{
if (event.getType() != UpdateType.FAST || GetState() != GameState.End && GetState() != GameState.WinRoom || WinnerTeam == null)
{
return;
}
UtilFirework.playFirework(UtilAlg.getRandomLocation(_winText, 20, 1, 20), FIREWORK_EFFECT);
}
}

View File

@ -215,6 +215,7 @@ public class Phase2 extends BossPhase
clearAttacks();
_completing = true;
_host.sendSantaMessage("At this point Phase 2 should end", null);
_host.endGame(true, "The Pumpkin King was Defeated!");
}
}
}