Skip to content

Commit

Permalink
feat(utils): command source permission level predicates
Browse files Browse the repository at this point in the history
  • Loading branch information
WakelessSloth56 committed Jun 29, 2022
1 parent 15ec843 commit e4c9ada
Showing 1 changed file with 7 additions and 0 deletions.
Expand Up @@ -4,6 +4,7 @@
import static org.auioc.mcmod.arnicalib.utils.game.TextUtils.I18nText;
import java.lang.reflect.Field;
import java.util.List;
import java.util.function.Predicate;
import java.util.stream.Collectors;
import org.auioc.mcmod.arnicalib.api.mixin.common.IMixinCommandSourceStack;
import com.mojang.brigadier.context.CommandContext;
Expand All @@ -25,6 +26,12 @@ public interface CommandUtils {
SimpleCommandExceptionType NOT_DEDICATED_SERVER_ERROR = new SimpleCommandExceptionType(I18nText(i18n("command.failure.not_dedicated_server")));
SimpleCommandExceptionType GET_REAL_SOURCE_REFLECTION_ERROR = new SimpleCommandExceptionType(I18nText(i18n("command.failure.get_real_source.reflection")));

Predicate<CommandSourceStack> PERMISSION_LEVEL_0 = (source) -> source.hasPermission(0);
Predicate<CommandSourceStack> PERMISSION_LEVEL_1 = (source) -> source.hasPermission(1);
Predicate<CommandSourceStack> PERMISSION_LEVEL_2 = (source) -> source.hasPermission(2);
Predicate<CommandSourceStack> PERMISSION_LEVEL_3 = (source) -> source.hasPermission(3);
Predicate<CommandSourceStack> PERMISSION_LEVEL_4 = (source) -> source.hasPermission(4);

/**
* @param sourceStack
* @return The real command source of the specified {@code CommandSourceStack}
Expand Down

0 comments on commit e4c9ada

Please sign in to comment.