forked from TuxCoding/FastLogin
Update fake player methods
This commit is contained in:
@ -1424,4 +1424,34 @@ public class FakePlayer implements Player {
|
|||||||
public boolean isCollidable() {
|
public boolean isCollidable() {
|
||||||
throw new UnsupportedOperationException("Not supported yet.");
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void stopSound(Sound sound) {
|
||||||
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void stopSound(String sound) {
|
||||||
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isSilent() {
|
||||||
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setSilent(boolean flag) {
|
||||||
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasGravity() {
|
||||||
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setGravity(boolean gravity) {
|
||||||
|
throw new UnsupportedOperationException("Not supported yet.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -45,31 +45,31 @@ public class PluginMessageListener implements Listener {
|
|||||||
ByteArrayDataInput dataInput = ByteStreams.newDataInput(data);
|
ByteArrayDataInput dataInput = ByteStreams.newDataInput(data);
|
||||||
String subchannel = dataInput.readUTF();
|
String subchannel = dataInput.readUTF();
|
||||||
|
|
||||||
ProxiedPlayer fromPlayer = (ProxiedPlayer) pluginMessageEvent.getReceiver();
|
ProxiedPlayer forPlayer = (ProxiedPlayer) pluginMessageEvent.getReceiver();
|
||||||
if ("ON".equals(subchannel)) {
|
if ("ON".equals(subchannel)) {
|
||||||
String playerName = dataInput.readUTF();
|
String playerName = dataInput.readUTF();
|
||||||
|
|
||||||
if (playerName.equals(fromPlayer.getName()) && plugin.getConfig().getBoolean("premium-warning")
|
if (playerName.equals(forPlayer.getName()) && plugin.getConfig().getBoolean("premium-warning")
|
||||||
&& !plugin.getPendingConfirms().contains(fromPlayer.getUniqueId())) {
|
&& !plugin.getPendingConfirms().contains(forPlayer.getUniqueId())) {
|
||||||
fromPlayer.sendMessage(TextComponent.fromLegacyText(plugin.getCore().getMessage("premium-warning")));
|
forPlayer.sendMessage(TextComponent.fromLegacyText(plugin.getCore().getMessage("premium-warning")));
|
||||||
plugin.getPendingConfirms().add(fromPlayer.getUniqueId());
|
plugin.getPendingConfirms().add(forPlayer.getUniqueId());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
plugin.getPendingConfirms().remove(fromPlayer.getUniqueId());
|
plugin.getPendingConfirms().remove(forPlayer.getUniqueId());
|
||||||
AsyncToggleMessage task = new AsyncToggleMessage(plugin, fromPlayer, playerName, true);
|
AsyncToggleMessage task = new AsyncToggleMessage(plugin, forPlayer, playerName, true);
|
||||||
ProxyServer.getInstance().getScheduler().runAsync(plugin, task);
|
ProxyServer.getInstance().getScheduler().runAsync(plugin, task);
|
||||||
} else if ("OFF".equals(subchannel)) {
|
} else if ("OFF".equals(subchannel)) {
|
||||||
String playerName = dataInput.readUTF();
|
String playerName = dataInput.readUTF();
|
||||||
|
|
||||||
AsyncToggleMessage task = new AsyncToggleMessage(plugin, fromPlayer, playerName, false);
|
AsyncToggleMessage task = new AsyncToggleMessage(plugin, forPlayer, playerName, false);
|
||||||
ProxyServer.getInstance().getScheduler().runAsync(plugin, task);
|
ProxyServer.getInstance().getScheduler().runAsync(plugin, task);
|
||||||
} else if ("SUCCESS".equals(subchannel)) {
|
} else if ("SUCCESS".equals(subchannel)) {
|
||||||
if (fromPlayer.getPendingConnection().isOnlineMode()) {
|
if (forPlayer.getPendingConnection().isOnlineMode()) {
|
||||||
//bukkit module successfully received and force logged in the user
|
//bukkit module successfully received and force logged in the user
|
||||||
//update only on success to prevent corrupt data
|
//update only on success to prevent corrupt data
|
||||||
PlayerProfile playerProfile = plugin.getCore().getStorage().loadProfile(fromPlayer.getName());
|
PlayerProfile playerProfile = plugin.getCore().getStorage().loadProfile(forPlayer.getName());
|
||||||
BungeeLoginSession loginSession = plugin.getSession().get(fromPlayer.getPendingConnection());
|
BungeeLoginSession loginSession = plugin.getSession().get(forPlayer.getPendingConnection());
|
||||||
loginSession.setRegistered(true);
|
loginSession.setRegistered(true);
|
||||||
|
|
||||||
if (!loginSession.isAlreadySaved()) {
|
if (!loginSession.isAlreadySaved()) {
|
||||||
|
@ -31,12 +31,14 @@ public class ForceLoginTask implements Runnable {
|
|||||||
try {
|
try {
|
||||||
PendingConnection pendingConnection = player.getPendingConnection();
|
PendingConnection pendingConnection = player.getPendingConnection();
|
||||||
BungeeLoginSession session = plugin.getSession().get(pendingConnection);
|
BungeeLoginSession session = plugin.getSession().get(pendingConnection);
|
||||||
PlayerProfile playerProfile = session.getProfile();
|
|
||||||
|
|
||||||
if (!player.isConnected()) {
|
if (session == null || !player.isConnected()) {
|
||||||
|
plugin.getLogger().log(Level.FINE, "Invalid session player {0} proparly left the server", player);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PlayerProfile playerProfile = session.getProfile();
|
||||||
|
|
||||||
//force login only on success
|
//force login only on success
|
||||||
if (pendingConnection.isOnlineMode()) {
|
if (pendingConnection.isOnlineMode()) {
|
||||||
boolean autoRegister = session.needsRegistration();
|
boolean autoRegister = session.needsRegistration();
|
||||||
|
@ -112,6 +112,7 @@ public abstract class MojangApiConnector {
|
|||||||
try {
|
try {
|
||||||
HttpURLConnection httpConnection = (HttpURLConnection) new URL(MCAPI_UUID_URL + playerName).openConnection();
|
HttpURLConnection httpConnection = (HttpURLConnection) new URL(MCAPI_UUID_URL + playerName).openConnection();
|
||||||
httpConnection.addRequestProperty("Content-Type", "application/json");
|
httpConnection.addRequestProperty("Content-Type", "application/json");
|
||||||
|
httpConnection.setRequestProperty("User-Agent", USER_AGENT);
|
||||||
|
|
||||||
if (httpConnection.getResponseCode() == HttpURLConnection.HTTP_NOT_FOUND) {
|
if (httpConnection.getResponseCode() == HttpURLConnection.HTTP_NOT_FOUND) {
|
||||||
//cracked
|
//cracked
|
||||||
|
Reference in New Issue
Block a user