From 04167997ad9fcada7f3fa1891616ed2d3028ca59 Mon Sep 17 00:00:00 2001 From: Sauilitired Date: Wed, 24 Sep 2014 20:53:04 +0200 Subject: [PATCH] Fixed SQLite errors Added stacktraces to clear (Settings.DEBUG) --- .../intellectualcrafters/plot/PlotHelper.java | 22 ++++++++----------- .../plot/database/DBFunc.java | 9 ++++---- 2 files changed, 14 insertions(+), 17 deletions(-) diff --git a/PlotSquared/src/com/intellectualcrafters/plot/PlotHelper.java b/PlotSquared/src/com/intellectualcrafters/plot/PlotHelper.java index f5a0b158e..253fa679c 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/PlotHelper.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/PlotHelper.java @@ -9,24 +9,14 @@ package com.intellectualcrafters.plot; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Random; -import java.util.UUID; - -import org.bukkit.Bukkit; -import org.bukkit.Chunk; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.OfflinePlayer; -import org.bukkit.World; +import com.intellectualcrafters.plot.database.DBFunc; +import org.bukkit.*; import org.bukkit.block.Biome; import org.bukkit.block.Block; import org.bukkit.block.Sign; import org.bukkit.entity.Player; -import com.intellectualcrafters.plot.database.DBFunc; +import java.util.*; /** * plot functions @@ -562,6 +552,12 @@ public class PlotHelper { SetBlockFast.update(requester); return; } catch (Exception e) { + if(Settings.DEBUG) { + PlotMain.sendConsoleSenderMessage(C.PREFIX.s() + "Debug Mode Enabled -> Throwing epic stacktrace."); + e.printStackTrace(); + } else { + PlotMain.sendConsoleSenderMessage(C.PREFIX.s() + "Something went wrong with plot clearing... Enable debug to get stacktraces."); + } PlayerFunctions.sendMessage(requester, C.PREFIX.s() + "&cPlot clear failed... Trying again..."); } } diff --git a/PlotSquared/src/com/intellectualcrafters/plot/database/DBFunc.java b/PlotSquared/src/com/intellectualcrafters/plot/database/DBFunc.java index 087d43365..5a4d50198 100644 --- a/PlotSquared/src/com/intellectualcrafters/plot/database/DBFunc.java +++ b/PlotSquared/src/com/intellectualcrafters/plot/database/DBFunc.java @@ -277,10 +277,7 @@ public class DBFunc { // each time. HashMap settings = getSettings(id); UUID owner = UUID.fromString(r.getString("owner")); - Biome plotBiome = Biome.valueOf((String) settings.get("biome")); - if (plotBiome == null) { - plotBiome = Biome.FOREST; - } + Biome plotBiome = Biome.FOREST; String[] flags_string; if (settings.get("flags") == null) { flags_string = new String[] {}; @@ -315,6 +312,10 @@ public class DBFunc { } PlotHomePosition position = null; for (PlotHomePosition plotHomePosition : PlotHomePosition.values()) { + if (settings.get("position") == null) { + position = PlotHomePosition.DEFAULT; + break; + } if (plotHomePosition.isMatching((String) settings.get("position"))) { position = plotHomePosition; }