mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-12-22 16:48:21 +01:00
Again Change BungeeCord hook with latest method
This commit is contained in:
parent
96907d5a24
commit
c18131408d
Binary file not shown.
2
pom.xml
2
pom.xml
@ -28,7 +28,7 @@
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<version>2.7.12b2</version>
|
||||
<version>2.7.12b3</version>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.bukkit</groupId>
|
||||
|
@ -95,7 +95,6 @@ public class AuthMe extends JavaPlugin {
|
||||
public API api;
|
||||
public HashMap<String, Integer> captcha = new HashMap<String, Integer>();
|
||||
public HashMap<String, String> cap = new HashMap<String, String>();
|
||||
public HashMap<String, String> bungeesIp = new HashMap<String, String>();
|
||||
public MultiverseCore mv = null;
|
||||
|
||||
@Override
|
||||
@ -235,10 +234,6 @@ public class AuthMe extends JavaPlugin {
|
||||
|
||||
management = new Management(database, this);
|
||||
|
||||
if (Settings.bungee) {
|
||||
this.getServer().getMessenger().registerOutgoingPluginChannel(this, "BungeeCord");
|
||||
this.getServer().getMessenger().registerIncomingPluginChannel(this, "BungeeCord", new BungeeCord(this));
|
||||
}
|
||||
PluginManager pm = getServer().getPluginManager();
|
||||
if (pm.isPluginEnabled("Spout")) {
|
||||
pm.registerEvents(new AuthMeSpoutListener(database), this);
|
||||
|
@ -1,52 +0,0 @@
|
||||
package uk.org.whoami.authme;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.plugin.messaging.PluginMessageListener;
|
||||
|
||||
import uk.org.whoami.authme.settings.Settings;
|
||||
|
||||
|
||||
public class BungeeCord implements PluginMessageListener {
|
||||
|
||||
public AuthMe plugin;
|
||||
|
||||
public BungeeCord(AuthMe plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPluginMessageReceived(String channel, Player player,
|
||||
byte[] message) {
|
||||
|
||||
if (channel.equals("BungeeCord")) {
|
||||
DataInputStream in = new DataInputStream(new ByteArrayInputStream(
|
||||
message));
|
||||
try {
|
||||
|
||||
String packetType = in.readUTF();
|
||||
|
||||
if (packetType.equals("IP")) {
|
||||
|
||||
if (player.isOnline()) {
|
||||
String ip = in.readUTF();
|
||||
|
||||
if (!Settings.noConsoleSpam)
|
||||
ConsoleLogger.info(
|
||||
"Got data from bungeecord: Player "
|
||||
+ player.getName()
|
||||
+ " Logged in with IP :" + ip);
|
||||
|
||||
String name = player.getName();
|
||||
plugin.bungeesIp.put(name, ip);
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -5,6 +5,7 @@ import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import me.muizers.Notifications.Notification;
|
||||
import net.md_5.bungee.BungeeCord;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
@ -60,13 +61,11 @@ public class Management {
|
||||
|
||||
String name = player.getName().toLowerCase();
|
||||
String ip = player.getAddress().getAddress().getHostAddress();
|
||||
String playerName = player.getName();
|
||||
if (Settings.bungee) {
|
||||
try {
|
||||
if (plugin.bungeesIp.containsKey(playerName))
|
||||
ip = plugin.bungeesIp.get(playerName);
|
||||
ip = BungeeCord.getInstance().getPlayer(player.getName()).getAddress().getAddress().getHostAddress();
|
||||
} catch (NoClassDefFoundError ncdfe) {
|
||||
ConsoleLogger.showError("Your BungeeCord version is outdated");
|
||||
ConsoleLogger.showError("Your BungeeCord version is outdated, you need a version with the latest API");
|
||||
}
|
||||
}
|
||||
World world = player.getWorld();
|
||||
|
@ -20,6 +20,7 @@ import java.security.NoSuchAlgorithmException;
|
||||
import java.util.Date;
|
||||
|
||||
import me.muizers.Notifications.Notification;
|
||||
import net.md_5.bungee.BungeeCord;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
@ -76,15 +77,13 @@ public class RegisterCommand implements CommandExecutor {
|
||||
|
||||
final Player player = (Player) sender;
|
||||
final String name = player.getName().toLowerCase();
|
||||
final String playerName = player.getName();
|
||||
String ipA = player.getAddress().getAddress().getHostAddress();
|
||||
|
||||
if (Settings.bungee) {
|
||||
try {
|
||||
if (plugin.bungeesIp.containsKey(playerName))
|
||||
ipA = plugin.bungeesIp.get(playerName);
|
||||
ipA = BungeeCord.getInstance().getPlayer(player.getName()).getAddress().getAddress().getHostAddress();
|
||||
} catch (NoClassDefFoundError ncdfe) {
|
||||
ConsoleLogger.showError("Your BungeeCord version is outdated");
|
||||
ConsoleLogger.showError("Your BungeeCord version is outdated, you need a version with the latest API");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -16,12 +16,11 @@
|
||||
|
||||
package uk.org.whoami.authme.listener;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
|
||||
import net.md_5.bungee.BungeeCord;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.GameMode;
|
||||
import org.bukkit.Location;
|
||||
@ -664,39 +663,10 @@ public class AuthMePlayerListener implements Listener {
|
||||
Location spawnLoc = world.getSpawnLocation();
|
||||
gm = player.getGameMode().getValue();
|
||||
final String name = player.getName().toLowerCase();
|
||||
final String playerName = player.getName();
|
||||
gameMode.put(name, gm);
|
||||
BukkitScheduler sched = plugin.getServer().getScheduler();
|
||||
final PlayerJoinEvent e = event;
|
||||
|
||||
if (Settings.bungee);
|
||||
sched.scheduleSyncDelayedTask(plugin, new Runnable() {
|
||||
public void run() {
|
||||
try {
|
||||
|
||||
ByteArrayOutputStream b = new ByteArrayOutputStream();
|
||||
DataOutputStream out = new DataOutputStream(b);
|
||||
|
||||
try {
|
||||
out.writeUTF("IP");
|
||||
} catch (IOException e) {
|
||||
// Can never happen
|
||||
}
|
||||
|
||||
plugin.getServer()
|
||||
.getPlayerExact(playerName)
|
||||
.sendPluginMessage(plugin, "BungeeCord",
|
||||
b.toByteArray());
|
||||
|
||||
} catch (Exception exception) {
|
||||
|
||||
exception.printStackTrace();
|
||||
|
||||
}
|
||||
}
|
||||
}, 21L);
|
||||
|
||||
|
||||
if (plugin.getCitizensCommunicator().isNPC(player, plugin) || Utils.getInstance().isUnrestricted(player) || CombatTagComunicator.isNPC(player)) {
|
||||
return;
|
||||
}
|
||||
@ -704,10 +674,9 @@ public class AuthMePlayerListener implements Listener {
|
||||
String ip = player.getAddress().getAddress().getHostAddress();
|
||||
if (Settings.bungee) {
|
||||
try {
|
||||
if (plugin.bungeesIp.containsKey(playerName))
|
||||
ip = plugin.bungeesIp.get(playerName);
|
||||
ip = BungeeCord.getInstance().getPlayer(player.getName()).getAddress().getAddress().getHostAddress();
|
||||
} catch (NoClassDefFoundError ncdfe) {
|
||||
ConsoleLogger.showError("Your BungeeCord version is outdated");
|
||||
ConsoleLogger.showError("Your BungeeCord version is outdated, you need a version with the latest API");
|
||||
}
|
||||
}
|
||||
if(Settings.isAllowRestrictedIp && !Settings.getRestrictedIp(name, ip)) {
|
||||
|
@ -3,7 +3,7 @@ author: darkwarriros,Xephi
|
||||
website: http://www.multiplayer-italia.com/
|
||||
description: AuthMe prevents people, which aren't logged in, from doing stuff like placing blocks, moving, typing commands or seeing the inventory of the current player.
|
||||
main: uk.org.whoami.authme.AuthMe
|
||||
version: 2.7.12b2
|
||||
version: 2.7.12b3
|
||||
softdepend: [Vault, ChestShop, Spout, Multiverse-Core, Notifications, Citizens, CombatTag]
|
||||
commands:
|
||||
register:
|
||||
|
Loading…
Reference in New Issue
Block a user