mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-12-02 01:46:45 +01:00
ToggleCommand shouldn't hit the database
This commit is contained in:
parent
2fcd3904dc
commit
31e04a2d91
@ -11,10 +11,9 @@ import org.bukkit.entity.Player;
|
||||
import org.bukkit.util.StringUtil;
|
||||
|
||||
import com.gmail.nossr50.datatypes.player.McMMOPlayer;
|
||||
import com.gmail.nossr50.util.Misc;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.commands.CommandUtils;
|
||||
import com.gmail.nossr50.util.player.UserManager;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
||||
public abstract class ToggleCommand implements TabExecutor {
|
||||
@ -46,19 +45,15 @@ public abstract class ToggleCommand implements TabExecutor {
|
||||
return true;
|
||||
}
|
||||
|
||||
String playerName = Misc.getMatchedPlayerName(args[0]);
|
||||
mcMMOPlayer = UserManager.getPlayer(playerName);
|
||||
mcMMOPlayer = UserManager.getPlayer(args[0], true);
|
||||
|
||||
if (!CommandUtils.checkPlayerExistence(sender, playerName, mcMMOPlayer)) {
|
||||
if (mcMMOPlayer == null) {
|
||||
player.sendMessage(LocaleLoader.getString("Commands.Offline"));
|
||||
return true;
|
||||
}
|
||||
|
||||
player = mcMMOPlayer.getPlayer();
|
||||
|
||||
if (CommandUtils.isOffline(sender, player)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
applyCommandAction();
|
||||
sendSuccessMessage(sender);
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user