Skip to content
This repository has been archived by the owner on Jul 27, 2019. It is now read-only.

Commit

Permalink
More error catching. $49
Browse files Browse the repository at this point in the history
  • Loading branch information
cnaude committed Jun 16, 2014
1 parent 38e1773 commit 0b76b75
Showing 1 changed file with 74 additions and 11 deletions.
85 changes: 74 additions & 11 deletions src/main/java/com/cnaude/purpleirc/PurpleBot.java
Expand Up @@ -2617,11 +2617,18 @@ public void gamePrismRollback(Player player, QueryParameters queryParams) {
String worldName = queryParams.getWorld();
String id = String.valueOf(queryParams.getId());
String radius = String.valueOf(queryParams.getRadius());
String X = String.valueOf(queryParams.getSpecificBlockLocations().get(0).getX());
String Y = String.valueOf(queryParams.getSpecificBlockLocations().get(0).getY());
String Z = String.valueOf(queryParams.getSpecificBlockLocations().get(0).getZ());
String X = "";
String Y = "";
String Z = "";
try {
X = String.valueOf(queryParams.getSpecificBlockLocations().get(0).getX());
Y = String.valueOf(queryParams.getSpecificBlockLocations().get(0).getY());
Z = String.valueOf(queryParams.getSpecificBlockLocations().get(0).getZ());
} catch (Exception ex) {
plugin.logDebug(ex.getMessage());
}
if (keyword == null) {
keyword = "";
keyword = "";
}
if (sortDirection == null) {
sortDirection = "";
Expand Down Expand Up @@ -2666,17 +2673,73 @@ public void gamePrismDrainOrExtinguish(String template, Player player, int radiu
if (!this.isConnected()) {
return;
}
String X;
String Y;
String Z;
String radiusStr = String.valueOf(radius);
String origBlock;
String newBlock;
String blockWorld;
try {
blockWorld = String.valueOf(blockStateChange.get(0).getNewBlock().getWorld().getName());
} catch (Exception ex) {
plugin.logDebug(ex.getMessage());
blockWorld = "";
}
try {
origBlock = String.valueOf(blockStateChange.get(0).getOriginalBlock().getType().name());
} catch (Exception ex) {
plugin.logDebug(ex.getMessage());
origBlock = "";
}
try {
newBlock = String.valueOf(blockStateChange.get(0).getNewBlock().getType().name());
} catch (Exception ex) {
plugin.logDebug(ex.getMessage());
newBlock = "";
}
try {
X = String.valueOf(blockStateChange.get(0).getNewBlock().getX());
Y = String.valueOf(blockStateChange.get(0).getNewBlock().getY());
Z = String.valueOf(blockStateChange.get(0).getNewBlock().getZ());
} catch (Exception ex) {
plugin.logDebug(ex.getMessage());
X = "";
Y = "";
Z = "";
}
if (radiusStr == null) {
radiusStr = "";
}
if (X == null) {
X = "";
}
if (Y == null) {
Y = "";
}
if (Z == null) {
Z = "";
}
if (blockWorld == null) {
blockWorld = null;
}
if (origBlock == null) {
origBlock = "";
}
if (newBlock == null) {
newBlock = "";
}
for (String channelName : botChannels) {
if (isMessageEnabled(channelName, template)) {
asyncIRCMessage(channelName, plugin.tokenizer
.playerTokenizer(player, plugin.getMsgTemplate(botNick, template))
.replace("%RADIUS%", String.valueOf(radius))
.replace("%ORIGINALBLOCK%", String.valueOf(blockStateChange.get(0).getOriginalBlock().getType().name()))
.replace("%NEWBLOCK%", String.valueOf(blockStateChange.get(0).getNewBlock().getType().name()))
.replace("%X%", String.valueOf(blockStateChange.get(0).getNewBlock().getX()))
.replace("%Y%", String.valueOf(blockStateChange.get(0).getNewBlock().getY()))
.replace("%Z%", String.valueOf(blockStateChange.get(0).getNewBlock().getZ()))
.replace("%BLOCKWORLD%", String.valueOf(blockStateChange.get(0).getNewBlock().getWorld().getName()))
.replace("%RADIUS%", radiusStr)
.replace("%ORIGINALBLOCK%", origBlock)
.replace("%NEWBLOCK%", newBlock)
.replace("%X%", X)
.replace("%Y%", Y)
.replace("%Z%", Z)
.replace("%BLOCKWORLD%", blockWorld)
);
}
}
Expand Down

0 comments on commit 0b76b75

Please sign in to comment.