ChatNotifier: gave up on highlights
This commit is contained in:
parent
094f354086
commit
2774ac7ab1
@ -4,6 +4,7 @@ import org.bukkit.Bukkit;
|
|||||||
import org.bukkit.Sound;
|
import org.bukkit.Sound;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
|
import org.bukkit.event.EventPriority;
|
||||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||||
|
|
||||||
import com.connorlinfoot.bountifulapi.BountifulAPI;
|
import com.connorlinfoot.bountifulapi.BountifulAPI;
|
||||||
@ -12,18 +13,19 @@ import cz.marwland.mc.core.features.Feature;
|
|||||||
import net.md_5.bungee.api.ChatColor;
|
import net.md_5.bungee.api.ChatColor;
|
||||||
|
|
||||||
public class ChatNotifier extends Feature {
|
public class ChatNotifier extends Feature {
|
||||||
|
|
||||||
|
// TODO: Per-player highlighting
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerChat(AsyncPlayerChatEvent e) {
|
public void onPlayerChat(AsyncPlayerChatEvent e) {
|
||||||
for (Player p : Bukkit.getServer().getOnlinePlayers()) {
|
for (Player p : Bukkit.getServer().getOnlinePlayers()) {
|
||||||
String msg = e.getMessage();
|
String msg = e.getMessage();
|
||||||
if (e.getMessage().toLowerCase().contains(p.getName().toLowerCase()) && p.getPlayer() != e.getPlayer()) {
|
if (msg.toLowerCase().contains(p.getName().toLowerCase()) && p.getPlayer() != e.getPlayer()) {
|
||||||
e.getRecipients().remove(p);
|
/*e.getRecipients().remove(p);
|
||||||
msg = ChatColor.RED + msg;
|
msg = ChatColor.RED + msg;*/
|
||||||
BountifulAPI.sendActionBar(p, ChatColor.RED + "Byl jsi zminen v chatu!");
|
BountifulAPI.sendActionBar(p, ChatColor.RED + "Byl jsi zminen v chatu!");
|
||||||
p.playSound(p.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1.0F, 3.0F);
|
p.playSound(p.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1.0F, 3.0F);
|
||||||
}
|
}
|
||||||
p.sendMessage(String.format(e.getFormat(), e.getPlayer().getDisplayName(), msg));
|
//p.sendMessage(String.format(e.getFormat(), e.getPlayer().getDisplayName(), msg));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user