Xmas + UHC changes

This commit is contained in:
Chiss 2013-12-04 12:45:17 +11:00
parent 36a98d5e41
commit 28c928b4c3
9 changed files with 321 additions and 9 deletions

View File

@ -371,7 +371,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
{
if (_game != null && _game.GetType() == GameType.UHC)
{
event.setMotd(ChatColor.RED + "UHC - Season 3");
event.setMotd(ChatColor.RED + "UHC - Season 4");
return;
}

View File

@ -10,6 +10,7 @@ import nautilus.game.arcade.game.games.barbarians.Barbarians;
import nautilus.game.arcade.game.games.bridge.Bridge;
import nautilus.game.arcade.game.games.castlesiege.CastleSiege;
import nautilus.game.arcade.game.games.champions.Champions;
import nautilus.game.arcade.game.games.christmas.Christmas;
import nautilus.game.arcade.game.games.deathtag.DeathTag;
import nautilus.game.arcade.game.games.dragonescape.DragonEscape;
import nautilus.game.arcade.game.games.dragonriders.DragonRiders;
@ -50,6 +51,7 @@ public class GameFactory
else if (gameType == GameType.Bridge) return new Bridge(_manager);
else if (gameType == GameType.CastleSiege) return new CastleSiege(_manager, pastTeams);
else if (gameType == GameType.Champions) return new Champions(_manager);
else if (gameType == GameType.Christmas) return new Christmas(_manager);
else if (gameType == GameType.DeathTag) return new DeathTag(_manager);
else if (gameType == GameType.Dragons) return new Dragons(_manager);
else if (gameType == GameType.DragonEscape) return new DragonEscape(_manager);

View File

@ -8,6 +8,7 @@ public enum GameType
Bridge("The Bridges"),
CastleSiege("Castle Siege"),
Champions("Champions"),
Christmas("Christmas Caper"),
DeathTag("Death Tag"),
DragonEscape("Dragon Escape"),
DragonRiders("Dragon Riders"),

View File

@ -1,5 +1,63 @@
package nautilus.game.arcade.game.games.christmas;
public class Christmas {
import org.bukkit.event.EventHandler;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType;
import nautilus.game.arcade.game.SoloGame;
import nautilus.game.arcade.game.games.stacker.kits.*;
import nautilus.game.arcade.kit.Kit;
public class Christmas extends SoloGame
{
private Sleigh _sleigh;
public Christmas(ArcadeManager manager)
{
super(manager, GameType.Christmas,
new Kit[]
{
new KitDefault(manager)
},
new String[]
{
});
}
@EventHandler
public void Update(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
if (!IsLive())
return;
if (_sleigh == null)
return;
_sleigh.Update();
}
@EventHandler
public void Test(PlayerCommandPreprocessEvent event)
{
if (event.getMessage().equalsIgnoreCase("/sleigh spawn"))
{
_sleigh = new Sleigh(this, event.getPlayer().getLocation().add(5, 0, 5));
event.setCancelled(true);
}
if (event.getMessage().equalsIgnoreCase("/sleigh here"))
{
_sleigh.SetTarget(event.getPlayer().getLocation());
event.setCancelled(true);
}
}
}

View File

@ -0,0 +1,139 @@
package nautilus.game.arcade.game.games.christmas;
import java.util.ArrayList;
import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilMath;
import net.minecraft.server.v1_6_R3.EntityCreature;
import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftCreature;
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftFallingSand;
import org.bukkit.entity.Chicken;
import org.bukkit.entity.Entity;
import org.bukkit.entity.FallingBlock;
public class Sleigh
{
public Christmas Host;
//This is the central entity, all other sleigh entities have location relative to this.
private Entity CentralEntity;
private ArrayList<SleighPart> SleighEnts;
private ArrayList<SleighHorse> SleighHorses;
private Location Target;
public Sleigh(Christmas host, Location loc)
{
Host = host;
Host.CreatureAllowOverride = true;
Target = loc.clone();
CentralEntity = loc.getWorld().spawn(loc, Chicken.class);
UtilEnt.Vegetate(CentralEntity);
SleighEnts = new ArrayList<SleighPart>();
SleighEnts.add(new SleighPart(5, 0, loc.clone(), 0, -3));
SleighEnts.add(new SleighPart(5, 0, loc.clone(), -1, -3));
SleighEnts.add(new SleighPart(5, 0, loc.clone(), -2, -3));
SleighEnts.add(new SleighPart(5, 0, loc.clone(), 1, -3));
SleighEnts.add(new SleighPart(5, 0, loc.clone(), 2, -3));
SleighEnts.add(new SleighPart(5, 0, loc.clone(), -2, -2));
SleighEnts.add(new SleighPart(126, 0, loc.clone(), -1, -2));
SleighEnts.add(new SleighPart(126, 0, loc.clone(), 0, -2));
SleighEnts.add(new SleighPart(126, 0, loc.clone(), 1, -2));
SleighEnts.add(new SleighPart(5, 0, loc.clone(), 2, -2));
SleighEnts.add(new SleighPart(5, 0, loc.clone(), -2, -1));
SleighEnts.add(new SleighPart(126, 0, loc.clone(), -1, -1));
SleighEnts.add(new SleighPart(126, 0, loc.clone(), 0, -1));
SleighEnts.add(new SleighPart(126, 0, loc.clone(), 1, -1));
SleighEnts.add(new SleighPart(5, 0, loc.clone(), 2, -1));
SleighEnts.add(new SleighPart(5, 0, loc.clone(), -2, 0));
SleighEnts.add(new SleighPart(5, 0, loc.clone(), -1, 0));
//SleighEnts.add(new SleighEntity(loc.clone(), 0, 0));
SleighEnts.add(new SleighPart(5, 0, loc.clone(), 1, 0));
SleighEnts.add(new SleighPart(5, 0, loc.clone(), 2, 0));
SleighEnts.add(new SleighPart(5, 0, loc.clone(), -2, 1));
SleighEnts.add(new SleighPart(126, 0, loc.clone(), -1, 1));
SleighEnts.add(new SleighPart(126, 0, loc.clone(), 0, 1));
SleighEnts.add(new SleighPart(126, 0, loc.clone(), 1, 1));
SleighEnts.add(new SleighPart(5, 0, loc.clone(), 2, 1));
SleighEnts.add(new SleighPart(5, 0, loc.clone(), -2, 2));
SleighEnts.add(new SleighPart(126, 0, loc.clone(), -1, 2));
SleighEnts.add(new SleighPart(126, 0, loc.clone(), 0, 2));
SleighEnts.add(new SleighPart(126, 0, loc.clone(), 1, 2));
SleighEnts.add(new SleighPart(5, 0, loc.clone(), 2, 2));
SleighEnts.add(new SleighPart(126, 0, loc.clone(), -2, 3));
SleighEnts.add(new SleighPart(126, 0, loc.clone(), -1, 3));
SleighEnts.add(new SleighPart(126, 0, loc.clone(), 0, 3));
SleighEnts.add(new SleighPart(126, 0, loc.clone(), 1, 3));
SleighEnts.add(new SleighPart(126, 0, loc.clone(), 2, 3));
SleighHorses = new ArrayList<SleighHorse>();
SleighHorses.add(new SleighHorse(CentralEntity, loc.clone(), -1.5, 8));
SleighHorses.add(new SleighHorse(CentralEntity, loc.clone(), 1.5, 8));
SleighHorses.add(new SleighHorse(CentralEntity, loc.clone(), -1.5, 11));
SleighHorses.add(new SleighHorse(CentralEntity, loc.clone(), 1.5, 11));
}
public void AddPresent(FallingBlock block)
{
block.leaveVehicle();
//Add to Sleigh
}
public Location GetLocation()
{
return CentralEntity.getLocation();
}
public void SetTarget(Location loc)
{
Target = loc;
}
public void Update()
{
if (Target == null)
return;
Move(CentralEntity, Target, 1);
//Move Sleigh
for (SleighPart ent : SleighEnts)
{
if (ent.Block != null)
((CraftFallingSand)ent.Block).getHandle().c = 1;
Move(ent.Ent, CentralEntity.getLocation().add(ent.OffsetX, 0, ent.OffsetZ), 1);
}
//Move Horses
for (SleighHorse ent : SleighHorses)
{
Move(ent.Ent, CentralEntity.getLocation().add(ent.OffsetX, 0, ent.OffsetZ), 1.4);
}
}
public void Move(Entity ent, Location target, double speed)
{
if (UtilMath.offset(ent.getLocation(), target) > 0.1)
{
EntityCreature ec = ((CraftCreature)ent).getHandle();
ec.getControllerMove().a(target.getX(), target.getY(), target.getZ(), speed);
}
}
}

View File

@ -0,0 +1,24 @@
package nautilus.game.arcade.game.games.christmas;
import mineplex.core.common.util.UtilEnt;
import org.bukkit.Location;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Horse;
public class SleighHorse
{
public Horse Ent;
public double OffsetX;
public double OffsetZ;
public SleighHorse(Entity owner, Location loc, double x, double z)
{
Ent = loc.getWorld().spawn(loc.add(x, 0, z), Horse.class);
//Ent.setLeashHolder(owner);
UtilEnt.Vegetate(Ent);
OffsetX = x;
OffsetZ = z;
}
}

View File

@ -0,0 +1,30 @@
package nautilus.game.arcade.game.games.christmas;
import mineplex.core.common.util.UtilEnt;
import org.bukkit.Location;
import org.bukkit.entity.Chicken;
import org.bukkit.entity.FallingBlock;
public class SleighPart
{
public Chicken Ent;
public FallingBlock Block;
public double OffsetX;
public double OffsetZ;
public SleighPart(int id, int data, Location loc, double x, double z)
{
Ent = loc.getWorld().spawn(loc.add(x, 0, z), Chicken.class);
Ent.setBaby();
Ent.setAgeLock(true);
Block = loc.getWorld().spawnFallingBlock(loc.add(0, 1, 0), id, (byte)data);
Ent.setPassenger(Block);
UtilEnt.Vegetate(Ent);
OffsetX = x;
OffsetZ = z;
}
}

View File

@ -100,7 +100,7 @@ public class Draw extends SoloGame
{
"Bird", "Volcano", "Love", "Dance", "Hair", "Glasses", "Domino", "Dice", "Computer", "Top Hat", "Beard", "Wind", "Rain", "Minecraft",
"Push", "Fighting", "Juggle", "Clown", "Miner", "Creeper", "Ghast", "Spider", "Punch", "Roll", "River", "Desert", "Cold", "Pregnant",
"Photo", "Quick", "Mario", "Luigi", "Bridge", "Turtle", "Door Knob", "Mineplex", "Binoculars", "Telescope", "Planet",
"Photo", "Quick", "Mario", "Luigi", "Bridge", "Turtle", "Door Knob", "Mineplex", "Binoculars", "Telescope", "Planet", "Mountain Bike",
"Moon", "Comet", "Flower", "Squirrel", "Horse Riding", "Chef", "Elephant", "Yoshi", "Shotgun", "Pistol", "James Bond",
"Truck", "Helicopter", "Hot Air Balloon", "Sprout", "Yelling", "Muscles", "Skinny", "Zombie", "Lava", "Snake", "Motorbike", "Whale",
"Boat", "Letterbox", "Window", "Lollipop", "Handcuffs", "Police", "Uppercut", "Windmill", "Eyepatch", "Campfire", "Rainbow", "Storm", "Pikachu",
@ -285,7 +285,7 @@ public class Draw extends SoloGame
//Points for Drawer
AddScore(_round.Drawer, 2);
this.AddGems(_round.Drawer, 2, "Drawing Word", true);
this.AddGems(_round.Drawer, 2, "Drawings Guessed", true);
}
if (_round.Guessed(player))
@ -294,9 +294,9 @@ public class Draw extends SoloGame
Announce(C.cYellow + C.Bold + "+" + score + " " + C.cGreen + C.Bold + player.getName() + " has guessed the word!");
if (score == 1)
this.AddGems(player, 1, "Guessing Word", true);
this.AddGems(player, 1, "Words Guessed", true);
else
this.AddGems(player, 4, "Guessing Word First", true);
this.AddGems(player, 4, "Words Guessed First", true);
}
else
{

View File

@ -9,6 +9,7 @@ import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Chunk;
import org.bukkit.Difficulty;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
@ -1110,6 +1111,29 @@ public class UHC extends TeamGame
}
}
public void AnnounceEndLose()
{
for (Player player : UtilServer.getPlayers())
{
player.playSound(player.getLocation(), Sound.LEVEL_UP, 2f, 1f);
UtilPlayer.message(player, "");
UtilPlayer.message(player, ArcadeFormat.Line);
UtilPlayer.message(player, C.cYellow+ C.Bold + this.GetName());
UtilPlayer.message(player, "");
UtilPlayer.message(player, "");
UtilPlayer.message(player, ChatColor.WHITE + "§lEnder Dragon has won the game...");
UtilPlayer.message(player, "");
UtilPlayer.message(player, "");
UtilPlayer.message(player, C.cWhite + "Created and Hosted by " + C.cYellow + C.Bold + "Mineplex.com");
UtilPlayer.message(player, ArcadeFormat.Line);
}
}
@Override
public boolean AdvertiseText(GameLobbyManager gameLobbyManager, int _advertiseStage)
{
@ -1164,11 +1188,10 @@ public class UHC extends TeamGame
for (GameTeam team : _rejoinTeam.values())
teamsAlive.add(team);
if (teamsAlive.size() <= 1)
if (teamsAlive.size() == 0)
{
//Announce
if (teamsAlive.size() > 0)
AnnounceEnd(teamsAlive.get(0));
AnnounceEndLose();
//End
_ended = true;
@ -1282,4 +1305,39 @@ public class UHC extends TeamGame
{
}
@EventHandler
public void EndUpdate(UpdateEvent event)
{
if (event.getType() != UpdateType.SEC)
return;
if (!IsLive())
return;
if (!_ended)
return;
GameTeam endTeam = GetTeam("Post Game", false);
if (endTeam == null)
{
endTeam = new GameTeam("Post Game", ChatColor.GRAY, GetTeamList().get(0).GetSpawns());
AddTeam(endTeam);
}
for (Player player : UtilServer.getPlayers())
{
GameTeam team = GetTeam(player);
if (team != null && !endTeam.equals(team))
{
team.RemovePlayer(player);
Manager.Clear(player);
}
endTeam.AddPlayer(player);
player.setGameMode(GameMode.CREATIVE);
}
}
}