From 9eba3427582e9b3ffa4ca8bbd29d48edd9263c62 Mon Sep 17 00:00:00 2001 From: Jascha Starke Date: Tue, 15 Oct 2013 22:59:35 +0200 Subject: [PATCH] Syncronized Update non-cached state fixed --- pom.xml | 2 +- .../blockstate/SyncronizedModel.java | 16 +++++----------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/pom.xml b/pom.xml index 4a6c4f0..352800f 100644 --- a/pom.xml +++ b/pom.xml @@ -3,7 +3,7 @@ de.jaschastarke LimitedCreative LimitedCreative - 2.1 + 2.1.1-SNAPSHOT https://github.com/possi/LimitedCreative diff --git a/src/main/java/de/jaschastarke/minecraft/limitedcreative/blockstate/SyncronizedModel.java b/src/main/java/de/jaschastarke/minecraft/limitedcreative/blockstate/SyncronizedModel.java index 7a5633f..40beffe 100644 --- a/src/main/java/de/jaschastarke/minecraft/limitedcreative/blockstate/SyncronizedModel.java +++ b/src/main/java/de/jaschastarke/minecraft/limitedcreative/blockstate/SyncronizedModel.java @@ -135,21 +135,15 @@ public class SyncronizedModel extends AbstractModel implements DBModel { } public void setState(BlockState state) { Block block = state.getLocation().getBlock(); - boolean update = hasMetaBlock(block); - boolean store = state.isRestricted() || mod.getConfig().getLogSurvival(); + boolean store = state != null && (state.isRestricted() || mod.getConfig().getLogSurvival()); setMetaBlock(block, store ? state : null); try { - if (update) { - if (!store) - q.delete(state); - else if (!q.update(state)) - q.insert(state); - } else { - if (store) - q.insert(state); - } + if (!store) + q.delete(state); + else if (!q.update(state)) + q.insert(state); } catch (SQLException e) { mod.getLog().severe(e.getMessage()); mod.getLog().warn("Failed to update BlockState in DB at " + block.getLocation().toString());