Skip to content

Commit

Permalink
fixed an issue where the insert was done to the wrong part
Browse files Browse the repository at this point in the history
  • Loading branch information
KasperFranz committed Jun 12, 2017
1 parent 7761f14 commit e558ab8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ This project adheres to [Semantic Versioning](http://semver.org/ ), and followin
### Fixed


## 2017-06-12 3.4.0
### Fixed
- fixed an issue where the insert was done to the wrong part (world add as personal and persoanl as world, if using the add while nothing was in the DB)


## 2017-04-21 3.3.0
### Changed
- Using the gameStoppingEvent instead of the GameStopped event to be sure that we can unforce properly.
Expand Down
16 changes: 8 additions & 8 deletions src/main/java/net/kaikk/mc/bcl/datastore/MySqlDataStore.java
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ public void setAlwaysOnChunksLimit(UUID playerId, int amount) {
super.setAlwaysOnChunksLimit(playerId, amount);
try {
this.statement().executeUpdate(
"INSERT INTO bcl_playersdata VALUES (" + UUIDtoHexString(playerId) + ", " + amount + ", " + Config.getConfig().get()
"INSERT INTO bcl_playersdata (pid,alwayson,onlineonly) VALUES (" + UUIDtoHexString(playerId) + ", " + amount + ", " + Config.getConfig().get()
.getNode("DefaultChunksAmount").getNode("World").getInt() + ") ON DUPLICATE KEY UPDATE alwayson=" + amount);
} catch (SQLException e) {
e.printStackTrace();
Expand All @@ -193,7 +193,7 @@ public void setAlwaysOnChunksLimit(UUID playerId, int amount) {
public void setOnlineOnlyChunksLimit(UUID playerId, int amount) {
super.setOnlineOnlyChunksLimit(playerId, amount);
try {
this.statement().executeUpdate("INSERT INTO bcl_playersdata VALUES (" + UUIDtoHexString(playerId) + ", " + Config.getConfig().get()
this.statement().executeUpdate("INSERT INTO bcl_playersdata (pid,alwayson,onlineonly) VALUES (" + UUIDtoHexString(playerId) + ", " + Config.getConfig().get()
.getNode("DefaultChunksAmount").getNode("Personal").getInt() + ", " + amount + ") ON DUPLICATE KEY UPDATE onlineonly=" + amount);
} catch (SQLException e) {
e.printStackTrace();
Expand All @@ -205,11 +205,11 @@ public void addAlwaysOnChunksLimit(UUID playerId, int amount) {
super.addAlwaysOnChunksLimit(playerId, amount);
try {
int world = Config.getConfig().get()
.getNode("DefaultChunksAmount").getNode("World").getInt();
.getNode("DefaultChunksAmount").getNode("World").getInt()+amount;
int personal = Config.getConfig().get()
.getNode("DefaultChunksAmount").getNode("Personal").getInt()+amount;
.getNode("DefaultChunksAmount").getNode("Personal").getInt();
this.statement().executeUpdate(
"INSERT INTO bcl_playersdata VALUES (" + UUIDtoHexString(playerId) + ", " + personal + ", " + world + ") ON DUPLICATE KEY "
"INSERT INTO bcl_playersdata (pid,alwayson,onlineonly) VALUES (" + UUIDtoHexString(playerId) + ", " + world+","+personal + ") ON DUPLICATE KEY "
+ "UPDATE "
+ "alwayson=alwayson+" + amount);
} catch (SQLException e) {
Expand All @@ -222,10 +222,10 @@ public void addOnlineOnlyChunksLimit(UUID playerId, int amount) {
super.addOnlineOnlyChunksLimit(playerId, amount);
try {
int world = Config.getConfig().get()
.getNode("DefaultChunksAmount").getNode("World").getInt()+amount;
.getNode("DefaultChunksAmount").getNode("World").getInt();
int personal = Config.getConfig().get()
.getNode("DefaultChunksAmount").getNode("Personal").getInt();
this.statement().executeUpdate("INSERT INTO bcl_playersdata VALUES (" + UUIDtoHexString(playerId) + ", " + personal + ", " + world +
.getNode("DefaultChunksAmount").getNode("Personal").getInt()+amount;
this.statement().executeUpdate("INSERT INTO bcl_playersdata (pid,alwayson,onlineonly) VALUES (" + UUIDtoHexString(playerId) + ", " + world + ", " + personal +
") "
+ "ON DUPLICATE KEY UPDATE onlineonly=onlineonly+"
+ amount);
Expand Down

0 comments on commit e558ab8

Please sign in to comment.