mirror of
https://github.com/Multiverse/Multiverse-Core.git
synced 2025-01-06 00:08:04 +01:00
added config option to change the format for prefixchat
This commit is contained in:
parent
4a66a2f5bb
commit
ad6f0d1b62
@ -42,6 +42,8 @@ public class MultiverseCoreConfiguration extends SerializationConfig implements
|
||||
@Property
|
||||
private volatile boolean prefixchat;
|
||||
@Property
|
||||
private volatile String prefixchatformat;
|
||||
@Property
|
||||
private volatile boolean useasyncchat;
|
||||
@Property
|
||||
private volatile boolean teleportintercept;
|
||||
@ -85,6 +87,7 @@ public class MultiverseCoreConfiguration extends SerializationConfig implements
|
||||
enforceaccess = false;
|
||||
useasyncchat = true;
|
||||
prefixchat = true;
|
||||
prefixchatformat = "[%world%]%chat%";
|
||||
teleportintercept = true;
|
||||
firstspawnoverride = true;
|
||||
displaypermerrors = true;
|
||||
@ -143,6 +146,22 @@ public class MultiverseCoreConfiguration extends SerializationConfig implements
|
||||
public void setPrefixChat(boolean prefixChat) {
|
||||
this.prefixchat = prefixChat;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public String getPrefixChatFormat() {
|
||||
return this.prefixchatformat;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Override
|
||||
public void setPrefixChatFormat(String prefixChatFormat) {
|
||||
this.prefixchatformat = prefixChatFormat;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
|
@ -121,6 +121,18 @@ public interface MultiverseCoreConfig extends ConfigurationSerializable {
|
||||
* @return prefixChat.
|
||||
*/
|
||||
boolean getPrefixChat();
|
||||
|
||||
/**
|
||||
* Sets prefixChatFormat.
|
||||
* @param prefixChatFormat The new value.
|
||||
*/
|
||||
void setPrefixChatFormat(String prefixChatFormat);
|
||||
|
||||
/**
|
||||
* Gets prefixChatFormat.
|
||||
* @return prefixChatFormat.
|
||||
*/
|
||||
String getPrefixChatFormat();
|
||||
|
||||
/**
|
||||
* Sets enforceAccess.
|
||||
|
@ -66,6 +66,7 @@ public class VersionCommand extends MultiverseCommand {
|
||||
buffer.append("[Multiverse-Core] messagecooldown: ").append(plugin.getMessaging().getCooldown()).append('\n');
|
||||
buffer.append("[Multiverse-Core] teleportcooldown: ").append(plugin.getMVConfig().getTeleportCooldown()).append('\n');
|
||||
buffer.append("[Multiverse-Core] worldnameprefix: ").append(plugin.getMVConfig().getPrefixChat()).append('\n');
|
||||
buffer.append("[Multiverse-Core] worldnameprefixFormat: ").append(plugin.getMVConfig().getPrefixChatFormat()).append('\n');
|
||||
buffer.append("[Multiverse-Core] enforceaccess: ").append(plugin.getMVConfig().getEnforceAccess()).append('\n');
|
||||
buffer.append("[Multiverse-Core] displaypermerrors: ").append(plugin.getMVConfig().getDisplayPermErrors()).append('\n');
|
||||
buffer.append("[Multiverse-Core] teleportintercept: ").append(plugin.getMVConfig().getTeleportIntercept()).append('\n');
|
||||
|
@ -3,6 +3,8 @@ package com.onarandombox.MultiverseCore.listeners;
|
||||
import com.onarandombox.MultiverseCore.MultiverseCore;
|
||||
import com.onarandombox.MultiverseCore.api.MVWorldManager;
|
||||
import com.onarandombox.MultiverseCore.api.MultiverseWorld;
|
||||
|
||||
import org.bukkit.ChatColor;
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
/**
|
||||
@ -45,8 +47,13 @@ public abstract class MVChatListener implements Listener {
|
||||
return;
|
||||
}
|
||||
prefix = mvworld.getColoredWorldString();
|
||||
String format = event.getFormat();
|
||||
event.setFormat("[" + prefix + "]" + format);
|
||||
String chat = event.getFormat();
|
||||
|
||||
String prefixChatFormat = plugin.getMVConfig().getPrefixChatFormat();
|
||||
prefixChatFormat = prefixChatFormat.replace("%world%", prefix).replace("%chat%", chat);
|
||||
prefixChatFormat = ChatColor.translateAlternateColorCodes('&', prefixChatFormat);
|
||||
|
||||
event.setFormat(prefixChatFormat);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user