Remove some snapshot related patches in preparation for update.
This commit is contained in:
parent
b32a7595bf
commit
7a108da7f3
@ -1,11 +1,11 @@
|
||||
From 0667d6da84d92d80b6be70145083fa4cc5bd913c Mon Sep 17 00:00:00 2001
|
||||
From cf42ff147f5671741937ce529c714d39aeadc797 Mon Sep 17 00:00:00 2001
|
||||
From: Aikar <aikar@aikar.co>
|
||||
Date: Sun, 24 Feb 2013 20:45:20 +1100
|
||||
Subject: [PATCH] Enable Improved Ping Sending
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
|
||||
index 27f9dc9..5788872 100644
|
||||
index ca06f60..787c764 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
|
||||
@@ -62,6 +62,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
@ -17,7 +17,7 @@ index 27f9dc9..5788872 100644
|
||||
// Spigot start
|
||||
public boolean collidesWithEntities = true;
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
|
||||
index 25810d3..bf353e0 100644
|
||||
index c4698d4..59ba67c 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerList.java
|
||||
@@ -784,6 +784,8 @@ public abstract class PlayerList {
|
||||
@ -61,5 +61,5 @@ index 25810d3..bf353e0 100644
|
||||
|
||||
public void sendAll(Packet packet) {
|
||||
--
|
||||
1.8.5.2.msysgit.0
|
||||
1.8.3.2
|
||||
|
@ -1,136 +0,0 @@
|
||||
From 433062e42e703ec2032fcdef0845b3569c8635a7 Mon Sep 17 00:00:00 2001
|
||||
From: md_5 <git@md-5.net>
|
||||
Date: Wed, 26 Mar 2014 21:21:35 +1100
|
||||
Subject: [PATCH] Fix several occurances of missed diff.
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java
|
||||
index e91d53f..22becf7 100644
|
||||
--- a/src/main/java/net/minecraft/server/DedicatedServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/DedicatedServer.java
|
||||
@@ -182,7 +182,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer
|
||||
this.c((this.getMaxBuildHeight() + 8) / 16 * 16);
|
||||
this.c(MathHelper.a(this.getMaxBuildHeight(), 64, 256));
|
||||
this.propertyManager.a("max-build-height", Integer.valueOf(this.getMaxBuildHeight()));
|
||||
- h.info("Preparing level \"" + this.M() + "\"");
|
||||
+ h.info("Preparing level \"" + this.N() + "\"");
|
||||
this.a(this.N(), this.N(), k, worldtype, s2);
|
||||
long i1 = System.nanoTime() - j;
|
||||
String s3 = String.format("%.3fs", new Object[] { Double.valueOf((double) i1 / 1.0E9D)});
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityEnderDragon.java b/src/main/java/net/minecraft/server/EntityEnderDragon.java
|
||||
index f53b183..dbf30cb 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityEnderDragon.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityEnderDragon.java
|
||||
@@ -135,7 +135,7 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo
|
||||
d2 = this.locZ + (this.bj - this.locZ) / (double) this.bg;
|
||||
d3 = MathHelper.g(this.bk - (double) this.yaw);
|
||||
this.yaw = (float) ((double) this.yaw + d3 / (double) this.bg);
|
||||
- this.pitch = (float) ((double) this.pitch + (this.bm - (double) this.pitch) / (double) this.bg);
|
||||
+ this.pitch = (float) ((double) this.pitch + (this.bl - (double) this.pitch) / (double) this.bg);
|
||||
--this.bg;
|
||||
this.setPosition(d0, d1, d2);
|
||||
this.b(this.yaw, this.pitch);
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java
|
||||
index 1f0e29a..b0b1462 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityHuman.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityHuman.java
|
||||
@@ -78,7 +78,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
|
||||
ChunkCoordinates chunkcoordinates = world.getSpawn();
|
||||
|
||||
this.setPositionRotation((double) chunkcoordinates.x + 0.5D, (double) (chunkcoordinates.y + 1), (double) chunkcoordinates.z + 0.5D, 0.0F, 0.0F);
|
||||
- this.az = 180.0F;
|
||||
+ this.aZ = 180.0F;
|
||||
this.maxFireTicks = 20;
|
||||
}
|
||||
|
||||
@@ -190,7 +190,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
|
||||
}
|
||||
|
||||
if (d0 < -d3) {
|
||||
- this.bu = this.by = this.locX;
|
||||
+ this.bu = this.bx = this.locX;
|
||||
}
|
||||
|
||||
if (d2 < -d3) {
|
||||
@@ -198,7 +198,7 @@ public abstract class EntityHuman extends EntityLiving implements ICommandListen
|
||||
}
|
||||
|
||||
if (d1 < -d3) {
|
||||
- this.bv = this.bz = this.locY;
|
||||
+ this.bv = this.by = this.locY;
|
||||
}
|
||||
|
||||
this.bx += d0 * 0.25D;
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java
|
||||
index 0f1bcc7..5eb893f 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityItem.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityItem.java
|
||||
@@ -320,7 +320,7 @@ public class EntityItem extends Entity {
|
||||
public ItemStack getItemStack() {
|
||||
ItemStack itemstack = this.getDataWatcher().getItemStack(10);
|
||||
|
||||
- return itemstack == null ? new ItemStack(Blocks.STONE) : itemstack;
|
||||
+ return itemstack == null ? new ItemStack(Blocks.STONE) : itemstack;
|
||||
}
|
||||
|
||||
public void setItemStack(ItemStack itemstack) {
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityMinecartAbstract.java b/src/main/java/net/minecraft/server/EntityMinecartAbstract.java
|
||||
index f565028..166206c 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityMinecartAbstract.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityMinecartAbstract.java
|
||||
@@ -199,7 +199,7 @@ public abstract class EntityMinecartAbstract extends Entity {
|
||||
}
|
||||
|
||||
if (this.locY < -64.0D) {
|
||||
- this.G();
|
||||
+ this.F();
|
||||
}
|
||||
|
||||
int i;
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
index b2cde75..b8d08e2 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerConnection.java
|
||||
@@ -353,7 +353,7 @@ public class PlayerConnection implements PacketPlayInListener {
|
||||
}
|
||||
|
||||
this.player.i();
|
||||
- this.player.W = 0.0F;
|
||||
+ this.player.V = 0.0F;
|
||||
this.player.setLocation(this.y, this.z, this.q, f2, f3);
|
||||
if (!this.checkMovement) {
|
||||
return;
|
||||
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
|
||||
index c4698d4..25810d3 100644
|
||||
--- a/src/main/java/net/minecraft/server/PlayerList.java
|
||||
+++ b/src/main/java/net/minecraft/server/PlayerList.java
|
||||
@@ -51,7 +51,7 @@ public abstract class PlayerList {
|
||||
public IPlayerFileData playerFileData; // CraftBukkit - private -> public
|
||||
public boolean hasWhitelist; // CraftBukkit - private -> public
|
||||
protected int maxPlayers;
|
||||
- protected int m;
|
||||
+ private int m;
|
||||
private EnumGamemode n;
|
||||
private boolean o;
|
||||
private int p;
|
||||
diff --git a/src/main/java/net/minecraft/server/StatisticManager.java b/src/main/java/net/minecraft/server/StatisticManager.java
|
||||
index e86e21b..418ec40 100644
|
||||
--- a/src/main/java/net/minecraft/server/StatisticManager.java
|
||||
+++ b/src/main/java/net/minecraft/server/StatisticManager.java
|
||||
@@ -8,11 +8,10 @@ public class StatisticManager {
|
||||
|
||||
protected final Map a = Maps.newConcurrentMap();
|
||||
|
||||
- public StatisticManager() {
|
||||
- }
|
||||
+ public StatisticManager() {}
|
||||
|
||||
public boolean a(Achievement achievement) {
|
||||
- return this.getStatisticValue((Statistic) achievement) > 0;
|
||||
+ return this.getStatisticValue(achievement) > 0;
|
||||
}
|
||||
|
||||
public boolean b(Achievement achievement) {
|
||||
--
|
||||
1.8.5.2.msysgit.0
|
||||
|
@ -1,11 +1,11 @@
|
||||
From 199e63f001def1fb39642d5f6448544493ec37c7 Mon Sep 17 00:00:00 2001
|
||||
From 3f5a0704fe6de51b06e554c07f37237240d4022e Mon Sep 17 00:00:00 2001
|
||||
From: md_5 <git@md-5.net>
|
||||
Date: Sun, 30 Mar 2014 09:15:35 +1100
|
||||
Subject: [PATCH] Prevent getOfflinePlayer(UUID) on main thread.
|
||||
|
||||
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
index 4c089ea..8961015 100644
|
||||
index 707410b..446b046 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
|
||||
@@ -1341,6 +1341,7 @@ public final class CraftServer implements Server {
|
@ -1,11 +1,11 @@
|
||||
From 8c8e29dbb30f6945a78a1a215a1e866421013bcf Mon Sep 17 00:00:00 2001
|
||||
From 3acd3a83d766bdd1a50b42110532e56131a5716c Mon Sep 17 00:00:00 2001
|
||||
From: drXor <mcyoungsota@gmail.com>
|
||||
Date: Sat, 29 Mar 2014 13:44:25 -0400
|
||||
Subject: [PATCH] Configurable dragon death and wither spawn sounds
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityEnderDragon.java b/src/main/java/net/minecraft/server/EntityEnderDragon.java
|
||||
index dbf30cb..64b0992 100644
|
||||
index f53b183..9a8408c 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityEnderDragon.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityEnderDragon.java
|
||||
@@ -550,7 +550,14 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo
|
@ -1,4 +1,4 @@
|
||||
From 21c02e2e18bf05f41a934f259d3c80547d5c24fb Mon Sep 17 00:00:00 2001
|
||||
From 4a11712fc763f0233db7c951d714cfb1b41e8555 Mon Sep 17 00:00:00 2001
|
||||
From: FrozenBrain <carstenbamsti@googlemail.com>
|
||||
Date: Sun, 23 Mar 2014 01:49:13 +0100
|
||||
Subject: [PATCH] Fix TileEntities getting ticked after being queued for
|
@ -1,4 +1,4 @@
|
||||
From ed6e47fa12d55ee06fcb40251756390f3e8fb6c3 Mon Sep 17 00:00:00 2001
|
||||
From 4b7d88914d7e2c7ec619697ee2d60dabea61aeb7 Mon Sep 17 00:00:00 2001
|
||||
From: Thinkofdeath <thethinkofdeath@gmail.com>
|
||||
Date: Fri, 11 Apr 2014 11:16:34 +0100
|
||||
Subject: [PATCH] Display 'Spigot' in client crashes, server lists and Mojang
|
||||
@ -6,10 +6,10 @@ Subject: [PATCH] Display 'Spigot' in client crashes, server lists and Mojang
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
index 96b904c..b314181 100644
|
||||
index 8ce9dd7..cbf4ade 100644
|
||||
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
||||
@@ -957,7 +957,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
|
||||
@@ -955,7 +955,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
|
||||
}
|
||||
|
||||
public String getServerModName() {
|
||||
@ -19,5 +19,5 @@ index 96b904c..b314181 100644
|
||||
|
||||
public CrashReport b(CrashReport crashreport) {
|
||||
--
|
||||
1.8.5.2.msysgit.0
|
||||
1.8.3.2
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,316 +0,0 @@
|
||||
From a03d3471b1741d354da03ff76313f057e5a0b51f Mon Sep 17 00:00:00 2001
|
||||
From: Thinkofdeath <thethinkofdeath@gmail.com>
|
||||
Date: Wed, 9 Apr 2014 13:29:57 +0100
|
||||
Subject: [PATCH] Convert player heads async
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
|
||||
index 90f32ed..6c2e905 100644
|
||||
--- a/src/main/java/net/minecraft/server/Chunk.java
|
||||
+++ b/src/main/java/net/minecraft/server/Chunk.java
|
||||
@@ -513,6 +513,13 @@ public class Chunk {
|
||||
if (tileentity != null) {
|
||||
tileentity.u();
|
||||
}
|
||||
+
|
||||
+ // Spigot start
|
||||
+ if ( tileentity instanceof TileEntitySkull )
|
||||
+ {
|
||||
+ org.spigotmc.HeadConverter.convertHead( (TileEntitySkull) tileentity );
|
||||
+ }
|
||||
+ // Spigot end
|
||||
}
|
||||
|
||||
this.n = true;
|
||||
diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
|
||||
index fb262bc..4c086d3 100644
|
||||
--- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java
|
||||
+++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java
|
||||
@@ -378,6 +378,12 @@ public class ChunkRegionLoader implements IChunkLoader, IAsyncChunkSaver {
|
||||
TileEntity tileentity = TileEntity.c(nbttagcompound4);
|
||||
|
||||
if (tileentity != null) {
|
||||
+ // Spigot start
|
||||
+ if ( tileentity instanceof TileEntitySkull )
|
||||
+ {
|
||||
+ org.spigotmc.HeadConverter.convertHead( (TileEntitySkull) tileentity );
|
||||
+ }
|
||||
+ // Spigot end
|
||||
chunk.a(tileentity);
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/ItemSkull.java b/src/main/java/net/minecraft/server/ItemSkull.java
|
||||
index 6b2bf9b..5a74142 100644
|
||||
--- a/src/main/java/net/minecraft/server/ItemSkull.java
|
||||
+++ b/src/main/java/net/minecraft/server/ItemSkull.java
|
||||
@@ -68,6 +68,7 @@ public class ItemSkull extends Item {
|
||||
((TileEntitySkull) tileentity).setSkullType(itemstack.getData(), s);
|
||||
((TileEntitySkull) tileentity).setRotation(i1);
|
||||
((BlockSkull) Blocks.SKULL).a(world, i, j, k, (TileEntitySkull) tileentity);
|
||||
+ org.spigotmc.HeadConverter.convertHead( (TileEntitySkull) tileentity ); // Spigot
|
||||
}
|
||||
|
||||
--itemstack.count;
|
||||
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutTileEntityData.java b/src/main/java/net/minecraft/server/PacketPlayOutTileEntityData.java
|
||||
index 005f1fe..4780c53 100644
|
||||
--- a/src/main/java/net/minecraft/server/PacketPlayOutTileEntityData.java
|
||||
+++ b/src/main/java/net/minecraft/server/PacketPlayOutTileEntityData.java
|
||||
@@ -1,5 +1,7 @@
|
||||
package net.minecraft.server;
|
||||
|
||||
+import net.minecraft.util.com.mojang.authlib.GameProfile;
|
||||
+
|
||||
public class PacketPlayOutTileEntityData extends Packet {
|
||||
|
||||
private int a;
|
||||
@@ -41,12 +43,14 @@ public class PacketPlayOutTileEntityData extends Packet {
|
||||
packetdataserializer.writeShort(this.b);
|
||||
packetdataserializer.writeInt(this.c);
|
||||
packetdataserializer.writeByte((byte) this.d);
|
||||
- if ( this.e.hasKey( "ExtraType" ) )
|
||||
+ if ( this.e.hasKey( "ExtraType" ) && !this.e.hasKey( "Owner" ) )
|
||||
{
|
||||
NBTTagCompound profile = new NBTTagCompound();
|
||||
profile.setString( "Name", this.e.getString( "ExtraType" ) );
|
||||
profile.setString( "Id", "" );
|
||||
this.e.set( "Owner", profile );
|
||||
+ } else {
|
||||
+ this.e.remove( "ExtraType" );
|
||||
}
|
||||
packetdataserializer.a(this.e);
|
||||
}
|
||||
diff --git a/src/main/java/net/minecraft/server/TileEntitySkull.java b/src/main/java/net/minecraft/server/TileEntitySkull.java
|
||||
index b241cfe..925e017 100644
|
||||
--- a/src/main/java/net/minecraft/server/TileEntitySkull.java
|
||||
+++ b/src/main/java/net/minecraft/server/TileEntitySkull.java
|
||||
@@ -5,6 +5,7 @@ public class TileEntitySkull extends TileEntity {
|
||||
private int a;
|
||||
private int i;
|
||||
private String j = "";
|
||||
+ private NBTTagCompound owner = null;
|
||||
|
||||
public TileEntitySkull() {}
|
||||
|
||||
@@ -13,6 +14,7 @@ public class TileEntitySkull extends TileEntity {
|
||||
nbttagcompound.setByte("SkullType", (byte) (this.a & 255));
|
||||
nbttagcompound.setByte("Rot", (byte) (this.i & 255));
|
||||
nbttagcompound.setString("ExtraType", this.j);
|
||||
+ if ( owner != null ) nbttagcompound.set( "Owner", owner );
|
||||
}
|
||||
|
||||
public void a(NBTTagCompound nbttagcompound) {
|
||||
@@ -22,6 +24,10 @@ public class TileEntitySkull extends TileEntity {
|
||||
if (nbttagcompound.hasKeyOfType("ExtraType", 8)) {
|
||||
this.j = nbttagcompound.getString("ExtraType");
|
||||
}
|
||||
+ if ( nbttagcompound.hasKey( "Owner" ) )
|
||||
+ {
|
||||
+ owner = nbttagcompound.getCompound( "Owner" );
|
||||
+ }
|
||||
}
|
||||
|
||||
public Packet getUpdatePacket() {
|
||||
diff --git a/src/main/java/org/spigotmc/HeadConverter.java b/src/main/java/org/spigotmc/HeadConverter.java
|
||||
new file mode 100644
|
||||
index 0000000..ad0454a
|
||||
--- /dev/null
|
||||
+++ b/src/main/java/org/spigotmc/HeadConverter.java
|
||||
@@ -0,0 +1,195 @@
|
||||
+package org.spigotmc;
|
||||
+
|
||||
+import com.google.common.base.Charsets;
|
||||
+import com.google.common.util.concurrent.ThreadFactoryBuilder;
|
||||
+import com.google.gson.JsonArray;
|
||||
+import com.google.gson.JsonElement;
|
||||
+import com.google.gson.JsonObject;
|
||||
+import com.google.gson.JsonParser;
|
||||
+import net.minecraft.server.EntityHuman;
|
||||
+import net.minecraft.server.MinecraftServer;
|
||||
+import net.minecraft.server.NBTBase;
|
||||
+import net.minecraft.server.NBTTagCompound;
|
||||
+import net.minecraft.server.NBTTagList;
|
||||
+import net.minecraft.server.TileEntitySkull;
|
||||
+import net.minecraft.util.com.mojang.authlib.GameProfile;
|
||||
+import org.bukkit.Bukkit;
|
||||
+import org.spigotmc.authlib.properties.Property;
|
||||
+
|
||||
+import java.io.IOException;
|
||||
+import java.io.InputStreamReader;
|
||||
+import java.io.OutputStream;
|
||||
+import java.net.HttpURLConnection;
|
||||
+import java.net.MalformedURLException;
|
||||
+import java.net.URL;
|
||||
+import java.util.Set;
|
||||
+import java.util.UUID;
|
||||
+import java.util.concurrent.Executor;
|
||||
+import java.util.concurrent.Executors;
|
||||
+
|
||||
+public class HeadConverter
|
||||
+{
|
||||
+ private static final Executor executor = Executors.newFixedThreadPool( 3,
|
||||
+ new ThreadFactoryBuilder()
|
||||
+ .setNameFormat( "Head Conversion Thread - %1$d" )
|
||||
+ .build()
|
||||
+ );
|
||||
+ private static boolean hasWarned = false;
|
||||
+
|
||||
+ public static void convertHead(final TileEntitySkull head)
|
||||
+ {
|
||||
+ if ( head.getSkullType() != 3 )
|
||||
+ {
|
||||
+ return;
|
||||
+ }
|
||||
+ final int x = head.x;
|
||||
+ final int y = head.y;
|
||||
+ final int z = head.z;
|
||||
+ final String name = head.getExtraType();
|
||||
+ final NBTTagCompound tag = new NBTTagCompound();
|
||||
+ head.b( tag );
|
||||
+ if ( tag.hasKey( "Owner" ) && tag.getCompound( "Owner" ).hasKey( "Properties" ) )
|
||||
+ {
|
||||
+ // Validate the head
|
||||
+ org.spigotmc.authlib.GameProfile profile = getProfile( tag.getCompound( "Owner" ) );
|
||||
+ if ( MinecraftServer.getServer().newSessionService.getTextures( profile, false ).size() == 0 ) {
|
||||
+ tag.remove( "Owner" );
|
||||
+ head.a( tag );
|
||||
+ } else
|
||||
+ {
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ executor.execute( new Runnable()
|
||||
+ {
|
||||
+ @Override
|
||||
+ public void run()
|
||||
+ {
|
||||
+ HttpURLConnection connection = null;
|
||||
+ try
|
||||
+ {
|
||||
+ // Firstly convert name -> uuid
|
||||
+ URL accountsAPI = new URL( "https://api.mojang.com/profiles/page/1" );
|
||||
+
|
||||
+ connection = (HttpURLConnection) accountsAPI.openConnection();
|
||||
+ connection.setRequestProperty( "Content-Type", "application/json" );
|
||||
+ connection.setRequestMethod( "POST" );
|
||||
+ connection.setDoInput( true );
|
||||
+ connection.setDoOutput( true );
|
||||
+
|
||||
+ OutputStream outputStream = connection.getOutputStream();
|
||||
+ outputStream.write( ( "[{\"name\":\"" + name +
|
||||
+ "\", \"agent\":\"minecraft\"}]" ).getBytes( Charsets.UTF_8 ) );
|
||||
+ outputStream.flush();
|
||||
+ outputStream.close();
|
||||
+
|
||||
+ InputStreamReader inputStreamReader = new InputStreamReader( connection.getInputStream() );
|
||||
+ JsonObject response;
|
||||
+ try
|
||||
+ {
|
||||
+ response = new JsonParser().parse( inputStreamReader )
|
||||
+ .getAsJsonObject();
|
||||
+ } finally
|
||||
+ {
|
||||
+ inputStreamReader.close();
|
||||
+ }
|
||||
+ if ( response.get( "size" ).getAsInt() != 1 ||
|
||||
+ response.getAsJsonArray( "profiles" ).size() != 1 )
|
||||
+ {
|
||||
+ return;
|
||||
+ }
|
||||
+ String uuid = response.getAsJsonArray( "profiles" )
|
||||
+ .get( 0 ).getAsJsonObject()
|
||||
+ .get( "id" ).getAsString();
|
||||
+ String correctedName = response.getAsJsonArray( "profiles" )
|
||||
+ .get( 0 ).getAsJsonObject()
|
||||
+ .get( "name" ).getAsString();
|
||||
+
|
||||
+ NBTTagCompound owner = new NBTTagCompound();
|
||||
+ GameProfile gameProfile = new GameProfile( uuid, correctedName );
|
||||
+ owner.setString( "Name", correctedName );
|
||||
+ owner.setString( "Id", EntityHuman.a( gameProfile ).toString() );
|
||||
+
|
||||
+ NBTTagCompound properties = new NBTTagCompound();
|
||||
+
|
||||
+ // Now to lookup the textures
|
||||
+ org.spigotmc.authlib.GameProfile newStyleProfile = new org.spigotmc.authlib.GameProfile(
|
||||
+ EntityHuman.a( gameProfile ),
|
||||
+ gameProfile.getName() );
|
||||
+ MinecraftServer.getServer().newSessionService.fillProfileProperties( newStyleProfile );
|
||||
+
|
||||
+ if ( newStyleProfile.getProperties().size() < 1)
|
||||
+ {
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+
|
||||
+ for ( String key : newStyleProfile.getProperties().keys() )
|
||||
+ {
|
||||
+ NBTTagList propList = new NBTTagList();
|
||||
+ for ( Property prop : newStyleProfile.getProperties().get( key ) )
|
||||
+ {
|
||||
+ NBTTagCompound nprop = new NBTTagCompound();
|
||||
+ nprop.setString( "Signature", prop.getSignature() );
|
||||
+ nprop.setString( "Value", prop.getValue() );
|
||||
+ propList.add( nprop );
|
||||
+ }
|
||||
+ properties.set( key, propList );
|
||||
+ }
|
||||
+
|
||||
+ owner.set( "Properties", properties );
|
||||
+ tag.set( "Owner", owner );
|
||||
+
|
||||
+ // Update the tile entity
|
||||
+ MinecraftServer.getServer().processQueue.add( new Runnable()
|
||||
+ {
|
||||
+ @Override
|
||||
+ public void run()
|
||||
+ {
|
||||
+ head.a( tag );
|
||||
+ // Send the updated version
|
||||
+ MinecraftServer.getServer().getPlayerList().sendPacketNearby(
|
||||
+ x, y, z, head.getWorld().spigotConfig.viewDistance * 16, head.getWorld().worldData.j(),
|
||||
+ head.getUpdatePacket() );
|
||||
+ }
|
||||
+ } );
|
||||
+
|
||||
+ } catch ( MalformedURLException e )
|
||||
+ {
|
||||
+ e.printStackTrace();
|
||||
+ } catch ( IOException e )
|
||||
+ {
|
||||
+ if (!hasWarned)
|
||||
+ {
|
||||
+ hasWarned = true;
|
||||
+ Bukkit.getLogger().warning( "Error connecting to Mojang servers, cannot convert player heads" );
|
||||
+ }
|
||||
+ } finally
|
||||
+ {
|
||||
+ if ( connection != null )
|
||||
+ {
|
||||
+ connection.disconnect();
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ } );
|
||||
+ }
|
||||
+
|
||||
+ private static org.spigotmc.authlib.GameProfile getProfile(NBTTagCompound owner)
|
||||
+ {
|
||||
+ org.spigotmc.authlib.GameProfile profile = new org.spigotmc.authlib.GameProfile(
|
||||
+ UUID.fromString( owner.getString( "Id" ) ), owner.getString( "Name" ) );
|
||||
+
|
||||
+ NBTTagCompound properties = owner.getCompound( "Properties" );
|
||||
+ for (String key : (Set<String>) properties.c())
|
||||
+ {
|
||||
+ NBTTagList props = properties.getList( key, 10 );
|
||||
+ for (int i = 0; i < props.size(); i++) {
|
||||
+ NBTTagCompound prop = props.get( i );
|
||||
+ profile.getProperties().put( key, new Property( key, prop.getString( "Value" ), prop.getString( "Signature" ) ) );
|
||||
+ }
|
||||
+ }
|
||||
+ return profile;
|
||||
+ }
|
||||
+}
|
||||
--
|
||||
1.8.5.2.msysgit.0
|
||||
|
Loading…
Reference in New Issue
Block a user