Syncronized Update non-cached state fixed

This commit is contained in:
Jascha Starke 2013-10-15 22:59:35 +02:00
parent 65a50d30c0
commit 9eba342758
2 changed files with 6 additions and 12 deletions

View file

@ -3,7 +3,7 @@
<groupId>de.jaschastarke</groupId> <groupId>de.jaschastarke</groupId>
<artifactId>LimitedCreative</artifactId> <artifactId>LimitedCreative</artifactId>
<name>LimitedCreative</name> <name>LimitedCreative</name>
<version>2.1</version> <version>2.1.1-SNAPSHOT</version>
<url>https://github.com/possi/LimitedCreative</url> <url>https://github.com/possi/LimitedCreative</url>
<properties> <properties>

View file

@ -135,21 +135,15 @@ public class SyncronizedModel extends AbstractModel implements DBModel {
} }
public void setState(BlockState state) { public void setState(BlockState state) {
Block block = state.getLocation().getBlock(); Block block = state.getLocation().getBlock();
boolean update = hasMetaBlock(block); boolean store = state != null && (state.isRestricted() || mod.getConfig().getLogSurvival());
boolean store = state.isRestricted() || mod.getConfig().getLogSurvival();
setMetaBlock(block, store ? state : null); setMetaBlock(block, store ? state : null);
try { try {
if (update) { if (!store)
if (!store) q.delete(state);
q.delete(state); else if (!q.update(state))
else if (!q.update(state)) q.insert(state);
q.insert(state);
} else {
if (store)
q.insert(state);
}
} catch (SQLException e) { } catch (SQLException e) {
mod.getLog().severe(e.getMessage()); mod.getLog().severe(e.getMessage());
mod.getLog().warn("Failed to update BlockState in DB at " + block.getLocation().toString()); mod.getLog().warn("Failed to update BlockState in DB at " + block.getLocation().toString());