Command condition

Started by alpgonjustvi on

Topic category: Advanced modding

Joined Apr 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
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())))); 
    } 
}