mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-26 07:06:44 +01:00
inplot
This commit is contained in:
parent
9eb1b0f6f5
commit
ef9e1dd1ac
@ -27,6 +27,7 @@ import org.bukkit.Bukkit;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.database.DBFunc;
|
||||
import com.intellectualcrafters.plot.events.PlayerPlotHelperEvent;
|
||||
import com.intellectualcrafters.plot.object.Location;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
@ -44,11 +45,11 @@ public class Helpers extends SubCommand {
|
||||
MainUtil.sendMessage(plr, C.HELPER_NEED_ARGUMENT);
|
||||
return true;
|
||||
}
|
||||
if (!BukkitPlayerFunctions.isInPlot(plr)) {
|
||||
MainUtil.sendMessage(plr, C.NOT_IN_PLOT);
|
||||
return true;
|
||||
}
|
||||
Location loc = plr.getLocation();
|
||||
final Plot plot = MainUtil.getPlot(loc);
|
||||
if (plot == null) {
|
||||
return !sendMessage(plr, C.NOT_IN_PLOT);
|
||||
}
|
||||
if ((plot == null) || !plot.hasOwner()) {
|
||||
MainUtil.sendMessage(plr, C.PLOT_UNOWNED);
|
||||
return false;
|
||||
|
@ -30,6 +30,7 @@ import org.bukkit.Bukkit;
|
||||
import com.intellectualcrafters.plot.PlotSquared;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.database.DBFunc;
|
||||
import com.intellectualcrafters.plot.object.Location;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotComment;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
@ -50,11 +51,11 @@ public class Inbox extends SubCommand {
|
||||
report = true;
|
||||
}
|
||||
}
|
||||
if (!BukkitPlayerFunctions.isInPlot(plr) && !report) {
|
||||
MainUtil.sendMessage(plr, C.NOT_IN_PLOT);
|
||||
return false;
|
||||
}
|
||||
Location loc = plr.getLocation();
|
||||
final Plot plot = MainUtil.getPlot(loc);
|
||||
if (plot == null && !report) {
|
||||
return !sendMessage(plr, C.NOT_IN_PLOT);
|
||||
}
|
||||
if ((plot != null) && !plot.hasOwner()) {
|
||||
MainUtil.sendMessage(plr, C.NOT_IN_PLOT);
|
||||
return false;
|
||||
|
@ -57,14 +57,15 @@ public class Info extends SubCommand {
|
||||
World world;
|
||||
Plot plot;
|
||||
if (player != null) {
|
||||
world = player.getWorld();
|
||||
Location loc = player.getLocation();
|
||||
String world = loc.getWorld();
|
||||
if (!PlotSquared.isPlotWorld(world)) {
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NOT_IN_PLOT_WORLD);
|
||||
return false;
|
||||
}
|
||||
if (!BukkitPlayerFunctions.isInPlot(player)) {
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NOT_IN_PLOT);
|
||||
return false;
|
||||
final Plot plot = MainUtil.getPlot(loc);
|
||||
if (plot == null) {
|
||||
return !sendMessage(plr, C.NOT_IN_PLOT);
|
||||
}
|
||||
plot = MainUtil.getPlot(loc);
|
||||
} else {
|
||||
|
@ -24,6 +24,7 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.object.Location;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
@ -38,11 +39,11 @@ public class Kick extends SubCommand {
|
||||
|
||||
@Override
|
||||
public boolean execute(final PlotPlayer plr, final String... args) {
|
||||
if (!BukkitPlayerFunctions.isInPlot(plr)) {
|
||||
MainUtil.sendMessage(plr, "You're not in a plot.");
|
||||
return false;
|
||||
}
|
||||
Location loc = plr.getLocation();
|
||||
final Plot plot = MainUtil.getPlot(loc);
|
||||
if (plot == null) {
|
||||
return !sendMessage(plr, C.NOT_IN_PLOT);
|
||||
}
|
||||
if (((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(UUIDHandler.getUUID(plr))) && !Permissions.hasPermission(plr, "plots.admin.command.kick")) {
|
||||
MainUtil.sendMessage(plr, C.NO_PLOT_PERMS);
|
||||
return false;
|
||||
|
@ -31,6 +31,7 @@ import org.bukkit.World;
|
||||
import com.intellectualcrafters.plot.PlotSquared;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.events.PlotMergeEvent;
|
||||
import com.intellectualcrafters.plot.object.Location;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotId;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
@ -75,11 +76,11 @@ public class Merge extends SubCommand {
|
||||
|
||||
@Override
|
||||
public boolean execute(final PlotPlayer plr, final String... args) {
|
||||
if (!BukkitPlayerFunctions.isInPlot(plr)) {
|
||||
MainUtil.sendMessage(plr, C.NOT_IN_PLOT);
|
||||
return true;
|
||||
}
|
||||
Location loc = plr.getLocation();
|
||||
final Plot plot = MainUtil.getPlot(loc);
|
||||
if (plot == null) {
|
||||
return !sendMessage(plr, C.NOT_IN_PLOT);
|
||||
}
|
||||
if ((plot == null) || !plot.hasOwner()) {
|
||||
MainUtil.sendMessage(plr, C.PLOT_UNOWNED);
|
||||
return false;
|
||||
|
@ -29,6 +29,7 @@ import org.bukkit.inventory.meta.ItemMeta;
|
||||
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.listeners.PlotPlusListener;
|
||||
import com.intellectualcrafters.plot.object.Location;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
@ -41,11 +42,11 @@ public class MusicSubcommand extends SubCommand {
|
||||
|
||||
@Override
|
||||
public boolean execute(final PlotPlayer player, final String... args) {
|
||||
if (!BukkitPlayerFunctions.isInPlot(player)) {
|
||||
sendMessage(player, C.NOT_IN_PLOT);
|
||||
return true;
|
||||
}
|
||||
Location loc = plr.getLocation();
|
||||
final Plot plot = MainUtil.getPlot(loc);
|
||||
if (plot == null) {
|
||||
return !sendMessage(plr, C.NOT_IN_PLOT);
|
||||
}
|
||||
if (!plot.hasRights(player)) {
|
||||
sendMessage(player, C.NO_PLOT_PERMS);
|
||||
return true;
|
||||
|
@ -1,67 +0,0 @@
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// PlotSquared - A plot manager and world generator for the Bukkit API /
|
||||
// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
|
||||
// /
|
||||
// This program is free software; you can redistribute it and/or modify /
|
||||
// it under the terms of the GNU General Public License as published by /
|
||||
// the Free Software Foundation; either version 3 of the License, or /
|
||||
// (at your option) any later version. /
|
||||
// /
|
||||
// This program is distributed in the hope that it will be useful, /
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of /
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
|
||||
// GNU General Public License for more details. /
|
||||
// /
|
||||
// You should have received a copy of the GNU General Public License /
|
||||
// along with this program; if not, write to the Free Software Foundation, /
|
||||
// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
|
||||
// /
|
||||
// You can contact us via: support@intellectualsites.com /
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
package com.intellectualcrafters.plot.commands;
|
||||
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions;
|
||||
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
||||
|
||||
public class Paste extends SubCommand {
|
||||
public Paste() {
|
||||
super(Command.PASTE, "Paste a plot", "paste", CommandCategory.ACTIONS, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(final PlotPlayer plr, final String... args) {
|
||||
if (!BukkitPlayerFunctions.isInPlot(plr)) {
|
||||
MainUtil.sendMessage(plr, C.NOT_IN_PLOT);
|
||||
return false;
|
||||
}
|
||||
final Plot plot = MainUtil.getPlot(loc);
|
||||
if (((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(UUIDHandler.getUUID(plr))) && !Permissions.hasPermission(plr, "plots.admin.command.paste")) {
|
||||
MainUtil.sendMessage(plr, C.NO_PLOT_PERMS);
|
||||
return false;
|
||||
}
|
||||
if (!MainUtil.getTopPlot(plr.getWorld(), plot).equals(BukkitPlayerFunctions.getBottomPlot(plr.getWorld(), plot))) {
|
||||
MainUtil.sendMessage(plr, C.UNLINK_REQUIRED);
|
||||
return false;
|
||||
}
|
||||
assert plot != null;
|
||||
final int size = (MainUtil.getPlotTopLocAbs(plr.getWorld(), plot.getId()).getBlockX() - MainUtil.getPlotBottomLocAbs(plr.getWorld(), plot.getId()).getBlockX());
|
||||
if (PlotSelection.currentSelection.containsKey(plr.getName())) {
|
||||
final PlotSelection selection = PlotSelection.currentSelection.get(plr.getName());
|
||||
if (size != selection.getWidth()) {
|
||||
sendMessage(plr, C.PASTE_FAILED, "The size of the current plot is not the same as the paste");
|
||||
return false;
|
||||
}
|
||||
selection.paste(plr.getWorld(), plot);
|
||||
sendMessage(plr, C.PASTED);
|
||||
} else {
|
||||
sendMessage(plr, C.NO_CLIPBOARD);
|
||||
return false;
|
||||
}
|
||||
PlotSelection.currentSelection.remove(plr.getName());
|
||||
return true;
|
||||
}
|
||||
}
|
@ -22,6 +22,7 @@ package com.intellectualcrafters.plot.commands;
|
||||
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.database.DBFunc;
|
||||
import com.intellectualcrafters.plot.object.Location;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
@ -44,11 +45,11 @@ public class Rate extends SubCommand {
|
||||
sendMessage(plr, C.RATING_NOT_VALID);
|
||||
return true;
|
||||
}
|
||||
if (!BukkitPlayerFunctions.isInPlot(plr)) {
|
||||
sendMessage(plr, C.NOT_IN_PLOT);
|
||||
return true;
|
||||
}
|
||||
Location loc = plr.getLocation();
|
||||
final Plot plot = MainUtil.getPlot(loc);
|
||||
if (plot == null) {
|
||||
return !sendMessage(plr, C.NOT_IN_PLOT);
|
||||
}
|
||||
if (!plot.hasOwner()) {
|
||||
sendMessage(plr, C.RATING_NOT_OWNED);
|
||||
return true;
|
||||
|
@ -36,6 +36,7 @@ import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotId;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.Permissions;
|
||||
import com.intellectualcrafters.plot.util.SchematicHandler;
|
||||
import com.intellectualcrafters.plot.util.SchematicHandler.DataCollection;
|
||||
import com.intellectualcrafters.plot.util.SchematicHandler.Dimension;
|
||||
@ -247,11 +248,11 @@ public class Schematic extends SubCommand {
|
||||
final String world;
|
||||
final Plot p2;
|
||||
if (plr != null) {
|
||||
if (!BukkitPlayerFunctions.isInPlot(plr)) {
|
||||
sendMessage(plr, C.NOT_IN_PLOT);
|
||||
return false;
|
||||
Location loc = plr.getLocation();
|
||||
final Plot plot = MainUtil.getPlot(loc);
|
||||
if (plot == null) {
|
||||
return !sendMessage(plr, C.NOT_IN_PLOT);
|
||||
}
|
||||
final Plot myplot = MainUtil.getPlot(loc);
|
||||
if (!myplot.hasRights(plr)) {
|
||||
sendMessage(plr, C.NO_PLOT_PERMS);
|
||||
return false;
|
||||
|
@ -64,11 +64,11 @@ public class Set extends SubCommand {
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public boolean execute(final PlotPlayer plr, final String... args) {
|
||||
if (!BukkitPlayerFunctions.isInPlot(plr)) {
|
||||
MainUtil.sendMessage(plr, C.NOT_IN_PLOT);
|
||||
return false;
|
||||
}
|
||||
Location loc = plr.getLocation();
|
||||
final Plot plot = MainUtil.getPlot(loc);
|
||||
if (plot == null) {
|
||||
return !sendMessage(plr, C.NOT_IN_PLOT);
|
||||
}
|
||||
if (!plot.hasOwner()) {
|
||||
sendMessage(plr, C.PLOT_NOT_CLAIMED);
|
||||
return false;
|
||||
|
@ -25,6 +25,7 @@ import org.bukkit.World;
|
||||
import com.intellectualcrafters.plot.PlotSquared;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.database.DBFunc;
|
||||
import com.intellectualcrafters.plot.object.Location;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotId;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
@ -49,11 +50,11 @@ public class Swap extends SubCommand {
|
||||
MainUtil.sendMessage(plr, C.SWAP_SYNTAX);
|
||||
return false;
|
||||
}
|
||||
if (!BukkitPlayerFunctions.isInPlot(plr)) {
|
||||
MainUtil.sendMessage(plr, C.NOT_IN_PLOT);
|
||||
return false;
|
||||
}
|
||||
Location loc = plr.getLocation();
|
||||
final Plot plot = MainUtil.getPlot(loc);
|
||||
if (plot == null) {
|
||||
return !sendMessage(plr, C.NOT_IN_PLOT);
|
||||
}
|
||||
if (((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(UUIDHandler.getUUID(plr))) && !Permissions.hasPermission(plr, "plots.admin.command.swap")) {
|
||||
MainUtil.sendMessage(plr, C.NO_PLOT_PERMS);
|
||||
return false;
|
||||
|
@ -27,6 +27,7 @@ import org.bukkit.Bukkit;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.database.DBFunc;
|
||||
import com.intellectualcrafters.plot.events.PlayerPlotTrustedEvent;
|
||||
import com.intellectualcrafters.plot.object.Location;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
@ -45,11 +46,11 @@ public class Trusted extends SubCommand {
|
||||
MainUtil.sendMessage(plr, C.TRUSTED_NEED_ARGUMENT);
|
||||
return true;
|
||||
}
|
||||
if (!BukkitPlayerFunctions.isInPlot(plr)) {
|
||||
MainUtil.sendMessage(plr, C.NOT_IN_PLOT);
|
||||
return true;
|
||||
}
|
||||
Location loc = plr.getLocation();
|
||||
final Plot plot = MainUtil.getPlot(loc);
|
||||
if (plot == null) {
|
||||
return !sendMessage(plr, C.NOT_IN_PLOT);
|
||||
}
|
||||
if ((plot == null) || !plot.hasOwner()) {
|
||||
MainUtil.sendMessage(plr, C.PLOT_UNOWNED);
|
||||
return false;
|
||||
|
@ -1,33 +0,0 @@
|
||||
package com.intellectualcrafters.plot.commands;
|
||||
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions;
|
||||
|
||||
/**
|
||||
* Created 2014-11-09 for PlotSquared
|
||||
*
|
||||
* @author Citymonstret
|
||||
*/
|
||||
public class Unban extends SubCommand {
|
||||
public Unban() {
|
||||
super(Command.UNBAN, "Alias for /plot denied remove", "/plot unban [player]", CommandCategory.ACTIONS, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean execute(final PlotPlayer plr, final String... args) {
|
||||
if (args.length < 1) {
|
||||
return MainUtil.sendMessage(plr, "&cUsage: &c" + this.usage);
|
||||
}
|
||||
if (!BukkitPlayerFunctions.isInPlot(plr)) {
|
||||
return sendMessage(plr, C.NOT_IN_PLOT);
|
||||
}
|
||||
final Plot plot = MainUtil.getPlot(loc);
|
||||
if (!plot.hasRights(plr)) {
|
||||
return sendMessage(plr, C.NO_PLOT_PERMS);
|
||||
}
|
||||
return plr.performCommand("plot denied remove " + args[0]);
|
||||
}
|
||||
}
|
@ -27,6 +27,7 @@ import org.bukkit.World;
|
||||
import com.intellectualcrafters.plot.PlotSquared;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.database.DBFunc;
|
||||
import com.intellectualcrafters.plot.object.Location;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.object.PlotWorld;
|
||||
@ -41,10 +42,11 @@ public class Unclaim extends SubCommand {
|
||||
|
||||
@Override
|
||||
public boolean execute(final PlotPlayer plr, final String... args) {
|
||||
if (!BukkitPlayerFunctions.isInPlot(plr)) {
|
||||
Location loc = plr.getLocation();
|
||||
final Plot plot = MainUtil.getPlot(loc);
|
||||
if (plot == null) {
|
||||
return !sendMessage(plr, C.NOT_IN_PLOT);
|
||||
}
|
||||
final Plot plot = MainUtil.getPlot(loc);
|
||||
if (!MainUtil.getTopPlot(plr.getWorld(), plot).equals(BukkitPlayerFunctions.getBottomPlot(plr.getWorld(), plot))) {
|
||||
return !sendMessage(plr, C.UNLINK_REQUIRED);
|
||||
}
|
||||
|
@ -30,6 +30,7 @@ import com.intellectualcrafters.plot.PlotSquared;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.database.DBFunc;
|
||||
import com.intellectualcrafters.plot.events.PlotUnlinkEvent;
|
||||
import com.intellectualcrafters.plot.object.Location;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotId;
|
||||
import com.intellectualcrafters.plot.object.PlotManager;
|
||||
@ -51,10 +52,11 @@ public class Unlink extends SubCommand {
|
||||
|
||||
@Override
|
||||
public boolean execute(final PlotPlayer plr, final String... args) {
|
||||
if (!BukkitPlayerFunctions.isInPlot(plr)) {
|
||||
return sendMessage(plr, C.NOT_IN_PLOT);
|
||||
}
|
||||
Location loc = plr.getLocation();
|
||||
final Plot plot = MainUtil.getPlot(loc);
|
||||
if (plot == null) {
|
||||
return !sendMessage(plr, C.NOT_IN_PLOT);
|
||||
}
|
||||
if (((plot == null) || !plot.hasOwner() || !plot.getOwner().equals(UUIDHandler.getUUID(plr))) && !Permissions.hasPermission(plr, "plots.admin.command.unlink")) {
|
||||
return sendMessage(plr, C.NO_PLOT_PERMS);
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ package com.intellectualcrafters.plot.commands;
|
||||
import com.intellectualcrafters.plot.PlotSquared;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.Permissions;
|
||||
import com.intellectualcrafters.plot.util.bukkit.PWE;
|
||||
|
||||
public class WE_Anywhere extends SubCommand {
|
||||
|
Loading…
Reference in New Issue
Block a user