From 2bbfec1a32efc81c882a44e48fb5fdee7f64ebe6 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Thu, 16 Jun 2016 17:31:02 +1000 Subject: [PATCH] Fix load / flush queue before sending message --- .../java/com/intellectualcrafters/plot/commands/Load.java | 5 ++--- .../intellectualcrafters/plot/util/SchematicHandler.java | 8 ++------ 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/Load.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/Load.java index 33ad0d795..b8073f9cd 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/Load.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/Load.java @@ -13,7 +13,6 @@ import com.intellectualcrafters.plot.util.SchematicHandler; import com.intellectualcrafters.plot.util.SchematicHandler.Schematic; import com.intellectualcrafters.plot.util.TaskManager; import com.plotsquared.general.commands.CommandDeclaration; - import java.net.MalformedURLException; import java.net.URL; import java.util.List; @@ -68,14 +67,14 @@ public class Load extends SubCommand { String schematic; try { schematic = schematics.get(Integer.parseInt(args[0]) - 1); - } catch (NumberFormatException ignored) { + } catch (Exception ignored) { // use /plot load MainUtil.sendMessage(player, C.NOT_VALID_NUMBER, "(1, " + schematics.size() + ')'); return false; } final URL url; try { - url = new URL(Settings.Web.URL + "saves/" + player.getUUID() + '/' + schematic + ".schematic"); + url = new URL(Settings.Web.URL + "saves/" + player.getUUID() + '/' + schematic); } catch (MalformedURLException e) { e.printStackTrace(); MainUtil.sendMessage(player, C.LOAD_FAILED); diff --git a/Core/src/main/java/com/intellectualcrafters/plot/util/SchematicHandler.java b/Core/src/main/java/com/intellectualcrafters/plot/util/SchematicHandler.java index 56278eb74..1efbe047a 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/util/SchematicHandler.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/util/SchematicHandler.java @@ -1,6 +1,5 @@ package com.intellectualcrafters.plot.util; -import com.google.common.collect.Lists; import com.intellectualcrafters.jnbt.ByteArrayTag; import com.intellectualcrafters.jnbt.CompoundTag; import com.intellectualcrafters.jnbt.IntTag; @@ -247,12 +246,9 @@ public abstract class SchematicHandler { int i2 = (rz * WIDTH) + i1; for (int rx = xxb - p1x; rx <= (xxt - p1x); rx++) { int i = i2 + rx; - int xx = p1x + rx; int zz = p1z + rz; - int id = ids[i]; - switch (id) { case 0: case 2: @@ -338,11 +334,11 @@ public abstract class SchematicHandler { BlockLoc loc = entry.getKey(); restoreTile(queue, entry.getValue(), p1x + xOffset + loc.x, loc.y + y_offset_actual, p1z + zOffset + loc.z); } + queue.flush(); if (whenDone != null) { whenDone.value = true; whenDone.run(); } - queue.flush(); } } }); @@ -513,7 +509,7 @@ public abstract class SchematicHandler { String schematic = array.getString(i); schematics.add(schematic); } - return Lists.reverse(schematics); + return schematics; } catch (JSONException | IOException e) { e.printStackTrace(); PS.debug("ERROR PARSING: " + rawJSON);