Separate config setting for prefix/suffix

This commit is contained in:
snowleo 2011-07-23 01:43:02 +02:00
parent a20f2b71da
commit 3cedfeef2c
4 changed files with 22 additions and 7 deletions

View File

@ -130,4 +130,6 @@ public interface ISettings extends IConf
boolean isPlayerCommand(String string);
public boolean useBukkitPermissions();
public boolean addPrefixSuffix();
}

View File

@ -468,4 +468,9 @@ public class Settings implements ISettings
{
return config.getBoolean("use-bukkit-permissions", false);
}
public boolean addPrefixSuffix()
{
return config.getBoolean("add-prefix-suffix", false);
}
}

View File

@ -246,14 +246,17 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
}
}
final String prefix = ess.getPermissionsHandler().getPrefix(this).replace('&', '§').replace("{WORLDNAME}", this.getWorld().getName());
final String suffix = ess.getPermissionsHandler().getSuffix(this).replace('&', '§').replace("{WORLDNAME}", this.getWorld().getName());
nickname.insert(0, prefix);
nickname.append(suffix);
if (suffix.length() < 2 || !suffix.substring(suffix.length() - 2, suffix.length() - 1).equals("§"))
if (ess.getSettings().addPrefixSuffix())
{
nickname.append("§f");
final String prefix = ess.getPermissionsHandler().getPrefix(this).replace('&', '§').replace("{WORLDNAME}", this.getWorld().getName());
final String suffix = ess.getPermissionsHandler().getSuffix(this).replace('&', '§').replace("{WORLDNAME}", this.getWorld().getName());
nickname.insert(0, prefix);
nickname.append(suffix);
if (suffix.length() < 2 || !suffix.substring(suffix.length() - 2, suffix.length() - 1).equals("§"))
{
nickname.append("§f");
}
}
return nickname.toString();

View File

@ -37,6 +37,11 @@ nickname-prefix: '~'
# Disable this if you have any other plugin, that modifies the displayname of a user.
change-displayname: true
# Adds the prefix and suffix to the displayname of the player, so it will be displayed in messages and lists.
# The prefix/suffix can be set using Permissions, Group Manager or PermissionsEx.
# The value of change-displayname (above) has to be true.
add-prefix-suffix: false
# The delay, in seconds, required between /home, /tp, etc.
teleport-cooldown: 0