Skip to content

Commit

Permalink
Fixed API function copypasta.
Browse files Browse the repository at this point in the history
  • Loading branch information
madmaxoft committed Sep 18, 2016
1 parent d213f92 commit ce7c198
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 28 deletions.
34 changes: 17 additions & 17 deletions API.lua
Expand Up @@ -22,22 +22,22 @@ function LockAreaByCoords(a_WorldName, a_BlockX, a_BlockZ, a_LockedByName)
) then
return false, "ParamError", "Invalid parameters. Expected string, number, number and string."
end

-- Find the appropriate area:
local Area = g_DB:LoadAreaByPos(a_WorldName, a_BlockX, a_BlockZ)
if (Area == nil) then
return false, "NoAreaHere", "There is no gallery area here"
end

-- If the area is already locked, bail out:
if (Area.IsLocked) then
return false, "AlreadyLocked", "This area has already been locked by " .. Area.LockedBy .. " on " .. Area.DateLocked
end

-- Lock the area:
g_DB:LockArea(Area, a_LockedByName)
ReplaceAreaForAllPlayers(Area)

return true
end

Expand All @@ -57,22 +57,22 @@ function LockAreaByID(a_AreaID, a_LockedByName)
) then
return false, "ParamError", "Invalid parameters. Expected number and string."
end

-- Find the appropriate area:
local Area = g_DB:LoadAreaByID(a_AreaID)
if (Area == nil) then
return false, "NoSuchArea", "There is no such area"
end

-- If the area is already locked, bail out:
if (Area.IsLocked) then
return false, "AlreadyLocked", "This area has already been locked by " .. Area.LockedBy .. " on " .. Area.DateLocked
end

-- Lock the area:
g_DB:LockArea(Area, a_LockedByName)
ReplaceAreaForAllPlayers(Area)

return true
end

Expand All @@ -91,26 +91,26 @@ function UnlockAreaByCoords(a_WorldName, a_BlockX, a_BlockZ, a_UnlockedByName)
(type(a_WorldName) ~= "string") or
(type(a_BlockX) ~= "number") or
(type(a_BlockZ) ~= "number") or
(type(a_LockedByName) ~= "string")
(type(a_UnlockedByName) ~= "string")
) then
return false, "ParamError", "Invalid parameters. Expected string, number, number and string."
end

-- Find the appropriate area:
local Area = g_DB:LoadAreaByPos(a_WorldName, a_BlockX, a_BlockZ)
if (Area == nil) then
return false, "NoAreaHere", "There is no gallery area here"
end

-- If the area isn't locked, bail out:
if not(Area.IsLocked) then
return false, "NotLocked", "This area hasn't been locked."
end

-- Lock the area:
g_DB:UnlockArea(Area, a_UnlockedByName)
ReplaceAreaForAllPlayers(Area)

return true
end

Expand All @@ -130,22 +130,22 @@ function UnlockAreaByID(a_AreaID, a_UnlockedByName)
) then
return false, "ParamError", "Invalid parameters. Expected number and string."
end

-- Find the appropriate area:
local Area = g_DB:LoadAreaByID(a_AreaID)
if (Area == nil) then
return false, "NoSuchArea", "There is no such area"
end

-- If the area is already unlocked, bail out:
if not(Area.IsLocked) then
return false, "NotLocked", "This area has already been unlocked by " .. Area.LockedBy .. " on " .. Area.DateLocked
end

-- Unlock the area:
g_DB:UnlockArea(Area, a_UnlockedByName)
ReplaceAreaForAllPlayers(Area)

return true
end

Expand Down
31 changes: 20 additions & 11 deletions README.md
Expand Up @@ -41,12 +41,16 @@ Note that most admin-level permissions need their non-admin-level permissions in
|/gallery help | gallery.help | prints detailed help for the subcommand|
|/gallery info | gallery.info | prints information on the area you're currently standing at|
|/gallery list | gallery.list | lists all available galleries|
|/gallery lockarea | gallery.admin.lockarea | locks an area so that even the owner can't build there|
|/gallery my | gallery.my | lists all your areas|
|/gallery name | gallery.name | renames the area you're currently standing at|
|/gallery remove | gallery.admin.remove | removes the area you're standing on from its owner|
|/gallery reset | gallery.reset | resets the area you're standing on to its original state|
|/gallery select | gallery.select | selects the entire area you're standing in.|
|/gallery stats | gallery.stats | shows statistics about the galleries on this server|
|/gallery template | gallery.admin.template | creates new .schematic template based on your selection|
|/gallery unclaim | gallery.unclaim | removes your claim on the area you're standing in|
|/gallery unlockarea | gallery.admin.unlockarea | unlocks a previously locked area|
|/gallery visit | gallery.visit | teleports you to the specified gallery|


