Moved features to separate projects
This commit is contained in:
31
ChatNotifier/src/cz/marwland/mc/features/ChatNotifier.java
Normal file
31
ChatNotifier/src/cz/marwland/mc/features/ChatNotifier.java
Normal file
@ -0,0 +1,31 @@
|
||||
package cz.marwland.mc.features;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Sound;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.player.AsyncPlayerChatEvent;
|
||||
|
||||
import com.connorlinfoot.bountifulapi.BountifulAPI;
|
||||
|
||||
import cz.marwland.mc.core.features.Feature;
|
||||
import net.md_5.bungee.api.ChatColor;
|
||||
|
||||
public class ChatNotifier extends Feature {
|
||||
|
||||
// TODO: Per-player highlighting
|
||||
@EventHandler
|
||||
public void onPlayerChat(AsyncPlayerChatEvent e) {
|
||||
for (Player p : Bukkit.getServer().getOnlinePlayers()) {
|
||||
String msg = e.getMessage();
|
||||
if (msg.toLowerCase().contains(p.getName().toLowerCase()) && p.getPlayer() != e.getPlayer()) {
|
||||
/*e.getRecipients().remove(p);
|
||||
msg = ChatColor.RED + msg;*/
|
||||
BountifulAPI.sendActionBar(p, ChatColor.RED + "Byl jsi zminen v chatu!");
|
||||
p.playSound(p.getLocation(), Sound.ENTITY_EXPERIENCE_ORB_PICKUP, 1.0F, 3.0F);
|
||||
}
|
||||
//p.sendMessage(String.format(e.getFormat(), e.getPlayer().getDisplayName(), msg));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user