Release AdminPlugin
#1
Idea:
Plugins using commands which depend on admin checks, currently don't have many options on working with admin functionality.
The Idea was to give Plugin developers more freedom on using admins by simplyfying that and extending the abilitys of the addon.dll.

General Features:
- Classes which derive from AdminPlugin get all features from the addon + the additional admin features
- seperated admin.cfg (autogenerated with admin-examples if the admin.cfg is missing)

Command Features:
- !admins (list the names of all admins)
- !addadmin <name> <xuid> (simply add a admin)
- !reloadadmins (if you edit the admin.cfg file while the server is still running, you can call this command to update the admin table)

Classes:
- ServerAdmin (Class which holds information of an admin, similar to ServerClient)
- Admin (Main Class holding the AdminPlugin Features)

ServerAdmin Functions:
- allowedToUse(command) Check if the admin is allowed to use the command
- isImmuneToCmd(command) Check if the admin is immun against the command

Admin Functions:
- LoadAdmins() loads the admin.cfg and initializes all admins
- GetAdmins() returns a list of ServerAdmins representing the admins defined in the admin.cfg
- GetAdminFromClient(ServerClient) returns the Admin-Information of the Client
- AddAdmin(name, xuid) add a new admin (which is also added in the admin.cfg)
- isAdmin(ServerClient) check if the client is a admin
- OnSayAfterAP(Message, ServerClient) this overrideable function is called after the AdminPlugin checked for admin related commands
- The OnSay Function is sealed inside the AdminPlugin to ensure that derived classes don't get the event before the AdminPlugin

Because i limit the usage of the AdminPlugin for derived classes only and sealing the OnSay Function, i ensure that AdminPlugin comes first regardless of the Plugin-Names.

Additional Information:
- the admin.cfg file is saved under admin\admin.cfg
- just make a derived project, start the server and run loadAdmins() to generate the default admin.cfg

Changelog:
- v0.1.1 Beta | initial release

Requirements:
- @Nukem's Server Addon v1.190+

