Compare commits
4 commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
1b0e13849e | ||
![]() |
d6b371bed0 | ||
![]() |
6ef79d3353 | ||
![]() |
11ce126347 |
5 changed files with 29 additions and 7 deletions
|
@ -11,3 +11,5 @@ Permissions:
|
||||||
/chat [on/off/clear] - sloudpl.chat
|
/chat [on/off/clear] - sloudpl.chat
|
||||||
|
|
||||||
Bypass chat off - sloudpl.chat.bypass
|
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>
|
<groupId>pl.sloudpl</groupId>
|
||||||
<artifactId>SloudChat</artifactId>
|
<artifactId>SloudChat</artifactId>
|
||||||
<version>1.1</version>
|
<version>1.2</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>SloudChat</name>
|
<name>SloudChat</name>
|
||||||
|
|
|
@ -21,6 +21,10 @@ public class onPlayerChat implements Listener {
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void PlayerChat(AsyncPlayerChatEvent event){
|
public void PlayerChat(AsyncPlayerChatEvent event){
|
||||||
|
|
||||||
|
if(event.isCancelled()){
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Player player = event.getPlayer();
|
Player player = event.getPlayer();
|
||||||
|
|
||||||
if(!plugin.isChatEnabled && !player.hasPermission("sloudpl.chat.bypass")){
|
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!");
|
plugin.getLogger().warning("Chat format contains PlaceholderAPI variables but PlaceholderAPI is not installed!");
|
||||||
}
|
}
|
||||||
|
|
||||||
format = format.replace("{MESSAGE}", message);
|
if(player.hasPermission("sloudchat.colors")){
|
||||||
|
|
||||||
format = ChatColor.translateAlternateColorCodes('&', format);
|
format = format.replace("{MESSAGE}", message);
|
||||||
|
format = ChatColor.translateAlternateColorCodes('&', format);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
format = ChatColor.translateAlternateColorCodes('&', format);
|
||||||
|
format = format.replace("{MESSAGE}", message);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
event.setFormat(format.replace("%", "%%"));
|
event.setFormat(format.replace("%", "%%"));
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ public class onPlayerChat1_16 implements Listener {
|
||||||
|
|
||||||
if(!plugin.isChatEnabled && !player.hasPermission("sloudpl.chat.bypass")){
|
if(!plugin.isChatEnabled && !player.hasPermission("sloudpl.chat.bypass")){
|
||||||
|
|
||||||
player.sendMessage(ChatColor.translateAlternateColorCodes('&', plugin.getConfig().getString("disabled-chat-msg")));
|
player.sendMessage(ColorUtils.convertHexColors(ChatColor.translateAlternateColorCodes('&', plugin.getConfig().getString("disabled-chat-msg"))));
|
||||||
event.setCancelled(true);
|
event.setCancelled(true);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -71,9 +71,17 @@ public class onPlayerChat1_16 implements Listener {
|
||||||
plugin.getLogger().warning("Chat format contains PlaceholderAPI variables but PlaceholderAPI is not installed!");
|
plugin.getLogger().warning("Chat format contains PlaceholderAPI variables but PlaceholderAPI is not installed!");
|
||||||
}
|
}
|
||||||
|
|
||||||
format = format.replace("{MESSAGE}", message);
|
if(player.hasPermission("sloudchat.colors")){
|
||||||
|
|
||||||
format = ColorUtils.convertHexColors(ChatColor.translateAlternateColorCodes('&', format));
|
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("%", "%%"));
|
event.setFormat(format.replace("%", "%%"));
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ name: SloudChat
|
||||||
version: '${project.version}'
|
version: '${project.version}'
|
||||||
main: pl.sloudpl.sloudchat.SloudChat
|
main: pl.sloudpl.sloudchat.SloudChat
|
||||||
authors: [SloudPL]
|
authors: [SloudPL]
|
||||||
api-version: '1.18'
|
api-version: '1.13'
|
||||||
softdepend:
|
softdepend:
|
||||||
- LuckPerms
|
- LuckPerms
|
||||||
- PlaceholderAPI
|
- PlaceholderAPI
|
||||||
|
|
Loading…
Add table
Reference in a new issue