mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-27 12:45:59 +01:00
optimizations
This commit is contained in:
parent
98232107f9
commit
336b22303f
@ -802,15 +802,15 @@ public class SQLManager implements AbstractDB {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void movePlot(final String world, final PlotId originalPlot, final PlotId newPlot) {
|
||||
public void movePlot(Plot original, final Plot newPlot) {
|
||||
TaskManager.runTaskAsync(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
final int id = getId(world, originalPlot);
|
||||
final int id = getId(original.world, original.id);
|
||||
final PreparedStatement stmt = SQLManager.this.connection.prepareStatement("UPDATE `" + SQLManager.this.prefix + "plot` SET `plot_id_x` = ?, `plot_id_z` = ? WHERE `id` = ?");
|
||||
stmt.setInt(1, newPlot.x);
|
||||
stmt.setInt(2, newPlot.y);
|
||||
stmt.setInt(1, newPlot.id.x);
|
||||
stmt.setInt(2, newPlot.id.y);
|
||||
stmt.setInt(3, id);
|
||||
stmt.executeUpdate();
|
||||
stmt.close();
|
||||
|
@ -11,6 +11,7 @@ import org.bukkit.plugin.Plugin;
|
||||
|
||||
import com.intellectualcrafters.plot.BukkitMain;
|
||||
import com.intellectualcrafters.plot.PlotSquared;
|
||||
import com.intellectualcrafters.plot.api.PlotAPI;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.object.ChunkLoc;
|
||||
import com.intellectualcrafters.plot.object.PlotBlock;
|
||||
|
@ -949,11 +949,11 @@ public class BukkitChunkManager extends ChunkManager {
|
||||
int X = chunk.getX();
|
||||
int Z = chunk.getX();
|
||||
Entity[] ents = chunk.getEntities();
|
||||
if (X == bx || X == tx || Z == bz || Z == tz) {
|
||||
for (final Entity entity : ents) {
|
||||
if (!(entity instanceof Creature)) {
|
||||
continue;
|
||||
}
|
||||
if (X == bx || X == tx || Z == bz || Z == tz) {
|
||||
final PlotId id = MainUtil.getPlotId(BukkitUtil.getLocation(entity));
|
||||
if (plot.id.equals(id)) {
|
||||
count[0]++;
|
||||
@ -965,12 +965,7 @@ public class BukkitChunkManager extends ChunkManager {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (final Entity entity : ents) {
|
||||
if (!(entity instanceof Creature)) {
|
||||
continue;
|
||||
}
|
||||
count[0]++;
|
||||
if (entity instanceof Animals) {
|
||||
count[1]++;
|
||||
|
Loading…
Reference in New Issue
Block a user