More setup getting CC to work

This commit is contained in:
Sam 2017-11-07 20:24:56 +00:00 committed by Alexander Meech
parent 570033e3c9
commit a40625825d
10 changed files with 424 additions and 184 deletions

View File

@ -1150,11 +1150,21 @@ public class UtilPlayer
public static void playCustomSound(CustomSound sound) public static void playCustomSound(CustomSound sound)
{ {
if (sound == null)
{
return;
}
UtilServer.getPlayersCollection().forEach(player -> playCustomSound(player, sound)); UtilServer.getPlayersCollection().forEach(player -> playCustomSound(player, sound));
} }
public static void playCustomSound(Player player, CustomSound sound) public static void playCustomSound(Player player, CustomSound sound)
{ {
if (player == null || sound == null)
{
return;
}
Packet packet; Packet packet;
int protocol = ((CraftPlayer) player).getHandle().getProtocol(); int protocol = ((CraftPlayer) player).getHandle().getProtocol();
Location location = player.getLocation(); Location location = player.getLocation();

View File

@ -34,6 +34,7 @@ import nautilus.game.arcade.game.games.champions.ChampionsDominate;
import nautilus.game.arcade.game.games.champions.ChampionsTDM; import nautilus.game.arcade.game.games.champions.ChampionsTDM;
import nautilus.game.arcade.game.games.champions.modes.SmashDom; import nautilus.game.arcade.game.games.champions.modes.SmashDom;
import nautilus.game.arcade.game.games.christmas.Christmas; import nautilus.game.arcade.game.games.christmas.Christmas;
import nautilus.game.arcade.game.games.christmasnew.ChristmasNew;
import nautilus.game.arcade.game.games.deathtag.DeathTag; import nautilus.game.arcade.game.games.deathtag.DeathTag;
import nautilus.game.arcade.game.games.dragonescape.DragonEscape; import nautilus.game.arcade.game.games.dragonescape.DragonEscape;
import nautilus.game.arcade.game.games.dragonescape.DragonEscapeTeams; import nautilus.game.arcade.game.games.dragonescape.DragonEscapeTeams;
@ -147,6 +148,7 @@ public enum GameType
{ {
Pair.create(MinecraftVersion.ALL, "http://file.mineplex.com/ResChristmas.zip") Pair.create(MinecraftVersion.ALL, "http://file.mineplex.com/ResChristmas.zip")
}, true), }, true),
ChristmasNew(ChristmasNew.class, GameDisplay.ChristmasNew),
DeathTag(DeathTag.class, GameDisplay.DeathTag), DeathTag(DeathTag.class, GameDisplay.DeathTag),
DragonEscape(DragonEscape.class, GameDisplay.DragonEscape), DragonEscape(DragonEscape.class, GameDisplay.DragonEscape),
DragonEscapeTeams(DragonEscapeTeams.class, GameDisplay.DragonEscapeTeams), DragonEscapeTeams(DragonEscapeTeams.class, GameDisplay.DragonEscapeTeams),

View File

