Skip to content
This repository has been archived by the owner on Jul 27, 2019. It is now read-only.

Commit

Permalink
Switch from MineverseChat to VentureChat.
Browse files Browse the repository at this point in the history
  • Loading branch information
cnaude committed Feb 17, 2016
1 parent 43739d2 commit 4eef9e7
Show file tree
Hide file tree
Showing 12 changed files with 149 additions and 152 deletions.
10 changes: 5 additions & 5 deletions dependency-reduced-pom.xml
Expand Up @@ -6,7 +6,7 @@
<name>PurpleIRC</name>
<version>2.1.14-${build.number}</version>
<description>Minecraft IRC integration for CraftBukkit/Spigot servers.</description>
<url>http://www.spigotmc.org/resources/purpleirc.2836/</url>
<url>http://dev.bukkit.org/bukkit-plugins/purpleirc/</url>
<build>
<resources>
<resource>
Expand Down Expand Up @@ -198,9 +198,9 @@
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.cnaude.mineversechat</groupId>
<artifactId>MineverseChat</artifactId>
<version>2.5.7</version>
<groupId>com.cnaude.venturechat</groupId>
<artifactId>VentureChat</artifactId>
<version>2.7.2</version>
<scope>compile</scope>
</dependency>
<dependency>
Expand Down Expand Up @@ -284,7 +284,7 @@
<dependency>
<groupId>com.cnaude.protocol</groupId>
<artifactId>ProtocolLib</artifactId>
<version>3.6.4</version>
<version>3.6.5</version>
<scope>compile</scope>
</dependency>
<dependency>
Expand Down
13 changes: 6 additions & 7 deletions pom.xml
Expand Up @@ -170,14 +170,13 @@
<version>5.6.7</version>
</dependency>

<!-- MineverseChat -->
<!-- VentureChat -->
<dependency>
<groupId>com.cnaude.mineversechat</groupId>
<artifactId>MineverseChat</artifactId>
<version>2.5.7</version>
<groupId>com.cnaude.venturechat</groupId>
<artifactId>VentureChat</artifactId>
<version>2.7.2</version>
</dependency>



<!-- Jobs -->
<dependency>
<groupId>com.cnaude.jobs</groupId>
Expand Down Expand Up @@ -273,7 +272,7 @@
<dependency>
<groupId>com.cnaude.protocol</groupId>
<artifactId>ProtocolLib</artifactId>
<version>3.6.4</version>
<version>3.6.5</version>
</dependency>

<!-- CleverNotch -->
Expand Down
1 change: 0 additions & 1 deletion src/main/java/com/cnaude/purpleirc/Commands/Link.java
Expand Up @@ -20,7 +20,6 @@
import com.cnaude.purpleirc.PurpleIRC;
import java.math.BigInteger;
import java.security.SecureRandom;
import org.apache.commons.codec.binary.Base64;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;

