XMAS UPDATE OMG :O
This commit is contained in:
parent
402530d671
commit
35ab40727b
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<classpath>
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
|
||||
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/httpcore-4.2.jar"/>
|
||||
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/httpclient-4.2.jar"/>
|
||||
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/commons-codec-1.6.jar"/>
|
||||
|
@ -1,12 +1,12 @@
|
||||
eclipse.preferences.version=1
|
||||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
|
||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
|
||||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||
org.eclipse.jdt.core.compiler.compliance=1.7
|
||||
org.eclipse.jdt.core.compiler.compliance=1.8
|
||||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
|
||||
org.eclipse.jdt.core.compiler.debug.localVariable=generate
|
||||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
|
||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||
org.eclipse.jdt.core.compiler.source=1.7
|
||||
org.eclipse.jdt.core.compiler.source=1.8
|
||||
|
@ -862,7 +862,7 @@ public class ServerManager extends MiniPlugin
|
||||
|
||||
public ShopBase<ServerManager> getMinestrikeShop()
|
||||
{
|
||||
return _serverNpcShopMap.get("Mine-Strike");
|
||||
return _serverNpcShopMap.get("MineStrike");
|
||||
}
|
||||
|
||||
public ShopBase<ServerManager> getWizardShop()
|
||||
|
@ -4,8 +4,8 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
@ -127,7 +127,7 @@ public class ServerGameMenu extends ShopPageBase<ServerManager, QuickShop>
|
||||
|
||||
setItem(22, _superSmashCycle.get(_ssmIndex));
|
||||
|
||||
setItem(24, ItemStackFactory.Instance.CreateStack(Material.TNT.getId(), (byte) 0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "Mine-Strike " + C.cGray + "Team Survival", new String[]
|
||||
setItem(24, ItemStackFactory.Instance.CreateStack(Material.TNT.getId(), (byte) 0, 1, ChatColor.RESET + C.Bold + ChatColor.YELLOW + "MineStrike" + C.cGray + "Team Survival", new String[]
|
||||
{
|
||||
ChatColor.RESET + "",
|
||||
ChatColor.RESET + "One team must defend two bomb sites from",
|
||||
|
@ -1,6 +1,5 @@
|
||||
package nautilus.game.arcade.game;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
@ -36,7 +35,6 @@ import org.bukkit.event.entity.FoodLevelChangeEvent;
|
||||
import org.bukkit.event.entity.ItemSpawnEvent;
|
||||
import org.bukkit.event.hanging.HangingBreakEvent;
|
||||
import org.bukkit.event.hanging.HangingPlaceEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerLoginEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.event.world.WorldLoadEvent;
|
||||
@ -54,8 +52,8 @@ import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTabTitle;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.common.util.UtilTextMiddle;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.disguise.disguises.DisguisePlayer;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
import mineplex.core.packethandler.IPacketHandler;
|
||||
@ -72,18 +70,24 @@ import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.events.PlayerGameRespawnEvent;
|
||||
import nautilus.game.arcade.events.PlayerStateChangeEvent;
|
||||
import nautilus.game.arcade.game.GameTeam.PlayerState;
|
||||
import nautilus.game.arcade.gametutorial.GameTutorial;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import nautilus.game.arcade.kit.KitAvailability;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
import nautilus.game.arcade.managers.GameLobbyManager;
|
||||
import nautilus.game.arcade.scoreboard.GameScoreboard;
|
||||
import nautilus.game.arcade.stats.*;
|
||||
import nautilus.game.arcade.stats.AssistsStatTracker;
|
||||
import nautilus.game.arcade.stats.DamageDealtStatTracker;
|
||||
import nautilus.game.arcade.stats.DamageTakenStatTracker;
|
||||
import nautilus.game.arcade.stats.DeathsStatTracker;
|
||||
import nautilus.game.arcade.stats.ExperienceStatTracker;
|
||||
import nautilus.game.arcade.stats.GamesPlayedStatTracker;
|
||||
import nautilus.game.arcade.stats.KillsStatTracker;
|
||||
import nautilus.game.arcade.stats.LoseStatTracker;
|
||||
import nautilus.game.arcade.stats.StatTracker;
|
||||
import nautilus.game.arcade.stats.WinStatTracker;
|
||||
import nautilus.game.arcade.world.WorldData;
|
||||
import net.minecraft.server.v1_8_R3.EntityItem;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayInUseEntity;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutScoreboardTeam;
|
||||
import net.minecraft.server.v1_8_R3.ScoreboardTeam;
|
||||
import net.minecraft.server.v1_8_R3.WorldServer;
|
||||
|
||||
public abstract class Game implements Listener
|
||||
@ -124,6 +128,7 @@ public abstract class Game implements Listener
|
||||
private boolean _countdownForce = false;
|
||||
|
||||
private String _customWinLine = "";
|
||||
private NautHashMap<Player, String> _customWinMessages = new NautHashMap<Player, String>();
|
||||
|
||||
// Kits
|
||||
private Kit[] _kits;
|
||||
@ -492,6 +497,11 @@ public abstract class Game implements Listener
|
||||
{
|
||||
_customWinLine = line;
|
||||
}
|
||||
|
||||
public void SetCustomWinMessage(Player player, String message)
|
||||
{
|
||||
_customWinMessages.put(player, message);
|
||||
}
|
||||
|
||||
public GameScoreboard GetScoreboard()
|
||||
{
|
||||
@ -1156,7 +1166,20 @@ public abstract class Game implements Listener
|
||||
UtilPlayer.message(player, "Nobody won the game!");
|
||||
}
|
||||
|
||||
UtilPlayer.message(player, _customWinLine);
|
||||
if (_customWinMessages.containsKey(player))
|
||||
{
|
||||
if (!_customWinLine.trim().equalsIgnoreCase(""))
|
||||
{
|
||||
UtilPlayer.message(player, _customWinLine);
|
||||
}
|
||||
|
||||
UtilPlayer.message(player, _customWinMessages.get(player));
|
||||
}
|
||||
else
|
||||
{
|
||||
UtilPlayer.message(player, _customWinLine);
|
||||
}
|
||||
|
||||
UtilPlayer.message(player, "");
|
||||
UtilPlayer.message(player, "§aMap - §f§l" + WorldData.MapName + C.cGray + " created by " + "§f§l"
|
||||
+ WorldData.MapAuthor);
|
||||
|
@ -1,8 +1,9 @@
|
||||
package nautilus.game.arcade.game;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@ -13,8 +14,6 @@ import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.events.PlayerStateChangeEvent;
|
||||
import nautilus.game.arcade.game.GameTeam.PlayerState;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
|
||||
public abstract class SoloGame extends Game
|
||||
@ -36,6 +35,11 @@ public abstract class SoloGame extends Game
|
||||
_players.SetColor(ChatColor.YELLOW);
|
||||
_players.SetName("Players");
|
||||
}
|
||||
|
||||
public GameTeam getPlayersTeam()
|
||||
{
|
||||
return _players;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void EndCheck()
|
||||
|
@ -1,6 +1,5 @@
|
||||
package nautilus.game.arcade.game.games.christmas;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
@ -8,9 +7,8 @@ import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.CraftServer;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftHorse;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Villager;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@ -18,13 +16,16 @@ import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.block.BlockFadeEvent;
|
||||
import org.bukkit.event.entity.EntityCombustEvent;
|
||||
import org.bukkit.event.entity.ItemSpawnEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.entity.ItemSpawnEvent;
|
||||
import org.bukkit.event.entity.ProjectileHitEvent;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.event.player.PlayerInteractAtEntityEvent;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.Callback;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.MapUtil;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
@ -34,7 +35,6 @@ import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.packethandler.IPacketHandler;
|
||||
import mineplex.core.packethandler.PacketInfo;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.reward.rewards.PetReward;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
@ -45,14 +45,22 @@ import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.SoloGame;
|
||||
import nautilus.game.arcade.game.games.christmas.kits.KitPlayer;
|
||||
import nautilus.game.arcade.game.games.christmas.parts.*;
|
||||
import nautilus.game.arcade.game.games.christmas.parts.Part;
|
||||
import nautilus.game.arcade.game.games.christmas.parts.Part1;
|
||||
import nautilus.game.arcade.game.games.christmas.parts.Part2;
|
||||
import nautilus.game.arcade.game.games.christmas.parts.Part3;
|
||||
import nautilus.game.arcade.game.games.christmas.parts.Part4;
|
||||
import nautilus.game.arcade.game.games.christmas.parts.Part5;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutAttachEntity;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityDestroy;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutNamedSoundEffect;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving;
|
||||
|
||||
public class Christmas extends SoloGame
|
||||
{
|
||||
private GameTeam _badGuys;
|
||||
|
||||
private Sleigh _sleigh;
|
||||
|
||||
private Location _sleighSpawn;
|
||||
@ -201,7 +209,7 @@ public class Christmas extends SoloGame
|
||||
for (Location loc : WorldData.GetCustomLocs("129"))
|
||||
{
|
||||
_barrier.add(loc.getBlock().getLocation());
|
||||
MapUtil.QuickChangeBlockAt(loc, 65, (byte)3);
|
||||
MapUtil.QuickChangeBlockAt(loc, 166, (byte)0);
|
||||
}
|
||||
|
||||
//Parts
|
||||
@ -250,7 +258,8 @@ public class Christmas extends SoloGame
|
||||
if (event.GetState() != GameState.Live)
|
||||
return;
|
||||
|
||||
GetTeamList().add(new GameTeam(this, "Christmas Thieves", ChatColor.RED, WorldData.GetDataLocs("RED")));
|
||||
_badGuys = new GameTeam(this, "Christmas Thieves", ChatColor.RED, WorldData.GetDataLocs("RED"));
|
||||
AddTeam(_badGuys);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
@ -366,7 +375,7 @@ public class Christmas extends SoloGame
|
||||
|
||||
for (Location loc : _barrier)
|
||||
{
|
||||
if (UtilMath.offset(GetSleigh().GetLocation(), loc) > 15)
|
||||
if (UtilMath.offset(GetSleigh().GetLocation(), loc) > 20)
|
||||
continue;
|
||||
|
||||
breakAt = loc;
|
||||
@ -458,14 +467,39 @@ public class Christmas extends SoloGame
|
||||
|
||||
for (Player player : GetPlayers(false))
|
||||
{
|
||||
Manager.rewardPet(player, "Christmas Elf", EntityType.VILLAGER);
|
||||
if (Manager.IsRewardItems())
|
||||
{
|
||||
if (Manager.GetTaskManager().hasCompletedTask(player, "CC Reward 2015"))
|
||||
{
|
||||
SetCustomWinMessage(player, "You already earned your reward");
|
||||
}
|
||||
else
|
||||
{
|
||||
SetCustomWinMessage(player, "You earned " + C.cYellow + "Winter Chest x2");
|
||||
|
||||
Manager.GetTaskManager().completedTask(new Callback<Boolean>()
|
||||
{
|
||||
@Override
|
||||
public void run(Boolean data)
|
||||
{
|
||||
if (data)
|
||||
{
|
||||
Manager.getInventoryManager().addItemToInventory(player, "Winter Chest", 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
UtilPlayer.message(player, F.main("Inventory", "An error occured while giving you " + C.cRed + "Winter Chest x2" + C.cGray + "."));
|
||||
}
|
||||
}
|
||||
}, player, "CC Reward 2015");
|
||||
}
|
||||
}
|
||||
|
||||
Manager.GetGame().AddGems(player, 30, "Slaying the Pumpkin King", false, false);
|
||||
Manager.GetGame().AddGems(player, 10, "Participation", false, false);
|
||||
}
|
||||
|
||||
SetCustomWinLine("You earned Christmas Elf Pet!");
|
||||
AnnounceEnd(this.GetTeamList().get(0));
|
||||
AnnounceEnd(getPlayersTeam());
|
||||
SetState(GameState.End);
|
||||
}
|
||||
else if (GetPlayers(true).size() == 0)
|
||||
@ -476,7 +510,7 @@ public class Christmas extends SoloGame
|
||||
}
|
||||
|
||||
SetCustomWinLine("You all died...");
|
||||
AnnounceEnd(this.GetTeamList().get(1));
|
||||
AnnounceEnd(_badGuys);
|
||||
SetState(GameState.End);
|
||||
}
|
||||
else if (UtilTime.elapsed(GetStateTime(), _gameTime))
|
||||
@ -487,7 +521,7 @@ public class Christmas extends SoloGame
|
||||
}
|
||||
|
||||
SetCustomWinLine("You did not save Christmas in time.");
|
||||
AnnounceEnd(this.GetTeamList().get(1));
|
||||
AnnounceEnd(_badGuys);
|
||||
SetState(GameState.End);
|
||||
}
|
||||
|
||||
@ -504,7 +538,7 @@ public class Christmas extends SoloGame
|
||||
}
|
||||
|
||||
SetCustomWinLine("Santa Claus was killed by the Giant!");
|
||||
AnnounceEnd(this.GetTeamList().get(1));
|
||||
AnnounceEnd(_badGuys);
|
||||
SetState(GameState.End);
|
||||
}
|
||||
|
||||
@ -572,30 +606,55 @@ public class Christmas extends SoloGame
|
||||
return;
|
||||
|
||||
if (!IsLive())
|
||||
{
|
||||
Scoreboard.Reset();
|
||||
|
||||
String line = "";
|
||||
for (int i = 0 ; i < 10 ; i++)
|
||||
line += ((i % 2 == 0 ? C.cRed : C.cDGreen) + "█");
|
||||
|
||||
Scoreboard.WriteBlank();
|
||||
Scoreboard.Write(line);
|
||||
|
||||
Scoreboard.WriteBlank();
|
||||
|
||||
Scoreboard.Write(C.cWhiteB + "May your winter");
|
||||
Scoreboard.Write(C.cWhiteB + "be filled with " + C.cYellowB + "joy" + C.cWhiteB + " and " + C.cYellowB + "cheer" + C.cWhiteB + ".");
|
||||
|
||||
Scoreboard.WriteBlank();
|
||||
|
||||
Scoreboard.Write(C.cWhite + "Happy Holidays!");
|
||||
Scoreboard.Write(C.cWhiteB + "- Your friends at " + C.cGoldB + "MINEPLEX");
|
||||
|
||||
Scoreboard.WriteBlank();
|
||||
Scoreboard.Write(line);
|
||||
|
||||
Scoreboard.Draw();
|
||||
return;
|
||||
}
|
||||
|
||||
//Wipe Last
|
||||
Scoreboard.Reset();
|
||||
|
||||
//Rounds
|
||||
Scoreboard.WriteBlank();
|
||||
Scoreboard.Write(C.cWhite + "Challenge:");
|
||||
Scoreboard.Write(C.cYellow + (5 - _parts.size()) + " of " + 5);
|
||||
Scoreboard.Write(C.cGoldB + "Challenge");
|
||||
Scoreboard.Write(C.cWhite + (5 - _parts.size()) + " of " + 5);
|
||||
|
||||
//Presents
|
||||
Scoreboard.WriteBlank();
|
||||
Scoreboard.Write(C.cWhite + "Presents:");
|
||||
Scoreboard.Write(C.cYellow + GetSleigh().GetPresents().size() + " of " + 10);
|
||||
Scoreboard.Write(C.cGreenB + "Presents");
|
||||
Scoreboard.Write(C.cWhite + GetSleigh().GetPresents().size() + " of " + 10);
|
||||
|
||||
//Players
|
||||
Scoreboard.WriteBlank();
|
||||
Scoreboard.Write(C.cWhite + "Players:");
|
||||
Scoreboard.Write(C.cYellow + GetPlayers(true).size());
|
||||
Scoreboard.Write(C.cYellowB + "Players");
|
||||
Scoreboard.Write(C.cWhite + GetPlayers(true).size());
|
||||
|
||||
//Time
|
||||
Scoreboard.WriteBlank();
|
||||
Scoreboard.Write(C.cWhite + "Time Left:");
|
||||
Scoreboard.Write(C.cYellow + UtilTime.MakeStr(_gameTime - (System.currentTimeMillis() - GetStateTime())));
|
||||
Scoreboard.Write(C.cYellowB + "Time Left");
|
||||
Scoreboard.Write(C.cWhite + UtilTime.MakeStr(_gameTime - (System.currentTimeMillis() - GetStateTime())));
|
||||
|
||||
Scoreboard.Draw();
|
||||
}
|
||||
@ -679,4 +738,37 @@ public class Christmas extends SoloGame
|
||||
UtilPlayer.sendPacket(player, packet);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void updateReigns(UpdateEvent event)
|
||||
{
|
||||
if (!InProgress())
|
||||
return;
|
||||
|
||||
if (event.getType() != UpdateType.FASTER)
|
||||
return;
|
||||
|
||||
if (_sleigh == null)
|
||||
return;
|
||||
|
||||
if (_sleigh.getSanta() == null)
|
||||
return;
|
||||
|
||||
for (SleighHorse horse : _sleigh.getHorses())
|
||||
{
|
||||
if (horse.Ent == null || !horse.Ent.isValid())
|
||||
continue;
|
||||
|
||||
PacketPlayOutAttachEntity packet = new PacketPlayOutAttachEntity(1, ((CraftHorse) horse.Ent).getHandle(), (((CraftEntity) _sleigh.getSanta()).getHandle()));
|
||||
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
UtilPlayer.sendPacket(player, packet);
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void preventStand(PlayerInteractAtEntityEvent event)
|
||||
{
|
||||
event.setCancelled(true);
|
||||
}
|
||||
}
|
||||
|
@ -2,30 +2,28 @@ package nautilus.game.arcade.game.games.christmas;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
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.UtilMath;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.game.games.christmas.parts.Part;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.FireworkEffect;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.FireworkEffect.Type;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Chicken;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.FallingBlock;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class Sleigh
|
||||
{
|
||||
@ -41,6 +39,8 @@ public class Sleigh
|
||||
private ArrayList<Location> PresentsCollected = new ArrayList<Location>();;
|
||||
|
||||
private Location Target;
|
||||
|
||||
private Entity Santa;
|
||||
|
||||
public void setupSleigh(Christmas host, Location loc)
|
||||
{
|
||||
@ -52,24 +52,25 @@ public class Sleigh
|
||||
|
||||
CentralEntity = loc.getWorld().spawn(loc, Chicken.class);
|
||||
UtilEnt.Vegetate(CentralEntity, true);
|
||||
UtilEnt.ghost(CentralEntity, true, true);
|
||||
UtilEnt.ghost(CentralEntity, true, false);
|
||||
Host.Manager.GetCondition().Factory().Invisible("Sleigh", (LivingEntity) CentralEntity, null, Double.MAX_VALUE, 3, false, false, true);
|
||||
|
||||
//Presents
|
||||
PresentSlots = new ArrayList<SleighPart>();
|
||||
|
||||
PresentSlots.add(new SleighPart(2, 0, 0, loc.clone(), -1, -2));
|
||||
PresentSlots.add(new SleighPart(2, 0, 0, loc.clone(), 0, -2));
|
||||
PresentSlots.add(new SleighPart(2, 0, 0, loc.clone(), 1, -2));
|
||||
PresentSlots.add(new SleighPart(2, 0, 0, loc.clone(), -1, -1));
|
||||
PresentSlots.add(new SleighPart(2, 0, 0, loc.clone(), 0, -1));
|
||||
PresentSlots.add(new SleighPart(2, 0, 0, loc.clone(), 1, -1));
|
||||
PresentSlots.add(new SleighPart(this, 2, 0, 0, loc.clone(), -1, -2));
|
||||
PresentSlots.add(new SleighPart(this, 2, 0, 0, loc.clone(), 0, -2));
|
||||
PresentSlots.add(new SleighPart(this, 2, 0, 0, loc.clone(), 1, -2));
|
||||
PresentSlots.add(new SleighPart(this, 2, 0, 0, loc.clone(), -1, -1));
|
||||
PresentSlots.add(new SleighPart(this, 2, 0, 0, loc.clone(), 0, -1));
|
||||
PresentSlots.add(new SleighPart(this, 2, 0, 0, loc.clone(), 1, -1));
|
||||
|
||||
PresentSlots.add(new SleighPart(6, 0, 0, loc.clone(), -1, -2));
|
||||
PresentSlots.add(new SleighPart(6, 0, 0, loc.clone(), 0, -2));
|
||||
PresentSlots.add(new SleighPart(6, 0, 0, loc.clone(), 1, -2));
|
||||
PresentSlots.add(new SleighPart(6, 0, 0, loc.clone(), -1, -1));
|
||||
PresentSlots.add(new SleighPart(6, 0, 0, loc.clone(), 0, -1));
|
||||
PresentSlots.add(new SleighPart(6, 0, 0, loc.clone(), 1, -1));
|
||||
PresentSlots.add(new SleighPart(this, 6, 0, 0, loc.clone(), -1, -2));
|
||||
PresentSlots.add(new SleighPart(this, 6, 0, 0, loc.clone(), 0, -2));
|
||||
PresentSlots.add(new SleighPart(this, 6, 0, 0, loc.clone(), 1, -2));
|
||||
PresentSlots.add(new SleighPart(this, 6, 0, 0, loc.clone(), -1, -1));
|
||||
PresentSlots.add(new SleighPart(this, 6, 0, 0, loc.clone(), 0, -1));
|
||||
PresentSlots.add(new SleighPart(this, 6, 0, 0, loc.clone(), 1, -1));
|
||||
|
||||
//Sleigh
|
||||
SleighEnts = new ArrayList<SleighPart>();
|
||||
@ -77,65 +78,71 @@ public class Sleigh
|
||||
for (SleighPart part : PresentSlots)
|
||||
SleighEnts.add(part);
|
||||
|
||||
SleighEnts.add(new SleighPart(0, 159, 14, loc.clone(), 0, -3));
|
||||
SleighEnts.add(new SleighPart(0, 159, 14, loc.clone(), -1, -3));
|
||||
SleighEnts.add(new SleighPart(0, 159, 14, loc.clone(), -2, -3));
|
||||
SleighEnts.add(new SleighPart(0, 159, 14, loc.clone(), 1, -3));
|
||||
SleighEnts.add(new SleighPart(0, 159, 14, loc.clone(), 2, -3));
|
||||
SleighEnts.add(new SleighPart(this, 0, 159, 14, loc.clone(), 0, -3));
|
||||
SleighEnts.add(new SleighPart(this, 0, 159, 14, loc.clone(), -1, -3));
|
||||
SleighEnts.add(new SleighPart(this, 0, 159, 14, loc.clone(), -2, -3));
|
||||
SleighEnts.add(new SleighPart(this, 0, 159, 14, loc.clone(), 1, -3));
|
||||
SleighEnts.add(new SleighPart(this, 0, 159, 14, loc.clone(), 2, -3));
|
||||
|
||||
SleighEnts.add(new SleighPart(0, 159, 14, loc.clone(), -2, -2));
|
||||
SleighEnts.add(new SleighPart(0, 44, 7, loc.clone(), -1, -2));
|
||||
SleighEnts.add(new SleighPart(0, 44, 7, loc.clone(), 0, -2));
|
||||
SleighEnts.add(new SleighPart(0, 44, 7, loc.clone(), 1, -2));
|
||||
SleighEnts.add(new SleighPart(0, 159, 14, loc.clone(), 2, -2));
|
||||
SleighEnts.add(new SleighPart(this, 0, 159, 14, loc.clone(), -2, -2));
|
||||
SleighEnts.add(new SleighPart(this, 0, 44, 7, loc.clone(), -1, -2));
|
||||
SleighEnts.add(new SleighPart(this, 0, 44, 7, loc.clone(), 0, -2));
|
||||
SleighEnts.add(new SleighPart(this, 0, 44, 7, loc.clone(), 1, -2));
|
||||
SleighEnts.add(new SleighPart(this, 0, 159, 14, loc.clone(), 2, -2));
|
||||
|
||||
SleighEnts.add(new SleighPart(0, 159, 14, loc.clone(), -2, -1));
|
||||
SleighEnts.add(new SleighPart(0, 44, 7, loc.clone(), -1, -1));
|
||||
SleighEnts.add(new SleighPart(0, 44, 7, loc.clone(), 0, -1));
|
||||
SleighEnts.add(new SleighPart(0, 44, 7, loc.clone(), 1, -1));
|
||||
SleighEnts.add(new SleighPart(0, 159, 14, loc.clone(), 2, -1));
|
||||
SleighEnts.add(new SleighPart(this, 0, 159, 14, loc.clone(), -2, -1));
|
||||
SleighEnts.add(new SleighPart(this, 0, 44, 7, loc.clone(), -1, -1));
|
||||
SleighEnts.add(new SleighPart(this, 0, 44, 7, loc.clone(), 0, -1));
|
||||
SleighEnts.add(new SleighPart(this, 0, 44, 7, loc.clone(), 1, -1));
|
||||
SleighEnts.add(new SleighPart(this, 0, 159, 14, loc.clone(), 2, -1));
|
||||
|
||||
|
||||
SleighEnts.add(new SleighPart(0, 159, 14, loc.clone(), -2, 0));
|
||||
SleighEnts.add(new SleighPart(0, 159, 14, loc.clone(), -1, 0));
|
||||
SleighEnts.add(new SleighPart(0, 159, 14, loc.clone(), 0, 0));
|
||||
SleighEnts.add(new SleighPart(0, 159, 14, loc.clone(), 1, 0));
|
||||
SleighEnts.add(new SleighPart(0, 159, 14, loc.clone(), 2, 0));
|
||||
SleighEnts.add(new SleighPart(this, 0, 159, 14, loc.clone(), -2, 0));
|
||||
SleighEnts.add(new SleighPart(this, 0, 159, 14, loc.clone(), -1, 0));
|
||||
SleighEnts.add(new SleighPart(this, 0, 159, 14, loc.clone(), 0, 0));
|
||||
SleighEnts.add(new SleighPart(this, 0, 159, 14, loc.clone(), 1, 0));
|
||||
SleighEnts.add(new SleighPart(this, 0, 159, 14, loc.clone(), 2, 0));
|
||||
|
||||
SleighEnts.add(new SleighPart(0, 159, 14, loc.clone(), -2, 1));
|
||||
SleighEnts.add(new SleighPart(0, 44, 7, loc.clone(), -1, 1));
|
||||
SleighEnts.add(new SleighPart(0, 159, 15, loc.clone(), 0, 1));
|
||||
SleighEnts.add(new SleighPart(0, 44, 7, loc.clone(), 1, 1));
|
||||
SleighEnts.add(new SleighPart(0, 159, 14, loc.clone(), 2, 1));
|
||||
SleighEnts.add(new SleighPart(this, 0, 159, 14, loc.clone(), -2, 1));
|
||||
SleighEnts.add(new SleighPart(this, 0, 44, 7, loc.clone(), -1, 1));
|
||||
SleighEnts.add(new SleighPart(this, 0, 159, 15, loc.clone(), 0, 1));
|
||||
SleighEnts.add(new SleighPart(this, 0, 44, 7, loc.clone(), 1, 1));
|
||||
SleighEnts.add(new SleighPart(this, 0, 159, 14, loc.clone(), 2, 1));
|
||||
|
||||
SleighEnts.add(new SleighPart(0, 44, 7, loc.clone(), -2, 2));
|
||||
SleighEnts.add(new SleighPart(0, 44, 7, loc.clone(), -1, 2));
|
||||
SleighEnts.add(new SleighPart(0, 44, 7, loc.clone(), 0, 2));
|
||||
SleighEnts.add(new SleighPart(0, 44, 7, loc.clone(), 1, 2));
|
||||
SleighEnts.add(new SleighPart(0, 44, 7, loc.clone(), 2, 2));
|
||||
SleighEnts.add(new SleighPart(this, 0, 44, 7, loc.clone(), -2, 2));
|
||||
SleighEnts.add(new SleighPart(this, 0, 44, 7, loc.clone(), -1, 2));
|
||||
SleighEnts.add(new SleighPart(this, 0, 44, 7, loc.clone(), 0, 2));
|
||||
SleighEnts.add(new SleighPart(this, 0, 44, 7, loc.clone(), 1, 2));
|
||||
SleighEnts.add(new SleighPart(this, 0, 44, 7, loc.clone(), 2, 2));
|
||||
|
||||
SleighEnts.add(new SleighPart(0, 159, 14, loc.clone(), -2, 3));
|
||||
SleighEnts.add(new SleighPart(0, 159, 14, loc.clone(), -1, 3));
|
||||
SleighEnts.add(new SleighPart(0, 159, 14, loc.clone(), 0, 3));
|
||||
SleighEnts.add(new SleighPart(0, 159, 14, loc.clone(), 1, 3));
|
||||
SleighEnts.add(new SleighPart(0, 159, 14, loc.clone(), 2, 3));
|
||||
SleighEnts.add(new SleighPart(this, 0, 159, 14, loc.clone(), -2, 3));
|
||||
SleighEnts.add(new SleighPart(this, 0, 159, 14, loc.clone(), -1, 3));
|
||||
SleighEnts.add(new SleighPart(this, 0, 159, 14, loc.clone(), 0, 3));
|
||||
SleighEnts.add(new SleighPart(this, 0, 159, 14, loc.clone(), 1, 3));
|
||||
SleighEnts.add(new SleighPart(this, 0, 159, 14, loc.clone(), 2, 3));
|
||||
|
||||
//Santa
|
||||
SleighPart santa = new SleighPart(3, 0, 0, loc.clone(), 0, 1);
|
||||
santa.AddSanta();
|
||||
SleighPart santa = new SleighPart(this, 3, 0, 0, loc.clone(), 0, 1);
|
||||
Santa = santa.AddSanta();
|
||||
SleighEnts.add(santa);
|
||||
|
||||
SleighHorses.add(new SleighHorse(loc.clone(), -1.5, 8));
|
||||
SleighHorses.add(new SleighHorse(loc.clone(), 1.5, 8));
|
||||
SleighHorses.add(new SleighHorse(loc.clone(), "Dasher", -1.5, 8));
|
||||
SleighHorses.add(new SleighHorse(loc.clone(), "Dancer", 1.5, 8));
|
||||
|
||||
SleighHorses.add(new SleighHorse(loc.clone(), "Prancer", -1.5, 11));
|
||||
SleighHorses.add(new SleighHorse(loc.clone(), "Vixen", 1.5, 11));
|
||||
|
||||
SleighHorses.add(new SleighHorse(loc.clone(), "Comet", -1.5, 14));
|
||||
SleighHorses.add(new SleighHorse(loc.clone(), "Cupid", 1.5, 14));
|
||||
|
||||
SleighHorses.add(new SleighHorse(loc.clone(), -1.5, 11));
|
||||
SleighHorses.add(new SleighHorse(loc.clone(), 1.5, 11));
|
||||
SleighHorses.add(new SleighHorse(loc.clone(), "Donner", -1.5, 17));
|
||||
SleighHorses.add(new SleighHorse(loc.clone(), "Blitzen", 1.5, 17));
|
||||
|
||||
for (SleighHorse horse : SleighHorses)
|
||||
horse.spawnHorse();
|
||||
|
||||
for (SleighHorse horse : SleighHorses)
|
||||
UtilEnt.Leash(horse.Ent, santa.GetTop(), false, false);
|
||||
// for (SleighHorse horse : SleighHorses)
|
||||
// UtilEnt.Leash(horse.Ent, santa.GetTop(), true, false);
|
||||
}
|
||||
|
||||
public Location GetLocation()
|
||||
@ -157,6 +164,8 @@ public class Sleigh
|
||||
|
||||
Move(CentralEntity, Target, 1);
|
||||
|
||||
Santa.setTicksLived(1);
|
||||
|
||||
//Move Sleigh
|
||||
for (SleighPart part : SleighEnts)
|
||||
{
|
||||
@ -184,24 +193,6 @@ public class Sleigh
|
||||
{
|
||||
for (Player player : Host.GetPlayers(true))
|
||||
{
|
||||
if (!Recharge.Instance.usable(player, "Sleigh Bump"))
|
||||
continue;
|
||||
|
||||
for (SleighPart part : SleighEnts)
|
||||
if (UtilMath.offset(player, part.Ent) < 1)
|
||||
{
|
||||
UtilAction.velocity(player, UtilAlg.getTrajectory2d(CentralEntity, player), 0.4, true, 0.2, 0, 0, true);
|
||||
Recharge.Instance.useForce(player, "Sleigh Bump", 400);
|
||||
}
|
||||
|
||||
|
||||
for (SleighHorse part : SleighHorses)
|
||||
if (UtilMath.offset(player, part.Ent) < 1)
|
||||
{
|
||||
UtilAction.velocity(player, UtilAlg.getTrajectory2d(CentralEntity, player), 0.4, true, 0.2, 0, 0, true);
|
||||
Recharge.Instance.useForce(player, "Sleigh Bump", 400);
|
||||
}
|
||||
|
||||
if (player.getLocation().getZ() < CentralEntity.getLocation().getZ() - 24)
|
||||
{
|
||||
player.damage(1);
|
||||
@ -211,6 +202,64 @@ public class Sleigh
|
||||
Recharge.Instance.useForce(player, "Sleigh Bump", 400);
|
||||
}
|
||||
}
|
||||
|
||||
for (SleighPart part : SleighEnts)
|
||||
{
|
||||
for (Entity ent : UtilEnt.getInRadius(part.Ent.getLocation(), 1).keySet())
|
||||
{
|
||||
boolean matches = false;
|
||||
for (SleighPart cur : SleighEnts)
|
||||
{
|
||||
if (ent instanceof LivingEntity && cur.HasEntity((LivingEntity) ent))
|
||||
{
|
||||
matches = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (matches)
|
||||
continue;
|
||||
|
||||
if (ent instanceof Player)
|
||||
{
|
||||
if (!Recharge.Instance.usable((Player) ent, "Sleigh Bump"))
|
||||
continue;
|
||||
|
||||
Recharge.Instance.useForce((Player) ent, "Sleigh Bump", 400);
|
||||
}
|
||||
|
||||
UtilAction.velocity(ent, UtilAlg.getTrajectory2d(CentralEntity, ent), 0.4, true, 0.2, 0, 0, true);
|
||||
}
|
||||
}
|
||||
|
||||
for (SleighHorse part : SleighHorses)
|
||||
{
|
||||
for (Entity ent : UtilEnt.getInRadius(part.Ent.getLocation(), 1).keySet())
|
||||
{
|
||||
boolean matches = false;
|
||||
for (SleighPart cur : SleighEnts)
|
||||
{
|
||||
if (ent instanceof LivingEntity && cur.HasEntity((LivingEntity) ent))
|
||||
{
|
||||
matches = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (matches)
|
||||
continue;
|
||||
|
||||
if (ent instanceof Player)
|
||||
{
|
||||
if (!Recharge.Instance.usable((Player) ent, "Sleigh Bump"))
|
||||
continue;
|
||||
|
||||
Recharge.Instance.useForce((Player) ent, "Sleigh Bump", 400);
|
||||
}
|
||||
|
||||
UtilAction.velocity(ent, UtilAlg.getTrajectory2d(CentralEntity, ent), 0.4, true, 0.2, 0, 0, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean HasPresent(Location loc)
|
||||
@ -222,6 +271,7 @@ public class Sleigh
|
||||
{
|
||||
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);
|
||||
|
||||
@ -267,4 +317,9 @@ public class Sleigh
|
||||
{
|
||||
return SleighHorses;
|
||||
}
|
||||
|
||||
public Entity getSanta()
|
||||
{
|
||||
return Santa;
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,19 @@ package nautilus.game.arcade.game.games.christmas;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack;
|
||||
import org.bukkit.entity.Horse;
|
||||
import org.bukkit.entity.Horse.Color;
|
||||
import org.bukkit.entity.Horse.Style;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import net.minecraft.server.v1_8_R3.DataWatcher;
|
||||
@ -14,19 +27,6 @@ import net.minecraft.server.v1_8_R3.PacketPlayOutEntityTeleport;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving;
|
||||
import net.minecraft.server.v1_8_R3.Vector3f;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.inventory.CraftItemStack;
|
||||
import org.bukkit.entity.Horse;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Horse.Color;
|
||||
import org.bukkit.entity.Horse.Style;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
public class SleighHorse
|
||||
{
|
||||
private Location _lastFacing;
|
||||
@ -40,9 +40,11 @@ public class SleighHorse
|
||||
public int horseId;
|
||||
public double OffsetX;
|
||||
public double OffsetZ;
|
||||
public String Name;
|
||||
|
||||
public SleighHorse(Location loc, double x, double z)
|
||||
public SleighHorse(Location loc, String name, double x, double z)
|
||||
{
|
||||
Name = name;
|
||||
OffsetX = x;
|
||||
OffsetZ = z;
|
||||
_lastFacing = loc.add(x, 0.5, z);
|
||||
@ -182,6 +184,10 @@ public class SleighHorse
|
||||
Ent = _lastFacing.getWorld().spawn(_lastFacing.subtract(0, 0.5, 0), Horse.class);
|
||||
UtilEnt.Vegetate(Ent);
|
||||
UtilEnt.ghost(Ent, true, false);
|
||||
Ent.setRemoveWhenFarAway(false);
|
||||
|
||||
Ent.setCustomName(C.cWhiteB + Name);
|
||||
Ent.setCustomNameVisible(true);
|
||||
|
||||
Ent.setStyle(Style.BLACK_DOTS);
|
||||
Ent.setColor(Color.BROWN);
|
||||
|
@ -1,9 +1,5 @@
|
||||
package nautilus.game.arcade.game.games.christmas;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
@ -16,6 +12,10 @@ import org.bukkit.entity.Skeleton;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.LeatherArmorMeta;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
|
||||
public class SleighPart
|
||||
{
|
||||
public Chicken Ent;
|
||||
@ -23,38 +23,32 @@ public class SleighPart
|
||||
public double OffsetX;
|
||||
public double OffsetZ;
|
||||
|
||||
public SleighPart(int rise, int id, int data, Location loc, double x, double z)
|
||||
public int Rise;
|
||||
public int Id;
|
||||
public int Data;
|
||||
public Location Location;
|
||||
|
||||
public SleighPart(Sleigh sleigh, int rise, int id, int data, Location loc, double x, double z)
|
||||
{
|
||||
//Base
|
||||
Ent = loc.getWorld().spawn(loc.add(x, 0, z), Chicken.class);
|
||||
Ent.setBaby();
|
||||
Ent.setAgeLock(true);
|
||||
Ent.setRemoveWhenFarAway(false);
|
||||
|
||||
UtilEnt.Vegetate(Ent, true);
|
||||
UtilEnt.ghost(Ent, true, true);
|
||||
|
||||
UtilEnt.ghost(Ent, true, false);
|
||||
sleigh.Host.Manager.GetCondition().Factory().Invisible("Sleigh", Ent, null, Double.MAX_VALUE, 3, false, false, true);
|
||||
|
||||
//Height
|
||||
Chicken top = Ent;
|
||||
for (int i=0 ; i<rise ; i++)
|
||||
{
|
||||
Chicken newTop = loc.getWorld().spawn(loc.add(x, 0, z), Chicken.class);
|
||||
newTop.setBaby();
|
||||
newTop.setAgeLock(true);
|
||||
UtilEnt.Vegetate(newTop, true);
|
||||
UtilEnt.ghost(newTop, true, true);
|
||||
|
||||
top.setPassenger(newTop);
|
||||
top = newTop;
|
||||
}
|
||||
|
||||
//Block
|
||||
if (id != 0)
|
||||
{
|
||||
Block = loc.getWorld().spawnFallingBlock(loc.add(0, 1, 0), id, (byte)data);
|
||||
top.setPassenger(Block);
|
||||
}
|
||||
|
||||
Rise = rise;
|
||||
Id = id;
|
||||
Data = data;
|
||||
Location = loc;
|
||||
OffsetX = x;
|
||||
OffsetZ = z;
|
||||
|
||||
addRise(sleigh);
|
||||
}
|
||||
|
||||
public void RefreshBlocks()
|
||||
@ -70,7 +64,7 @@ public class SleighPart
|
||||
|
||||
if (ent instanceof FallingBlock)
|
||||
((CraftFallingSand)ent).getHandle().ticksLived = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void SetPresent()
|
||||
@ -87,10 +81,10 @@ public class SleighPart
|
||||
top.setPassenger(Block);
|
||||
}
|
||||
|
||||
public void AddSanta()
|
||||
public Entity AddSanta()
|
||||
{
|
||||
if (Ent == null)
|
||||
return;
|
||||
return null;
|
||||
|
||||
Skeleton skel = Ent.getWorld().spawn(Ent.getLocation().add(0, 1, 0), Skeleton.class);
|
||||
UtilEnt.Vegetate(skel);
|
||||
@ -99,6 +93,7 @@ public class SleighPart
|
||||
ItemStack head = new ItemStack(Material.LEATHER_HELMET);
|
||||
LeatherArmorMeta meta = (LeatherArmorMeta)head.getItemMeta();
|
||||
meta.setColor(Color.RED);
|
||||
meta.spigot().setUnbreakable(true);
|
||||
head.setItemMeta(meta);
|
||||
skel.getEquipment().setHelmet(head);
|
||||
|
||||
@ -116,18 +111,22 @@ public class SleighPart
|
||||
|
||||
ItemStack boots = new ItemStack(Material.LEATHER_BOOTS);
|
||||
meta = (LeatherArmorMeta)boots.getItemMeta();
|
||||
meta.setColor(Color.RED);
|
||||
meta.setColor(Color.BLACK);
|
||||
boots.setItemMeta(meta);
|
||||
skel.getEquipment().setBoots(boots);
|
||||
|
||||
skel.setCustomName(C.Bold + "Santa Claus");
|
||||
skel.setCustomNameVisible(true);
|
||||
|
||||
Entity top = Ent;
|
||||
while (top.getPassenger() != null)
|
||||
top = top.getPassenger();
|
||||
|
||||
top.setPassenger(skel);
|
||||
|
||||
skel.setCustomName(C.Bold + "Santa Claus");
|
||||
skel.setCustomNameVisible(true);
|
||||
|
||||
skel.setRemoveWhenFarAway(false);
|
||||
|
||||
return skel;
|
||||
}
|
||||
|
||||
public boolean HasEntity(LivingEntity ent)
|
||||
@ -159,4 +158,30 @@ public class SleighPart
|
||||
|
||||
return ent;
|
||||
}
|
||||
|
||||
private void addRise(Sleigh sleigh)
|
||||
{
|
||||
Chicken top = Ent;
|
||||
for (int i=0 ; i<Rise ; i++)
|
||||
{
|
||||
Chicken newTop = Location.getWorld().spawn(Ent.getLocation(), Chicken.class);
|
||||
newTop.setBaby();
|
||||
newTop.setAgeLock(true);
|
||||
newTop.setRemoveWhenFarAway(false);
|
||||
|
||||
UtilEnt.Vegetate(newTop, true);
|
||||
UtilEnt.ghost(newTop, true, false);
|
||||
sleigh.Host.Manager.GetCondition().Factory().Invisible("Sleigh", newTop, null, Double.MAX_VALUE, 3, false, false, true);
|
||||
|
||||
top.setPassenger(newTop);
|
||||
top = newTop;
|
||||
}
|
||||
|
||||
//Block
|
||||
if (Id != 0)
|
||||
{
|
||||
Block = Location.getWorld().spawnFallingBlock(Ent.getLocation().add(0, 1, 0), Id, (byte) Data);
|
||||
top.setPassenger(Block);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3,21 +3,20 @@ package nautilus.game.arcade.game.games.christmas.content;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.MapUtil;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import nautilus.game.arcade.game.games.christmas.Christmas;
|
||||
import nautilus.game.arcade.game.games.christmas.ChristmasAudio;
|
||||
import nautilus.game.arcade.game.games.christmas.parts.Part5;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.MapUtil;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import nautilus.game.arcade.game.games.christmas.ChristmasAudio;
|
||||
import nautilus.game.arcade.game.games.christmas.parts.Part5;
|
||||
|
||||
public class BossFloor
|
||||
{
|
||||
private Part5 Host;
|
||||
@ -114,9 +113,10 @@ public class BossFloor
|
||||
_restoreLoc = Host.GetBoss().GetEntity().getLocation().getBlock().getLocation().add(0.5, 0, 0.5);
|
||||
|
||||
//Give Wool
|
||||
for (Player player : UtilServer.getPlayers())
|
||||
for (int i=3 ; i<9 ; i++)
|
||||
player.getInventory().setItem(i, ItemStackFactory.Instance.CreateStack(Material.WOOL, _color));
|
||||
for (Player player : Host.Host.GetPlayers(true))
|
||||
for (int i=0 ; i<9 ; i++)
|
||||
if (player.getInventory().getItem(i) == null || player.getInventory().getItem(i).getType() == Material.AIR)
|
||||
player.getInventory().setItem(i, ItemStackFactory.Instance.CreateStack(Material.WOOL, _color));
|
||||
}
|
||||
//Countdown
|
||||
else if (_state == 1)
|
||||
|
@ -1,17 +1,18 @@
|
||||
package nautilus.game.arcade.game.games.christmas.content;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilWorld;
|
||||
import nautilus.game.arcade.game.games.christmas.Christmas;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import nautilus.game.arcade.game.games.christmas.Christmas;
|
||||
|
||||
public class IceMaze
|
||||
{
|
||||
private Christmas Host;
|
||||
@ -22,6 +23,18 @@ public class IceMaze
|
||||
|
||||
private Location _present;
|
||||
|
||||
private Comparator<Block> _heightComparator = new Comparator<Block>()
|
||||
{
|
||||
@Override
|
||||
public int compare(Block o1, Block o2)
|
||||
{
|
||||
if (o1.getLocation().getBlockY() == o2.getLocation().getBlockY())
|
||||
return 0;
|
||||
|
||||
return o1.getLocation().getBlockY() > o2.getLocation().getBlockY() ? 1 : -1;
|
||||
}
|
||||
};
|
||||
|
||||
public IceMaze(Christmas host, ArrayList<Location> mazeCorners, ArrayList<Location> mazeExits, Location[] presents)
|
||||
{
|
||||
Host = host;
|
||||
@ -71,6 +84,8 @@ public class IceMaze
|
||||
if (_blocks.isEmpty())
|
||||
return;
|
||||
|
||||
Collections.sort(_blocks, _heightComparator);
|
||||
|
||||
for (int i=0 ; i<20 ; i++)
|
||||
{
|
||||
if (_blocks.isEmpty())
|
||||
|
@ -1,17 +1,15 @@
|
||||
package nautilus.game.arcade.game.games.christmas.content;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftCreature;
|
||||
import org.bukkit.entity.Creature;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.IronGolem;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.IronGolem;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Slime;
|
||||
import org.bukkit.entity.Snowball;
|
||||
import org.bukkit.entity.Snowman;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
@ -147,7 +145,17 @@ public class SnowmanBoss
|
||||
else
|
||||
{
|
||||
if ((minion.Target == null || !minion.Target.isValid() || !Host.IsAlive(minion.Target)) && !Host.GetPlayers(true).isEmpty())
|
||||
minion.Target = UtilAlg.Random(Host.GetPlayers(true));
|
||||
{
|
||||
List<Player> valid = new ArrayList<Player>();
|
||||
for (Player player : Host.GetPlayers(true))
|
||||
if (UtilMath.offset(player, minion.Ent) <= 25 && player.getLocation().getBlockY() >= minion.Ent.getLocation().getBlockY())
|
||||
valid.add(player);
|
||||
|
||||
minion.Target = UtilAlg.Random(valid);
|
||||
}
|
||||
|
||||
if (minion.Target == null)
|
||||
continue;
|
||||
|
||||
//Move
|
||||
UtilEnt.CreatureMoveFast(minion.Ent, minion.Target.getLocation(), 1.6f);
|
||||
|
@ -6,17 +6,6 @@ import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.common.util.UtilWorld;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import nautilus.game.arcade.game.games.christmas.Christmas;
|
||||
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
@ -28,6 +17,16 @@ import org.bukkit.entity.Snowman;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import nautilus.game.arcade.game.games.christmas.Christmas;
|
||||
import nautilus.game.arcade.game.games.christmas.content.SnowmanWaypoint.CardinalDirection;
|
||||
|
||||
public class SnowmanMaze
|
||||
{
|
||||
private Christmas Host;
|
||||
@ -163,48 +162,90 @@ public class SnowmanMaze
|
||||
if (south != null) nextBlock.add(south);
|
||||
if (east != null) nextBlock.add(east);
|
||||
if (west != null) nextBlock.add(west);
|
||||
|
||||
//Random Direction
|
||||
if (!nextBlock.isEmpty())
|
||||
|
||||
if(nextBlock.isEmpty())
|
||||
{
|
||||
data.getValue().Target = UtilAlg.Random(nextBlock).getLocation().add(0.5, 0, 0.5);
|
||||
UtilEnt.CreatureMove(data.getKey(), data.getValue().Target, 1.4f);
|
||||
entIterator.remove();
|
||||
data.getKey().remove();
|
||||
continue;
|
||||
}
|
||||
|
||||
if(nextBlock.size() > 1 && data.getValue().Direction != CardinalDirection.NULL) // they can do a uturn if they're stuck
|
||||
{
|
||||
if(data.getValue().Direction == CardinalDirection.NORTH)
|
||||
{
|
||||
nextBlock.remove(south);
|
||||
}
|
||||
else if(data.getValue().Direction == CardinalDirection.SOUTH)
|
||||
{
|
||||
nextBlock.remove(north);
|
||||
}
|
||||
else if(data.getValue().Direction == CardinalDirection.WEST)
|
||||
{
|
||||
nextBlock.remove(east);
|
||||
}
|
||||
else if(data.getValue().Direction == CardinalDirection.EAST)
|
||||
{
|
||||
nextBlock.remove(west);
|
||||
}
|
||||
}
|
||||
|
||||
if (nextBlock.isEmpty())
|
||||
{
|
||||
entIterator.remove();
|
||||
data.getKey().remove();
|
||||
continue;
|
||||
}
|
||||
|
||||
//Random Direction
|
||||
Location nextLoc = UtilAlg.Random(nextBlock).getLocation();
|
||||
data.getValue().Target = nextLoc.clone().add(0.5, 0, 0.5);
|
||||
if(north != null && nextLoc.equals(north.getLocation()))
|
||||
{
|
||||
data.getValue().Direction = CardinalDirection.NORTH;
|
||||
}
|
||||
else if(south != null && nextLoc.equals(south.getLocation()))
|
||||
{
|
||||
data.getValue().Direction = CardinalDirection.SOUTH;
|
||||
}
|
||||
else if(east != null && nextLoc.equals(east.getLocation()))
|
||||
{
|
||||
data.getValue().Direction = CardinalDirection.EAST;
|
||||
}
|
||||
else if(west != null && nextLoc.equals(west.getLocation()))
|
||||
{
|
||||
data.getValue().Direction = CardinalDirection.WEST;
|
||||
}
|
||||
}
|
||||
|
||||
//Timeout Move
|
||||
if (UtilMath.offset(data.getKey().getLocation(), data.getValue().Last) > 0.1)
|
||||
data.getValue().Time = System.currentTimeMillis();
|
||||
|
||||
if (UtilTime.elapsed(data.getValue().Time, 2000))
|
||||
UtilEnt.CreatureMove(data.getKey(), data.getValue().Target, 1.4f);
|
||||
|
||||
UtilEnt.CreatureMoveFast(data.getKey(), data.getValue().Target, 1.4f);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private Block getTarget(Block start, Block cur, BlockFace face)
|
||||
{
|
||||
if (cur == null)
|
||||
cur = start;
|
||||
|
||||
|
||||
while (_waypoints.contains(cur.getRelative(face)))
|
||||
{
|
||||
cur = cur.getRelative(face);
|
||||
|
||||
|
||||
//Stop at intersection
|
||||
int count = 0;
|
||||
|
||||
if (face != BlockFace.NORTH && _waypoints.contains(cur.getRelative(BlockFace.NORTH))) count++;
|
||||
if (face != BlockFace.SOUTH && _waypoints.contains(cur.getRelative(BlockFace.SOUTH))) count++;
|
||||
if (face != BlockFace.EAST && _waypoints.contains(cur.getRelative(BlockFace.EAST))) count++;
|
||||
if (face != BlockFace.WEST && _waypoints.contains(cur.getRelative(BlockFace.WEST))) count++;
|
||||
|
||||
|
||||
if (face != BlockFace.NORTH && _waypoints.contains(cur.getRelative(BlockFace.NORTH)) && !_waypoints.contains(cur.getRelative(BlockFace.NORTH))) count++;
|
||||
if (face != BlockFace.SOUTH && _waypoints.contains(cur.getRelative(BlockFace.SOUTH)) && !_waypoints.contains(cur.getRelative(BlockFace.SOUTH))) count++;
|
||||
if (face != BlockFace.EAST && _waypoints.contains(cur.getRelative(BlockFace.EAST)) && !_waypoints.contains(cur.getRelative(BlockFace.EAST))) count++;
|
||||
if (face != BlockFace.WEST && _waypoints.contains(cur.getRelative(BlockFace.WEST)) && !_waypoints.contains(cur.getRelative(BlockFace.WEST))) count++;
|
||||
|
||||
if (count > 1)
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (cur.equals(start))
|
||||
return null;
|
||||
|
||||
|
||||
return cur;
|
||||
}
|
||||
|
||||
|
@ -6,6 +6,7 @@ public class SnowmanWaypoint
|
||||
{
|
||||
public Location Last;
|
||||
public Location Target;
|
||||
public CardinalDirection Direction = CardinalDirection.NULL;
|
||||
public long Time;
|
||||
|
||||
public SnowmanWaypoint(Location last)
|
||||
@ -14,4 +15,9 @@ public class SnowmanWaypoint
|
||||
Target = null;
|
||||
Time = System.currentTimeMillis();
|
||||
}
|
||||
|
||||
public static enum CardinalDirection
|
||||
{
|
||||
NORTH, SOUTH, EAST, WEST, NULL // such order much not care
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,15 @@
|
||||
package nautilus.game.arcade.game.games.christmas.kits;
|
||||
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.enchantments.Enchantment;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import nautilus.game.arcade.ArcadeManager;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
@ -21,15 +24,23 @@ public class KitPlayer extends Kit
|
||||
|
||||
new String[]
|
||||
{
|
||||
"Help Santa retreive the lost presents!"
|
||||
"Help Santa retrieve the lost presents!"
|
||||
},
|
||||
|
||||
new Perk[]
|
||||
{
|
||||
},
|
||||
EntityType.ZOMBIE,
|
||||
EntityType.SKELETON,
|
||||
new ItemStack(Material.IRON_SWORD));
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void SpawnCustom(LivingEntity ent)
|
||||
{
|
||||
ent.getEquipment().setHelmet(new ItemBuilder(Material.LEATHER_HELMET).setColor(Color.RED).setUnbreakable(true).build());
|
||||
ent.getEquipment().setChestplate(new ItemBuilder(Material.LEATHER_CHESTPLATE).setColor(Color.RED).build());
|
||||
ent.getEquipment().setLeggings(new ItemBuilder(Material.LEATHER_LEGGINGS).setColor(Color.RED).build());
|
||||
ent.getEquipment().setBoots(new ItemBuilder(Material.LEATHER_BOOTS).setColor(Color.BLACK).build());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -43,7 +54,7 @@ public class KitPlayer extends Kit
|
||||
item = ItemStackFactory.Instance.CreateStack(Material.BOW, (byte)0, 1, C.cGreen + C.Bold + "Toy Bow");
|
||||
item.addEnchantment(Enchantment.ARROW_INFINITE, 1);
|
||||
player.getInventory().setItem(1, item);
|
||||
player.getInventory().setItem(28, ItemStackFactory.Instance.CreateStack(Material.ARROW));
|
||||
player.getInventory().setItem(9, ItemStackFactory.Instance.CreateStack(Material.ARROW));
|
||||
|
||||
//Axe
|
||||
item = ItemStackFactory.Instance.CreateStack(Material.STONE_PICKAXE, (byte)0, 1, C.cGreen + C.Bold + "Coal Digger");
|
||||
|
@ -1,35 +1,42 @@
|
||||
package nautilus.game.arcade.game.games.christmas.parts;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftCreature;
|
||||
import org.bukkit.entity.Ageable;
|
||||
import org.bukkit.entity.ArmorStand;
|
||||
import org.bukkit.entity.Creature;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.player.PlayerInteractAtEntityEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.SkullMeta;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTextTop;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.game.games.christmas.Christmas;
|
||||
import nautilus.game.arcade.game.games.christmas.ChristmasAudio;
|
||||
import net.minecraft.server.v1_8_R3.EntityCreature;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.SkullType;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.Skull;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftCreature;
|
||||
import org.bukkit.entity.Ageable;
|
||||
import org.bukkit.entity.Creature;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
|
||||
public abstract class Part implements Listener
|
||||
{
|
||||
public Christmas Host;
|
||||
@ -42,6 +49,7 @@ public abstract class Part implements Listener
|
||||
protected double _objectiveHealth = 1;
|
||||
|
||||
protected HashMap<Creature, Player> _creatures = new HashMap<Creature, Player>();
|
||||
protected NautHashMap<Entity, Location> _spawnedPresents = new NautHashMap<Entity, Location>();
|
||||
|
||||
public Part(Christmas host, Location sleigh, Location[] presents)
|
||||
{
|
||||
@ -53,38 +61,63 @@ public abstract class Part implements Listener
|
||||
loc.getBlock().setType(Material.AIR);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
public void Prepare()
|
||||
{
|
||||
Activate();
|
||||
|
||||
for (Location loc : _presents)
|
||||
{
|
||||
Block present = loc.getBlock();
|
||||
present.setTypeIdAndData(Material.SKULL.getId(), (byte)1, true);
|
||||
|
||||
Skull skull = (Skull) present.getState();
|
||||
skull.setSkullType(SkullType.PLAYER);
|
||||
{
|
||||
Location standLoc = loc.clone().add(0, -1.45, 0);
|
||||
standLoc.setYaw(UtilMath.r(100));
|
||||
|
||||
//Present Type
|
||||
double r = Math.random();
|
||||
if (r > 0.75) skull.setOwner("CruXXx");
|
||||
else if (r > 0.5) skull.setOwner("CruXXx");
|
||||
else if (r > 0.25) skull.setOwner("CruXXx");
|
||||
else skull.setOwner("CruXXx");
|
||||
Host.CreatureAllowOverride = true;
|
||||
ArmorStand stand = loc.getWorld().spawn(standLoc, ArmorStand.class);
|
||||
Host.CreatureAllowOverride = false;
|
||||
|
||||
//Angle
|
||||
BlockFace face = BlockFace.UP;
|
||||
while (face == BlockFace.UP || face == BlockFace.DOWN || face == BlockFace.SELF)
|
||||
face = BlockFace.values()[UtilMath.r(BlockFace.values().length)];
|
||||
skull.setRotation(face);
|
||||
|
||||
skull.update();
|
||||
stand.setVisible(false);
|
||||
stand.setGravity(false);
|
||||
|
||||
ItemStack stack = ItemStackFactory.Instance.CreateStack(Material.SKULL_ITEM, (byte) 3);
|
||||
SkullMeta meta = (SkullMeta) stack.getItemMeta();
|
||||
meta.setOwner("CruXXx");
|
||||
stack.setItemMeta(meta);
|
||||
|
||||
stand.setHelmet(stack);
|
||||
//
|
||||
// present.setTypeIdAndData(Material.SKULL.getId(), (byte)1, true);
|
||||
//
|
||||
// Skull skull = (Skull) present.getState();
|
||||
// skull.setSkullType(SkullType.PLAYER);
|
||||
//
|
||||
// //Present Type
|
||||
// double r = Math.random();
|
||||
// if (r > 0.75) skull.setOwner("CruXXx");
|
||||
// else if (r > 0.5) skull.setOwner("CruXXx");
|
||||
// else if (r > 0.25) skull.setOwner("CruXXx");
|
||||
// else skull.setOwner("CruXXx");
|
||||
//
|
||||
// //Angle
|
||||
// BlockFace face = BlockFace.UP;
|
||||
// while (face == BlockFace.UP || face == BlockFace.DOWN || face == BlockFace.SELF)
|
||||
// face = BlockFace.values()[UtilMath.r(BlockFace.values().length)];
|
||||
// skull.setRotation(face);
|
||||
//
|
||||
// skull.update();
|
||||
|
||||
_spawnedPresents.put(stand, loc);
|
||||
|
||||
//Beacon
|
||||
present.getRelative(BlockFace.DOWN).setType(Material.BEACON);
|
||||
for (int x=-1 ; x<=1 ; x++)
|
||||
for (int z=-1 ; z<=1 ; z++)
|
||||
present.getRelative(x, -2, z).setType(Material.IRON_BLOCK);
|
||||
{
|
||||
loc.getBlock().getRelative(x, -2, z).setType(Material.IRON_BLOCK);
|
||||
loc.getBlock().getRelative(x, -3, z).setType(Material.IRON_BLOCK);
|
||||
}
|
||||
|
||||
loc.getBlock().getRelative(BlockFace.DOWN).getRelative(BlockFace.DOWN).setType(Material.BEACON);
|
||||
loc.getBlock().getRelative(BlockFace.DOWN).setType(Material.STAINED_GLASS);
|
||||
loc.getBlock().getRelative(BlockFace.DOWN).setData(UtilMath.randomElement(new Byte[]{14, 5, 13}));
|
||||
}
|
||||
|
||||
}
|
||||
@ -157,35 +190,38 @@ public abstract class Part implements Listener
|
||||
return true;
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void PresentCollect(PlayerInteractEvent event)
|
||||
@EventHandler(priority = EventPriority.LOW, ignoreCancelled = false)
|
||||
public void PresentCollect(PlayerInteractAtEntityEvent event)
|
||||
{
|
||||
if (event.getClickedBlock() == null)
|
||||
Location present = _spawnedPresents.get(event.getRightClicked());
|
||||
if (present == null)
|
||||
return;
|
||||
|
||||
|
||||
boolean contains = false;
|
||||
for (Location loc : _presents)
|
||||
if (loc.getBlock().equals(event.getClickedBlock()))
|
||||
if (loc.getBlock().equals(present.getBlock()))
|
||||
contains = true;
|
||||
|
||||
if (!contains)
|
||||
return;
|
||||
|
||||
event.setCancelled(true);
|
||||
|
||||
if (!Host.IsLive())
|
||||
return;
|
||||
|
||||
if (!Host.IsAlive(event.getPlayer()))
|
||||
return;
|
||||
|
||||
if (Host.GetSleigh().HasPresent(event.getClickedBlock().getLocation()))
|
||||
if (Host.GetSleigh().HasPresent(present.getBlock().getLocation()))
|
||||
return;
|
||||
|
||||
if (UtilMath.offset(event.getPlayer().getLocation(), event.getClickedBlock().getLocation().add(0.5, 0.5, 0.5)) > 2)
|
||||
if (UtilMath.offset(event.getPlayer().getLocation(), present.clone().add(0.5, 0.5, 0.5)) > 2)
|
||||
return;
|
||||
|
||||
Host.GetSleigh().AddPresent(event.getClickedBlock().getLocation());
|
||||
_spawnedPresents.remove(event.getRightClicked());
|
||||
|
||||
event.getRightClicked().remove();
|
||||
|
||||
Host.GetSleigh().AddPresent(present.getBlock().getLocation());
|
||||
|
||||
Host.SantaSay("Well done " + event.getPlayer().getName() + "! You collected a present!", null);
|
||||
}
|
||||
@ -276,4 +312,21 @@ public abstract class Part implements Listener
|
||||
_creatures.clear();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onDamagePresent(EntityDamageEvent event)
|
||||
{
|
||||
event.setCancelled(_spawnedPresents.containsKey(event.getEntity()));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void PresentParticles(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.FAST)
|
||||
return;
|
||||
|
||||
for (Entity ent : _spawnedPresents.keySet())
|
||||
{
|
||||
UtilParticle.PlayParticle(ParticleType.HAPPY_VILLAGER, ent.getLocation().clone().add(0, 1.5, 0), .3F, .3F, .3F, 0F, 1, ViewDist.LONG, UtilServer.getPlayers());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,41 +1,33 @@
|
||||
package nautilus.game.arcade.game.games.christmas.parts;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.game.Game.GameState;
|
||||
import nautilus.game.arcade.game.games.christmas.Christmas;
|
||||
import nautilus.game.arcade.game.games.christmas.ChristmasAudio;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Skeleton;
|
||||
import org.bukkit.entity.TNTPrimed;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||
import org.bukkit.event.entity.ExplosionPrimeEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilParticle;
|
||||
import mineplex.core.common.util.UtilParticle.ParticleType;
|
||||
import mineplex.core.common.util.UtilParticle.ViewDist;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.game.games.christmas.Christmas;
|
||||
import nautilus.game.arcade.game.games.christmas.ChristmasAudio;
|
||||
|
||||
public class Part1 extends Part
|
||||
{
|
||||
private ArrayList<Location> _skeletons;
|
||||
@ -145,7 +137,7 @@ public class Part1 extends Part
|
||||
|
||||
_presents = System.currentTimeMillis();
|
||||
|
||||
Host.SantaSay("Theres some of the presents up ahead!", ChristmasAudio.P1_B);
|
||||
Host.SantaSay("There are some of the presents up ahead!", ChristmasAudio.P1_B);
|
||||
SetObjectivePresents();
|
||||
}
|
||||
|
||||
@ -189,7 +181,7 @@ public class Part1 extends Part
|
||||
}
|
||||
|
||||
Host.SantaSay("Clear the path! Watch out for the undead!", ChristmasAudio.P1_D);
|
||||
SetObjectiveText("Clear a path for Santas Sleigh!", 1);
|
||||
SetObjectiveText("Clear a path for Santa's Sleigh!", 1);
|
||||
}
|
||||
|
||||
private void UpdateClear()
|
||||
|
@ -3,10 +3,22 @@ package nautilus.game.arcade.game.games.christmas.parts;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.FallingBlock;
|
||||
import org.bukkit.entity.Giant;
|
||||
import org.bukkit.entity.Zombie;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.entity.EntityChangeBlockEvent;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilPlayer;
|
||||
import mineplex.core.hologram.Hologram;
|
||||
import mineplex.core.hologram.HologramManager;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
@ -17,24 +29,6 @@ import nautilus.game.arcade.game.games.christmas.ChristmasAudio;
|
||||
import nautilus.game.arcade.game.games.christmas.content.CaveGiant;
|
||||
import nautilus.game.arcade.game.games.christmas.content.Snake;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.entity.FallingBlock;
|
||||
import org.bukkit.entity.Giant;
|
||||
import org.bukkit.entity.Spider;
|
||||
import org.bukkit.entity.Zombie;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.entity.EntityChangeBlockEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
||||
public class Part4 extends Part
|
||||
{
|
||||
private ArrayList<Location> _roofIce;
|
||||
@ -51,6 +45,13 @@ public class Part4 extends Part
|
||||
private boolean _b = false;
|
||||
private HologramManager _holoManager;
|
||||
|
||||
private String[] _evilElfNames = new String[]
|
||||
{ "Bing", "Bling", "Blitz", "Larry", "Buddy", "Buster", "Cedar", "Dash", "Eggnog", "Elfie", "Elm", "Elvis",
|
||||
"Evergreen", "Figgy", "Flake", "Frank", "Frost", "Gabriel", "George", "Henry", "Hermey", "Ice", "Jangle",
|
||||
"Jingle", "Jinx", "Kringle", "Kris", "Louie", "Max", "Mistletoe", "Nat", "Nick", "Noel", "Pax", "Peppermin",
|
||||
"Pine", "Ralphie", "Rudy", "Snow", "Snowball", "Star", "Tinsel", "Tiny", "Topper", "Trinket", "Wayne",
|
||||
"Wink", "Yule", "Zippy" };
|
||||
|
||||
public Part4(HologramManager holoManager, Christmas host, Location sleigh, Location[] presents, ArrayList<Location> roofIce, ArrayList<Location> mobs,
|
||||
ArrayList<Location> snakeHead, ArrayList<Location> snakeTrail, ArrayList<Location> gate, ArrayList<Location> checkpoints, Location giant)
|
||||
{
|
||||
@ -85,7 +86,7 @@ public class Part4 extends Part
|
||||
@EventHandler
|
||||
public void GateUpdate(UpdateEvent event)
|
||||
{
|
||||
if (event.getType() != UpdateType.SEC)
|
||||
if (event.getType() != UpdateType.FAST)
|
||||
return;
|
||||
|
||||
if (_gate.isEmpty())
|
||||
@ -187,6 +188,8 @@ public class Part4 extends Part
|
||||
ent.getEquipment().setLeggings(new ItemStack(Material.LEATHER_LEGGINGS));
|
||||
ent.getEquipment().setBoots(new ItemStack(Material.LEATHER_BOOTS));
|
||||
ent.setVillager(true);
|
||||
|
||||
ent.setCustomName("Evil Elf " + UtilMath.randomElement(_evilElfNames));
|
||||
|
||||
ent.setHealth(9);
|
||||
|
||||
|
@ -2,41 +2,37 @@ package nautilus.game.arcade.game.games.christmas.parts;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.game.games.christmas.Christmas;
|
||||
import nautilus.game.arcade.game.games.christmas.ChristmasAudio;
|
||||
import nautilus.game.arcade.game.games.christmas.content.*;
|
||||
import net.minecraft.server.v1_8_R3.EntityCreature;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.EntityEffect;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftCreature;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Snowman;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
import org.bukkit.event.HandlerList;
|
||||
import org.bukkit.event.block.BlockBurnEvent;
|
||||
import org.bukkit.event.block.BlockIgniteEvent;
|
||||
import org.bukkit.event.entity.EntityCombustEvent;
|
||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
|
||||
import nautilus.game.arcade.game.games.christmas.Christmas;
|
||||
import nautilus.game.arcade.game.games.christmas.ChristmasAudio;
|
||||
import nautilus.game.arcade.game.games.christmas.content.BossFloor;
|
||||
import nautilus.game.arcade.game.games.christmas.content.BossMobs;
|
||||
import nautilus.game.arcade.game.games.christmas.content.BossSnowmanPattern;
|
||||
import nautilus.game.arcade.game.games.christmas.content.PumpkinKing;
|
||||
|
||||
public class Part5 extends Part
|
||||
{
|
||||
private ArrayList<Location> _spawn;
|
||||
@ -385,6 +381,9 @@ public class Part5 extends Part
|
||||
@EventHandler
|
||||
public void Damage(CustomDamageEvent event)
|
||||
{
|
||||
if (event.isCancelled())
|
||||
return;
|
||||
|
||||
if (_boss == null)
|
||||
return;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user