Shade the Bungee-Config implementation because it's platform independent

This commit is contained in:
games647 committed 2017-09-22 20:07:04 +02:00
1 parent bb80521ab6
commit 2f0eb81735
21 files changed
+92 -143

No files matched your search

@@ -1,6 +1,7 @@
package com.github.games647.fastlogin.bukkit;
import com.github.games647.fastlogin.core.PlayerProfile;
import com.github.games647.fastlogin.core.mojang.SkinProperties;
import com.github.games647.fastlogin.core.shared.LoginSession;
import org.apache.commons.lang.ArrayUtils;
@@ -17,8 +18,7 @@ public class BukkitLoginSession extends LoginSession {
private boolean verified;
private String encodedSkinData;
private String skinSignature;
private SkinProperties skinProperty;
public BukkitLoginSession(String username, String serverId, byte[] verifyToken, boolean registered
, PlayerProfile profile) {
@@ -62,23 +62,15 @@ public class BukkitLoginSession extends LoginSession {
return ArrayUtils.clone(verifyToken);
}
public synchronized String getEncodedSkinData() {
return encodedSkinData;
}
public synchronized String getSkinSignature() {
return skinSignature;
public synchronized SkinProperties getSkinProperty() {
return skinProperty;
}
/**
* Sets the premium skin property which was retrieved by the session server
*
* @param encodedData
* @param skinSignature
*/
public synchronized void setSkin(String encodedData, String skinSignature) {
this.encodedSkinData = encodedData;
this.skinSignature = skinSignature;
public synchronized void setSkinProperty(SkinProperties skinProperty) {
this.skinProperty = skinProperty;
}
/**
@@ -8,14 +8,13 @@ import com.github.games647.fastlogin.bukkit.listener.protocollib.LoginSkinApplyL
import com.github.games647.fastlogin.bukkit.listener.protocollib.ProtocolLibListener;
import com.github.games647.fastlogin.bukkit.listener.protocolsupport.ProtocolSupportListener;
import com.github.games647.fastlogin.bukkit.tasks.DelayedAuthHook;
import com.github.games647.fastlogin.core.shared.FastLoginCore;
import com.github.games647.fastlogin.core.mojang.MojangApiConnector;
import com.github.games647.fastlogin.core.shared.FastLoginCore;
import com.github.games647.fastlogin.core.shared.PlatformPlugin;
import com.google.common.collect.Iterables;
import com.google.common.io.ByteArrayDataOutput;
import com.google.common.io.ByteStreams;
import java.io.Reader;
import java.security.KeyPair;
import java.util.List;
import java.util.Map;
@@ -26,7 +25,6 @@ import java.util.logging.Logger;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.plugin.messaging.PluginMessageRecipient;
@@ -190,12 +188,6 @@ public class FastLoginBukkit extends JavaPlugin implements PlatformPlugin<Comman
sender.sendPluginMessage(this, getName(), dataOutput.toByteArray());
}
@Override
public Map<String, Object> loadYamlFile(Reader reader) {
YamlConfiguration config = YamlConfiguration.loadConfiguration(reader);
return config.getValues(true);
}
@Override
public void sendMessage(CommandSender receiver, String message) {
receiver.sendMessage(message);
@@ -50,10 +50,7 @@ public class MojangApiBukkit extends MojangApiConnector {
SkinProperties[] properties = verification.getProperties();
if (properties != null && properties.length > 0) {
SkinProperties skinProperty = properties[0];
String skinValue = skinProperty.getValue();
String signature = skinProperty.getSignature();
playerSession.setSkin(skinValue, signature);
playerSession.setSkinProperty(skinProperty);
}
return true;
@@ -30,7 +30,7 @@ public class AuthMeHook implements AuthPlugin<Player> {
}
@Override
public boolean isRegistered(String playerName) throws Exception {
public boolean isRegistered(String playerName) {
return AuthMeApi.getInstance().isRegistered(playerName);
}
@@ -78,7 +78,7 @@ public class CrazyLoginHook implements AuthPlugin<Player> {
}
@Override
public boolean isRegistered(String playerName) throws Exception {
public boolean isRegistered(String playerName) {
return crazyLoginPlugin.getPlayerData(playerName) != null;
}
@@ -26,7 +26,7 @@ public class LogItHook implements AuthPlugin<Player> {
}
@Override
public boolean isRegistered(String playerName) throws Exception {
public boolean isRegistered(String playerName) {
return LogItCore.getInstance().getAccountManager().isRegistered(playerName);
}
@@ -29,7 +29,7 @@ public class LoginSecurityHook implements AuthPlugin<Player> {
}
@Override
public boolean isRegistered(String playerName) throws Exception {
public boolean isRegistered(String playerName) {
PlayerSession session = LoginSecurity.getSessionManager().getOfflineSession(playerName);
return session.isRegistered();
}
@@ -45,7 +45,7 @@ public class UltraAuthHook implements AuthPlugin<Player> {
}
@Override
public boolean isRegistered(String playerName) throws Exception {
public boolean isRegistered(String playerName) {
return UltraAuthAPI.isRegisterd(playerName);
}
@@ -52,7 +52,7 @@ public class xAuthHook implements AuthPlugin<Player> {
}
@Override
public boolean isRegistered(String playerName) throws Exception {
public boolean isRegistered(String playerName) {
//this will load the player if it's not in the cache
xAuthPlayer xAuthPlayer = xAuthPlugin.getPlayerManager().getPlayer(playerName);
return xAuthPlayer != null && xAuthPlayer.isRegistered();
@@ -8,6 +8,7 @@ import com.comphenix.protocol.wrappers.WrappedGameProfile;
import com.comphenix.protocol.wrappers.WrappedSignedProperty;
import com.github.games647.fastlogin.bukkit.BukkitLoginSession;
import com.github.games647.fastlogin.bukkit.FastLoginBukkit;
import com.github.games647.fastlogin.core.mojang.SkinProperties;
import java.lang.reflect.InvocationTargetException;
import java.util.logging.Level;
@@ -45,10 +46,8 @@ public class LoginSkinApplyListener implements Listener {
//loginEvent.getAddress is just a InetAddress not InetSocketAddress, so not unique enough
for (BukkitLoginSession session : plugin.getLoginSessions().values()) {
if (session.getUsername().equals(player.getName())) {
String signature = session.getSkinSignature();
String skinData = session.getEncodedSkinData();
applySkin(player, skinData, signature);
SkinProperties skinProperty = session.getSkinProperty();
applySkin(player, skinProperty.getValue(), skinProperty.getSignature());
break;
}
}
@@ -49,7 +49,7 @@ public class ProtocolLibLoginSource implements LoginSource {
}
@Override
public void kick(String message) throws Exception {
public void kick(String message) throws InvocationTargetException {
ProtocolManager protocolManager = ProtocolLibrary.getProtocolManager();
PacketContainer kickPacket = protocolManager.createPacket(DISCONNECT);