Compare commits

...

4 commits
1.1 ... master

Author SHA1 Message Date
SloudPL
1b0e13849e Update 1.2
Fixed bugs
Added permissions to write color messages in chat
2025-06-23 21:08:41 +02:00
SloudPL
d6b371bed0 Small fix 2025-06-20 13:30:43 +02:00
SloudPL
6ef79d3353 Small fix 2025-06-20 12:14:31 +02:00
SloudPL
11ce126347 Small fix 2025-06-19 22:01:15 +02:00
5 changed files with 29 additions and 7 deletions
README.mdpom.xml
src/main
java/pl/sloudpl/sloudchat/events
resources

View file

@ -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

View file

@ -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>

View file

@ -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("%", "%%"));

View file

@ -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("%", "%%"));
} }

View file

@ -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