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 java.util.Queue;
import java.util.concurrent.ConcurrentLinkedQueue;
import net.minecraft.server.v1_8_R2.RemoteControlCommandListener;
import static org.bukkit.Bukkit.getServer;
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.ReadWriteLock;
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.events.BlockStateChange;
import org.bukkit.Achievement;
@ -165,7 +163,7 @@ public final class PurpleBot {
String version;
String finger;
private int reconnectCount;
private ReadWriteLock rwl;
private final ReadWriteLock rwl;
private final Lock wl;
/**

View File

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