mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-26 07:06:44 +01:00
Fix load / flush queue before sending message
This commit is contained in:
parent
b2997b7c7b
commit
2bbfec1a32
@ -13,7 +13,6 @@ import com.intellectualcrafters.plot.util.SchematicHandler;
|
|||||||
import com.intellectualcrafters.plot.util.SchematicHandler.Schematic;
|
import com.intellectualcrafters.plot.util.SchematicHandler.Schematic;
|
||||||
import com.intellectualcrafters.plot.util.TaskManager;
|
import com.intellectualcrafters.plot.util.TaskManager;
|
||||||
import com.plotsquared.general.commands.CommandDeclaration;
|
import com.plotsquared.general.commands.CommandDeclaration;
|
||||||
|
|
||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -68,14 +67,14 @@ public class Load extends SubCommand {
|
|||||||
String schematic;
|
String schematic;
|
||||||
try {
|
try {
|
||||||
schematic = schematics.get(Integer.parseInt(args[0]) - 1);
|
schematic = schematics.get(Integer.parseInt(args[0]) - 1);
|
||||||
} catch (NumberFormatException ignored) {
|
} catch (Exception ignored) {
|
||||||
// use /plot load <index>
|
// use /plot load <index>
|
||||||
MainUtil.sendMessage(player, C.NOT_VALID_NUMBER, "(1, " + schematics.size() + ')');
|
MainUtil.sendMessage(player, C.NOT_VALID_NUMBER, "(1, " + schematics.size() + ')');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
final URL url;
|
final URL url;
|
||||||
try {
|
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) {
|
} catch (MalformedURLException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
MainUtil.sendMessage(player, C.LOAD_FAILED);
|
MainUtil.sendMessage(player, C.LOAD_FAILED);
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package com.intellectualcrafters.plot.util;
|
package com.intellectualcrafters.plot.util;
|
||||||
|
|
||||||
import com.google.common.collect.Lists;
|
|
||||||
import com.intellectualcrafters.jnbt.ByteArrayTag;
|
import com.intellectualcrafters.jnbt.ByteArrayTag;
|
||||||
import com.intellectualcrafters.jnbt.CompoundTag;
|
import com.intellectualcrafters.jnbt.CompoundTag;
|
||||||
import com.intellectualcrafters.jnbt.IntTag;
|
import com.intellectualcrafters.jnbt.IntTag;
|
||||||
@ -247,12 +246,9 @@ public abstract class SchematicHandler {
|
|||||||
int i2 = (rz * WIDTH) + i1;
|
int i2 = (rz * WIDTH) + i1;
|
||||||
for (int rx = xxb - p1x; rx <= (xxt - p1x); rx++) {
|
for (int rx = xxb - p1x; rx <= (xxt - p1x); rx++) {
|
||||||
int i = i2 + rx;
|
int i = i2 + rx;
|
||||||
|
|
||||||
int xx = p1x + rx;
|
int xx = p1x + rx;
|
||||||
int zz = p1z + rz;
|
int zz = p1z + rz;
|
||||||
|
|
||||||
int id = ids[i];
|
int id = ids[i];
|
||||||
|
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case 0:
|
case 0:
|
||||||
case 2:
|
case 2:
|
||||||
@ -338,11 +334,11 @@ public abstract class SchematicHandler {
|
|||||||
BlockLoc loc = entry.getKey();
|
BlockLoc loc = entry.getKey();
|
||||||
restoreTile(queue, entry.getValue(), p1x + xOffset + loc.x, loc.y + y_offset_actual, p1z + zOffset + loc.z);
|
restoreTile(queue, entry.getValue(), p1x + xOffset + loc.x, loc.y + y_offset_actual, p1z + zOffset + loc.z);
|
||||||
}
|
}
|
||||||
|
queue.flush();
|
||||||
if (whenDone != null) {
|
if (whenDone != null) {
|
||||||
whenDone.value = true;
|
whenDone.value = true;
|
||||||
whenDone.run();
|
whenDone.run();
|
||||||
}
|
}
|
||||||
queue.flush();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -513,7 +509,7 @@ public abstract class SchematicHandler {
|
|||||||
String schematic = array.getString(i);
|
String schematic = array.getString(i);
|
||||||
schematics.add(schematic);
|
schematics.add(schematic);
|
||||||
}
|
}
|
||||||
return Lists.reverse(schematics);
|
return schematics;
|
||||||
} catch (JSONException | IOException e) {
|
} catch (JSONException | IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
PS.debug("ERROR PARSING: " + rawJSON);
|
PS.debug("ERROR PARSING: " + rawJSON);
|
||||||
|
Loading…
Reference in New Issue
Block a user