UHC Update

This commit is contained in:
Chiss 2013-12-03 16:26:47 +11:00
parent f4e3b6efdc
commit 43196dd7af
6 changed files with 140 additions and 226 deletions

View File

@ -19,13 +19,18 @@ import org.bukkit.GameMode;
import org.bukkit.Material;
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_6_R3.entity.CraftPlayer;
import org.bukkit.entity.Chicken;
import org.bukkit.entity.Entity;
import org.bukkit.entity.IronGolem;
import org.bukkit.entity.Player;
import org.bukkit.entity.Skeleton;
import org.bukkit.event.EventHandler;
import org.bukkit.event.block.BlockBurnEvent;
import org.bukkit.event.block.BlockFadeEvent;
import org.bukkit.event.block.BlockSpreadEvent;
import org.bukkit.event.block.LeavesDecayEvent;
import org.bukkit.event.entity.CreatureSpawnEvent;
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
import org.bukkit.event.player.PlayerJoinEvent;
import org.bukkit.event.player.PlayerLoginEvent;
import org.bukkit.event.player.PlayerQuitEvent;
@ -561,10 +566,84 @@ public class ArcadeManager extends MiniPlugin implements IRelation
event.setCancelled(true);
}
@EventHandler
//@EventHandler
public void MobSpawn(CreatureSpawnEvent event)
{
if (_game == null)
event.setCancelled(true);
}
@EventHandler//XXX
public void TEST(PlayerCommandPreprocessEvent event)
{
if (event.getMessage().equals("/test1"))
{
Chicken chicken = event.getPlayer().getWorld().spawn(event.getPlayer().getLocation(), Chicken.class);
chicken.setBaby();
Entity a = event.getPlayer().getWorld().spawnFallingBlock(event.getPlayer().getLocation().add(0, 5, 0), 42, (byte)0);
Entity b = event.getPlayer().getWorld().spawnFallingBlock(event.getPlayer().getLocation().add(0, 5, 0), 41, (byte)0);
chicken.setPassenger(a);
a.setPassenger(b);
}
if (event.getMessage().equals("/test2"))
{
Chicken chicken = event.getPlayer().getWorld().spawn(event.getPlayer().getLocation(), Chicken.class);
chicken.setBaby();
Entity a = event.getPlayer().getWorld().spawnFallingBlock(event.getPlayer().getLocation().add(0, 5, 0), 42, (byte)0);
Entity b = event.getPlayer().getWorld().spawnFallingBlock(event.getPlayer().getLocation().add(0, 5, 0), 41, (byte)0);
Chicken chickenb = event.getPlayer().getWorld().spawn(event.getPlayer().getLocation(), Chicken.class);
chickenb.setBaby();
chickenb.setCustomName("Dinnerbone");
chicken.setPassenger(chickenb);
chickenb.setPassenger(a);
a.setPassenger(b);
}
if (event.getMessage().equals("/test3"))
{
Chicken chicken = event.getPlayer().getWorld().spawn(event.getPlayer().getLocation(), Chicken.class);
chicken.setBaby();
Chicken chickenb = event.getPlayer().getWorld().spawn(event.getPlayer().getLocation(), Chicken.class);
chickenb.setBaby();
Chicken chickenc = event.getPlayer().getWorld().spawn(event.getPlayer().getLocation(), Chicken.class);
chickenc.setBaby();
Entity a = event.getPlayer().getWorld().spawnFallingBlock(event.getPlayer().getLocation().add(0, 5, 0), 42, (byte)0);
Entity b = event.getPlayer().getWorld().spawnFallingBlock(event.getPlayer().getLocation().add(0, 5, 0), 41, (byte)0);
chicken.setPassenger(chickenb);
chickenb.setPassenger(chickenc);
chickenc.setPassenger(a);
a.setPassenger(b);
}
if (event.getMessage().equals("/test4"))
{
Chicken chicken = event.getPlayer().getWorld().spawn(event.getPlayer().getLocation(), Chicken.class);
chicken.setBaby();
Chicken chickenb = event.getPlayer().getWorld().spawn(event.getPlayer().getLocation(), Chicken.class);
chickenb.setBaby();
Chicken chickenc = event.getPlayer().getWorld().spawn(event.getPlayer().getLocation(), Chicken.class);
chickenc.setBaby();
Chicken chickend = event.getPlayer().getWorld().spawn(event.getPlayer().getLocation(), Chicken.class);
chickend.setBaby();
Entity a = event.getPlayer().getWorld().spawnFallingBlock(event.getPlayer().getLocation().add(0, 5, 0), 42, (byte)0);
Entity b = event.getPlayer().getWorld().spawnFallingBlock(event.getPlayer().getLocation().add(0, 5, 0), 44, (byte)0);
Entity iron = event.getPlayer().getWorld().spawn(event.getPlayer().getLocation(), Skeleton.class);
chicken.setPassenger(chickenb);
chickenb.setPassenger(chickenc);
chickenc.setPassenger(chickend);
chickend.setPassenger(a);
a.setPassenger(iron);
iron.setPassenger(b);
}
}
}

