diff --git a/src/me/ryanhamshire/GriefPrevention/Claim.java b/src/me/ryanhamshire/GriefPrevention/Claim.java index d2c11d7..e5936a6 100644 --- a/src/me/ryanhamshire/GriefPrevention/Claim.java +++ b/src/me/ryanhamshire/GriefPrevention/Claim.java @@ -217,7 +217,7 @@ public class Claim for(int i = 0; i < builderIDs.length; i++) { String builderID = builderIDs[i]; - if(builderID != null) + if(builderID != null && !builderID.isEmpty()) { this.playerIDToClaimPermissionMap.put(builderID, ClaimPermission.Build); } @@ -226,7 +226,7 @@ public class Claim for(int i = 0; i < containerIds.length; i++) { String containerID = containerIds[i]; - if(containerID != null) + if(containerID != null && !containerID.isEmpty()) { this.playerIDToClaimPermissionMap.put(containerID, ClaimPermission.Inventory); } @@ -235,7 +235,7 @@ public class Claim for(int i = 0; i < accessorIDs.length; i++) { String accessorID = accessorIDs[i]; - if(accessorID != null) + if(accessorID != null && !accessorID.isEmpty()) { this.playerIDToClaimPermissionMap.put(accessorID, ClaimPermission.Access); } @@ -244,7 +244,7 @@ public class Claim for(int i = 0; i < managerIDs.length; i++) { String managerID = managerIDs[i]; - if(managerID != null) + if(managerID != null && !managerID.isEmpty()) { this.managers.add(managerID); } diff --git a/src/me/ryanhamshire/GriefPrevention/DatabaseDataStore.java b/src/me/ryanhamshire/GriefPrevention/DatabaseDataStore.java index 74443df..73280bc 100644 --- a/src/me/ryanhamshire/GriefPrevention/DatabaseDataStore.java +++ b/src/me/ryanhamshire/GriefPrevention/DatabaseDataStore.java @@ -414,7 +414,7 @@ public class DatabaseDataStore extends DataStore this.refreshDataConnection(); Statement statement = databaseConnection.createStatement(); - statement.execute("INSERT INTO griefprevention_claimdata VALUES(" + + statement.execute("INSERT INTO griefprevention_claimdata (id, owner, lessercorner, greatercorner, builders, containers, accessors, managers, parentid) VALUES(" + id + ", '" + owner + "', '" + lesserCornerString + "', '" + @@ -509,7 +509,7 @@ public class DatabaseDataStore extends DataStore Statement statement = databaseConnection.createStatement(); statement.execute("DELETE FROM griefprevention_playerdata WHERE name='" + playerID.toString() + "';"); - statement.execute("INSERT INTO griefprevention_playerdata VALUES ('" + playerID.toString() + "', '" + dateString + "', " + playerData.accruedClaimBlocks + ", " + playerData.bonusClaimBlocks + ");"); + statement.execute("INSERT INTO griefprevention_playerdata (name, lastlogin, accruedblocks, bonusblocks) VALUES ('" + playerID.toString() + "', '" + dateString + "', " + playerData.accruedClaimBlocks + ", " + playerData.bonusClaimBlocks + ");"); } catch(SQLException e) { @@ -608,7 +608,7 @@ public class DatabaseDataStore extends DataStore //otherwise return the value that's in the table else { - return results.getInt(0); + return results.getInt("version"); } } @@ -616,6 +616,7 @@ public class DatabaseDataStore extends DataStore { GriefPrevention.AddLogEntry("Unable to retrieve schema version from database. Details:"); GriefPrevention.AddLogEntry(e.getMessage()); + e.printStackTrace(); return 0; } } diff --git a/src/me/ryanhamshire/GriefPrevention/FlatFileDataStore.java b/src/me/ryanhamshire/GriefPrevention/FlatFileDataStore.java index 953cfc4..db84b68 100644 --- a/src/me/ryanhamshire/GriefPrevention/FlatFileDataStore.java +++ b/src/me/ryanhamshire/GriefPrevention/FlatFileDataStore.java @@ -610,6 +610,7 @@ public class FlatFileDataStore extends DataStore catch(Exception e) { GriefPrevention.AddLogEntry("Unexpected exception saving next claim ID: " + e.getMessage()); + e.printStackTrace(); } //close the file diff --git a/src/me/ryanhamshire/GriefPrevention/GriefPrevention.java b/src/me/ryanhamshire/GriefPrevention/GriefPrevention.java index d4b58db..f6b24e4 100644 --- a/src/me/ryanhamshire/GriefPrevention/GriefPrevention.java +++ b/src/me/ryanhamshire/GriefPrevention/GriefPrevention.java @@ -2101,7 +2101,7 @@ public class GriefPrevention extends JavaPlugin } else { - currentClaim.setPermission(identifierToAdd, permissionLevel); + currentClaim.setPermission(identifierToAdd, permissionLevel); } this.dataStore.saveClaim(currentClaim); }