* Null pointer fix.

This commit is contained in:
cnaude 2015-11-01 16:52:13 -07:00
parent 6202673298
commit cf7197ccd4
3 changed files with 35 additions and 6 deletions

View File

@ -1728,6 +1728,9 @@ public final class PurpleBot {
if (!this.isConnected()) {
return;
}
if (player == null || message == null) {
return;
}
if (message.isEmpty()) {
plugin.logDebug("gameDeath: blank death message for " + player.getDisplayName());
return;

View File

@ -73,6 +73,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.lang.management.ManagementFactory;
import java.lang.reflect.Method;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.text.Collator;
@ -1459,9 +1460,26 @@ public class PurpleIRC extends JavaPlugin {
hookList.add(hookFormat(PL_HEROCHAT, false));
}
if (isPluginEnabled(PL_GRIEFPREVENTION)) {
hookList.add(hookFormat(PL_GRIEFPREVENTION, true));
griefPreventionHook = new GriefPreventionHook(this);
//getServer().getPluginManager().registerEvents(new GriefPreventionListener(this), this);
Class cls = null;
boolean hooked = false;
try {
cls = Class.forName("me.ryanhamshire.GriefPrevention.DataStore");
} catch (ClassNotFoundException ex) {
logDebug(ex.getMessage());
}
if (cls != null) {
for (Method m : cls.getMethods()) {
if (m.getName().equals("isSoftMuted")) {
hookList.add(hookFormat(PL_GRIEFPREVENTION, true));
griefPreventionHook = new GriefPreventionHook(this);
hooked = true;
break;
}
}
}
if (!hooked) {
hookList.add(hookFormat(PL_GRIEFPREVENTION, false));
}
} else {
hookList.add(hookFormat(PL_GRIEFPREVENTION, false));
}

View File

@ -59,15 +59,23 @@ public class PurpleTabCompleter implements TabCompleter {
if (strings.length == 2) {
for (PurpleBot ircBot : plugin.ircBots.values()) {
for (Channel channel : ircBot.getChannels()) {
String channelName = channel.getName();
for (User user : channel.getUsers()) {
if (user.getNick().startsWith(strings[1])) {
if (!list.contains(user.getNick())) {
String nick = user.getNick();
if (nick.startsWith(strings[1])) {
if (list.contains(nick)) {
continue;
}
if (ircBot.tabIgnoreNicks.containsKey(channelName)) {
if (ircBot.tabIgnoreNicks.get(channelName).contains(nick)) {
continue;
}
}
list.add(user.getNick());
}
}
}
}
}
for (Player player : plugin.getServer().getOnlinePlayers()) {
if (plugin.vanishHook != null) {
if (plugin.vanishHook.isVanished(player)) {