Compare commits

...

2 Commits

Author SHA1 Message Date
A c937327d1a
Merge ba071ec1ed into a4c37da8ee 2024-04-28 04:00:25 -07:00
Arasple ba071ec1ed Check for optional SkullOwner 2024-03-04 19:59:50 +08:00
2 changed files with 17 additions and 7 deletions

View File

@ -1,6 +1,9 @@
package net.coreprotect.paper;
import net.coreprotect.bukkit.BukkitAdapter;
import net.coreprotect.config.ConfigHandler;
import org.bukkit.Location;
import org.bukkit.OfflinePlayer;
import org.bukkit.Server;
import org.bukkit.block.Sign;
import org.bukkit.block.Skull;
@ -8,9 +11,6 @@ import org.bukkit.entity.Entity;
import org.bukkit.inventory.Inventory;
import org.bukkit.inventory.InventoryHolder;
import net.coreprotect.bukkit.BukkitAdapter;
import net.coreprotect.config.ConfigHandler;
public class PaperAdapter implements PaperInterface {
public static PaperInterface ADAPTER;
@ -76,7 +76,12 @@ public class PaperAdapter implements PaperInterface {
@Override
public String getSkullOwner(Skull skull) {
return skull.getOwningPlayer().getUniqueId().toString();
OfflinePlayer owner = skull.getOwningPlayer();
if (owner != null) {
return owner.getUniqueId().toString();
} else {
return "";
}
}
@Override

View File

@ -1,12 +1,12 @@
package net.coreprotect.paper;
import com.destroystokyo.paper.profile.PlayerProfile;
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
import org.bukkit.Bukkit;
import org.bukkit.block.Sign;
import org.bukkit.block.Skull;
import org.bukkit.block.sign.Side;
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
public class Paper_v1_20 extends Paper_v1_17 implements PaperInterface {
@Override
@ -22,7 +22,12 @@ public class Paper_v1_20 extends Paper_v1_17 implements PaperInterface {
@Override
public String getSkullOwner(Skull skull) {
return skull.getPlayerProfile().getName();
PlayerProfile profile = skull.getPlayerProfile();
if (profile == null) {
return "";
} else {
return profile.getName();
}
}
@Override