mirror of
https://github.com/PHIDIAS0303/ExpCluster.git
synced 2026-09-21 17:04:00 +00:00
Remove redundant event properties
This commit is contained in:
@@ -25,7 +25,7 @@ local Jail = {
|
|||||||
|
|
||||||
--- The role given to jailed players, it has a higher priority than every other role
|
--- The role given to jailed players, it has a higher priority than every other role
|
||||||
--- @return ExpRoles.Role
|
--- @return ExpRoles.Role
|
||||||
local function jail_role()
|
local function get_jail_role()
|
||||||
return (assert(Roles.get_role_by_name("Jail"), "The Jail role does not exist"))
|
return (assert(Roles.get_role_by_name("Jail"), "The Jail role does not exist"))
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -33,7 +33,7 @@ end
|
|||||||
--- @param player LuaPlayer
|
--- @param player LuaPlayer
|
||||||
--- @return boolean
|
--- @return boolean
|
||||||
function Jail.is_jailed(player)
|
function Jail.is_jailed(player)
|
||||||
return jail_role():has_player(player)
|
return get_jail_role():has_player(player)
|
||||||
end
|
end
|
||||||
|
|
||||||
--- Put a player into jail, which suppresses all of their other roles
|
--- Put a player into jail, which suppresses all of their other roles
|
||||||
@@ -42,7 +42,7 @@ end
|
|||||||
--- @param reason string
|
--- @param reason string
|
||||||
--- @return boolean # False when the player was already in jail
|
--- @return boolean # False when the player was already in jail
|
||||||
function Jail.jail_player(player, by_player_name, reason)
|
function Jail.jail_player(player, by_player_name, reason)
|
||||||
local role = jail_role()
|
local role = get_jail_role()
|
||||||
if role:has_player(player) then return false end
|
if role:has_player(player) then return false end
|
||||||
|
|
||||||
-- Stop whatever the player is doing, the jail permission group stops them from starting again
|
-- Stop whatever the player is doing, the jail permission group stops them from starting again
|
||||||
@@ -56,8 +56,6 @@ function Jail.jail_player(player, by_player_name, reason)
|
|||||||
role:assign(player, { by_player_name = by_player_name, silent = true })
|
role:assign(player, { by_player_name = by_player_name, silent = true })
|
||||||
|
|
||||||
script.raise_event(Jail.on_player_jailed, {
|
script.raise_event(Jail.on_player_jailed, {
|
||||||
name = Jail.on_player_jailed,
|
|
||||||
tick = game.tick,
|
|
||||||
player_index = player.index,
|
player_index = player.index,
|
||||||
by_player_name = by_player_name,
|
by_player_name = by_player_name,
|
||||||
reason = reason,
|
reason = reason,
|
||||||
@@ -71,14 +69,12 @@ end
|
|||||||
--- @param by_player_name string
|
--- @param by_player_name string
|
||||||
--- @return boolean # False when the player was not in jail
|
--- @return boolean # False when the player was not in jail
|
||||||
function Jail.unjail_player(player, by_player_name)
|
function Jail.unjail_player(player, by_player_name)
|
||||||
local role = jail_role()
|
local role = get_jail_role()
|
||||||
if not role:has_player(player) then return false end
|
if not role:has_player(player) then return false end
|
||||||
|
|
||||||
role:unassign(player, { by_player_name = by_player_name, silent = true })
|
role:unassign(player, { by_player_name = by_player_name, silent = true })
|
||||||
|
|
||||||
script.raise_event(Jail.on_player_unjailed, {
|
script.raise_event(Jail.on_player_unjailed, {
|
||||||
name = Jail.on_player_unjailed,
|
|
||||||
tick = game.tick,
|
|
||||||
player_index = player.index,
|
player_index = player.index,
|
||||||
by_player_name = by_player_name,
|
by_player_name = by_player_name,
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user