fix(appearance): show error reason
This commit is contained in:
parent
365ac9b2d9
commit
f14457fd8b
1 changed files with 9 additions and 2 deletions
|
@ -3,6 +3,7 @@ package xyz.ineanto.nicko.gui.items.home;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.inventory.ClickType;
|
import org.bukkit.event.inventory.ClickType;
|
||||||
import xyz.ineanto.nicko.NickoBukkit;
|
import xyz.ineanto.nicko.NickoBukkit;
|
||||||
|
import xyz.ineanto.nicko.appearance.ActionResult;
|
||||||
import xyz.ineanto.nicko.appearance.AppearanceManager;
|
import xyz.ineanto.nicko.appearance.AppearanceManager;
|
||||||
import xyz.ineanto.nicko.i18n.I18N;
|
import xyz.ineanto.nicko.i18n.I18N;
|
||||||
import xyz.ineanto.nicko.i18n.I18NDict;
|
import xyz.ineanto.nicko.i18n.I18NDict;
|
||||||
|
@ -39,10 +40,16 @@ public class RandomSkinItem {
|
||||||
instance.getDataStore().updateCache(player.getUniqueId(), profile);
|
instance.getDataStore().updateCache(player.getUniqueId(), profile);
|
||||||
|
|
||||||
final AppearanceManager appearanceManager = new AppearanceManager(player);
|
final AppearanceManager appearanceManager = new AppearanceManager(player);
|
||||||
if (!appearanceManager.updatePlayer(true, false).isError()) {
|
final ActionResult result = appearanceManager.updatePlayer(true, false);
|
||||||
|
if (!result.isError()) {
|
||||||
player.sendMessage(i18n.translate(I18NDict.Event.Appearance.Set.OK, true));
|
player.sendMessage(i18n.translate(I18NDict.Event.Appearance.Set.OK, true));
|
||||||
} else {
|
} else {
|
||||||
player.sendMessage(i18n.translate(I18NDict.Event.Appearance.Set.ERROR, true));
|
player.sendMessage(i18n.translate(
|
||||||
|
I18NDict.Event.Appearance.Set.ERROR,
|
||||||
|
true,
|
||||||
|
i18n.translate(result.getErrorKey(), false)
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in a new issue