Progress
This commit is contained in:
parent
4205dc6c25
commit
3dda9352e7
Binary file not shown.
@ -53,14 +53,14 @@ public class UtilEnt
|
||||
|
||||
public static void silence(LivingEntity entity, boolean silence)
|
||||
{
|
||||
((CraftLivingEntity)entity).getHandle().silent = silence;
|
||||
((CraftLivingEntity)entity).getHandle().setSilent(silence);
|
||||
}
|
||||
|
||||
public static void ghost(Entity entity, boolean ghost, boolean invisible)
|
||||
{
|
||||
if (entity instanceof LivingEntity)
|
||||
{
|
||||
((CraftLivingEntity)entity).getHandle().Ghost = ghost;
|
||||
((CraftLivingEntity)entity).getHandle().setGhost(ghost);
|
||||
}
|
||||
|
||||
// ((CraftEntity)entity).getHandle().Invisible = invisible;
|
||||
@ -69,13 +69,8 @@ public class UtilEnt
|
||||
|
||||
public static void Leash(LivingEntity leashed, Entity holder, boolean pull, boolean breakable)
|
||||
{
|
||||
if (((CraftEntity)leashed).getHandle() instanceof EntityInsentient)
|
||||
{
|
||||
EntityInsentient creature = (EntityInsentient)((CraftEntity)leashed).getHandle();
|
||||
|
||||
creature.PullWhileLeashed = pull;
|
||||
creature.ShouldBreakLeash = breakable;
|
||||
}
|
||||
leashed.setPullWhileLeashed(pull);
|
||||
leashed.setShouldBreakLeash(breakable);
|
||||
|
||||
leashed.setLeashHolder(holder);
|
||||
}
|
||||
@ -171,8 +166,8 @@ public class UtilEnt
|
||||
{
|
||||
EntityInsentient creature = (EntityInsentient)((CraftEntity)entity).getHandle();
|
||||
|
||||
creature.Vegetated = true;
|
||||
creature.silent = mute;
|
||||
creature.setVegetated(true);
|
||||
creature.setSilent(mute);
|
||||
|
||||
((List)_pathfinderBList.get(((PathfinderGoalSelector)_goalSelector.get(creature)))).clear();
|
||||
((List)_pathfinderCList.get(((PathfinderGoalSelector)_goalSelector.get(creature)))).clear();
|
||||
@ -183,14 +178,14 @@ public class UtilEnt
|
||||
|
||||
if (((CraftEntity)entity).getHandle() instanceof EntityBat)
|
||||
{
|
||||
((EntityBat)((CraftEntity)entity).getHandle()).Vegetated = true;
|
||||
((EntityBat)((CraftEntity)entity).getHandle()).setVegetated(true);
|
||||
}
|
||||
|
||||
if (((CraftEntity)entity).getHandle() instanceof EntityEnderDragon)
|
||||
{
|
||||
EntityEnderDragon creature = (EntityEnderDragon)((CraftEntity)entity).getHandle();
|
||||
|
||||
creature.Vegetated = true;
|
||||
creature.setVegetated(true);
|
||||
}
|
||||
}
|
||||
catch (IllegalArgumentException e)
|
||||
|
@ -14,30 +14,26 @@ public class UtilParticle
|
||||
{
|
||||
public enum ViewDist
|
||||
{
|
||||
SHORT(8),
|
||||
NORMAL(24),
|
||||
LONG(48),
|
||||
LONGER(96),
|
||||
MAX(256);
|
||||
|
||||
SHORT(8), NORMAL(24), LONG(48), LONGER(96), MAX(256);
|
||||
|
||||
private int _dist;
|
||||
|
||||
|
||||
ViewDist(int dist)
|
||||
{
|
||||
_dist = dist;
|
||||
}
|
||||
|
||||
|
||||
public int getDist()
|
||||
{
|
||||
return _dist;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public enum ParticleType
|
||||
{
|
||||
ANGRY_VILLAGER("angryVillager", "Lightning Cloud", Material.INK_SACK, (byte) 11, EnumParticle.VILLAGER_ANGRY),
|
||||
ANGRY_VILLAGER(EnumParticle.VILLAGER_ANGRY, "angryVillager", "Lightning Cloud", Material.INK_SACK, (byte) 11),
|
||||
|
||||
BLOCK_CRACK("blockcrack_1_0", EnumParticle.BLOCK_CRACK)
|
||||
BLOCK_CRACK(EnumParticle.BLOCK_CRACK, "blockcrack")
|
||||
{
|
||||
@Override
|
||||
public String getParticle(Material type, int data)
|
||||
@ -46,7 +42,7 @@ public class UtilParticle
|
||||
}
|
||||
},
|
||||
|
||||
BLOCK_DUST("blockdust_1_0", EnumParticle.BLOCK_DUST)
|
||||
BLOCK_DUST(EnumParticle.BLOCK_DUST, "blockdust")
|
||||
{
|
||||
@Override
|
||||
public String getParticle(Material type, int data)
|
||||
@ -55,37 +51,37 @@ public class UtilParticle
|
||||
}
|
||||
},
|
||||
|
||||
BUBBLE("bubble", EnumParticle.WATER_BUBBLE),
|
||||
BUBBLE(EnumParticle.WATER_BUBBLE, "bubble"),
|
||||
|
||||
CLOUD("cloud", "White Smoke", Material.INK_SACK, (byte) 7, EnumParticle.CLOUD),
|
||||
CLOUD(EnumParticle.CLOUD, "cloud", "White Smoke", Material.INK_SACK, (byte) 7),
|
||||
|
||||
CRIT("crit", "Brown Magic", Material.INK_SACK, (byte) 14, EnumParticle.CRIT),
|
||||
CRIT(EnumParticle.CRIT, "crit", "Brown Magic", Material.INK_SACK, (byte) 14),
|
||||
|
||||
DEPTH_SUSPEND("depthSuspend", EnumParticle.SUSPENDED_DEPTH),
|
||||
DEPTH_SUSPEND(EnumParticle.SUSPENDED_DEPTH, "depthSuspend"),
|
||||
|
||||
DRIP_LAVA("dripLava", "Lava Drip", Material.LAVA_BUCKET, (byte) 0, EnumParticle.DRIP_LAVA),
|
||||
DRIP_LAVA(EnumParticle.DRIP_LAVA, "dripLava", "Lava Drip", Material.LAVA_BUCKET, (byte) 0),
|
||||
|
||||
DRIP_WATER("dripWater", "Water Drop", Material.WATER_BUCKET, (byte) 0, EnumParticle.DRIP_WATER),
|
||||
DRIP_WATER(EnumParticle.DRIP_WATER, "dripWater", "Water Drop", Material.WATER_BUCKET, (byte) 0),
|
||||
|
||||
DROPLET("droplet", "Water Splash", Material.INK_SACK, (byte) 4, EnumParticle.WATER_DROP),
|
||||
DROPLET(EnumParticle.WATER_DROP, "droplet", "Water Splash", Material.INK_SACK, (byte) 4),
|
||||
|
||||
ENCHANTMENT_TABLE("enchantmenttable", "Enchantment Words", Material.BOOK, (byte) 0, EnumParticle.ENCHANTMENT_TABLE),
|
||||
ENCHANTMENT_TABLE(EnumParticle.ENCHANTMENT_TABLE, "enchantmenttable", "Enchantment Words", Material.BOOK, (byte) 0),
|
||||
|
||||
EXPLODE("explode", "Big White Smoke", Material.INK_SACK, (byte) 15, EnumParticle.EXPLOSION_NORMAL),
|
||||
EXPLODE(EnumParticle.EXPLOSION_NORMAL, "explode", "Big White Smoke", Material.INK_SACK, (byte) 15),
|
||||
|
||||
FIREWORKS_SPARK("fireworksSpark", "White Sparkle", Material.GHAST_TEAR, (byte) 0, EnumParticle.FIREWORKS_SPARK),
|
||||
FIREWORKS_SPARK(EnumParticle.FIREWORKS_SPARK, "fireworksSpark", "White Sparkle", Material.GHAST_TEAR, (byte) 0),
|
||||
|
||||
FLAME("flame", "Flame", Material.BLAZE_POWDER, (byte) 0, EnumParticle.FLAME),
|
||||
FLAME(EnumParticle.FLAME, "flame", "Flame", Material.BLAZE_POWDER, (byte) 0),
|
||||
|
||||
FOOTSTEP("footstep", "Foot Step", Material.LEATHER_BOOTS, (byte) 0, EnumParticle.FOOTSTEP),
|
||||
FOOTSTEP(EnumParticle.FOOTSTEP, "footstep", "Foot Step", Material.LEATHER_BOOTS, (byte) 0),
|
||||
|
||||
HAPPY_VILLAGER("happyVillager", "Emerald Sparkle", Material.EMERALD, (byte) 0, EnumParticle.VILLAGER_HAPPY),
|
||||
HAPPY_VILLAGER(EnumParticle.VILLAGER_HAPPY, "happyVillager", "Emerald Sparkle", Material.EMERALD, (byte) 0),
|
||||
|
||||
HEART("heart", "Love Heart", Material.APPLE, (byte) 0, EnumParticle.HEART),
|
||||
HEART(EnumParticle.HEART, "heart", "Love Heart", Material.APPLE, (byte) 0),
|
||||
|
||||
HUGE_EXPLOSION("hugeexplosion", "Huge Explosion", Material.TNT, (byte) 0, EnumParticle.EXPLOSION_HUGE),
|
||||
HUGE_EXPLOSION(EnumParticle.EXPLOSION_HUGE, "hugeexplosion", "Huge Explosion", Material.TNT, (byte) 0),
|
||||
|
||||
ICON_CRACK("iconcrack_1_0", EnumParticle.ITEM_CRACK)
|
||||
ICON_CRACK(EnumParticle.ITEM_CRACK, "iconcrack")
|
||||
{
|
||||
@Override
|
||||
public String getParticle(Material type, int data)
|
||||
@ -94,73 +90,83 @@ public class UtilParticle
|
||||
}
|
||||
},
|
||||
|
||||
INSTANT_SPELL("instantSpell", EnumParticle.SPELL_INSTANT),
|
||||
INSTANT_SPELL(EnumParticle.SPELL_INSTANT, "instantSpell"),
|
||||
|
||||
LARGE_EXPLODE("largeexplode", "Explosion", Material.FIREBALL, (byte) 0, EnumParticle.EXPLOSION_LARGE),
|
||||
LARGE_EXPLODE(EnumParticle.EXPLOSION_LARGE, "largeexplode", "Explosion", Material.FIREBALL, (byte) 0),
|
||||
|
||||
LARGE_SMOKE("largesmoke", "Black Smoke", Material.INK_SACK, (byte) 0, EnumParticle.SMOKE_LARGE),
|
||||
LARGE_SMOKE(EnumParticle.SMOKE_LARGE, "largesmoke", "Black Smoke", Material.INK_SACK, (byte) 0),
|
||||
|
||||
LAVA("lava", "Lava Debris", Material.LAVA, (byte) 0, EnumParticle.LAVA),
|
||||
SMOKE(EnumParticle.SMOKE_NORMAL, "smoke", "Smoke", Material.INK_SACK, (byte) 0),
|
||||
|
||||
MAGIC_CRIT("magicCrit", "Teal Magic", Material.INK_SACK, (byte) 6, EnumParticle.CRIT_MAGIC),
|
||||
LAVA(EnumParticle.LAVA, "lava", "Lava Debris", Material.LAVA, (byte) 0),
|
||||
|
||||
MAGIC_CRIT(EnumParticle.CRIT_MAGIC, "magicCrit", "Teal Magic", Material.INK_SACK, (byte) 6),
|
||||
|
||||
/**
|
||||
* Can be colored if count is 0, color is RGB and depends on the offset of xyz
|
||||
*/
|
||||
MOB_SPELL("mobSpell", "Black Swirls", Material.getMaterial(2263), (byte) 0, EnumParticle.SPELL_MOB),
|
||||
MOB_SPELL(EnumParticle.SPELL_MOB, "mobSpell", "Black Swirls", Material.getMaterial(2263), (byte) 0),
|
||||
|
||||
/**
|
||||
* Can be colored if count is 0, color is RGB and depends on the offset of xyz
|
||||
*/
|
||||
MOB_SPELL_AMBIENT("mobSpellAmbient", "Transparent Black Swirls", Material.getMaterial(2266), (byte) 0, EnumParticle.SPELL_MOB_AMBIENT),
|
||||
MOB_SPELL_AMBIENT(EnumParticle.SPELL_MOB_AMBIENT, "mobSpellAmbient", "Transparent Black Swirls", Material
|
||||
.getMaterial(2266), (byte) 0),
|
||||
|
||||
NOTE("note", "Musical Note", Material.JUKEBOX, (byte) 0, EnumParticle.NOTE),
|
||||
NOTE(EnumParticle.NOTE, "note", "Musical Note", Material.JUKEBOX, (byte) 0),
|
||||
|
||||
PORTAL("portal", "Portal Effect", Material.INK_SACK, (byte) 5, EnumParticle.PORTAL),
|
||||
PORTAL(EnumParticle.PORTAL, "portal", "Portal Effect", Material.INK_SACK, (byte) 5),
|
||||
|
||||
/**
|
||||
* Can be colored if count is 0, color is RGB and depends on the offset of xyz. Offset y if 0 will default to 1, counter by making it 0.0001
|
||||
* Can be colored if count is 0, color is RGB and depends on the offset of xyz. Offset y if 0 will default to 1, counter
|
||||
* by making it 0.0001
|
||||
*/
|
||||
RED_DUST("reddust", "Red Smoke", Material.INK_SACK, (byte) 1, EnumParticle.REDSTONE),
|
||||
RED_DUST(EnumParticle.REDSTONE, "reddust", "Red Smoke", Material.INK_SACK, (byte) 1),
|
||||
|
||||
SLIME("slime", "Slime Particles", Material.SLIME_BALL, (byte) 0, EnumParticle.SLIME),
|
||||
SLIME(EnumParticle.SLIME, "slime", "Slime Particles", Material.SLIME_BALL, (byte) 0),
|
||||
|
||||
SNOW_SHOVEL("snowshovel", "Snow Puffs", Material.SNOW_BALL, (byte) 0, EnumParticle.SNOW_SHOVEL),
|
||||
SNOW_SHOVEL(EnumParticle.SNOW_SHOVEL, "snowshovel", "Snow Puffs", Material.SNOW_BALL, (byte) 0),
|
||||
|
||||
SNOWBALL_POOF("snowballpoof", EnumParticle.SNOWBALL),
|
||||
SNOWBALL_POOF(EnumParticle.SNOWBALL, "snowballpoof"),
|
||||
|
||||
SPELL("spell", "White Swirls", Material.getMaterial(2264), (byte) 0, EnumParticle.SPELL),
|
||||
SPELL(EnumParticle.SPELL, "spell", "White Swirls", Material.getMaterial(2264), (byte) 0),
|
||||
|
||||
SPLASH("splash", EnumParticle.WATER_SPLASH),
|
||||
SPLASH(EnumParticle.WATER_SPLASH, "splash"),
|
||||
|
||||
SUSPEND("suspended", EnumParticle.SUSPENDED),
|
||||
SUSPEND(EnumParticle.SUSPENDED, "suspended"),
|
||||
|
||||
TOWN_AURA("townaura", "Black Specks", Material.COAL, (byte) 0, EnumParticle.TOWN_AURA),
|
||||
TOWN_AURA(EnumParticle.TOWN_AURA, "townaura", "Black Specks", Material.COAL, (byte) 0),
|
||||
|
||||
WITCH_MAGIC("witchMagic", "Purple Magic", Material.INK_SACK, (byte) 13, EnumParticle.SPELL_WITCH);
|
||||
WITCH_MAGIC(EnumParticle.SPELL_WITCH, "witchMagic", "Purple Magic", Material.INK_SACK, (byte) 13),
|
||||
|
||||
MOB_APPEARANCE(EnumParticle.MOB_APPEARANCE, "mobappearance"),
|
||||
|
||||
BARRIER(EnumParticle.BARRIER, "barrier"),
|
||||
|
||||
ITEM_TAKE(EnumParticle.ITEM_TAKE, "take"),
|
||||
|
||||
WATER_WAKE(EnumParticle.WATER_WAKE, "wake");
|
||||
|
||||
public EnumParticle particle;
|
||||
public String particleName;
|
||||
private boolean _friendlyData;
|
||||
private String _friendlyName;
|
||||
private Material _material;
|
||||
private byte _data;
|
||||
private EnumParticle _enumParticle;
|
||||
|
||||
ParticleType(String particleName, EnumParticle enumParticle)
|
||||
ParticleType(EnumParticle particle, String particleName)
|
||||
{
|
||||
this.particleName = particleName;
|
||||
_friendlyData = false;
|
||||
_enumParticle = enumParticle;
|
||||
}
|
||||
|
||||
ParticleType(String particleName, String friendlyName, Material material, byte data, EnumParticle enumParticle)
|
||||
ParticleType(EnumParticle particle, String particleName, String friendlyName, Material material, byte data)
|
||||
{
|
||||
this.particleName = particleName;
|
||||
_friendlyData = true;
|
||||
_friendlyName = friendlyName;
|
||||
_material = material;
|
||||
_data = data;
|
||||
_enumParticle = enumParticle;
|
||||
}
|
||||
|
||||
public String getParticle(Material type, int data)
|
||||
@ -177,9 +183,9 @@ public class UtilParticle
|
||||
{
|
||||
if (_friendlyName == null)
|
||||
{
|
||||
return toString();
|
||||
return toString();
|
||||
}
|
||||
|
||||
|
||||
return _friendlyName;
|
||||
}
|
||||
|
||||
@ -202,32 +208,53 @@ public class UtilParticle
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public EnumParticle getEnumParticle()
|
||||
{
|
||||
return _enumParticle;
|
||||
}
|
||||
}
|
||||
|
||||
private static PacketPlayOutWorldParticles getPacket(EnumParticle particle, Location location, float offsetX, float offsetY,
|
||||
private static PacketPlayOutWorldParticles getPacket(String particleName, Location location, float offsetX, float offsetY,
|
||||
float offsetZ, float speed, int count, boolean displayFar)
|
||||
{
|
||||
String[] parts = particleName.split("_");
|
||||
int[] details = new int[parts.length - 1];
|
||||
|
||||
for (int i = 0; i < details.length; i++)
|
||||
{
|
||||
details[i] = Integer.parseInt(parts[i + 1]);
|
||||
}
|
||||
|
||||
ParticleType particleType = ParticleType.CRIT;
|
||||
|
||||
for (ParticleType type : ParticleType.values())
|
||||
{
|
||||
if (type.particleName.equalsIgnoreCase(parts[0]))
|
||||
{
|
||||
particleType = type;
|
||||
}
|
||||
}
|
||||
|
||||
PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles(particleType.particle, displayFar,
|
||||
(float) location.getX(), (float) location.getY(), (float) location.getZ(), offsetX, offsetY, offsetZ, speed,
|
||||
count, details);
|
||||
|
||||
PacketPlayOutWorldParticles packet = new PacketPlayOutWorldParticles(particle, displayFar, (float) location.getX(), (float) location.getY(), (float) location.getZ(), offsetX, offsetY, offsetZ, speed, count);
|
||||
return packet;
|
||||
}
|
||||
|
||||
public static void PlayParticle(ParticleType particle, Location location, float offsetX, float offsetY, float offsetZ,
|
||||
float speed, int count, ViewDist dist, Player... players)
|
||||
public static void PlayParticle(ParticleType type, Location location, float offsetX, float offsetY, float offsetZ,
|
||||
float speed, int count, ViewDist dist, Player... players)
|
||||
{
|
||||
PacketPlayOutWorldParticles packet = getPacket(particle.getEnumParticle(), location, offsetX, offsetY, offsetZ, speed, count, true);
|
||||
PlayParticle(type.particleName, location, offsetX, offsetY, offsetZ, speed, count, dist, players);
|
||||
}
|
||||
|
||||
public static void PlayParticle(String particle, Location location, float offsetX, float offsetY, float offsetZ, float speed,
|
||||
int count, ViewDist dist, Player... players)
|
||||
{
|
||||
PacketPlayOutWorldParticles packet = getPacket(particle, location, offsetX, offsetY, offsetZ, speed, count, true);
|
||||
|
||||
for (Player player : players)
|
||||
{
|
||||
//Out of range for player
|
||||
// Out of range for player
|
||||
if (UtilMath.offset(player.getLocation(), location) > dist.getDist())
|
||||
continue;
|
||||
|
||||
|
||||
UtilPlayer.sendPacket(player, packet);
|
||||
}
|
||||
}
|
||||
|
@ -6,19 +6,23 @@ import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import net.minecraft.server.v1_8_R3.EntityPlayer;
|
||||
import net.minecraft.server.v1_8_R3.Packet;
|
||||
import net.minecraft.server.v1_8_R3.PlayerConnection;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.event.CraftEventFactory;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.Inventory;
|
||||
import org.bukkit.inventory.InventoryView;
|
||||
import org.bukkit.util.Vector;
|
||||
|
||||
import net.minecraft.server.v1_8_R3.Packet;
|
||||
import net.minecraft.server.v1_8_R3.PlayerConnection;
|
||||
|
||||
public class UtilPlayer
|
||||
{
|
||||
private static boolean hasIntersection(Vector3D p1, Vector3D p2, Vector3D min, Vector3D max)
|
||||
@ -586,6 +590,11 @@ public class UtilPlayer
|
||||
return (((CraftEntity) player).getHandle().getDataWatcher().getByte(0) & 1 << 4) != 0;
|
||||
}
|
||||
|
||||
public static boolean is1_8(Player player)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void sendPacket(Player player, Packet... packets)
|
||||
{
|
||||
PlayerConnection connection = ((CraftPlayer) player).getHandle().playerConnection;
|
||||
@ -602,12 +611,19 @@ public class UtilPlayer
|
||||
return ((CraftPlayer) player).getHandle().spectating;
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean is1_8(Player player)
|
||||
{
|
||||
return true;
|
||||
|
||||
public static InventoryView swapToInventory(Player player, Inventory inv) {
|
||||
|
||||
EntityPlayer nmsPlayer = ((CraftPlayer) player).getHandle();
|
||||
if (nmsPlayer.activeContainer != nmsPlayer.defaultContainer)
|
||||
{
|
||||
// Do this so that other inventories know their time is over.
|
||||
CraftEventFactory.handleInventoryCloseEvent(nmsPlayer);
|
||||
nmsPlayer.m();
|
||||
}
|
||||
return player.openInventory(inv);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
public void setListName(Player player, CoreClient client)
|
||||
{
|
||||
@ -637,7 +653,7 @@ public class UtilPlayer
|
||||
player.setPlayerListName(playerName);
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
public static Location getTargetLocation(Player player, double distance)
|
||||
{
|
||||
Vector looking = player.getLocation().getDirection().clone();
|
||||
|
@ -15,6 +15,5 @@
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.Core.Common"/>
|
||||
<classpathentry kind="var" path="REPO_DIR/Plugins/Libraries/NoCheatPlus.jar"/>
|
||||
<classpathentry combineaccessrules="false" kind="src" path="/Mineplex.PlayerCache"/>
|
||||
<classpathentry kind="lib" path="A:/Mineplex/mineplex/Testing/Clans/craftbukkit.jar"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
@ -19,6 +19,7 @@ import mineplex.core.packethandler.PacketInfo;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import net.minecraft.server.v1_8_R3.DataWatcher;
|
||||
import net.minecraft.server.v1_8_R3.DataWatcher.WatchableObject;
|
||||
import net.minecraft.server.v1_8_R3.MathHelper;
|
||||
import net.minecraft.server.v1_8_R3.Packet;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutAttachEntity;
|
||||
@ -26,7 +27,6 @@ import net.minecraft.server.v1_8_R3.PacketPlayOutEntityDestroy;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityMetadata;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntity;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutSpawnEntityLiving;
|
||||
import net.minecraft.server.v1_8_R3.WatchableObject;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
|
||||
@ -61,7 +61,8 @@ public class CustomTagFix extends MiniPlugin implements IPacketHandler, NCPHook
|
||||
{
|
||||
super("Custom Tag Fix", plugin);
|
||||
|
||||
packetHandler.addPacketHandler(this);
|
||||
packetHandler.addPacketHandler(this, PacketPlayOutAttachEntity.class, PacketPlayOutEntityDestroy.class,
|
||||
PacketPlayOutEntityMetadata.class, PacketPlayOutSpawnEntity.class, PacketPlayOutSpawnEntityLiving.class);
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -102,7 +102,7 @@ public class PetTagPage extends ShopPageBase<CosmeticManager, CosmeticShop>
|
||||
|
||||
getPlugin().getPetManager().Get(getPlayer()).GetPets().put(_pet.GetPetType(), token.PetName);
|
||||
|
||||
getPlugin().getInventoryManager().addItemToInventory(null, getPlayer(), "Pet", _pet.GetPetType().toString(), 1);
|
||||
getPlugin().getInventoryManager().addItemToInventory(null, getPlayer(), _pet.GetPetType().toString(), 1);
|
||||
getShop().openPageForPlayer(getPlayer(), new Menu(getPlugin(), getShop(), getClientManager(), getDonationManager(), getPlayer()));
|
||||
}
|
||||
}, null, _petPurchase ? _pet : tag, CurrencyType.Coins, getPlayer()));
|
||||
|
@ -17,6 +17,7 @@ import net.minecraft.server.v1_8_R3.PacketPlayOutAnimation;
|
||||
import net.minecraft.server.v1_8_R3.EntityPlayer;
|
||||
import net.minecraft.server.v1_8_R3.Packet;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutBed;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutEntity;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityStatus;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutMapChunk;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutMapChunkBulk;
|
||||
@ -111,7 +112,14 @@ public class DisguiseManager extends MiniPlugin implements IPacketHandler
|
||||
{
|
||||
super("Disguise Manager", plugin);
|
||||
|
||||
packetHandler.addPacketHandler(this);
|
||||
packetHandler.addPacketHandler(this, PacketPlayOutAnimation.class, PacketPlayOutBed.class,
|
||||
PacketPlayOutEntityStatus.class, PacketPlayOutMapChunk.class, PacketPlayOutMapChunkBulk.class,
|
||||
PacketPlayOutNamedEntitySpawn.class, PacketPlayOutPlayerInfo.class,
|
||||
PacketPlayOutEntity.PacketPlayOutRelEntityMove.class, PacketPlayOutEntity.PacketPlayOutRelEntityMoveLook.class,
|
||||
PacketPlayOutPlayerInfo.PlayerInfoData.class, PacketPlayOutSpawnEntity.class, PacketPlayOutEntityVelocity.class,
|
||||
PacketPlayOutEntityDestroy.class, PacketPlayOutEntityTeleport.class, PacketPlayOutEntityMetadata.class,
|
||||
PacketPlayOutSpawnEntityLiving.class, PacketPlayOutUpdateAttributes.class, PacketPlayOutEntityEquipment.class,
|
||||
PacketPlayOutNamedSoundEffect.class);
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -1,7 +1,6 @@
|
||||
package mineplex.core.disguise.disguises;
|
||||
|
||||
import org.bukkit.entity.*;
|
||||
import org.spigotmc.ProtocolData;
|
||||
|
||||
public abstract class DisguiseAgeable extends DisguiseCreature
|
||||
{
|
||||
|
@ -1,7 +1,6 @@
|
||||
package mineplex.core.disguise.disguises;
|
||||
|
||||
import org.bukkit.entity.*;
|
||||
import org.spigotmc.ProtocolData;
|
||||
|
||||
public class DisguiseHorse extends DisguiseAnimal
|
||||
{
|
||||
|
@ -7,7 +7,6 @@ import org.bukkit.Location;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.spigotmc.ProtocolData;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
@ -18,6 +17,8 @@ import net.minecraft.server.v1_8_R3.Packet;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayInSettings;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutNamedEntitySpawn;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutPlayerInfo;
|
||||
import net.minecraft.server.v1_8_R3.WorldSettings;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutPlayerInfo.EnumPlayerInfoAction;
|
||||
|
||||
public class DisguisePlayer extends DisguiseHuman
|
||||
{
|
||||
@ -68,37 +69,21 @@ public class DisguisePlayer extends DisguiseHuman
|
||||
public boolean getSneaking()
|
||||
{
|
||||
return _sneaking;
|
||||
}
|
||||
|
||||
public Packet getOldInfoPacket(boolean add)
|
||||
{
|
||||
PacketPlayOutPlayerInfo playerInfo = new PacketPlayOutPlayerInfo();
|
||||
|
||||
if(Entity instanceof Player)
|
||||
{
|
||||
playerInfo.username = Entity.getName();
|
||||
playerInfo.action = add ? 0 : 4;
|
||||
playerInfo.ping = 90;
|
||||
playerInfo.player = ((CraftPlayer) (Player) Entity).getProfile();
|
||||
playerInfo.gamemode = 0;
|
||||
}
|
||||
|
||||
return playerInfo;
|
||||
}
|
||||
public Packet getNewInfoPacket(boolean add)
|
||||
{
|
||||
PacketPlayOutPlayerInfo newDisguiseInfo = new PacketPlayOutPlayerInfo();
|
||||
newDisguiseInfo.a = add ? EnumPlayerInfoAction.ADD_PLAYER : EnumPlayerInfoAction.REMOVE_PLAYER;
|
||||
|
||||
public Packet getNewInfoPacket(boolean add)
|
||||
{
|
||||
PacketPlayOutPlayerInfo newDisguiseInfo = new PacketPlayOutPlayerInfo();
|
||||
newDisguiseInfo.username = _profile.getName();
|
||||
newDisguiseInfo.action = add ? 0 : 4;
|
||||
newDisguiseInfo.ping = 90;
|
||||
newDisguiseInfo.player = _profile;
|
||||
newDisguiseInfo.gamemode = 0;
|
||||
PacketPlayOutPlayerInfo.PlayerInfoData info = newDisguiseInfo.new PlayerInfoData(_profile, 90,
|
||||
WorldSettings.EnumGamemode.SURVIVAL, null);
|
||||
|
||||
return newDisguiseInfo;
|
||||
}
|
||||
newDisguiseInfo.b.add(info);
|
||||
|
||||
return newDisguiseInfo;
|
||||
}
|
||||
|
||||
@SuppressWarnings("static-access")
|
||||
@Override
|
||||
public void UpdateDataWatcher()
|
||||
{
|
||||
@ -120,7 +105,7 @@ public class DisguisePlayer extends DisguiseHuman
|
||||
|
||||
PacketPlayOutNamedEntitySpawn packet = new PacketPlayOutNamedEntitySpawn();
|
||||
packet.a = Entity.getId();
|
||||
packet.b = _profile;
|
||||
packet.b = _profile.getId();
|
||||
packet.c = MathHelper.floor(loc.getX() * 32.0D);
|
||||
packet.d = MathHelper.floor(loc.getY() * 32.0D);
|
||||
packet.e = MathHelper.floor(loc.getZ() * 32.0D);
|
||||
@ -136,7 +121,7 @@ public class DisguisePlayer extends DisguiseHuman
|
||||
{
|
||||
PacketPlayOutNamedEntitySpawn packet = new PacketPlayOutNamedEntitySpawn();
|
||||
packet.a = Entity.getId();
|
||||
packet.b = _profile;
|
||||
packet.b = _profile.getId();
|
||||
packet.c = MathHelper.floor(Entity.locX * 32.0D);
|
||||
packet.d = MathHelper.floor(Entity.locY * 32.0D);
|
||||
packet.e = MathHelper.floor(Entity.locZ * 32.0D);
|
||||
|
@ -15,12 +15,12 @@ public class DisguiseWither extends DisguiseMonster
|
||||
DataWatcher.a(20, new Integer(0));
|
||||
}
|
||||
|
||||
public int ca()
|
||||
public int getInvulTime()
|
||||
{
|
||||
return DataWatcher.getInt(20);
|
||||
}
|
||||
|
||||
public void s(int i)
|
||||
public void setInvulTime(int i)
|
||||
{
|
||||
DataWatcher.watch(20, Integer.valueOf(i));
|
||||
}
|
||||
|
@ -1,88 +0,0 @@
|
||||
package mineplex.core.friend.ui;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import net.minecraft.server.v1_8_R3.EntityPlayer;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutPlayerInfo;
|
||||
import net.minecraft.server.v1_8_R3.WorldSettings;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
public class LineTracker
|
||||
{
|
||||
private String _line = null;
|
||||
private String _oldLine = null;
|
||||
private PacketPlayOutPlayerInfo _clearOldPacket;
|
||||
private PacketPlayOutPlayerInfo _addNewPacket;
|
||||
private PacketPlayOutPlayerInfo _clearNewPacket;
|
||||
|
||||
public LineTracker(String line)
|
||||
{
|
||||
setLine(line);
|
||||
}
|
||||
|
||||
public boolean setLine(String s)
|
||||
{
|
||||
if (s != null && s.length() > 16)
|
||||
s = s.substring(0, 16);
|
||||
|
||||
if (_line != null && _line.compareTo(s) == 0)
|
||||
return false;
|
||||
|
||||
_oldLine = _line;
|
||||
_line = s;
|
||||
|
||||
if (_oldLine != null)
|
||||
{
|
||||
_clearOldPacket = new PacketPlayOutPlayerInfo();
|
||||
PacketPlayOutPlayerInfo.PlayerInfoData data = new PacketPlayOutPlayerInfo.PlayerInfoData(new GameProfile(UUID.randomUUID(), _oldLine), 0, WorldSettings.EnumGamemode.SURVIVAL, null);
|
||||
_clearOldPacket.username = _oldLine;
|
||||
_clearOldPacket.action = PacketPlayOutPlayerInfo.REMOVE_PLAYER;
|
||||
_clearOldPacket.ping = 0;
|
||||
_clearOldPacket.player = new GameProfile(UUID.randomUUID(), _oldLine);
|
||||
}
|
||||
|
||||
if (_line != null)
|
||||
{
|
||||
_addNewPacket = new PacketPlayOutPlayerInfo();
|
||||
_addNewPacket.username = _line;
|
||||
_addNewPacket.action = PacketPlayOutPlayerInfo.ADD_PLAYER;
|
||||
_addNewPacket.ping = 0;
|
||||
_addNewPacket.player = new GameProfile(UUID.randomUUID(), _line);
|
||||
|
||||
_clearNewPacket = new PacketPlayOutPlayerInfo();
|
||||
_clearNewPacket.username = _line;
|
||||
_clearNewPacket.action = PacketPlayOutPlayerInfo.REMOVE_PLAYER;
|
||||
_clearNewPacket.ping = 0;
|
||||
_clearNewPacket.player = new GameProfile(UUID.randomUUID(), _line);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void displayLineToPlayer(EntityPlayer entityPlayer)
|
||||
{
|
||||
if (_oldLine != null)
|
||||
{
|
||||
entityPlayer.playerConnection.sendPacket(_clearOldPacket);
|
||||
}
|
||||
|
||||
if (_line != null)
|
||||
{
|
||||
entityPlayer.playerConnection.sendPacket(_addNewPacket);
|
||||
}
|
||||
}
|
||||
|
||||
public void removeLineForPlayer(EntityPlayer entityPlayer)
|
||||
{
|
||||
if (_line != null)
|
||||
{
|
||||
entityPlayer.playerConnection.sendPacket(_clearNewPacket);
|
||||
}
|
||||
}
|
||||
|
||||
public void clearOldLine()
|
||||
{
|
||||
_oldLine = null;
|
||||
}
|
||||
}
|
@ -1,116 +0,0 @@
|
||||
package mineplex.core.friend.ui;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
||||
import net.minecraft.server.v1_8_R3.EntityPlayer;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
|
||||
public class TabList implements Listener
|
||||
{
|
||||
private static int MAX_SLOTS = 64;
|
||||
private static int COLUMN_SLOTS = 16;
|
||||
|
||||
private static NautHashMap<Integer, String> _invisibleHolders = new NautHashMap<Integer, String>();
|
||||
|
||||
private NautHashMap<Integer, LineTracker> _tabSlots = new NautHashMap<Integer, LineTracker>();
|
||||
private HashSet<Integer> _updatedSlots = new HashSet<Integer>();
|
||||
|
||||
private boolean _update;
|
||||
|
||||
static {
|
||||
String spaces = "";
|
||||
|
||||
for (int i=0; i < MAX_SLOTS; i++)
|
||||
{
|
||||
int markerSymbol = i / COLUMN_SLOTS;
|
||||
String symbol = null;
|
||||
|
||||
if (i % COLUMN_SLOTS == 0)
|
||||
spaces = "";
|
||||
else
|
||||
spaces += " ";
|
||||
|
||||
if (markerSymbol == 0)
|
||||
{
|
||||
symbol = ChatColor.GREEN + "";
|
||||
}
|
||||
else if (markerSymbol == 1)
|
||||
{
|
||||
symbol = ChatColor.RED + "";
|
||||
}
|
||||
else if (markerSymbol == 2)
|
||||
{
|
||||
symbol = ChatColor.BLUE + "";
|
||||
}
|
||||
else if (markerSymbol == 3)
|
||||
{
|
||||
symbol = ChatColor.BLACK + "";
|
||||
}
|
||||
|
||||
_invisibleHolders.put(i, symbol + spaces);
|
||||
}
|
||||
}
|
||||
|
||||
public TabList()
|
||||
{
|
||||
for (Integer i=0; i < MAX_SLOTS; i++)
|
||||
{
|
||||
_tabSlots.put(i, new LineTracker(_invisibleHolders.get(i)));
|
||||
}
|
||||
}
|
||||
|
||||
public void set(int column, int row, String lineContent)
|
||||
{
|
||||
int index = row * 4 + column;
|
||||
|
||||
if (index >= MAX_SLOTS)
|
||||
return;
|
||||
|
||||
if (lineContent == null || lineContent.isEmpty())
|
||||
lineContent = _invisibleHolders.get(index);
|
||||
|
||||
if (_tabSlots.get(index).setLine(lineContent))
|
||||
{
|
||||
_updatedSlots.add(index);
|
||||
_update = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void refreshForPlayer(Player player)
|
||||
{
|
||||
EntityPlayer entityPlayer = ((CraftPlayer)player).getHandle();
|
||||
|
||||
int indexChanged = MAX_SLOTS;
|
||||
|
||||
for (int i=0; i < MAX_SLOTS; i++)
|
||||
{
|
||||
if (indexChanged == MAX_SLOTS && _updatedSlots.contains(i))
|
||||
{
|
||||
indexChanged = i;
|
||||
}
|
||||
else if (indexChanged != MAX_SLOTS && !_updatedSlots.contains(i))
|
||||
{
|
||||
_tabSlots.get(i).removeLineForPlayer(entityPlayer);
|
||||
}
|
||||
}
|
||||
|
||||
for (int i=indexChanged; i < MAX_SLOTS; i++)
|
||||
{
|
||||
_tabSlots.get(i).displayLineToPlayer(entityPlayer);
|
||||
}
|
||||
|
||||
_update = false;
|
||||
_updatedSlots.clear();
|
||||
}
|
||||
|
||||
public boolean shouldUpdate()
|
||||
{
|
||||
return _update;
|
||||
}
|
||||
}
|
@ -21,8 +21,8 @@ import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftFallingSand;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftFallingSand;
|
||||
import org.bukkit.entity.FallingBlock;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
|
@ -2,6 +2,7 @@ package mineplex.core.gadget.gadgets;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.Location;
|
||||
@ -111,7 +112,7 @@ public class ItemPaintbrush extends ItemGadget
|
||||
if (!UtilGear.isMat(player.getItemInHand(), Material.WOOD_SWORD))
|
||||
return;
|
||||
|
||||
Block block = player.getTargetBlock(null, 100);
|
||||
Block block = player.getTargetBlock((HashSet<Byte>)null, 100);
|
||||
if (block == null || block.getType() != Material.STAINED_CLAY)
|
||||
return;
|
||||
|
||||
@ -158,7 +159,7 @@ public class ItemPaintbrush extends ItemGadget
|
||||
continue;
|
||||
}
|
||||
|
||||
Block block = player.getTargetBlock(null, 100);
|
||||
Block block = player.getTargetBlock((HashSet<Byte>)null, 100);
|
||||
if (block == null || block.getType() != Material.WOOL)
|
||||
continue;
|
||||
|
||||
|
@ -1,7 +1,5 @@
|
||||
package mineplex.core.gadget.gadgets;
|
||||
|
||||
import net.minecraft.util.com.mojang.authlib.GameProfile;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
@ -9,6 +7,8 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.player.*;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.ProfileLoader;
|
||||
import mineplex.core.common.util.UUIDFetcher;
|
||||
|
@ -1,12 +1,12 @@
|
||||
package mineplex.core.gadget.gadgets;
|
||||
|
||||
import net.minecraft.util.com.mojang.authlib.GameProfile;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.player.*;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.ProfileLoader;
|
||||
import mineplex.core.common.util.UUIDFetcher;
|
||||
|
@ -4,11 +4,13 @@ import java.util.HashMap;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import net.minecraft.server.v1_8_R3.Block;
|
||||
import net.minecraft.server.v1_8_R3.BlockPosition;
|
||||
import net.minecraft.server.v1_8_R3.Blocks;
|
||||
import net.minecraft.server.v1_8_R3.Chunk;
|
||||
import net.minecraft.server.v1_8_R3.MaterialMapColor;
|
||||
import net.minecraft.server.v1_8_R3.MathHelper;
|
||||
import net.minecraft.server.v1_8_R3.WorldMap;
|
||||
|
||||
import com.google.common.collect.HashMultiset;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.collect.Multisets;
|
||||
@ -33,7 +35,7 @@ public class ChunkMapRenderer extends MapRenderer
|
||||
|
||||
public void setupMap(World world)
|
||||
{
|
||||
int i = 1 << worldmap.scale;
|
||||
/*int i = 1 << worldmap.scale;
|
||||
int j = worldmap.centerX;
|
||||
int k = worldmap.centerZ;
|
||||
int l = MathHelper.floor(0) / i + 64;
|
||||
@ -56,7 +58,7 @@ public class ChunkMapRenderer extends MapRenderer
|
||||
int i3 = (j / i + k1 - 64) * i;
|
||||
int j3 = (k / i + j2 - 64) * i;
|
||||
HashMultiset hashmultiset = HashMultiset.create();
|
||||
Chunk chunk = ((CraftWorld) world).getHandle().getChunkAtWorldCoords(i3, j3);
|
||||
Chunk chunk = ((CraftWorld) world).getHandle().getChunkAtWorldCoords(new BlockPosition(i3, 0, j3));
|
||||
|
||||
if (!chunk.isEmpty())
|
||||
{
|
||||
@ -160,7 +162,7 @@ public class ChunkMapRenderer extends MapRenderer
|
||||
|
||||
if (l1 <= i2)
|
||||
worldmap.flagDirty(k1, l1, i2);
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -14,7 +14,7 @@ import mineplex.core.updater.event.UpdateEvent;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftMinecart;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftMinecart;
|
||||
import org.bukkit.entity.Minecart;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
@ -577,7 +577,7 @@ public class NpcManager extends MiniPlugin
|
||||
Npc npc = getNpcByEntity(entity);
|
||||
if (npc != null)
|
||||
{
|
||||
UtilEnt.silence(entity, true);
|
||||
UtilEnt.silence((LivingEntity) entity, true);
|
||||
UtilEnt.ghost(entity, true, false);
|
||||
|
||||
if (npc.getDatabaseRecord().getRadius() == 0)
|
||||
|
@ -1,11 +1,9 @@
|
||||
package mineplex.core.packethandler;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.util.HashSet;
|
||||
|
||||
import net.minecraft.server.v1_8_R3.EnumProtocol;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map.Entry;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
@ -14,57 +12,51 @@ import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import com.mineplex.spigot.PacketProcessor;
|
||||
|
||||
import mineplex.core.MiniPlugin;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
|
||||
public class PacketHandler extends MiniPlugin
|
||||
{
|
||||
private NautHashMap<Player, PacketVerifier> _playerVerifierMap = new NautHashMap<Player, PacketVerifier>();
|
||||
private HashSet<IPacketHandler> _packetHandlers = new HashSet<IPacketHandler>();
|
||||
private HashMap<Class, ArrayList<IPacketHandler>> _forceMainThread = new HashMap<Class, ArrayList<IPacketHandler>>();
|
||||
private HashMap<Class, ArrayList<IPacketHandler>> _packetHandlers = new HashMap<Class, ArrayList<IPacketHandler>>();
|
||||
|
||||
public PacketHandler(JavaPlugin plugin)
|
||||
{
|
||||
super("PacketHandler", plugin);
|
||||
|
||||
try
|
||||
{
|
||||
// TODO Remove this when if incoming packets are ever listened to in the future.
|
||||
|
||||
for (Class clss : new Class[]
|
||||
{
|
||||
PacketPlayResourcePackStatus.class, PacketPlayUseEntity.class
|
||||
})
|
||||
{
|
||||
Field field = clss.getDeclaredField("_packetHandler");
|
||||
|
||||
field.setAccessible(true);
|
||||
field.set(null, this);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onPlayerJoin(PlayerJoinEvent event)
|
||||
{
|
||||
_playerVerifierMap.put(event.getPlayer(), new PacketVerifier(event.getPlayer()));
|
||||
((CraftPlayer) event.getPlayer()).getHandle().playerConnection.PacketVerifier.addPacketVerifier(_playerVerifierMap
|
||||
.get(event.getPlayer()));
|
||||
_playerVerifierMap.put(event.getPlayer(), new PacketVerifier(event.getPlayer(), this));
|
||||
|
||||
for (IPacketHandler packetHandler : _packetHandlers)
|
||||
((CraftPlayer) event.getPlayer()).getHandle().playerConnection.PacketVerifier.setPacketVerifier(_playerVerifierMap
|
||||
.get(event.getPlayer()));
|
||||
}
|
||||
|
||||
public boolean handlePacket(PacketInfo packetInfo)
|
||||
{
|
||||
if (!_packetHandlers.containsKey(packetInfo.getPacket().getClass()))
|
||||
{
|
||||
_playerVerifierMap.get(event.getPlayer()).addPacketHandler(packetHandler);
|
||||
System.err.print("Received packet " + packetInfo.getPacket().getClass() + " but am not listening for it!");
|
||||
return true;
|
||||
}
|
||||
|
||||
for (IPacketHandler handler : _packetHandlers.get(packetInfo.getPacket().getClass()))
|
||||
{
|
||||
handler.handle(packetInfo);
|
||||
}
|
||||
|
||||
return !packetInfo.isCancelled();
|
||||
}
|
||||
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onPlayerQuit(PlayerQuitEvent event)
|
||||
{
|
||||
((CraftPlayer) event.getPlayer()).getHandle().playerConnection.PacketVerifier.clearVerifiers();
|
||||
_playerVerifierMap.remove(event.getPlayer()).clearHandlers();
|
||||
((CraftPlayer) event.getPlayer()).getHandle().playerConnection.PacketVerifier.setPacketVerifier(null);
|
||||
}
|
||||
|
||||
public PacketVerifier getPacketVerifier(Player player)
|
||||
@ -72,28 +64,73 @@ public class PacketHandler extends MiniPlugin
|
||||
return _playerVerifierMap.get(player);
|
||||
}
|
||||
|
||||
public void addPacketHandler(IPacketHandler packetHandler)
|
||||
public void addPacketHandler(IPacketHandler packetHandler, Class... packetsToListen)
|
||||
{
|
||||
_packetHandlers.add(packetHandler);
|
||||
|
||||
for (PacketVerifier verifier : _playerVerifierMap.values())
|
||||
if (packetsToListen.length == 0)
|
||||
{
|
||||
verifier.addPacketHandler(packetHandler);
|
||||
throw new IllegalArgumentException("When registering a new packet listener, add the packets its going to listen to");
|
||||
}
|
||||
|
||||
addPacketHandler(packetHandler, false, packetsToListen);
|
||||
}
|
||||
|
||||
public HashSet<IPacketHandler> getPacketHandlers()
|
||||
/**
|
||||
* This should only be used for incoming packets
|
||||
*/
|
||||
public void addPacketHandler(IPacketHandler packetHandler, boolean forceMainThread, Class... packetsToListen)
|
||||
{
|
||||
return _packetHandlers;
|
||||
if (packetsToListen.length == 0)
|
||||
{
|
||||
throw new IllegalArgumentException("When registering a new packet listener, add the packets its going to listen to");
|
||||
}
|
||||
|
||||
for (Class c : packetsToListen)
|
||||
{
|
||||
if (forceMainThread)
|
||||
{
|
||||
if (!_forceMainThread.containsKey(c))
|
||||
{
|
||||
_forceMainThread.put(c, new ArrayList());
|
||||
}
|
||||
|
||||
_forceMainThread.get(c).add(packetHandler);
|
||||
}
|
||||
|
||||
if (!_packetHandlers.containsKey(c))
|
||||
{
|
||||
_packetHandlers.put(c, new ArrayList());
|
||||
}
|
||||
|
||||
_packetHandlers.get(c).add(packetHandler);
|
||||
PacketProcessor.addPacket(c, forceMainThread || _forceMainThread.containsKey(c));
|
||||
}
|
||||
}
|
||||
|
||||
public void removePacketHandler(IPacketHandler packetHandler)
|
||||
{
|
||||
_packetHandlers.remove(packetHandler);
|
||||
Iterator<Entry<Class, ArrayList<IPacketHandler>>> itel = _packetHandlers.entrySet().iterator();
|
||||
|
||||
for (PacketVerifier verifier : _playerVerifierMap.values())
|
||||
while (itel.hasNext())
|
||||
{
|
||||
verifier.removePacketHandler(packetHandler);
|
||||
Entry<Class, ArrayList<IPacketHandler>> entry = itel.next();
|
||||
|
||||
if (entry.getValue().remove(packetHandler))
|
||||
{
|
||||
if (_forceMainThread.containsKey(entry.getKey()) && _forceMainThread.get(entry.getKey()).remove(packetHandler))
|
||||
{
|
||||
if (_forceMainThread.get(entry.getKey()).isEmpty())
|
||||
{
|
||||
_forceMainThread.remove(entry.getKey());
|
||||
PacketProcessor.addPacket(entry.getKey(), false);
|
||||
}
|
||||
}
|
||||
|
||||
if (entry.getValue().isEmpty())
|
||||
{
|
||||
PacketProcessor.removePacket(entry.getKey());
|
||||
itel.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,15 +0,0 @@
|
||||
package mineplex.core.packethandler;
|
||||
|
||||
import net.minecraft.server.v1_8_R3.PacketDataSerializer;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayInBlockPlace;
|
||||
|
||||
public class PacketPlayInBlockPace extends PacketPlayInBlockPlace
|
||||
{
|
||||
|
||||
@Override
|
||||
public void a(PacketDataSerializer data)
|
||||
{
|
||||
super.a(WrappedPacketDataSerializer.wrapDataSerializer(data));
|
||||
}
|
||||
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
package mineplex.core.packethandler;
|
||||
|
||||
import net.minecraft.server.v1_7_R4.PacketDataSerializer;
|
||||
|
||||
public class PacketPlayInSetCreativeSlot extends net.minecraft.server.v1_7_R4.PacketPlayInSetCreativeSlot
|
||||
{
|
||||
|
||||
@Override
|
||||
public void a(PacketDataSerializer data)
|
||||
{
|
||||
super.a(WrappedPacketDataSerializer.wrapDataSerializer(data));
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
package mineplex.core.packethandler;
|
||||
|
||||
import net.minecraft.server.v1_7_R4.PacketDataSerializer;
|
||||
|
||||
public class PacketPlayInWindowClick extends net.minecraft.server.v1_7_R4.PacketPlayInWindowClick
|
||||
{
|
||||
|
||||
@Override
|
||||
public void a(PacketDataSerializer data)
|
||||
{
|
||||
super.a(WrappedPacketDataSerializer.wrapDataSerializer(data));
|
||||
}
|
||||
|
||||
}
|
@ -1,44 +0,0 @@
|
||||
package mineplex.core.packethandler;
|
||||
|
||||
import org.bukkit.entity.Entity;
|
||||
|
||||
import net.minecraft.server.v1_7_R4.Packet;
|
||||
import net.minecraft.server.v1_7_R4.PacketDataSerializer;
|
||||
import net.minecraft.server.v1_7_R4.PacketListener;
|
||||
|
||||
public class PacketPlayOutCamera extends Packet
|
||||
{
|
||||
public int a;
|
||||
|
||||
public PacketPlayOutCamera()
|
||||
{
|
||||
}
|
||||
|
||||
public PacketPlayOutCamera(int id)
|
||||
{
|
||||
a = id;
|
||||
}
|
||||
|
||||
public PacketPlayOutCamera(Entity paramEntity)
|
||||
{
|
||||
this.a = paramEntity.getEntityId();
|
||||
}
|
||||
|
||||
public void a(PacketDataSerializer paramPacketDataSerializer)
|
||||
{
|
||||
}
|
||||
|
||||
public void b(PacketDataSerializer paramPacketDataSerializer)
|
||||
{
|
||||
paramPacketDataSerializer.b(this.a);
|
||||
}
|
||||
|
||||
public void a(PacketListener paramPacketListenerPlayOut)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handle(PacketListener arg0)
|
||||
{
|
||||
}
|
||||
}
|
@ -1,83 +0,0 @@
|
||||
package mineplex.core.packethandler;
|
||||
|
||||
|
||||
import net.minecraft.server.v1_8_R3.PacketDataSerializer;
|
||||
import net.minecraft.server.v1_8_R3.PacketListenerPlayOut;
|
||||
|
||||
public class PacketPlayOutWorldBorder extends net.minecraft.server.v1_8_R3.PacketPlayOutWorldBorder
|
||||
{
|
||||
/**
|
||||
* @0 Set size - newRadius
|
||||
* @1 Gradual Size - oldRadius, newRadius, speed
|
||||
* @2 Set center - centerX, centerZ
|
||||
* @3 Initialize - All feields
|
||||
* @4 Set warning time - warningTime
|
||||
* @5 Set warning blocks - warningBlocks
|
||||
*/
|
||||
public int worldBorderType;
|
||||
// public int damageBoundry;
|
||||
public double centerX;
|
||||
public double centerZ;
|
||||
public double newRadius;
|
||||
public double oldRadius;
|
||||
/**
|
||||
* Time in millis until new border reached
|
||||
*/
|
||||
public long speed;
|
||||
public int warningBlocks;
|
||||
public int warningTime;
|
||||
|
||||
public PacketPlayOutWorldBorder()
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(PacketDataSerializer paramPacketDataSerializer)
|
||||
{
|
||||
}
|
||||
|
||||
@Override
|
||||
public void b(PacketDataSerializer paramPacketDataSerializer)
|
||||
{
|
||||
paramPacketDataSerializer.b(worldBorderType);
|
||||
|
||||
switch (worldBorderType)
|
||||
{
|
||||
case 0:
|
||||
paramPacketDataSerializer.writeDouble(newRadius * 2);
|
||||
break;
|
||||
case 1:
|
||||
paramPacketDataSerializer.writeDouble(oldRadius * 2);
|
||||
paramPacketDataSerializer.writeDouble(newRadius * 2);
|
||||
paramPacketDataSerializer.b((int) speed);
|
||||
break;
|
||||
case 2:
|
||||
paramPacketDataSerializer.writeDouble(centerX);
|
||||
paramPacketDataSerializer.writeDouble(centerZ);
|
||||
break;
|
||||
case 3:
|
||||
paramPacketDataSerializer.writeDouble(centerX);
|
||||
paramPacketDataSerializer.writeDouble(centerZ);
|
||||
paramPacketDataSerializer.writeDouble(oldRadius * 2);
|
||||
paramPacketDataSerializer.writeDouble(newRadius * 2);
|
||||
paramPacketDataSerializer.b((int) speed);
|
||||
|
||||
// paramPacketDataSerializer.b(damageBoundry);
|
||||
paramPacketDataSerializer.b(29999984);
|
||||
paramPacketDataSerializer.b(warningTime);
|
||||
paramPacketDataSerializer.b(warningBlocks);
|
||||
break;
|
||||
case 4:
|
||||
paramPacketDataSerializer.b(warningTime);
|
||||
break;
|
||||
case 5:
|
||||
paramPacketDataSerializer.b(warningBlocks);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(PacketListenerPlayOut arg0)
|
||||
{
|
||||
}
|
||||
}
|
@ -1,61 +0,0 @@
|
||||
package mineplex.core.packethandler;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import net.minecraft.server.v1_8_R3.Packet;
|
||||
import net.minecraft.server.v1_8_R3.PacketDataSerializer;
|
||||
import net.minecraft.server.v1_8_R3.PacketListenerPlayIn;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayInResourcePackStatus;
|
||||
import net.minecraft.server.v1_8_R3.PlayerConnection;
|
||||
|
||||
public class PacketPlayResourcePackStatus implements Packet<PacketListenerPlayIn>
|
||||
{
|
||||
public enum EnumResourcePackStatus
|
||||
{
|
||||
ACCEPTED,
|
||||
|
||||
DECLINED,
|
||||
|
||||
FAILED_DOWNLOAD,
|
||||
|
||||
LOADED;
|
||||
}
|
||||
|
||||
private static PacketHandler _packetHandler;
|
||||
|
||||
public String ResourcePackUrl;
|
||||
private int _resourcePackStatus;
|
||||
|
||||
public void a(PacketDataSerializer packetdataserializer) throws IOException
|
||||
{
|
||||
ResourcePackUrl = packetdataserializer.c(40);
|
||||
_resourcePackStatus = packetdataserializer.a(PacketPlayInResourcePackStatus.EnumResourcePackStatus.class).ordinal();
|
||||
}
|
||||
|
||||
public void b(PacketDataSerializer packetdataserializer) throws IOException
|
||||
{
|
||||
}
|
||||
|
||||
public EnumResourcePackStatus getResourcePackStatus()
|
||||
{
|
||||
return EnumResourcePackStatus.values()[_resourcePackStatus];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void a(PacketListenerPlayIn packetListener)
|
||||
{
|
||||
Player player = ((PlayerConnection) packetListener).getPlayer();
|
||||
PacketVerifier verifier = _packetHandler.getPacketVerifier(player);
|
||||
|
||||
PacketInfo packetInfo = new PacketInfo(player, this, verifier);
|
||||
|
||||
for (IPacketHandler handler : _packetHandler.getPacketHandlers())
|
||||
{
|
||||
handler.handle(packetInfo);
|
||||
}
|
||||
// ((PlayerConnection) packetListener).PacketVerifier
|
||||
// .processPacket(this, ((PlayerConnection) packetListener).networkManager);
|
||||
|
||||
}
|
||||
}
|
@ -1,33 +0,0 @@
|
||||
package mineplex.core.packethandler;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import net.minecraft.server.v1_7_R4.PacketListener;
|
||||
import net.minecraft.server.v1_7_R4.PacketPlayInListener;
|
||||
import net.minecraft.server.v1_7_R4.PacketPlayInUseEntity;
|
||||
import net.minecraft.server.v1_7_R4.PlayerConnection;
|
||||
|
||||
public class PacketPlayUseEntity extends PacketPlayInUseEntity
|
||||
{
|
||||
private static PacketHandler _packetHandler;
|
||||
|
||||
@Override
|
||||
public void handle(PacketListener packetlistener)
|
||||
{
|
||||
Player player = ((PlayerConnection) packetlistener).getPlayer();
|
||||
|
||||
PacketVerifier verifier = _packetHandler.getPacketVerifier(player);
|
||||
|
||||
PacketInfo packetInfo = new PacketInfo(player, this, verifier);
|
||||
|
||||
for (IPacketHandler handler : _packetHandler.getPacketHandlers())
|
||||
{
|
||||
handler.handle(packetInfo);
|
||||
}
|
||||
|
||||
if (!packetInfo.isCancelled())
|
||||
{
|
||||
a((PacketPlayInListener) packetlistener);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,82 +1,41 @@
|
||||
package mineplex.core.packethandler;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import net.minecraft.server.v1_8_R3.IPacketVerifier;
|
||||
import com.mineplex.spigot.IPacketVerifier;
|
||||
|
||||
import net.minecraft.server.v1_8_R3.Packet;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutEntityDestroy;
|
||||
|
||||
public class PacketVerifier implements IPacketVerifier
|
||||
{
|
||||
private static Field _destroyId;
|
||||
private Player _owner;
|
||||
|
||||
private List<IPacketHandler> _packetHandlers = new ArrayList<IPacketHandler>();
|
||||
private PacketHandler _packetHandler;
|
||||
|
||||
public PacketVerifier(Player owner)
|
||||
{
|
||||
_owner = owner;
|
||||
|
||||
if (_destroyId == null)
|
||||
{
|
||||
try
|
||||
{
|
||||
_destroyId = PacketPlayOutEntityDestroy.class.getDeclaredField("a");
|
||||
_destroyId.setAccessible(true);
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
System.out.println("Field exception in CustomTagFix : ");
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean verify(Packet o)
|
||||
{
|
||||
PacketInfo packetInfo = new PacketInfo(_owner, o, this);
|
||||
|
||||
for (IPacketHandler handler : _packetHandlers)
|
||||
{
|
||||
handler.handle(packetInfo);
|
||||
}
|
||||
|
||||
return !packetInfo.isCancelled();
|
||||
}
|
||||
|
||||
public void bypassProcess(Packet packet)
|
||||
{
|
||||
((CraftPlayer)_owner).getHandle().playerConnection.networkManager.handle(packet);
|
||||
}
|
||||
|
||||
public void Deactivate()
|
||||
{
|
||||
public PacketVerifier(Player player, PacketHandler packetHandler)
|
||||
{
|
||||
_owner = player;
|
||||
_packetHandler = packetHandler;
|
||||
}
|
||||
|
||||
public void bypassProcess(Packet packet)
|
||||
{
|
||||
((CraftPlayer) _owner).getHandle().playerConnection.networkManager.handle(packet);
|
||||
}
|
||||
|
||||
public void Deactivate()
|
||||
{
|
||||
_owner = null;
|
||||
}
|
||||
}
|
||||
|
||||
public void process(Packet packet)
|
||||
{
|
||||
((CraftPlayer)_owner).getHandle().playerConnection.sendPacket(packet);
|
||||
((CraftPlayer) _owner).getHandle().playerConnection.sendPacket(packet);
|
||||
}
|
||||
|
||||
public void clearHandlers()
|
||||
@Override
|
||||
public boolean handlePacket(Packet packet)
|
||||
{
|
||||
_packetHandlers.clear();
|
||||
return _packetHandler.handlePacket(new PacketInfo(_owner, packet, this));
|
||||
}
|
||||
|
||||
public void addPacketHandler(IPacketHandler packetHandler)
|
||||
{
|
||||
_packetHandlers.add(packetHandler);
|
||||
}
|
||||
|
||||
public void removePacketHandler(IPacketHandler packetHandler)
|
||||
{
|
||||
_packetHandlers.remove(packetHandler);
|
||||
}
|
||||
}
|
||||
|
@ -1,85 +0,0 @@
|
||||
package mineplex.core.packethandler;
|
||||
|
||||
import java.io.DataInputStream;
|
||||
import java.io.InputStream;
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import org.bukkit.craftbukkit.v1_7_R4.inventory.CraftItemStack;
|
||||
import org.spigotmc.LimitStream;
|
||||
|
||||
import net.minecraft.server.v1_7_R4.Item;
|
||||
import net.minecraft.server.v1_7_R4.ItemStack;
|
||||
import net.minecraft.server.v1_7_R4.NBTCompressedStreamTools;
|
||||
import net.minecraft.server.v1_7_R4.NBTReadLimiter;
|
||||
import net.minecraft.server.v1_7_R4.NBTTagCompound;
|
||||
import net.minecraft.server.v1_7_R4.PacketDataSerializer;
|
||||
import net.minecraft.util.io.netty.buffer.ByteBuf;
|
||||
import net.minecraft.util.io.netty.buffer.ByteBufInputStream;
|
||||
|
||||
public class WrappedPacketDataSerializer extends PacketDataSerializer
|
||||
{
|
||||
|
||||
public WrappedPacketDataSerializer(ByteBuf bytebuf)
|
||||
{
|
||||
super(bytebuf);
|
||||
}
|
||||
|
||||
public WrappedPacketDataSerializer(ByteBuf bytebuf, int version)
|
||||
{
|
||||
super(bytebuf, version);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack c()
|
||||
{
|
||||
try {
|
||||
ItemStack itemstack = null;
|
||||
short short0 = readShort();
|
||||
if (short0 >= 0)
|
||||
{
|
||||
byte b0 = readByte();
|
||||
short short1 = readShort();
|
||||
|
||||
itemstack = new ItemStack(Item.getById(short0), b0, short1);
|
||||
itemstack.setTag(b());
|
||||
if (itemstack.getTag() != null) {
|
||||
CraftItemStack.setItemMeta(itemstack, CraftItemStack.getItemMeta(itemstack));
|
||||
}
|
||||
}
|
||||
return itemstack;
|
||||
} catch (Exception e) {
|
||||
this.clear();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public NBTTagCompound b()
|
||||
{
|
||||
int i = readerIndex();
|
||||
byte b0 = readByte();
|
||||
if (b0 == 0) {
|
||||
return null;
|
||||
}
|
||||
readerIndex(i);
|
||||
ByteBufInputStream data = new ByteBufInputStream(this);
|
||||
NBTReadLimiter nbtreadlimiter = new NBTReadLimiter(2097152L);
|
||||
return NBTCompressedStreamTools.a(new DataInputStream(new LimitStream((InputStream)data, nbtreadlimiter)), nbtreadlimiter);
|
||||
}
|
||||
|
||||
public static WrappedPacketDataSerializer wrapDataSerializer(PacketDataSerializer data) {
|
||||
try
|
||||
{
|
||||
Field a = data.getClass().getDeclaredField("a");
|
||||
a.setAccessible(true);
|
||||
ByteBuf buff = (ByteBuf) a.get(data);
|
||||
WrappedPacketDataSerializer w = new WrappedPacketDataSerializer(buff, data.version);
|
||||
return w;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
@ -7,7 +7,6 @@ import java.util.Map.Entry;
|
||||
import mineplex.core.MiniClientPlugin;
|
||||
import mineplex.core.pet.repository.PetRepository;
|
||||
import mineplex.core.pet.repository.token.ClientPetTokenWrapper;
|
||||
import mineplex.core.pet.types.CustomWither;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
@ -18,6 +17,7 @@ import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.common.util.UtilEnt;
|
||||
import mineplex.core.common.util.UtilServer;
|
||||
import mineplex.core.disguise.DisguiseManager;
|
||||
import mineplex.core.disguise.disguises.DisguiseWither;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import net.minecraft.server.v1_8_R3.EntityCreature;
|
||||
import net.minecraft.server.v1_8_R3.EntityWither;
|
||||
@ -28,7 +28,9 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
|
||||
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftCreature;
|
||||
import org.bukkit.entity.Ageable;
|
||||
@ -169,15 +171,18 @@ public class PetManager extends MiniClientPlugin<PetClient>
|
||||
|
||||
if (entityType == EntityType.WITHER)
|
||||
{
|
||||
_creatureModule.SetForce(true);
|
||||
EntityWither wither = new CustomWither(((CraftWorld) location.getWorld()).getHandle());
|
||||
wither.Silent = true;
|
||||
wither.setLocation(location.getX(), location.getY(), location.getZ(), 0, 0);
|
||||
((CraftWorld) location.getWorld()).getHandle().addEntity(wither, SpawnReason.CUSTOM);
|
||||
pet = (Creature) wither.getBukkitEntity();
|
||||
_creatureModule.SetForce(false);
|
||||
|
||||
Entity silverfish = _creatureModule.SpawnEntity(location, EntityType.SILVERFISH);
|
||||
_creatureModule.SetForce(true);
|
||||
|
||||
DisguiseWither witherDisguise = new DisguiseWither(null);
|
||||
|
||||
witherDisguise.setInvulTime(530);
|
||||
|
||||
_disguiseManager.addFutureDisguise(witherDisguise);
|
||||
|
||||
pet = (Creature) location.getWorld().spawnEntity(location, EntityType.SILVERFISH);
|
||||
_creatureModule.SetForce(false);
|
||||
|
||||
Entity silverfish = _creatureModule.SpawnEntity(location, EntityType.SILVERFISH);
|
||||
UtilEnt.Vegetate(silverfish, true);
|
||||
((LivingEntity) silverfish).addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, Integer.MAX_VALUE, 0));
|
||||
pet.setPassenger(silverfish);
|
||||
|
@ -2,36 +2,65 @@ package mineplex.core.pet.repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
|
||||
import mineplex.core.database.DBPool;
|
||||
import mineplex.core.database.RepositoryBase;
|
||||
import mineplex.core.database.column.ColumnInt;
|
||||
import mineplex.core.database.column.ColumnVarChar;
|
||||
import mineplex.core.pet.repository.token.PetChangeToken;
|
||||
import mineplex.core.pet.repository.token.PetExtraToken;
|
||||
import mineplex.core.pet.repository.token.PetSalesToken;
|
||||
import mineplex.core.server.remotecall.AsyncJsonWebCall;
|
||||
import mineplex.core.server.remotecall.JsonWebCall;
|
||||
|
||||
public class PetRepository
|
||||
public class PetRepository extends RepositoryBase
|
||||
{
|
||||
private String _webAddress;
|
||||
|
||||
public PetRepository(String webAddress)
|
||||
public PetRepository(JavaPlugin plugin, String webAddress)
|
||||
{
|
||||
super(plugin, DBPool.ACCOUNT);
|
||||
|
||||
_webAddress = webAddress;
|
||||
}
|
||||
|
||||
public List<PetSalesToken> GetPets(List<PetSalesToken> petTokens)
|
||||
{
|
||||
return new JsonWebCall(_webAddress + "Pets/GetPets").Execute(new TypeToken<List<PetSalesToken>>(){}.getType(), petTokens);
|
||||
}
|
||||
|
||||
public void AddPet(PetChangeToken token)
|
||||
public void AddPet(final PetChangeToken token)
|
||||
{
|
||||
new AsyncJsonWebCall(_webAddress + "Pets/AddPet").Execute(token);
|
||||
|
||||
Plugin.getServer().getScheduler().runTaskAsynchronously(Plugin, new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
if (token.PetId == 0 || token.AccountId == 0)
|
||||
return;
|
||||
|
||||
executeInsert("INSERT INTO accountPets(petName, petId, accountId) VALUES (?, ?, ?);", null, new ColumnVarChar("petName", 32, token.PetName)
|
||||
, new ColumnInt("petId", token.PetId)
|
||||
, new ColumnInt("accountId", token.AccountId));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void RemovePet(PetChangeToken token)
|
||||
public void RemovePet(final PetChangeToken token)
|
||||
{
|
||||
new AsyncJsonWebCall(_webAddress + "Pets/RemovePet").Execute(token);
|
||||
|
||||
Plugin.getServer().getScheduler().runTaskAsynchronously(Plugin, new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
if (token.PetId == 0 || token.AccountId == 0)
|
||||
return;
|
||||
|
||||
executeUpdate("DELETE FROM accountPets WHERE petId = ? AND accountId = ?;"
|
||||
, new ColumnInt("petId", token.PetId)
|
||||
, new ColumnInt("accountId", token.AccountId));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public List<PetExtraToken> GetPetExtras(List<PetExtraToken> petExtraTokens)
|
||||
@ -39,18 +68,38 @@ public class PetRepository
|
||||
return new JsonWebCall(_webAddress + "Pets/GetPetExtras").Execute(new TypeToken<List<PetExtraToken>>(){}.getType(), petExtraTokens);
|
||||
}
|
||||
|
||||
public void UpdatePet(PetChangeToken token)
|
||||
public void UpdatePet(final PetChangeToken token)
|
||||
{
|
||||
new AsyncJsonWebCall(_webAddress + "Pets/UpdatePet").Execute(token);
|
||||
|
||||
Plugin.getServer().getScheduler().runTaskAsynchronously(Plugin, new Runnable()
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
if (token.PetId == 0 || token.AccountId == 0)
|
||||
return;
|
||||
|
||||
int rowsChanged = executeUpdate("UPDATE accountPets SET petName = ? WHERE petId = ? AND accountId = ?;", new ColumnVarChar("petName", 32, token.PetName)
|
||||
, new ColumnInt("petId", token.PetId)
|
||||
, new ColumnInt("accountId", token.AccountId));
|
||||
|
||||
if (rowsChanged < 1)
|
||||
{
|
||||
executeInsert("INSERT INTO accountPets(petName, petId, accountId) VALUES (?, ?, ?);", null, new ColumnVarChar("petName", 32, token.PetName)
|
||||
, new ColumnInt("petId", token.PetId)
|
||||
, new ColumnInt("accountId", token.AccountId));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void AddPetNameTag(String name)
|
||||
@Override
|
||||
protected void initialize()
|
||||
{
|
||||
new AsyncJsonWebCall(_webAddress + "Pets/AddPetNameTag").Execute(name);
|
||||
}
|
||||
|
||||
public void RemovePetNameTag(String name)
|
||||
@Override
|
||||
protected void update()
|
||||
{
|
||||
new AsyncJsonWebCall(_webAddress + "Pets/RemovePetNameTag").Execute(name);
|
||||
}
|
||||
}
|
||||
|
@ -1,196 +0,0 @@
|
||||
package mineplex.core.pet.types;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.HashMap;
|
||||
|
||||
import org.bukkit.craftbukkit.v1_8_R3.SpigotTimings;
|
||||
import org.bukkit.entity.EntityType;
|
||||
|
||||
import net.minecraft.server.v1_8_R3.EntityTypes;
|
||||
import net.minecraft.server.v1_8_R3.EntityWither;
|
||||
import net.minecraft.server.v1_8_R3.MathHelper;
|
||||
import net.minecraft.server.v1_8_R3.World;
|
||||
|
||||
public class CustomWither extends EntityWither
|
||||
{
|
||||
static
|
||||
{
|
||||
try
|
||||
{
|
||||
Field f = EntityTypes.class.getDeclaredField("f");
|
||||
f.setAccessible(true);
|
||||
HashMap map = (HashMap) f.get(null);
|
||||
map.put(CustomWither.class, (int) EntityType.WITHER.getTypeId());
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
private int bq;
|
||||
|
||||
public CustomWither(World world)
|
||||
{
|
||||
super(world);
|
||||
s(530);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void bn()
|
||||
{
|
||||
this.aU += 1;
|
||||
this.world.methodProfiler.a("checkDespawn");
|
||||
w();
|
||||
this.world.methodProfiler.b();
|
||||
|
||||
if (this.fromMobSpawner)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
this.world.methodProfiler.a("sensing");
|
||||
this.getEntitySenses().a();
|
||||
this.world.methodProfiler.b();
|
||||
this.world.methodProfiler.a("targetSelector");
|
||||
this.targetSelector.a();
|
||||
this.world.methodProfiler.b();
|
||||
this.world.methodProfiler.a("goalSelector");
|
||||
this.goalSelector.a();
|
||||
this.world.methodProfiler.b();
|
||||
this.world.methodProfiler.a("navigation");
|
||||
this.getNavigation().f();
|
||||
this.world.methodProfiler.b();
|
||||
this.world.methodProfiler.a("mob tick");
|
||||
bp();
|
||||
this.world.methodProfiler.b();
|
||||
this.world.methodProfiler.a("controls");
|
||||
this.world.methodProfiler.a("move");
|
||||
this.getControllerMove().c();
|
||||
this.world.methodProfiler.c("look");
|
||||
this.getControllerLook().a();
|
||||
this.world.methodProfiler.c("jump");
|
||||
this.getControllerJump().b();
|
||||
this.world.methodProfiler.b();
|
||||
this.world.methodProfiler.b();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void e()
|
||||
{
|
||||
if (this.bq > 0)
|
||||
{
|
||||
this.bq -= 1;
|
||||
}
|
||||
|
||||
if (this.bg > 0)
|
||||
{
|
||||
double d0 = this.locX + (this.bh - this.locX) / this.bg;
|
||||
double d1 = this.locY + (this.bi - this.locY) / this.bg;
|
||||
double d2 = this.locZ + (this.bj - this.locZ) / this.bg;
|
||||
double d3 = MathHelper.g(this.bk - this.yaw);
|
||||
|
||||
this.yaw = ((float) (this.yaw + d3 / this.bg));
|
||||
this.pitch = ((float) (this.pitch + (this.bl - this.pitch) / this.bg));
|
||||
this.bg -= 1;
|
||||
|
||||
if (!this.Vegetated)
|
||||
{
|
||||
setPosition(d0, d1, d2);
|
||||
}
|
||||
b(this.yaw, this.pitch);
|
||||
}
|
||||
else if (!br())
|
||||
{
|
||||
this.motX *= 0.98D;
|
||||
this.motY *= 0.98D;
|
||||
this.motZ *= 0.98D;
|
||||
}
|
||||
|
||||
if (Math.abs(this.motX) < 0.005D)
|
||||
{
|
||||
this.motX = 0.0D;
|
||||
}
|
||||
|
||||
if (Math.abs(this.motY) < 0.005D)
|
||||
{
|
||||
this.motY = 0.0D;
|
||||
}
|
||||
|
||||
if (Math.abs(this.motZ) < 0.005D)
|
||||
{
|
||||
this.motZ = 0.0D;
|
||||
}
|
||||
|
||||
this.world.methodProfiler.a("ai");
|
||||
SpigotTimings.timerEntityAI.startTiming();
|
||||
if (bh())
|
||||
{
|
||||
this.bc = false;
|
||||
this.bd = 0.0F;
|
||||
this.be = 0.0F;
|
||||
this.bf = 0.0F;
|
||||
}
|
||||
else if (br())
|
||||
{
|
||||
if (bk())
|
||||
{
|
||||
this.world.methodProfiler.a("newAi");
|
||||
bn();
|
||||
this.world.methodProfiler.b();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.world.methodProfiler.a("oldAi");
|
||||
bq();
|
||||
this.world.methodProfiler.b();
|
||||
this.aO = this.yaw;
|
||||
}
|
||||
}
|
||||
SpigotTimings.timerEntityAI.stopTiming();
|
||||
|
||||
this.world.methodProfiler.b();
|
||||
this.world.methodProfiler.a("jump");
|
||||
if (this.bc)
|
||||
{
|
||||
if ((!M()) && (!P()))
|
||||
{
|
||||
if ((this.onGround) && (this.bq == 0))
|
||||
{
|
||||
bj();
|
||||
this.bq = 10;
|
||||
}
|
||||
}
|
||||
else
|
||||
this.motY += 0.03999999910593033D;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.bq = 0;
|
||||
}
|
||||
|
||||
this.world.methodProfiler.b();
|
||||
this.world.methodProfiler.a("travel");
|
||||
this.bd *= 0.98F;
|
||||
this.be *= 0.98F;
|
||||
this.bf *= 0.9F;
|
||||
SpigotTimings.timerEntityAIMove.startTiming();
|
||||
e(this.bd, this.be);
|
||||
SpigotTimings.timerEntityAIMove.stopTiming();
|
||||
this.world.methodProfiler.b();
|
||||
this.world.methodProfiler.a("push");
|
||||
if (!this.world.isStatic)
|
||||
{
|
||||
SpigotTimings.timerEntityAICollision.startTiming();
|
||||
bo();
|
||||
SpigotTimings.timerEntityAICollision.stopTiming();
|
||||
}
|
||||
|
||||
this.world.methodProfiler.b();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected float bf()
|
||||
{
|
||||
return 0.4F;
|
||||
}
|
||||
}
|
@ -136,7 +136,7 @@ public class PunishPage extends CraftInventoryCustom implements Listener
|
||||
examplePrefixNote + "Give Warning if 0 Past Offences and 0 Warnings.",
|
||||
}, 1, false, true), new PunishButton(this, Category.ChatOffense, 1, false, getDuration(Category.ChatOffense, 1, offenseMap)));
|
||||
|
||||
if (_plugin.GetClients().Get(_player).GetRank().Has(Rank.MODERATOR))
|
||||
if (_plugin.GetClients().Get(_player).GetRank().has(Rank.MODERATOR))
|
||||
{
|
||||
AddButton(28, new ShopItem(Material.INK_SACK, (byte)11, "Severity 2", new String[] {
|
||||
ChatColor.RESET + "Past Offences: " + ChatColor.YELLOW + offenseMap.get(Category.ChatOffense).get(2),
|
||||
@ -220,7 +220,7 @@ public class PunishPage extends CraftInventoryCustom implements Listener
|
||||
examplePrefixEx + " Player Radar",
|
||||
}, 1, false, true), new PunishButton(this, Category.Hacking, 1, true, getDuration(Category.Hacking, 1, offenseMap)));
|
||||
|
||||
if (_plugin.GetClients().Get(_player).GetRank().Has(Rank.MODERATOR))
|
||||
if (_plugin.GetClients().Get(_player).GetRank().has(Rank.MODERATOR))
|
||||
{
|
||||
|
||||
AddButton(32, new ShopItem(Material.INK_SACK, (byte)11, "Severity 2",new String[]
|
||||
@ -275,7 +275,7 @@ public class PunishPage extends CraftInventoryCustom implements Listener
|
||||
|
||||
}, 1, false, true), new PunishButton(this, Category.Warning, 1, false, 0));
|
||||
|
||||
if (_plugin.GetClients().Get(_player).GetRank().Has(Rank.MODERATOR))
|
||||
if (_plugin.GetClients().Get(_player).GetRank().has(Rank.MODERATOR))
|
||||
{
|
||||
AddButton(34, new ShopItem(Material.REDSTONE_BLOCK, (byte)0, "Permanent Ban", new String[] {
|
||||
ChatColor.RESET + "Ban Duration: " + ChatColor.YELLOW + "Permanent",
|
||||
|
@ -4,7 +4,6 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import mineplex.core.CustomTagFix;
|
||||
import mineplex.core.TablistFix;
|
||||
import mineplex.core.account.CoreClientManager;
|
||||
import mineplex.core.achievement.AchievementManager;
|
||||
import mineplex.core.antihack.AntiHack;
|
||||
@ -134,7 +133,6 @@ public class Hub extends JavaPlugin implements IRelation
|
||||
new MemoryFix(this);
|
||||
new FileUpdater(this, portal, serverStatusManager.getCurrentServerName(), serverStatusManager.getRegion());
|
||||
new CustomTagFix(this, packetHandler);
|
||||
new TablistFix(this);
|
||||
new ResPackManager(new ResUnloadCheck()
|
||||
{
|
||||
public boolean canSendUnload(Player player)
|
||||
|
@ -80,7 +80,7 @@ import org.bukkit.ChatColor;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.CraftWorld;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.CraftWorld;
|
||||
import org.bukkit.entity.Egg;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
|
@ -4,7 +4,6 @@ import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
|
@ -20,12 +20,13 @@ import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.craftbukkit.libs.com.google.gson.Gson;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
|
||||
public class ClassManager extends MiniClientPlugin<ClientClass> implements IClassFactory
|
||||
{
|
||||
private CoreClientManager _clientManager;
|
||||
|
@ -2,7 +2,7 @@ package mineplex.minecraft.game.classcombat.Class.repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.craftbukkit.libs.com.google.gson.reflect.TypeToken;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
|
||||
import mineplex.core.server.remotecall.AsyncJsonWebCall;
|
||||
import mineplex.core.server.remotecall.JsonWebCall;
|
||||
@ -12,18 +12,20 @@ import mineplex.minecraft.game.classcombat.Class.repository.token.CustomBuildTok
|
||||
public class ClassRepository
|
||||
{
|
||||
private String _webAddress;
|
||||
|
||||
|
||||
public ClassRepository(String webAddress)
|
||||
{
|
||||
_webAddress = webAddress;
|
||||
}
|
||||
|
||||
public List<ClassToken> GetClasses(List<ClassToken> pvpClasses)
|
||||
public List<ClassToken> GetClasses(List<ClassToken> pvpClasses)
|
||||
{
|
||||
return new JsonWebCall(_webAddress + "Dominate/GetClasses").Execute(new TypeToken<List<ClassToken>>(){}.getType(), pvpClasses);
|
||||
return new JsonWebCall(_webAddress + "Dominate/GetClasses").Execute(new TypeToken<List<ClassToken>>()
|
||||
{
|
||||
}.getType(), pvpClasses);
|
||||
}
|
||||
|
||||
public void SaveCustomBuild(CustomBuildToken token)
|
||||
|
||||
public void SaveCustomBuild(CustomBuildToken token)
|
||||
{
|
||||
new AsyncJsonWebCall(_webAddress + "PlayerAccount/SaveCustomBuild").Execute(token);
|
||||
}
|
||||
|
@ -2,13 +2,12 @@ package mineplex.minecraft.game.classcombat.Skill.Assassin;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import net.minecraft.util.com.mojang.authlib.GameProfile;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Skeleton;
|
||||
@ -167,7 +166,7 @@ public class Illusion extends SkillActive
|
||||
UtilAction.velocity(skel, 0.6, 0.4, 1, false);
|
||||
}
|
||||
|
||||
UtilEnt.CreatureMoveFast(skel, cur.getTargetBlock(null, 0).getLocation().add(0, 2, 0), 1.8f);
|
||||
UtilEnt.CreatureMoveFast(skel, cur.getTargetBlock((HashSet<Byte>)null, 0).getLocation().add(0, 2, 0), 1.8f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -167,7 +167,7 @@ public class Rupture extends SkillActiveCharge
|
||||
|
||||
public void MoveRupture(Player cur)
|
||||
{
|
||||
Block targetBlock = cur.getTargetBlock(null, 0);
|
||||
Block targetBlock = cur.getTargetBlock((HashSet<Byte>)null, 0);
|
||||
if (targetBlock == null) return;
|
||||
|
||||
//Aiming at sky
|
||||
|
@ -14,7 +14,6 @@ import mineplex.core.updater.event.UpdateEvent;
|
||||
import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
|
||||
import org.bukkit.entity.Arrow;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
@ -2,7 +2,7 @@ package mineplex.minecraft.game.classcombat.Skill.repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.craftbukkit.libs.com.google.gson.reflect.TypeToken;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
|
||||
import mineplex.core.server.remotecall.JsonWebCall;
|
||||
import mineplex.minecraft.game.classcombat.Skill.repository.token.SkillToken;
|
||||
|
@ -3,7 +3,7 @@ package mineplex.minecraft.game.classcombat.item;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
@ -8,7 +8,7 @@ import org.bukkit.GameMode;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -8,7 +8,7 @@ import org.bukkit.GameMode;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -4,7 +4,7 @@ import org.bukkit.Effect;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.player.PlayerInteractEvent;
|
||||
|
@ -2,7 +2,7 @@ package mineplex.minecraft.game.classcombat.item.repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.bukkit.craftbukkit.libs.com.google.gson.reflect.TypeToken;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
|
||||
import mineplex.core.server.remotecall.JsonWebCall;
|
||||
|
||||
|
@ -2,7 +2,7 @@ package mineplex.minecraft.game.classcombat.shop;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
|
@ -19,7 +19,6 @@ import org.bukkit.event.Listener;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.entity.EntityTargetEvent;
|
||||
import org.bukkit.potion.PotionEffectType;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
||||
|
||||
public class ConditionEffect implements Listener
|
||||
{
|
||||
|
@ -17,17 +17,20 @@ import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
|
||||
import mineplex.core.common.util.UtilMath;
|
||||
import mineplex.core.explosion.ExplosionEvent;
|
||||
import mineplex.minecraft.game.core.damage.DamageManager;
|
||||
import net.minecraft.server.v1_8_R3.AxisAlignedBB;
|
||||
import net.minecraft.server.v1_8_R3.Block;
|
||||
import net.minecraft.server.v1_8_R3.BlockPosition;
|
||||
import net.minecraft.server.v1_8_R3.Blocks;
|
||||
import net.minecraft.server.v1_8_R3.ChunkPosition;
|
||||
import net.minecraft.server.v1_8_R3.DamageSource;
|
||||
import net.minecraft.server.v1_8_R3.EnchantmentProtection;
|
||||
import net.minecraft.server.v1_8_R3.Entity;
|
||||
import net.minecraft.server.v1_8_R3.EntityHuman;
|
||||
import net.minecraft.server.v1_8_R3.EnumParticle;
|
||||
import net.minecraft.server.v1_8_R3.Explosion;
|
||||
import net.minecraft.server.v1_8_R3.IBlockData;
|
||||
import net.minecraft.server.v1_8_R3.Material;
|
||||
import net.minecraft.server.v1_8_R3.MathHelper;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutExplosion;
|
||||
@ -38,7 +41,6 @@ public class CustomExplosion extends Explosion
|
||||
{
|
||||
private Player _owner;
|
||||
private boolean _damageOwner;
|
||||
private int _i = 16;
|
||||
private World _world;
|
||||
private DamageManager _manager;
|
||||
private String _damageReason;
|
||||
@ -54,12 +56,18 @@ public class CustomExplosion extends Explosion
|
||||
private int _maxFallingBlocks = -1;
|
||||
private float _maxDamage = 1000;
|
||||
private float _size;
|
||||
private boolean _damageBlocks;
|
||||
private double posX, posY, posZ;
|
||||
|
||||
public CustomExplosion(DamageManager manager, mineplex.core.explosion.Explosion explosion, Location loc, float explosionSize,
|
||||
String deathCause)
|
||||
{
|
||||
super(((CraftWorld) loc.getWorld()).getHandle(), null, loc.getX(), loc.getY(), loc.getZ(), explosionSize);
|
||||
super(((CraftWorld) loc.getWorld()).getHandle(), null, loc.getX(), loc.getY(), loc.getZ(), explosionSize, false, false);
|
||||
|
||||
posX = loc.getX();
|
||||
posY = loc.getY();
|
||||
posZ = loc.getZ();
|
||||
|
||||
_world = ((CraftWorld) loc.getWorld()).getHandle();
|
||||
_manager = manager;
|
||||
_damageReason = deathCause;
|
||||
@ -82,7 +90,7 @@ public class CustomExplosion extends Explosion
|
||||
public CustomExplosion setMaxDamage(float maxDamage)
|
||||
{
|
||||
_maxDamage = maxDamage;
|
||||
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
@ -116,7 +124,7 @@ public class CustomExplosion extends Explosion
|
||||
|
||||
public CustomExplosion setDamageBlocks(boolean damageBlocks)
|
||||
{
|
||||
b = damageBlocks;
|
||||
_damageBlocks = damageBlocks;
|
||||
|
||||
return this;
|
||||
}
|
||||
@ -160,72 +168,70 @@ public class CustomExplosion extends Explosion
|
||||
return;
|
||||
}
|
||||
|
||||
float f = this._size;
|
||||
HashSet hashset = new HashSet();
|
||||
|
||||
for (int i = 0; i < this._i; i++)
|
||||
for (int i = 0; i < 16; i++)
|
||||
{
|
||||
for (int j = 0; j < this._i; j++)
|
||||
for (int j = 0; j < 16; j++)
|
||||
{
|
||||
for (int k = 0; k < this._i; k++)
|
||||
for (int k = 0; k < 16; k++)
|
||||
{
|
||||
if ((i == 0) || (i == this._i - 1) || (j == 0) || (j == this._i - 1) || (k == 0) || (k == this._i - 1))
|
||||
if ((i == 0) || (i == 16 - 1) || (j == 0) || (j == 16 - 1) || (k == 0) || (k == 16 - 1))
|
||||
{
|
||||
double d3 = i / (this._i - 1.0F) * 2.0F - 1.0F;
|
||||
double d4 = j / (this._i - 1.0F) * 2.0F - 1.0F;
|
||||
double d5 = k / (this._i - 1.0F) * 2.0F - 1.0F;
|
||||
double d6 = Math.sqrt(d3 * d3 + d4 * d4 + d5 * d5);
|
||||
double d0 = k / 15.0F * 2.0F - 1.0F;
|
||||
double d1 = i / 15.0F * 2.0F - 1.0F;
|
||||
double d2 = j / 15.0F * 2.0F - 1.0F;
|
||||
double d3 = Math.sqrt(d0 * d0 + d1 * d1 + d2 * d2);
|
||||
|
||||
d3 /= d6;
|
||||
d4 /= d6;
|
||||
d5 /= d6;
|
||||
d0 /= d3;
|
||||
d1 /= d3;
|
||||
d2 /= d3;
|
||||
float f1 = this._blockExplosionSize * (0.7F + this._world.random.nextFloat() * 0.6F);
|
||||
double d4 = this.posX;
|
||||
double d5 = this.posY;
|
||||
double d6 = this.posZ;
|
||||
|
||||
double d0 = this.posX;
|
||||
double d1 = this.posY;
|
||||
double d2 = this.posZ;
|
||||
|
||||
for (float f2 = 0.3F; f1 > 0.0F; f1 -= f2 * 0.75F)
|
||||
for (; f1 > 0.0F; f1 -= 0.225F)
|
||||
{
|
||||
int l = MathHelper.floor(d0);
|
||||
int i1 = MathHelper.floor(d1);
|
||||
int j1 = MathHelper.floor(d2);
|
||||
Block block = this._world.getType(l, i1, j1);
|
||||
BlockPosition blockposition = new BlockPosition(d4, d5, d6);
|
||||
IBlockData iblockdata = this._world.getType(blockposition);
|
||||
|
||||
if (block.getMaterial() != Material.AIR)
|
||||
if (iblockdata.getBlock().getMaterial() != Material.AIR)
|
||||
{
|
||||
float f3 = this.source != null ? this.source.a(this, this._world, l, i1, j1, block)
|
||||
: (_damageBlocksEqually ? Blocks.DIRT : block).a(this.source); // XXX
|
||||
float f2 = this.source != null ? this.source.a(this, this._world, blockposition, iblockdata)
|
||||
: (_damageBlocksEqually ? Blocks.DIRT : iblockdata.getBlock()).a((World) null);
|
||||
|
||||
f1 -= (f3 + 0.3F) * f2;
|
||||
f1 -= (f2 + 0.3F) * 0.3F;
|
||||
}
|
||||
|
||||
if ((f1 > 0.0F)
|
||||
&& ((this.source == null) || (this.source.a(this, this._world, l, i1, j1, block, f1))) // XXX
|
||||
&& (i1 < 256) && (i1 >= 0))
|
||||
&& ((this.source == null) || (this.source.a(this, this._world, blockposition, iblockdata, f1)))
|
||||
&& (blockposition.getY() < 256) && (blockposition.getY() >= 0))
|
||||
{
|
||||
hashset.add(new ChunkPosition(l, i1, j1));
|
||||
hashset.add(blockposition);
|
||||
}
|
||||
|
||||
d0 += d3 * f2;
|
||||
d1 += d4 * f2;
|
||||
d2 += d5 * f2;
|
||||
d4 += d0 * 0.300000011920929D;
|
||||
d5 += d1 * 0.300000011920929D;
|
||||
d6 += d2 * 0.300000011920929D;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.blocks.addAll(hashset);
|
||||
this._size *= 2.0F;
|
||||
_i = MathHelper.floor(this.posX - this._size - 1.0D);
|
||||
int j = MathHelper.floor(this.posX + this._size + 1.0D);
|
||||
int k = MathHelper.floor(this.posY - this._size - 1.0D);
|
||||
int k1 = MathHelper.floor(this.posY + this._size + 1.0D);
|
||||
int l1 = MathHelper.floor(this.posZ - this._size - 1.0D);
|
||||
int i2 = MathHelper.floor(this.posZ + this._size + 1.0D);
|
||||
List list = this._world.getEntities(this.source, AxisAlignedBB.a(_i, k, l1, j, k1, i2)); // XXX
|
||||
Vec3D vec3d = Vec3D.a(this.posX, this.posY, this.posZ);
|
||||
this.getBlocks().addAll(hashset);
|
||||
|
||||
float f3 = _size * 2F;
|
||||
|
||||
int i = MathHelper.floor(this.posX - f3 - 1.0D);
|
||||
int j = MathHelper.floor(this.posX + f3 + 1.0D);
|
||||
int k = MathHelper.floor(this.posY - f3 - 1.0D);
|
||||
int k1 = MathHelper.floor(this.posY + f3 + 1.0D);
|
||||
int l1 = MathHelper.floor(this.posZ - f3 - 1.0D);
|
||||
int i2 = MathHelper.floor(this.posZ + f3 + 1.0D);
|
||||
List list = this._world.getEntities(this.source, new AxisAlignedBB(i, k, l1, j, k1, i2));
|
||||
Vec3D vec3d = new Vec3D(this.posX, this.posY, this.posZ);
|
||||
|
||||
for (int j2 = 0; j2 < list.size(); j2++)
|
||||
{
|
||||
@ -250,7 +256,7 @@ public class CustomExplosion extends Explosion
|
||||
d2 /= d8;
|
||||
|
||||
// Performs a raytrace that determines the percentage of solid blocks between the two
|
||||
double d9 = this._world.a(vec3d, entity.boundingBox); // XXX
|
||||
double d9 = this._world.a(vec3d, entity.getBoundingBox()); // XXX
|
||||
double d10 = (1.0D - d7) * d9;
|
||||
float damage;
|
||||
|
||||
@ -272,25 +278,23 @@ public class CustomExplosion extends Explosion
|
||||
else
|
||||
{
|
||||
CraftEventFactory.entityDamage = this.source;
|
||||
if (!entity.damageEntity(DamageSource.explosion(this), damage))
|
||||
; // Yeah I don't get this either. But its in the source.
|
||||
entity.damageEntity(DamageSource.explosion(this), damage);
|
||||
CraftEventFactory.entityDamage = null;
|
||||
}
|
||||
|
||||
double d11 = EnchantmentProtection.a(entity, d10); // XXX
|
||||
|
||||
entity.motX += d0 * d11;
|
||||
/*entity.motX += d0 * d11;
|
||||
entity.motY += d1 * d11;
|
||||
entity.motZ += d2 * d11;
|
||||
if ((entity instanceof EntityHuman))
|
||||
entity.motZ += d2 * d11;*/
|
||||
|
||||
if (((entity instanceof EntityHuman)) && (!((EntityHuman) entity).abilities.isInvulnerable))
|
||||
{
|
||||
this.b().put(entity, Vec3D.a(d0 * d10, d1 * d10, d2 * d10)); // XXX
|
||||
this.b().put((EntityHuman) entity, new Vec3D(d0 * d10, d1 * d10, d2 * d10));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this._size = f;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -298,23 +302,24 @@ public class CustomExplosion extends Explosion
|
||||
{
|
||||
this._world.makeSound(this.posX, this.posY, this.posZ, "random.explode", 4.0F,
|
||||
(1.0F + (this._world.random.nextFloat() - this._world.random.nextFloat()) * 0.2F) * 0.7F);
|
||||
if ((this._blockExplosionSize >= 2.0F) && (this.b))
|
||||
this._world.addParticle("hugeexplosion", this.posX, this.posY, this.posZ, 1.0D, 0.0D, 0.0D);
|
||||
else
|
||||
{
|
||||
this._world.addParticle("largeexplode", this.posX, this.posY, this.posZ, 1.0D, 0.0D, 0.0D);
|
||||
}
|
||||
if ((this._blockExplosionSize >= 2.0F) && (this._damageBlocks))
|
||||
this._world.addParticle(EnumParticle.EXPLOSION_HUGE, this.posX, this.posY, this.posZ, 1.0D, 0.0D, 0.0D, new int[0]);
|
||||
else {
|
||||
this._world.addParticle(EnumParticle.EXPLOSION_LARGE, this.posX, this.posY, this.posZ, 1.0D, 0.0D, 0.0D, new int[0]);
|
||||
}
|
||||
|
||||
if (this.b)
|
||||
if (_damageBlocks)
|
||||
{
|
||||
org.bukkit.World bworld = this._world.getWorld();
|
||||
|
||||
List blockList = new ArrayList();
|
||||
ChunkPosition cpos;
|
||||
for (int i1 = this.blocks.size() - 1; i1 >= 0; i1--)
|
||||
|
||||
for (int i1 = this.getBlocks().size() - 1; i1 >= 0; i1--)
|
||||
{
|
||||
cpos = (ChunkPosition) this.blocks.get(i1);
|
||||
org.bukkit.block.Block bblock = bworld.getBlockAt(cpos.x, cpos.y, cpos.z);
|
||||
BlockPosition cpos = this.getBlocks().get(i1);
|
||||
|
||||
org.bukkit.block.Block bblock = bworld.getBlockAt(cpos.getX(), cpos.getY(), cpos.getZ());
|
||||
|
||||
if (bblock.getType() != org.bukkit.Material.AIR)
|
||||
{
|
||||
blockList.add(bblock);
|
||||
@ -324,12 +329,12 @@ public class CustomExplosion extends Explosion
|
||||
ExplosionEvent event = _owner == null ? new ExplosionEvent(blockList) : new ExplosionEvent(blockList, _owner);
|
||||
this._world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
this.blocks.clear();
|
||||
this.getBlocks().clear();
|
||||
|
||||
for (org.bukkit.block.Block bblock : event.GetBlocks())
|
||||
{
|
||||
ChunkPosition coords = new ChunkPosition(bblock.getX(), bblock.getY(), bblock.getZ());
|
||||
this.blocks.add(coords);
|
||||
BlockPosition coords = new BlockPosition(bblock.getX(), bblock.getY(), bblock.getZ());
|
||||
this.getBlocks().add(coords);
|
||||
}
|
||||
|
||||
if (event.GetBlocks().isEmpty())
|
||||
@ -359,21 +364,19 @@ public class CustomExplosion extends Explosion
|
||||
_explosion.BlockExplosion(blocks, new Location(_world.getWorld(), posX, posY, posZ), false, false);
|
||||
}
|
||||
|
||||
Iterator iterator = this.blocks.iterator();
|
||||
Iterator iterator = this.getBlocks().iterator();
|
||||
|
||||
while (iterator.hasNext())
|
||||
{
|
||||
ChunkPosition chunkposition = (ChunkPosition) iterator.next();
|
||||
int i = chunkposition.x;
|
||||
int j = chunkposition.y;
|
||||
int k = chunkposition.z;
|
||||
Block block = this._world.getType(i, j, k);
|
||||
this._world.spigotConfig.antiXrayInstance.updateNearbyBlocks(this._world, i, j, k);
|
||||
BlockPosition blockposition = (BlockPosition) iterator.next();
|
||||
Block block = this._world.getType(blockposition).getBlock();
|
||||
|
||||
this._world.spigotConfig.antiXrayInstance.updateNearbyBlocks(this._world, blockposition);
|
||||
if (flag)
|
||||
{
|
||||
double d0 = i + this._world.random.nextFloat();
|
||||
double d1 = j + this._world.random.nextFloat();
|
||||
double d2 = k + this._world.random.nextFloat();
|
||||
double d0 = blockposition.getX() + this._world.random.nextFloat();
|
||||
double d1 = blockposition.getY() + this._world.random.nextFloat();
|
||||
double d2 = blockposition.getZ() + this._world.random.nextFloat();
|
||||
double d3 = d0 - this.posX;
|
||||
double d4 = d1 - this.posY;
|
||||
double d5 = d2 - this.posZ;
|
||||
@ -388,41 +391,38 @@ public class CustomExplosion extends Explosion
|
||||
d3 *= d7;
|
||||
d4 *= d7;
|
||||
d5 *= d7;
|
||||
this._world.addParticle("explode", (d0 + this.posX * 1.0D) / 2.0D, (d1 + this.posY * 1.0D) / 2.0D,
|
||||
(d2 + this.posZ * 1.0D) / 2.0D, d3, d4, d5);
|
||||
this._world.addParticle("smoke", d0, d1, d2, d3, d4, d5);
|
||||
this._world.addParticle(EnumParticle.EXPLOSION_NORMAL, (d0 + this.posX * 1.0D) / 2.0D,
|
||||
(d1 + this.posY * 1.0D) / 2.0D, (d2 + this.posZ * 1.0D) / 2.0D, d3, d4, d5, new int[0]);
|
||||
this._world.addParticle(EnumParticle.SMOKE_NORMAL, d0, d1, d2, d3, d4, d5, new int[0]);
|
||||
}
|
||||
|
||||
if (block.getMaterial() != Material.AIR)
|
||||
{
|
||||
if (block.a(this) && _dropItems)
|
||||
{
|
||||
block.dropNaturally(this._world, i, j, k, this._world.getData(i, j, k), _blockExplosionSize, 0);
|
||||
block.dropNaturally(this._world, blockposition, this._world.getType(blockposition), _blockExplosionSize,
|
||||
0);
|
||||
}
|
||||
|
||||
this._world.setTypeAndData(i, j, k, Blocks.AIR, 0, 3);
|
||||
block.wasExploded(this._world, i, j, k, this);
|
||||
this._world.setTypeAndData(blockposition, Blocks.AIR.getBlockData(), 3);
|
||||
block.wasExploded(this._world, blockposition, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (this._createFire)
|
||||
{
|
||||
Iterator iterator = this.blocks.iterator();
|
||||
Iterator iterator = this.getBlocks().iterator();
|
||||
|
||||
while (iterator.hasNext())
|
||||
{
|
||||
ChunkPosition chunkposition = (ChunkPosition) iterator.next();
|
||||
int i = chunkposition.x;
|
||||
int j = chunkposition.y;
|
||||
int k = chunkposition.z;
|
||||
Block block = this._world.getType(i, j, k);
|
||||
Block block1 = this._world.getType(i, j - 1, k);
|
||||
|
||||
if ((block.getMaterial() == Material.AIR) && (block1.j()) && (new Random().nextInt(3) == 0))
|
||||
BlockPosition blockposition = (BlockPosition) iterator.next();
|
||||
if ((this._world.getType(blockposition).getBlock().getMaterial() == Material.AIR)
|
||||
&& (this._world.getType(blockposition.down()).getBlock().o()) && (UtilMath.r(3) == 0))
|
||||
{
|
||||
if (!CraftEventFactory.callBlockIgniteEvent(this._world, i, j, k, this).isCancelled())
|
||||
this._world.setTypeUpdate(i, j, k, Blocks.FIRE);
|
||||
if (!CraftEventFactory.callBlockIgniteEvent(this._world, blockposition.getX(), blockposition.getY(),
|
||||
blockposition.getZ(), this).isCancelled())
|
||||
this._world.setTypeUpdate(blockposition, Blocks.FIRE.getBlockData());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -16,7 +16,7 @@ import mineplex.minecraft.game.core.damage.DamageManager;
|
||||
import org.bukkit.Effect;
|
||||
import org.bukkit.EntityEffect;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Item;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -42,8 +42,6 @@ import mineplex.core.npc.NpcManager;
|
||||
import mineplex.core.packethandler.IPacketHandler;
|
||||
import mineplex.core.packethandler.PacketHandler;
|
||||
import mineplex.core.packethandler.PacketInfo;
|
||||
import mineplex.core.packethandler.PacketPlayResourcePackStatus;
|
||||
import mineplex.core.packethandler.PacketPlayResourcePackStatus.EnumResourcePackStatus;
|
||||
import mineplex.core.party.PartyManager;
|
||||
import mineplex.core.pet.PetManager;
|
||||
import mineplex.core.poll.PollManager;
|
||||
@ -107,15 +105,14 @@ import nautilus.game.arcade.managers.HolidayManager;
|
||||
import nautilus.game.arcade.managers.IdleManager;
|
||||
import nautilus.game.arcade.managers.MiscManager;
|
||||
import nautilus.game.arcade.shop.ArcadeShop;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
@ -133,6 +130,8 @@ import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
import org.bukkit.event.player.PlayerJoinEvent;
|
||||
import org.bukkit.event.player.PlayerLoginEvent;
|
||||
import org.bukkit.event.player.PlayerQuitEvent;
|
||||
import org.bukkit.event.player.PlayerResourcePackStatusEvent;
|
||||
import org.bukkit.event.player.PlayerResourcePackStatusEvent.Status;
|
||||
import org.bukkit.event.server.ServerListPingEvent;
|
||||
import org.bukkit.potion.PotionEffect;
|
||||
import org.bukkit.util.Vector;
|
||||
@ -192,9 +191,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
|
||||
private TaskManager _taskManager;
|
||||
private PacketHandler _packetHandler;
|
||||
|
||||
|
||||
private IPacketHandler _resourcePacketHandler;
|
||||
|
||||
private String _resourcePackUrl;
|
||||
private boolean _resourcePackRequired;
|
||||
private NautHashMap<String, Boolean> _resourcePackUsers = new NautHashMap<String, Boolean>();
|
||||
@ -336,75 +333,6 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
}, 80L);
|
||||
}
|
||||
|
||||
_resourcePacketHandler = new IPacketHandler()
|
||||
{
|
||||
|
||||
@Override
|
||||
public void handle(PacketInfo packetInfo)
|
||||
{
|
||||
if (_resourcePackUrl != null && packetInfo.getPacket() instanceof PacketPlayResourcePackStatus)
|
||||
{
|
||||
|
||||
final Player player = packetInfo.getPlayer();
|
||||
final EnumResourcePackStatus response = ((PacketPlayResourcePackStatus) packetInfo.getPacket())
|
||||
.getResourcePackStatus();
|
||||
|
||||
Bukkit.getScheduler().scheduleSyncDelayedTask(_plugin, new Runnable()
|
||||
{
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
if (_resourcePackRequired)
|
||||
{
|
||||
if (response == EnumResourcePackStatus.ACCEPTED)
|
||||
{
|
||||
_resourcePackNoResponse.remove(player.getName());
|
||||
}
|
||||
else if (response == EnumResourcePackStatus.DECLINED)
|
||||
{
|
||||
_resourcePackNoResponse.remove(player.getName());
|
||||
|
||||
UtilPlayer.message(player, " ");
|
||||
JsonMessage message = new JsonMessage("")
|
||||
.color("gold")
|
||||
.bold()
|
||||
.extra("You need to accept the resource pack!\n"
|
||||
+ "Click me for instructions on how to fix this!")
|
||||
|
||||
.click(ClickEvent.OPEN_URL,
|
||||
|
||||
"http://mineplex.com/forums/m/11929946/viewthread/21554536-wizards-resource-pack-help");
|
||||
|
||||
message.sendToPlayer(player);
|
||||
UtilPlayer.message(player, " ");
|
||||
|
||||
returnHubNoResPack(player);
|
||||
}
|
||||
else if (response == EnumResourcePackStatus.FAILED_DOWNLOAD)
|
||||
{
|
||||
_resourcePackNoResponse.remove(player.getName());
|
||||
|
||||
returnHubNoResPack(player, "Failed to download resource pack!");
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (response == EnumResourcePackStatus.ACCEPTED || response == EnumResourcePackStatus.LOADED)
|
||||
{
|
||||
_resourcePackUsers.put(player.getName(), true);
|
||||
}
|
||||
else
|
||||
{
|
||||
_resourcePackUsers.remove(player.getName());
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
new ResPackManager(new ResUnloadCheck()
|
||||
{
|
||||
public boolean canSendUnload(Player player)
|
||||
@ -418,8 +346,6 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
}
|
||||
});
|
||||
|
||||
getPacketHandler().addPacketHandler(_resourcePacketHandler);
|
||||
|
||||
loadRequiredRank();
|
||||
}
|
||||
|
||||
@ -432,6 +358,63 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
addCommand(new DisguiseCommand(this));
|
||||
addCommand(new RequiredRankCommand(this));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onResourcePackStatus(PlayerResourcePackStatusEvent event)
|
||||
{
|
||||
if (_resourcePackUrl == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if (_resourcePackRequired)
|
||||
{
|
||||
if (event.getStatus() == Status.ACCEPTED)
|
||||
{
|
||||
_resourcePackNoResponse.remove(player.getName());
|
||||
}
|
||||
else if (event.getStatus() == Status.DECLINED)
|
||||
{
|
||||
_resourcePackNoResponse.remove(player.getName());
|
||||
|
||||
UtilPlayer.message(player, " ");
|
||||
JsonMessage message = new JsonMessage("")
|
||||
.color("gold")
|
||||
.bold()
|
||||
.extra("You need to accept the resource pack!\n"
|
||||
+ "Click me for instructions on how to fix this!")
|
||||
|
||||
.click(ClickEvent.OPEN_URL,
|
||||
|
||||
"http://mineplex.com/forums/m/11929946/viewthread/21554536-wizards-resource-pack-help");
|
||||
|
||||
message.sendToPlayer(player);
|
||||
UtilPlayer.message(player, " ");
|
||||
|
||||
returnHubNoResPack(player);
|
||||
}
|
||||
else if (event.getStatus() == Status.FAILED_DOWNLOAD)
|
||||
{
|
||||
_resourcePackNoResponse.remove(player.getName());
|
||||
|
||||
returnHubNoResPack(player, "Failed to download resource pack!");
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (event.getStatus() == Status.ACCEPTED
|
||||
|| event.getStatus() == Status.SUCCESSFULLY_LOADED)
|
||||
{
|
||||
_resourcePackUsers.put(player.getName(), true);
|
||||
}
|
||||
else
|
||||
{
|
||||
_resourcePackUsers.remove(player.getName());
|
||||
}
|
||||
}
|
||||
|
||||
public GameServerConfig GetServerConfig()
|
||||
{
|
||||
@ -943,11 +926,11 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
player.setPlayerTime(player.getWorld().getTime(), false);
|
||||
|
||||
((CraftPlayer) player).getHandle().spectating = false;
|
||||
((CraftPlayer) player).getHandle().ghost = false;
|
||||
((CraftPlayer) player).getHandle().setGhost(false);
|
||||
((CraftPlayer) player).getHandle().k = true;
|
||||
|
||||
// Arrows go bye bye.
|
||||
((CraftPlayer) player).getHandle().p(0);
|
||||
((CraftPlayer) player).getHandle().o(0);
|
||||
|
||||
//Remove all conditions
|
||||
GetCondition().EndCondition(player, null, null);
|
||||
@ -1389,7 +1372,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation
|
||||
player.setFlying(true);
|
||||
player.setFlySpeed(0.1f);
|
||||
((CraftPlayer) player).getHandle().spectating = true;
|
||||
((CraftPlayer) player).getHandle().ghost = true;
|
||||
((CraftPlayer) player).getHandle().setGhost(true);
|
||||
((CraftPlayer) player).getHandle().k = false;
|
||||
|
||||
GetCondition().Factory().Cloak("Spectator", player, player, 7777, true, true);
|
||||
|
@ -392,7 +392,7 @@ public abstract class Game implements Listener
|
||||
try
|
||||
{
|
||||
PacketTeam = Class.forName(
|
||||
"org.bukkit.craftbukkit.v1_7_R4.scoreboard.CraftTeam")
|
||||
"org.bukkit.craftbukkit.v1_8_R3.scoreboard.CraftTeam")
|
||||
.getDeclaredField("team");
|
||||
PacketTeam.setAccessible(true);
|
||||
|
||||
@ -1543,7 +1543,7 @@ public abstract class Game implements Listener
|
||||
if (event.GetState() == GameState.Live)
|
||||
{
|
||||
getArcadeManager().getPacketHandler().addPacketHandler(
|
||||
_useEntityPacketHandler);
|
||||
_useEntityPacketHandler, PacketPlayInUseEntity.class);
|
||||
}
|
||||
else if (event.GetState() == GameState.Dead)
|
||||
{
|
||||
|
@ -3,7 +3,7 @@ package nautilus.game.arcade.game.games.build.gui.page;
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftLivingEntity;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftLivingEntity;
|
||||
import org.bukkit.entity.Ageable;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
@ -76,7 +76,7 @@ public class MobPage extends ShopPageBase<ArcadeManager, MobShop>
|
||||
if (_entity instanceof LivingEntity)
|
||||
{
|
||||
final LivingEntity livingEntity = ((LivingEntity) _entity);
|
||||
final boolean ghost = ((CraftLivingEntity) livingEntity).getHandle().ghost;
|
||||
final boolean ghost = ((CraftLivingEntity) livingEntity).getHandle().isGhost();
|
||||
|
||||
ShopItem item = new ShopItem(Material.FEATHER, (ghost ? "Allow " : "Disable ") + "Pushing " + entityName, null, 0, false, false);
|
||||
addButton(buttonSlot, item, new IButton()
|
||||
@ -84,7 +84,7 @@ public class MobPage extends ShopPageBase<ArcadeManager, MobShop>
|
||||
@Override
|
||||
public void onClick(Player player, ClickType clickType)
|
||||
{
|
||||
((CraftLivingEntity) livingEntity).getHandle().ghost = !ghost;
|
||||
((CraftLivingEntity) livingEntity).getHandle().setGhost(!ghost);
|
||||
UtilPlayer.message(player, F.main("Game", "Pushing " + (ghost ? "Enabled" : "Disabled") + " for " + entityName));
|
||||
buildPage();
|
||||
}
|
||||
|
@ -311,7 +311,10 @@ public class Christmas extends SoloGame
|
||||
{
|
||||
public void run()
|
||||
{
|
||||
getArcadeManager().getPacketHandler().addPacketHandler(_reindeerPackets);
|
||||
getArcadeManager().getPacketHandler().addPacketHandler(
|
||||
_reindeerPackets,
|
||||
PacketPlayOutEntityDestroy.class,
|
||||
PacketPlayOutSpawnEntityLiving.class);
|
||||
|
||||
GetSleigh();
|
||||
|
||||
|
@ -21,7 +21,6 @@ import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.FireworkEffect.Type;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
|
||||
import org.bukkit.entity.Chicken;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.FallingBlock;
|
||||
|
@ -7,7 +7,7 @@ import mineplex.core.common.util.UtilMath;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftFallingSand;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftFallingSand;
|
||||
import org.bukkit.entity.Chicken;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.FallingBlock;
|
||||
|
@ -7,7 +7,7 @@ import nautilus.game.arcade.ArcadeManager;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEnderDragon;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEnderDragon;
|
||||
import org.bukkit.entity.EnderDragon;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -468,7 +468,7 @@ public class Draw extends SoloGame
|
||||
continue;
|
||||
}
|
||||
|
||||
Block block = player.getTargetBlock(null, 200);
|
||||
Block block = player.getTargetBlock((HashSet<Byte>) null, 200);
|
||||
if (block == null || !_canvas.contains(block))
|
||||
continue;
|
||||
|
||||
@ -570,7 +570,7 @@ public class Draw extends SoloGame
|
||||
if (!_drawers.HasPlayer(player))
|
||||
return;
|
||||
|
||||
Block block = player.getTargetBlock(null, 200);
|
||||
Block block = player.getTargetBlock((HashSet<Byte>) null, 200);
|
||||
if (block == null || !_canvas.contains(block))
|
||||
return;
|
||||
|
||||
@ -613,7 +613,7 @@ public class Draw extends SoloGame
|
||||
if (!_drawers.HasPlayer(player))
|
||||
return;
|
||||
|
||||
Block block = player.getTargetBlock(null, 200);
|
||||
Block block = player.getTargetBlock((HashSet<Byte>) null, 200);
|
||||
if (block == null || block.getType() != Material.WOOL || _canvas.contains(block))
|
||||
return;
|
||||
|
||||
|
@ -2,6 +2,7 @@ package nautilus.game.arcade.game.games.draw.tools;
|
||||
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
||||
import mineplex.core.common.util.UtilEvent;
|
||||
import mineplex.core.common.util.UtilGear;
|
||||
@ -37,7 +38,7 @@ public abstract class Tool
|
||||
{
|
||||
if (!UtilEvent.isAction(event, ActionType.R))
|
||||
return;
|
||||
Block block = event.getPlayer().getTargetBlock(null, 60);
|
||||
Block block = event.getPlayer().getTargetBlock((HashSet<Byte>) null, 60);
|
||||
|
||||
if (block == null)
|
||||
return;
|
||||
@ -70,7 +71,7 @@ public abstract class Tool
|
||||
_new = new HashMap<Block, Byte>();
|
||||
|
||||
//Calculate New
|
||||
Block end = _drawer.getTargetBlock(null, 64);
|
||||
Block end = _drawer.getTargetBlock((HashSet<Byte>) null, 64);
|
||||
if (end != null && Host.getCanvas().contains(end))
|
||||
{
|
||||
customDraw(end);
|
||||
|
@ -40,7 +40,7 @@ import org.bukkit.Material;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftLivingEntity;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftLivingEntity;
|
||||
import org.bukkit.entity.Ageable;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
@ -1247,7 +1247,7 @@ public class EventModule extends MiniPlugin
|
||||
for (int i = 0 ; i < count ; i++)
|
||||
{
|
||||
Manager.GetGame().CreatureAllowOverride = true;
|
||||
entSet.add(Manager.GetCreature().SpawnEntity(caller.getTargetBlock(null, 0).getLocation().add(0.5, 1, 0.5), type));
|
||||
entSet.add(Manager.GetCreature().SpawnEntity(caller.getTargetBlock((HashSet<Byte>)null, 0).getLocation().add(0.5, 1, 0.5), type));
|
||||
Manager.GetGame().CreatureAllowOverride = false;
|
||||
}
|
||||
|
||||
|
@ -65,7 +65,7 @@ import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.EventPriority;
|
||||
@ -323,7 +323,7 @@ public class Evolution extends SoloGame
|
||||
player.eject();
|
||||
player.leaveVehicle();
|
||||
|
||||
((CraftPlayer) player).getHandle().p(0);
|
||||
((CraftPlayer) player).getHandle().o(0);
|
||||
|
||||
//Freeze
|
||||
Manager.GetCondition().Factory().Cloak("Evolving", player, null, 10, false, false);
|
||||
|
@ -357,10 +357,10 @@ public class EvolveData
|
||||
|
||||
if (invisible)
|
||||
{
|
||||
entity.Invisible = true;
|
||||
entity.setInvisible(true);
|
||||
}
|
||||
|
||||
entity.ghost = true;
|
||||
entity.setGhost(true);
|
||||
|
||||
UtilPlayer.sendPacket(_player, packet);
|
||||
return entity;
|
||||
|
@ -13,7 +13,7 @@ import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.FireworkEffect.Type;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftFallingSand;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftFallingSand;
|
||||
import org.bukkit.entity.Arrow;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.FallingBlock;
|
||||
|
@ -37,7 +37,7 @@ import nautilus.game.arcade.game.games.halloween.waves.WaveBase;
|
||||
import nautilus.game.arcade.game.games.halloween.waves.WaveBoss;
|
||||
import nautilus.game.arcade.game.games.halloween.waves.WaveVictory;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import net.minecraft.server.v1_7_R4.PacketPlayOutNamedSoundEffect;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutNamedSoundEffect;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Difficulty;
|
||||
@ -45,7 +45,7 @@ import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Fireball;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
@ -271,7 +271,7 @@ public class HideSeek extends TeamGame
|
||||
{
|
||||
if (event.GetState() == GameState.Prepare)
|
||||
{
|
||||
this.getArcadeManager().getPacketHandler().addPacketHandler(_preventSpawnSent);
|
||||
this.getArcadeManager().getPacketHandler().addPacketHandler(_preventSpawnSent, PacketPlayOutSpawnEntity.class);
|
||||
}
|
||||
else if (event.GetState() == GameState.End)
|
||||
{
|
||||
|
@ -10,7 +10,7 @@ import nautilus.game.arcade.game.games.hideseek.HideSeek;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEntity;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
|
@ -5,7 +5,6 @@ import java.util.List;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -5,7 +5,6 @@ import java.util.List;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -5,7 +5,6 @@ import java.util.List;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -39,7 +39,7 @@ import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||
import org.bukkit.entity.EnderPearl;
|
||||
import org.bukkit.entity.HumanEntity;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
|
@ -7,7 +7,6 @@ import nautilus.game.arcade.game.Game;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.EntityEffect;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Skeleton;
|
||||
|
@ -3,7 +3,7 @@ package nautilus.game.arcade.game.games.searchanddestroy;
|
||||
import mineplex.core.shop.item.IButton;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
|
||||
|
@ -62,7 +62,7 @@ import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.BlockState;
|
||||
import org.bukkit.block.Chest;
|
||||
import org.bukkit.block.DoubleChest;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Chicken;
|
||||
import org.bukkit.entity.Egg;
|
||||
import org.bukkit.entity.EnderPearl;
|
||||
|
@ -2,7 +2,6 @@ package nautilus.game.arcade.game.games.survivalgames;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.bukkit.*;
|
||||
import org.bukkit.FireworkEffect.Type;
|
||||
@ -38,7 +37,6 @@ import org.bukkit.event.entity.ItemSpawnEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
|
||||
import org.bukkit.event.entity.ProjectileHitEvent;
|
||||
import org.bukkit.event.hanging.HangingBreakEvent;
|
||||
import org.bukkit.event.inventory.InventoryCloseEvent;
|
||||
import org.bukkit.event.inventory.PrepareItemCraftEvent;
|
||||
import org.bukkit.event.player.PlayerChangedWorldEvent;
|
||||
import org.bukkit.event.player.PlayerCommandPreprocessEvent;
|
||||
@ -58,7 +56,6 @@ import org.bukkit.util.Vector;
|
||||
|
||||
import mineplex.core.common.util.C;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.common.util.NautHashMap;
|
||||
import mineplex.core.common.util.UtilAction;
|
||||
import mineplex.core.common.util.UtilAlg;
|
||||
import mineplex.core.common.util.UtilBlock;
|
||||
@ -76,7 +73,6 @@ import mineplex.core.common.util.UtilWorld;
|
||||
import mineplex.core.itemstack.ItemBuilder;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.core.loot.*;
|
||||
import mineplex.core.packethandler.PacketPlayOutWorldBorder;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
@ -97,10 +93,11 @@ import nautilus.game.arcade.stats.SimultaneousSkeletonStatTracker;
|
||||
import nautilus.game.arcade.stats.WinWithoutWearingArmorStatTracker;
|
||||
import net.minecraft.server.v1_8_R3.EntityLargeFireball;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutScoreboardTeam;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutWorldBorder;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutWorldBorder.EnumWorldBorderAction;
|
||||
import net.minecraft.server.v1_8_R3.ScoreboardTeam;
|
||||
import net.minecraft.server.v1_8_R3.TileEntity;
|
||||
import net.minecraft.server.v1_8_R3.TileEntityChest;
|
||||
import net.minecraft.server.v1_8_R3.WorldServer;
|
||||
import net.minecraft.server.v1_8_R3.WorldBorder;
|
||||
|
||||
public abstract class SurvivalGames extends Game
|
||||
{
|
||||
@ -251,7 +248,7 @@ public abstract class SurvivalGames extends Game
|
||||
try
|
||||
{
|
||||
|
||||
_packetTeam = Class.forName("org.bukkit.craftbukkit.v1_7_R4.scoreboard.CraftTeam").getDeclaredField("team");
|
||||
_packetTeam = Class.forName("org.bukkit.craftbukkit.v1_8_R3.scoreboard.CraftTeam").getDeclaredField("team");
|
||||
_packetTeam.setAccessible(true);
|
||||
|
||||
_nameTagVisibility = PacketPlayOutScoreboardTeam.class.getDeclaredField("e");
|
||||
@ -1387,13 +1384,13 @@ public abstract class SurvivalGames extends Game
|
||||
{
|
||||
_borderStartedMoving = System.currentTimeMillis();
|
||||
|
||||
PacketPlayOutWorldBorder packet = new PacketPlayOutWorldBorder();
|
||||
packet.worldBorderType = 1;
|
||||
WorldBorder border = new WorldBorder();
|
||||
|
||||
packet.newRadius = _currentBorder;
|
||||
packet.oldRadius = _previousBorder;
|
||||
border.transitionSizeBetween(_currentBorder * 2, _previousBorder,
|
||||
_currentBorder != _previousBorder ? 1000 : 0);
|
||||
|
||||
packet.speed = _currentBorder != _previousBorder ? 1000 : 0;
|
||||
PacketPlayOutWorldBorder packet = new PacketPlayOutWorldBorder(border,
|
||||
EnumWorldBorderAction.LERP_SIZE);
|
||||
|
||||
for (Player player : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
@ -1406,25 +1403,26 @@ public abstract class SurvivalGames extends Game
|
||||
|
||||
private void setupBorder(Player player)
|
||||
{
|
||||
PacketPlayOutWorldBorder packet = new PacketPlayOutWorldBorder();
|
||||
packet.worldBorderType = 3;
|
||||
WorldBorder border = new WorldBorder();
|
||||
|
||||
packet.centerX = _spawn.getX();
|
||||
packet.centerZ = _spawn.getZ();
|
||||
border.transitionSizeBetween(
|
||||
_currentBorder * 2,
|
||||
_previousBorder,
|
||||
_currentBorder != _previousBorder ? 1000 - Math.min(1000,
|
||||
(System.currentTimeMillis() - _borderStartedMoving))
|
||||
: 0);
|
||||
border.setCenter(_spawn.getX(), _spawn.getZ());
|
||||
border.setWarningDistance(-10);
|
||||
border.setWarningTime(-10);
|
||||
border.a(29999984);
|
||||
|
||||
packet.newRadius = _currentBorder;
|
||||
packet.oldRadius = _previousBorder;
|
||||
PacketPlayOutWorldBorder packet = new PacketPlayOutWorldBorder(border,
|
||||
EnumWorldBorderAction.INITIALIZE);
|
||||
|
||||
packet.warningBlocks = -10;
|
||||
packet.warningTime = -10;
|
||||
|
||||
if (_currentBorder != _previousBorder)
|
||||
{
|
||||
packet.speed = 1000 - Math.min(1000, (System.currentTimeMillis() - _borderStartedMoving));
|
||||
}
|
||||
|
||||
// We don't set warnings speed or blocks as its not particularly useful for this game.
|
||||
// Also if we don't use it here, its more effective in other places to reinforce the idea what its for.
|
||||
// We don't set warnings speed or blocks as its not particularly useful
|
||||
// for this game.
|
||||
// Also if we don't use it here, its more effective in other places to
|
||||
// reinforce the idea what its for.
|
||||
|
||||
if (UtilPlayer.is1_8(player))
|
||||
{
|
||||
|
@ -19,7 +19,6 @@ import mineplex.core.common.util.UtilTextMiddle;
|
||||
import mineplex.core.common.util.UtilTime;
|
||||
import mineplex.core.common.util.UtilWorld;
|
||||
import mineplex.core.itemstack.ItemStackFactory;
|
||||
import mineplex.core.packethandler.PacketPlayOutWorldBorder;
|
||||
import mineplex.core.recharge.Recharge;
|
||||
import mineplex.core.timing.TimingManager;
|
||||
import mineplex.core.updater.UpdateType;
|
||||
@ -34,6 +33,9 @@ import nautilus.game.arcade.events.GameStateChangeEvent;
|
||||
import nautilus.game.arcade.game.GameTeam;
|
||||
import nautilus.game.arcade.game.TeamGame;
|
||||
import nautilus.game.arcade.kit.Kit;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutWorldBorder;
|
||||
import net.minecraft.server.v1_8_R3.WorldBorder;
|
||||
import net.minecraft.server.v1_8_R3.PacketPlayOutWorldBorder.EnumWorldBorderAction;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.ChatColor;
|
||||
@ -277,15 +279,13 @@ public class UHC extends TeamGame
|
||||
|
||||
private void setBorder()
|
||||
{
|
||||
_borderStartedMoving = System.currentTimeMillis();
|
||||
WorldBorder border = new WorldBorder();
|
||||
|
||||
PacketPlayOutWorldBorder packet = new PacketPlayOutWorldBorder();
|
||||
packet.worldBorderType = 1;
|
||||
border.transitionSizeBetween(_currentBorder * 2, _previousBorder,
|
||||
_currentBorder != _previousBorder ? 1000 : 0);
|
||||
|
||||
packet.newRadius = _currentBorder;
|
||||
packet.oldRadius = _previousBorder;
|
||||
|
||||
packet.speed = _currentBorder != _previousBorder ? 1000 : 0;
|
||||
PacketPlayOutWorldBorder packet = new PacketPlayOutWorldBorder(border,
|
||||
EnumWorldBorderAction.LERP_SIZE);
|
||||
|
||||
for (Player player : Bukkit.getOnlinePlayers())
|
||||
{
|
||||
@ -373,19 +373,20 @@ public class UHC extends TeamGame
|
||||
|
||||
private void setupBorder(Player player)
|
||||
{
|
||||
PacketPlayOutWorldBorder packet = new PacketPlayOutWorldBorder();
|
||||
packet.worldBorderType = 3;
|
||||
WorldBorder border = new WorldBorder();
|
||||
|
||||
packet.newRadius = _currentBorder;
|
||||
packet.oldRadius = _previousBorder;
|
||||
border.transitionSizeBetween(
|
||||
_currentBorder * 2,
|
||||
_previousBorder,
|
||||
_currentBorder != _previousBorder ? 1000 - Math.min(1000,
|
||||
(System.currentTimeMillis() - _borderStartedMoving))
|
||||
: 0);
|
||||
border.setWarningDistance(-10);
|
||||
border.setWarningTime(-10);
|
||||
border.a(29999984);
|
||||
|
||||
packet.warningBlocks = -10;
|
||||
packet.warningTime = -10;
|
||||
|
||||
if (_currentBorder != _previousBorder)
|
||||
{
|
||||
packet.speed = 1000 - Math.min(1000, (System.currentTimeMillis() - _borderStartedMoving));
|
||||
}
|
||||
PacketPlayOutWorldBorder packet = new PacketPlayOutWorldBorder(border,
|
||||
EnumWorldBorderAction.INITIALIZE);
|
||||
|
||||
// We don't set warnings speed or blocks as its not particularly useful for this game.
|
||||
// Also if we don't use it here, its more effective in other places to reinforce the idea what its for.
|
||||
|
@ -57,7 +57,7 @@ import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Projectile;
|
||||
|
@ -2,7 +2,6 @@ package nautilus.game.arcade.game.games.wither.kit;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -2,7 +2,6 @@ package nautilus.game.arcade.game.games.wither.kit;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -2,7 +2,6 @@ package nautilus.game.arcade.game.games.wither.kit;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
||||
import org.bukkit.entity.EntityType;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -659,7 +659,9 @@ public class Wizards extends SoloGame
|
||||
{
|
||||
if (event.GetState() == GameState.Live)
|
||||
{
|
||||
getArcadeManager().getPacketHandler().addPacketHandler(_wizardSpellLevelHandler);
|
||||
getArcadeManager().getPacketHandler().addPacketHandler(
|
||||
_wizardSpellLevelHandler, PacketPlayOutSetSlot.class,
|
||||
PacketPlayOutWindowItems.class);
|
||||
}
|
||||
else if (event.GetState() == GameState.Dead)
|
||||
{
|
||||
|
@ -16,7 +16,7 @@ import nautilus.game.arcade.game.games.wizards.Spell;
|
||||
import nautilus.game.arcade.game.games.wizards.spellinterfaces.SpellClick;
|
||||
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftArrow;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftArrow;
|
||||
import org.bukkit.entity.Arrow;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
@ -1,6 +1,6 @@
|
||||
package nautilus.game.arcade.gui.spectatorMenu.button;
|
||||
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.inventory.ClickType;
|
||||
|
||||
|
@ -9,7 +9,7 @@ import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.kit.Perk;
|
||||
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
||||
|
@ -5,7 +5,7 @@ import java.util.HashMap;
|
||||
import org.bukkit.Color;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.FireworkEffect.Type;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEnderDragon;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftEnderDragon;
|
||||
import org.bukkit.entity.EnderDragon;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
@ -17,7 +17,7 @@ import nautilus.game.arcade.kit.Perk;
|
||||
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftArrow;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftArrow;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
@ -1,10 +1,12 @@
|
||||
package nautilus.game.arcade.kit.perks;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
||||
import mineplex.core.updater.UpdateType;
|
||||
import mineplex.core.updater.event.UpdateEvent;
|
||||
import nautilus.game.arcade.kit.SmashPerk;
|
||||
@ -24,7 +26,7 @@ public class PerkMeteorShower extends SmashPerk
|
||||
@Override
|
||||
public void addSuperCustom(Player player)
|
||||
{
|
||||
_meteors.add(new MeteorShowerData(player, player.getTargetBlock(null, 128).getLocation()));
|
||||
_meteors.add(new MeteorShowerData(player, player.getTargetBlock((HashSet<Byte>) null, 128).getLocation()));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
|
@ -2,6 +2,7 @@ package nautilus.game.arcade.kit.perks;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Location;
|
||||
@ -62,7 +63,7 @@ public class PerkStormSquid extends SmashPerk
|
||||
if (event.getAction() == Action.PHYSICAL)
|
||||
return;
|
||||
|
||||
Block block = player.getTargetBlock(null, 100);
|
||||
Block block = player.getTargetBlock((HashSet<Byte>) null, 100);
|
||||
if (block == null)
|
||||
return;
|
||||
|
||||
|
@ -7,7 +7,6 @@ import java.util.Iterator;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftTNTPrimed;
|
||||
import org.bukkit.entity.Arrow;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Player;
|
||||
|
@ -35,7 +35,7 @@ import org.bukkit.block.Block;
|
||||
import org.bukkit.block.BlockFace;
|
||||
import org.bukkit.block.Chest;
|
||||
import org.bukkit.block.DoubleChest;
|
||||
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
|
||||
import org.bukkit.craftbukkit.v1_8_R3.entity.CraftPlayer;
|
||||
import org.bukkit.entity.LivingEntity;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.entity.Projectile;
|
||||
@ -732,7 +732,7 @@ public class GameFlagManager implements Listener
|
||||
player.setAllowFlight(true);
|
||||
player.setFlying(true);
|
||||
((CraftPlayer)player).getHandle().spectating = true;
|
||||
((CraftPlayer) player).getHandle().ghost = true;
|
||||
((CraftPlayer) player).getHandle().setGhost(true);
|
||||
((CraftPlayer)player).getHandle().k = false;
|
||||
|
||||
for (int i=0 ; i<9 ; i++)
|
||||
|
@ -120,7 +120,7 @@ public class GameLobbyManager implements Listener, IPacketHandler
|
||||
{
|
||||
Manager = manager;
|
||||
|
||||
packetHandler.addPacketHandler(this);
|
||||
packetHandler.addPacketHandler(this, PacketPlayOutEntityMetadata.class);
|
||||
|
||||
World world = UtilWorld.getWorld("world");
|
||||
|
||||
|
@ -19,7 +19,6 @@ import mineplex.core.timing.TimingManager;
|
||||
import nautilus.game.arcade.GameType;
|
||||
import nautilus.game.arcade.game.Game;
|
||||
import nautilus.game.arcade.game.games.uhc.UHC;
|
||||
import net.minecraft.server.v1_7_R4.ChunkPreLoadEvent;
|
||||
|
||||
import org.bukkit.Difficulty;
|
||||
import org.bukkit.Location;
|
||||
@ -28,6 +27,8 @@ import org.bukkit.World.Environment;
|
||||
import org.bukkit.WorldCreator;
|
||||
import org.bukkit.event.world.ChunkUnloadEvent;
|
||||
|
||||
import com.mineplex.spigot.ChunkPreLoadEvent;
|
||||
|
||||
public class WorldData
|
||||
{
|
||||
public Game Host;
|
||||
@ -447,11 +448,11 @@ public class WorldData
|
||||
if (World == null)
|
||||
return;
|
||||
|
||||
if (!event.GetWorld().equals(World))
|
||||
if (!event.getWorld().equals(World))
|
||||
return;
|
||||
|
||||
int x = event.GetX();
|
||||
int z = event.GetZ();
|
||||
int x = event.getX();
|
||||
int z = event.getZ();
|
||||
|
||||
|
||||
if (x >= MinX >> 4 && x <= MaxX >> 4 && z >= MinZ >> 4 && z <= MaxZ >> 4)
|
||||
|
Loading…
Reference in New Issue
Block a user