Skip to content

Commit

Permalink
feat(utils): IS_PLAYER command source predicate
Browse files Browse the repository at this point in the history
  • Loading branch information
WakelessSloth56 committed Aug 16, 2022
1 parent aaa4deb commit 5cc9fd1
Showing 1 changed file with 2 additions and 0 deletions.
Expand Up @@ -15,6 +15,7 @@
import net.minecraft.client.player.LocalPlayer;
import net.minecraft.commands.CommandSource;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.server.level.ServerPlayer;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;

Expand All @@ -26,6 +27,7 @@ public interface CommandUtils {
SimpleCommandExceptionType NOT_DEDICATED_SERVER_ERROR = new SimpleCommandExceptionType(translatable(i18n("command.failure.not_dedicated_server")));
SimpleCommandExceptionType GET_REAL_SOURCE_REFLECTION_ERROR = new SimpleCommandExceptionType(translatable(i18n("command.failure.get_real_source.reflection")));

Predicate<CommandSourceStack> IS_PLAYER = (source) -> source.getEntity() instanceof ServerPlayer;
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);
Expand Down

0 comments on commit 5cc9fd1

Please sign in to comment.