refactor: missed some more actionresults

This commit is contained in:
ineanto 2023-07-01 18:03:43 +02:00
parent a91d039dd2
commit f419f62f6c
5 changed files with 7 additions and 7 deletions

BIN
logs/2023-07-01-1.log.gz Normal file

Binary file not shown.

View file

@ -67,7 +67,7 @@ public class AnvilManager {
return Collections.singletonList(AnvilGUI.ResponseAction.replaceInputText("Invalid username!")); return Collections.singletonList(AnvilGUI.ResponseAction.replaceInputText("Invalid username!"));
} else { } else {
appearanceManager.setName(snapshot.getText()); appearanceManager.setName(snapshot.getText());
final ActionResult<Void> actionResult = appearanceManager.updatePlayer(false); final ActionResult actionResult = appearanceManager.updatePlayer(false, false);
return sendResultAndClose(actionResult); return sendResultAndClose(actionResult);
} }
} }
@ -87,7 +87,7 @@ public class AnvilManager {
return Collections.singletonList(AnvilGUI.ResponseAction.replaceInputText("Invalid username!")); return Collections.singletonList(AnvilGUI.ResponseAction.replaceInputText("Invalid username!"));
} else { } else {
appearanceManager.setSkin(snapshot.getText()); appearanceManager.setSkin(snapshot.getText());
final ActionResult<Void> actionResult = appearanceManager.updatePlayer(true); final ActionResult actionResult = appearanceManager.updatePlayer(true, false);
return sendResultAndClose(actionResult); return sendResultAndClose(actionResult);
} }
} }
@ -96,7 +96,7 @@ public class AnvilManager {
.text("New skin..."); .text("New skin...");
} }
private List<AnvilGUI.ResponseAction> sendResultAndClose(ActionResult<Void> actionResult) { private List<AnvilGUI.ResponseAction> sendResultAndClose(ActionResult actionResult) {
final I18N i18n = new I18N(player); final I18N i18n = new I18N(player);
if (!actionResult.isError()) { if (!actionResult.isError()) {
player.sendMessage(i18n.translate(I18NDict.Event.Disguise.SUCCESS)); player.sendMessage(i18n.translate(I18NDict.Event.Disguise.SUCCESS));

View file

@ -25,7 +25,7 @@ public class PlayerJoinListener implements Listener {
Bukkit.getScheduler().runTaskLater(instance, () -> { Bukkit.getScheduler().runTaskLater(instance, () -> {
final AppearanceManager appearanceManager = AppearanceManager.get(player); final AppearanceManager appearanceManager = AppearanceManager.get(player);
if (appearanceManager.hasData()) { if (appearanceManager.hasData()) {
final ActionResult actionResult = appearanceManager.updatePlayer(appearanceManager.needsASkinChange(), true); final ActionResult actionResult = appearanceManager.updatePlayer(appearanceManager.needsASkinChange(), false);
if (!actionResult.isError()) { if (!actionResult.isError()) {
player.sendMessage(i18n.translate(I18NDict.Event.PreviousSkin.SUCCESS)); player.sendMessage(i18n.translate(I18NDict.Event.PreviousSkin.SUCCESS));
} else { } else {

View file

@ -43,7 +43,7 @@ public class BrokenSQLTest {
public void storePlayer() { public void storePlayer() {
final Optional<NickoProfile> optionalProfile = plugin.getDataStore().getData(player.getUniqueId()); final Optional<NickoProfile> optionalProfile = plugin.getDataStore().getData(player.getUniqueId());
assertFalse(optionalProfile.isPresent()); assertFalse(optionalProfile.isPresent());
ActionResult<Void> result = plugin.getDataStore().saveData(player); ActionResult result = plugin.getDataStore().saveData(player);
assertTrue(result.isError()); assertTrue(result.isError());
} }

View file

@ -75,7 +75,7 @@ public class SQLStorageTest {
profile.setLocale(Locale.FRENCH); profile.setLocale(Locale.FRENCH);
profile.setBungeecordTransfer(false); profile.setBungeecordTransfer(false);
final ActionResult<Void> result = plugin.getDataStore().saveData(player); final ActionResult result = plugin.getDataStore().saveData(player);
assertFalse(result.isError()); assertFalse(result.isError());
final Optional<NickoProfile> optionalUpdatedProfile = plugin.getDataStore().getData(player.getUniqueId()); final Optional<NickoProfile> optionalUpdatedProfile = plugin.getDataStore().getData(player.getUniqueId());
@ -99,7 +99,7 @@ public class SQLStorageTest {
profile.setName(null); profile.setName(null);
profile.setSkin(null); profile.setSkin(null);
final ActionResult<Void> result = plugin.getDataStore().saveData(player); final ActionResult result = plugin.getDataStore().saveData(player);
assertFalse(result.isError()); assertFalse(result.isError());
final Optional<NickoProfile> optionalUpdatedProfile = plugin.getDataStore().getData(player.getUniqueId()); final Optional<NickoProfile> optionalUpdatedProfile = plugin.getDataStore().getData(player.getUniqueId());