add a detailed time limit to "permission" and provides a GUI for it

Supported Games
GameServerKingsGameServerKings

Features

  • Time-limited permission based on real time (Similar features to the TimedPermission plug-in)
  • Time-limited permission based on play time (Requires PlaytimeTracker Plug-in)
  • Automatically remove permission if the user does not connect to the server for a period of time
  • Manage multiple permission in one item
  • GUI Visualized Permission

About EffectThread

This plug-in provides a new way to give you a permission.

I decided to wrap the "permission" once because I had to add a property value to the existing "permission."It's EffectThread that rapped "permission."

EffectThread has the following properties:

  1. multiple permission
  2. Colors displayed in the GUI
  3. Type of duration and duration
  4. The value that determines if "EffectThread" is disabled a few seconds after the player disconnects.
  • As soon as EffectThread is given to the Player, "Permission" in EffectThread is also granted to the user
  • Then, items 3 and 4 determine when EffectThread will be removed from player.

There are three types of EffectThread duration: RealTime, Playtime, and No.

  • RealTime based duration EffectThread is will be removed when the time of the real world has elapsed.
  • PlayTime based duration EffectThread is will be removed when the player fills a specific time on the server.
  • An effect without time limit exists permanently until manually released

Permissions

  • permissioneffects.admin -- Allows player to use the /eps command

Admin Commands

  • /eps add <user/group> <playername/groupname> <effectthread> -- add effect to player/group
  • /eps remove <user/group> <playername/groupname> <effectthread> -- remove effect from player/group
  • /eps removeall <user/group> <playername/groupname> -- remove all effect from player/group
  • /eps reset <user/group/all> -- reset players/groups thread data
  • /eps thread add <threadname> <threadcolor> <permission1,permission2,...> <sec> <rt/pt> <DisconnExpireSec> -- register thread
  • /eps thread remove <threadname> -- unregister thread
  • /eps rlist -- Check Registered Thread
  • /eps plist -- Check Players Thread
  • /eps glist -- Check Groups Thread
  • /eps pt <player> -- Check Player Thread

Add effectthread examples

ex)/eps thread add "Restore Upon Death" green restoreupondeath.admin 3600 pt 7200 -- Create EffectThread with restoreupondeath.admin permission of RestoreUponDeath plug-in. Based on playtime(pt) and has a duration of 1hour(3,600 seconds). remove after 2 hours(7200 seconds) of disconnection, GUI shown in green

ex2)/eps thread add "Loot Protection" #FF6C6C sleeperguard.damageprotection,sleeperguard.lootprotection 3600 rt 0 -- Create EffectThread with sleeperguard.damageprotection and sleeperguard.lootprotection permission of SleeperGuard plug-in. Based on realtime(rt) and has a duration of 1hour(3,600 seconds). Automatic release after certain hours after disconnecting is disabled(0), GUI shown in #FF6C6C(light red)

ex3)/eps thread add "NPC Targeting Disable" blue donttargetme.playernpc,donttargetme.npc 0 rt 0 -- Create EffectThread with donttargetme.playernpc and donttargetme.npc permission of DontTargetMe plug-in. The time limit is unlimited(0). Automatic release after certain hours after disconnecting is disabled(0), GUI shown in blue

An example of EffectThread applied

Player Commands

  • /effect -- Check Your EffectThread

