Fixes hybridplotworld rotation for stairs
Fixes hybridplotworld skipping non-rotatable blocks on swapped sideroad
schem
Fixes schematic generation using wrong height
Fixes debug spam printed when using download cmd
Fixes pagination having page number instead of total list items
Fixes plot area list page being off by 1
Remove compatibility for a spigot 1.8.0 bug where getting the world name
during initialization crashes the server.
Fixes type 1,2 plot worlds not being fetchable if there are more than 8
plot worlds loaded.
This commit is contained in:
Jesse Boyd 2016-02-26 17:29:31 +11:00
parent c8ddcd7f54
commit 4669f31658
10 changed files with 115 additions and 220 deletions

View File

@ -1,30 +1,5 @@
package com.plotsquared.bukkit;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.UUID;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.OfflinePlayer;
import org.bukkit.Server;
import org.bukkit.World;
import org.bukkit.command.PluginCommand;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.Listener;
import org.bukkit.generator.ChunkGenerator;
import org.bukkit.metadata.MetadataValue;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.java.JavaPlugin;
import com.intellectualcrafters.configuration.ConfigurationSection;
import com.intellectualcrafters.plot.IPlotMain;
import com.intellectualcrafters.plot.PS;
@ -37,67 +12,40 @@ import com.intellectualcrafters.plot.generator.GeneratorWrapper;
import com.intellectualcrafters.plot.generator.HybridGen;
import com.intellectualcrafters.plot.generator.HybridUtils;
import com.intellectualcrafters.plot.generator.IndependentPlotGenerator;
import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotArea;
import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.object.RunnableVal;
import com.intellectualcrafters.plot.object.SetupObject;
import com.intellectualcrafters.plot.util.AbstractTitle;
import com.intellectualcrafters.plot.util.ChatManager;
import com.intellectualcrafters.plot.util.ChunkManager;
import com.intellectualcrafters.plot.util.ConsoleColors;
import com.intellectualcrafters.plot.util.EconHandler;
import com.intellectualcrafters.plot.util.EventUtil;
import com.intellectualcrafters.plot.util.InventoryUtil;
import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.PlotQueue;
import com.intellectualcrafters.plot.util.SchematicHandler;
import com.intellectualcrafters.plot.util.SetupUtils;
import com.intellectualcrafters.plot.util.StringMan;
import com.intellectualcrafters.plot.util.TaskManager;
import com.intellectualcrafters.plot.util.UUIDHandler;
import com.intellectualcrafters.plot.util.UUIDHandlerImplementation;
import com.intellectualcrafters.plot.util.WorldUtil;
import com.intellectualcrafters.plot.object.*;
import com.intellectualcrafters.plot.util.*;
import com.intellectualcrafters.plot.uuid.UUIDWrapper;
import com.plotsquared.bukkit.commands.DebugUUID;
import com.plotsquared.bukkit.database.plotme.ClassicPlotMeConnector;
import com.plotsquared.bukkit.database.plotme.LikePlotMeConverter;
import com.plotsquared.bukkit.database.plotme.PlotMeConnector_017;
import com.plotsquared.bukkit.generator.BukkitPlotGenerator;
import com.plotsquared.bukkit.listeners.ChunkListener;
import com.plotsquared.bukkit.listeners.ForceFieldListener;
import com.plotsquared.bukkit.listeners.PlayerEvents;
import com.plotsquared.bukkit.listeners.PlayerEvents_1_8;
import com.plotsquared.bukkit.listeners.PlayerEvents_1_8_3;
import com.plotsquared.bukkit.listeners.PlotPlusListener;
import com.plotsquared.bukkit.listeners.WorldEvents;
import com.plotsquared.bukkit.listeners.*;
import com.plotsquared.bukkit.listeners.worldedit.WEListener;
import com.plotsquared.bukkit.titles.DefaultTitle;
import com.plotsquared.bukkit.util.BukkitChatManager;
import com.plotsquared.bukkit.util.BukkitChunkManager;
import com.plotsquared.bukkit.util.BukkitCommand;
import com.plotsquared.bukkit.util.BukkitEconHandler;
import com.plotsquared.bukkit.util.BukkitEventUtil;
import com.plotsquared.bukkit.util.BukkitHybridUtils;
import com.plotsquared.bukkit.util.BukkitInventoryUtil;
import com.plotsquared.bukkit.util.BukkitPlainChatManager;
import com.plotsquared.bukkit.util.BukkitSchematicHandler;
import com.plotsquared.bukkit.util.BukkitSetupUtils;
import com.plotsquared.bukkit.util.BukkitTaskManager;
import com.plotsquared.bukkit.util.BukkitUtil;
import com.plotsquared.bukkit.util.Metrics;
import com.plotsquared.bukkit.util.SendChunk;
import com.plotsquared.bukkit.util.SetGenCB;
import com.plotsquared.bukkit.util.*;
import com.plotsquared.bukkit.util.block.FastQueue_1_7;
import com.plotsquared.bukkit.util.block.FastQueue_1_8;
import com.plotsquared.bukkit.util.block.FastQueue_1_8_3;
import com.plotsquared.bukkit.util.block.SlowQueue;
import com.plotsquared.bukkit.uuid.DefaultUUIDWrapper;
import com.plotsquared.bukkit.uuid.FileUUIDHandler;
import com.plotsquared.bukkit.uuid.LowerOfflineUUIDWrapper;
import com.plotsquared.bukkit.uuid.OfflineUUIDWrapper;
import com.plotsquared.bukkit.uuid.SQLUUIDHandler;
import com.plotsquared.bukkit.uuid.*;
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
import org.bukkit.*;
import org.bukkit.Location;
import org.bukkit.command.PluginCommand;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Player;
import org.bukkit.event.Listener;
import org.bukkit.generator.ChunkGenerator;
import org.bukkit.metadata.MetadataValue;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.java.JavaPlugin;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.*;
public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
@ -346,19 +294,10 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
@Override
final public ChunkGenerator getDefaultWorldGenerator(final String world, final String id) {
WorldEvents.lastWorld = world;
final HybridGen result = new HybridGen();
if (!PS.get().setupPlotWorld(world, id, result)) {
return null;
}
TaskManager.runTaskLater(new Runnable() {
@Override
public void run() {
if ((WorldEvents.lastWorld != null) && WorldEvents.lastWorld.equals(world)) {
WorldEvents.lastWorld = null;
}
}
}, 20);
return (ChunkGenerator) result.specify();
}

