mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-06-25 02:04:44 +02:00
Fixes
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:
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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:
|
||||
|
@ -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);
|
||||
|
@ -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());
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
@ -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;
|
||||
|
Reference in New Issue
Block a user