@ -43,7 +43,6 @@ import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GamePrepareCountdownCommence; import nautilus.game.arcade.events.GamePrepareCountdownCommence;
import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.GameTeam; 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.kits.KitPlayer;
import nautilus.game.arcade.game.games.christmas.parts.Part; 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.Part1;
@ -58,7 +57,7 @@ import net.minecraft.server.v1_8_R3.PacketPlayOutEntityDestroy;
import net.minecraft.server.v1_8_R3.PacketPlayOutNamedSoundEffect; import net.minecraft.server.v1_8_R3.PacketPlayOutNamedSoundEffect;
import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving; import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving;
public class Christmas extends SoloGame public class Christmas extends ChristmasCommon
{ {
private GameTeam _badGuys; private GameTeam _badGuys;
@ -377,7 +376,7 @@ public class Christmas extends SoloGame
} }
@EventHandler @EventHandler
public void BarrierDecay(UpdateEvent event) public void barrierDecay(UpdateEvent event)
{ {
if (!IsLive()) if (!IsLive())
return; return;
@ -596,7 +595,7 @@ public class Christmas extends SoloGame
public void DamageCancel(CustomDamageEvent event) public void DamageCancel(CustomDamageEvent event)
{ {
if (_sleigh != null) if (_sleigh != null)
GetSleigh().Damage(event); GetSleigh().onDamage(event);
if (event.GetCause() == DamageCause.FALL) if (event.GetCause() == DamageCause.FALL)
if (event.GetDamageeEntity().getLocation().getY() > 30) if (event.GetDamageeEntity().getLocation().getY() > 30)
@ -661,7 +660,7 @@ public class Christmas extends SoloGame
//Presents //Presents
Scoreboard.writeNewLine(); Scoreboard.writeNewLine();
Scoreboard.write(C.cGreenB + "Presents"); Scoreboard.write(C.cGreenB + "Presents");
Scoreboard.write(C.cWhite + GetSleigh().GetPresents().size() + " of " + 10); Scoreboard.write(C.cWhite + GetSleigh().getPresents().size() + " of " + 10);
//Players //Players
Scoreboard.writeNewLine(); Scoreboard.writeNewLine();

View File

@ -4,30 +4,53 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import net.minecraft.server.v1_8_R3.Entity;
import net.minecraft.server.v1_8_R3.PacketPlayOutAttachEntity;
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityDestroy; import net.minecraft.server.v1_8_R3.PacketPlayOutEntityDestroy;
import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving; import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
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.Player;
import org.bukkit.entity.Villager;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.block.BlockFadeEvent;
import org.bukkit.event.entity.EntityCombustEvent;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.event.entity.ItemSpawnEvent;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.MapUtil;
import mineplex.core.common.util.UtilAlg;
import mineplex.core.common.util.UtilBlock;
import mineplex.core.common.util.UtilMath;
import mineplex.core.common.util.UtilPlayer;
import mineplex.core.common.util.UtilServer;
import mineplex.core.packethandler.IPacketHandler; import mineplex.core.packethandler.IPacketHandler;
import mineplex.core.packethandler.PacketInfo; import mineplex.core.packethandler.PacketInfo;
import mineplex.core.updater.UpdateType;
import mineplex.core.updater.event.UpdateEvent;
import mineplex.minecraft.game.core.damage.CustomDamageEvent;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType; import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.GameTeam;
import nautilus.game.arcade.game.TeamGame; import nautilus.game.arcade.game.SoloGame;
import nautilus.game.arcade.game.games.christmasnew.ChristmasNewAudio;
import nautilus.game.arcade.game.modules.compass.CompassModule; import nautilus.game.arcade.game.modules.compass.CompassModule;
import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.Kit;
public class ChristmasCommon extends TeamGame public class ChristmasCommon extends SoloGame
{ {
private static final int BARRIER_BREAK_SQUARED = 400;
private GameTeam _badGuys; private GameTeam _badGuys;
private List<Location> _barrier = new ArrayList<>(); private List<Location> _barrier = new ArrayList<>();
@ -108,6 +131,15 @@ public class ChristmasCommon extends TeamGame
.register(this); .register(this);
} }
@Override
public void ParseData()
{
_barrier = WorldData.GetCustomLocs(String.valueOf(Material.EMERALD_ORE.getId()));
_barrier.forEach(location -> MapUtil.QuickChangeBlockAt(location, Material.BARRIER));
_sleighSpawn = WorldData.GetDataLocs("RED").get(0);
}
@EventHandler(priority = EventPriority.HIGHEST) @EventHandler(priority = EventPriority.HIGHEST)
public void generateTeams(GameStateChangeEvent event) public void generateTeams(GameStateChangeEvent event)
{ {
@ -120,13 +152,169 @@ public class ChristmasCommon extends TeamGame
AddTeam(_badGuys); AddTeam(_badGuys);
} }
public void sendSantaMessage(String message) @EventHandler
public void sleighSpawn(GameStateChangeEvent event)
{ {
GetPlayers(true).forEach(player -> sendSantaMessage(player, message)); if (event.GetState() != GameState.Prepare)
{
return;
}
List<Location> elfSpawns = getPlayersTeam().GetSpawns();
Manager.runSyncLater(() ->
{
Manager.getPacketHandler().addPacketHandler(
_reindeerPackets,
PacketPlayOutEntityDestroy.class,
PacketPlayOutSpawnEntityLiving.class);
getSleigh();
CreatureAllowOverride = true;
for (Location location : elfSpawns)
{
Villager elf = location.getWorld().spawn(UtilAlg.getRandomLocation(location, 2, 0, 2), Villager.class);
elf.setBaby();
elf.setAgeLock(true);
elf.setCustomName("Elf");
elf.setCustomNameVisible(true);
}
CreatureAllowOverride = false;
}, GetPlayers(true).size() * TickPerTeleport + 10);
} }
public void sendSantaMessage(Player player, String message) @EventHandler
public void sleighUpdate(UpdateEvent event)
{ {
if (event.getType() != UpdateType.TICK || _sleigh == null)
{
return;
}
for (SleighHorse horse : _sleigh.getHorses())
{
horse.onTick();
}
if (!IsLive())
{
return;
}
getSleigh().Update();
}
@EventHandler(priority = EventPriority.LOWEST)
public void damageCancel(CustomDamageEvent event)
{
if (_sleigh != null)
{
_sleigh.onDamage(event);
}
if (event.GetCause() == DamageCause.FALL)
{
event.SetCancelled("Fall Damage");
}
}
@EventHandler
public void updateReigns(UpdateEvent event)
{
if (event.getType() != UpdateType.FASTER || !InProgress() || _sleigh == null || _sleigh.getSanta() == null)
{
return;
}
Entity santa = ((CraftEntity) _sleigh.getSanta()).getHandle();
for (SleighHorse horse : _sleigh.getHorses())
{
if (horse.Ent == null || !horse.Ent.isValid())
{
continue;
}
PacketPlayOutAttachEntity packet = new PacketPlayOutAttachEntity(1, ((CraftHorse) horse.Ent).getHandle(), santa);
for (Player player : UtilServer.getPlayersCollection())
{
UtilPlayer.sendPacket(player, packet);
}
}
}
@EventHandler
public void barrierDecay(UpdateEvent event)
{
if (event.getType() != UpdateType.SEC || !IsLive())
{
return;
}
Location breakAt = null;
for (Location loc : _barrier)
{
if (UtilMath.offsetSquared(getSleigh().GetLocation(), loc) > BARRIER_BREAK_SQUARED)
{
continue;
}
breakAt = loc;
}
if (breakAt != null)
{
_barrier.remove(breakAt);
barrierBreak(breakAt);
}
}
private void barrierBreak(Location location)
{
MapUtil.QuickChangeBlockAt(location, Material.AIR);
for (Block block : UtilBlock.getSurrounding(location.getBlock(), false))
{
if (_barrier.remove(block.getLocation()))
{
barrierBreak(block.getLocation());
}
}
}
@EventHandler
public void combust(EntityCombustEvent event)
{
event.setCancelled(true);
}
@EventHandler
public void itemSpawn(ItemSpawnEvent event)
{
event.setCancelled(true);
}
@EventHandler
public void blockFade(BlockFadeEvent event)
{
event.setCancelled(true);
}
public void sendSantaMessage(String message, ChristmasNewAudio audio)
{
GetPlayers(true).forEach(player -> sendSantaMessage(player, message, audio));
}
public void sendSantaMessage(Player player, String message, ChristmasNewAudio audio)
{
UtilPlayer.playCustomSound(player, audio);
player.sendMessage(getSantaMessage(message)); player.sendMessage(getSantaMessage(message));
} }

View File

@ -75,7 +75,7 @@ public class Sleigh
PresentSlots.add(new SleighPart(this, 6, 0, 0, loc.clone(), 1, -1)); PresentSlots.add(new SleighPart(this, 6, 0, 0, loc.clone(), 1, -1));
//Sleigh //Sleigh
SleighEnts = new ArrayList<SleighPart>(); SleighEnts = new ArrayList<>();
SleighEnts.addAll(PresentSlots); SleighEnts.addAll(PresentSlots);

View File

@ -3,6 +3,17 @@ package nautilus.game.arcade.game.games.christmas;
import java.util.HashSet; import java.util.HashSet;
import java.util.UUID; import java.util.UUID;
import net.minecraft.server.v1_8_R3.DataWatcher;
import net.minecraft.server.v1_8_R3.Entity;
import net.minecraft.server.v1_8_R3.EntityArmorStand;
import net.minecraft.server.v1_8_R3.EntityPlayer;
import net.minecraft.server.v1_8_R3.EntityTrackerEntry;
import net.minecraft.server.v1_8_R3.Packet;
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityEquipment;
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.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld; import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
@ -18,180 +29,169 @@ import org.bukkit.util.Vector;
import mineplex.core.common.util.C; import mineplex.core.common.util.C;
import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilPlayer;
import net.minecraft.server.v1_8_R3.DataWatcher;
import net.minecraft.server.v1_8_R3.Entity;
import net.minecraft.server.v1_8_R3.EntityArmorStand;
import net.minecraft.server.v1_8_R3.EntityPlayer;
import net.minecraft.server.v1_8_R3.EntityTrackerEntry;
import net.minecraft.server.v1_8_R3.Packet;
import net.minecraft.server.v1_8_R3.PacketPlayOutEntity;
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityEquipment;
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityTeleport;
import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving;
import net.minecraft.server.v1_8_R3.Vector3f;
public class SleighHorse public class SleighHorse
{ {
private Location _lastFacing; private Location _lastFacing;
private Vector _lastMovement = new Vector(); private Vector _lastMovement = new Vector();
private int[] _previousDir = new int[4]; private int[] _previousDir = new int[4];
public Horse Ent; public Horse Ent;
public int[] hornsAndNose = new int[] public int[] hornsAndNose = new int[]
{ {
UtilEnt.getNewEntityId(), UtilEnt.getNewEntityId() UtilEnt.getNewEntityId(), UtilEnt.getNewEntityId()
}; };
public int horseId; public int horseId;
public double OffsetX; public double OffsetX;
public double OffsetZ; public double OffsetZ;
public String Name; public String Name;
SleighHorse(Location loc, String name, double x, double z) SleighHorse(Location loc, String name, double x, double z)
{ {
Name = name; Name = name;
OffsetX = x; OffsetX = x;
OffsetZ = z; OffsetZ = z;
_lastFacing = loc.add(x, 0.5, z); _lastFacing = loc.add(x, 0.5, z);
} }
private int[] getAngles(float yaw) private int[] getAngles(float yaw)
{ {
double angle = ((2 * Math.PI) / 360D) * (yaw + 90); double angle = ((2 * Math.PI) / 360D) * (yaw + 90);
double dist = 0.7; double dist = 0.7;
double angleMod = 0.19; double angleMod = 0.19;
int pX1 = (int) Math.floor(dist * Math.cos(angle + angleMod) * 32); int pX1 = (int) Math.floor(dist * Math.cos(angle + angleMod) * 32);
int pZ1 = (int) Math.floor(dist * Math.sin(angle + angleMod) * 32); int pZ1 = (int) Math.floor(dist * Math.sin(angle + angleMod) * 32);
int pX2 = (int) Math.floor(dist * Math.cos(angle - angleMod) * 32); int pX2 = (int) Math.floor(dist * Math.cos(angle - angleMod) * 32);
int pZ2 = (int) Math.floor(dist * Math.sin(angle - angleMod) * 32); int pZ2 = (int) Math.floor(dist * Math.sin(angle - angleMod) * 32);
return new int[] return new int[]
{ {
pX1, pZ1, pX2, pZ2 pX1, pZ1, pX2, pZ2
}; };
} }
public boolean HasEntity(LivingEntity ent) public boolean HasEntity(LivingEntity ent)
{ {
return Ent.equals(ent); return Ent.equals(ent);
} }
public void onTick() public void onTick()
{ {
EntityTrackerEntry entityTrackerEntry = ((CraftWorld) Ent.getWorld()).getHandle().tracker.trackedEntities EntityTrackerEntry entityTrackerEntry = ((CraftWorld) Ent.getWorld()).getHandle().tracker.trackedEntities
.get(Ent.getEntityId()); .get(Ent.getEntityId());
if (entityTrackerEntry != null) if (entityTrackerEntry != null)
{ {
Location newLocation = Ent.getLocation().add(0, 0.5, 0); Location newLocation = Ent.getLocation().add(0, 0.5, 0);
newLocation.setPitch(_lastFacing.getPitch()); newLocation.setPitch(_lastFacing.getPitch());
if (!newLocation.equals(_lastFacing)) if (!newLocation.equals(_lastFacing))
{ {
Packet[] packets1_8 = new Packet[2]; Packet[] packets1_8 = new Packet[2];
_lastMovement.add(new Vector(newLocation.getX() - _lastFacing.getX(), newLocation.getY() - _lastFacing.getY(), _lastMovement.add(new Vector(newLocation.getX() - _lastFacing.getX(), newLocation.getY() - _lastFacing.getY(),
newLocation.getZ() - _lastFacing.getZ())); newLocation.getZ() - _lastFacing.getZ()));
final int xP = (int) Math.floor(32 * _lastMovement.getX()); final int xP = (int) Math.floor(32 * _lastMovement.getX());
final int yP = (int) Math.floor(32 * _lastMovement.getY()); final int yP = (int) Math.floor(32 * _lastMovement.getY());
final int zP = (int) Math.floor(32 * _lastMovement.getZ()); final int zP = (int) Math.floor(32 * _lastMovement.getZ());
_lastMovement.subtract(new Vector(xP / 32D, yP / 32D, zP / 32D)); _lastMovement.subtract(new Vector(xP / 32D, yP / 32D, zP / 32D));
_lastFacing = newLocation; _lastFacing = newLocation;
int[] angles = getAngles(_lastFacing.getYaw()); int[] angles = getAngles(_lastFacing.getYaw());
boolean tp = false; boolean tp = false;
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; i++)
{ {
int pX = angles[i * 2] - _previousDir[i * 2]; int pX = angles[i * 2] - _previousDir[i * 2];
int pZ = angles[(i * 2) + 1] - _previousDir[(i * 2) + 1]; int pZ = angles[(i * 2) + 1] - _previousDir[(i * 2) + 1];
int x = xP + pX; int x = xP + pX;
int y = yP; int y = yP;
int z = zP + pZ; int z = zP + pZ;
if (x >= -128 && x <= 127 && y >= -128 && y <= 127 && z >= -128 && z <= 127) // if (x >= -128 && x <= 127 && y >= -128 && y <= 127 && z >= -128 && z <= 127)
{ // {
PacketPlayOutEntity relMove = pX != 0 || pZ != 0 ? new PacketPlayOutEntity.PacketPlayOutRelEntityMoveLook() // PacketPlayOutEntity relMove = pX != 0 || pZ != 0 ? new PacketPlayOutEntity.PacketPlayOutRelEntityMoveLook()
: new PacketPlayOutEntity.PacketPlayOutRelEntityMove(); // : new PacketPlayOutEntity.PacketPlayOutRelEntityMove();
relMove.a = hornsAndNose[i]; // relMove.a = hornsAndNose[i];
relMove.b = (byte) x; // relMove.b = (byte) x;
relMove.c = (byte) y; // relMove.c = (byte) y;
relMove.d = (byte) z; // relMove.d = (byte) z;
relMove.e = ((byte) (int) (newLocation.getYaw() * 256.0F / 360.0F)); // relMove.e = ((byte) (int) (newLocation.getYaw() * 256.0F / 360.0F));
packets1_8[i] = relMove; // packets1_8[i] = relMove;
} // }
else // else
{ {
x = (int) Math.floor(32 * newLocation.getX()); x = (int) Math.floor(32 * newLocation.getX());
y = (int) Math.floor(32 * newLocation.getY()); y = (int) Math.floor(32 * newLocation.getY());
z = (int) Math.floor(32 * newLocation.getZ()); z = (int) Math.floor(32 * newLocation.getZ());
tp = true; tp = true;
PacketPlayOutEntityTeleport teleportPacket = new PacketPlayOutEntityTeleport(); PacketPlayOutEntityTeleport teleportPacket = new PacketPlayOutEntityTeleport();
teleportPacket.a = hornsAndNose[i]; teleportPacket.a = hornsAndNose[i];
teleportPacket.b = x + pX; teleportPacket.b = x + pX;
teleportPacket.c = y; teleportPacket.c = y;
teleportPacket.d = z + pZ; teleportPacket.d = z + pZ;
teleportPacket.e = ((byte) (int) (newLocation.getYaw() * 256.0F / 360.0F)); teleportPacket.e = ((byte) (int) (newLocation.getYaw() * 256.0F / 360.0F));
packets1_8[i] = teleportPacket; packets1_8[i] = teleportPacket;
} }
} }
if (tp) if (tp)
{ {
int x = (int) Math.floor(32 * newLocation.getX()); int x = (int) Math.floor(32 * newLocation.getX());
int y = (int) Math.floor(32 * newLocation.getY()); int y = (int) Math.floor(32 * newLocation.getY());
int z = (int) Math.floor(32 * newLocation.getZ()); int z = (int) Math.floor(32 * newLocation.getZ());
_lastMovement = new Vector(newLocation.getX() - (x / 32D), newLocation.getY() - (y / 32D), newLocation.getZ() _lastMovement = new Vector(newLocation.getX() - (x / 32D), newLocation.getY() - (y / 32D), newLocation.getZ()
- (z / 32D)); - (z / 32D));
} }
_previousDir = angles; _previousDir = angles;
HashSet trackedPlayers = (HashSet) entityTrackerEntry.trackedPlayers; HashSet trackedPlayers = (HashSet) entityTrackerEntry.trackedPlayers;
HashSet<EntityPlayer> cloned = (HashSet) trackedPlayers.clone(); HashSet<EntityPlayer> cloned = (HashSet) trackedPlayers.clone();
for (EntityPlayer p : cloned) for (EntityPlayer p : cloned)
{ {
for (Packet packet : packets1_8) for (Packet packet : packets1_8)
{ {
p.playerConnection.sendPacket(packet); p.playerConnection.sendPacket(packet);
} }
} }
} }
} }
} }
public void spawnHorns(Player player) public void spawnHorns(Player player)
{ {
Location loc = Ent == null ? _lastFacing : Ent.getLocation().add(0, 0.5, 0); Location loc = Ent == null ? _lastFacing : Ent.getLocation().add(0, 0.5, 0);
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; i++)
{ {
int id = hornsAndNose[i]; int id = hornsAndNose[i];
PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving(); PacketPlayOutSpawnEntityLiving packet = new PacketPlayOutSpawnEntityLiving();
packet.a = id; packet.a = id;
packet.b = 30; packet.b = 30;
packet.c = (int) (loc.getX() * 32) + this._previousDir[i * 2]; packet.c = (int) (loc.getX() * 32) + this._previousDir[i * 2];
packet.d = (int) (loc.getY() * 32); packet.d = (int) (loc.getY() * 32);
packet.e = (int) (loc.getZ() * 32) + this._previousDir[(i * 2) + 1]; packet.e = (int) (loc.getZ() * 32) + this._previousDir[(i * 2) + 1];
packet.f = ((byte) (int) (loc.getYaw() * 256.0F / 360.0F)); packet.f = ((byte) (int) (loc.getYaw() * 256.0F / 360.0F));
packet.uuid = UUID.randomUUID(); packet.uuid = UUID.randomUUID();
// Setup datawatcher for armor stand // Setup datawatcher for armor stand
DataWatcher watcher = new DataWatcher(null); DataWatcher watcher = new DataWatcher(null);
watcher.a(0, (byte) 32, Entity.META_ENTITYDATA, (byte) 32); watcher.a(0, (byte) 32, Entity.META_ENTITYDATA, (byte) 32);
watcher.a(10, (byte) 4, EntityArmorStand.META_ARMOR_OPTION, (byte) 4); watcher.a(10, (byte) 4, EntityArmorStand.META_ARMOR_OPTION, (byte) 4);
watcher.a(11, new Vector3f(0, i * 180, (i == 0 ? -1 : 1) * 60f), EntityArmorStand.META_HEAD_POSE, new Vector3f(0, i * 180, (i == 0 ? -1 : 1) * 60f)); watcher.a(11, new Vector3f(0, i * 180, (i == 0 ? -1 : 1) * 60f), EntityArmorStand.META_HEAD_POSE, new Vector3f(0, i * 180, (i == 0 ? -1 : 1) * 60f));
packet.l = watcher; packet.l = watcher;
PacketPlayOutEntityEquipment enquipPacket = new PacketPlayOutEntityEquipment(); PacketPlayOutEntityEquipment enquipPacket = new PacketPlayOutEntityEquipment();
enquipPacket.a = id; enquipPacket.a = id;
enquipPacket.b = 4; enquipPacket.b = 4;
enquipPacket.c = CraftItemStack.asNMSCopy(new ItemStack(Material.DEAD_BUSH)); enquipPacket.c = CraftItemStack.asNMSCopy(new ItemStack(Material.DEAD_BUSH));
UtilPlayer.sendPacket(player, packet); UtilPlayer.sendPacket(player, packet);
UtilPlayer.sendPacket(player, enquipPacket); UtilPlayer.sendPacket(player, enquipPacket);
} }
} }
public void spawnHorse() public void spawnHorse()
{ {
horseId = UtilEnt.getNewEntityId(false); horseId = UtilEnt.getNewEntityId(false);
_previousDir = getAngles(_lastFacing.getYaw()); _previousDir = getAngles(_lastFacing.getYaw());
Ent = _lastFacing.getWorld().spawn(_lastFacing.subtract(0, 0.5, 0), Horse.class); Ent = _lastFacing.getWorld().spawn(_lastFacing.subtract(0, 0.5, 0), Horse.class);
UtilEnt.vegetate(Ent); UtilEnt.vegetate(Ent);
UtilEnt.ghost(Ent, true, false); UtilEnt.ghost(Ent, true, false);
Ent.setRemoveWhenFarAway(false); Ent.setRemoveWhenFarAway(false);
Ent.setCustomName(C.cWhiteB + Name); Ent.setCustomName(C.cWhiteB + Name);
Ent.setCustomNameVisible(true); Ent.setCustomNameVisible(true);
Ent.setStyle(Style.BLACK_DOTS); Ent.setStyle(Style.BLACK_DOTS);
Ent.setColor(Color.BROWN); Ent.setColor(Color.BROWN);
} }
} }

View File

@ -93,6 +93,7 @@ public class SleighPart
ItemStack head = new ItemStack(Material.LEATHER_HELMET); ItemStack head = new ItemStack(Material.LEATHER_HELMET);
LeatherArmorMeta meta = (LeatherArmorMeta)head.getItemMeta(); LeatherArmorMeta meta = (LeatherArmorMeta)head.getItemMeta();
meta.setColor(Color.RED); meta.setColor(Color.RED);
meta.spigot().setUnbreakable(true); meta.spigot().setUnbreakable(true);
head.setItemMeta(meta); head.setItemMeta(meta);

View File

@ -1,8 +1,12 @@
package nautilus.game.arcade.game.games.christmasnew; package nautilus.game.arcade.game.games.christmasnew;
import org.bukkit.event.EventHandler;
import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.ArcadeManager;
import nautilus.game.arcade.GameType; import nautilus.game.arcade.GameType;
import nautilus.game.arcade.events.GameStateChangeEvent;
import nautilus.game.arcade.game.games.christmas.ChristmasCommon; import nautilus.game.arcade.game.games.christmas.ChristmasCommon;
import nautilus.game.arcade.game.games.christmas.kits.KitPlayer;
import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.Kit;
public class ChristmasNew extends ChristmasCommon public class ChristmasNew extends ChristmasCommon
@ -17,7 +21,20 @@ public class ChristmasNew extends ChristmasCommon
{ {
super(manager, GameType.ChristmasNew, new Kit[] super(manager, GameType.ChristmasNew, new Kit[]
{ {
new KitPlayer(manager)
}, DESCRIPTION); }, DESCRIPTION);
PrepareTime = 2000;
}
@EventHandler
public void gameStart(GameStateChangeEvent event)
{
if (event.GetState() != GameState.Live)
{
return;
}
sendSantaMessage("Testing music", ChristmasNewAudio.TEST);
} }
} }

View File

@ -2,15 +2,15 @@ package nautilus.game.arcade.game.games.christmasnew;
import mineplex.core.common.util.UtilPlayer.CustomSound; import mineplex.core.common.util.UtilPlayer.CustomSound;
enum ChristmasAudio implements CustomSound public enum ChristmasNewAudio implements CustomSound
{ {
TEST("test")
; ;
private final String _audioPath; private final String _audioPath;
ChristmasAudio(String audioPath) ChristmasNewAudio(String audioPath)
{ {
_audioPath = audioPath; _audioPath = audioPath;
} }

View File

@ -0,0 +1,23 @@
package nautilus.game.arcade.game.games.christmasnew.section;
import org.bukkit.event.Listener;
import nautilus.game.arcade.game.games.christmasnew.ChristmasNew;
public abstract class Section implements Listener
{
private final ChristmasNew _host;
public Section(ChristmasNew host)
{
_host = host;
}
public abstract void onRegister();
public abstract void onUnregister();
public abstract boolean isComplete();
}