Add fine grained permissions for Rei's Minimap's radar.

This merges pull request 4 (@slide23) in a slightly altered way, with
a little delay.
This commit is contained in:
asofold 2013-01-18 22:43:16 +01:00
parent f9b45921b1
commit 48c2d0ea53
3 changed files with 53 additions and 2 deletions

View File

@ -18,7 +18,11 @@ public class ModUtil {
* @param player
*/
public static void checkModsMessage(Player player) {
// TODO: Somebody test this all !
String message = "";
// TODO: add feature to check world specific (!).
// Check if we allow all the client mods.
final boolean allowAll = ConfigManager.getConfigFile().getBoolean(ConfPaths.MISCELLANEOUS_ALLOWCLIENTMODS);
@ -28,8 +32,35 @@ public class ModUtil {
message += "§0§0§1§e§f";
// Allow Rei's Minimap's radar.
if (allowAll || player.hasPermission(Permissions.REI_RADAR))
message += "§0§0§2§3§4§5§6§7§e§f";
if (allowAll || player.hasPermission(Permissions.REI_RADAR)){
// TODO: Does this allow all radar features?
message += "§0§0§2§3§4§5§6§7§e§f";
}
else{
// Allow Rei's Minimap's player radar
if (allowAll || player.hasPermission(Permissions.REI_RADAR_PLAYER))
message += "§0§0§2§e§f";
// Allow Rei's Minimap's animal radar
if (allowAll || player.hasPermission(Permissions.REI_RADAR_ANIMAL))
message += "§0§0§3§e§f";
// Allow Rei's Minimap's mob radar
if (allowAll || player.hasPermission(Permissions.REI_RADAR_MOB))
message += "§0§0§4§e§f";
// Allow Rei's Minimap's slime radar
if (allowAll || player.hasPermission(Permissions.REI_RADAR_SLIME))
message += "§0§0§5§e§f";
// Allow Rei's Minimap's squid radar
if (allowAll || player.hasPermission(Permissions.REI_RADAR_SQUID))
message += "§0§0§6§e§f";
// Allow Rei's Minimap's other radar
if (allowAll || player.hasPermission(Permissions.REI_RADAR_OTHER))
message += "§0§0§7§e§f";
}
// If all the client mods are allowed, no need to go any further.
if (allowAll) {

View File

@ -204,6 +204,13 @@ public class Permissions {
private static final String REI = MODS + ".rei";
public static final String REI_CAVE = REI + ".cave";
public static final String REI_RADAR = REI + ".radar";
public static final String REI_RADAR_PLAYER = REI_RADAR + ".player";
public static final String REI_RADAR_ANIMAL = REI_RADAR + ".animal";
public static final String REI_RADAR_MOB = REI_RADAR + ".mob";
public static final String REI_RADAR_SLIME = REI_RADAR + ".slime";
public static final String REI_RADAR_SQUID = REI_RADAR + ".squid";
public static final String REI_RADAR_OTHER = REI_RADAR + ".other";
private static final String SMARTMOVING = MODS + ".smartmoving";
public static final String SMARTMOVING_CLIMBING = SMARTMOVING + ".climbing";

View File

@ -230,6 +230,19 @@ permissions:
description: Allow the player to use Rei's Minimap cave mode.
nocheatplus.mods.rei.radar:
description: Allow the player to use Rei's Minimap radar.
children:
nocheatplus.mods.rei.radar.player:
description: Allow the player to use Rei's Minimap player radar
nocheatplus.mods.rei.radar.animal:
description: Allow the player to use Rei's Minimap animal radar
nocheatplus.mods.rei.radar.mob:
description: Allow the player to use Rei's Minimap mob radar
nocheatplus.mods.rei.radar.slime:
description: Allow the player to use Rei's Minimap slime radar
nocheatplus.mods.rei.radar.squid:
description: Allow the player to use Rei's Minimap squid radar
nocheatplus.mods.rei.radar.other:
description: Allow the player to use Rei's Minimap other radar
nocheatplus.mods.smartmoving:
description: Allow the player to use the Smart Moving mod.
children: