More work on 1.8 update

This commit is contained in:
Shaun Bennett 2015-04-23 08:28:19 -04:00
parent 20b5ee8b65
commit ed0db983f8
24 changed files with 306 additions and 305 deletions

View File

@ -1,8 +1,8 @@
package mineplex.core.common; package mineplex.core.common;
import net.minecraft.server.v1_7_R4.Entity; import net.minecraft.server.v1_8_R2.Entity;
import net.minecraft.server.v1_7_R4.NBTTagCompound; import net.minecraft.server.v1_8_R2.NBTTagCompound;
import net.minecraft.server.v1_7_R4.World; import net.minecraft.server.v1_8_R2.World;
public class DummyEntity extends Entity public class DummyEntity extends Entity
{ {
@ -12,17 +12,20 @@ public class DummyEntity extends Entity
} }
@Override @Override
protected void c() protected void h()
{ {
} }
@Override @Override
protected void a(NBTTagCompound nbttagcompound) protected void a(NBTTagCompound nbtTagCompound)
{ {
} }
@Override @Override
protected void b(NBTTagCompound nbttagcompound) protected void b(NBTTagCompound nbtTagCompound)
{ {
} }
} }

View File

@ -2,7 +2,7 @@ package mineplex.core.common.util;
import java.util.HashMap; import java.util.HashMap;
import org.bukkit.craftbukkit.v1_7_R4.inventory.CraftInventory; import org.bukkit.craftbukkit.v1_8_R2.inventory.CraftInventory;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
public class InventoryUtil public class InventoryUtil

View File