Expand Down
Expand Up @@ -27,7 +27,7 @@
* @author Chris Naude Event listener for plugins that want to catch command
* events from PurpleIRC
*/
public class MineverseChatEvent extends Event {
public class VentureChatEvent extends Event {

private static final HandlerList HANDLERS = new HandlerList();
private final AsyncPlayerChatEvent event;
Expand All @@ -38,7 +38,7 @@ public class MineverseChatEvent extends Event {
* @param event
* @param bot
*/
public MineverseChatEvent(AsyncPlayerChatEvent event, PurpleBot bot) {
public VentureChatEvent(AsyncPlayerChatEvent event, PurpleBot bot) {
this.event = event;
this.bot = bot;
}
Expand Down
Expand Up @@ -16,7 +16,7 @@
*/
package com.cnaude.purpleirc.GameListeners;

import com.cnaude.purpleirc.Events.MineverseChatEvent;
import com.cnaude.purpleirc.Events.VentureChatEvent;
import com.cnaude.purpleirc.PurpleBot;
import com.cnaude.purpleirc.PurpleIRC;
import com.cnaude.purpleirc.TemplateName;
Expand All @@ -27,21 +27,20 @@
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.AsyncPlayerChatEvent;

/**
*
* @author Chris Naude
*/
public class MineverseChatListener implements Listener {
public class VentureChatListener implements Listener {

final PurpleIRC plugin;

/**
*
* @param plugin the PurpleIRC plugin
*/
public MineverseChatListener(PurpleIRC plugin) {
public VentureChatListener(PurpleIRC plugin) {
this.plugin = plugin;
}

Expand All @@ -50,18 +49,18 @@ public MineverseChatListener(PurpleIRC plugin) {
* @param event
*/
@EventHandler(ignoreCancelled = true, priority = EventPriority.NORMAL)
public void onMineverseChatEvent(MineverseChatEvent event) {
mineverseChat(event.getPlayer(), event.getMessage(), event.getBot());
public void onVentureChatEvent(VentureChatEvent event) {
ventureChat(event.getPlayer(), event.getMessage(), event.getBot());
}

/**
* MineverseChat from game to IRC
* VentureChat from game to IRC
*
* @param player
* @param message
* @param bot the calling bot
*/
public void mineverseChat(Player player, String message, PurpleBot bot) {
public void ventureChat(Player player, String message, PurpleBot bot) {
MineverseChatPlayer mcp = MineverseChatAPI.getMineverseChatPlayer(player);
ChatChannel eventChannel = mcp.getCurrentChannel();
if (mcp.isQuickChat()) { //for single message chat detection
Expand All @@ -74,24 +73,24 @@ public void mineverseChat(Player player, String message, PurpleBot bot) {
bot.sendFloodWarning(player);
return;
}
String mvChannel = eventChannel.getName();
String mvColor = eventChannel.getColor();
String vcChannel = eventChannel.getName();
String vcColor = eventChannel.getColor();
for (String channelName : bot.botChannels) {
if (!bot.isPlayerInValidWorld(player, channelName)) {
continue;
}
plugin.logDebug("MV Channel: " + mvChannel);
String channelTemplateName = "mineverse-" + mvChannel + "-chat";
plugin.logDebug("VC Channel: " + vcChannel);
String channelTemplateName = "venture-" + vcChannel + "-chat";
if (bot.isMessageEnabled(channelName, channelTemplateName)
|| bot.isMessageEnabled(channelName, TemplateName.MINEVERSE_CHAT)) {
String template = plugin.getMineverseChatTemplate(bot.botNick, mvChannel);
plugin.logDebug("MV Template: " + template);
|| bot.isMessageEnabled(channelName, TemplateName.VENTURE_CHAT)) {
String template = plugin.getVentureChatTemplate(bot.botNick, vcChannel);
plugin.logDebug("VC Template: " + template);
bot.asyncIRCMessage(channelName, plugin.tokenizer
.mineverseChatTokenizer(player, mvChannel, mvColor, message, template));
.ventureChatTokenizer(player, vcChannel, vcColor, message, template));
} else {
plugin.logDebug("Player " + player.getName() + " is in Mineverse channel "
+ mvChannel + ". Message types " + channelTemplateName + " and "
+ TemplateName.MINEVERSE_CHAT + " are disabled. No message sent to IRC.");
plugin.logDebug("Player " + player.getName() + " is in VentureChat channel "
+ vcChannel + ". Message types " + channelTemplateName + " and "
+ TemplateName.VENTURE_CHAT + " are disabled. No message sent to IRC.");
}
}
}
Expand Down
Expand Up @@ -26,15 +26,15 @@
*
* @author cnaude
*/
public class MineverseChatHook {
public class VentureChatHook {

private final PurpleIRC plugin;

/**
*
* @param plugin the PurpleIRC plugin
*/
public MineverseChatHook(PurpleIRC plugin) {
public VentureChatHook(PurpleIRC plugin) {
this.plugin = plugin;

}
Expand Down
40 changes: 20 additions & 20 deletions src/main/java/com/cnaude/purpleirc/PurpleBot.java
Expand Up @@ -16,7 +16,7 @@
*/
package com.cnaude.purpleirc;

import com.cnaude.purpleirc.Events.MineverseChatEvent;
import com.cnaude.purpleirc.Events.VentureChatEvent;
import com.cnaude.purpleirc.IRCListeners.ActionListener;
import com.cnaude.purpleirc.IRCListeners.AwayListener;
import com.cnaude.purpleirc.IRCListeners.ConnectListener;
Expand Down Expand Up @@ -146,12 +146,12 @@ public final class PurpleBot {
public CaseInsensitiveMap<Boolean> invalidCommandPrivate;
public CaseInsensitiveMap<Boolean> invalidCommandCTCP;
public CaseInsensitiveMap<Boolean> logIrcToHeroChat;
public CaseInsensitiveMap<Boolean> logIrcToMineverseChat;
public CaseInsensitiveMap<Boolean> logIrcToVentureChat;
public CaseInsensitiveMap<Boolean> enableMessageFiltering;
public CaseInsensitiveMap<String> channelPrefix;
private final CaseInsensitiveMap<Boolean> shortify;
public CaseInsensitiveMap<String> heroChannel;
public CaseInsensitiveMap<String> mineverseChannel;
public CaseInsensitiveMap<String> ventureChatChannel;
public CaseInsensitiveMap<String> townyChannel;
public CaseInsensitiveMap<Collection<String>> opsList;
public CaseInsensitiveMap<Collection<String>> banList;
Expand Down Expand Up @@ -233,11 +233,11 @@ public PurpleBot(File file, PurpleIRC plugin) {
this.banList = new CaseInsensitiveMap<>();
this.voicesList = new CaseInsensitiveMap<>();
this.heroChannel = new CaseInsensitiveMap<>();
this.mineverseChannel = new CaseInsensitiveMap<>();
this.ventureChatChannel = new CaseInsensitiveMap<>();
this.townyChannel = new CaseInsensitiveMap<>();
this.invalidCommandCTCP = new CaseInsensitiveMap<>();
this.logIrcToHeroChat = new CaseInsensitiveMap<>();
this.logIrcToMineverseChat = new CaseInsensitiveMap<>();
this.logIrcToVentureChat = new CaseInsensitiveMap<>();
this.shortify = new CaseInsensitiveMap<>();
this.invalidCommandPrivate = new CaseInsensitiveMap<>();
this.hideQuitWhenVanished = new CaseInsensitiveMap<>();
Expand Down Expand Up @@ -898,17 +898,17 @@ private boolean loadConfig() {
heroChannel.put(channelName, config.getString("channels." + enChannelName + ".hero-channel", "admin"));
plugin.logDebug(" HeroChannel => " + heroChannel.get(channelName));

mineverseChannel.put(channelName, config.getString("channels." + enChannelName + ".mineverse-channel", "global"));
plugin.logDebug(" MineverseChannel => " + mineverseChannel.get(channelName));
ventureChatChannel.put(channelName, config.getString("channels." + enChannelName + ".venture-channel", "global"));
plugin.logDebug(" VentureChatChannel => " + ventureChatChannel.get(channelName));

townyChannel.put(channelName, config.getString("channels." + enChannelName + ".towny-channel", ""));
plugin.logDebug(" TownyChannel => " + townyChannel.get(channelName));

logIrcToHeroChat.put(channelName, config.getBoolean("channels." + enChannelName + ".log-irc-to-hero-chat", false));
plugin.logDebug(" LogIrcToHeroChat => " + logIrcToHeroChat.get(channelName));

logIrcToMineverseChat.put(channelName, config.getBoolean("channels." + enChannelName + ".log-irc-to-mineverse-chat", false));
plugin.logDebug(" LogIrcToMineverseChat => " + logIrcToMineverseChat.get(channelName));
logIrcToVentureChat.put(channelName, config.getBoolean("channels." + enChannelName + ".log-irc-to-venture-chat", false));
plugin.logDebug(" LogIrcToVentureChat => " + logIrcToVentureChat.get(channelName));

ignoreIRCChat.put(channelName, config.getBoolean("channels." + enChannelName + ".ignore-irc-chat", false));
plugin.logDebug(" IgnoreIRCChat => " + ignoreIRCChat.get(channelName));
Expand Down Expand Up @@ -1222,8 +1222,8 @@ public void gameChat(AsyncPlayerChatEvent event) {
} else {
plugin.logDebug("No Factions");
}
if (plugin.mineverseChatEnabled) {
plugin.getServer().getPluginManager().callEvent(new MineverseChatEvent(event, this));
if (plugin.ventureChatEnabled) {
plugin.getServer().getPluginManager().callEvent(new VentureChatEvent(event, this));
}
if (isMessageEnabled(channelName, TemplateName.GAME_CHAT)) {
asyncIRCMessage(channelName, plugin.tokenizer
Expand Down Expand Up @@ -2745,19 +2745,19 @@ public void broadcastChat(User user, org.pircbotx.Channel channel, String target
}

/*
Send messages to MineverseChat if enabled
Send messages to VentureChat if enabled
*/
if (isMessageEnabled(channelName, TemplateName.IRC_MINEVERSE_CHAT) && plugin.mineverseChatEnabled) {
String mvChannel = mineverseChannel.get(channelName);
String mvTemplate = plugin.getIrcMineverseChatTemplate(botNick, mvChannel);
plugin.logDebug("broadcastChat [MV]: " + mvChannel + ": " + mvTemplate);
if (isMessageEnabled(channelName, TemplateName.IRC_VENTURE_CHAT) && plugin.ventureChatEnabled) {
String vcChannel = ventureChatChannel.get(channelName);
String vcTemplate = plugin.getIrcVentureChatTemplate(botNick, vcChannel);
plugin.logDebug("broadcastChat [MV]: " + vcChannel + ": " + vcTemplate);
String rawMvMessage = filterMessage(
plugin.tokenizer.ircChatToMineverseChatTokenizer(this, user, channel, mvTemplate, message, mvChannel), channelName);
plugin.tokenizer.ircChatToVentureChatTokenizer(this, user, channel, vcTemplate, message, vcChannel), channelName);
if (!rawMvMessage.isEmpty()) {
plugin.mvHook.sendMessage(mvChannel, rawMvMessage);
plugin.vcHook.sendMessage(vcChannel, rawMvMessage);
messageSent = true;
if (logIrcToMineverseChat.containsKey(channelName)) {
if (logIrcToMineverseChat.get(channelName)) {
if (logIrcToVentureChat.containsKey(channelName)) {
if (logIrcToVentureChat.get(channelName)) {
plugin.getServer().getConsoleSender().sendMessage(rawMvMessage);
}
}
Expand Down

0 comments on commit 4eef9e7

Please sign in to comment.