Skip to content

Commit

Permalink
Major bug fixes with database being locked
Browse files Browse the repository at this point in the history
  • Loading branch information
hsyyid committed Jun 22, 2016
1 parent aa1d2d8 commit bd10d52
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apply plugin: 'eclipse'

sourceCompatibility = 1.8
targetCompatibility = 1.8
version = '0.6.2'
version = '0.6.3'
group = "io.github.hsyyid"
archivesBaseName = "Inspector"

Expand All @@ -26,7 +26,7 @@ repositories {
}

dependencies {
compile "org.spongepowered:spongeapi:4.0.0"
compile "org.spongepowered:spongeapi:4.2.0-SNAPSHOT"
compile "com.github.Flibio:Updatifier:v1.0.0"
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/io/github/hsyyid/inspector/PluginInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ public abstract class PluginInfo
{
public static final String ID = "io.github.hsyyid.inspector";
public static final String NAME = "Inspector";
public static final String VERSION = "0.6.2";
public static final String VERSION = "0.6.3";
public static final String DESCRIPTION = "This plugin enables servers to monitor griefing and provides rollback.";
}
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ public boolean isPlayerInDatabase(Player player)
Connection c = this.getDatabaseConnection();
Statement stmt = c.createStatement();
stmt.executeUpdate("CREATE TABLE IF NOT EXISTS PLAYERS" + "(ID INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL," + " UUID TEXT NOT NULL," + " NAME TEXT NOT NULL)");

stmt.close();

PreparedStatement preparedStmt = c.prepareStatement("SELECT count(*) from PLAYERS WHERE uuid=?");
preparedStmt.setString(1, player.getUniqueId().toString());
ResultSet rs = preparedStmt.executeQuery();
Expand All @@ -134,7 +135,7 @@ public boolean isPlayerInDatabase(Player player)
isInDatabase = rs.getInt(1) > 0;
}

stmt.close();
rs.close();
preparedStmt.close();
}
catch (SQLException e)
Expand Down Expand Up @@ -162,6 +163,7 @@ private int getPlayerId(UUID uniqueId)
id = rs.getInt("id");
}

rs.close();
stmt.close();
}
catch (SQLException e)
Expand All @@ -186,6 +188,7 @@ private UUID getPlayerUniqueId(int id)
return UUID.fromString(rs.getString("uuid"));
}

rs.close();
stmt.close();
}
catch (SQLException e)
Expand All @@ -212,6 +215,7 @@ private String getPlayerName(int id)
name = rs.getString("name");
}

rs.close();
stmt.close();
}
catch (SQLException e)
Expand Down Expand Up @@ -242,6 +246,7 @@ public List<BlockInformation> getBlockInformationAt(Location<World> location)
blockInformation.add(new BlockInformation(location, oldBlockSnapshot, newBlockSnapshot, rs.getString("time"), this.getPlayerUniqueId(id), this.getPlayerName(id)));
}

rs.close();
stmt.close();
}
catch (SQLException e)
Expand Down Expand Up @@ -275,6 +280,7 @@ public List<BlockInformation> getBlockInformationAt(Set<Location<World>> locatio
blockInformation.add(new BlockInformation(location, oldBlockSnapshot, newBlockSnapshot, rs.getString("time"), playerUniqueId, this.getPlayerName(playerId)));
}

rs.close();
stmt.close();
}
catch (SQLException e)
Expand Down

0 comments on commit bd10d52

Please sign in to comment.