mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-25 22:56:45 +01:00
.
This commit is contained in:
parent
2a8415502e
commit
02de9c20a2
@ -24,11 +24,13 @@ package com.intellectualcrafters.plot.commands;
|
||||
import net.milkbowl.vault.economy.Economy;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.intellectualcrafters.plot.PlotMain;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.events.PlayerClaimPlotEvent;
|
||||
import com.intellectualcrafters.plot.generator.ClassicPlotWorld;
|
||||
import com.intellectualcrafters.plot.generator.HybridPlotWorld;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotWorld;
|
||||
@ -62,30 +64,26 @@ public class Claim extends SubCommand {
|
||||
if (teleport) {
|
||||
PlotMain.teleportPlayer(player, player.getLocation(), plot);
|
||||
}
|
||||
final PlotWorld world = PlotMain.getWorldSettings(plot.getWorld());
|
||||
World world = plot.getWorld();
|
||||
final PlotWorld plotworld = PlotMain.getWorldSettings(world);
|
||||
|
||||
final Plot plot2 = PlotMain.getPlots(player.getWorld()).get(plot.id);
|
||||
|
||||
if (world.SCHEMATIC_ON_CLAIM) {
|
||||
if (plotworld.SCHEMATIC_ON_CLAIM) {
|
||||
SchematicHandler.Schematic sch;
|
||||
if (schematic.equals("")) {
|
||||
sch = SchematicHandler.getSchematic(world.SCHEMATIC_FILE);
|
||||
sch = SchematicHandler.getSchematic(plotworld.SCHEMATIC_FILE);
|
||||
} else {
|
||||
sch = SchematicHandler.getSchematic(schematic);
|
||||
if (sch == null) {
|
||||
sch = SchematicHandler.getSchematic(world.SCHEMATIC_FILE);
|
||||
sch = SchematicHandler.getSchematic(plotworld.SCHEMATIC_FILE);
|
||||
}
|
||||
}
|
||||
SchematicHandler.paste(player.getLocation(), sch, plot2, 0, 0);
|
||||
}
|
||||
if (world instanceof HybridPlotWorld) {
|
||||
final HybridPlotWorld pW = (HybridPlotWorld) world;
|
||||
if (!(pW.CLAIMED_WALL_BLOCK.equals(pW.WALL_BLOCK))) {
|
||||
PlotMain.getPlotManager(plot.getWorld()).claimPlot(player.getWorld(), world, plot);
|
||||
PlotMain.getPlotManager(plot.world).claimPlot(world, plotworld, plot);
|
||||
PlotHelper.update(player.getLocation());
|
||||
}
|
||||
}
|
||||
}
|
||||
return event.isCancelled();
|
||||
}
|
||||
|
||||
|
@ -28,7 +28,7 @@ import org.bukkit.entity.Player;
|
||||
|
||||
import com.intellectualcrafters.plot.PlotMain;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.generator.HybridPlotWorld;
|
||||
import com.intellectualcrafters.plot.generator.SquarePlotWorld;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotId;
|
||||
import com.intellectualcrafters.plot.util.ChunkManager;
|
||||
@ -54,7 +54,7 @@ public class DebugClear extends SubCommand {
|
||||
if (id == null) {
|
||||
PlotMain.sendConsoleSenderMessage("Invalid Plot ID: " + args[0]);
|
||||
} else {
|
||||
if (!PlotMain.isPlotWorld(world) || !(PlotMain.getWorldSettings(world) instanceof HybridPlotWorld)) {
|
||||
if (!PlotMain.isPlotWorld(world) || !(PlotMain.getWorldSettings(world) instanceof SquarePlotWorld)) {
|
||||
PlotMain.sendConsoleSenderMessage("Invalid plot world: " + world);
|
||||
} else {
|
||||
final Plot plot = PlotHelper.getPlot(Bukkit.getWorld(world), id);
|
||||
@ -84,7 +84,7 @@ public class DebugClear extends SubCommand {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!PlayerFunctions.isInPlot(plr) || !(PlotMain.getWorldSettings(plr.getWorld()) instanceof HybridPlotWorld)) {
|
||||
if (!PlayerFunctions.isInPlot(plr) || !(PlotMain.getWorldSettings(plr.getWorld()) instanceof SquarePlotWorld)) {
|
||||
return sendMessage(plr, C.NOT_IN_PLOT);
|
||||
}
|
||||
final Plot plot = PlayerFunctions.getCurrentPlot(plr);
|
||||
|
@ -37,8 +37,8 @@ import org.bukkit.entity.Player;
|
||||
|
||||
import com.intellectualcrafters.plot.PlotMain;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.generator.HybridPlotManager;
|
||||
import com.intellectualcrafters.plot.generator.HybridPlotWorld;
|
||||
import com.intellectualcrafters.plot.generator.SquarePlotManager;
|
||||
import com.intellectualcrafters.plot.generator.SquarePlotWorld;
|
||||
import com.intellectualcrafters.plot.object.ChunkLoc;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotId;
|
||||
@ -222,36 +222,36 @@ public class Trim extends SubCommand {
|
||||
|
||||
public static ArrayList<Plot> expired = null;
|
||||
|
||||
public static void updateUnmodifiedPlots(final World world) {
|
||||
final HybridPlotManager manager = (HybridPlotManager) PlotMain.getPlotManager(world);
|
||||
final HybridPlotWorld plotworld = (HybridPlotWorld) PlotMain.getWorldSettings(world);
|
||||
final ArrayList<Plot> expired = new ArrayList<>();
|
||||
final Set<Plot> plots = ExpireManager.getOldPlots(world.getName()).keySet();
|
||||
sendMessage("Checking " + plots.size() +" plots! This may take a long time...");
|
||||
Trim.TASK_ID = Bukkit.getScheduler().scheduleSyncRepeatingTask(PlotMain.getMain(), new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (manager != null && plots.size() > 0) {
|
||||
Plot plot = plots.iterator().next();
|
||||
if (plot.hasOwner()) {
|
||||
HybridPlotManager.checkModified(plot, 0);
|
||||
}
|
||||
if (plot.owner == null || !HybridPlotManager.checkModified(plot, plotworld.REQUIRED_CHANGES)) {
|
||||
expired.add(plot);
|
||||
sendMessage("found expired: " + plot);
|
||||
}
|
||||
}
|
||||
else {
|
||||
Trim.expired = expired;
|
||||
Trim.TASK = false;
|
||||
sendMessage("Done!");
|
||||
Bukkit.getScheduler().cancelTask(Trim.TASK_ID);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}, 1, 1);
|
||||
}
|
||||
|
||||
// public static void updateUnmodifiedPlots(final World world) {
|
||||
// final SquarePlotManager manager = (SquarePlotManager) PlotMain.getPlotManager(world);
|
||||
// final SquarePlotWorld plotworld = (SquarePlotWorld) PlotMain.getWorldSettings(world);
|
||||
// final ArrayList<Plot> expired = new ArrayList<>();
|
||||
// final Set<Plot> plots = ExpireManager.getOldPlots(world.getName()).keySet();
|
||||
// sendMessage("Checking " + plots.size() +" plots! This may take a long time...");
|
||||
// Trim.TASK_ID = Bukkit.getScheduler().scheduleSyncRepeatingTask(PlotMain.getMain(), new Runnable() {
|
||||
// @Override
|
||||
// public void run() {
|
||||
// if (manager != null && plots.size() > 0) {
|
||||
// Plot plot = plots.iterator().next();
|
||||
// if (plot.hasOwner()) {
|
||||
// SquarePlotManager.checkModified(plot, 0);
|
||||
// }
|
||||
// if (plot.owner == null || !SquarePlotManager.checkModified(plot, plotworld.REQUIRED_CHANGES)) {
|
||||
// expired.add(plot);
|
||||
// sendMessage("found expired: " + plot);
|
||||
// }
|
||||
// }
|
||||
// else {
|
||||
// Trim.expired = expired;
|
||||
// Trim.TASK = false;
|
||||
// sendMessage("Done!");
|
||||
// Bukkit.getScheduler().cancelTask(Trim.TASK_ID);
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
// }, 1, 1);
|
||||
// }
|
||||
//
|
||||
public static void deleteChunks(World world, ArrayList<ChunkLoc> chunks) {
|
||||
String worldname = world.getName();
|
||||
for (ChunkLoc loc : chunks) {
|
||||
|
Loading…
Reference in New Issue
Block a user