Expand All @@ -58,22 +62,27 @@ Note that most admin-level permissions need their non-admin-level permissions in
| gallery.admin.buildanywhere.<GalleryName> | Build in other people's areas and the public sidewalks in the specific gallery. | | local admins, local mods |
| gallery.admin.goto | Teleport to any player's area. | `/gallery goto @PlayerName AreaName`, `/gallery goto`, `/gallery goto @PlayerName AreaName` | VIPs |
| gallery.admin.info | View information on any area. | `/gallery info` | VIPs |
| gallery.admin.lockarea | Lock an area so that not even the owner can build in there. | `/gallery lockarea` | admins |
| gallery.admin.my | View list of areas for other players, using the "/gallery my @playername [<galleryname>]" form. | `/gallery my @PlayerName`, `/gallery my @PlayerName GalleryName`, `/gallery my`, `/gallery my @PlayerName`, `/gallery my @PlayerName GalleryName` | VIPs |
| gallery.admin.name | Rename any area for any player. | `/gallery name NewName`, `/gallery name @PlayerName OldName NewName`, `/gallery name`, `/gallery name NewName`, `/gallery name @PlayerName OldName NewName` | admins, mods |
| gallery.admin.template | Create a .schematic file out of an in-game cuboid. | `/gallery template`, `/gallery template` | admins |
| gallery.admin.overridelocked | Allows a player to build in areas that have been locked. The player still needs to have access to the area - either ownership or by allowance. | | admins |
| gallery.admin.remove | | `/gallery remove` | |
| gallery.admin.template | Create a .schematic file out of an in-game cuboid. | `/gallery template` | admins |
| gallery.admin.unlockarea | Unlock a previously locked area. See also "gallery.admin.lock." | `/gallery unlockarea` | admins |
| gallery.admin.worldedit | Allows the use of worldedit anywhere in the gallery. | | admins |
| gallery.allow | Allow another player to build in your area. | `/gallery allow`, `/gallery allow` | normal users |
| gallery.claim | Claim an area in any gallery. | `/gallery claim`, `/gallery claim` | normal users |
| gallery.deny | Deny another player to build in your area. | `/gallery deny`, `/gallery deny` | normal users |
| gallery.fork | | `/gallery fork`, `/gallery fork` | |
| gallery.allow | Allow another player to build in your area. | `/gallery allow` | normal users |
| gallery.claim | Claim an area in any gallery. | `/gallery claim` | normal users |
| gallery.deny | Deny another player to build in your area. | `/gallery deny` | normal users |
| gallery.fork | | `/gallery fork` | |
| gallery.goto | Teleport to any player's area. | `/gallery goto @PlayerName AreaName`, `/gallery goto`, `/gallery goto @PlayerName AreaName` | VIPs |
| gallery.help | Display help for subcommands. | `/gallery help`, `/gallery help` | everyone |
| gallery.info | View information on an area owned by self. | `/gallery info`, `/gallery info` | normal users |
| gallery.list | List available gallery. | `/gallery list`, `/gallery list` | normal users |
| gallery.help | Display help for subcommands. | `/gallery help` | everyone |
| gallery.info | View information on an area owned by self. | `/gallery info` | normal users |
| gallery.list | List available gallery. | `/gallery list` | normal users |
| gallery.my | View list of areas for other players, using the "/gallery my @playername [<galleryname>]" form. | `/gallery my @PlayerName`, `/gallery my @PlayerName GalleryName`, `/gallery my`, `/gallery my @PlayerName`, `/gallery my @PlayerName GalleryName` | VIPs |
| gallery.name | Rename any area for any player. | `/gallery name NewName`, `/gallery name @PlayerName OldName NewName`, `/gallery name`, `/gallery name NewName`, `/gallery name @PlayerName OldName NewName` | admins, mods |
| gallery.reset | | `/gallery reset` | |
| gallery.select | | `/gallery select`, `/gallery select` | |
| gallery.stats | | `/gallery stats`, `/gallery stats` | |
| gallery.visit | Teleport to any gallery. | `/gallery visit`, `/gallery visit` | normal users |
| gallery.select | | `/gallery select` | |
| gallery.stats | | `/gallery stats` | |
| gallery.unclaim | | `/gallery unclaim` | |
| gallery.visit | Teleport to any gallery. | `/gallery visit` | normal users |
| gallery.worldedit | Allows the use of WorldEdit within each individual area. | | normal users |

0 comments on commit ce7c198

Please sign in to comment.