Merge branch 'master' of ssh://dev.mineplex.com:7999/min/Mineplex

This commit is contained in:
Jonathan Williams 2013-12-06 01:57:18 -08:00
commit 9382271315
10 changed files with 362 additions and 12 deletions

Binary file not shown.

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,8 +100,8 @@ 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",
"Moon", "Comet", "Flower", "Squirrel", "Horse Riding", "Chef", "Elephant", "Yoshi", "Shotgun", "Pistol", "James Bond",
"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", "Money", "Salt and Pepper",
"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",
"Charmander", "Tornado", "Crying", "King", "Hobo", "Worm", "Snail", "XBox", "Playstation", "Nintendo", "Duck", "Pull", "Dinosaur", "Alligator",
@ -113,7 +113,13 @@ public class Draw extends SoloGame
"Book", "Swimming", "Horse", "Paper", "Toaster", "Television", "Hammer", "Piano", "Sleeping", "Yawn", "Sheep", "Night", "Chest", "Lamp", "Redstone",
"Grass", "Plane", "Ocean", "Lake", "Melon", "Pumpkin", "Gift", "Fishing", "Pirate", "Lightning", "Stomach", "Belly Button", "Fishing Rod",
"Iron Ore", "Diamonds", "Emeralds", "Nether Portal", "Ender Dragon", "Rabbit", "Harry Potter", "Miley Cyrus", "Torch", "Light", "Battery",
"Zombie Pigman", "Telephone", "Tent"
"Zombie Pigman", "Telephone", "Tent", "Hand", "Traffic Lights", "Anvil", "Tail", "Umbrella", "Piston", "Skeleton", "Spikes", "Bridge", "Bomb",
"Spoon", "Rainbow", "Staircase", "Poop", "Dragon", "Fire", "Apple", "Shoe", "Squid", "Cookie", "Tooth", "Camera", "Sock", "Monkey",
"Unicorn", "Smile", "Pool", "Rabbit", "Cupcake", "Pancake", "Princess", "Castle", "Flag", "Planet", "Stars", "Camp Fire", "Rose",
"Spray", "Pencil", "Torch", "Ice Cream", "Toilet", "Moose", "Bear", "Beer", "Batman", "Sun Glasses", "Eggs", "Teapot",
"Golf Club", "Tennis Racket", "Shield", "Crab", "Pot of Gold", "Cactus", "Television", "Pumpkin Pie", "Chimney", "Stable", "Nether", "Wither",
"Beach", "Stop Sign", "Chestplate", "Pokeball", "Christmas Tree", "Present", "Snowflake", "Laptop", "Superman", "Football", "Basketball", "Creeper",
"Tetris", "Jump", "Ninja", "Baby", "Troll Face", "Grim Reaper", "Temple",
};
}
@ -285,7 +291,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 +300,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,7 +9,7 @@ import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Chunk;
import org.bukkit.Difficulty;
import org.bukkit.Effect;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Sound;
@ -970,6 +970,20 @@ public class UHC extends TeamGame
Announce(event.getPlayer().getName() + " set time to Day and Night!");
}
if (event.getMessage().startsWith("/dragondamage"))
{
if (event.getPlayer().getName().equals("Chiss"))
{
for (Entity ent : event.getPlayer().getWorld().getEntities())
{
if (ent instanceof EnderDragon)
{
((EnderDragon) ent).damage(100, event.getPlayer());
}
}
}
}
}
@EventHandler
@ -1125,6 +1139,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)
{
@ -1179,11 +1216,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;
@ -1297,4 +1333,58 @@ 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(ChatColor.GRAY);
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);
player.setFlying(true);
}
}
}
@EventHandler
public void EndCommands(PlayerCommandPreprocessEvent event)
{
if (!IsLive())
return;
if (!_ended)
return;
if (event.getMessage().startsWith("/world"))
{
event.setCancelled(true);
event.getPlayer().teleport(_portalBlock.get(0).clone().add(0, 10, 0));
event.getPlayer().setGameMode(GameMode.CREATIVE);
event.getPlayer().setFlying(true);
}
}
}