mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-25 06:36:44 +01:00
Added plot unlinking
This commit is contained in:
parent
c6859a5d50
commit
ccb2e32c58
@ -53,7 +53,8 @@ public enum C {
|
|||||||
/*
|
/*
|
||||||
* Permission
|
* Permission
|
||||||
*/
|
*/
|
||||||
NO_PERMISSION("&cYou don't have the permissions required to use this command."), NO_PLOT_PERMS("&cYou don't have the permissions to do that in this plot"), CANT_CLAIM_MORE_PLOTS("&cYou can't claim more plots."), YOU_BE_DENIED("&cYou are not allowed to enter this plot"), NO_PERM_MERGE("&cYou are not the owner of the plot: &6%plot%"), UNLINK_REQUIRED("&cAn unlink is required to do this."),
|
NO_PERMISSION("&cYou don't have the permissions required to use this command."), NO_PLOT_PERMS("&cYou don't have the permissions to do that in this plot"), CANT_CLAIM_MORE_PLOTS("&cYou can't claim more plots."), YOU_BE_DENIED("&cYou are not allowed to enter this plot"),
|
||||||
|
NO_PERM_MERGE("&cYou are not the owner of the plot: &6%plot%"), UNLINK_REQUIRED("&cAn unlink is required to do this."), UNLINK_IMPOSSIBLE("&cYou can only unlink a mega-plot"),
|
||||||
/*
|
/*
|
||||||
* Commands
|
* Commands
|
||||||
*/
|
*/
|
||||||
|
@ -34,6 +34,10 @@ public enum Command {
|
|||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
UNLINK("unlink", "u"),
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
CLEAR("clear", "clear", new CommandPermission("plots.clear")),
|
CLEAR("clear", "clear", new CommandPermission("plots.clear")),
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
* You are not allowed to distribute and/or monetize any of our intellectual property.
|
* You are not allowed to distribute and/or monetize any of our intellectual property.
|
||||||
* IntellectualCrafters is not affiliated with Mojang AB. Minecraft is a trademark of Mojang AB.
|
* IntellectualCrafters is not affiliated with Mojang AB. Minecraft is a trademark of Mojang AB.
|
||||||
*
|
*
|
||||||
* >> File = Clear.java
|
* >> File = Delete.java
|
||||||
* >> Generated by: Citymonstret at 2014-08-09 01:41
|
* >> Generated by: Citymonstret at 2014-08-09 01:41
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ import com.intellectualcrafters.plot.PlotMain;
|
|||||||
*/
|
*/
|
||||||
public class MainCommand implements CommandExecutor {
|
public class MainCommand implements CommandExecutor {
|
||||||
|
|
||||||
private static SubCommand[] _subCommands = new SubCommand[] { new Claim(), new Auto(), new Home(), new Visit(), new TP(), new Set(), new Clear(), new Delete(), new SetOwner(), new Denied(), new Helpers(), new Info(), new list(), new Help(), new Debug(), new Schematic(), new plugin(), new Inventory(), new Reload(), new Merge() };
|
private static SubCommand[] _subCommands = new SubCommand[] { new Claim(), new Auto(), new Home(), new Visit(), new TP(), new Set(), new Clear(), new Delete(), new SetOwner(), new Denied(), new Helpers(), new Info(), new list(), new Help(), new Debug(), new Schematic(), new plugin(), new Inventory(), new Reload(), new Merge(), new Unlink() };
|
||||||
|
|
||||||
public static ArrayList<SubCommand> subCommands = new ArrayList<SubCommand>() {
|
public static ArrayList<SubCommand> subCommands = new ArrayList<SubCommand>() {
|
||||||
{
|
{
|
||||||
|
@ -0,0 +1,59 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) IntellectualCrafters - 2014.
|
||||||
|
* You are not allowed to distribute and/or monetize any of our intellectual property.
|
||||||
|
* IntellectualCrafters is not affiliated with Mojang AB. Minecraft is a trademark of Mojang AB.
|
||||||
|
*
|
||||||
|
* >> File = Unlink.java
|
||||||
|
* >> Generated by: Citymonstret at 2014-08-09 01:41
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.intellectualcrafters.plot.commands;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
|
import com.intellectualcrafters.plot.C;
|
||||||
|
import com.intellectualcrafters.plot.PlayerFunctions;
|
||||||
|
import com.intellectualcrafters.plot.Plot;
|
||||||
|
import com.intellectualcrafters.plot.PlotHelper;
|
||||||
|
import com.intellectualcrafters.plot.PlotId;
|
||||||
|
import com.intellectualcrafters.plot.PlotMain;
|
||||||
|
import com.intellectualcrafters.plot.PlotSettings;
|
||||||
|
import com.intellectualcrafters.plot.database.DBFunc;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Citymonstret on 2014-08-01.
|
||||||
|
*/
|
||||||
|
public class Unlink extends SubCommand {
|
||||||
|
|
||||||
|
public Unlink() {
|
||||||
|
super(Command.UNLINK, "Unlink a mega-plot", "unlink", CommandCategory.ACTIONS);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean execute(Player plr, String... args) {
|
||||||
|
if (!PlayerFunctions.isInPlot(plr)) {
|
||||||
|
PlayerFunctions.sendMessage(plr, "You're not in a plot.");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
Plot plot = PlayerFunctions.getCurrentPlot(plr);
|
||||||
|
if ((plot==null || !plot.hasOwner() || !plot.getOwner().equals(plr.getUniqueId())) && !plr.hasPermission("plots.admin")) {
|
||||||
|
PlayerFunctions.sendMessage(plr, C.NO_PLOT_PERMS);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (PlayerFunctions.getTopPlot(plr.getWorld(), plot).equals(PlayerFunctions.getBottomPlot(plr.getWorld(), plot))) {
|
||||||
|
PlayerFunctions.sendMessage(plr, C.UNLINK_IMPOSSIBLE);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
World world = plr.getWorld();
|
||||||
|
ArrayList<PlotId> ids = PlayerFunctions.getPlotSelectionIds(world, PlayerFunctions.getBottomPlot(world, plot).id, PlayerFunctions.getTopPlot(world, plot).id);
|
||||||
|
for (PlotId id:ids) {
|
||||||
|
Plot myplot = PlotMain.getPlots(world).get(id);
|
||||||
|
myplot.settings.setMerged(new boolean[] {false, false, false, false} );
|
||||||
|
DBFunc.setMerged(world.getName(), myplot, myplot.settings.getMerged());
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user