Skip to content

Commit 8820901

Browse files
committed
Fixed skin values and NPE on ping.
1 parent 850c528 commit 8820901

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

hostprofiles-common/src/main/java/de/mcmdev/hostprofiles/common/connection/ConnectionHandler.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ public boolean handleLogin(ConnectionEvent connectionEvent) {
2323
connectionEvent.setUuid(profile.getUuid());
2424
connectionEvent.setName(profile.getName());
2525
connectionEvent.setSkinCopy(profile.isSkinCopy());
26-
if (connectionEvent.getSkinValue() != null) {
26+
if (profile.getSkinValue() != null) {
2727
connectionEvent.setSkinValue(profile.getSkinValue());
28-
if (connectionEvent.getSkinSignature() != null) {
28+
if (profile.getSkinSignature() != null) {
2929
connectionEvent.setSkinSignature(profile.getSkinSignature());
3030
}
3131
}

hostprofiles-paper/src/main/java/de/mcmdev/hostprofiles/paper/listener/PaperListener.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
import org.bukkit.event.Listener;
1515
import org.bukkit.event.player.AsyncPlayerPreLoginEvent;
1616

17+
import java.net.InetSocketAddress;
18+
1719
@RequiredArgsConstructor
1820
public class PaperListener implements Listener {
1921

@@ -54,7 +56,9 @@ private void onAsyncLogin(AsyncPlayerPreLoginEvent event) {
5456

5557
@EventHandler
5658
public void onPing(PaperServerListPingEvent event) {
57-
String hostname = event.getClient().getVirtualHost().getHostName();
59+
InetSocketAddress virtualHost = event.getClient().getVirtualHost();
60+
if (virtualHost == null) return;
61+
String hostname = virtualHost.getHostName();
5862
PingEvent pingEvent = new PingEvent(hostname);
5963
connectionHandler.handlePing(pingEvent);
6064
if (pingEvent.getMotd() != null) {

0 commit comments

Comments
 (0)