mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 05:06:44 +01:00
Bump version / misc
Fix regenallroads Add schematic y_offset Change visit/list for multi-owner plots Fix updater (pre-1.7.10)
This commit is contained in:
parent
109715e0d7
commit
f00ac79c91
@ -34,7 +34,7 @@ public class GenChunk extends PlotChunk<Chunk> {
|
|||||||
@Override
|
@Override
|
||||||
public Chunk getChunkAbs() {
|
public Chunk getChunkAbs() {
|
||||||
ChunkWrapper wrap = getChunkWrapper();
|
ChunkWrapper wrap = getChunkWrapper();
|
||||||
if (wrap.x != chunk.getX() || wrap.z != chunk.getZ()) {
|
if (chunk == null || wrap.x != chunk.getX() || wrap.z != chunk.getZ()) {
|
||||||
chunk = BukkitUtil.getWorld(wrap.world).getChunkAt(wrap.x, wrap.z);
|
chunk = BukkitUtil.getWorld(wrap.world).getChunkAt(wrap.x, wrap.z);
|
||||||
}
|
}
|
||||||
return chunk;
|
return chunk;
|
||||||
@ -65,9 +65,14 @@ public class GenChunk extends PlotChunk<Chunk> {
|
|||||||
modified = true;
|
modified = true;
|
||||||
result[i] = v = new short[4096];
|
result[i] = v = new short[4096];
|
||||||
}
|
}
|
||||||
v[MainUtil.CACHE_J[y][x][z]] = (short) id;
|
int j = MainUtil.CACHE_J[y][x][z];
|
||||||
|
v[j] = (short) id;
|
||||||
if (data != 0) {
|
if (data != 0) {
|
||||||
getChunk().getBlock(x, y, z).setData(data);
|
byte[] vd = result_data[i];
|
||||||
|
if (vd == null) {
|
||||||
|
result_data[i] = vd = new byte[4096];
|
||||||
|
}
|
||||||
|
vd[j] = data;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1332,6 +1332,10 @@ public class PS {
|
|||||||
return getPlots(player.getUUID());
|
return getPlots(player.getUUID());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Set<Plot> getBasePlots(final PlotPlayer player) {
|
||||||
|
return getBasePlots(player.getUUID());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the plots for a UUID
|
* Get the plots for a UUID
|
||||||
* @param uuid
|
* @param uuid
|
||||||
@ -1350,6 +1354,19 @@ public class PS {
|
|||||||
return new HashSet<>(myplots);
|
return new HashSet<>(myplots);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Set<Plot> getBasePlots(final UUID uuid) {
|
||||||
|
final ArrayList<Plot> myplots = new ArrayList<>();
|
||||||
|
foreachBasePlot(new RunnableVal<Plot>() {
|
||||||
|
@Override
|
||||||
|
public void run(Plot value) {
|
||||||
|
if (value.isOwner(uuid)) {
|
||||||
|
myplots.add(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return new HashSet<>(myplots);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the plots for a UUID
|
* Get the plots for a UUID
|
||||||
* @param uuid
|
* @param uuid
|
||||||
|
@ -1,16 +1,15 @@
|
|||||||
package com.intellectualcrafters.plot;
|
package com.intellectualcrafters.plot;
|
||||||
|
|
||||||
import static com.intellectualcrafters.plot.PS.log;
|
import com.intellectualcrafters.json.JSONArray;
|
||||||
|
import com.intellectualcrafters.json.JSONObject;
|
||||||
import com.google.gson.Gson;
|
|
||||||
import com.google.gson.annotations.SerializedName;
|
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.List;
|
|
||||||
|
import static com.intellectualcrafters.plot.PS.log;
|
||||||
|
|
||||||
public class Updater {
|
public class Updater {
|
||||||
|
|
||||||
@ -44,42 +43,32 @@ public class Updater {
|
|||||||
|
|
||||||
public static URL getUpdate() {
|
public static URL getUpdate() {
|
||||||
String str = readUrl("https://api.github.com/repos/IntellectualSites/PlotSquared/releases/latest");
|
String str = readUrl("https://api.github.com/repos/IntellectualSites/PlotSquared/releases/latest");
|
||||||
Gson gson = new Gson();
|
JSONObject release = new JSONObject(str);
|
||||||
URL url = null;
|
JSONArray assets = (JSONArray) release.get("assets");
|
||||||
Release release = gson.fromJson(str, Release.class);
|
|
||||||
String downloadURL = String.format("PlotSquared-%s%n.jar", PS.get().getPlatform());
|
String downloadURL = String.format("PlotSquared-%s%n.jar", PS.get().getPlatform());
|
||||||
List<Release.Asset> assets = release.assets;
|
for (int i = 0; i < assets.length(); i++) {
|
||||||
for (Release.Asset asset : assets) {
|
JSONObject asset = assets.getJSONObject(i);
|
||||||
if (asset.name.equals(downloadURL)) {
|
String name = asset.getString("name");
|
||||||
|
if (downloadURL.equals(name)) {
|
||||||
try {
|
try {
|
||||||
url = new URL(asset.downloadUrl);
|
String version = release.getString("name");
|
||||||
break;
|
URL url = new URL(asset.getString("downloadUrl"));
|
||||||
|
if (!PS.get().canUpdate(PS.get().config.getString("version"), version)) {
|
||||||
|
PS.debug("&7PlotSquared is already up to date!");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
log("&6PlotSquared " + version + " is available:");
|
||||||
|
log("&8 - &3Use: &7/plot update");
|
||||||
|
log("&8 - &3Or: &7" + downloadURL);
|
||||||
|
return url;
|
||||||
} catch (MalformedURLException e) {
|
} catch (MalformedURLException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
log("&dCould not check for updates (0)");
|
log("&dCould not check for updates (1)");
|
||||||
log("&7 - Manually check for updates: https://github.com/IntellectualSites/PlotSquared/releases");
|
log("&7 - Manually check for updates: https://github.com/IntellectualSites/PlotSquared/releases");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!PS.get().canUpdate(PS.get().config.getString("version"), release.name)) {
|
log("You are running the latest version of PlotSquared");
|
||||||
PS.debug("&7PlotSquared is already up to date!");
|
return null;
|
||||||
return null;
|
|
||||||
}
|
|
||||||
log("&6PlotSquared " + release.tagName + " is available:");
|
|
||||||
log("&8 - &3Use: &7/plot update");
|
|
||||||
log("&8 - &3Or: &7" + downloadURL);
|
|
||||||
return url;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private static class Release {
|
|
||||||
public String name;
|
|
||||||
@SerializedName("tag_name") String tagName;
|
|
||||||
List<Asset> assets;
|
|
||||||
static class Asset {
|
|
||||||
public String name;
|
|
||||||
@SerializedName("browser_download_url") String downloadUrl;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,7 @@ public class Claim extends SubCommand {
|
|||||||
sch = SchematicHandler.manager.getSchematic(plotworld.SCHEMATIC_FILE);
|
sch = SchematicHandler.manager.getSchematic(plotworld.SCHEMATIC_FILE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SchematicHandler.manager.paste(sch, plot, 0, 0, new RunnableVal<Boolean>() {
|
SchematicHandler.manager.paste(sch, plot, 0, 0, 0, true, new RunnableVal<Boolean>() {
|
||||||
@Override
|
@Override
|
||||||
public void run(Boolean value) {
|
public void run(Boolean value) {
|
||||||
if (value) {
|
if (value) {
|
||||||
|
@ -91,7 +91,7 @@ public class Load extends SubCommand {
|
|||||||
sendMessage(plr, C.SCHEMATIC_INVALID, "non-existent or not in gzip format");
|
sendMessage(plr, C.SCHEMATIC_INVALID, "non-existent or not in gzip format");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
SchematicHandler.manager.paste(schematic, plot, 0, 0, new RunnableVal<Boolean>() {
|
SchematicHandler.manager.paste(schematic, plot, 0, 0, 0, true, new RunnableVal<Boolean>() {
|
||||||
@Override
|
@Override
|
||||||
public void run(Boolean value) {
|
public void run(Boolean value) {
|
||||||
plot.removeRunning();
|
plot.removeRunning();
|
||||||
|
@ -61,7 +61,7 @@ public class RegenAllRoads extends SubCommand {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PlotArea area = PS.get().getPlotAreaByString(args[0]);
|
PlotArea area = PS.get().getPlotAreaByString(args[0]);
|
||||||
if (area == null || WorldUtil.IMP.isWorld(area.worldname)) {
|
if (area == null || !WorldUtil.IMP.isWorld(area.worldname)) {
|
||||||
C.NOT_VALID_PLOT_WORLD.send(plr, args[0]);
|
C.NOT_VALID_PLOT_WORLD.send(plr, args[0]);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -20,20 +20,10 @@
|
|||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
package com.intellectualcrafters.plot.commands;
|
package com.intellectualcrafters.plot.commands;
|
||||||
|
|
||||||
import java.net.URL;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.PS;
|
import com.intellectualcrafters.plot.PS;
|
||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
import com.intellectualcrafters.plot.config.Settings;
|
import com.intellectualcrafters.plot.config.Settings;
|
||||||
import com.intellectualcrafters.plot.object.ConsolePlayer;
|
import com.intellectualcrafters.plot.object.*;
|
||||||
import com.intellectualcrafters.plot.object.Location;
|
|
||||||
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.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualcrafters.plot.util.Permissions;
|
import com.intellectualcrafters.plot.util.Permissions;
|
||||||
import com.intellectualcrafters.plot.util.SchematicHandler;
|
import com.intellectualcrafters.plot.util.SchematicHandler;
|
||||||
@ -41,6 +31,11 @@ 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.URL;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
@CommandDeclaration(
|
@CommandDeclaration(
|
||||||
command = "schematic",
|
command = "schematic",
|
||||||
permission = "plots.schematic",
|
permission = "plots.schematic",
|
||||||
@ -114,7 +109,7 @@ public class SchematicCmd extends SubCommand {
|
|||||||
sendMessage(plr, C.SCHEMATIC_INVALID, "non-existent or not in gzip format");
|
sendMessage(plr, C.SCHEMATIC_INVALID, "non-existent or not in gzip format");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
SchematicHandler.manager.paste(schematic, plot, 0, 0, new RunnableVal<Boolean>() {
|
SchematicHandler.manager.paste(schematic, plot, 0, 0, 0, true, new RunnableVal<Boolean>() {
|
||||||
@Override
|
@Override
|
||||||
public void run(Boolean value) {
|
public void run(Boolean value) {
|
||||||
running = false;
|
running = false;
|
||||||
|
@ -20,14 +20,6 @@
|
|||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
package com.intellectualcrafters.plot.commands;
|
package com.intellectualcrafters.plot.commands;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.PS;
|
import com.intellectualcrafters.plot.PS;
|
||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
@ -39,6 +31,8 @@ import com.intellectualcrafters.plot.util.UUIDHandler;
|
|||||||
import com.plotsquared.general.commands.Argument;
|
import com.plotsquared.general.commands.Argument;
|
||||||
import com.plotsquared.general.commands.CommandDeclaration;
|
import com.plotsquared.general.commands.CommandDeclaration;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
@CommandDeclaration(
|
@CommandDeclaration(
|
||||||
command = "visit",
|
command = "visit",
|
||||||
permission = "plots.visit",
|
permission = "plots.visit",
|
||||||
@ -83,11 +77,11 @@ public class Visit extends SubCommand {
|
|||||||
final UUID user = UUIDHandler.getCachedUUID(args[0], null);
|
final UUID user = UUIDHandler.getCachedUUID(args[0], null);
|
||||||
if (page == Integer.MIN_VALUE && user == null && MathMan.isInteger(args[0])) {
|
if (page == Integer.MIN_VALUE && user == null && MathMan.isInteger(args[0])) {
|
||||||
page = Integer.parseInt(args[0]);
|
page = Integer.parseInt(args[0]);
|
||||||
unsorted = PS.get().getPlots(player);
|
unsorted = PS.get().getBasePlots(player);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (user != null) {
|
if (user != null) {
|
||||||
unsorted = PS.get().getPlots(user);
|
unsorted = PS.get().getBasePlots(user);
|
||||||
} else if (PS.get().getPlotAreaByString(args[0]) != null) {
|
} else if (PS.get().getPlotAreaByString(args[0]) != null) {
|
||||||
unsorted = PS.get().getPlotAreaByString(args[0]).getPlots();
|
unsorted = PS.get().getPlotAreaByString(args[0]).getPlots();
|
||||||
} else {
|
} else {
|
||||||
|
@ -132,7 +132,7 @@ public class list extends SubCommand {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
sort = false;
|
sort = false;
|
||||||
plots = PS.get().sortPlotsByTemp(PS.get().getPlots(plr));
|
plots = PS.get().sortPlotsByTemp(PS.get().getBasePlots(plr));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "shared": {
|
case "shared": {
|
||||||
|
@ -409,7 +409,7 @@ public abstract class HybridUtils {
|
|||||||
}
|
}
|
||||||
if (blocks != null) {
|
if (blocks != null) {
|
||||||
for (Entry<Integer, PlotBlock> entry : blocks.entrySet()) {
|
for (Entry<Integer, PlotBlock> entry : blocks.entrySet()) {
|
||||||
SetQueue.IMP.setBlock(area.worldname, x + X + plotworld.ROAD_OFFSET_X, sy + entry.getKey(), z + Z + plotworld.ROAD_OFFSET_Z, entry.getValue());
|
SetQueue.IMP.setBlock(area.worldname, x + X + plotworld.ROAD_OFFSET_X, entry.getKey(), z + Z + plotworld.ROAD_OFFSET_Z, entry.getValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -96,6 +96,8 @@ public abstract class SchematicHandler {
|
|||||||
});
|
});
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Paste a schematic
|
* Paste a schematic
|
||||||
@ -107,7 +109,7 @@ public abstract class SchematicHandler {
|
|||||||
*
|
*
|
||||||
* @return boolean true if succeeded
|
* @return boolean true if succeeded
|
||||||
*/
|
*/
|
||||||
public void paste(final Schematic schematic, final Plot plot, final int x_offset, final int z_offset, final RunnableVal<Boolean> whenDone) {
|
public void paste(final Schematic schematic, final Plot plot, final int x_offset, final int y_offset, final int z_offset, final boolean autoHeight, final RunnableVal<Boolean> whenDone) {
|
||||||
TaskManager.runTask(new Runnable() {
|
TaskManager.runTask(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
@ -147,18 +149,23 @@ public abstract class SchematicHandler {
|
|||||||
final short[] ids = schematic.ids;
|
final short[] ids = schematic.ids;
|
||||||
final byte[] datas = schematic.datas;
|
final byte[] datas = schematic.datas;
|
||||||
// Calculate the optimal height to paste the schematic at
|
// Calculate the optimal height to paste the schematic at
|
||||||
final int y_offset;
|
final int y_offset_actual;
|
||||||
if (HEIGHT >= 256) {
|
if (autoHeight) {
|
||||||
y_offset = 0;
|
if (HEIGHT >= 256) {
|
||||||
} else {
|
y_offset_actual = y_offset;
|
||||||
PlotArea pw = plot.getArea();
|
|
||||||
if (pw instanceof ClassicPlotWorld) {
|
|
||||||
y_offset = ((ClassicPlotWorld) pw).PLOT_HEIGHT;
|
|
||||||
} else {
|
} else {
|
||||||
y_offset = MainUtil.getHeighestBlock(plot.getArea().worldname, region.minX + 1, region.minZ + 1);
|
PlotArea pw = plot.getArea();
|
||||||
|
if (pw instanceof ClassicPlotWorld) {
|
||||||
|
y_offset_actual = y_offset + ((ClassicPlotWorld) pw).PLOT_HEIGHT;
|
||||||
|
} else {
|
||||||
|
y_offset_actual = y_offset + MainUtil.getHeighestBlock(plot.getArea().worldname, region.minX + 1, region.minZ + 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
final Location pos1 = new Location(plot.getArea().worldname, region.minX + x_offset, y_offset, region.minZ + z_offset);
|
else {
|
||||||
|
y_offset_actual = y_offset;
|
||||||
|
}
|
||||||
|
final Location pos1 = new Location(plot.getArea().worldname, region.minX + x_offset, y_offset_actual, region.minZ + z_offset);
|
||||||
final Location pos2 = pos1.clone().add(WIDTH - 1, HEIGHT - 1, LENGTH - 1);
|
final Location pos2 = pos1.clone().add(WIDTH - 1, HEIGHT - 1, LENGTH - 1);
|
||||||
// TODO switch to ChunkManager.chunkTask(pos1, pos2, task, whenDone, allocate);
|
// TODO switch to ChunkManager.chunkTask(pos1, pos2, task, whenDone, allocate);
|
||||||
final int p1x = pos1.getX();
|
final int p1x = pos1.getX();
|
||||||
@ -203,7 +210,7 @@ public abstract class SchematicHandler {
|
|||||||
// Paste schematic here
|
// Paste schematic here
|
||||||
|
|
||||||
for (int ry = 0; ry < Math.min(256, HEIGHT); ry++) {
|
for (int ry = 0; ry < Math.min(256, HEIGHT); ry++) {
|
||||||
final int yy = y_offset + ry;
|
final int yy = y_offset_actual + ry;
|
||||||
if (yy > 255) {
|
if (yy > 255) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ import java.util.*;
|
|||||||
* Created by robin on 01/11/2014
|
* Created by robin on 01/11/2014
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Plugin(id = "PlotSquared", name = "PlotSquared", version = "3.3.0", dependencies = "before:WorldEdit")
|
@Plugin(id = "PlotSquared", name = "PlotSquared", version = "3.3.1", dependencies = "before:WorldEdit")
|
||||||
public class SpongeMain implements IPlotMain {
|
public class SpongeMain implements IPlotMain {
|
||||||
public static SpongeMain THIS;
|
public static SpongeMain THIS;
|
||||||
|
|
||||||
|
@ -10,7 +10,7 @@ buildscript {
|
|||||||
}
|
}
|
||||||
|
|
||||||
group = 'com.intellectualcrafters'
|
group = 'com.intellectualcrafters'
|
||||||
version = '3.3.0'
|
version = '3.3.1'
|
||||||
description = """PlotSquared"""
|
description = """PlotSquared"""
|
||||||
|
|
||||||
subprojects {
|
subprojects {
|
||||||
|
2
pom.xml
2
pom.xml
@ -8,7 +8,7 @@
|
|||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
</properties>
|
</properties>
|
||||||
<artifactId>PlotSquared</artifactId>
|
<artifactId>PlotSquared</artifactId>
|
||||||
<version>3.3.0</version>
|
<version>3.3.1</version>
|
||||||
<name>PlotSquared</name>
|
<name>PlotSquared</name>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<build>
|
<build>
|
||||||
|
Loading…
Reference in New Issue
Block a user