@ -1,48 +1,40 @@
package mineplex.core.common.util; package mineplex.core.common.util;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap; import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map; import java.util.Map;
import net.minecraft.server.v1_7_R4.Block;
import net.minecraft.server.v1_7_R4.BlockContainer;
import net.minecraft.server.v1_7_R4.Blocks;
import net.minecraft.server.v1_7_R4.ChunkCoordIntPair;
import net.minecraft.server.v1_7_R4.ChunkSection;
import net.minecraft.server.v1_7_R4.EnumSkyBlock;
import net.minecraft.server.v1_7_R4.ExceptionWorldConflict;
import net.minecraft.server.v1_7_R4.IContainer;
import net.minecraft.server.v1_7_R4.IProgressUpdate;
import net.minecraft.server.v1_7_R4.MinecraftServer;
import net.minecraft.server.v1_7_R4.PacketPlayOutMapChunkBulk;
import net.minecraft.server.v1_7_R4.PacketPlayOutMultiBlockChange;
import net.minecraft.server.v1_7_R4.RegionFile;
import net.minecraft.server.v1_7_R4.RegionFileCache;
import net.minecraft.server.v1_7_R4.TileEntity;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Chunk; import org.bukkit.Chunk;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.craftbukkit.v1_7_R4.CraftChunk; import org.bukkit.craftbukkit.v1_8_R2.CraftChunk;
import org.bukkit.craftbukkit.v1_7_R4.CraftServer; import org.bukkit.craftbukkit.v1_8_R2.CraftServer;
import org.bukkit.craftbukkit.v1_7_R4.CraftWorld; import org.bukkit.craftbukkit.v1_8_R2.CraftWorld;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_8_R2.entity.CraftPlayer;
import org.bukkit.craftbukkit.v1_8_R2.util.CraftMagicNumbers;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.world.WorldUnloadEvent; import org.bukkit.event.world.WorldUnloadEvent;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.util.Vector; import net.minecraft.server.v1_8_R2.Block;
import net.minecraft.server.v1_8_R2.BlockPosition;
import net.minecraft.server.v1_8_R2.ChunkCoordIntPair;
import net.minecraft.server.v1_8_R2.ExceptionWorldConflict;
import net.minecraft.server.v1_8_R2.IBlockData;
import net.minecraft.server.v1_8_R2.IProgressUpdate;
import net.minecraft.server.v1_8_R2.MinecraftServer;
import net.minecraft.server.v1_8_R2.PacketPlayOutMultiBlockChange;
import net.minecraft.server.v1_8_R2.RegionFile;
import net.minecraft.server.v1_8_R2.RegionFileCache;
public class MapUtil public class MapUtil
{ {
public static void ReplaceOreInChunk(Chunk chunk, Material replacee, Material replacer) /*public static void ReplaceOreInChunk(Chunk chunk, Material replacee, Material replacer)
{ {
net.minecraft.server.v1_7_R4.Chunk c = ((CraftChunk) chunk).getHandle(); net.minecraft.server.v1_8_R2.Chunk c = ((CraftChunk) chunk).getHandle();
for (int x = 0; x < 16; x++) for (int x = 0; x < 16; x++)
{ {
@ -54,7 +46,7 @@ public class MapUtil
int bY = y & 0xFF; int bY = y & 0xFF;
int bZ = c.locZ << 4 | z & 0xF; int bZ = c.locZ << 4 | z & 0xF;
if (c.getType(bX & 0xF, bY, bZ & 0xF).k() == replacee.getId()) if (c.getTypeAbs(bX, bY, bZ).k() == replacee.getId())
{ {
c.b(bX & 0xF, bY, bZ & 0xF, replacer.getId()); c.b(bX & 0xF, bY, bZ & 0xF, replacer.getId());
} }
@ -63,7 +55,7 @@ public class MapUtil
} }
c.initLighting(); c.initLighting();
} }*/
public static void QuickChangeBlockAt(Location location, Material setTo) public static void QuickChangeBlockAt(Location location, Material setTo)
{ {
@ -89,10 +81,12 @@ public class MapUtil
public static void QuickChangeBlockAt(World world, int x, int y, int z, int id, int data) public static void QuickChangeBlockAt(World world, int x, int y, int z, int id, int data)
{ {
Chunk chunk = world.getChunkAt(x >> 4, z >> 4); Chunk chunk = world.getChunkAt(x >> 4, z >> 4);
net.minecraft.server.v1_7_R4.Chunk c = ((CraftChunk) chunk).getHandle(); net.minecraft.server.v1_8_R2.Chunk c = ((CraftChunk) chunk).getHandle();
c.a(x & 0xF, y, z & 0xF, Block.getById(id), data); //c.a(x & 0xF, y, z & 0xF, Block.getById(id), data);
((CraftWorld) world).getHandle().notify(x, y, z); IBlockData blockData = CraftMagicNumbers.getBlock(id).fromLegacyData(data);
c.a(bp(x, y, z), blockData);
((CraftWorld) world).getHandle().notify(bp(x, y, z));
} }
public static int GetHighestBlockInCircleAt(World world, int bx, int bz, int radius) public static int GetHighestBlockInCircleAt(World world, int bx, int bz, int radius)
@ -147,7 +141,7 @@ public class MapUtil
Block.getById(id), data)) Block.getById(id), data))
{ {
if (notifyPlayers) if (notifyPlayers)
((CraftWorld) world).getHandle().notify(x, y, z); ((CraftWorld) world).getHandle().notify(bp(x, y, z));
} }
} }
@ -156,13 +150,15 @@ public class MapUtil
world.getBlockAt(x, y, z).setTypeIdAndData(id, data, notifyPlayers); world.getBlockAt(x, y, z).setTypeIdAndData(id, data, notifyPlayers);
} }
private static boolean changeChunkBlock(int x, int y, int z, net.minecraft.server.v1_7_R4.Chunk chunk, Block block, private static boolean changeChunkBlock(int x, int y, int z, net.minecraft.server.v1_8_R2.Chunk chunk, Block block,
byte data) byte data)
{ {
return chunk.a(x, y, z, block, data); chunk.a(bp(x, y, z), block.fromLegacyData(data));
return true; // todo?
// return chunk.a(x, y, z, block, data);
} }
public static void SendChunkForPlayer(net.minecraft.server.v1_7_R4.Chunk chunk, Player player) public static void SendChunkForPlayer(net.minecraft.server.v1_8_R2.Chunk chunk, Player player)
{ {
SendChunkForPlayer(chunk.locX, chunk.locZ, player); SendChunkForPlayer(chunk.locX, chunk.locZ, player);
} }
@ -211,7 +207,7 @@ public class MapUtil
Bukkit.getPluginManager().callEvent(new WorldUnloadEvent(((CraftWorld) world).getHandle().getWorld())); Bukkit.getPluginManager().callEvent(new WorldUnloadEvent(((CraftWorld) world).getHandle().getWorld()));
Iterator<net.minecraft.server.v1_7_R4.Chunk> chunkIterator = ((CraftWorld) world).getHandle().chunkProviderServer.chunks Iterator<net.minecraft.server.v1_8_R2.Chunk> chunkIterator = ((CraftWorld) world).getHandle().chunkProviderServer.chunks
.values().iterator(); .values().iterator();
for (Entity entity : world.getEntities()) for (Entity entity : world.getEntities())
@ -221,7 +217,7 @@ public class MapUtil
while (chunkIterator.hasNext()) while (chunkIterator.hasNext())
{ {
net.minecraft.server.v1_7_R4.Chunk chunk = chunkIterator.next(); net.minecraft.server.v1_8_R2.Chunk chunk = chunkIterator.next();
chunk.removeEntities(); chunk.removeEntities();
} }
@ -298,4 +294,9 @@ public class MapUtil
return true; return true;
} }
public static BlockPosition bp(int x, int y, int z)
{
return new BlockPosition(x, y, z);
}
} }

View File

@ -6,8 +6,8 @@ import java.util.Scanner;
import java.util.UUID; import java.util.UUID;
import java.util.logging.Level; import java.util.logging.Level;
import net.minecraft.util.com.mojang.authlib.GameProfile; import com.mojang.authlib.GameProfile;
import net.minecraft.util.com.mojang.authlib.properties.Property; import com.mojang.authlib.properties.Property;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;

View File

