feat: error handling on invalid skin/name
This commit is contained in:
parent
30803363ba
commit
3377dcf2bf
2 changed files with 7 additions and 2 deletions
|
@ -114,15 +114,22 @@ public class AppearanceManager {
|
|||
properties.get("textures").clear();
|
||||
properties.put("textures", new WrappedSignedProperty("textures", skinResult.value(), skinResult.signature()));
|
||||
} else {
|
||||
profile.setSkin(null);
|
||||
dataStore.updateCache(player.getUniqueId(), profile);
|
||||
return ActionResult.error(I18NDict.Error.MOJANG_SKIN);
|
||||
}
|
||||
} else {
|
||||
profile.setName(null);
|
||||
dataStore.updateCache(player.getUniqueId(), profile);
|
||||
return ActionResult.error(I18NDict.Error.MOJANG_NAME);
|
||||
}
|
||||
return ActionResult.ok();
|
||||
} catch (ExecutionException e) {
|
||||
return ActionResult.error(I18NDict.Error.CACHE);
|
||||
} catch (IOException e) {
|
||||
profile.setName(null);
|
||||
profile.setSkin(null);
|
||||
dataStore.updateCache(player.getUniqueId(), profile);
|
||||
return ActionResult.error(I18NDict.Error.MOJANG_NAME);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package xyz.ineanto.nicko.event;
|
||||
|
||||
import net.kyori.adventure.text.Component;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
|
@ -41,7 +40,6 @@ public class PlayerJoinListener implements Listener {
|
|||
optionalProfile.ifPresent(profile -> {
|
||||
// Random Skin on connection feature
|
||||
if (profile.isRandomSkin()) {
|
||||
Bukkit.broadcast(Component.text("§c[ELITE DEBUG] §fJoined with Random Skin."));
|
||||
final String name = instance.getNameFetcher().getRandomUsername();
|
||||
final String skin = instance.getNameFetcher().getRandomUsername();
|
||||
profile.setName(name);
|
||||
|
|
Loading…
Add table
Reference in a new issue