3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-15 12:30:06 +01:00

Nearly done, testing time.

Dieser Commit ist enthalten in:
md_5 2014-04-12 14:38:17 +10:00
Ursprung 06b0dec1c5
Commit c2dd459650
14 geänderte Dateien mit 50 neuen und 225 gelöschten Zeilen

Datei anzeigen

@ -1,11 +1,11 @@
From b3766c829b07913655f7238d91b865fe3884be2f Mon Sep 17 00:00:00 2001
From e144ac992708501a0283d1462490e96d4f3c0b76 Mon Sep 17 00:00:00 2001
From: md_5 <git@md-5.net>
Date: Wed, 18 Dec 2013 13:32:10 +1100
Subject: [PATCH] Fire PreLogin Events in Offline Mode
diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/java/net/minecraft/server/LoginListener.java
index 8f982f1..eb227bc 100644
index 8f982f1..0755d36 100644
--- a/src/main/java/net/minecraft/server/LoginListener.java
+++ b/src/main/java/net/minecraft/server/LoginListener.java
@@ -59,10 +59,23 @@ public class LoginListener implements PacketLoginInListener {
@ -15,7 +15,7 @@ index 8f982f1..eb227bc 100644
+ // Spigot start
+ public void initUUID()
+ {
+ String uuid = UUID.nameUUIDFromBytes( ( "OfflinePlayer:" + this.i.getName() ).getBytes( Charsets.UTF_8 ) ).toString().replaceAll( "-", "" );
+ UUID uuid = UUID.nameUUIDFromBytes( ( "OfflinePlayer:" + this.i.getName() ).getBytes( Charsets.UTF_8 ) );
+
+ this.i = new GameProfile( uuid, this.i.getName() );
+ }
@ -42,7 +42,7 @@ index 8f982f1..eb227bc 100644
}
diff --git a/src/main/java/net/minecraft/server/ThreadPlayerLookupUUID.java b/src/main/java/net/minecraft/server/ThreadPlayerLookupUUID.java
index 6b91be7..b41ed2f 100644
index 6b91be7..1b2620c 100644
--- a/src/main/java/net/minecraft/server/ThreadPlayerLookupUUID.java
+++ b/src/main/java/net/minecraft/server/ThreadPlayerLookupUUID.java
@@ -25,50 +25,19 @@ class ThreadPlayerLookupUUID extends Thread {
@ -50,7 +50,7 @@ index 6b91be7..b41ed2f 100644
try {
+ // Spigot Start
+ if ( !LoginListener.b( this.a ).getOnlineMode() )
+ if ( !LoginListener.c( this.a ).getOnlineMode() )
+ {
+ a.initUUID();
+ fireLoginEvents();

Datei anzeigen

@ -1,4 +1,4 @@
From 7a40301085d45e555e5d980b663a03fc7215870e Mon Sep 17 00:00:00 2001
From 356dff0aa787496546e42947c933cf0b3a316114 Mon Sep 17 00:00:00 2001
From: md_5 <md_5@live.com.au>
Date: Sun, 1 Dec 2013 18:18:41 +1100
Subject: [PATCH] BungeeCord Support
@ -6,10 +6,18 @@ Subject: [PATCH] BungeeCord Support
Provides support for IP forwarding via BungeeCord.
diff --git a/src/main/java/net/minecraft/server/HandshakeListener.java b/src/main/java/net/minecraft/server/HandshakeListener.java
index b98079c..0542db3 100644
index b98079c..c738ab5 100644
--- a/src/main/java/net/minecraft/server/HandshakeListener.java
+++ b/src/main/java/net/minecraft/server/HandshakeListener.java
@@ -73,6 +73,22 @@ public class HandshakeListener implements PacketHandshakingInListener {
@@ -5,6 +5,7 @@ import net.minecraft.util.io.netty.util.concurrent.GenericFutureListener;
// CraftBukkit start
import java.net.InetAddress;
import java.util.HashMap;
+import net.minecraft.util.com.mojang.util.UUIDTypeAdapter;
// CraftBukkit end
public class HandshakeListener implements PacketHandshakingInListener {
@@ -73,6 +74,22 @@ public class HandshakeListener implements PacketHandshakingInListener {
this.b.close(chatcomponenttext);
} else {
this.b.a((PacketListener) (new LoginListener(this.a, this.b)));
@ -19,7 +27,7 @@ index b98079c..0542db3 100644
+ if ( split.length == 3 ) {
+ packethandshakinginsetprotocol.b = split[0];
+ b.n = new java.net.InetSocketAddress(split[1], ((java.net.InetSocketAddress) b.getSocketAddress()).getPort());
+ b.spoofedUUID = split[2];
+ b.spoofedUUID = UUIDTypeAdapter.fromString( split[2] );
+ } else
+ {
+ chatcomponenttext = new ChatComponentText("If you wish to use IP forwarding, please enable it in your BungeeCord config as well!");
@ -33,28 +41,27 @@ index b98079c..0542db3 100644
}
break;
diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/java/net/minecraft/server/LoginListener.java
index eb227bc..04d9f73 100644
index 0755d36..990dbef 100644
--- a/src/main/java/net/minecraft/server/LoginListener.java
+++ b/src/main/java/net/minecraft/server/LoginListener.java
@@ -62,8 +62,14 @@ public class LoginListener implements PacketLoginInListener {
@@ -62,7 +62,14 @@ public class LoginListener implements PacketLoginInListener {
// Spigot start
public void initUUID()
{
- String uuid = UUID.nameUUIDFromBytes( ( "OfflinePlayer:" + this.i.getName() ).getBytes( Charsets.UTF_8 ) ).toString().replaceAll( "-", "" );
-
+ String uuid;
- UUID uuid = UUID.nameUUIDFromBytes( ( "OfflinePlayer:" + this.i.getName() ).getBytes( Charsets.UTF_8 ) );
+ UUID uuid;
+ if ( networkManager.spoofedUUID != null )
+ {
+ uuid = networkManager.spoofedUUID;
+ } else
+ {
+ uuid = UUID.nameUUIDFromBytes( ( "OfflinePlayer:" + this.i.getName() ).getBytes( Charsets.UTF_8 ) ).toString().replaceAll("-", "");
+ uuid = UUID.nameUUIDFromBytes( ( "OfflinePlayer:" + this.i.getName() ).getBytes( Charsets.UTF_8 ) );
+ }
this.i = new GameProfile( uuid, this.i.getName() );
}
// Spigot end
diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java
index 1dd2227..c4a86bf 100644
index 1dd2227..6789ca8 100644
--- a/src/main/java/net/minecraft/server/NetworkManager.java
+++ b/src/main/java/net/minecraft/server/NetworkManager.java
@@ -36,7 +36,8 @@ public class NetworkManager extends SimpleChannelInboundHandler {
@ -63,7 +70,7 @@ index 1dd2227..c4a86bf 100644
private Channel m;
- private SocketAddress n;
+ public SocketAddress n; // Spigot
+ public String spoofedUUID; // Spigot
+ public java.util.UUID spoofedUUID; // Spigot
private PacketListener o;
private EnumProtocol p;
private IChatBaseComponent q;

Datei anzeigen

@ -1,14 +1,14 @@
From 96f5ab167d2dc52dd71692bd9ed200fa7bd46569 Mon Sep 17 00:00:00 2001
From dcac97e8a999b9ff4bda55a612a260cc9527ea4f Mon Sep 17 00:00:00 2001
From: Tux <write@imaginarycode.com>
Date: Sun, 9 Feb 2014 14:03:03 -0500
Subject: [PATCH] Add support for fetching hidden players
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 6f008db..302305d 100644
index 6f008db..779c996 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1374,6 +1374,12 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@@ -1374,6 +1374,18 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
{
return getHandle().locale;
}
@ -16,7 +16,13 @@ index 6f008db..302305d 100644
+ @Override
+ public Set<Player> getHiddenPlayers()
+ {
+ return java.util.Collections.unmodifiableSet( new HashSet<Player>( hiddenPlayers.values() ) );
+ Set<Player> ret = new HashSet<Player>();
+ for ( UUID u : hiddenPlayers )
+ {
+ ret.add( getServer().getPlayer( u ) );
+ }
+
+ return java.util.Collections.unmodifiableSet( ret );
+ }
};

Datei anzeigen

@ -1,4 +1,4 @@
From 25569e8a05ead051d52f5a545b1554941516c8bd Mon Sep 17 00:00:00 2001
From 8891be3ff887e394147125e5b2bf40be1f2dc822 Mon Sep 17 00:00:00 2001
From: drXor <mcyoungsota@gmail.com>
Date: Sat, 15 Mar 2014 01:30:05 -0400
Subject: [PATCH] Descriptive kick reasons instead of Nope!

Datei anzeigen

@ -1,188 +0,0 @@
From a24b5a38ec94a03907c3ef650eb9fb6e32f68b76 Mon Sep 17 00:00:00 2001
From: md_5 <git@md-5.net>
Date: Sat, 15 Mar 2014 14:34:03 +1100
Subject: [PATCH] Optimize Player Lookup
Optimize player lookup and various player operations. We mainly do this by keeping a map instead of iterating through all players. We also speed up the duplicate login check and a few other checks by simply checking for one matching player.
diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java
index d2a378e..8a48ec2 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -61,6 +61,25 @@ public abstract class PlayerList {
private boolean s;
private int t;
+ // Spigot Start
+ private final Map<String, EntityPlayer> playerMap = new java.util.HashMap<String, EntityPlayer>();
+
+ private void removePlayer(EntityPlayer player)
+ {
+ playerMap.remove( player.getName().toLowerCase() );
+ }
+
+ private void addPlayer(EntityPlayer player)
+ {
+ playerMap.put( player.getName().toLowerCase(), player );
+ }
+
+ private EntityPlayer getPlayerByName(String name)
+ {
+ return playerMap.get( name.toLowerCase() );
+ }
+ // Spigot End
+
// CraftBukkit start
private CraftServer cserver;
@@ -244,6 +263,7 @@ public abstract class PlayerList {
cserver.detectListNameConflict(entityplayer); // CraftBukkit
// this.sendAll(new PacketPlayOutPlayerInfo(entityplayer.getName(), true, 1000)); // CraftBukkit - replaced with loop below
this.players.add(entityplayer);
+ addPlayer( entityplayer ); // Spigot
WorldServer worldserver = this.server.getWorldServer(entityplayer.dimension);
// CraftBukkit start
@@ -319,6 +339,7 @@ public abstract class PlayerList {
worldserver.kill(entityplayer);
worldserver.getPlayerChunkMap().removePlayer(entityplayer);
this.players.remove(entityplayer);
+ removePlayer( entityplayer ); // Spigot
this.n.remove(entityplayer.getUniqueID());
ChunkIOExecutor.adjustPoolSize(this.getPlayerCount()); // CraftBukkit
@@ -394,24 +415,14 @@ event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, org.spigotmc.SpigotConfig
}
public EntityPlayer processLogin(GameProfile gameprofile, EntityPlayer player) { // CraftBukkit - added EntityPlayer
- UUID uuid = EntityHuman.a(gameprofile);
- ArrayList arraylist = Lists.newArrayList();
-
- EntityPlayer entityplayer;
+ // Spigot Start
+ EntityPlayer entityplayer = getPlayer( gameprofile.getName() );
- for (int i = 0; i < this.players.size(); ++i) {
- entityplayer = (EntityPlayer) this.players.get(i);
- if (entityplayer.getUniqueID().equals(uuid)) {
- arraylist.add(entityplayer);
- }
- }
-
- Iterator iterator = arraylist.iterator();
-
- while (iterator.hasNext()) {
- entityplayer = (EntityPlayer) iterator.next();
- entityplayer.playerConnection.disconnect("You logged in from another location");
+ if ( entityplayer != null )
+ {
+ entityplayer.playerConnection.disconnect( "You logged in from another location" );
}
+ // Spigot End
/* CraftBukkit start
Object object;
@@ -901,19 +912,7 @@ event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, org.spigotmc.SpigotConfig
}
public EntityPlayer getPlayer(String s) {
- Iterator iterator = this.players.iterator();
-
- EntityPlayer entityplayer;
-
- do {
- if (!iterator.hasNext()) {
- return null;
- }
-
- entityplayer = (EntityPlayer) iterator.next();
- } while (!entityplayer.getName().equalsIgnoreCase(s));
-
- return entityplayer;
+ return getPlayerByName( s ); // Spigot
}
public List a(ChunkCoordinates chunkcoordinates, int i, int j, int k, int l, int i1, int j1, Map map, String s, String s1, World world) {
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java b/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java
index bec4134..0430cc1 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java
@@ -131,14 +131,10 @@ public class CraftOfflinePlayer implements OfflinePlayer, ConfigurationSerializa
}
public Player getPlayer() {
- for (Object obj : server.getHandle().players) {
- EntityPlayer player = (EntityPlayer) obj;
- if (player.getUniqueID().equals(getUniqueId())) {
- return (player.playerConnection != null) ? player.playerConnection.getPlayer() : null;
- }
- }
-
- return null;
+ // Spigot Start
+ EntityPlayer player = server.getHandle().getPlayer( name );
+ return ( player != null && player.playerConnection != null ) ? player.getBukkitEntity() : null;
+ // Spigot End
}
@Override
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 2645c97..ff13c51 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -502,6 +502,13 @@ public final class CraftServer implements Server {
public Player getPlayer(final String name) {
Validate.notNull(name, "Name cannot be null");
+ // Spigot Start
+ Player directLookup = getPlayerExact( name );
+ if ( directLookup != null )
+ {
+ return directLookup;
+ }
+ // Spigot End
Player[] players = getOnlinePlayers();
Player found = null;
@@ -523,15 +530,10 @@ public final class CraftServer implements Server {
public Player getPlayerExact(String name) {
Validate.notNull(name, "Name cannot be null");
- String lname = name.toLowerCase();
-
- for (Player player : getOnlinePlayers()) {
- if (player.getName().equalsIgnoreCase(lname)) {
- return player;
- }
- }
-
- return null;
+ // Spigot Start
+ EntityPlayer entityPlayer = playerList.getPlayer( name );
+ return ( entityPlayer != null ) ? entityPlayer.getBukkitEntity() : null;
+ // Spigot End
}
// TODO: In 1.7.6+ this should use the server's UUID->EntityPlayer map
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 8af4bf7..8b1ffd6 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -101,13 +101,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
}
public boolean isOnline() {
- for (Object obj : server.getHandle().players) {
- EntityPlayer player = (EntityPlayer) obj;
- if (player.getName().equalsIgnoreCase(getName())) {
- return true;
- }
- }
- return false;
+ return server.getHandle().getPlayer( getName() ) != null; // Spigot
}
public InetSocketAddress getAddress() {
--
1.8.3.2

Datei anzeigen

@ -1,4 +1,4 @@
From 06daebc4d7b583f854ed3a1913d359d6c9335437 Mon Sep 17 00:00:00 2001
From aba6ecaf644f983f543b6b3fd8a44de320b91cc4 Mon Sep 17 00:00:00 2001
From: andrepl <andre@norcode.com>
Date: Sat, 15 Mar 2014 12:50:00 -0400
Subject: [PATCH] Allow enchanting tables to enchant any item

Datei anzeigen

@ -1,4 +1,4 @@
From 4c278c6fdc194b23a0ed33e9fbd9d94219f66ca1 Mon Sep 17 00:00:00 2001
From 4904ff3b4497220cbeb724b3e1e49081e5ce2dfa Mon Sep 17 00:00:00 2001
From: Thinkofdeath <thethinkofdeath@gmail.com>
Date: Tue, 18 Mar 2014 09:49:30 +0000
Subject: [PATCH] Remove the lastChunkAccessed if it is unloaded.

Datei anzeigen

@ -1,4 +1,4 @@
From 5201ffe0150fb2e5105e28267978e3efea9e793f Mon Sep 17 00:00:00 2001
From 107d62ed8ad22520af5040e1f24166106e3f9909 Mon Sep 17 00:00:00 2001
From: Thinkofdeath <thethinkofdeath@gmail.com>
Date: Sun, 23 Mar 2014 01:12:10 +0000
Subject: [PATCH] Check for manually prefixed commands or commands that don't

Datei anzeigen

@ -1,4 +1,4 @@
From 322c314741c18194c62d033395dbca31b0a2df70 Mon Sep 17 00:00:00 2001
From 66560851845f64cfb0491c3430a8ed07b095276e Mon Sep 17 00:00:00 2001
From: Thinkofdeath <thethinkofdeath@gmail.com>
Date: Sun, 23 Mar 2014 10:53:48 +0000
Subject: [PATCH] Cap window names to prevent client disconnects

Datei anzeigen

@ -1,4 +1,4 @@
From 09287f47fdadb27dcdc39c6914902d94e0e8f514 Mon Sep 17 00:00:00 2001
From c33df504e1123d58fe8238e9dd238b00643baa79 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
@ -17,10 +17,10 @@ index 4fb5f75..c164e39 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 8a48ec2..9a052f7 100644
index d2a378e..9abf099 100644
--- a/src/main/java/net/minecraft/server/PlayerList.java
+++ b/src/main/java/net/minecraft/server/PlayerList.java
@@ -804,6 +804,8 @@ event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, org.spigotmc.SpigotConfig
@@ -793,6 +793,8 @@ event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, org.spigotmc.SpigotConfig
// CraftBukkit end
}
@ -29,7 +29,7 @@ index 8a48ec2..9a052f7 100644
public void tick() {
if (++this.t > 600) {
this.t = 0;
@@ -816,6 +818,30 @@ event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, org.spigotmc.SpigotConfig
@@ -805,6 +807,30 @@ event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, org.spigotmc.SpigotConfig
this.sendAll(new PacketPlayOutPlayerInfo(entityplayer.getName(), true, entityplayer.ping));
}
// CraftBukkit end */

Datei anzeigen

@ -1,14 +1,14 @@
From e64d7c0ca438aa60ac1e545928ba2b0c83f5aa6d Mon Sep 17 00:00:00 2001
From 3ca585448f331bc7961ad0579e3cb5f8e6314215 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 ff13c51..7b2242a 100644
index 2645c97..17ebcce 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -1306,6 +1306,7 @@ public final class CraftServer implements Server {
@@ -1304,6 +1304,7 @@ public final class CraftServer implements Server {
public OfflinePlayer getOfflinePlayer(String name) {
Validate.notNull(name, "Name cannot be null");

Datei anzeigen

@ -1,4 +1,4 @@
From 67ea2bb8feb99fa189e87a05ff37aff6dff241a0 Mon Sep 17 00:00:00 2001
From 5f16a34374e9bbd0b7aed359e2b3cc236ab0f5a0 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

Datei anzeigen

@ -1,4 +1,4 @@
From 5d529ca00299e2f3aab97a98aa6975ddc317acd6 Mon Sep 17 00:00:00 2001
From 43f56ba461edd0a4d4c77a14b2628ab91bbc0e92 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

Datei anzeigen

@ -1,4 +1,4 @@
From e479193f877f9c8b674a2319599843af75e8c539 Mon Sep 17 00:00:00 2001
From 42f834d1bd2a0f85ab7ab451f7a6fb272e99c983 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