forked from TuxCoding/FastLogin
Optional migration
This commit is contained in:
@@ -4,6 +4,8 @@ import com.github.games647.fastlogin.core.PlayerProfile;
|
||||
import com.github.games647.fastlogin.core.mojang.SkinProperties;
|
||||
import com.github.games647.fastlogin.core.shared.LoginSession;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
|
||||
/**
|
||||
@@ -63,8 +65,8 @@ public class BukkitLoginSession extends LoginSession {
|
||||
}
|
||||
|
||||
//todo: this should be optional for players without a skin at all
|
||||
public synchronized SkinProperties getSkinProperty() {
|
||||
return skinProperty;
|
||||
public synchronized Optional<SkinProperties> getSkin() {
|
||||
return Optional.ofNullable(skinProperty);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@ public class CrackedCommand implements CommandExecutor {
|
||||
plugin.getCore().sendLocaleMessage("remove-premium", sender);
|
||||
|
||||
profile.setPremium(false);
|
||||
profile.setUuid(null);
|
||||
profile.setId(null);
|
||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, () -> {
|
||||
plugin.getCore().getStorage().save(profile);
|
||||
});
|
||||
|
||||
+1
-5
@@ -44,11 +44,7 @@ public class SkinApplyListener 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())) {
|
||||
SkinProperties skinProperty = session.getSkinProperty();
|
||||
if (skinProperty != null) {
|
||||
applySkin(player, skinProperty.getValue(), skinProperty.getSignature());
|
||||
}
|
||||
|
||||
session.getSkin().ifPresent(skin -> applySkin(player, skin.getValue(), skin.getSignature()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user