Updated SQL code to account for database config differences.
This commit is contained in:
parent
7ac4fb886d
commit
ad57d1f7f7
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -2101,7 +2101,7 @@ public class GriefPrevention extends JavaPlugin
|
|||
}
|
||||
else
|
||||
{
|
||||
currentClaim.setPermission(identifierToAdd, permissionLevel);
|
||||
currentClaim.setPermission(identifierToAdd, permissionLevel);
|
||||
}
|
||||
this.dataStore.saveClaim(currentClaim);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user