@ -4,31 +4,29 @@ import java.lang.reflect.Field;
import java.util.HashMap; import java.util.HashMap;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
import net.minecraft.server.v1_7_R4.EntityBat;
import net.minecraft.server.v1_7_R4.EntityCreature;
import net.minecraft.server.v1_7_R4.EntityEnderDragon;
import net.minecraft.server.v1_7_R4.EntityInsentient;
import net.minecraft.server.v1_7_R4.Navigation;
import net.minecraft.server.v1_7_R4.PathfinderGoalMoveTowardsRestriction;
import net.minecraft.server.v1_7_R4.PathfinderGoalSelector;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.GameMode;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.Sound; import org.bukkit.Sound;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity; import org.bukkit.craftbukkit.v1_8_R2.CraftWorld;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftLivingEntity; import org.bukkit.craftbukkit.v1_8_R2.entity.CraftCreature;
import org.bukkit.craftbukkit.v1_8_R2.entity.CraftEntity;
import org.bukkit.entity.Creature; import org.bukkit.entity.Creature;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.Giant; import org.bukkit.entity.Giant;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftCreature; import net.minecraft.server.v1_8_R2.EntityBat;
import org.bukkit.craftbukkit.v1_7_R4.CraftWorld; import net.minecraft.server.v1_8_R2.EntityCreature;
import net.minecraft.server.v1_8_R2.EntityEnderDragon;
import net.minecraft.server.v1_8_R2.EntityInsentient;
import net.minecraft.server.v1_8_R2.NavigationAbstract;
import net.minecraft.server.v1_8_R2.PathfinderGoalMoveTowardsRestriction;
import net.minecraft.server.v1_8_R2.PathfinderGoalSelector;
public class UtilEnt public class UtilEnt
{ {
@ -50,17 +48,17 @@ public class UtilEnt
public static void silence(Entity entity, boolean silence) public static void silence(Entity entity, boolean silence)
{ {
((CraftEntity)entity).getHandle().Silent = silence; ((CraftEntity)entity).getHandle().setSilent(silence);
} }
public static void ghost(Entity entity, boolean ghost, boolean invisible) public static void ghost(Entity entity, boolean ghost, boolean invisible)
{ {
if (entity instanceof LivingEntity) if (entity instanceof LivingEntity)
{ {
((CraftLivingEntity)entity).getHandle().ghost = ghost; ((LivingEntity) entity).setGhost(ghost);
} }
((CraftEntity)entity).getHandle().Invisible = invisible; ((CraftEntity)entity).getHandle().setMineplexInvisible(invisible);
((CraftEntity)entity).getHandle().setInvisible(invisible); ((CraftEntity)entity).getHandle().setInvisible(invisible);
} }
@ -70,8 +68,8 @@ public class UtilEnt
{ {
EntityInsentient creature = (EntityInsentient)((CraftEntity)leashed).getHandle(); EntityInsentient creature = (EntityInsentient)((CraftEntity)leashed).getHandle();
creature.PullWhileLeashed = pull; creature.setPullWhileLeashed(pull);
creature.BreakLeash = breakable; creature.setShouldBreakLeash(breakable);
} }
leashed.setLeashHolder(holder); leashed.setLeashHolder(holder);
@ -127,8 +125,8 @@ public class UtilEnt
{ {
EntityInsentient creature = (EntityInsentient)((CraftEntity)entity).getHandle(); EntityInsentient creature = (EntityInsentient)((CraftEntity)entity).getHandle();
creature.Vegetated = true; creature.setVegetated(true);
creature.Silent = mute; creature.setSilent(mute);
((List)_pathfinderBList.get(((PathfinderGoalSelector)_goalSelector.get(creature)))).clear(); ((List)_pathfinderBList.get(((PathfinderGoalSelector)_goalSelector.get(creature)))).clear();
((List)_pathfinderCList.get(((PathfinderGoalSelector)_goalSelector.get(creature)))).clear(); ((List)_pathfinderCList.get(((PathfinderGoalSelector)_goalSelector.get(creature)))).clear();
@ -139,14 +137,14 @@ public class UtilEnt
if (((CraftEntity)entity).getHandle() instanceof EntityBat) if (((CraftEntity)entity).getHandle() instanceof EntityBat)
{ {
((EntityBat)((CraftEntity)entity).getHandle()).Vegetated = true; ((EntityBat)((CraftEntity)entity).getHandle()).setVegetated(true);
} }
if (((CraftEntity)entity).getHandle() instanceof EntityEnderDragon) if (((CraftEntity)entity).getHandle() instanceof EntityEnderDragon)
{ {
EntityEnderDragon creature = (EntityEnderDragon)((CraftEntity)entity).getHandle(); EntityEnderDragon creature = (EntityEnderDragon)((CraftEntity)entity).getHandle();
creature.Vegetated = true; creature.setVegetated(true);
} }
} }
catch (IllegalArgumentException e) catch (IllegalArgumentException e)
@ -545,7 +543,7 @@ public class UtilEnt
return; return;
EntityCreature ec = ((CraftCreature)ent).getHandle(); EntityCreature ec = ((CraftCreature)ent).getHandle();
Navigation nav = ec.getNavigation(); NavigationAbstract nav = ec.getNavigation();
if (UtilMath.offset(ent.getLocation(), target) > 16) if (UtilMath.offset(ent.getLocation(), target) > 16)
{ {
@ -597,7 +595,7 @@ public class UtilEnt
{ {
try try
{ {
Field field = net.minecraft.server.v1_7_R4.Entity.class.getDeclaredField("entityCount"); Field field = net.minecraft.server.v1_8_R2.Entity.class.getDeclaredField("entityCount");
field.setAccessible(true); field.setAccessible(true);
int entityId = field.getInt(null); int entityId = field.getInt(null);
if (modifynumber) { if (modifynumber) {

View File

@ -4,9 +4,9 @@ import org.bukkit.Color;
import org.bukkit.FireworkEffect; import org.bukkit.FireworkEffect;
import org.bukkit.FireworkEffect.Type; import org.bukkit.FireworkEffect.Type;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_7_R4.CraftWorld; import org.bukkit.craftbukkit.v1_8_R2.CraftWorld;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity; import org.bukkit.craftbukkit.v1_8_R2.entity.CraftEntity;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftFirework; import org.bukkit.craftbukkit.v1_8_R2.entity.CraftFirework;
import org.bukkit.entity.Firework; import org.bukkit.entity.Firework;
import org.bukkit.inventory.meta.FireworkMeta; import org.bukkit.inventory.meta.FireworkMeta;
import org.bukkit.util.Vector; import org.bukkit.util.Vector;
@ -15,9 +15,9 @@ public class UtilFirework
{ {
public static void playFirework(Location loc, FireworkEffect fe) public static void playFirework(Location loc, FireworkEffect fe)
{ {
Firework firework = (Firework) loc.getWorld().spawn(loc, Firework.class); Firework firework = loc.getWorld().spawn(loc, Firework.class);
FireworkMeta data = (FireworkMeta) firework.getFireworkMeta(); FireworkMeta data = firework.getFireworkMeta();
data.clearEffects(); data.clearEffects();
data.setPower(1); data.setPower(1);
data.addEffect(fe); data.addEffect(fe);
@ -32,9 +32,9 @@ public class UtilFirework
{ {
try try
{ {
Firework fw = (Firework) loc.getWorld().spawn(loc, Firework.class); Firework fw = loc.getWorld().spawn(loc, Firework.class);
FireworkMeta data = (FireworkMeta) fw.getFireworkMeta(); FireworkMeta data = fw.getFireworkMeta();
data.clearEffects(); data.clearEffects();
data.setPower(power); data.setPower(power);
data.addEffect(fe); data.addEffect(fe);
@ -56,7 +56,6 @@ public class UtilFirework
public void detonateFirework(Firework firework) public void detonateFirework(Firework firework)
{ {
((CraftWorld)firework.getWorld()).getHandle().broadcastEntityEffect(((CraftEntity)firework).getHandle(), (byte)17); ((CraftWorld)firework.getWorld()).getHandle().broadcastEntityEffect(((CraftEntity)firework).getHandle(), (byte)17);
firework.remove(); firework.remove();
} }

View File

@ -1,12 +1,11 @@
package mineplex.core.common.util; package mineplex.core.common.util;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import net.minecraft.server.v1_7_R4.PacketPlayOutWorldParticles;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_8_R2.entity.CraftPlayer;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import net.minecraft.server.v1_8_R2.PacketPlayOutWorldParticles;
public class UtilParticle public class UtilParticle
{ {

View File

@ -603,6 +603,11 @@ public class UtilPlayer
return false; return false;
} }
public static boolean is1_8(Player player)
{
return true;
}
/* /*
public void setListName(Player player, CoreClient client) public void setListName(Player player, CoreClient client)
{ {

View File

@ -1,192 +1,193 @@
package mineplex.core.common.util; package mineplex.core.common.util;
import net.minecraft.server.v1_7_R4.ChatSerializer;
import net.minecraft.server.v1_7_R4.IChatBaseComponent;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer;
import org.bukkit.entity.Player;
import org.spigotmc.ProtocolInjector;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.UUID; import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.v1_8_R2.entity.CraftPlayer;
import org.bukkit.entity.Player;
import net.minecraft.server.v1_8_R2.IChatBaseComponent;
import net.minecraft.server.v1_8_R2.PacketPlayOutPlayerListHeaderFooter;
import net.minecraft.server.v1_8_R2.PacketPlayOutTitle;
public class UtilTabTitle public class UtilTabTitle
{ {
private static final int PROTOCOL_VERSION = 47; public static void broadcastHeader(String header)
{
public static void broadcastHeader(String header) broadcastHeaderAndFooter(header, null);
{ }
broadcastHeaderAndFooter(header, null);
}
public static void broadcastFooter(String footer) public static void broadcastFooter(String footer)
{ {
broadcastHeaderAndFooter(null, footer); broadcastHeaderAndFooter(null, footer);
} }
public static void broadcastHeaderAndFooter(String header, String footer) public static void broadcastHeaderAndFooter(String header, String footer)
{ {
for (Player player : Bukkit.getOnlinePlayers()) for (Player player : Bukkit.getOnlinePlayers())
doHeaderAndFooter(player, header, footer); doHeaderAndFooter(player, header, footer);
} }
public static void setHeaderAndFooter(Player player, String header, String footer)
{
doHeaderAndFooter(player, header, footer);
}
public static void setHeader(Player p, String header) public static void setHeaderAndFooter(Player player, String header, String footer)
{ {
doHeaderAndFooter(p, header, null); doHeaderAndFooter(player, header, footer);
} }
public static void setHeader(Player p, String header)
{
doHeaderAndFooter(p, header, null);
}
public static void setFooter(Player p, String footer) public static void setFooter(Player p, String footer)
{ {
doHeaderAndFooter(p, null, footer); doHeaderAndFooter(p, null, footer);
} }
public static void doHeaderAndFooter(Player p, String rawHeader, String rawFooter) public static void doHeaderAndFooter(Player p, String rawHeader, String rawFooter)
{ {
CraftPlayer player = (CraftPlayer) p; CraftPlayer player = (CraftPlayer) p;
if (player.getHandle().playerConnection.networkManager.getVersion() != PROTOCOL_VERSION) return; IChatBaseComponent header = IChatBaseComponent.ChatSerializer.a(TextConverter.convert(rawHeader));
IChatBaseComponent header = ChatSerializer.a(TextConverter.convert(rawHeader)); IChatBaseComponent footer = IChatBaseComponent.ChatSerializer.a(TextConverter.convert(rawFooter));
IChatBaseComponent footer = ChatSerializer.a(TextConverter.convert(rawFooter)); if (header == null || footer == null)
if (header == null || footer == null) {
{ TabTitleCache titleCache = TabTitleCache.getTabTitle(p.getUniqueId());
TabTitleCache titleCache = TabTitleCache.getTabTitle(p.getUniqueId()); if (titleCache != null)
if (titleCache != null) {
{ if (header == null)
if (header == null) {
{ String headerString = titleCache.getHeader();
String headerString = titleCache.getHeader(); if (headerString != null)
if (headerString != null) {
{ rawHeader = headerString;
rawHeader = headerString; header = IChatBaseComponent.ChatSerializer.a(TextConverter.convert(headerString));
header = ChatSerializer.a(TextConverter.convert(headerString)); }
} }
} if (footer == null)
if (footer == null) {
{ String footerString = titleCache.getFooter();
String footerString = titleCache.getFooter(); if (footerString != null)
if (footerString != null) {
{ rawHeader = footerString;
rawHeader = footerString; header = IChatBaseComponent.ChatSerializer.a(TextConverter.convert(footerString));
header = ChatSerializer.a(TextConverter.convert(footerString)); }
} }
} }
} }
}
TabTitleCache.addTabTitle(p.getUniqueId(), new TabTitleCache(rawHeader, rawFooter)); TabTitleCache.addTabTitle(p.getUniqueId(), new TabTitleCache(rawHeader, rawFooter));
ProtocolInjector.PacketTabHeader packet = new ProtocolInjector.PacketTabHeader(header, footer); PacketPlayOutPlayerListHeaderFooter packet = new PacketPlayOutPlayerListHeaderFooter();
player.getHandle().playerConnection.sendPacket(packet); packet.a = header;
} packet.b = footer;
player.getHandle().playerConnection.sendPacket(packet);
private static class TextConverter }
{
public static String convert(String text) private static class TextConverter
{ {
if (text == null || text.length() == 0) public static String convert(String text)
{ {
return "\"\""; if (text == null || text.length() == 0)
} {
return "\"\"";
char c; }
int i;
int len = text.length(); char c;
StringBuilder sb = new StringBuilder(len + 4); int i;
String t; int len = text.length();
sb.append('"'); StringBuilder sb = new StringBuilder(len + 4);
String t;
for (i = 0; i < len; i += 1) sb.append('"');
{
c = text.charAt(i); for (i = 0; i < len; i += 1)
switch (c) {
{ c = text.charAt(i);
case '\\': switch (c)
case '"': {
sb.append('\\'); case '\\':
sb.append(c); case '"':
break; sb.append('\\');
case '/': sb.append(c);
sb.append('\\'); break;
sb.append(c); case '/':
break; sb.append('\\');
case '\b': sb.append(c);
sb.append("\\b"); break;
break; case '\b':
case '\t': sb.append("\\b");
sb.append("\\t"); break;
break; case '\t':
case '\n': sb.append("\\t");
sb.append("\\n"); break;
break; case '\n':
case '\f': sb.append("\\n");
sb.append("\\f"); break;
break; case '\f':
case '\r': sb.append("\\f");
sb.append("\\r"); break;
break; case '\r':
default: sb.append("\\r");
if (c < ' ') break;
{ default:
t = "000" + Integer.toHexString(c); if (c < ' ')
sb.append("\\u").append(t.substring(t.length() - 4)); {
} t = "000" + Integer.toHexString(c);
else sb.append("\\u").append(t.substring(t.length() - 4));
{ }
sb.append(c); else
} {
} sb.append(c);
} }
sb.append('"'); }
return sb.toString(); }
} sb.append('"');
return sb.toString();
public static String setPlayerName(Player player, String text) }
{
return text.replaceAll("(?i)\\{PLAYER\\}", player.getName()); public static String setPlayerName(Player player, String text)
} {
} return text.replaceAll("(?i)\\{PLAYER\\}", player.getName());
}
private static class TabTitleCache }
{
final private static Map<UUID, TabTitleCache> playerTabTitles = new HashMap<>(); private static class TabTitleCache
private String header; {
private String footer; final private static Map<UUID, TabTitleCache> playerTabTitles = new HashMap<>();
private String header;
public TabTitleCache(String header, String footer) private String footer;
{
this.header = header; public TabTitleCache(String header, String footer)
this.footer = footer; {
} this.header = header;
this.footer = footer;
public static TabTitleCache getTabTitle(UUID uuid) }
{
return playerTabTitles.get(uuid); public static TabTitleCache getTabTitle(UUID uuid)
} {
return playerTabTitles.get(uuid);
public static void addTabTitle(UUID uuid, TabTitleCache titleCache) }
{
playerTabTitles.put(uuid, titleCache); public static void addTabTitle(UUID uuid, TabTitleCache titleCache)
} {
playerTabTitles.put(uuid, titleCache);
public static void removeTabTitle(UUID uuid) }
{
playerTabTitles.remove(uuid); public static void removeTabTitle(UUID uuid)
} {
playerTabTitles.remove(uuid);
public String getHeader() }
{
return header; public String getHeader()
} {
return header;
public String getFooter() }
{
return footer; public String getFooter()
} {
} return footer;
}
}
} }

View File

@ -1,12 +1,11 @@
package mineplex.core.common.util; package mineplex.core.common.util;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_8_R2.entity.CraftPlayer;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import net.minecraft.server.v1_7_R4.ChatMessage; import net.minecraft.server.v1_8_R2.ChatMessage;
import net.minecraft.server.v1_8_R2.Packet;
import org.spigotmc.ProtocolInjector.PacketTitle; import net.minecraft.server.v1_8_R2.PacketPlayOutTitle;
import org.spigotmc.ProtocolInjector.PacketTitle.Action;
/** /**
* Created by Shaun on 9/5/2014. * Created by Shaun on 9/5/2014.
@ -52,7 +51,7 @@ public class UtilTextMiddle
text = ""; text = "";
ChatMessage message = new ChatMessage(text); ChatMessage message = new ChatMessage(text);
PacketTitle packet = new PacketTitle(Action.TITLE, message); PacketPlayOutTitle packet = new PacketPlayOutTitle(PacketPlayOutTitle.EnumTitleAction.TITLE, message);
sendPacket(packet, players); sendPacket(packet, players);
} }
@ -67,7 +66,7 @@ public class UtilTextMiddle
text = ""; text = "";
ChatMessage message = new ChatMessage(text); ChatMessage message = new ChatMessage(text);
PacketTitle packet = new PacketTitle(Action.SUBTITLE, message); PacketPlayOutTitle packet = new PacketPlayOutTitle(PacketPlayOutTitle.EnumTitleAction.SUBTITLE, message);
sendPacket(packet, players); sendPacket(packet, players);
} }
@ -78,7 +77,7 @@ public class UtilTextMiddle
*/ */
private static void setTimings(int fadeInTicks, int stayTicks, int fadeOutTicks, Player... players) private static void setTimings(int fadeInTicks, int stayTicks, int fadeOutTicks, Player... players)
{ {
PacketTitle packet = new PacketTitle(Action.TIMES, fadeInTicks, stayTicks, fadeOutTicks); PacketPlayOutTitle packet = new PacketPlayOutTitle(fadeInTicks, stayTicks, fadeOutTicks);
sendPacket(packet, players); sendPacket(packet, players);
} }
@ -87,7 +86,7 @@ public class UtilTextMiddle
*/ */
public static void clear(Player... players) public static void clear(Player... players)
{ {
PacketTitle packet = new PacketTitle(Action.CLEAR); PacketPlayOutTitle packet = new PacketPlayOutTitle(PacketPlayOutTitle.EnumTitleAction.CLEAR, null);
sendPacket(packet, players); sendPacket(packet, players);
} }
@ -98,18 +97,15 @@ public class UtilTextMiddle
*/ */
public static void reset(Player... players) public static void reset(Player... players)
{ {
PacketTitle packet = new PacketTitle(Action.RESET); PacketPlayOutTitle packet = new PacketPlayOutTitle(PacketPlayOutTitle.EnumTitleAction.RESET, null);
sendPacket(packet, players); sendPacket(packet, players);
} }
private static void sendPacket(PacketTitle packet, Player... players) private static void sendPacket(Packet packet, Player... players)
{ {
for (Player player : players) for (Player player : players)
{ {
if (UtilPlayer.is1_8(player)) ((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
{
((CraftPlayer) player).getHandle().playerConnection.sendPacket(packet);
}
} }
} }

View File

@ -1,16 +1,16 @@
package mineplex.core.common.util; package mineplex.core.common.util;
import mineplex.core.common.DummyEntity; import mineplex.core.common.DummyEntity;
import net.minecraft.server.v1_7_R4.DataWatcher; import net.minecraft.server.v1_8_R2.DataWatcher;
import net.minecraft.server.v1_7_R4.MathHelper; import net.minecraft.server.v1_8_R2.MathHelper;
import net.minecraft.server.v1_7_R4.PacketPlayOutEntityDestroy; import net.minecraft.server.v1_8_R2.PacketPlayOutEntityDestroy;
import net.minecraft.server.v1_7_R4.PacketPlayOutSpawnEntityLiving; import net.minecraft.server.v1_8_R2.PacketPlayOutSpawnEntityLiving;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.craftbukkit.v1_7_R4.CraftWorld; import org.bukkit.craftbukkit.v1_8_R2.CraftWorld;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; import org.bukkit.craftbukkit.v1_8_R2.entity.CraftPlayer;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;

View File

@ -7,6 +7,7 @@ import java.util.Map.Entry;
import java.util.UUID; import java.util.UUID;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import com.google.gson.Gson;
import mineplex.core.MiniPlugin; import mineplex.core.MiniPlugin;
import mineplex.core.account.command.UpdateRank; import mineplex.core.account.command.UpdateRank;
import mineplex.core.account.event.ClientUnloadEvent; import mineplex.core.account.event.ClientUnloadEvent;
@ -28,7 +29,6 @@ import mineplex.serverdata.servers.ServerManager;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.OfflinePlayer; import org.bukkit.OfflinePlayer;
import org.bukkit.craftbukkit.libs.com.google.gson.Gson;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;

View File

@ -10,7 +10,7 @@ import java.util.List;
import java.util.UUID; import java.util.UUID;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.libs.com.google.gson.reflect.TypeToken; import com.google.gson.reflect.TypeToken;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import mineplex.core.account.ILoginProcessor; import mineplex.core.account.ILoginProcessor;

View File

@ -3,12 +3,12 @@ package mineplex.core.disguise.disguises;
import mineplex.core.common.*; import mineplex.core.common.*;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity; import org.bukkit.craftbukkit.v1_8_R2.entity.CraftEntity;
import net.minecraft.server.v1_7_R4.DataWatcher; import net.minecraft.server.v1_8_R2.DataWatcher;
import net.minecraft.server.v1_7_R4.Entity; import net.minecraft.server.v1_8_R2.Entity;
import net.minecraft.server.v1_7_R4.Packet; import net.minecraft.server.v1_8_R2.Packet;
import net.minecraft.server.v1_7_R4.PacketPlayOutEntityMetadata; import net.minecraft.server.v1_8_R2.PacketPlayOutEntityMetadata;
public abstract class DisguiseBase public abstract class DisguiseBase
{ {

View File

@ -1,15 +1,13 @@
package mineplex.core.disguise.disguises; package mineplex.core.disguise.disguises;
import org.spigotmc.ProtocolData;
public abstract class DisguiseHuman extends DisguiseLiving public abstract class DisguiseHuman extends DisguiseLiving
{ {
public DisguiseHuman(org.bukkit.entity.Entity entity) public DisguiseHuman(org.bukkit.entity.Entity entity)
{ {
super(entity); super(entity);
DataWatcher.a(10, new ProtocolData.HiddenByte( (byte) 0 ) ); // Spigot - protocol patch, handle new metadata value DataWatcher.a(10, (byte) 0); // todo
DataWatcher.a(16, new ProtocolData.DualByte( (byte) 0, (byte) 0 ) ); DataWatcher.a(16, (byte) 0);
DataWatcher.a(17, Float.valueOf(0.0F)); DataWatcher.a(17, Float.valueOf(0.0F));
DataWatcher.a(18, Integer.valueOf(0)); DataWatcher.a(18, Integer.valueOf(0));
} }

View File

@ -2,7 +2,7 @@ package mineplex.core.disguise.disguises;
import java.util.Random; import java.util.Random;
import net.minecraft.server.v1_7_R4.EntityLiving; import net.minecraft.server.v1_8_R2.EntityLiving;
public abstract class DisguiseLiving extends DisguiseBase public abstract class DisguiseLiving extends DisguiseBase
{ {

View File

@ -5,11 +5,11 @@ import java.sql.SQLException;
import java.util.UUID; import java.util.UUID;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.craftbukkit.libs.com.google.gson.Gson;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.java.JavaPlugin;
import com.google.gson.Gson;
import mineplex.core.MiniDbClientPlugin; import mineplex.core.MiniDbClientPlugin;
import mineplex.core.account.CoreClientManager; import mineplex.core.account.CoreClientManager;
import mineplex.core.account.event.ClientWebResponseEvent; import mineplex.core.account.event.ClientWebResponseEvent;

View File

@ -19,17 +19,18 @@ import mineplex.core.common.util.UtilEnt;
import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilServer;
import mineplex.core.disguise.DisguiseManager; import mineplex.core.disguise.DisguiseManager;
import mineplex.core.donation.DonationManager; import mineplex.core.donation.DonationManager;
import net.minecraft.server.v1_7_R4.EntityCreature; import net.minecraft.server.v1_8_R2.EntityCreature;
import net.minecraft.server.v1_7_R4.EntityWither; import net.minecraft.server.v1_8_R2.EntityWither;
import net.minecraft.server.v1_7_R4.Navigation; import net.minecraft.server.v1_8_R2.Navigation;
import net.minecraft.server.v1_8_R2.NavigationAbstract;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.craftbukkit.libs.com.google.gson.Gson; import com.google.gson.Gson;
import org.bukkit.craftbukkit.v1_7_R4.CraftWorld; import org.bukkit.craftbukkit.v1_8_R2.CraftWorld;
import org.bukkit.craftbukkit.v1_7_R4.entity.CraftCreature; import org.bukkit.craftbukkit.v1_8_R2.entity.CraftCreature;
import org.bukkit.entity.Ageable; import org.bukkit.entity.Ageable;
import org.bukkit.entity.Creature; import org.bukkit.entity.Creature;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
@ -328,7 +329,7 @@ public class PetManager extends MiniClientPlugin<PetClient>
if ((xDiff + yDiff + zDiff) > 4) if ((xDiff + yDiff + zDiff) > 4)
{ {
EntityCreature ec = ((CraftCreature) pet).getHandle(); EntityCreature ec = ((CraftCreature) pet).getHandle();
Navigation nav = ec.getNavigation(); NavigationAbstract nav = ec.getNavigation();
int xIndex = -1; int xIndex = -1;
int zIndex = -1; int zIndex = -1;

View File

@ -2,7 +2,7 @@ package mineplex.core.pet.repository;
import java.util.List; import java.util.List;
import org.bukkit.craftbukkit.libs.com.google.gson.reflect.TypeToken; import com.google.gson.reflect.TypeToken;
import mineplex.core.pet.repository.token.PetChangeToken; import mineplex.core.pet.repository.token.PetChangeToken;
import mineplex.core.pet.repository.token.PetExtraToken; import mineplex.core.pet.repository.token.PetExtraToken;

View File

@ -3,13 +3,13 @@ package mineplex.core.pet.types;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.util.HashMap; import java.util.HashMap;
import org.bukkit.craftbukkit.v1_7_R4.SpigotTimings; import org.bukkit.craftbukkit.v1_8_R2.SpigotTimings;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
import net.minecraft.server.v1_7_R4.EntityTypes; import net.minecraft.server.v1_8_R2.EntityTypes;
import net.minecraft.server.v1_7_R4.EntityWither; import net.minecraft.server.v1_8_R2.EntityWither;
import net.minecraft.server.v1_7_R4.MathHelper; import net.minecraft.server.v1_8_R2.MathHelper;
import net.minecraft.server.v1_7_R4.World; import net.minecraft.server.v1_8_R2.World;
public class CustomWither extends EntityWither public class CustomWither extends EntityWither
{ {

View File

@ -8,10 +8,10 @@ import java.util.ArrayList;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.WorldCreator; import org.bukkit.WorldCreator;
import net.minecraft.util.org.apache.commons.io.FileUtils;
import mineplex.core.common.util.MapUtil; import mineplex.core.common.util.MapUtil;
import mineplex.core.common.util.ZipUtil; import mineplex.core.common.util.ZipUtil;
import org.apache.commons.io.FileUtils;
public class WorldManager public class WorldManager
{ {

View File

@ -5,12 +5,12 @@ import java.io.IOException;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import net.minecraft.util.org.apache.commons.io.FileUtils;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.MapUtil; import mineplex.core.common.util.MapUtil;
import mineplex.mapparser.GameType; import mineplex.mapparser.GameType;
import mineplex.mapparser.MapParser; import mineplex.mapparser.MapParser;
import org.apache.commons.io.FileUtils;
/** /**
* Created by Shaun on 8/16/2014. * Created by Shaun on 8/16/2014.

View File

@ -4,9 +4,9 @@ import java.io.File;
import java.io.IOException; import java.io.IOException;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import net.minecraft.util.org.apache.commons.io.FileUtils;
import mineplex.mapparser.MapParser; import mineplex.mapparser.MapParser;
import org.apache.commons.io.FileUtils;
/** /**
* Created by Shaun on 8/16/2014. * Created by Shaun on 8/16/2014.

View File

@ -4,12 +4,12 @@ import java.io.File;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
import net.minecraft.util.org.apache.commons.io.FileUtils;
import mineplex.core.common.util.F; import mineplex.core.common.util.F;
import mineplex.core.common.util.MapUtil; import mineplex.core.common.util.MapUtil;
import mineplex.mapparser.GameType; import mineplex.mapparser.GameType;
import mineplex.mapparser.MapParser; import mineplex.mapparser.MapParser;
import org.apache.commons.io.FileUtils;
/** /**
* Created by Shaun on 8/16/2014. * Created by Shaun on 8/16/2014.