View File

@ -0,0 +1,5 @@
package nautilus.game.arcade.game.games.christmas;
public class Christmas {
}

View File

@ -139,17 +139,6 @@ public class Dragons extends SoloGame
if (_dragons.size() < 7)
{
if (_dragons.size() == 0)
{
for (Player player : UtilServer.getPlayers())
{
Location loc = player.getLocation();
loc.setPitch(UtilAlg.GetPitch(UtilAlg.getTrajectory(player.getLocation(), _dragonSpawns.get(0))));
loc.setYaw(UtilAlg.GetYaw(UtilAlg.getTrajectory(player.getLocation(), _dragonSpawns.get(0))));
player.teleport(loc);
}
}
CreatureAllowOverride = true;
EnderDragon ent = GetSpectatorLocation().getWorld().spawn(_dragonSpawns.get(0), EnderDragon.class);
UtilEnt.Vegetate(ent);

View File

@ -113,7 +113,7 @@ 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"
};
}
@ -638,61 +638,61 @@ public class Draw extends SoloGame
//Rounds
String out = C.cRed + " ";
_lastScoreboard.add(out);
if (out.length() >= 16)
out = out.substring(0, 15);
_lastScoreboard.add(out);
GetObjectiveSide().getScore(Bukkit.getOfflinePlayer(out)).setScore(index--);
out = C.cRed + " ";
_lastScoreboard.add(out);
if (out.length() >= 16)
out = out.substring(0, 15);
_lastScoreboard.add(out);
GetObjectiveSide().getScore(Bukkit.getOfflinePlayer(out)).setScore(index--);
out = C.cWhite + "Round:";
_lastScoreboard.add(out);
if (out.length() >= 16)
out = out.substring(0, 15);
_lastScoreboard.add(out);
GetObjectiveSide().getScore(Bukkit.getOfflinePlayer(out)).setScore(index--);
out = C.cYellow + Math.min(_roundCount+1, _roundMax) + " of " + _roundMax;
_lastScoreboard.add(out);
if (out.length() >= 16)
out = out.substring(0, 15);
_lastScoreboard.add(out);
GetObjectiveSide().getScore(Bukkit.getOfflinePlayer(out)).setScore(index--);
//Drawer
out = C.cRed + " ";
_lastScoreboard.add(out);
if (out.length() >= 16)
out = out.substring(0, 15);
_lastScoreboard.add(out);
GetObjectiveSide().getScore(Bukkit.getOfflinePlayer(out)).setScore(index--);
out = C.cWhite + "Drawer:";
_lastScoreboard.add(out);
if (out.length() >= 16)
out = out.substring(0, 15);
_lastScoreboard.add(out);
GetObjectiveSide().getScore(Bukkit.getOfflinePlayer(out)).setScore(index--);
out = C.cYellow + "None";
if (_round != null)
out = C.cYellow + _round.Drawer.getName();
_lastScoreboard.add(out);
if (out.length() >= 16)
out = out.substring(0, 15);
_lastScoreboard.add(out);
GetObjectiveSide().getScore(Bukkit.getOfflinePlayer(out)).setScore(index--);
out = C.cRed + " ";
_lastScoreboard.add(out);
if (out.length() >= 16)
out = out.substring(0, 15);
_lastScoreboard.add(out);
GetObjectiveSide().getScore(Bukkit.getOfflinePlayer(out)).setScore(index--);
//Scores
out = C.cWhite + "Scores:";
_lastScoreboard.add(out);
if (out.length() >= 16)
out = out.substring(0, 15);
_lastScoreboard.add(out);
GetObjectiveSide().getScore(Bukkit.getOfflinePlayer(out)).setScore(index--);
//Write New

