Minor tweaks

- SBQ unsanitized input
- plotme conversion tweaks
- schematic default output directory
- increment version number
This commit is contained in:
boy0001 2015-08-30 16:19:35 +10:00
parent 3662b05da8
commit 0ba838b16b
8 changed files with 40 additions and 7 deletions

View File

@ -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.1.7</version> <version>3.1.8</version>
<name>PlotSquared</name> <name>PlotSquared</name>
<packaging>jar</packaging> <packaging>jar</packaging>
<build> <build>

View File

@ -120,7 +120,7 @@ public class Settings {
/** /**
* Schematic Save Path * Schematic Save Path
*/ */
public static String SCHEMATIC_SAVE_PATH = "/var/www/schematics"; public static String SCHEMATIC_SAVE_PATH = "plugins/PlotSquared/schematics";
/** /**
* BO3 Save Path * BO3 Save Path
*/ */

View File

@ -49,7 +49,7 @@ public class SetBlockQueue {
init(); init();
runnables.add(whenDone); runnables.add(whenDone);
} }
if (blocks == null || blocks.size() == 0) { if (blocks == null || blocks.size() == 0 || !blocks.entrySet().iterator().hasNext()) {
ArrayDeque<Runnable> tasks = runnables; ArrayDeque<Runnable> tasks = runnables;
lastInt = -1; lastInt = -1;
lastBlock = null; lastBlock = null;
@ -81,7 +81,6 @@ public class SetBlockQueue {
@Override @Override
public void run() { public void run() {
if (locked) { if (locked) {
System.out.print("LOCKED!");
return; return;
} }
if (blocks == null || blocks.size() == 0) { if (blocks == null || blocks.size() == 0) {
@ -205,7 +204,10 @@ public class SetBlockQueue {
result = new PlotBlock[16][]; result = new PlotBlock[16][];
blocks.put(wrap, result); blocks.put(wrap, result);
} }
if ((y > 255) || (y < 0)) {
locked = false;
return;
}
if (result[y >> 4] == null) { if (result[y >> 4] == null) {
result[y >> 4] = new PlotBlock[4096]; result[y >> 4] = new PlotBlock[4096];
} }
@ -232,6 +234,10 @@ public class SetBlockQueue {
result = new PlotBlock[16][]; result = new PlotBlock[16][];
blocks.put(wrap, result); blocks.put(wrap, result);
} }
if ((y > 255) || (y < 0)) {
locked = false;
return;
}
if (result[y >> 4] == null) { if (result[y >> 4] == null) {
result[y >> 4] = new PlotBlock[4096]; result[y >> 4] = new PlotBlock[4096];
} }
@ -258,6 +264,10 @@ public class SetBlockQueue {
result = new PlotBlock[16][]; result = new PlotBlock[16][];
blocks.put(wrap, result); blocks.put(wrap, result);
} }
if ((y > 255) || (y < 0)) {
locked = false;
return;
}
if (result[y >> 4] == null) { if (result[y >> 4] == null) {
result[y >> 4] = new PlotBlock[4096]; result[y >> 4] = new PlotBlock[4096];
} }

View File

@ -57,7 +57,15 @@ public class ClassicPlotMeConnector extends APlotMeConnector {
final HashMap<String, HashMap<PlotId, boolean[]>> merges = new HashMap<>(); final HashMap<String, HashMap<PlotId, boolean[]>> merges = new HashMap<>();
stmt = connection.prepareStatement("SELECT * FROM `" + plugin + "Plots`"); stmt = connection.prepareStatement("SELECT * FROM `" + plugin + "Plots`");
r = stmt.executeQuery(); r = stmt.executeQuery();
String column = null;
boolean checkUUID = DBFunc.hasColumn(r, "ownerid"); boolean checkUUID = DBFunc.hasColumn(r, "ownerid");
boolean checkUUID2 = DBFunc.hasColumn(r, "ownerId");
if (checkUUID) {
column = "ownerid";
}
else if (checkUUID2) {
column = "ownerId";
}
boolean merge = !plugin.equals("plotme") && Settings.CONVERT_PLOTME; boolean merge = !plugin.equals("plotme") && Settings.CONVERT_PLOTME;
while (r.next()) { while (r.next()) {
final PlotId id = new PlotId(r.getInt("idX"), r.getInt("idZ")); final PlotId id = new PlotId(r.getInt("idX"), r.getInt("idZ"));
@ -103,7 +111,7 @@ public class ClassicPlotMeConnector extends APlotMeConnector {
else { else {
if (checkUUID){ if (checkUUID){
try { try {
byte[] bytes = r.getBytes("ownerid"); byte[] bytes = r.getBytes(column);
if (bytes != null) { if (bytes != null) {
try { try {
ByteBuffer bb = ByteBuffer.wrap(bytes); ByteBuffer bb = ByteBuffer.wrap(bytes);

View File

@ -10,6 +10,7 @@ import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable; import org.bukkit.event.Cancellable;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.HandlerList;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerCommandPreprocessEvent;
@ -26,6 +27,8 @@ import com.plotsquared.bukkit.BukkitMain;
import com.plotsquared.bukkit.util.BukkitUtil; import com.plotsquared.bukkit.util.BukkitUtil;
import com.plotsquared.bukkit.util.SetBlockFast; import com.plotsquared.bukkit.util.SetBlockFast;
import com.sk89q.worldedit.BlockVector; import com.sk89q.worldedit.BlockVector;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
import com.sk89q.worldedit.bukkit.selections.Selection; import com.sk89q.worldedit.bukkit.selections.Selection;
public class WEListener implements Listener { public class WEListener implements Listener {
@ -171,6 +174,11 @@ public class WEListener implements Listener {
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true) @EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public boolean onPlayerCommand(final PlayerCommandPreprocessEvent e) { public boolean onPlayerCommand(final PlayerCommandPreprocessEvent e) {
WorldEditPlugin worldedit = BukkitMain.worldEdit;
if (worldedit == null) {
HandlerList.unregisterAll(this);
return true;
}
final Player p = e.getPlayer(); final Player p = e.getPlayer();
final PlotPlayer pp = BukkitUtil.getPlayer(p); final PlotPlayer pp = BukkitUtil.getPlayer(p);
if (!PS.get().isPlotWorld(p.getWorld().getName())) { if (!PS.get().isPlotWorld(p.getWorld().getName())) {

View File

@ -17,8 +17,10 @@ import com.intellectualcrafters.plot.util.UUIDHandler;
import com.plotsquared.bukkit.BukkitMain; import com.plotsquared.bukkit.BukkitMain;
import com.plotsquared.bukkit.object.BukkitPlayer; import com.plotsquared.bukkit.object.BukkitPlayer;
import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.EditSession.Stage; import com.sk89q.worldedit.EditSession.Stage;
import com.sk89q.worldedit.LocalSession; import com.sk89q.worldedit.LocalSession;
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
import com.sk89q.worldedit.command.tool.BrushTool; import com.sk89q.worldedit.command.tool.BrushTool;
import com.sk89q.worldedit.event.extent.EditSessionEvent; import com.sk89q.worldedit.event.extent.EditSessionEvent;
import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extension.platform.Actor;
@ -43,6 +45,11 @@ public class WESubscriber {
@Subscribe(priority=Priority.VERY_EARLY) @Subscribe(priority=Priority.VERY_EARLY)
public void onEditSession(EditSessionEvent event) { public void onEditSession(EditSessionEvent event) {
WorldEditPlugin worldedit = BukkitMain.worldEdit;
if (worldedit == null) {
WorldEdit.getInstance().getEventBus().unregister(this);
return;
}
World worldObj = event.getWorld(); World worldObj = event.getWorld();
String world = worldObj.getName(); String world = worldObj.getName();
Actor actor = event.getActor(); Actor actor = event.getActor();
@ -67,7 +74,7 @@ public class WESubscriber {
if (Settings.CHUNK_PROCESSOR) { if (Settings.CHUNK_PROCESSOR) {
if (Settings.EXPERIMENTAL_FAST_ASYNC_WORLDEDIT) { if (Settings.EXPERIMENTAL_FAST_ASYNC_WORLDEDIT) {
try { try {
LocalSession session = ((BukkitMain) PS.get().IMP).worldEdit.getWorldEdit().getSession(name); LocalSession session = worldedit.getWorldEdit().getSession(name);
boolean hasMask = session.getMask() != null; boolean hasMask = session.getMask() != null;
Player objPlayer = ((BukkitPlayer) player).player; Player objPlayer = ((BukkitPlayer) player).player;
ItemStack item = objPlayer.getItemInHand(); ItemStack item = objPlayer.getItemInHand();

Binary file not shown.

Binary file not shown.