2013-07-08 11:34:43 +00:00
|
|
|
From f56b55c5dcd17f2238647b1a32ad097274cf5650 Mon Sep 17 00:00:00 2001
|
2013-07-08 11:17:32 +00:00
|
|
|
From: md_5 <md_5@live.com.au>
|
2013-07-08 11:27:56 +00:00
|
|
|
Date: Mon, 8 Jul 2013 21:27:40 +1000
|
2013-07-08 11:17:32 +00:00
|
|
|
Subject: [PATCH] Snapshot Protocol
|
|
|
|
|
|
|
|
|
2013-07-08 11:34:43 +00:00
|
|
|
diff --git a/pom.xml b/pom.xml
|
|
|
|
index 69e596b..f91396f 100644
|
|
|
|
--- a/pom.xml
|
|
|
|
+++ b/pom.xml
|
|
|
|
@@ -12,7 +12,7 @@
|
|
|
|
<groupId>org.spigotmc</groupId>
|
|
|
|
<artifactId>spigot</artifactId>
|
|
|
|
<packaging>jar</packaging>
|
|
|
|
- <version>1.6.1-R0.1-SNAPSHOT</version>
|
|
|
|
+ <version>1.6.2-R0.1-SNAPSHOT</version>
|
|
|
|
<name>Spigot</name>
|
|
|
|
<url>http://www.spigotmc.org</url>
|
|
|
|
|
|
|
|
@@ -42,7 +42,7 @@
|
|
|
|
<dependency>
|
|
|
|
<groupId>org.spigotmc</groupId>
|
|
|
|
<artifactId>spigot-api</artifactId>
|
|
|
|
- <version>${project.version}</version>
|
|
|
|
+ <version>1.6.1-R0.1-SNAPSHOT</version>
|
|
|
|
<type>jar</type>
|
|
|
|
<scope>compile</scope>
|
|
|
|
</dependency>
|
2013-07-08 11:17:32 +00:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/ItemBlock.java b/src/main/java/net/minecraft/server/ItemBlock.java
|
2013-07-08 11:27:56 +00:00
|
|
|
index b2c3ed8..e46cb2a 100644
|
2013-07-08 11:17:32 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/ItemBlock.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/ItemBlock.java
|
|
|
|
@@ -110,6 +110,12 @@ public class ItemBlock extends Item {
|
|
|
|
|
|
|
|
world.makeSound((double) ((float) x + 0.5F), (double) ((float) y + 0.5F), (double) ((float) z + 0.5F), block.stepSound.getPlaceSound(), (block.stepSound.getVolume1() + 1.0F) / 2.0F, block.stepSound.getVolume2() * 0.8F);
|
|
|
|
}
|
|
|
|
+ // Spigot Start
|
2013-07-08 11:27:56 +00:00
|
|
|
+ if ( org.spigotmc.SpigotConfig.snapshotProtocol && block instanceof BlockSign )
|
2013-07-08 11:17:32 +00:00
|
|
|
+ {
|
|
|
|
+ ( (EntityPlayer) entityhuman ).playerConnection.sendPacket( new Packet133SignPlace( x, y, z ) );
|
|
|
|
+ }
|
|
|
|
+ // Spigot End
|
|
|
|
|
|
|
|
if (itemstack != null) {
|
|
|
|
--itemstack.count;
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
|
2013-07-08 11:27:56 +00:00
|
|
|
index 415087a..de730fa 100644
|
2013-07-08 11:17:32 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
|
|
|
|
@@ -762,7 +762,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getVersion() {
|
|
|
|
- return "1.6.1";
|
2013-07-08 11:27:56 +00:00
|
|
|
+ return org.spigotmc.SpigotConfig.gameVersion; // Spigot
|
2013-07-08 11:17:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
public int A() {
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/Packet.java b/src/main/java/net/minecraft/server/Packet.java
|
|
|
|
index 9389a7d..4a75e71 100644
|
|
|
|
--- a/src/main/java/net/minecraft/server/Packet.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/Packet.java
|
|
|
|
@@ -321,6 +321,7 @@ public abstract class Packet {
|
|
|
|
a(130, true, true, Packet130UpdateSign.class);
|
|
|
|
a(131, true, false, Packet131ItemData.class);
|
|
|
|
a(132, true, false, Packet132TileEntityData.class);
|
|
|
|
+ a(133, true, false, Packet133SignPlace.class); // Spigot
|
|
|
|
a(200, true, false, Packet200Statistic.class);
|
|
|
|
a(201, true, false, Packet201PlayerInfo.class);
|
|
|
|
a(202, true, true, Packet202Abilities.class);
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/Packet133SignPlace.java b/src/main/java/net/minecraft/server/Packet133SignPlace.java
|
|
|
|
new file mode 100644
|
|
|
|
index 0000000..a1b2bbb
|
|
|
|
--- /dev/null
|
|
|
|
+++ b/src/main/java/net/minecraft/server/Packet133SignPlace.java
|
|
|
|
@@ -0,0 +1,49 @@
|
|
|
|
+package net.minecraft.server;
|
|
|
|
+
|
|
|
|
+import java.io.DataInput;
|
|
|
|
+import java.io.DataOutput;
|
|
|
|
+import java.io.IOException;
|
|
|
|
+
|
|
|
|
+public class Packet133SignPlace extends Packet
|
|
|
|
+{
|
|
|
|
+
|
|
|
|
+ private int x, y, z;
|
|
|
|
+
|
|
|
|
+ public Packet133SignPlace()
|
|
|
|
+ {
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public Packet133SignPlace(int x, int y, int z)
|
|
|
|
+ {
|
|
|
|
+ this.x = x;
|
|
|
|
+ this.y = y;
|
|
|
|
+ this.z = z;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void a(DataInput datainput) throws IOException
|
|
|
|
+ {
|
|
|
|
+ throw new UnsupportedOperationException( "Not supported yet." ); //To change body of generated methods, choose Tools | Templates.
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void a(DataOutput dataoutput) throws IOException
|
|
|
|
+ {
|
|
|
|
+ dataoutput.writeByte( 0 );
|
|
|
|
+ dataoutput.writeInt( x );
|
|
|
|
+ dataoutput.writeInt( y );
|
|
|
|
+ dataoutput.writeInt( z );
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void handle(Connection connection)
|
|
|
|
+ {
|
|
|
|
+ throw new UnsupportedOperationException( "Not supported yet." ); //To change body of generated methods, choose Tools | Templates.
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public int a()
|
|
|
|
+ {
|
|
|
|
+ return 13;
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/Packet44UpdateAttributes.java b/src/main/java/net/minecraft/server/Packet44UpdateAttributes.java
|
2013-07-08 11:19:55 +00:00
|
|
|
new file mode 100644
|
|
|
|
index 0000000..2d60528
|
|
|
|
--- /dev/null
|
2013-07-08 11:17:32 +00:00
|
|
|
+++ b/src/main/java/net/minecraft/server/Packet44UpdateAttributes.java
|
2013-07-08 11:19:55 +00:00
|
|
|
@@ -0,0 +1,60 @@
|
|
|
|
+package net.minecraft.server;
|
|
|
|
+
|
|
|
|
+import java.io.DataInput;
|
|
|
|
+import java.io.DataOutput;
|
|
|
|
+import java.util.Collection;
|
|
|
|
+import java.util.HashMap;
|
|
|
|
+import java.util.Iterator;
|
|
|
|
+import java.util.Map;
|
|
|
|
+import java.util.Map.Entry;
|
|
|
|
+
|
|
|
|
+public class Packet44UpdateAttributes extends Packet {
|
|
|
|
+
|
|
|
|
+ private int a;
|
2013-07-08 11:17:32 +00:00
|
|
|
+ private final java.util.List<AttributeModifiable> b = new java.util.ArrayList<AttributeModifiable>();
|
2013-07-08 11:19:55 +00:00
|
|
|
+
|
|
|
|
+ public Packet44UpdateAttributes() {}
|
|
|
|
+
|
|
|
|
+ public Packet44UpdateAttributes(int i, Collection collection) {
|
|
|
|
+ this.a = i;
|
|
|
|
+ Iterator iterator = collection.iterator();
|
|
|
|
+
|
|
|
|
+ while (iterator.hasNext()) {
|
2013-07-08 11:17:32 +00:00
|
|
|
+ AttributeModifiable attributeinstance = (AttributeModifiable) iterator.next();
|
2013-07-08 11:19:55 +00:00
|
|
|
+
|
2013-07-08 11:17:32 +00:00
|
|
|
+ this.b.add( attributeinstance );
|
2013-07-08 11:19:55 +00:00
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void a(DataInput datainput) throws java.io.IOException { // Spigot - throws
|
2013-07-08 11:17:32 +00:00
|
|
|
+ throw new UnsupportedOperationException();
|
2013-07-08 11:19:55 +00:00
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void a(DataOutput dataoutput) throws java.io.IOException { // Spigot - throws
|
2013-07-08 11:17:32 +00:00
|
|
|
+ dataoutput.writeInt( this.a );
|
|
|
|
+ dataoutput.writeInt( this.b.size() );
|
|
|
|
+ for ( AttributeModifiable attribute : this.b )
|
|
|
|
+ {
|
|
|
|
+ a( attribute.a().a(), dataoutput );
|
|
|
|
+ dataoutput.writeDouble( attribute.b() );
|
|
|
|
+ dataoutput.writeShort( attribute.c().size() );
|
|
|
|
+
|
|
|
|
+ for ( Object o : attribute.c() )
|
|
|
|
+ {
|
|
|
|
+ AttributeModifier modifier = (AttributeModifier) o;
|
|
|
|
+ dataoutput.writeLong( modifier.a().getMostSignificantBits() );
|
|
|
|
+ dataoutput.writeLong( modifier.a().getLeastSignificantBits() );
|
|
|
|
+ dataoutput.writeDouble( modifier.d() );
|
|
|
|
+ dataoutput.writeByte( modifier.c() );
|
|
|
|
+ }
|
2013-07-08 11:19:55 +00:00
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public void handle(Connection connection) {
|
|
|
|
+ connection.a(this);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public int a() {
|
|
|
|
+ return 8 + this.b.size() * 24;
|
|
|
|
+ }
|
|
|
|
+}
|
2013-07-08 11:17:32 +00:00
|
|
|
diff --git a/src/main/java/net/minecraft/server/PendingConnection.java b/src/main/java/net/minecraft/server/PendingConnection.java
|
2013-07-08 11:27:56 +00:00
|
|
|
index 9b8ddd2..3664a1c 100644
|
2013-07-08 11:17:32 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/PendingConnection.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/PendingConnection.java
|
|
|
|
@@ -76,8 +76,8 @@ public class PendingConnection extends Connection {
|
|
|
|
} else {
|
|
|
|
PublicKey publickey = this.server.H().getPublic();
|
|
|
|
|
|
|
|
- if (packet2handshake.d() != 73) {
|
|
|
|
- if (packet2handshake.d() > 73) {
|
|
|
|
+ if (packet2handshake.d() != org.spigotmc.SpigotConfig.protocolVersion) { // Spigot
|
2013-07-08 11:27:56 +00:00
|
|
|
+ if (packet2handshake.d() > org.spigotmc.SpigotConfig.protocolVersion) { // Spigot
|
2013-07-08 11:17:32 +00:00
|
|
|
this.disconnect("Outdated server!");
|
|
|
|
} else {
|
|
|
|
this.disconnect("Outdated client!");
|
|
|
|
@@ -156,7 +156,7 @@ public class PendingConnection extends Connection {
|
|
|
|
s = pingEvent.getMotd() + "\u00A7" + playerlist.getPlayerCount() + "\u00A7" + pingEvent.getMaxPlayers();
|
|
|
|
} else {
|
|
|
|
// CraftBukkit start - Don't create a list from an array
|
|
|
|
- Object[] list = new Object[] { 1, 73, this.server.getVersion(), pingEvent.getMotd(), playerlist.getPlayerCount(), pingEvent.getMaxPlayers() };
|
|
|
|
+ Object[] list = new Object[] { 1, org.spigotmc.SpigotConfig.protocolVersion, this.server.getVersion(), pingEvent.getMotd(), playerlist.getPlayerCount(), pingEvent.getMaxPlayers() }; // Spigot
|
|
|
|
|
|
|
|
StringBuilder builder = new StringBuilder();
|
|
|
|
for (Object object : list) {
|
|
|
|
diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java
|
2013-07-08 11:27:56 +00:00
|
|
|
index e8039d7..982f503 100644
|
2013-07-08 11:17:32 +00:00
|
|
|
--- a/src/main/java/org/spigotmc/SpigotConfig.java
|
|
|
|
+++ b/src/main/java/org/spigotmc/SpigotConfig.java
|
2013-07-08 11:27:56 +00:00
|
|
|
@@ -280,4 +280,23 @@ public class SpigotConfig
|
2013-07-08 11:17:32 +00:00
|
|
|
|
|
|
|
Bukkit.getLogger().setFilter( new LogFilter() );
|
|
|
|
}
|
|
|
|
+
|
|
|
|
+ public static boolean snapshotProtocol;
|
2013-07-08 11:27:56 +00:00
|
|
|
+ public static String gameVersion;
|
2013-07-08 11:17:32 +00:00
|
|
|
+ public static byte protocolVersion;
|
|
|
|
+ private static void snapshotProtocol()
|
|
|
|
+ {
|
|
|
|
+ snapshotProtocol = getBoolean( "settings.snapshot-protocol", false );
|
|
|
|
+ snapshotProtocol = true;
|
2013-07-08 11:27:56 +00:00
|
|
|
+
|
|
|
|
+ gameVersion = ( snapshotProtocol ) ? "1.6.2" : "1.6.1";
|
|
|
|
+ protocolVersion = (byte) ( ( snapshotProtocol ) ? 74 : 73 );
|
2013-07-08 11:17:32 +00:00
|
|
|
+ if ( snapshotProtocol )
|
|
|
|
+ {
|
|
|
|
+ Bukkit.getLogger().severe( "================ [Snapshot Protocol] ================" );
|
2013-07-08 11:27:56 +00:00
|
|
|
+ Bukkit.getLogger().severe( "Initialised Snapshot Protocol for " + gameVersion + " (" + protocolVersion + ")" );
|
2013-07-08 11:17:32 +00:00
|
|
|
+ Bukkit.getLogger().severe( "Features may NOT be implemented! Use at your own risk!" );
|
|
|
|
+ Bukkit.getLogger().severe( "================ ====================================" );
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
}
|
|
|
|
--
|
|
|
|
1.8.1.2
|
|
|
|
|