-
Notifications
You must be signed in to change notification settings - Fork 65
Bans
Negativity has its own ban subsystem, it is flexible and can be used in two ways:
- manually, with commands
- automatically, by banning a player when they have too many warns
On v1, This subsystem is only used by Spigot and Sponge plugins, the proxy plugins do not use it.
The ban subsystem configuration is located in the main config file (config.yml
or config.conf
) or in bans.yml
for v2, and is quite simple:
-
active
: the main 'switch' of the subsystem, iftrue
ban-related commands of the plugins can be used and players may be banned automatically for cheating (if they fulfill configurable conditions). Defaults tofalse
-
processor
: the ID of the processor to use. Processors are used to execute and fetch bans. Defaults tofile
-
auto
: enable the automatic ban feature. Defaults tofalse
-
time.calculator
: a JavaScript code snippet to compute the duration of a ban. It supports the following placeholders:-
%reliability%
: the reliability of the alert triggering the ban -
%alert%
: the number of alerts for the cheat of the alert -
%all_alert%
: all alerts for the detected cheat since you added Negativity on your server
-
-
reliability_need
: the minimum reliability of the alert needed to ban a player. Defaults to95
-
alert_need
: the number of alerts for the same cheat required before trying banning the player. Defaults to10
-
def.time
: the number of bans for a player before banning him definitely. Defaults to2
You can override the global configuration for each cheat. To do it, go in the cheat config file such as xray.yml
, then add:
ban:
reliability_need: 95
some: "else"
Actually, this is all possible keys which can be overrided :
-
active
: Disable ban for this cheat only -
time.calculator
: Work exactly as described before. -
reliability_need
: Defaults to95
-
alert_need
: Defaults to10
-
def.time
: Defaults to2
If a player have been banned, you can prevent alt/multiples accounts.
To add an action, you have to create new section on alt
part of ban config.
The key have to be the number of account needed to show. For example, if you set 3, the third account to log in will run the action.
You don't have to set all account number. If you set only 2, and player have 3 accounts, it will run the action of 2 (near lower account).
If you set 1
, it will be showed for all account.
Available actions :
-
alert
: send message to alt account -
alert_mod
: send message to all mod (= ShowAlert permission) -
ban
: Automatically ban alt account -
ban_all
: Ban all alt (just logged and all other previous). Warn: this is not available with all bans processor.
You have to set the sent message by using message: "My message"
.
For message, it's used for direct send (not translated, just colored).
For ban, it's used as reason.
About ban, you can set if it's definitive with def: true
, or set the time thanks to time: 1000
(here, ban 1 second).
You also can set conditions to run the action. To do it, use :
condition:
warning: 1
Now, there is only a check of amount of warn.
Finally, this is an example :
4:
action: ban
message: "Alt unauthorized"
# the time of the ban in milliseconds.
# set '-1' or "def: true" for definitive ban
time: 360000
# condition to be banned
# Get Warn and Violation from ALL account
condition:
# Need at least 30 warn
warning: 30
In /negativity <player>
menu, there is an anvil which enable mod to ban (need permission to do /nban).
This inventory is a shortcut to nban command, which default configuration.
For example, if you want to ban player for Insult 2h, you just have to configure an item in this inventory and not have to write the full command.
To configure it, there is a "sanctions" section.
Example:
# The key is not specially used
cheat:
# the name is used as item's name and also as the reason
name: "&4Cheat"
# the material of item in inventory
material: RED_BANNER
# the slot in the inventory
slot: 1
# Message sent to player who ban other
message: "&6%name% &ahave been banned for %reason%"
# The command which have to be done (Command used by console, so it have to be enabled for it)
command: "nban %name% 30d Cheat."
# (optional) the permission to see and use this item.
# If is empty, it will be available for everyone which can access to this inventory
permission: "negativity.sanction.cheat"
If you want to see different item according to permission, you can set multiple item at the same slot. There will be only the last item which is permitted for the player.
Like each processor have own working system, some of them don't have some features.
The "BanAll" indicator, show you if the processor is compatible with alt ban system.
ID: file
Platform: All.
BanAll: Not yet.
Stores bans on the local filesystem. Useful if you only have one server.
Its configuration is located in the main config file, under ban.file
:
-
log_bans
: whether old bans (expired or manually revoked) should be kept. Defaults totrue
.
ID: database
Platform: All.
BanAll: Yes.
Stores bans in a database. Requires a valid database configuration.
Its configuration is located in the main config file, under ban.database
:
-
log_bans
: whether old bans (expired or manually revoked) should be kept. Defaults totrue
.
ID: command
Platform: All.
BanAll: Unknow.
Executes bans via custom commands. Since this one only uses commands it does not support logged bans.
Its configuration is in the main config file, under ban.command
:
-
ban
is the list of command to execute when executing bans -
unban
is the same thanban
, but for revoking bans
Both lists must contain strings, the order of the commands is respected.
Each command can contain the following placeholders:
-
%uuid%
: the UUID of the player -
%name%
: the name of the player -
%ip%
: the IP address of the player -
%reason%
: the reason of the ban -
%alert%
: the number of alerts for the detected cheat that triggered the ban -
%all_alert%
: all alerts for the detected cheat since you added Negativity on your server -
%life%
: the health of the player at the moment the command is executed -
%level%
: the level of the player -
%gm%
: the gamemode of the player -
%walk_speed%
: the speed at which the player should walk
ID: bukkit
Platform: Spigot.
BanAll: No.
Uses Bukkit's ban system (which by extension is vanilla's one).
ID: maxbans
Platform: Spigot.
BanAll: Yes.
Uses MaxBans.
ID: advancedban
Platform: Spigot & Bungeecord.
BanAll: No.
Uses AdvancedBan.
ID: litebans
Platform: Spigot & Bungeecord.
BanAll: Yes.
Uses LiteBans.
ID: dkbans
Platform: Spigot & Bungeecord.
BanAll: Yes.
Uses DkBans.
ID: professionalbans
Platform: Spigot & Bungeecord.
BanAll: Yes.
ID: ultrapunishments
Platform: Spigot.
BanAll: Yes.
Uses ProfessionalBans.
ID: sponge
Platform: Sponge.
BanAll: No.
Uses Sponge's BanService (which delegates to the vanilla system by default). Ban plugins usually provide their own service implementation.
However, it has the drawback of not supporting logged bans.
You can use command processor if you don't have lot of time.
To make your own, follow those steps :
- Create your own ban processor.
It should implement com.elikill58.negativity.universal.ban.processor.BanProcessor
's java interface.
- Register this processor into Negativity :
BanProcessor myProcess = ...;
BanManager.registerProcessor("myprocessor", myProcess);
- In config, change
processor: "file"
pourprocessor: "myprocessor"
.
("myprocessor" is what you wrote as plugin ID in registerProcessor
)
Welcome to Negativity's wiki !