mirror of
https://github.com/essentials/Essentials.git
synced 2025-08-13 18:14:38 +02:00
Sneaking in an option to disable prefix/suffix selectively.
(This will probably be removed during ess chat rewrite).
This commit is contained in:
@@ -124,6 +124,10 @@ public interface ISettings extends IConf
|
|||||||
boolean useBukkitPermissions();
|
boolean useBukkitPermissions();
|
||||||
|
|
||||||
boolean addPrefixSuffix();
|
boolean addPrefixSuffix();
|
||||||
|
|
||||||
|
boolean disablePrefix();
|
||||||
|
|
||||||
|
boolean disableSuffix();
|
||||||
|
|
||||||
boolean isUpdateEnabled();
|
boolean isUpdateEnabled();
|
||||||
|
|
||||||
|
@@ -498,6 +498,16 @@ public class Settings implements ISettings
|
|||||||
{
|
{
|
||||||
return config.getBoolean("add-prefix-suffix", ess.getServer().getPluginManager().isPluginEnabled("EssentialsChat"));
|
return config.getBoolean("add-prefix-suffix", ess.getServer().getPluginManager().isPluginEnabled("EssentialsChat"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean disablePrefix()
|
||||||
|
{
|
||||||
|
return config.getBoolean("disablePrefix", false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean disableSuffix()
|
||||||
|
{
|
||||||
|
return config.getBoolean("disableSuffix", false);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isUpdateEnabled()
|
public boolean isUpdateEnabled()
|
||||||
|
@@ -269,12 +269,22 @@ public class User extends UserData implements Comparable<User>, IReplyTo, IUser
|
|||||||
|
|
||||||
if (ess.getSettings().addPrefixSuffix())
|
if (ess.getSettings().addPrefixSuffix())
|
||||||
{
|
{
|
||||||
final String prefix = ess.getPermissionsHandler().getPrefix(base).replace('&', '§').replace("{WORLDNAME}", this.getWorld().getName());
|
|
||||||
final String suffix = ess.getPermissionsHandler().getSuffix(base).replace('&', '§').replace("{WORLDNAME}", this.getWorld().getName());
|
|
||||||
|
|
||||||
nickname.insert(0, prefix);
|
if (!ess.getSettings().disablePrefix())
|
||||||
nickname.append(suffix);
|
{
|
||||||
if (suffix.length() < 2 || !suffix.substring(suffix.length() - 2, suffix.length() - 1).equals("§"))
|
final String prefix = ess.getPermissionsHandler().getPrefix(base).replace('&', '§').replace("{WORLDNAME}", this.getWorld().getName());
|
||||||
|
nickname.insert(0, prefix);
|
||||||
|
}
|
||||||
|
if (!ess.getSettings().disableSuffix())
|
||||||
|
{
|
||||||
|
final String suffix = ess.getPermissionsHandler().getSuffix(base).replace('&', '§').replace("{WORLDNAME}", this.getWorld().getName());
|
||||||
|
nickname.append(suffix);
|
||||||
|
if (suffix.length() < 2 || !suffix.substring(suffix.length() - 2, suffix.length() - 1).equals("§"))
|
||||||
|
{
|
||||||
|
nickname.append("§f");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
nickname.append("§f");
|
nickname.append("§f");
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user