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 @@ -8,6 +8,7 @@ as provided in the LICENSE file.
36451
bearbin (Alexander Harkness)
Bond-009
ccuser44
daniel0916
Etmix
Howaner
Expand Down
37 changes: 35 additions & 2 deletions Info.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ g_PluginInfo =

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

["/ban"] =
{
Permission = "core.ban",
Expand Down Expand Up @@ -661,7 +669,15 @@ g_PluginInfo =
},
},
},


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

["/viewdistance"] =
{
Permission = "core.viewdistance",
Expand Down Expand Up @@ -759,6 +775,12 @@ g_PluginInfo =

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

["ban"] =
{
Handler = HandleConsoleBan,
Expand Down Expand Up @@ -1287,7 +1309,13 @@ g_PluginInfo =
},
},
},


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

["weather"] =
{
Handler = HandleConsoleWeather,
Expand Down Expand Up @@ -1445,6 +1473,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 @@ -5,6 +5,7 @@ Implements some of the basic commands needed to run a simple server.
### General
| Command | Permission | Description |
| ------- | ---------- | ----------- |
|/about | core.version | Shows the server software version.|
|/ban | core.ban | Bans a player.|
|/clear | core.clear | Clears the inventory of a player.|
|/difficulty | core.difficulty | Changes the difficulty level of the world you're located in.|
Expand Down Expand Up @@ -55,6 +56,7 @@ Implements some of the basic commands needed to run a simple server.
|/unrank | core.unrank | Add a player to the default rank.|
|/unsafegive | core.give.unsafe | Gives an item to a player, even if the item is blacklisted.|
|/unsafeitem | core.item.unsafe | Gives your player an item, even if the item is blacklisted.|
|/version | core.version | Shows the server software version.|
|/viewdistance | core.viewdistance | Changes your view distance.|
|/weather | core.weather | Changes the world's weather.|
|/whitelist | | Manages the whitelist.|
Expand Down Expand Up @@ -113,6 +115,7 @@ Implements some of the basic commands needed to run a simple server.
| core.tps | | `/tps` | |
| core.unban | | `/unban` | |
| core.unrank | | `/deop`, `/unrank` | |
| core.version | | `/version`, `/about` | |
| core.viewdistance | | `/viewdistance` | |
| core.weather | Allows players to change the weather. | `/weather` | admins |
| core.whitelist | Allows players to manage the whitelist. | `/whitelist off`, `/whitelist list`, `/whitelist remove`, `/whitelist on`, `/whitelist add` | admins |
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:
Response = SendMessage(Player, string.format(
"This server is running Cuberite %s - %s (%s - %s) with Lua version %s and SQLite version %s.",
cRoot:GetBuildSeriesName(),
cRoot:GetBuildID(),
cRoot:GetBuildCommitID(),
cRoot:GetBuildDateTime(),
_VERSION,
sqlite3.version()
))
return true, Response
end