Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create /version command #250

Merged
merged 17 commits into from
Mar 16, 2023
1 change: 1 addition & 0 deletions CONTRIBUTORS
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ tigerw (Tiger Wang)
tonibm19
tonitch (Debucquoy Anthony)
xoft (Mattes Dolak/madmaxoft)
ccuser44
ccuser44 marked this conversation as resolved.
Show resolved Hide resolved

34 changes: 34 additions & 0 deletions Info.lua
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,23 @@ g_PluginInfo =
},
},

["/version"] =
{
Alias = "/ver",
Permission = "core.version",
Handler = HandleVersionCommand,
HelpString = "Shows the version of the server software.",
},

["/about"] =
ccuser44 marked this conversation as resolved.
Show resolved Hide resolved
{
Alias = "/abt",
Permission = "core.version",
Handler = HandleVersionCommand,
HelpString = "Shows the version of the server software.",
},
ccuser44 marked this conversation as resolved.
Show resolved Hide resolved


["/portal"] =
{
Alias = "/world",
Expand Down Expand Up @@ -926,6 +943,18 @@ g_PluginInfo =
HelpString = "Shows a list of the plugins.",
},

["version"] =
{
Handler = HandleVersionCommand,
HelpString = "Shows the version of the server software.",
},

["about"] =
{
Handler = HandleVersionCommand,
HelpString = "Shows the version of the server software.",
},

ccuser44 marked this conversation as resolved.
Show resolved Hide resolved
["rank"] =
{
Handler = HandleConsoleRank,
Expand Down Expand Up @@ -1445,6 +1474,11 @@ g_PluginInfo =
Description = "Allows players to manage the whitelist.",
RecommendedGroups = "admins",
},

["core.version"] =
{
Description = "Shows the version of the server software.",
},
ccuser44 marked this conversation as resolved.
Show resolved Hide resolved
}, -- Permissions
} -- g_PluginInfo

Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ Implements some of the basic commands needed to run a simple server.
|/motd | core.motd | Shows the message of the day.|
|/op | core.rank | Add a player to the administrator rank.|
|/plugins | core.plugins | Shows a list of the plugins.|
|/version | core.version | Shows the server software version.|
|/about | core.version | Shows the server software version.|
ccuser44 marked this conversation as resolved.
Show resolved Hide resolved
|/portal | core.portal | Moves your player to a different world.|
|/r | core.tell | Replies to the latest private message you received.|
|/rank | core.rank | Shows or sets a player's rank.|
Expand Down Expand Up @@ -91,6 +93,7 @@ Implements some of the basic commands needed to run a simple server.
| core.me | | `/me` | |
| core.motd | | `/motd` | |
| core.plugins | | `/plugins` | |
| core.version | | `/version`, `/about` | |
| core.portal | | `/portal` | |
| core.rank | | `/rank`, `/op` | |
| core.regen | | `/regen` | |
Expand Down
13 changes: 13 additions & 0 deletions cmd_version.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
function HandleVersionCommand(Split, Player)
-- Send output to player:
SendMessage(Player, string.format(
"This server is running Cuberite %s - %s (%s - %s) with Lua version %s and SQL version %s.",
ccuser44 marked this conversation as resolved.
Show resolved Hide resolved
cRoot:GetBuildSeriesName(),
cRoot:GetBuildID(),
cRoot:GetBuildCommitID(),
cRoot:GetBuildDateTime(),
_VERSION,
sqlite3.version
))
return true
end