File tree Expand file tree Collapse file tree
src/main/kotlin/com/mairwunnx/projectessentials/core/impl/vanilla/commands Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11package com.mairwunnx.projectessentials.core.impl.vanilla.commands
22
33import com.mairwunnx.projectessentials.core.api.v1.commands.CommandAPI
4+ import com.mairwunnx.projectessentials.core.api.v1.permissions.hasPermission
45import com.mojang.brigadier.CommandDispatcher
56import net.minecraft.command.CommandSource
7+ import net.minecraft.entity.player.ServerPlayerEntity
8+ import org.apache.logging.log4j.LogManager
69
710abstract class VanillaCommandBase (val name : String ) {
811 open fun register (dispatcher : CommandDispatcher <CommandSource >) {
912 CommandAPI .removeCommand(name)
13+ LogManager .getLogger().info(" Native command replacing implementation for $name " )
14+ }
15+
16+ companion object {
17+ @JvmStatic
18+ fun isAllowed (source : CommandSource , node : String , opLevel : Int ) =
19+ if (source.entity is ServerPlayerEntity ) {
20+ hasPermission(source.asPlayer(), " native.$node " , opLevel)
21+ } else true
1022 }
1123}
You can’t perform that action at this time.
0 commit comments