From 1c15f8462ffc77ff96c7e100817de8da7c0dc060 Mon Sep 17 00:00:00 2001 From: Luck Date: Wed, 26 Oct 2016 19:52:03 +0100 Subject: [PATCH] Don't run commands through the buffer system --- .../luckperms/common/commands/SubCommand.java | 51 ++++++++----------- 1 file changed, 21 insertions(+), 30 deletions(-) diff --git a/common/src/main/java/me/lucko/luckperms/common/commands/SubCommand.java b/common/src/main/java/me/lucko/luckperms/common/commands/SubCommand.java index cfcbad43..0fe1b9f0 100644 --- a/common/src/main/java/me/lucko/luckperms/common/commands/SubCommand.java +++ b/common/src/main/java/me/lucko/luckperms/common/commands/SubCommand.java @@ -162,44 +162,35 @@ public abstract class SubCommand { } public static void save(User user, Sender sender, LuckPermsPlugin plugin) { - plugin.doAsync(() -> { - boolean success = plugin.getDatastore().saveUser(user).getUnchecked(); - user.getRefreshBuffer().request().getUnchecked(); - - if (success) { - Message.USER_SAVE_SUCCESS.send(sender); - } else { - Message.USER_SAVE_ERROR.send(sender); - } - }); + boolean success = plugin.getDatastore().force().saveUser(user).getUnchecked(); + user.getRefreshBuffer().requestDirectly(); + if (success) { + Message.USER_SAVE_SUCCESS.send(sender); + } else { + Message.USER_SAVE_ERROR.send(sender); + } } public static void save(Group group, Sender sender, LuckPermsPlugin plugin) { - plugin.doAsync(() -> { - boolean success = plugin.getDatastore().saveGroup(group).getUnchecked(); - plugin.getUpdateTaskBuffer().request().getUnchecked(); - - if (success) { - Message.GROUP_SAVE_SUCCESS.send(sender); - } else { - Message.GROUP_SAVE_ERROR.send(sender); - } - }); + boolean success = plugin.getDatastore().force().saveGroup(group).getUnchecked(); + plugin.getUpdateTaskBuffer().requestDirectly(); + if (success) { + Message.GROUP_SAVE_SUCCESS.send(sender); + } else { + Message.GROUP_SAVE_ERROR.send(sender); + } } public static void save(Track track, Sender sender, LuckPermsPlugin plugin) { - plugin.doAsync(() -> { - boolean success = plugin.getDatastore().saveTrack(track).getUnchecked(); - plugin.getUpdateTaskBuffer().request().getUnchecked(); - - if (success) { - Message.TRACK_SAVE_SUCCESS.send(sender); - } else { - Message.TRACK_SAVE_ERROR.send(sender); - } - }); + boolean success = plugin.getDatastore().force().saveTrack(track).getUnchecked(); + plugin.getUpdateTaskBuffer().requestDirectly(); + if (success) { + Message.TRACK_SAVE_SUCCESS.send(sender); + } else { + Message.TRACK_SAVE_ERROR.send(sender); + } } }