fix: reset
This commit is contained in:
parent
03a8eb9b7d
commit
436fc91556
2 changed files with 21 additions and 4 deletions
2
TODO
2
TODO
|
@ -1,5 +1,3 @@
|
||||||
la fonctionnalité pour retirer les déguisements fonctionne pas (admin comme via la tnt côté utilisateur)
|
|
||||||
l'item favori explose si skin == null
|
l'item favori explose si skin == null
|
||||||
les messages d'erreurs ne contiennent pas la raison (est affiché null en raison, pb de trad ?)
|
|
||||||
impossible de s'équiper d'un favori
|
impossible de s'équiper d'un favori
|
||||||
les chat session sont baisées (https://github.com/retrooper/packetevents/issues/1271)
|
les chat session sont baisées (https://github.com/retrooper/packetevents/issues/1271)
|
|
@ -33,11 +33,16 @@ public class AppearanceManager {
|
||||||
final PlayerResetDisguiseEvent event = new PlayerResetDisguiseEvent(player);
|
final PlayerResetDisguiseEvent event = new PlayerResetDisguiseEvent(player);
|
||||||
Bukkit.getPluginManager().callEvent(event);
|
Bukkit.getPluginManager().callEvent(event);
|
||||||
|
|
||||||
|
final String playerName = nameStore.getStoredName(player);
|
||||||
|
profile.setName(playerName);
|
||||||
|
profile.setSkin(playerName);
|
||||||
|
final ActionResult resetSkinUpdate = update(true);
|
||||||
|
|
||||||
profile.setName(null);
|
profile.setName(null);
|
||||||
profile.setSkin(null);
|
profile.setSkin(null);
|
||||||
dataStore.getCache().cache(player.getUniqueId(), profile);
|
dataStore.getCache().cache(player.getUniqueId(), profile);
|
||||||
|
|
||||||
return ActionResult.ok();
|
return resetSkinUpdate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ActionResult update(boolean skinChange) {
|
public ActionResult update(boolean skinChange) {
|
||||||
|
@ -50,7 +55,7 @@ public class AppearanceManager {
|
||||||
final ActionResult propertiesUpdateResult = packetSender.updatePlayerProfileProperties();
|
final ActionResult propertiesUpdateResult = packetSender.updatePlayerProfileProperties();
|
||||||
|
|
||||||
if (propertiesUpdateResult.isError()) {
|
if (propertiesUpdateResult.isError()) {
|
||||||
return reset();
|
return resetWithoutUpdate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,6 +68,20 @@ public class AppearanceManager {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private ActionResult resetWithoutUpdate() {
|
||||||
|
final NickoProfile profile = getNickoProfile();
|
||||||
|
|
||||||
|
// Call the event.
|
||||||
|
final PlayerResetDisguiseEvent event = new PlayerResetDisguiseEvent(player);
|
||||||
|
Bukkit.getPluginManager().callEvent(event);
|
||||||
|
|
||||||
|
profile.setName(null);
|
||||||
|
profile.setSkin(null);
|
||||||
|
dataStore.getCache().cache(player.getUniqueId(), profile);
|
||||||
|
|
||||||
|
return ActionResult.ok();
|
||||||
|
}
|
||||||
|
|
||||||
private NickoProfile getNickoProfile() {
|
private NickoProfile getNickoProfile() {
|
||||||
final Optional<NickoProfile> optionalProfile = dataStore.getData(player.getUniqueId());
|
final Optional<NickoProfile> optionalProfile = dataStore.getData(player.getUniqueId());
|
||||||
return optionalProfile.orElse(NickoProfile.EMPTY_PROFILE.clone());
|
return optionalProfile.orElse(NickoProfile.EMPTY_PROFILE.clone());
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue