FlashyReese / CommandAliases

Alternate short commands for complex commands
MIT License
25 stars 6 forks source link

NullPointerException upon loading command alias #25

Closed redbrain closed 2 years ago

redbrain commented 2 years ago

Mod version: 0.6.0 Server version: 1.18.2 Other mods: Fabric API, BlueMap, Fabric Tailor, FerriteCore, Geyser, Lithium, Phosphor Command file:

[{
    "commandMode": "COMMAND_ALIAS",
    "command": "think",
    "execution": [{
        "command": "me is thinking",
        "type": "CLIENT"
    }]
}]

Error: java.lang.NullPointerException: Cannot invoke "me.flashyreese.mods.commandaliases.command.builder.alias.format.AliasCommand.getCommand()" because "command" is null

FlashyReese commented 2 years ago

The format you are using is outdated. Check out the wiki.

{
    "commandMode": "COMMAND_ALIAS",
    "aliasCommand": {
        "command": "think",
        "execution": [
            {
                "command": "me is thinking",
                "type": "CLIENT"
            }
        ]
    }
}
redbrain commented 2 years ago

Alright, the command registers without an error this time, but it doesn't exist for the players. Any thoughts?

[
  {
    "commandMode": "COMMAND_ALIAS",
    "aliasCommand": {
      "command": "think",
      "execution": [
        {
          "command": "me is thinking...",
          "type": "CLIENT",
          "sleep": 100
        },
        {
          "command": "scoreboard players add {this::SELF} int 1",
          "type": "SERVER"
        }
      ],
      "message": "Intelligence +1"
    }
  }
]
FlashyReese commented 2 years ago

Might be an issue with the new implementation to work with LuckPerms. You can try using LuckPerms and giving the players permission of commandaliases.think.

Another option is to use Command Custom since the alias format isn't getting much support from me by default the permission should fallback to 0 and be set available for everyone if LuckPerms isn't installed.

{
    "commandMode": "COMMAND_CUSTOM",
    "customCommand": {
        "parent": "think",
        "permission": 0, /*Line not required the default is 0 see https://minecraft.fandom.com/wiki/Permission_level*/
        "actions": [
            {
                "command": "me is thinking...",
                "commandType": "CLIENT",
                "sleep": "1000"
            },
            {
                "command": "scoreboard players add $executor_name() int 1",
                "commandType": "SERVER"
            },
                        "message": "Intelligence +1"
        ]
    }
}

The last option is to just downgrade to version 0.5.0.

redbrain commented 2 years ago

I will try options 2 and 3 this afternoon and let you know what works!