More error catching around vault.

This commit is contained in:
cnaude 2015-03-13 07:35:54 -07:00
parent 0dfad43aeb
commit 7885a2597e
4 changed files with 58 additions and 58 deletions

View File

@ -19,6 +19,8 @@ package com.cnaude.purpleirc;
import com.cnaude.purpleirc.Events.IRCCommandEvent; import com.cnaude.purpleirc.Events.IRCCommandEvent;
import java.util.Queue; import java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.ConcurrentLinkedQueue;
import net.minecraft.server.v1_8_R2.RemoteControlCommandListener;
import static org.bukkit.Bukkit.getServer;
import org.bukkit.command.CommandException; import org.bukkit.command.CommandException;
/** /**

View File

@ -55,8 +55,6 @@ import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.Lock; import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReadWriteLock; import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock; import java.util.concurrent.locks.ReentrantReadWriteLock;
import java.util.logging.Level;
import java.util.logging.Logger;
import me.botsko.prism.actionlibs.QueryParameters; import me.botsko.prism.actionlibs.QueryParameters;
import me.botsko.prism.events.BlockStateChange; import me.botsko.prism.events.BlockStateChange;
import org.bukkit.Achievement; import org.bukkit.Achievement;
@ -165,7 +163,7 @@ public final class PurpleBot {
String version; String version;
String finger; String finger;
private int reconnectCount; private int reconnectCount;
private ReadWriteLock rwl; private final ReadWriteLock rwl;
private final Lock wl; private final Lock wl;
/** /**

View File

@ -965,15 +965,15 @@ public class PurpleIRC extends JavaPlugin {
*/ */
public String getPlayerGroup(Player player) { public String getPlayerGroup(Player player) {
String groupName = ""; String groupName = "";
if (vaultHelpers != null) {
if (vaultHelpers.permission != null) {
try { try {
if (vaultHelpers != null) {
if (vaultHelpers.permission != null && vaultHelpers.permission != null) {
groupName = vaultHelpers.permission.getPrimaryGroup(player); groupName = vaultHelpers.permission.getPrimaryGroup(player);
}
}
} catch (Exception ex) { } catch (Exception ex) {
logDebug("Problem with primary group (" + player.getName() + "): " + ex.getMessage()); logDebug("Problem with primary group (" + player.getName() + "): " + ex.getMessage());
} }
}
}
if (groupName == null) { if (groupName == null) {
groupName = ""; groupName = "";
} }
@ -1000,19 +1000,19 @@ public class PurpleIRC extends JavaPlugin {
*/ */
public String getPlayerGroup(String worldName, String player) { public String getPlayerGroup(String worldName, String player) {
String groupName = ""; String groupName = "";
try {
UUID uuid = getPlayerUuid(player); UUID uuid = getPlayerUuid(player);
if (vaultHelpers != null && uuid != null) { if (vaultHelpers != null && uuid != null) {
if (vaultHelpers.permission != null) { if (vaultHelpers.permission != null && vaultHelpers.permission != null) {
OfflinePlayer offlinePlayer = getServer().getOfflinePlayer(uuid); OfflinePlayer offlinePlayer = getServer().getOfflinePlayer(uuid);
if (offlinePlayer != null) { if (offlinePlayer != null) {
try {
groupName = vaultHelpers.permission.getPrimaryGroup(worldName, offlinePlayer); groupName = vaultHelpers.permission.getPrimaryGroup(worldName, offlinePlayer);
}
}
}
} catch (Exception ex) { } catch (Exception ex) {
logDebug("getPlayerGroup (" + player + "): " + ex.getMessage()); logDebug("getPlayerGroup (" + player + "): " + ex.getMessage());
} }
}
}
}
if (groupName == null) { if (groupName == null) {
groupName = ""; groupName = "";
} }
@ -1045,19 +1045,19 @@ public class PurpleIRC extends JavaPlugin {
*/ */
public String getPlayerPrefix(String worldName, String player) { public String getPlayerPrefix(String worldName, String player) {
String prefix = ""; String prefix = "";
try {
UUID uuid = getPlayerUuid(player); UUID uuid = getPlayerUuid(player);
if (vaultHelpers != null && uuid != null) { if (vaultHelpers != null && uuid != null) {
if (vaultHelpers.chat != null) { if (vaultHelpers.chat != null) {
OfflinePlayer offlinePlayer = getServer().getOfflinePlayer(uuid); OfflinePlayer offlinePlayer = getServer().getOfflinePlayer(uuid);
if (offlinePlayer != null) { if (offlinePlayer != null) {
try {
prefix = vaultHelpers.chat.getPlayerPrefix(worldName, offlinePlayer); prefix = vaultHelpers.chat.getPlayerPrefix(worldName, offlinePlayer);
}
}
}
} catch (Exception ex) { } catch (Exception ex) {
logDebug("getPlayerPrefix (" + player + "): " + ex.getMessage()); logDebug("getPlayerPrefix (" + player + "): " + ex.getMessage());
} }
}
}
}
if (prefix == null) { if (prefix == null) {
prefix = ""; prefix = "";
} }
@ -1090,19 +1090,19 @@ public class PurpleIRC extends JavaPlugin {
*/ */
public String getPlayerSuffix(String worldName, String player) { public String getPlayerSuffix(String worldName, String player) {
String suffix = ""; String suffix = "";
try {
UUID uuid = getPlayerUuid(player); UUID uuid = getPlayerUuid(player);
if (vaultHelpers != null && uuid != null) { if (vaultHelpers != null && uuid != null) {
if (vaultHelpers.chat != null) { if (vaultHelpers.chat != null) {
OfflinePlayer offlinePlayer = getServer().getOfflinePlayer(uuid); OfflinePlayer offlinePlayer = getServer().getOfflinePlayer(uuid);
if (offlinePlayer != null) { if (offlinePlayer != null) {
try {
suffix = vaultHelpers.chat.getPlayerSuffix(worldName, offlinePlayer); suffix = vaultHelpers.chat.getPlayerSuffix(worldName, offlinePlayer);
}
}
}
} catch (Exception ex) { } catch (Exception ex) {
logDebug("getPlayerSuffix (" + player + "): " + ex.getMessage()); logDebug("getPlayerSuffix (" + player + "): " + ex.getMessage());
} }
}
}
}
if (suffix == null) { if (suffix == null) {
suffix = ""; suffix = "";
} }
@ -1178,7 +1178,7 @@ public class PurpleIRC extends JavaPlugin {
public String getGroupPrefix(Player player) { public String getGroupPrefix(Player player) {
String prefix = ""; String prefix = "";
if (vaultHelpers != null) { if (vaultHelpers != null) {
if (vaultHelpers.chat != null) { if (vaultHelpers.chat != null && vaultHelpers.permission != null) {
String group = ""; String group = "";
try { try {
group = vaultHelpers.permission.getPrimaryGroup(player); group = vaultHelpers.permission.getPrimaryGroup(player);
@ -1205,17 +1205,14 @@ public class PurpleIRC extends JavaPlugin {
*/ */
public String getGroupPrefix(String worldName, String player) { public String getGroupPrefix(String worldName, String player) {
String prefix = ""; String prefix = "";
try {
UUID uuid = getPlayerUuid(player); UUID uuid = getPlayerUuid(player);
if (vaultHelpers != null && uuid != null) { if (vaultHelpers != null && uuid != null) {
if (vaultHelpers.chat != null) { if (vaultHelpers.chat != null && vaultHelpers.permission != null) {
String group = ""; String group = "";
OfflinePlayer offlinePlayer = getServer().getOfflinePlayer(uuid); OfflinePlayer offlinePlayer = getServer().getOfflinePlayer(uuid);
if (offlinePlayer != null) { if (offlinePlayer != null) {
try {
group = vaultHelpers.permission.getPrimaryGroup(worldName, offlinePlayer); group = vaultHelpers.permission.getPrimaryGroup(worldName, offlinePlayer);
} catch (Exception ex) {
logDebug("getGroupPrefix (" + player + "): " + ex.getMessage());
}
} }
if (group == null) { if (group == null) {
group = ""; group = "";
@ -1226,6 +1223,9 @@ public class PurpleIRC extends JavaPlugin {
if (prefix == null) { if (prefix == null) {
prefix = ""; prefix = "";
} }
} catch (Exception ex) {
logDebug("getGroupPrefix (" + player + "): " + ex.getMessage());
}
return ChatColor.translateAlternateColorCodes('&', prefix); return ChatColor.translateAlternateColorCodes('&', prefix);
} }
@ -1260,7 +1260,7 @@ public class PurpleIRC extends JavaPlugin {
public String getGroupSuffix(Player player) { public String getGroupSuffix(Player player) {
String suffix = ""; String suffix = "";
if (vaultHelpers != null) { if (vaultHelpers != null) {
if (vaultHelpers.chat != null) { if (vaultHelpers.chat != null && vaultHelpers.permission != null) {
String group = ""; String group = "";
try { try {
group = vaultHelpers.permission.getPrimaryGroup(player); group = vaultHelpers.permission.getPrimaryGroup(player);
@ -1289,7 +1289,7 @@ public class PurpleIRC extends JavaPlugin {
String suffix = ""; String suffix = "";
UUID uuid = getPlayerUuid(player); UUID uuid = getPlayerUuid(player);
if (vaultHelpers != null && uuid != null) { if (vaultHelpers != null && uuid != null) {
if (vaultHelpers.chat != null) { if (vaultHelpers.chat != null && vaultHelpers.permission != null) {
String group = ""; String group = "";
OfflinePlayer offlinePlayer = getServer().getOfflinePlayer(uuid); OfflinePlayer offlinePlayer = getServer().getOfflinePlayer(uuid);
try { try {