Fixed bug where code was no run if debug was false.

This commit is contained in:
Tastybento 2017-11-21 17:26:57 -08:00
parent 792d1f8ec3
commit 4c1f7f24a5
3 changed files with 348 additions and 342 deletions

View File

@ -319,6 +319,7 @@ public class IslandCommand extends AbstractCommand {
@Override @Override
public void execute(CommandSender sender, String[] args) { public void execute(CommandSender sender, String[] args) {
player.setGameMode(GameMode.SPECTATOR);
// Get the player's old island // Get the player's old island
Island oldIsland = getIslands().getIsland(playerUUID); Island oldIsland = getIslands().getIsland(playerUUID);
if (DEBUG) if (DEBUG)
@ -332,7 +333,11 @@ public class IslandCommand extends AbstractCommand {
plugin.getLogger().info("DEBUG: making new island "); plugin.getLogger().info("DEBUG: making new island ");
Schematic schematic = plugin.getSchematics().getSchematic("default"); Schematic schematic = plugin.getSchematics().getSchematic("default");
try { try {
new NewIsland.Builder().player(player).schematic(schematic).oldIsland(oldIsland).build(); NewIsland.builder()
.player(player)
.schematic(schematic)
.oldIsland(oldIsland)
.build();
} catch (IOException e) { } catch (IOException e) {
plugin.getLogger().severe("Could not create island for player."); plugin.getLogger().severe("Could not create island for player.");
Util.sendMessage(sender, ChatColor.RED + plugin.getLocale(sender).get("general.errors.general")); Util.sendMessage(sender, ChatColor.RED + plugin.getLocale(sender).get("general.errors.general"));
@ -1523,7 +1528,10 @@ public class IslandCommand extends AbstractCommand {
//TODO: Add panels, make a selection. //TODO: Add panels, make a selection.
Schematic schematic = plugin.getSchematics().getSchematic("default"); Schematic schematic = plugin.getSchematics().getSchematic("default");
try { try {
new NewIsland.Builder().player(player).schematic(schematic).build(); NewIsland.builder()
.player(player)
.schematic(schematic)
.build();
} catch (IOException e) { } catch (IOException e) {
plugin.getLogger().severe("Could not create island for player."); plugin.getLogger().severe("Could not create island for player.");
Util.sendMessage(player, ChatColor.RED + plugin.getLocale(player).get("general.errors.general")); Util.sendMessage(player, ChatColor.RED + plugin.getLocale(player).get("general.errors.general"));

View File

@ -38,7 +38,7 @@ import us.tastybento.bskyblock.util.Util;
public class FlatFileDatabaseHandler<T> extends AbstractDatabaseHandler<T> { public class FlatFileDatabaseHandler<T> extends AbstractDatabaseHandler<T> {
private static final String DATABASE_FOLDER_NAME = "database"; private static final String DATABASE_FOLDER_NAME = "database";
private static final boolean DEBUG = true; private static final boolean DEBUG = false;
public FlatFileDatabaseHandler(BSkyBlock plugin, Class<T> type, DatabaseConnecter databaseConnecter) { public FlatFileDatabaseHandler(BSkyBlock plugin, Class<T> type, DatabaseConnecter databaseConnecter) {
super(plugin, type, databaseConnecter); super(plugin, type, databaseConnecter);
} }
@ -214,13 +214,11 @@ public class FlatFileDatabaseHandler<T> extends AbstractDatabaseHandler<T> {
plugin.getLogger().info("DEBUG: value = " + value); plugin.getLogger().info("DEBUG: value = " + value);
plugin.getLogger().info("DEBUG: property type = " + propertyDescriptor.getPropertyType()); plugin.getLogger().info("DEBUG: property type = " + propertyDescriptor.getPropertyType());
plugin.getLogger().info("DEBUG: " + value.getClass()); plugin.getLogger().info("DEBUG: " + value.getClass());
}
if (value != null && !value.getClass().equals(MemorySection.class)) { if (value != null && !value.getClass().equals(MemorySection.class)) {
method.invoke(instance, deserialize(value,propertyDescriptor.getPropertyType())); method.invoke(instance, deserialize(value,propertyDescriptor.getPropertyType()));
} }
} }
}
} }
} }

View File

@ -274,7 +274,7 @@ public class Util {
return true; return true;
} }
} }
return true; return false;
} }
/** /**