Usage:
To Use the AdminPlugin, you have to set it as a reference in your Project.
This is a simple Example how to use my Plugin:
Code:
using System; using System.Collections.Generic; using System.Text; using AdminPlugin; using Addon; namespace TestPlugin { //Since the AdminPlugin derives from CPlugin, //you only have to derive from AdminPlugin.Admin to call functions from both classes public class Test : Admin { public override void OnServerLoad() { //Load the admin.cfg and initialize all admins LoadAdmins(); ServerPrint("TestPlugin loaded."); } //This Function is called AFTER AdminPlugin checked the message for admin related commands public override ChatType OnSayAfterAP(string Message, ServerClient Client) { //Check if the Message starts with an command and check if the client is a admin if (Message.StartsWith("!") && isAdmin(Client)) { //Get the ServerAdmin object representing the admin ServerAdmin admin = GetAdminFromClient(Client); //Simply check if the admin is allowed to use the command if (admin.allowedToUse(Message.Split(' ')[0])) { TellClient(Client.ClientNum, "You are allowed to use this command.",true); } else { TellClient(Client.ClientNum, "You are not allowed to use this command.", true); } return ChatType.ChatNone; } else return ChatType.ChatContinue; } } }


Attached Files
.rar   AdminPlugin.rar (Size: 4.15 KB / Downloads: 1,025)
Reply

#2
You need someone to test it?

Edit:That sounded stupid
Reply

#3
sorry but i dont think this is very needed because there are already 2 of them
Reply

#4
not bad
Reply

#5
(01-21-2012, 12:21)slipknotignacio Wrote: sorry but i dont think this is very needed because there are already 2 of them

2 of what exactly? ^^
Reply

#6
This plugin is not working.
Reply

#7
(03-22-2012, 13:11)dthem_2000 Wrote: This plugin is not working.

You may be right about that. I don't know if this version still works since the last updates, but i didn't intend to update this Plugin because nobody seems to use it (even though its been downloaded more than 90 times).

If someone really wants to use this Plugin then he/they should ask for an update.
I won't put effort in something that isn't wanted/needed.

And just in case you or someone else didn't really understand:
Keep in mind that this Plugins purpose is for working with other Plugins and not to run on its own.
Reply

#8
how to install these ?? i m a noob in this . beginner..
Reply

#9
(03-22-2012, 19:31)Deviler86 Wrote: You may be right about that. I don't know if this version still works since the last updates, but i didn't intend to update this Plugin because nobody seems to use it (even though its been downloaded more than 90 times).

If someone really wants to use this Plugin then he/they should ask for an update.
I won't put effort in something that isn't wanted/needed.

And just in case you or someone else didn't really understand:
Keep in mind that this Plugins purpose is for working with other Plugins and not to run on its own.

Man, does it works on tekno server?
I'm going to try it on my tekno server, i think it's useful plugin.
Reply

#10
(01-21-2012, 06:39)Deviler86 Wrote: Idea:
Plugins using commands which depend on admin checks, currently don't have many options on working with admin functionality.
The Idea was to give Plugin developers more freedom on using admins by simplyfying that and extending the abilitys of the addon.dll.

General Features:
- Classes which derive from AdminPlugin get all features from the addon + the additional admin features
- seperated admin.cfg (autogenerated with admin-examples if the admin.cfg is missing)

Command Features:
- !admins (list the names of all admins)
- !addadmin <name> <xuid> (simply add a admin)
- !reloadadmins (if you edit the admin.cfg file while the server is still running, you can call this command to update the admin table)

Classes:
- ServerAdmin (Class which holds information of an admin, similar to ServerClient)
- Admin (Main Class holding the AdminPlugin Features)

ServerAdmin Functions:
- allowedToUse(command) Check if the admin is allowed to use the command
- isImmuneToCmd(command) Check if the admin is immun against the command

Admin Functions:
- LoadAdmins() loads the admin.cfg and initializes all admins
- GetAdmins() returns a list of ServerAdmins representing the admins defined in the admin.cfg
- GetAdminFromClient(ServerClient) returns the Admin-Information of the Client
- AddAdmin(name, xuid) add a new admin (which is also added in the admin.cfg)
- isAdmin(ServerClient) check if the client is a admin
- OnSayAfterAP(Message, ServerClient) this overrideable function is called after the AdminPlugin checked for admin related commands
- The OnSay Function is sealed inside the AdminPlugin to ensure that derived classes don't get the event before the AdminPlugin

Because i limit the usage of the AdminPlugin for derived classes only and sealing the OnSay Function, i ensure that AdminPlugin comes first regardless of the Plugin-Names.

Additional Information:
- the admin.cfg file is saved under admin\admin.cfg
- just make a derived project, start the server and run loadAdmins() to generate the default admin.cfg

Changelog:
- v0.1.1 Beta | initial release

Requirements:
- @Nukem's Server Addon v1.190+

Usage:
To Use the AdminPlugin, you have to set it as a reference in your Project.
This is a simple Example how to use my Plugin:
Code:
using System; using System.Collections.Generic; using System.Text; using AdminPlugin; using Addon; namespace TestPlugin { //Since the AdminPlugin derives from CPlugin, //you only have to derive from AdminPlugin.Admin to call functions from both classes public class Test : Admin { public override void OnServerLoad() { //Load the admin.cfg and initialize all admins LoadAdmins(); ServerPrint("TestPlugin loaded."); } //This Function is called AFTER AdminPlugin checked the message for admin related commands public override ChatType OnSayAfterAP(string Message, ServerClient Client) { //Check if the Message starts with an command and check if the client is a admin if (Message.StartsWith("!") && isAdmin(Client)) { //Get the ServerAdmin object representing the admin ServerAdmin admin = GetAdminFromClient(Client); //Simply check if the admin is allowed to use the command if (admin.allowedToUse(Message.Split(' ')[0])) { TellClient(Client.ClientNum, "You are allowed to use this command.",true); } else { TellClient(Client.ClientNum, "You are not allowed to use this command.", true); } return ChatType.ChatNone; } else return ChatType.ChatContinue; } } }

I dont have admin.cfg in my admin folder, ill make admin.cfg and what text should i add in admin.cfg?
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

Forum Powered By MyBB, Theme by © 2002-2026 Melroy van den Berg.