View File

@ -20,33 +20,27 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.plotsquared.bukkit.generator;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import java.util.Set;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.generator.GeneratorWrapper;
import com.intellectualcrafters.plot.generator.HybridGen;
import com.intellectualcrafters.plot.generator.IndependentPlotGenerator;
import com.intellectualcrafters.plot.object.*;
import com.intellectualcrafters.plot.util.ChunkManager;
import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.PlotChunk;
import com.intellectualcrafters.plot.util.SetQueue;
import com.plotsquared.bukkit.util.BukkitUtil;
import com.plotsquared.bukkit.util.block.GenChunk;
import org.bukkit.Chunk;
import org.bukkit.World;
import org.bukkit.block.Biome;
import org.bukkit.generator.BlockPopulator;
import org.bukkit.generator.ChunkGenerator;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.generator.GeneratorWrapper;
import com.intellectualcrafters.plot.generator.HybridGen;
import com.intellectualcrafters.plot.generator.IndependentPlotGenerator;
import com.intellectualcrafters.plot.object.PlotArea;
import com.intellectualcrafters.plot.object.PlotId;
import com.intellectualcrafters.plot.object.PlotManager;
import com.intellectualcrafters.plot.object.PseudoRandom;
import com.intellectualcrafters.plot.object.SetupObject;
import com.intellectualcrafters.plot.util.ChunkManager;
import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.PlotChunk;
import com.intellectualcrafters.plot.util.SetQueue;
import com.plotsquared.bukkit.listeners.WorldEvents;
import com.plotsquared.bukkit.util.BukkitUtil;
import com.plotsquared.bukkit.util.block.GenChunk;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import java.util.Set;
public class BukkitPlotGenerator extends ChunkGenerator implements GeneratorWrapper<ChunkGenerator> {
@ -96,7 +90,6 @@ public class BukkitPlotGenerator extends ChunkGenerator implements GeneratorWrap
throw new IllegalArgumentException("ChunkGenerator: " + cg.getClass().getName() + " is already a BukkitPlotGenerator!");
}
this.full = false;
WorldEvents.lastWorld = world;
PS.get().debug("BukkitPlotGenerator does not fully support: " + cg);
platformGenerator = cg;
plotGenerator = new IndependentPlotGenerator() {
@ -205,7 +198,7 @@ public class BukkitPlotGenerator extends ChunkGenerator implements GeneratorWrap
public List<BlockPopulator> getDefaultPopulators(final World world) {
try {
if (!loaded) {
final String name = WorldEvents.getName(world);
final String name = world.getName();
PS.get().loadWorld(name, this);
Set<PlotArea> areas = PS.get().getPlotAreas(name);
if (!areas.isEmpty()) {
@ -265,7 +258,7 @@ public class BukkitPlotGenerator extends ChunkGenerator implements GeneratorWrap
public void generate(World world, int cx, int cz, GenChunk result) {
// Load if improperly loaded
if (!loaded) {
final String name = WorldEvents.getName(world);
final String name = world.getName();
PS.get().loadWorld(name, this);
loaded = true;
}

View File

@ -13,20 +13,10 @@ import com.plotsquared.bukkit.generator.BukkitPlotGenerator;
public class WorldEvents implements Listener {
public static String lastWorld = null;
public static String getName(final World world) {
if ((lastWorld != null) && !lastWorld.equals("CheckingPlotSquaredGenerator")) {
return lastWorld;
} else {
return world.getName();
}
}
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public static void onWorldInit(final WorldInitEvent event) {
final World world = event.getWorld();
final String name = getName(world);
final String name = world.getName();
final ChunkGenerator gen = world.getGenerator();
if (gen instanceof GeneratorWrapper) {
PS.get().loadWorld(name, (GeneratorWrapper<?>) gen);
@ -35,6 +25,5 @@ public class WorldEvents implements Listener {
PS.get().loadWorld(name, new BukkitPlotGenerator(name, gen));
}
}
lastWorld = null;
}
}

View File

@ -616,19 +616,17 @@ public class PS {
globalAreas.add(plotarea);
plotareas = globalAreas.toArray(new PlotArea[globalAreas.size()]);
plotareamap.put(plotarea.worldname, localAreas.toArray(new PlotArea[localAreas.size()]));
if (plotarea.TYPE == 2) {
QuadMap<PlotArea> map = plotareagrid.get(plotarea.worldname);
if (map == null) {
map = new QuadMap<PlotArea>(Integer.MAX_VALUE, 0, 0) {
@Override
public RegionWrapper getRegion(PlotArea value) {
return value.getRegion();
}
};
plotareagrid.put(plotarea.worldname, map);
}
map.add(plotarea);
QuadMap<PlotArea> map = plotareagrid.get(plotarea.worldname);
if (map == null) {
map = new QuadMap<PlotArea>(Integer.MAX_VALUE, 0, 0) {
@Override
public RegionWrapper getRegion(PlotArea value) {
return value.getRegion();
}
};
plotareagrid.put(plotarea.worldname, map);
}
map.add(plotarea);
}
/**
@ -1354,7 +1352,9 @@ public class PS {
* @param baseGenerator The generator for that world, or null if no generator
*/
public void loadWorld(final String world, final GeneratorWrapper<?> baseGenerator) {
System.out.println("LOADING WORLD!? " + world);
if (world.equals("CheckingPlotSquaredGenerator")) {
System.out.println("IS CHECK" + world);
return;
}
final Set<String> worlds = (config.contains("worlds") ? config.getConfigurationSection("worlds").getKeys(false) : new HashSet<String>());
@ -1383,11 +1383,13 @@ public class PS {
pg = primaryGenerator.getPlotGenerator();
}
else {
System.out.println("NO GENERATOR?! " + world);
return;
}
}
}
else {
System.out.println("NO WORLD SECTION?! " + world);
return;
}
// Conventional plot generator
@ -1413,7 +1415,9 @@ public class PS {
pg.initialize(plotArea);
plotArea.setupBorder();
} else {
System.out.println("NOT TYPE 0 " + world);
if (!worlds.contains(world)) {
System.out.println("WORLD DOESN'T EXIST " + world);
return;
}
ConfigurationSection areasSection = worldSection.getConfigurationSection("areas");
@ -1465,6 +1469,7 @@ public class PS {
for (PlotArea area : toLoad) {
addPlotArea(area);
}
System.out.println("ADDED BY CLUSTER! " + world);
return;
}
GeneratorWrapper<?> areaGen = IMP.getGenerator(world, gen_string);
@ -1485,6 +1490,7 @@ public class PS {
areaGen.getPlotGenerator().initialize(pa);
areaGen.augment(pa);
addPlotArea(pa);
System.out.println("ADDED BY AUG! " + world);
return;
}
if (type == 1) {
@ -1560,6 +1566,7 @@ public class PS {
areaGen.getPlotGenerator().initialize(pa);
areaGen.augment(pa);
addPlotArea(pa);
System.out.println("ADDED BY PART! " + world);
}
}
}

View File

@ -335,7 +335,7 @@ public class Area extends SubCommand {
break;
case 2:
if (MathMan.isInteger(args[1])) {
page = Integer.parseInt(args[1]);
page = Integer.parseInt(args[1]) - 1;
break;
}
default:

View File

@ -68,7 +68,7 @@ public abstract class SubCommand extends com.plotsquared.general.commands.Comman
max = c.size();
}
// Send the header
header = header.replaceAll("%cur", page + 1 + "").replaceAll("%max", totalPages + 1 + "").replaceAll("%amount%", totalPages + "").replaceAll("%word%", "all");
header = header.replaceAll("%cur", page + 1 + "").replaceAll("%max", totalPages + 1 + "").replaceAll("%amount%", c.size() + "").replaceAll("%word%", "all");
MainUtil.sendMessage(player, header);
// Send the page content
final List<T> subList = c.subList(page * size, max);

View File

@ -1,16 +1,12 @@
package com.intellectualcrafters.plot.generator;
import com.intellectualcrafters.plot.object.*;
import com.intellectualcrafters.plot.util.MathMan;
import com.intellectualcrafters.plot.util.PlotChunk;
import java.util.HashMap;
import java.util.Map.Entry;
import com.intellectualcrafters.plot.object.PlotArea;
import com.intellectualcrafters.plot.object.PlotBlock;
import com.intellectualcrafters.plot.object.PlotId;
import com.intellectualcrafters.plot.object.PlotManager;
import com.intellectualcrafters.plot.object.PseudoRandom;
import com.intellectualcrafters.plot.util.MathMan;
import com.intellectualcrafters.plot.util.PlotChunk;
public class HybridGen extends IndependentPlotGenerator {
@Override
@ -80,7 +76,7 @@ public class HybridGen extends IndependentPlotGenerator {
result.setBlock(x, y, z, hpw.ROAD_BLOCK);
}
if (hpw.ROAD_SCHEMATIC_ENABLED) {
HashMap<Integer, PlotBlock> map = sch.get(MathMan.pair(x, z));
HashMap<Integer, PlotBlock> map = sch.get(MathMan.pair(rx[x], rz[z]));
if (map != null) {
for (Entry<Integer, PlotBlock> entry : map.entrySet()) {
result.setBlock(x, entry.getKey(), z, entry.getValue());
@ -96,7 +92,7 @@ public class HybridGen extends IndependentPlotGenerator {
result.setBlock(x, y, z, hpw.ROAD_BLOCK);
}
if (hpw.ROAD_SCHEMATIC_ENABLED) {
HashMap<Integer, PlotBlock> map = sch.get(MathMan.pair(x, z));
HashMap<Integer, PlotBlock> map = sch.get(MathMan.pair(rx[x], rz[z]));
if (map != null) {
for (Entry<Integer, PlotBlock> entry : map.entrySet()) {
result.setBlock(x, entry.getKey(), z, entry.getValue());
@ -111,7 +107,7 @@ public class HybridGen extends IndependentPlotGenerator {
if (!hpw.ROAD_SCHEMATIC_ENABLED) {
result.setBlock(x, hpw.WALL_HEIGHT + 1, z, hpw.WALL_BLOCK);
} else {
HashMap<Integer, PlotBlock> map = sch.get(MathMan.pair(x, z));
HashMap<Integer, PlotBlock> map = sch.get(MathMan.pair(rx[x], rz[z]));
if (map != null) {
for (Entry<Integer, PlotBlock> entry : map.entrySet()) {
result.setBlock(x, entry.getKey(), z, entry.getValue());
@ -128,7 +124,7 @@ public class HybridGen extends IndependentPlotGenerator {
result.setBlock(x, y, z, hpw.ROAD_BLOCK);
}
if (hpw.ROAD_SCHEMATIC_ENABLED) {
HashMap<Integer, PlotBlock> map = sch.get(MathMan.pair(x, z));
HashMap<Integer, PlotBlock> map = sch.get(MathMan.pair(rx[x], rz[z]));
if (map != null) {
for (Entry<Integer, PlotBlock> entry : map.entrySet()) {
result.setBlock(x, entry.getKey(), z, entry.getValue());
@ -143,7 +139,7 @@ public class HybridGen extends IndependentPlotGenerator {
if (!hpw.ROAD_SCHEMATIC_ENABLED) {
result.setBlock(x, hpw.WALL_HEIGHT + 1, z, hpw.WALL_BLOCK);
} else {
HashMap<Integer, PlotBlock> map = sch.get(MathMan.pair(x, z));
HashMap<Integer, PlotBlock> map = sch.get(MathMan.pair(rx[x], rz[z]));
if (map != null) {
for (Entry<Integer, PlotBlock> entry : map.entrySet()) {
result.setBlock(x, entry.getKey(), z, entry.getValue());
@ -157,7 +153,7 @@ public class HybridGen extends IndependentPlotGenerator {
}
result.setBlock(x, hpw.PLOT_HEIGHT, z, hpw.TOP_BLOCK[random.random(hpw.TOP_BLOCK.length)]);
if (hpw.PLOT_SCHEMATIC) {
HashMap<Integer, PlotBlock> map = sch.get(MathMan.pair(x, z));
HashMap<Integer, PlotBlock> map = sch.get(MathMan.pair(rx[x], rz[z]));
if (map != null) {
for (Entry<Integer, PlotBlock> entry : map.entrySet()) {
result.setBlock(x, entry.getKey(), z, entry.getValue());

View File

@ -85,7 +85,7 @@ public class HybridPlotManager extends ClassicPlotManager {
final Location top = getPlotTopLocAbs(hpw, id);
final Location pos1 = new Location(plotworld.worldname, top.getX() + 1, 0, bot.getZ() - 1);
final Location pos2 = new Location(plotworld.worldname, bot.getX(), 255, top.getZ() + 1);
createSchemAbs(hpw, pos1, pos2, hpw.ROAD_HEIGHT, true);
createSchemAbs(hpw, pos1, pos2, 0, true);
return true;
}
@ -104,7 +104,7 @@ public class HybridPlotManager extends ClassicPlotManager {
final HashMap<Integer, PlotBlock> blocks = hpw.G_SCH.get(MathMan.pair(absX, absZ));
if (clear) {
for (short y = (short) (height); y <= (height + hpw.SCHEMATIC_HEIGHT); y++) {
SetQueue.IMP.setBlock(hpw.worldname, x, y + y, z, 0);
SetQueue.IMP.setBlock(hpw.worldname, x, y, z, 0);
}
}
if (blocks != null) {
@ -129,7 +129,7 @@ public class HybridPlotManager extends ClassicPlotManager {
final Location top = getPlotTopLocAbs(hpw, id);
final Location pos1 = new Location(plotworld.worldname, bot.getX() - 1, 0, top.getZ() + 1);
final Location pos2 = new Location(plotworld.worldname, top.getX() + 1, 255, bot.getZ());
createSchemAbs(hpw, pos1, pos2, hpw.ROAD_HEIGHT, true);
createSchemAbs(hpw, pos1, pos2, 0, true);
return true;
}
@ -146,7 +146,7 @@ public class HybridPlotManager extends ClassicPlotManager {
final Location pos2 = getPlotBottomLocAbs(hpw, id2);
pos1.setY(0);
pos2.setY(256);
createSchemAbs(hpw, pos1, pos2, hpw.ROAD_HEIGHT, true);
createSchemAbs(hpw, pos1, pos2, 0, true);
return true;
}
@ -214,7 +214,6 @@ public class HybridPlotManager extends ClassicPlotManager {
if (!plotworld.PLOT_SCHEMATIC) {
return;
}
createSchemAbs(plotworld, l1, l2, plotworld.PLOT_HEIGHT, false);
createSchemAbs(plotworld, l1, l2, 0, false);
}
}

View File

@ -98,7 +98,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
data = wrap(data, 0);
data = wrap(data, 4);
data = wrap(data, 8);
data = wrap(data, 16);
data = wrap(data, 12);
return data;
case 26:
@ -225,7 +225,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
final short id = ids[index];
final byte data = datas[index];
if (id != 0) {
addOverlayBlock((short) (x + shift + oddshift + center_shift_x), y, (short) (z + shift + oddshift + center_shift_z), id,
addOverlayBlock((short) (x + shift + oddshift + center_shift_x), (short) (y + PLOT_HEIGHT), (short) (z + shift + oddshift + center_shift_z), id,
data, false);
}
}
@ -241,10 +241,14 @@ public class HybridPlotWorld extends ClassicPlotWorld {
final short x = (short) item.x;
final short z = (short) item.z;
int pair = MathMan.pair(x, z);
HashSet<PlotItem> v = G_SCH_STATE.putIfAbsent(pair, new HashSet<PlotItem>());
if (v != null) {
v.add(item);
HashSet<PlotItem> existing = G_SCH_STATE.get(pair);
if (existing == null) {
existing = new HashSet<>();
G_SCH_STATE.put(pair, existing);
}
existing.add(item);
}
}
}
@ -278,8 +282,8 @@ public class HybridPlotWorld extends ClassicPlotWorld {
final short id = ids1[index];
final byte data = datas1[index];
if (id != 0) {
addOverlayBlock((short) (x - shift), y, (short) (z + shift + oddshift), id, data, false);
addOverlayBlock((short) (z + shift + oddshift), y, (short) (x - shift), id, data, true);
addOverlayBlock((short) (x - shift), (short) (y + ROAD_HEIGHT), (short) (z + shift + oddshift), id, data, false);
addOverlayBlock((short) (z + shift + oddshift), (short) (y + ROAD_HEIGHT), (short) (x - shift), id, data, true);
}
}
}
@ -291,7 +295,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
final short id = ids2[index];
final byte data = datas2[index];
if (id != 0) {
addOverlayBlock((short) (x - shift), y, (short) (z - shift), id, data, false);
addOverlayBlock((short) (x - shift), (short) (y + ROAD_HEIGHT), (short) (z - shift), id, data, false);
}
}
}
@ -307,15 +311,16 @@ public class HybridPlotWorld extends ClassicPlotWorld {
}
if (rotate) {
final byte newdata = rotate(id, data);
if (data == 0 && newdata == 0) {
return;
if (data != 0 || newdata != 0) {
data = newdata;
}
data = newdata;
}
int pair = MathMan.pair(x, y);
HashMap<Integer, PlotBlock> v = G_SCH.putIfAbsent(pair, new HashMap<Integer, PlotBlock>());
if (v != null) {
v.put((int) y, new PlotBlock(id, data));
int pair = MathMan.pair(x, z);
HashMap<Integer, PlotBlock> existing = G_SCH.get(pair);
if (existing == null) {
existing = new HashMap<>();
G_SCH.put(pair, existing);
}
existing.put((int) y, new PlotBlock(id, data));
}
}

View File

@ -1,56 +1,23 @@
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;
import com.intellectualcrafters.jnbt.ListTag;
import com.intellectualcrafters.jnbt.NBTInputStream;
import com.intellectualcrafters.jnbt.NBTOutputStream;
import com.intellectualcrafters.jnbt.ShortTag;
import com.intellectualcrafters.jnbt.StringTag;
import com.intellectualcrafters.jnbt.Tag;
import com.intellectualcrafters.jnbt.*;
import com.intellectualcrafters.json.JSONArray;
import com.intellectualcrafters.json.JSONException;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.generator.ClassicPlotWorld;
import com.intellectualcrafters.plot.object.ChunkLoc;
import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotArea;
import com.intellectualcrafters.plot.object.PlotBlock;
import com.intellectualcrafters.plot.object.RegionWrapper;
import com.intellectualcrafters.plot.object.RunnableVal;
import com.intellectualcrafters.plot.object.*;
import com.intellectualcrafters.plot.object.schematic.PlotItem;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.Reader;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
import java.nio.channels.Channels;
import java.nio.channels.ReadableByteChannel;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import java.util.*;
import java.util.zip.GZIPInputStream;
import java.util.zip.GZIPOutputStream;
@ -583,22 +550,22 @@ public abstract class SchematicHandler {
writer.append("--" + boundary + "--").append(CRLF).flush();
nos.close();
}
try (Reader response = new InputStreamReader(con.getInputStream(), StandardCharsets.UTF_8)) {
final char[] buffer = new char[256];
final StringBuilder result = new StringBuilder();
while (true) {
final int r = response.read(buffer);
if (r < 0) {
break;
}
result.append(buffer, 0, r);
}
if (!result.toString().equals("The file plot.schematic has been uploaded.")) {
PS.debug(result);
}
} catch (IOException e) {
e.printStackTrace();
}
// try (Reader response = new InputStreamReader(con.getInputStream(), StandardCharsets.UTF_8)) {
// final char[] buffer = new char[256];
// final StringBuilder result = new StringBuilder();
// while (true) {
// final int r = response.read(buffer);
// if (r < 0) {
// break;
// }
// result.append(buffer, 0, r);
// }
// if (!result.toString().equals("The file plot.schematic has been uploaded.")) {
// PS.debug(result);
// }
// } catch (IOException e) {
// e.printStackTrace();
// }
final int responseCode = ((HttpURLConnection) con).getResponseCode();
if (responseCode != 200) {
return null;