Configuration

  • DisconnectDetectTimerInterval -- The frequency with which the timer is operated to measure the user's lost connection time (the lower the value, the more accurate it is).
  • EffectCommand -- Modify /effect command
  • 'EPSCommand` -- Modify /eps command
  • TimeLimitTimerInterval -- The frequency with which the timer is operated to measure the time limit of the permission (the lower the value, the more accurate it is).
  • UIUpdateTimerInterval -- The frequency with which the timer update GUI (the lower the value, the more accurate it is).
  • use_BroadCast -- When a user or group receives a "permission" through this plug-in, Decide if you want to broadcast a message that you received "permission"
  • use_ConsoleMessage -- When a user or group receives a "permission" through this plug-in, Decide whether to output messages received "permission" to the console
  • use_Message -- This option determines whether the user is notified by message when the user has permission.
  • UIPosions -- This option is the value of the UI position and the number 10, 8 and 6 means different values depending on UIScale. The UI size is configured to respond to users with different UI sizes, and the basic UI size is 10.
  • ConfigVersion -- It's for config update. Never mind.
{
  "DisconnectDetectTimerInterval": 10,
  "EffectCommand": "effect",
  "EPSCommand": "eps",
  "TimeLimitTimerInterval": 4,
  "UIUpdateTimerInterval": 4,
  "use_BroadCast": false,
  "use_ConsoleMessage": true,
  "use_Message": true,
  "UIPosions": {
    "10": {
      "YAnchorMax": 0.11,
      "YAnchorMin": 0.11,
      "XAnchorMax": 0.6395,
      "XAnchorMin": 0.3445
    },
    "8": {
      "YAnchorMax": 0.11,
      "YAnchorMin": 0.11,
      "XAnchorMax": 0.6105,
      "XAnchorMin": 0.375
    },
    "6": {
      "YAnchorMax": 0.11,
      "YAnchorMin": 0.11,
      "XAnchorMax": 0.5825,
      "XAnchorMin": 0.4056
    }
  },
  "ConfigVersion": {
    "Major": 1,
    "Minor": 0,
    "Patch": 5
  }
}

Stored Data

The plugin group data are stored in data/PermissionEffects/GroupData.json. You must use the command "/eps reset" to reset this file

The plugin player data are stored in data/PermissionEffects/PlayerData.json. You must use the command "/eps reset" to reset this file

The plugin UI data are stored in data/PermissionEffects/PlayerGUIData.json. Erasing this file will reset the user's UItoggle and page information.

Localization