View File

@ -412,14 +412,14 @@ public class HungerGames extends SoloGame
for (int i = 0; i < 30; i++) _baseChestLoot.add(new ItemStack(Material.WEB, 2));
//Food
for (int i = 0; i < 30; i++) _baseChestLoot.add(new ItemStack(Material.MUSHROOM_SOUP));
for (int i = 0; i < 40; i++) _baseChestLoot.add(new ItemStack(Material.COOKED_CHICKEN));
for (int i = 0; i < 50; i++) _baseChestLoot.add(new ItemStack(Material.RAW_BEEF));
for (int i = 0; i < 40; i++) _baseChestLoot.add(new ItemStack(Material.GRILLED_PORK));
for (int i = 0; i < 45; i++) _baseChestLoot.add(new ItemStack(Material.BREAD));
for (int i = 0; i < 40; i++) _baseChestLoot.add(new ItemStack(Material.MUSHROOM_SOUP));
for (int i = 0; i < 50; i++) _baseChestLoot.add(new ItemStack(Material.COOKED_CHICKEN));
for (int i = 0; i < 80; i++) _baseChestLoot.add(new ItemStack(Material.RAW_BEEF));
for (int i = 0; i < 50; i++) _baseChestLoot.add(new ItemStack(Material.GRILLED_PORK));
for (int i = 0; i < 100; i++) _baseChestLoot.add(new ItemStack(Material.BREAD));
for (int i = 0; i < 40; i++) _baseChestLoot.add(new ItemStack(Material.PUMPKIN_PIE));
for (int i = 0; i < 50; i++) _baseChestLoot.add(new ItemStack(Material.COOKIE));
for (int i = 0; i < 50; i++) _baseChestLoot.add(new ItemStack(Material.ROTTEN_FLESH));
for (int i = 0; i < 80; i++) _baseChestLoot.add(new ItemStack(Material.COOKIE));
for (int i = 0; i < 90; i++) _baseChestLoot.add(new ItemStack(Material.ROTTEN_FLESH));
for (int i = 0; i < 80; i++) _baseChestLoot.add(new ItemStack(Material.WHEAT, 6));

View File

