mirror of
https://github.com/cnaude/PurpleIRC-spigot.git
synced 2024-11-25 19:45:54 +01:00
More error catching around vault.
This commit is contained in:
parent
0dfad43aeb
commit
7885a2597e
@ -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;
|
||||
|
||||
/**
|
||||
@ -63,7 +65,7 @@ public class CommandQueueWatcher {
|
||||
}
|
||||
if (plugin.getServer().getVersion().contains("MC: 1.8") && plugin.getServer().getPluginCommand(cmd) == null
|
||||
&& !isCommandBookCommand) {
|
||||
plugin.logDebug("Dispatching command as ConsoleSender: " + ircCommand.getGameCommand());
|
||||
plugin.logDebug("Dispatching command as ConsoleSender: " + ircCommand.getGameCommand());
|
||||
|
||||
plugin.getServer().dispatchCommand(ircCommand.getIRCConsoleCommandSender(), ircCommand.getGameCommand());
|
||||
ircCommand.getIRCConsoleCommandSender().sendMessage("Command sent: " + ircCommand.getGameCommand());
|
||||
|
@ -150,7 +150,7 @@ public class IRCConsoleCommandSender implements ConsoleCommandSender {
|
||||
public boolean isPermissionSet(final Permission arg0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void sendRawMessage(String string) {
|
||||
plugin.logDebug("sendRawMessage: " + string);
|
||||
|
@ -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;
|
||||
|
||||
/**
|
||||
|
@ -247,7 +247,7 @@ public class PurpleIRC extends JavaPlugin {
|
||||
getServer().getPluginManager().registerEvents(new GamePlayerJoinListener(this), this);
|
||||
getServer().getPluginManager().registerEvents(new GamePlayerKickListener(this), this);
|
||||
getServer().getPluginManager().registerEvents(new GamePlayerQuitListener(this), this);
|
||||
getServer().getPluginManager().registerEvents(new GameServerCommandListener(this), this);
|
||||
getServer().getPluginManager().registerEvents(new GameServerCommandListener(this), this);
|
||||
if (isPluginEnabled("Herochat")) {
|
||||
logInfo("Enabling HeroChat support.");
|
||||
getServer().getPluginManager().registerEvents(new HeroChatListener(this), this);
|
||||
@ -322,7 +322,7 @@ public class PurpleIRC extends JavaPlugin {
|
||||
}
|
||||
if (isPluginEnabled("CommandBook")) {
|
||||
logInfo("Enabling CommandBook support.");
|
||||
commandBookHook = new CommandBookHook(this);
|
||||
commandBookHook = new CommandBookHook(this);
|
||||
} else {
|
||||
logInfo("CommandBook not detected.");
|
||||
}
|
||||
@ -362,7 +362,7 @@ public class PurpleIRC extends JavaPlugin {
|
||||
} else {
|
||||
logInfo("OreBroadcast not detected.");
|
||||
}
|
||||
vanishHook = new VanishHook(this);
|
||||
vanishHook = new VanishHook(this);
|
||||
if (isPluginEnabled("VanishNoPacket")) {
|
||||
logInfo("Enabling VanishNoPacket support.");
|
||||
getServer().getPluginManager().registerEvents(new VanishNoPacketListener(this), this);
|
||||
@ -719,7 +719,7 @@ public class PurpleIRC extends JavaPlugin {
|
||||
logInfo("Loaded bot: " + file.getName() + " [" + ircBot.botNick + "]");
|
||||
} else {
|
||||
logError("Bot not loaded: " + file.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -837,7 +837,7 @@ public class PurpleIRC extends JavaPlugin {
|
||||
public void logInfo(String message) {
|
||||
log.log(Level.INFO, String.format("%s %s", LOG_HEADER, message));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* @param message
|
||||
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user