Update 1.2
Fixed bugs Added permissions to write color messages in chat
This commit is contained in:
parent
d6b371bed0
commit
1b0e13849e
4 changed files with 27 additions and 5 deletions
|
@ -11,3 +11,5 @@ Permissions:
|
|||
/chat [on/off/clear] - sloudpl.chat
|
||||
|
||||
Bypass chat off - sloudpl.chat.bypass
|
||||
|
||||
To write in chat with color - sloudchat.colors
|
2
pom.xml
2
pom.xml
|
@ -6,7 +6,7 @@
|
|||
|
||||
<groupId>pl.sloudpl</groupId>
|
||||
<artifactId>SloudChat</artifactId>
|
||||
<version>1.1</version>
|
||||
<version>1.2</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>SloudChat</name>
|
||||
|
|
|
@ -21,6 +21,10 @@ public class onPlayerChat implements Listener {
|
|||
@EventHandler
|
||||
public void PlayerChat(AsyncPlayerChatEvent event){
|
||||
|
||||
if(event.isCancelled()){
|
||||
return;
|
||||
}
|
||||
|
||||
Player player = event.getPlayer();
|
||||
|
||||
if(!plugin.isChatEnabled && !player.hasPermission("sloudpl.chat.bypass")){
|
||||
|
@ -69,9 +73,17 @@ public class onPlayerChat implements Listener {
|
|||
plugin.getLogger().warning("Chat format contains PlaceholderAPI variables but PlaceholderAPI is not installed!");
|
||||
}
|
||||
|
||||
if(player.hasPermission("sloudchat.colors")){
|
||||
|
||||
format = format.replace("{MESSAGE}", message);
|
||||
format = ChatColor.translateAlternateColorCodes('&', format);
|
||||
|
||||
} else {
|
||||
|
||||
format = ChatColor.translateAlternateColorCodes('&', format);
|
||||
format = format.replace("{MESSAGE}", message);
|
||||
|
||||
}
|
||||
|
||||
event.setFormat(format.replace("%", "%%"));
|
||||
|
||||
|
|
|
@ -71,9 +71,17 @@ public class onPlayerChat1_16 implements Listener {
|
|||
plugin.getLogger().warning("Chat format contains PlaceholderAPI variables but PlaceholderAPI is not installed!");
|
||||
}
|
||||
|
||||
if(player.hasPermission("sloudchat.colors")){
|
||||
|
||||
format = format.replace("{MESSAGE}", message);
|
||||
format = ColorUtils.convertHexColors(ChatColor.translateAlternateColorCodes('&', format));
|
||||
|
||||
} else {
|
||||
|
||||
format = ColorUtils.convertHexColors(ChatColor.translateAlternateColorCodes('&', format));
|
||||
format = format.replace("{MESSAGE}", message);
|
||||
|
||||
}
|
||||
|
||||
event.setFormat(format.replace("%", "%%"));
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue