*Should fix issue with expired mega plots. [UNTESTED]

This commit is contained in:
boy0001 2015-02-10 17:03:59 +11:00
parent 8b8afc2010
commit ba35d8b774
3 changed files with 28 additions and 19 deletions

View File

@ -65,6 +65,27 @@ public class Unlink extends SubCommand {
} }
final World world = plr.getWorld(); final World world = plr.getWorld();
if (!unlinkPlot(world, plot)) {
PlayerFunctions.sendMessage(plr, "&cUnlink has been cancelled");
return false;
}
try {
if (PlotHelper.canSetFast) {
SetBlockFast.update(plr);
}
} catch (final Exception e) {
// execute(final Player plr, final String... args) {
try {
PlotMain.sendConsoleSenderMessage("Error on: " + getClass().getMethod("execute", Player.class, String[].class).toGenericString() + ":119, when trying to use \"SetBlockFast#update\"");
} catch (final Exception ex) {
ex.printStackTrace();
}
}
PlayerFunctions.sendMessage(plr, "&6Plots unlinked successfully!");
return true;
}
public static boolean unlinkPlot(World world, Plot plot) {
final PlotId pos1 = PlayerFunctions.getBottomPlot(world, plot).id; final PlotId pos1 = PlayerFunctions.getBottomPlot(world, plot).id;
final PlotId pos2 = PlayerFunctions.getTopPlot(world, plot).id; final PlotId pos2 = PlayerFunctions.getTopPlot(world, plot).id;
final ArrayList<PlotId> ids = PlayerFunctions.getPlotSelectionIds(pos1, pos2); final ArrayList<PlotId> ids = PlayerFunctions.getPlotSelectionIds(pos1, pos2);
@ -74,7 +95,6 @@ public class Unlink extends SubCommand {
Bukkit.getServer().getPluginManager().callEvent(event); Bukkit.getServer().getPluginManager().callEvent(event);
if (event.isCancelled()) { if (event.isCancelled()) {
event.setCancelled(true); event.setCancelled(true);
PlayerFunctions.sendMessage(plr, "&cUnlink has been cancelled");
return false; return false;
} }
@ -119,25 +139,10 @@ public class Unlink extends SubCommand {
if (ly) { if (ly) {
manager.createRoadSouth(plotworld, p); manager.createRoadSouth(plotworld, p);
} }
PlotHelper.setSign(plr.getWorld(), UUIDHandler.getName(plot.owner), plot); PlotHelper.setSign(world, UUIDHandler.getName(plot.owner), plot);
} }
} }
try {
if (PlotHelper.canSetFast) {
SetBlockFast.update(plr);
}
} catch (final Exception e) {
// execute(final Player plr, final String... args) {
try {
PlotMain.sendConsoleSenderMessage("Error on: " + getClass().getMethod("execute", Player.class, String[].class).toGenericString() + ":119, when trying to use \"SetBlockFast#update\"");
} catch (final Exception ex) {
ex.printStackTrace();
}
}
manager.finishPlotUnlink(world, plotworld, ids); manager.finishPlotUnlink(world, plotworld, ids);
PlayerFunctions.sendMessage(plr, "&6Plots unlinked successfully!");
return true; return true;
} }
} }

View File

@ -589,8 +589,8 @@ import com.intellectualcrafters.plot.util.SendChunk;
final HybridPlotWorld dpw = ((HybridPlotWorld) PlotMain.getWorldSettings(world)); final HybridPlotWorld dpw = ((HybridPlotWorld) PlotMain.getWorldSettings(world));
final Location pos1 = PlotHelper.getPlotBottomLoc(world, plot.id).add(1, 0, 1); final Location pos1 = PlotHelper.getPlotBottomLocAbs(world, plot.id).add(1, 0, 1);
final Location pos2 = PlotHelper.getPlotTopLoc(world, plot.id); final Location pos2 = PlotHelper.getPlotTopLocAbs(world, plot.id);
final PlotBlock[] plotfloor = dpw.TOP_BLOCK; final PlotBlock[] plotfloor = dpw.TOP_BLOCK;
final PlotBlock[] filling = dpw.MAIN_BLOCK; final PlotBlock[] filling = dpw.MAIN_BLOCK;

View File

@ -14,6 +14,7 @@ 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.commands.Unlink;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Settings; import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.database.DBFunc;
@ -108,6 +109,9 @@ public class ExpireManager {
} }
final World worldobj = Bukkit.getWorld(world); final World worldobj = Bukkit.getWorld(world);
final PlotManager manager = PlotMain.getPlotManager(world); final PlotManager manager = PlotMain.getPlotManager(world);
if (plot.settings.isMerged()) {
Unlink.unlinkPlot(Bukkit.getWorld(world), plot);
}
manager.clearPlot(worldobj, plot, false); manager.clearPlot(worldobj, plot, false);
PlotHelper.removeSign(worldobj, plot); PlotHelper.removeSign(worldobj, plot);
DBFunc.delete(world, plot); DBFunc.delete(world, plot);