From 1e1ba0f873e3e3319f1497f25244750b6e19f16e Mon Sep 17 00:00:00 2001
From: Thinkofdeath
Date: Thu, 10 Apr 2014 12:56:45 +0100
Subject: [PATCH] Fix the console issue
QueueLogAppender doesn't like being added twice
---
.../0128-1.7.6-pre1-support.patch | 2778 ++++++++++++++++-
1 file changed, 2759 insertions(+), 19 deletions(-)
diff --git a/CraftBukkit-Patches/0128-1.7.6-pre1-support.patch b/CraftBukkit-Patches/0128-1.7.6-pre1-support.patch
index be6a2e03c5..a9a0092745 100644
--- a/CraftBukkit-Patches/0128-1.7.6-pre1-support.patch
+++ b/CraftBukkit-Patches/0128-1.7.6-pre1-support.patch
@@ -1,11 +1,11 @@
-From af89e32891c1b2b4be699afe3bdae190e1c4babb Mon Sep 17 00:00:00 2001
+From 53269d6cfc3f178e66c9bb1ecbaca96341e700d2 Mon Sep 17 00:00:00 2001
From: Thinkofdeath
Date: Thu, 3 Apr 2014 17:04:18 +0100
Subject: [PATCH] 1.7.6-pre1 support
diff --git a/pom.xml b/pom.xml
-index c8285e0..21876f0 100644
+index c8285e0..24d101c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -31,6 +31,10 @@
@@ -34,9 +34,9 @@ index c8285e0..21876f0 100644
+ 2.4
+
+
-+ com.mojang
-+ authlib
-+ 1.5.5
++ commons-codec
++ commons-codec
++ 1.6
+
@@ -84,30 +84,37 @@ index 42539b4..490123f 100644
this.b.handle(new PacketLoginOutDisconnect(chatcomponenttext), new GenericFutureListener[0]);
this.b.close(chatcomponenttext);
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
-index 8ce9dd7..b95123c 100644
+index 8ce9dd7..96b904c 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
-@@ -17,6 +17,7 @@ import java.util.UUID;
+@@ -10,13 +10,13 @@ import java.util.ArrayList;
+ import java.util.Arrays;
+ import java.util.Collections;
+ import java.util.Date;
+-import java.util.Iterator;
+ import java.util.List;
+ import java.util.Random;
+ import java.util.UUID;
import java.util.concurrent.Callable;
import javax.imageio.ImageIO;
-+import com.mojang.authlib.yggdrasil.YggdrasilMinecraftSessionService;
++import org.spigotmc.authlib.yggdrasil.YggdrasilMinecraftSessionService;
import net.minecraft.util.com.google.common.base.Charsets;
import net.minecraft.util.com.mojang.authlib.GameProfile;
import net.minecraft.util.com.mojang.authlib.minecraft.MinecraftSessionService;
-@@ -107,6 +108,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
+@@ -107,6 +107,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
private static final int TICK_TIME = 1000000000 / TPS;
private static final int SAMPLE_INTERVAL = 100;
public final double[] recentTps = new double[ 3 ];
-+ public final com.mojang.authlib.minecraft.MinecraftSessionService newSessionService;
++ public final org.spigotmc.authlib.minecraft.MinecraftSessionService newSessionService;
// Spigot end
public MinecraftServer(OptionSet options, Proxy proxy) { // CraftBukkit - signature file -> OptionSet
-@@ -117,6 +119,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
+@@ -117,6 +118,7 @@ public abstract class MinecraftServer implements ICommandListener, Runnable, IMo
this.n = new CommandDispatcher();
// this.convertable = new WorldLoaderServer(file1); // CraftBukkit - moved to DedicatedServer.init
this.S = (new YggdrasilAuthenticationService(proxy, UUID.randomUUID().toString())).createMinecraftSessionService();
-+ newSessionService = new com.mojang.authlib.yggdrasil.YggdrasilAuthenticationService(proxy, UUID.randomUUID().toString()).createMinecraftSessionService();
++ newSessionService = new org.spigotmc.authlib.yggdrasil.YggdrasilAuthenticationService(proxy, UUID.randomUUID().toString()).createMinecraftSessionService();
// CraftBukkit start
this.options = options;
@@ -257,14 +264,14 @@ index 0000000..3aa93cd
+ }
+}
diff --git a/src/main/java/net/minecraft/server/PacketPlayOutNamedEntitySpawn.java b/src/main/java/net/minecraft/server/PacketPlayOutNamedEntitySpawn.java
-index 8bab528..01630be 100644
+index 8bab528..0884047 100644
--- a/src/main/java/net/minecraft/server/PacketPlayOutNamedEntitySpawn.java
+++ b/src/main/java/net/minecraft/server/PacketPlayOutNamedEntitySpawn.java
@@ -2,6 +2,7 @@ package net.minecraft.server;
import java.util.List;
-+import com.mojang.authlib.properties.Property;
++import org.spigotmc.authlib.properties.Property;
import net.minecraft.util.com.mojang.authlib.GameProfile;
import java.io.IOException; // CraftBukkit
@@ -282,7 +289,7 @@ index 8bab528..01630be 100644
+
+ if ( this.b instanceof ThreadPlayerLookupUUID.NewGameProfileWrapper )
+ {
-+ com.mojang.authlib.GameProfile newProfile = ((ThreadPlayerLookupUUID.NewGameProfileWrapper) b).newProfile;
++ org.spigotmc.authlib.GameProfile newProfile = ((ThreadPlayerLookupUUID.NewGameProfileWrapper) b).newProfile;
+ packetdataserializer.b( newProfile.getProperties().size() );
+ for ( String key : newProfile.getProperties().keys() )
+ {
@@ -439,7 +446,7 @@ index f9da452..fa493ca 100644
+ // Spigot end
}
diff --git a/src/main/java/net/minecraft/server/ThreadPlayerLookupUUID.java b/src/main/java/net/minecraft/server/ThreadPlayerLookupUUID.java
-index fe4502a..0649ccf 100644
+index fe4502a..63101fb 100644
--- a/src/main/java/net/minecraft/server/ThreadPlayerLookupUUID.java
+++ b/src/main/java/net/minecraft/server/ThreadPlayerLookupUUID.java
@@ -33,7 +33,9 @@ class ThreadPlayerLookupUUID extends Thread {
@@ -448,7 +455,7 @@ index fe4502a..0649ccf 100644
String s = (new BigInteger(MinecraftEncryption.a(LoginListener.a(this.a), LoginListener.b(this.a).J().getPublic(), LoginListener.c(this.a)))).toString(16);
- LoginListener.a(this.a, LoginListener.b(this.a).at().hasJoinedServer(new GameProfile((String) null, LoginListener.d(this.a).getName()), s));
+ //LoginListener.a(this.a, LoginListener.b(this.a).at().hasJoinedServer(new GameProfile((String) null, LoginListener.d(this.a).getName()), s));
-+ com.mojang.authlib.GameProfile profile = LoginListener.b(this.a).newSessionService.hasJoinedServer( new com.mojang.authlib.GameProfile( null, LoginListener.d(this.a).getName() ), s );
++ org.spigotmc.authlib.GameProfile profile = LoginListener.b(this.a).newSessionService.hasJoinedServer( new org.spigotmc.authlib.GameProfile( null, LoginListener.d(this.a).getName() ), s );
+ LoginListener.a(this.a, new NewGameProfileWrapper( profile ) );
if (LoginListener.d(this.a) != null) {
// Spigot Start
@@ -460,15 +467,2748 @@ index fe4502a..0649ccf 100644
+
+ public static class NewGameProfileWrapper extends GameProfile {
+
-+ public com.mojang.authlib.GameProfile newProfile;
++ public org.spigotmc.authlib.GameProfile newProfile;
+
-+ public NewGameProfileWrapper(com.mojang.authlib.GameProfile newProfile)
++ public NewGameProfileWrapper(org.spigotmc.authlib.GameProfile newProfile)
+ {
+ super( newProfile.getId().toString().replaceAll( "-", "" ), newProfile.getName() );
+ this.newProfile = newProfile;
+ }
+ }
}
+diff --git a/src/main/java/org/spigotmc/authlib/Agent.java b/src/main/java/org/spigotmc/authlib/Agent.java
+new file mode 100644
+index 0000000..873743d
+--- /dev/null
++++ b/src/main/java/org/spigotmc/authlib/Agent.java
+@@ -0,0 +1,30 @@
++package org.spigotmc.authlib;
++
++public class Agent {
++ public static final Agent MINECRAFT = new Agent("Minecraft", 1);
++ public static final Agent SCROLLS = new Agent("Scrolls", 1);
++
++ private final String name;
++ private final int version;
++
++ public Agent(String name, int version) {
++ this.name = name;
++ this.version = version;
++ }
++
++ public String getName() {
++ return name;
++ }
++
++ public int getVersion() {
++ return version;
++ }
++
++ @Override
++ public String toString() {
++ return "Agent{" +
++ "name='" + name + '\'' +
++ ", version=" + version +
++ '}';
++ }
++}
+diff --git a/src/main/java/org/spigotmc/authlib/AuthenticationService.java b/src/main/java/org/spigotmc/authlib/AuthenticationService.java
+new file mode 100644
+index 0000000..4110e53
+--- /dev/null
++++ b/src/main/java/org/spigotmc/authlib/AuthenticationService.java
+@@ -0,0 +1,33 @@
++package org.spigotmc.authlib;
++
++import org.spigotmc.authlib.minecraft.MinecraftSessionService;
++
++public interface AuthenticationService {
++ /**
++ * Creates a relevant {@link org.spigotmc.authlib.UserAuthentication} designed for this authentication service.
++ *
++ * Certain Authentication Services may have restrictions as to which {@link Agent}s are supported.
++ * Please consult their javadoc for more information.
++ *
++ * @param agent Game agent to authenticate for
++ * @throws java.lang.IllegalArgumentException Agent is null or not allowed for this AuthenticationService
++ * @return New user authenticator
++ */
++ public UserAuthentication createUserAuthentication(Agent agent);
++
++ /**
++ * Creates a relevant {@link org.spigotmc.authlib.minecraft.MinecraftSessionService} designed for this authentication service.
++ *
++ * This is a Minecraft specific service and is not relevant to any other game agent.
++ *
++ * @return New minecraft session service
++ */
++ public MinecraftSessionService createMinecraftSessionService();
++
++ /**
++ * Creates a relevant {@link org.spigotmc.authlib.GameProfileRepository} designed for this authentication service.
++ *
++ * @return New profile repository
++ */
++ public GameProfileRepository createProfileRepository();
++}
+diff --git a/src/main/java/org/spigotmc/authlib/BaseAuthenticationService.java b/src/main/java/org/spigotmc/authlib/BaseAuthenticationService.java
+new file mode 100644
+index 0000000..b3cb3bb
+--- /dev/null
++++ b/src/main/java/org/spigotmc/authlib/BaseAuthenticationService.java
+@@ -0,0 +1,4 @@
++package org.spigotmc.authlib;
++
++public abstract class BaseAuthenticationService implements AuthenticationService {
++}
+diff --git a/src/main/java/org/spigotmc/authlib/BaseUserAuthentication.java b/src/main/java/org/spigotmc/authlib/BaseUserAuthentication.java
+new file mode 100644
+index 0000000..3bdcea2
+--- /dev/null
++++ b/src/main/java/org/spigotmc/authlib/BaseUserAuthentication.java
+@@ -0,0 +1,268 @@
++package org.spigotmc.authlib;
++
++import org.spigotmc.authlib.properties.Property;
++import org.spigotmc.authlib.properties.PropertyMap;
++import org.spigotmc.authlib.util.UUIDTypeAdapter;
++import org.apache.commons.lang3.StringUtils;
++import org.apache.commons.lang3.Validate;
++import org.apache.logging.log4j.LogManager;
++import org.apache.logging.log4j.Logger;
++
++import java.util.ArrayList;
++import java.util.HashMap;
++import java.util.List;
++import java.util.Map;
++
++public abstract class BaseUserAuthentication implements UserAuthentication {
++ private static final Logger LOGGER = LogManager.getLogger();
++
++ protected static final String STORAGE_KEY_PROFILE_NAME = "displayName";
++ protected static final String STORAGE_KEY_PROFILE_ID = "uuid";
++ protected static final String STORAGE_KEY_PROFILE_PROPERTIES = "profileProperties";
++ protected static final String STORAGE_KEY_USER_NAME = "username";
++ protected static final String STORAGE_KEY_USER_ID = "userid";
++ protected static final String STORAGE_KEY_USER_PROPERTIES = "userProperties";
++
++ private final AuthenticationService authenticationService;
++ private final PropertyMap userProperties = new PropertyMap();
++ private String userid;
++ private String username;
++ private String password;
++ private GameProfile selectedProfile;
++ private UserType userType;
++
++ protected BaseUserAuthentication(AuthenticationService authenticationService) {
++ Validate.notNull(authenticationService);
++ this.authenticationService = authenticationService;
++ }
++
++ @Override
++ public boolean canLogIn() {
++ return !canPlayOnline() && StringUtils.isNotBlank(getUsername()) && StringUtils.isNotBlank(getPassword());
++ }
++
++ @Override
++ public void logOut() {
++ password = null;
++ userid = null;
++ setSelectedProfile(null);
++ getModifiableUserProperties().clear();
++ setUserType(null);
++ }
++
++ @Override
++ public boolean isLoggedIn() {
++ return getSelectedProfile() != null;
++ }
++
++ @Override
++ public void setUsername(String username) {
++ if (isLoggedIn() && canPlayOnline()) {
++ throw new IllegalStateException("Cannot change username whilst logged in & online");
++ }
++
++ this.username = username;
++ }
++
++ @Override
++ public void setPassword(String password) {
++ if (isLoggedIn() && canPlayOnline() && StringUtils.isNotBlank(password)) {
++ throw new IllegalStateException("Cannot set password whilst logged in & online");
++ }
++
++ this.password = password;
++ }
++
++ protected String getUsername() {
++ return username;
++ }
++
++ protected String getPassword() {
++ return password;
++ }
++
++ @SuppressWarnings("unchecked")
++ @Override
++ public void loadFromStorage(Map credentials) {
++ logOut();
++
++ setUsername(String.valueOf(credentials.get(STORAGE_KEY_USER_NAME)));
++
++ if (credentials.containsKey(STORAGE_KEY_USER_ID)) {
++ userid = String.valueOf(credentials.get(STORAGE_KEY_USER_ID));
++ } else {
++ userid = username;
++ }
++
++ if (credentials.containsKey(STORAGE_KEY_USER_PROPERTIES)) {
++ try {
++ List