@ -51,6 +51,7 @@ import org.bukkit.inventory.ShapedRecipe;
import org.bukkit.inventory.ShapelessRecipe;
import org.bukkit.potion.PotionEffect;
import org.bukkit.potion.PotionEffectType;
import org.bukkit.scoreboard.DisplaySlot;
import mineplex.core.common.Rank;
import mineplex.core.common.util.C;
@ -65,6 +66,7 @@ import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.common.util.UtilTime;
import mineplex.core.common.util.UtilWorld;
import mineplex.core.disguise.disguises.DisguiseChicken;
import mineplex.core.disguise.disguises.DisguiseCreeper;
import mineplex.core.disguise.disguises.DisguisePig;
@ -95,6 +97,8 @@ public class UHC extends TeamGame
private NautHashMap<String, Long> _combatTime = new NautHashMap<String, Long>();
private int _borders = 1000;
private int _gameMinutes = 0;
private long _lastMinute = System.currentTimeMillis();
@ -118,7 +122,6 @@ public class UHC extends TeamGame
new String[] {
"20 minutes of no PvP",
"Borders at -1250 and 1250",
"No default health regeneration",
"Last player/team alive wins!"
});
@ -168,7 +171,7 @@ public class UHC extends TeamGame
{
_portalBlock = WorldData.GetDataLocs("YELLOW");
_portal = WorldData.GetDataLocs("BLACK");
//Set Portal Blocks
for (int i=0 ; i<_portalBlock.size() ; i++)
{
@ -299,43 +302,24 @@ public class UHC extends TeamGame
if (event.GetState() != GameState.Recruit)
return;
if (_soloGame)
this.WorldData.MinX = -_borders;
this.WorldData.MaxX = _borders;
this.WorldData.MinZ = -_borders;
this.WorldData.MaxZ = _borders;
int min = -(_borders/16 + 1);
int max = _borders/16;
for (int x=min ; x<=max ; x++)
{
this.WorldData.MinX = -1250;
this.WorldData.MaxX = 1250;
this.WorldData.MinZ = -1250;
this.WorldData.MaxZ = 1250;
for (int x=-79 ; x<=78 ; x++)
{
WorldBoundaryRed(WorldData.World.getChunkAt(x, 78));
WorldBoundaryRed(WorldData.World.getChunkAt(x, -79));
}
for (int z=-79 ; z<=78 ; z++)
{
WorldBoundaryRed(WorldData.World.getChunkAt(78, z));
WorldBoundaryRed(WorldData.World.getChunkAt(-79, z));
}
WorldBoundaryRed(WorldData.World.getChunkAt(x, max));
WorldBoundaryRed(WorldData.World.getChunkAt(x, min));
}
else
for (int z=min ; z<=max ; z++)
{
this.WorldData.MinX = -1000;
this.WorldData.MaxX = 1000;
this.WorldData.MinZ = -1000;
this.WorldData.MaxZ = 1000;
for (int x=-63 ; x<=62 ; x++)
{
WorldBoundaryRed(WorldData.World.getChunkAt(x, 62));
WorldBoundaryRed(WorldData.World.getChunkAt(x, -63));
}
for (int z=-63 ; z<=62 ; z++)
{
WorldBoundaryRed(WorldData.World.getChunkAt(62, z));
WorldBoundaryRed(WorldData.World.getChunkAt(-63, z));
}
WorldBoundaryRed(WorldData.World.getChunkAt(max, z));
WorldBoundaryRed(WorldData.World.getChunkAt(min, z));
}
}
@ -608,11 +592,10 @@ public class UHC extends TeamGame
team.RemovePlayer(player);
if (team.GetColor() == ChatColor.DARK_GRAY)
return;
if (player.isDead())
return;
/* XXX
if (true)
{
@ -730,7 +713,7 @@ public class UHC extends TeamGame
ArrayList<Entity> entList = ents.get(type);
int count = 0;
while (entList.size() > 300)
while (entList.size() > 400)
{
Entity ent = entList.remove(UtilMath.r(entList.size()));
ent.remove();
@ -993,82 +976,6 @@ public class UHC extends TeamGame
}
}
@EventHandler
public void SpecialCommand(PlayerCommandPreprocessEvent event)
{
if (event.getMessage().startsWith("/superchissburger"))
{
Player player = event.getPlayer();
if (GetTeam(player) != null)
{
if (GetTeam(player).GetColor() == ChatColor.DARK_GRAY)
{
GetTeam(player).RemovePlayer(player);
}
else
{
return;
}
}
GameTeam special = null;
for (GameTeam team : this.GetTeamList())
{
if (team.GetColor() == ChatColor.DARK_GRAY)
{
special = team;
break;
}
}
if (special == null)
{
special = new GameTeam("Herobrine", ChatColor.DARK_GRAY, GetTeamList().get(0).GetSpawns());
AddTeam(special);
}
special.AddPlayer(player);
((CraftPlayer)player).getHandle().spectating = false;
((CraftPlayer)player).getHandle().m = true;
Manager.GetCondition().EndCondition(player, ConditionType.CLOAK, null);
if (event.getMessage().contains("chicken"))
{
DisguiseChicken disguise = new DisguiseChicken(player);
Manager.GetDisguise().disguise(disguise);
player.sendMessage("You are a Chicken!");
}
else if (event.getMessage().contains("creeper"))
{
DisguiseCreeper disguise = new DisguiseCreeper(player);
Manager.GetDisguise().disguise(disguise);
player.sendMessage("You are a Creeper!");
}
else if (event.getMessage().contains("pig"))
{
DisguisePig disguise = new DisguisePig(player);
Manager.GetDisguise().disguise(disguise);
player.sendMessage("You are a Pig!");
}
else
{
DisguiseSkeleton disguise = new DisguiseSkeleton(player);
disguise.SetSkeletonType(SkeletonType.WITHER);
Manager.GetDisguise().disguise(disguise);
player.sendMessage("You are a Wither Skeleton!");
}
UtilInv.Clear(player);
UtilInv.insert(player, new ItemStack(Material.IRON_SWORD));
event.setCancelled(true);
}
}
@EventHandler
public void RejoinCommand(PlayerCommandPreprocessEvent event)
{
@ -1102,63 +1009,6 @@ public class UHC extends TeamGame
event.setCancelled(false);
}
@EventHandler
public void SpecialDamage(EntityDamageEvent event)
{
if (event.isCancelled())
return;
//Damager
LivingEntity damagerEnt = UtilEvent.GetDamagerEntity(event, true);
if (damagerEnt != null)
{
if (damagerEnt instanceof Player)
{
Player damager = (Player)damagerEnt;
GameTeam team = GetTeam(damager);
if (team != null && team.GetColor() == ChatColor.DARK_GRAY)
{
event.setCancelled(true);
return;
}
}
}
//Damagee
if (event.getEntity() instanceof Player)
{
Player damagee = (Player)event.getEntity();
GameTeam team = GetTeam(damagee);
if (team != null && team.GetColor() == ChatColor.DARK_GRAY)
{
event.setCancelled(true);
return;
}
}
}
@EventHandler
public void SpecialCloak(UpdateEvent event)
{
if (event.getType() != UpdateType.TICK)
return;
GameTeam team = GetTeam(ChatColor.DARK_GRAY);
if (team == null) return;
for (Player player : team.GetPlayers(true))
{
if (!UtilGear.isMat(player.getItemInHand(), Material.IRON_SWORD))
Manager.GetCondition().Factory().Cloak("Special Cloak", player, player, 1.9, false, false);
else
Manager.GetCondition().EndCondition(player, ConditionType.CLOAK, null);
}
}
@EventHandler
public void TabHealth(UpdateEvent event)
{
@ -1172,22 +1022,6 @@ public class UHC extends TeamGame
{
GameTeam team = GetTeam(player);
if (team.GetColor() == ChatColor.DARK_GRAY)
{
if (player.getName().equalsIgnoreCase("chiss"))
player.setPlayerListName(" ");
else if (player.getName().equalsIgnoreCase("defek7"))
player.setPlayerListName(" ");
else if (player.getName().equalsIgnoreCase("spu_"))
player.setPlayerListName(" ");
else if (player.getName().equalsIgnoreCase("sterling_"))
player.setPlayerListName(" ");
else
player.setPlayerListName(" ");
continue;
}
ChatColor col = ChatColor.GREEN;
if (player.getHealth() <= 12) col = ChatColor.YELLOW;
if (player.getHealth() <= 6) col = ChatColor.RED;
@ -1383,7 +1217,7 @@ public class UHC extends TeamGame
GameTeam team = GetTeam(damager);
if (team != null && team.GetColor() == ChatColor.DARK_GRAY)
if (team != null)
{
if (_lastDragonDamager == null || !_lastDragonDamager.equals(team))
{
@ -1403,14 +1237,14 @@ public class UHC extends TeamGame
if (_ended)
return;
if (_lastDragonDamager == null)
return;
AnnounceEnd(_lastDragonDamager);
_ended = true;
}
@EventHandler
public void PortalCreate(UpdateEvent event)
{
@ -1425,23 +1259,23 @@ public class UHC extends TeamGame
{
if (loc.getBlock().getType() != Material.ENDER_PORTAL_FRAME)
loc.getBlock().setType(Material.ENDER_PORTAL_FRAME);
if (loc.getBlock().getData() < 4)
complete = false;
}
if (complete)
{
if (!_portalCreated)
{
for (Player player : UtilServer.getPlayers())
player.playSound(player.getLocation(), Sound.ZOMBIE_UNFECT, 2f, 1f);
Announce(ChatColor.WHITE + C.Bold + "The portal to The End has been opened!");
}
_portalCreated = true;
for (Location loc : _portal)
loc.getBlock().setTypeIdAndData(Material.ENDER_PORTAL.getId(), (byte)0, false);
}
@ -1451,11 +1285,18 @@ public class UHC extends TeamGame
loc.getBlock().setType(Material.AIR);
}
}
@EventHandler
public void PortalBreak(BlockBreakEvent event)
{
if (event.getBlock().getType() == Material.ENDER_PORTAL_FRAME)
event.setCancelled(true);
}
@Override
@EventHandler
public void ScoreboardUpdate(UpdateEvent event)
{
return;
}
}