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