diff --git a/CHANGELOG.md b/CHANGELOG.md index 3871888e..ea196600 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ * Added other command argument to /premium and /cracked * Added support for LogIt * Fixed 1.7 Minecraft support by removing guava 11+ only features -> Cauldron support +* Fixed BungeeCord support in Cauldron ######1.2.1 diff --git a/README.md b/README.md index 929cfe72..f8822a52 100644 --- a/README.md +++ b/README.md @@ -26,8 +26,8 @@ So they don't need to enter passwords. This is also called auto login (auto-logi *** ###Commands: - * /premium [player] Label the invoker as paid account - * /cracked [player] Label the invoker as cracked account + * /premium [player] Label the invoker or the argument as paid account + * /cracked [player] Label the invoker or the argument as cracked account ###Permissions: * fastlogin.bukkit.command.premium diff --git a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/FastLoginBukkit.java b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/FastLoginBukkit.java index 32793e2a..63af51c8 100644 --- a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/FastLoginBukkit.java +++ b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/FastLoginBukkit.java @@ -1,5 +1,6 @@ package com.github.games647.fastlogin.bukkit; +import com.avaje.ebeaninternal.api.ClassUtil; import com.comphenix.protocol.AsynchronousManager; import com.comphenix.protocol.ProtocolLibrary; import com.comphenix.protocol.ProtocolManager; @@ -22,7 +23,6 @@ import com.github.games647.fastlogin.bukkit.listener.StartPacketListener; import com.google.common.cache.CacheLoader; import com.google.common.collect.Lists; -import java.lang.reflect.Method; import java.security.KeyPair; import java.sql.SQLException; import java.util.List; @@ -32,8 +32,6 @@ import java.util.concurrent.TimeUnit; import java.util.logging.Level; import java.util.logging.Logger; -import org.bukkit.Bukkit; -import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.entity.Player; import org.bukkit.plugin.java.JavaPlugin; @@ -81,17 +79,13 @@ public class FastLoginBukkit extends JavaPlugin { @Override public void onEnable() { try { - if (Bukkit.spigot().getConfig().isBoolean("settings.bungeecord")) { - bungeeCord = Bukkit.spigot().getConfig().getBoolean("settings.bungeecord"); - } else { - Method getConfigMethod = FuzzyReflection.fromObject(getServer().spigot(), true) - .getMethodByName("getSpigotConfig"); - getConfigMethod.setAccessible(true); - YamlConfiguration spigotConfig = (YamlConfiguration) getConfigMethod.invoke(getServer().spigot()); - bungeeCord = spigotConfig.getBoolean("settings.bungeecord"); + if (ClassUtil.isPresent("org.spigotmc.SpigotConfig")) { + bungeeCord = (boolean) FuzzyReflection.fromClass(Class.forName("org.spigotmc.SpigotConfig")) + .getFieldByType("bungee", Boolean.TYPE).get(null); } } catch (Exception | NoSuchMethodError ex) { getLogger().warning("Cannot check bungeecord support. You use a non-spigot build"); + ex.printStackTrace(); } saveDefaultConfig(); diff --git a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/EncryptionPacketListener.java b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/EncryptionPacketListener.java index a069298a..7e9702d9 100644 --- a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/EncryptionPacketListener.java +++ b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/EncryptionPacketListener.java @@ -71,6 +71,7 @@ public class EncryptionPacketListener extends PacketAdapter { */ @Override public void onPacketReceiving(PacketEvent packetEvent) { + System.out.println("ENCRYPTION REQUEST"); Player player = packetEvent.getPlayer(); //the player name is unknown to ProtocolLib (so getName() doesn't work) - now uses ip:port as key diff --git a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/StartPacketListener.java b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/StartPacketListener.java index beeb56f8..65377a1c 100644 --- a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/StartPacketListener.java +++ b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/StartPacketListener.java @@ -61,7 +61,6 @@ public class StartPacketListener extends PacketAdapter { */ @Override public void onPacketReceiving(PacketEvent packetEvent) { - System.out.println("ON LOGIN"); plugin.setServerStarted(); Player player = packetEvent.getPlayer(); @@ -74,13 +73,13 @@ public class StartPacketListener extends PacketAdapter { //player.getName() won't work at this state PacketContainer packet = packetEvent.getPacket(); + String username = packet.getGameProfiles().read(0).getName(); plugin.getLogger().log(Level.FINER, "Player {0} with {1} connecting to the server" , new Object[]{sessionKey, username}); BukkitAuthPlugin authPlugin = plugin.getAuthPlugin(); if (authPlugin == null) { - System.out.println("NO AUTH PLUGIN"); return; }