mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-26 07:06:44 +01:00
loc
This commit is contained in:
parent
b2b4d827e8
commit
e41676544d
@ -20,8 +20,6 @@
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
package com.intellectualcrafters.plot.commands;
|
||||
|
||||
import net.milkbowl.vault.economy.Economy;
|
||||
|
||||
import com.intellectualcrafters.plot.PlotSquared;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.database.DBFunc;
|
||||
@ -32,7 +30,6 @@ import com.intellectualcrafters.plot.object.PlotWorld;
|
||||
import com.intellectualcrafters.plot.util.EconHandler;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.Permissions;
|
||||
import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions;
|
||||
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
||||
|
||||
public class Delete extends SubCommand {
|
||||
@ -58,7 +55,6 @@ public class Delete extends SubCommand {
|
||||
if (PlotSquared.economy != null && pWorld.USE_ECONOMY && (plot != null) && plot.hasOwner() && plot.getOwner().equals(UUIDHandler.getUUID(plr))) {
|
||||
final double c = pWorld.SELL_PRICE;
|
||||
if (c > 0d) {
|
||||
final Economy economy = PlotSquared.economy;
|
||||
EconHandler.depositPlayer(plr, c);
|
||||
sendMessage(plr, C.ADDED_BALANCE, c + "");
|
||||
}
|
||||
|
@ -28,9 +28,11 @@ import org.bukkit.entity.Player;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.database.DBFunc;
|
||||
import com.intellectualcrafters.plot.events.PlayerPlotDeniedEvent;
|
||||
import com.intellectualcrafters.plot.object.Location;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.Permissions;
|
||||
import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions;
|
||||
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
||||
|
||||
@ -46,11 +48,11 @@ public class Denied extends SubCommand {
|
||||
MainUtil.sendMessage(plr, C.DENIED_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;
|
||||
@ -77,14 +79,14 @@ public class Denied extends SubCommand {
|
||||
}
|
||||
if (plot.trusted.contains(uuid)) {
|
||||
plot.trusted.remove(uuid);
|
||||
DBFunc.removeTrusted(plr.getWorld().getName(), plot, uuid);
|
||||
DBFunc.removeTrusted(loc.getWorld(), plot, uuid);
|
||||
}
|
||||
if (plot.helpers.contains(uuid)) {
|
||||
plot.helpers.remove(uuid);
|
||||
DBFunc.removeHelper(plr.getWorld().getName(), plot, uuid);
|
||||
DBFunc.removeHelper(loc.getWorld(), plot, uuid);
|
||||
}
|
||||
plot.addDenied(uuid);
|
||||
DBFunc.setDenied(plr.getWorld().getName(), plot, uuid);
|
||||
DBFunc.setDenied(loc.getWorld(), plot, uuid);
|
||||
final PlayerPlotDeniedEvent event = new PlayerPlotDeniedEvent(plr, plot, uuid, true);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
} else {
|
||||
@ -109,13 +111,13 @@ public class Denied extends SubCommand {
|
||||
return true;
|
||||
}
|
||||
plot.removeDenied(uuid);
|
||||
DBFunc.removeDenied(plr.getWorld().getName(), plot, uuid);
|
||||
DBFunc.removeDenied(loc.getWorld(), plot, uuid);
|
||||
MainUtil.sendMessage(plr, C.DENIED_REMOVED);
|
||||
return true;
|
||||
}
|
||||
final UUID uuid = UUIDHandler.getUUID(args[1]);
|
||||
plot.removeDenied(uuid);
|
||||
DBFunc.removeDenied(plr.getWorld().getName(), plot, uuid);
|
||||
DBFunc.removeDenied(loc.getWorld(), plot, uuid);
|
||||
final PlayerPlotDeniedEvent event = new PlayerPlotDeniedEvent(plr, plot, uuid, false);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
MainUtil.sendMessage(plr, C.DENIED_REMOVED);
|
||||
|
@ -33,6 +33,7 @@ import com.intellectualcrafters.plot.flag.Flag;
|
||||
import com.intellectualcrafters.plot.flag.FlagManager;
|
||||
import com.intellectualcrafters.plot.flag.FlagValue;
|
||||
import com.intellectualcrafters.plot.listeners.PlotListener;
|
||||
import com.intellectualcrafters.plot.object.Location;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
@ -55,6 +56,7 @@ public class FlagCmd extends SubCommand {
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.COMMAND_SYNTAX, "/plot flag <set|remove|add|list|info>");
|
||||
return false;
|
||||
}
|
||||
Location loc = player.getLocation();
|
||||
final Plot plot = MainUtil.getPlot(loc);
|
||||
if (plot == null) {
|
||||
MainUtil.sendMessage(BukkitUtil.getPlayer(player), C.NOT_IN_PLOT);
|
||||
|
@ -75,14 +75,14 @@ public class Helpers extends SubCommand {
|
||||
}
|
||||
if (plot.trusted.contains(uuid)) {
|
||||
plot.trusted.remove(uuid);
|
||||
DBFunc.removeTrusted(plr.getWorld().getName(), plot, uuid);
|
||||
DBFunc.removeTrusted(loc.getWorld(), plot, uuid);
|
||||
}
|
||||
if (plot.denied.contains(uuid)) {
|
||||
plot.denied.remove(uuid);
|
||||
DBFunc.removeDenied(plr.getWorld().getName(), plot, uuid);
|
||||
DBFunc.removeDenied(loc.getWorld(), plot, uuid);
|
||||
}
|
||||
plot.addHelper(uuid);
|
||||
DBFunc.setHelper(plr.getWorld().getName(), plot, uuid);
|
||||
DBFunc.setHelper(loc.getWorld(), plot, uuid);
|
||||
final PlayerPlotHelperEvent event = new PlayerPlotHelperEvent(plr, plot, uuid, true);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
} else {
|
||||
@ -99,13 +99,13 @@ public class Helpers extends SubCommand {
|
||||
return true;
|
||||
}
|
||||
plot.removeHelper(uuid);
|
||||
DBFunc.removeHelper(plr.getWorld().getName(), plot, uuid);
|
||||
DBFunc.removeHelper(loc.getWorld(), plot, uuid);
|
||||
MainUtil.sendMessage(plr, C.HELPER_REMOVED);
|
||||
return true;
|
||||
}
|
||||
final UUID uuid = UUIDHandler.getUUID(args[1]);
|
||||
plot.removeHelper(uuid);
|
||||
DBFunc.removeHelper(plr.getWorld().getName(), plot, uuid);
|
||||
DBFunc.removeHelper(loc.getWorld(), plot, uuid);
|
||||
final PlayerPlotHelperEvent event = new PlayerPlotHelperEvent(plr, plot, uuid, false);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
MainUtil.sendMessage(plr, C.HELPER_REMOVED);
|
||||
|
@ -131,7 +131,7 @@ public class Inbox extends SubCommand {
|
||||
} else {
|
||||
below = true;
|
||||
}
|
||||
final String world = plr.getWorld().getName();
|
||||
final String world = loc.getWorld();
|
||||
final int tier2 = tier;
|
||||
Bukkit.getScheduler().runTaskAsynchronously(PlotSquared.getMain(), new Runnable() {
|
||||
@Override
|
||||
|
@ -257,7 +257,7 @@ public class Schematic extends SubCommand {
|
||||
return false;
|
||||
}
|
||||
p2 = myplot;
|
||||
world = plr.getWorld().getName();
|
||||
world = loc.getWorld();
|
||||
} else {
|
||||
if (args.length == 3) {
|
||||
try {
|
||||
|
@ -169,7 +169,7 @@ public class Set extends SubCommand {
|
||||
if (args.length > 1) {
|
||||
if (args[1].equalsIgnoreCase("none")) {
|
||||
plot.settings.setPosition(null);
|
||||
DBFunc.setPosition(plr.getWorld().getName(), plot, "");
|
||||
DBFunc.setPosition(loc.getWorld(), plot, "");
|
||||
return true;
|
||||
}
|
||||
return MainUtil.sendMessage(plr, C.HOME_ARGUMENT);
|
||||
@ -181,7 +181,7 @@ public class Set extends SubCommand {
|
||||
final Location relative = plr.getLocation().subtract(base);
|
||||
final BlockLoc blockloc = new BlockLoc(relative.getBlockX(), relative.getBlockY(), relative.getBlockZ());
|
||||
plot.settings.setPosition(blockloc);
|
||||
DBFunc.setPosition(plr.getWorld().getName(), plot, relative.getBlockX() + "," + relative.getBlockY() + "," + relative.getBlockZ());
|
||||
DBFunc.setPosition(loc.getWorld(), plot, relative.getBlockX() + "," + relative.getBlockY() + "," + relative.getBlockZ());
|
||||
return MainUtil.sendMessage(plr, C.POSITION_SET);
|
||||
}
|
||||
if (args[0].equalsIgnoreCase("alias")) {
|
||||
@ -204,7 +204,7 @@ public class Set extends SubCommand {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
DBFunc.setAlias(plr.getWorld().getName(), plot, alias);
|
||||
DBFunc.setAlias(loc.getWorld(), plot, alias);
|
||||
MainUtil.sendMessage(plr, C.ALIAS_SET_TO.s().replaceAll("%alias%", alias));
|
||||
return true;
|
||||
}
|
||||
|
@ -76,14 +76,14 @@ public class Trusted extends SubCommand {
|
||||
}
|
||||
if (plot.helpers.contains(uuid)) {
|
||||
plot.helpers.remove(uuid);
|
||||
DBFunc.removeHelper(plr.getWorld().getName(), plot, uuid);
|
||||
DBFunc.removeHelper(loc.getWorld(), plot, uuid);
|
||||
}
|
||||
if (plot.denied.contains(uuid)) {
|
||||
plot.denied.remove(uuid);
|
||||
DBFunc.removeDenied(plr.getWorld().getName(), plot, uuid);
|
||||
DBFunc.removeDenied(loc.getWorld(), plot, uuid);
|
||||
}
|
||||
plot.addTrusted(uuid);
|
||||
DBFunc.setTrusted(plr.getWorld().getName(), plot, uuid);
|
||||
DBFunc.setTrusted(loc.getWorld(), plot, uuid);
|
||||
final PlayerPlotTrustedEvent event = new PlayerPlotTrustedEvent(plr, plot, uuid, true);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
} else {
|
||||
@ -100,13 +100,13 @@ public class Trusted extends SubCommand {
|
||||
return true;
|
||||
}
|
||||
plot.removeTrusted(uuid);
|
||||
DBFunc.removeTrusted(plr.getWorld().getName(), plot, uuid);
|
||||
DBFunc.removeTrusted(loc.getWorld(), plot, uuid);
|
||||
MainUtil.sendMessage(plr, C.TRUSTED_REMOVED);
|
||||
return true;
|
||||
}
|
||||
final UUID uuid = UUIDHandler.getUUID(args[1]);
|
||||
plot.removeTrusted(uuid);
|
||||
DBFunc.removeTrusted(plr.getWorld().getName(), plot, uuid);
|
||||
DBFunc.removeTrusted(loc.getWorld(), plot, uuid);
|
||||
final PlayerPlotTrustedEvent event = new PlayerPlotTrustedEvent(plr, plot, uuid, false);
|
||||
Bukkit.getPluginManager().callEvent(event);
|
||||
MainUtil.sendMessage(plr, C.TRUSTED_REMOVED);
|
||||
|
@ -61,7 +61,7 @@ public class Unclaim extends SubCommand {
|
||||
sendMessage(plr, C.ADDED_BALANCE, c + "");
|
||||
}
|
||||
}
|
||||
final boolean result = PlotSquared.removePlot(plr.getWorld().getName(), plot.id, true);
|
||||
final boolean result = PlotSquared.removePlot(loc.getWorld(), plot.id, true);
|
||||
if (result) {
|
||||
final World world = plr.getWorld();
|
||||
final String worldname = world.getName();
|
||||
|
Loading…
Reference in New Issue
Block a user