Skip to content

Commit

Permalink
More validation debug messages
Browse files Browse the repository at this point in the history
  • Loading branch information
weaves7 committed Dec 24, 2022
1 parent f8e5076 commit 9f6bfe5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ private boolean loadSellerFromSettings(String key, HashMap<String,List<String>>
try {
SignShop.debugMessage("Getting sign block.");
seller_sign = signshopUtil.convertStringToLocation(tempList.get(0), world).getBlock();
SignShop.debugMessage("Sign block is: " + seller_sign);
} catch(Exception ex) {
SignShop.log("Caught an unexpected exception: " + ex.getMessage(), Level.WARNING);
// May have caught a FileNotFoundException originating from the chunkloader
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,13 +149,20 @@ public static String convertLocationToString(Location loc) {
}

public static Location convertStringToLocation(String sLoc, World pWorld) {
SignShop.debugMessage("Converting string '"+sLoc+"' to location in world, "+pWorld+".");
SignShop.debugMessage("From these worlds: " + Bukkit.getWorlds());
String[] sCoords = sLoc.split("/");
if(sCoords.length < 3)
return null;
try {
World world = pWorld;
if(sCoords.length > 3 && Bukkit.getWorld(sCoords[3]) != null)
if(sCoords.length > 3 && Bukkit.getWorld(sCoords[3]) != null) {
SignShop.debugMessage("World string is not null.");
world = Bukkit.getWorld(sCoords[3]);
}else {
SignShop.debugMessage("World string is null. Using passed world.");
}

return new Location(world, Double.parseDouble(sCoords[0]), Double.parseDouble(sCoords[1]), Double.parseDouble(sCoords[2]));
} catch(NumberFormatException ex) {
return null;
Expand Down

0 comments on commit 9f6bfe5

Please sign in to comment.