Skip to content

Commit

Permalink
Create /version command (#250)
Browse files Browse the repository at this point in the history
Co-authored-by: Mat <[email protected]>
  • Loading branch information
ccuser44 and mathiascode authored Mar 16, 2023
1 parent 27185c6 commit bcba1c6
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 2 deletions.
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.",
},
}, -- 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

0 comments on commit bcba1c6

Please sign in to comment.