-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bugfix: don't error out on //flora → //bonemeal alias if bonemeal mod…
… isn't installed Also add worldeditadditions_core.command_exists to check both WEA and WEW for whether a command exists or not
- Loading branch information
Showing
5 changed files
with
32 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
--- WorldEditAdditions chat command registration | ||
-- @namespace worldeditadditions_core | ||
local wea_c = worldeditadditions_core | ||
|
||
|
||
--- Returns whether a WorldEditAdditions (or WorldEdit) command exists with the given name. | ||
-- Note that this does NOT check for general Minetest chat commands - only commands registered through WorldEditAdditions or WorldEdit, if WorldEdit is currently loaded - the eventual plan is to make it an optional dependency. | ||
-- @param cmdname string The name of the command to check for. Remember to remove the first forward slash! In other words if you would normally type `//layers` in-game, then you'd call `worldeditadditions.command_exists("/layers")`. | ||
-- @param only_wea bool If true, then only check for WorldEditAdditions commands and not commands from related compatible mods such as WorldEdit. | ||
-- @returns bool Whether a WorldEdit/WorldEditAdditions command exists with the given name. | ||
local function command_exists(cmdname, only_wea) | ||
if only_wea == nil then only_wea = false end | ||
if wea_c.registered_commands[cmdname] ~= nil then | ||
return true | ||
end | ||
if only_wea == true then return false end | ||
if worldedit.registered_commands[cmdname] ~= nil then | ||
return true | ||
end | ||
return false | ||
end | ||
|
||
return command_exists |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters