Updated SQL code to account for database config differences.
This commit is contained in:
1 parent
7ac4fb886d
commit
ad57d1f7f7
3 files changed
+9
-7
No files matched your search
@@ -217,7 +217,7 @@ public class Claim
|
|||||||
for(int i = 0; i < builderIDs.length; i++)
|
for(int i = 0; i < builderIDs.length; i++)
|
||||||
{
|
{
|
||||||
String builderID = builderIDs[i];
|
String builderID = builderIDs[i];
|
||||||
if(builderID != null)
|
if(builderID != null && !builderID.isEmpty())
|
||||||
{
|
{
|
||||||
this.playerIDToClaimPermissionMap.put(builderID, ClaimPermission.Build);
|
this.playerIDToClaimPermissionMap.put(builderID, ClaimPermission.Build);
|
||||||
}
|
}
|
||||||
@@ -226,7 +226,7 @@ public class Claim
|
|||||||
for(int i = 0; i < containerIds.length; i++)
|
for(int i = 0; i < containerIds.length; i++)
|
||||||
{
|
{
|
||||||
String containerID = containerIds[i];
|
String containerID = containerIds[i];
|
||||||
if(containerID != null)
|
if(containerID != null && !containerID.isEmpty())
|
||||||
{
|
{
|
||||||
this.playerIDToClaimPermissionMap.put(containerID, ClaimPermission.Inventory);
|
this.playerIDToClaimPermissionMap.put(containerID, ClaimPermission.Inventory);
|
||||||
}
|
}
|
||||||
@@ -235,7 +235,7 @@ public class Claim
|
|||||||
for(int i = 0; i < accessorIDs.length; i++)
|
for(int i = 0; i < accessorIDs.length; i++)
|
||||||
{
|
{
|
||||||
String accessorID = accessorIDs[i];
|
String accessorID = accessorIDs[i];
|
||||||
if(accessorID != null)
|
if(accessorID != null && !accessorID.isEmpty())
|
||||||
{
|
{
|
||||||
this.playerIDToClaimPermissionMap.put(accessorID, ClaimPermission.Access);
|
this.playerIDToClaimPermissionMap.put(accessorID, ClaimPermission.Access);
|
||||||
}
|
}
|
||||||
@@ -244,7 +244,7 @@ public class Claim
|
|||||||
for(int i = 0; i < managerIDs.length; i++)
|
for(int i = 0; i < managerIDs.length; i++)
|
||||||
{
|
{
|
||||||
String managerID = managerIDs[i];
|
String managerID = managerIDs[i];
|
||||||
if(managerID != null)
|
if(managerID != null && !managerID.isEmpty())
|
||||||
{
|
{
|
||||||
this.managers.add(managerID);
|
this.managers.add(managerID);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -414,7 +414,7 @@ public class DatabaseDataStore extends DataStore
|
|||||||
this.refreshDataConnection();
|
this.refreshDataConnection();
|
||||||
|
|
||||||
Statement statement = databaseConnection.createStatement();
|
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 + ", '" +
|
id + ", '" +
|
||||||
owner + "', '" +
|
owner + "', '" +
|
||||||
lesserCornerString + "', '" +
|
lesserCornerString + "', '" +
|
||||||
@@ -509,7 +509,7 @@ public class DatabaseDataStore extends DataStore
|
|||||||
|
|
||||||
Statement statement = databaseConnection.createStatement();
|
Statement statement = databaseConnection.createStatement();
|
||||||
statement.execute("DELETE FROM griefprevention_playerdata WHERE name='" + playerID.toString() + "';");
|
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)
|
catch(SQLException e)
|
||||||
{
|
{
|
||||||
@@ -608,7 +608,7 @@ public class DatabaseDataStore extends DataStore
|
|||||||
//otherwise return the value that's in the table
|
//otherwise return the value that's in the table
|
||||||
else
|
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("Unable to retrieve schema version from database. Details:");
|
||||||
GriefPrevention.AddLogEntry(e.getMessage());
|
GriefPrevention.AddLogEntry(e.getMessage());
|
||||||
|
e.printStackTrace();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -610,6 +610,7 @@ public class FlatFileDataStore extends DataStore
|
|||||||
catch(Exception e)
|
catch(Exception e)
|
||||||
{
|
{
|
||||||
GriefPrevention.AddLogEntry("Unexpected exception saving next claim ID: " + e.getMessage());
|
GriefPrevention.AddLogEntry("Unexpected exception saving next claim ID: " + e.getMessage());
|
||||||
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
//close the file
|
//close the file
|
||||||
|
|||||||
Reference in new issue
Block a user