fix: profile skin npe
This commit is contained in:
parent
95453f24d1
commit
9a10ea2982
4 changed files with 8 additions and 4 deletions
|
@ -85,6 +85,7 @@ public class v1_17_R1 implements Internals {
|
||||||
public UpdateResult updateProfile(Player player, NickoProfile profile, boolean skinChange) {
|
public UpdateResult updateProfile(Player player, NickoProfile profile, boolean skinChange) {
|
||||||
final CraftPlayer craftPlayer = (CraftPlayer) player;
|
final CraftPlayer craftPlayer = (CraftPlayer) player;
|
||||||
final EntityPlayer entityPlayer = craftPlayer.getHandle();
|
final EntityPlayer entityPlayer = craftPlayer.getHandle();
|
||||||
|
final boolean changeOnlyName = profile.getSkin() != null && !profile.getSkin().equalsIgnoreCase(player.getName());
|
||||||
Optional<MojangSkin> skin;
|
Optional<MojangSkin> skin;
|
||||||
|
|
||||||
final PacketPlayOutPlayerInfo remove = new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.e, entityPlayer);
|
final PacketPlayOutPlayerInfo remove = new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.e, entityPlayer);
|
||||||
|
@ -93,7 +94,7 @@ public class v1_17_R1 implements Internals {
|
||||||
final PacketPlayOutPlayerInfo add = new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.a);
|
final PacketPlayOutPlayerInfo add = new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.a);
|
||||||
final GameProfile gameProfile = new GameProfile(player.getUniqueId(), profile.getName());
|
final GameProfile gameProfile = new GameProfile(player.getUniqueId(), profile.getName());
|
||||||
|
|
||||||
if (skinChange || !profile.getSkin().equalsIgnoreCase(player.getName())) {
|
if (skinChange || changeOnlyName) {
|
||||||
try {
|
try {
|
||||||
final Optional<String> uuid = NickoBukkit.getInstance().getMojangAPI().getUUID(profile.getSkin());
|
final Optional<String> uuid = NickoBukkit.getInstance().getMojangAPI().getUUID(profile.getSkin());
|
||||||
if (uuid.isPresent()) {
|
if (uuid.isPresent()) {
|
||||||
|
|
|
@ -87,6 +87,7 @@ public class v1_18_R1 implements Internals {
|
||||||
public UpdateResult updateProfile(Player player, NickoProfile profile, boolean skinChange) {
|
public UpdateResult updateProfile(Player player, NickoProfile profile, boolean skinChange) {
|
||||||
final CraftPlayer craftPlayer = (CraftPlayer) player;
|
final CraftPlayer craftPlayer = (CraftPlayer) player;
|
||||||
final EntityPlayer entityPlayer = craftPlayer.getHandle();
|
final EntityPlayer entityPlayer = craftPlayer.getHandle();
|
||||||
|
final boolean changeOnlyName = profile.getSkin() != null && !profile.getSkin().equalsIgnoreCase(player.getName());
|
||||||
Optional<MojangSkin> skin;
|
Optional<MojangSkin> skin;
|
||||||
|
|
||||||
final PacketPlayOutPlayerInfo remove = new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.e, entityPlayer);
|
final PacketPlayOutPlayerInfo remove = new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.e, entityPlayer);
|
||||||
|
@ -95,7 +96,7 @@ public class v1_18_R1 implements Internals {
|
||||||
final PacketPlayOutPlayerInfo add = new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.a);
|
final PacketPlayOutPlayerInfo add = new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.a);
|
||||||
final GameProfile gameProfile = new GameProfile(player.getUniqueId(), profile.getName());
|
final GameProfile gameProfile = new GameProfile(player.getUniqueId(), profile.getName());
|
||||||
|
|
||||||
if (skinChange || !profile.getSkin().equalsIgnoreCase(player.getName())) {
|
if (skinChange || changeOnlyName) {
|
||||||
try {
|
try {
|
||||||
final Optional<String> uuid = NickoBukkit.getInstance().getMojangAPI().getUUID(profile.getSkin());
|
final Optional<String> uuid = NickoBukkit.getInstance().getMojangAPI().getUUID(profile.getSkin());
|
||||||
if (uuid.isPresent()) {
|
if (uuid.isPresent()) {
|
||||||
|
|
|
@ -87,6 +87,7 @@ public class v1_18_R2 implements Internals {
|
||||||
public UpdateResult updateProfile(Player player, NickoProfile profile, boolean skinChange) {
|
public UpdateResult updateProfile(Player player, NickoProfile profile, boolean skinChange) {
|
||||||
final CraftPlayer craftPlayer = (CraftPlayer) player;
|
final CraftPlayer craftPlayer = (CraftPlayer) player;
|
||||||
final EntityPlayer entityPlayer = craftPlayer.getHandle();
|
final EntityPlayer entityPlayer = craftPlayer.getHandle();
|
||||||
|
final boolean changeOnlyName = profile.getSkin() != null && !profile.getSkin().equalsIgnoreCase(player.getName());
|
||||||
Optional<MojangSkin> skin;
|
Optional<MojangSkin> skin;
|
||||||
|
|
||||||
final PacketPlayOutPlayerInfo remove = new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.e, entityPlayer);
|
final PacketPlayOutPlayerInfo remove = new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.e, entityPlayer);
|
||||||
|
@ -95,7 +96,7 @@ public class v1_18_R2 implements Internals {
|
||||||
final PacketPlayOutPlayerInfo add = new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.a);
|
final PacketPlayOutPlayerInfo add = new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.a);
|
||||||
final GameProfile gameProfile = new GameProfile(player.getUniqueId(), profile.getName());
|
final GameProfile gameProfile = new GameProfile(player.getUniqueId(), profile.getName());
|
||||||
|
|
||||||
if (skinChange || !profile.getSkin().equalsIgnoreCase(player.getName())) {
|
if (skinChange || changeOnlyName) {
|
||||||
try {
|
try {
|
||||||
final Optional<String> uuid = NickoBukkit.getInstance().getMojangAPI().getUUID(profile.getSkin());
|
final Optional<String> uuid = NickoBukkit.getInstance().getMojangAPI().getUUID(profile.getSkin());
|
||||||
if (uuid.isPresent()) {
|
if (uuid.isPresent()) {
|
||||||
|
|
|
@ -89,6 +89,7 @@ public class v1_19_R1 implements Internals {
|
||||||
public UpdateResult updateProfile(Player player, NickoProfile profile, boolean skinChange) {
|
public UpdateResult updateProfile(Player player, NickoProfile profile, boolean skinChange) {
|
||||||
final CraftPlayer craftPlayer = (CraftPlayer) player;
|
final CraftPlayer craftPlayer = (CraftPlayer) player;
|
||||||
final EntityPlayer entityPlayer = craftPlayer.getHandle();
|
final EntityPlayer entityPlayer = craftPlayer.getHandle();
|
||||||
|
final boolean changeOnlyName = profile.getSkin() != null && !profile.getSkin().equalsIgnoreCase(player.getName());
|
||||||
Optional<MojangSkin> skin;
|
Optional<MojangSkin> skin;
|
||||||
|
|
||||||
final PacketPlayOutPlayerInfo add = new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.a);
|
final PacketPlayOutPlayerInfo add = new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.a);
|
||||||
|
@ -99,7 +100,7 @@ public class v1_19_R1 implements Internals {
|
||||||
final ProfilePublicKey.a key = remove.b().get(0).e();
|
final ProfilePublicKey.a key = remove.b().get(0).e();
|
||||||
final GameProfile gameProfile = new GameProfile(player.getUniqueId(), profile.getName());
|
final GameProfile gameProfile = new GameProfile(player.getUniqueId(), profile.getName());
|
||||||
|
|
||||||
if (skinChange || !profile.getSkin().equalsIgnoreCase(player.getName())) {
|
if (skinChange || changeOnlyName) {
|
||||||
try {
|
try {
|
||||||
final Optional<String> uuid = NickoBukkit.getInstance().getMojangAPI().getUUID(profile.getSkin());
|
final Optional<String> uuid = NickoBukkit.getInstance().getMojangAPI().getUUID(profile.getSkin());
|
||||||
if (uuid.isPresent()) {
|
if (uuid.isPresent()) {
|
||||||
|
|
Loading…
Reference in a new issue