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