本文整理汇总了Java中com.dthielke.herochat.ChannelChatEvent类的典型用法代码示例。如果您正苦于以下问题:Java ChannelChatEvent类的具体用法?Java ChannelChatEvent怎么用?Java ChannelChatEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ChannelChatEvent类属于com.dthielke.herochat包,在下文中一共展示了ChannelChatEvent类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onMessage
import com.dthielke.herochat.ChannelChatEvent; //导入依赖的package包/类
@EventHandler(priority = EventPriority.MONITOR)
public void onMessage(ChannelChatEvent event) {
// make sure chat channel is registered with a destination
if (DiscordSRV.getPlugin().getDestinationTextChannelForGameChannelName(event.getChannel().getName()) == null) return;
// make sure message isn't just blank
if (StringUtils.isBlank(event.getMessage())) return;
DiscordSRV.getPlugin().processChatMessage(event.getSender().getPlayer(), event.getMessage(), event.getChannel().getName(), event.getResult() != Chatter.Result.ALLOWED);
}
示例2: onChannelChatEvent
import com.dthielke.herochat.ChannelChatEvent; //导入依赖的package包/类
@EventHandler(priority = EventPriority.MONITOR)
public void onChannelChatEvent(ChannelChatEvent event) {
Resident resident = CivGlobal.getResident(event.getSender().getName());
if (resident == null) {
event.setResult(Result.FAIL);
return;
}
if (!resident.isInteractiveMode()) {
if (resident.isMuted()) {
event.setResult(Result.MUTED);
return;
}
}
if (event.getChannel().getDistance() > 0) {
for (String name : Resident.allchatters) {
Player player;
try {
player = CivGlobal.getPlayer(name);
} catch (CivException e) {
continue;
}
Chatter you = Herochat.getChatterManager().getChatter(player);
if (!event.getSender().isInRange(you, event.getChannel().getDistance())) {
player.sendMessage(CivColor.White+event.getSender().getName()+"[Far]: "+event.getMessage());
}
}
}
}