Permalink
Browse files

Switched to normal chat events;

Fixed Factions interactions; now uses default Factions tag insertion
Fixed world change events;
  • Loading branch information...
1 parent 9bd9684 commit 37feec3cf71264553a0b91c04acc8c3310501391 @krinsdeath committed Dec 20, 2011
View
@@ -15,8 +15,8 @@
<repositories>
<!-- Multiverse Repository -->
<repository>
- <id>pneumaticsystem</id>
- <url>http://pneumaticsystem.com:25578/nexus/content/groups/public</url>
+ <id>OnARandomBox</id>
+ <url>http://repo.onarandombox.com/artifactory/repo</url>
</repository>
<!-- End Multiverse -->
</repositories>
@@ -145,12 +145,13 @@ private void initEvents() {
// register events
// ---
// player events
- pm.registerEvent(Type.PLAYER_CHAT, pListener, Priority.Highest, this);
+ pm.registerEvent(Type.PLAYER_CHAT, pListener, Priority.Lowest, this);
pm.registerEvent(Type.PLAYER_JOIN, pListener, Priority.Monitor, this);
pm.registerEvent(Type.PLAYER_QUIT, pListener, Priority.Monitor, this);
pm.registerEvent(Type.PLAYER_KICK, pListener, Priority.Monitor, this);
pm.registerEvent(Type.PLAYER_TELEPORT, pListener, Priority.Monitor, this);
pm.registerEvent(Type.PLAYER_PORTAL, pListener, Priority.Monitor, this);
+ pm.registerEvent(Type.PLAYER_CHANGED_WORLD, pListener, Priority.Monitor, this);
// ---
// chat event
pm.registerEvent(Type.CUSTOM_EVENT, chatListener, Priority.Highest, this);
@@ -4,7 +4,6 @@
import java.util.Set;
import net.krinsoft.chat.ChatCore;
import net.krinsoft.chat.targets.ChatPlayer;
-import net.krinsoft.chat.events.ChannelMessage;
import net.krinsoft.chat.targets.Channel;
import org.bukkit.entity.Player;
import org.bukkit.event.player.PlayerChangedWorldEvent;
@@ -47,7 +46,7 @@ public void onPlayerChat(PlayerChatEvent event) {
}
String msg = event.getMessage().replaceAll("\\$", "\\\\\\$");
if (!event.getPlayer().hasPermission("chatsuite.colorize")) {
- msg = msg.replaceAll("(?i)&([0-F])", "");
+ msg = msg.replaceAll("&([0-9a-fA-F])", "");
}
ChatPlayer p = plugin.getPlayerManager().getPlayer(event.getPlayer().getName());
if (p == null) { return; }
@@ -61,10 +60,12 @@ public void onPlayerChat(PlayerChatEvent event) {
}
event.getRecipients().clear();
event.getRecipients().addAll(players);
+ // logger method; no longer necessary
//plugin.chat(event.getPlayer().getName(), msg);
msg = p.message(c, msg);
event.setFormat(msg);
event.setMessage("");
+ // custom event methods; no longer necessary
//ChannelMessage e = new ChannelMessage(plugin, c, event.getPlayer().getName(), msg);
//plugin.getServer().getPluginManager().callEvent(e);
//event.setCancelled(true);
@@ -20,10 +20,10 @@
private final static Pattern TARGET = Pattern.compile("(%t)");
private final static Pattern TARGET_DISPLAY = Pattern.compile("(%dt)");
private final static Pattern PREFIX = Pattern.compile("(%p)");
+ private final static Pattern GROUP = Pattern.compile("(%g)");
private final static Pattern SUFFIX = Pattern.compile("(%s)");
private final static Pattern FACTION = Pattern.compile("(%f)");
private final static Pattern HEROES = Pattern.compile("(%h)");
- private final static Pattern GROUP = Pattern.compile("(%g)");
private final static Pattern AFK = Pattern.compile("(%afk)");
private final static Pattern WORLD = Pattern.compile("(%w)");
private final static Pattern WHISPER_SEND = Pattern.compile("(%!ws|%!whisper_send)");
@@ -194,18 +194,18 @@ protected boolean setFormat(Type t, String msg) {
}
public boolean setFormat(String name, String msg) {
- if (msg != null && (msg.contains("%n") || msg.contains("%d"))) {
+ if (msg != null && (msg.contains("%n") || msg.contains("%d")) && (msg.contains("%m"))) {
Type t = Type.getTypeByName(name);
- return setFormat(t, name);
+ return setFormat(t, msg);
} else {
return false;
}
}
public boolean setFormat(int id, String msg) {
- if (msg != null && (msg.contains("%n") || msg.contains("%d"))) {
+ if (msg != null && (msg.contains("%n") || msg.contains("%d")) && (msg.contains("%m"))) {
Type t = Type.getTypeById(id);
- return setFormat(t, name);
+ return setFormat(t, msg);
} else {
return false;
}

0 comments on commit 37feec3

Please sign in to comment.