Command condition

Started by alpgonjustvi on

Topic category: Advanced modding

Active 1 year ago
Joined Apr 2023
Points:
262

User statistics:

  • Modifications: 0
  • Forum topics: 4
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 19
Command condition

Hi, I know it's ridicilous but I want to show the command to selected player. I reviewed it, in the ".java" file it's write:

 

public class TradeadminCommand {

    @SubscribeEvent

    public static void registerCommand(RegisterCommandsEvent event) {

        event.getDispatcher().register(Commands.literal("xx").requires(s -> s.hasPermission(3)).then(Commands.argument("name", ItemArgument.item(event.getBuildContext()))));

    }

}

 

But I want like this:

public class TradeadminCommand { 
    @SubscribeEvent 
    public static void registerCommand(RegisterCommandsEvent event) { 
        event.getDispatcher().register(Commands.literal("xx").requires(s -> s.hasLogicNBT(NBT == true)).then(Commands.argument("name", ItemArgument.item(event.getBuildContext())))); 
    } 
}