{
  "No Permission": "You do not have permission to use the '{0}' command.",
  "SteamID Not Found": "Could not find this SteamID: {0}.",
  "Player Not Found": "Could not find this player: {0}.",
  "Multiple Players Found": "Found multiple players!\n\n{0}",
  "PlaytimeTracker not Found": "PlaytimeTracker is not Loaded",
  "RegisterThread": "Thread '{0}' is Registered",
  "OverwriteThread": "Thread '{0}' is Overwritted",
  "UnregisterThread": "Thread '{0}' is UnRegistered",
  "RegisterThreadPlaytime": "Thread '{0}' is Registered Time Based On Playtime",
  "OverwriteThreadPlaytime": "Thread '{0}' is Overwritted Time Based On Playtime",
  "EffectAddedConsoleNotice": "Effect '{0}' is Added to {1}",
  "EffectOverwrittedConsoleNotice": "Effect '{0}' is Overwritted to {1}",
  "EffectRemovedConsoleNotice": "Effect '{0}' is Removed from {1}",
  "EffectAddedConsoleNoticeGroup": "Effect '{0}' is Added to {1} Group",
  "EffectOverwrittedConsoleNoticeGroup": "Effect '{0}' is Overwritted to {1} Group",
  "EffectRemovedConsoleNoticeGroup": "Effect '{0}' is Removed from {1} Group",
  "CantAddPlaytimeEffectToGroup": "Playtime-based effects cannot be added to the group",
  "Effect Is Not Exist On Player": "Effect '{0}' is not exist on player!",
  "Effect Is Not Exist On Group": "Effect '{0}' is not exist on group!",
  "Reseted PlayersData": "Players Data has been initialized",
  "Reseted GroupsData": "Groups Data has been initialized",
  "EffectAddedNotice": "Effect '{0}' is Added",
  "EffectOverwrittedNotice": "Effect '{0}' is Overwritted",
  "EffectRemovedNotice": "Effect '{0}' is Removed",
  "NotEnoughArgument": "to run this command you need {0} arguments, do /eps for more information.",
  "Invalid Parameter": "'{0}' is an invalid parameter, do /eps for more information.",
  "Effect Is Not Exist": "'{0}' is not exist effect.",
  "Permission Is Not Exist": "'{0}' is not exist permission.",
  "Permission Is Empty": "'{0}' Effect permission is Empty\nFail to Add Effect!",
  "GroupNotExist": "{0} is not Exist Group",
  "RegisteredDataList": "EPS Registered Threads\n\n{0}\n",
  "RegisteredPermList": "{0}",
  "RegisteredThreadList": "======================EffectThread\nThreadName : {0}\nHexThreadColor : {1}\nDisconnectAutoExpireTime : {2}\n-----------Permissions\n{3}\n\n",
  "RegisteredRtThreadList": "======================RealTImeEffectThread\nThreadName : {0}\nHexThreadColor : {1}\nDisconnectAutoExpireTime : {2}s\nEffectTime : {3}s\n-----------Permissions\n{4}\n\n",
  "RegisteredPtThreadList": "======================PlayTimeEffectThread\nThreadName : {0}\nHexThreadColor : {1}\nDisconnectAutoExpireTime : {2}s\nEffectTime : {3}s\n-----------Permissions\n{4}\n\n",
  "SingleThread": "{0} - {1}",
  "SinglePlaytimeThread": "{0} - {1} playtime",
  "PlayerThreads": "====================={0}\n{1}\n=======Contained In Group\n{2}\n",
  "PlayersThreadsHead": "Players EffectThreads\n",
  "PlayerThreadsHead": "{0}'s EffectThreads\n",
  "GroupsThreadsHead": "Groups EffectThreads\n",
  "GroupThreads": "====================={0}\n{1}\n",
  "Data Is Empty": "no data",
  "CommandHelp": "Permission Effects Commands\n\n---add effect to player/group\n/eps add <user/group> <playername/groupname> <effectthread>\n---remove effect from player/group\n/eps remove <user/group> <playername/groupname> <effectthread>\n---remove all effect from player/group\n/eps removeall <user/group> <playername/groupname>\n\n---reset players/groups thread data\n/eps reset <user/group/all>\n---register thread\n/eps thread add <threadname> <threadcolor> <permission1,permission2,...> <sec> <rt/pt> <DisconnExpireSec>\n---unregister thread\n/eps thread remove <threadname>\n\n---Check Registered Thread\n/eps rlist\n---Check Players Thread\n/eps plist\n---Check Groups Thread\n/eps glist\n---Check Player Thread\n/eps pt <player>\n---Check My Thread\n/effect"
}

Developer API

void API_AddEffectToPlayer(IPlayer player, string EffectThreadName)

void API_DeleteEffectFromPlayer(IPlayer player, string EffectThreadName)

void API_AddEffectToGroup(string GroupName, string EffectThreadName)

void API_DeleteEffectFromGroup(string GroupName, string EffectThreadName)

void API_DeleteAllEffectFromGroup(string GroupName)

void API_RegisterThread(int ThreadType, string ThreadName, string HexThreadColor, string[] Permissions, int AutoExpireTime, int EffectTime)
//ThreadType : 0 = Realtime based EffectThread, 1 = Playtime based EffectThread
//HexThreadColor : #000000 ~ ##FFFFFF, black, blue, clear, cyan, gray, green, magenta, red, white, yellow
//Permissions : Permissions to put in EffectThread
//AutoExpireTime : Determines if EffectThread will be revoke a few seconds after the user has not connected to the server(0 = Disable)
//EffectTime : Duration of EffectThread(0 = unlimited)

void API_UnRegisterThread(string ThreadName)

bool API_ThreadIsExist(string ThreadName)

bool API_PlayerHasEffect(string playerId, string effectThreadName)

TimeSpan? API_GetPlayerEffectLeftTime(IPlayer player, string effectThreadName)
//Returns null if no timelimit exists
MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.