mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 21:26:45 +01:00
parent
9d77b422df
commit
f2431c869f
2
pom.xml
2
pom.xml
@ -8,7 +8,7 @@
|
|||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
</properties>
|
</properties>
|
||||||
<artifactId>PlotSquared</artifactId>
|
<artifactId>PlotSquared</artifactId>
|
||||||
<version>3.2.7</version>
|
<version>3.2.8</version>
|
||||||
<name>PlotSquared</name>
|
<name>PlotSquared</name>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
<build>
|
<build>
|
||||||
|
@ -1994,6 +1994,7 @@ public class PS {
|
|||||||
Settings.FANCY_CHAT = false;
|
Settings.FANCY_CHAT = false;
|
||||||
}
|
}
|
||||||
Settings.METRICS = config.getBoolean("metrics");
|
Settings.METRICS = config.getBoolean("metrics");
|
||||||
|
Settings.UPDATE_NOTIFICATIONS = config.getBoolean("update-notifications");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -0,0 +1,71 @@
|
|||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// 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.PS;
|
||||||
|
import com.intellectualcrafters.plot.config.C;
|
||||||
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
|
import com.intellectualcrafters.plot.object.StringWrapper;
|
||||||
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
|
import com.intellectualcrafters.plot.util.StringMan;
|
||||||
|
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||||
|
import com.plotsquared.general.commands.CommandDeclaration;
|
||||||
|
|
||||||
|
@CommandDeclaration(
|
||||||
|
command = "setalias",
|
||||||
|
permission = "plots.set.alias",
|
||||||
|
description = "Set the plot name",
|
||||||
|
usage = "/plot alias <alias>",
|
||||||
|
aliases = { "alias", "sa", "name", "rename", "setname", "seta" },
|
||||||
|
category = CommandCategory.ACTIONS,
|
||||||
|
requiredType = RequiredType.NONE)
|
||||||
|
public class Alias extends SetCommand {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean set(final PlotPlayer plr, final Plot plot, final String alias) {
|
||||||
|
if (alias.length() == 0) {
|
||||||
|
C.COMMAND_SYNTAX.send(plr, getUsage());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (alias.length() >= 50) {
|
||||||
|
MainUtil.sendMessage(plr, C.ALIAS_TOO_LONG);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!StringMan.isAlphanumericUnd(alias)) {
|
||||||
|
C.NOT_VALID_VALUE.send(plr);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
for (final Plot p : PS.get().getPlotsInWorld(plr.getLocation().getWorld())) {
|
||||||
|
if (p.getAlias().equalsIgnoreCase(alias)) {
|
||||||
|
MainUtil.sendMessage(plr, C.ALIAS_IS_TAKEN);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (UUIDHandler.nameExists(new StringWrapper(alias)) || PS.get().isPlotWorld(alias)) {
|
||||||
|
MainUtil.sendMessage(plr, C.ALIAS_IS_TAKEN);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
plot.setAlias(alias);
|
||||||
|
MainUtil.sendMessage(plr, C.ALIAS_SET_TO.s().replaceAll("%alias%", alias));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,64 @@
|
|||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// 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.BlockManager;
|
||||||
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
|
import com.intellectualcrafters.plot.util.StringMan;
|
||||||
|
import com.plotsquared.general.commands.CommandDeclaration;
|
||||||
|
|
||||||
|
@CommandDeclaration(
|
||||||
|
command = "setbiome",
|
||||||
|
permission = "plots.set.biome",
|
||||||
|
description = "Set the plot biome",
|
||||||
|
usage = "/plot biome [biome]",
|
||||||
|
aliases = { "biome", "sb", "setb", "b" },
|
||||||
|
category = CommandCategory.ACTIONS,
|
||||||
|
requiredType = RequiredType.NONE)
|
||||||
|
public class Biome extends SetCommand {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean set(final PlotPlayer plr, final Plot plot, final String value) {
|
||||||
|
final int biome = BlockManager.manager.getBiomeFromString(value);
|
||||||
|
if (biome == -1) {
|
||||||
|
String biomes = StringMan.join(BlockManager.manager.getBiomeList(), C.BLOCK_LIST_SEPARATER.s());
|
||||||
|
C.NEED_BIOME.send(plr);
|
||||||
|
MainUtil.sendMessage(plr, C.SUBCOMMAND_SET_OPTIONS_HEADER.s() + biomes);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (plot.getRunning() > 0) {
|
||||||
|
MainUtil.sendMessage(plr, C.WAIT_FOR_TIMER);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
plot.addRunning();
|
||||||
|
plot.setBiome(value.toUpperCase(), new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
plot.removeRunning();
|
||||||
|
MainUtil.sendMessage(plr, C.BIOME_SET_TO.s() + value.toLowerCase());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
@ -20,21 +20,16 @@
|
|||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
package com.intellectualcrafters.plot.commands;
|
package com.intellectualcrafters.plot.commands;
|
||||||
|
|
||||||
import java.util.HashSet;
|
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.PS;
|
import com.intellectualcrafters.plot.PS;
|
||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
import com.intellectualcrafters.plot.config.Settings;
|
|
||||||
import com.intellectualcrafters.plot.database.DBFunc;
|
|
||||||
import com.intellectualcrafters.plot.flag.Flag;
|
import com.intellectualcrafters.plot.flag.Flag;
|
||||||
import com.intellectualcrafters.plot.flag.FlagManager;
|
import com.intellectualcrafters.plot.flag.FlagManager;
|
||||||
import com.intellectualcrafters.plot.object.Location;
|
import com.intellectualcrafters.plot.object.Location;
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
import com.intellectualcrafters.plot.object.PlotHandler;
|
|
||||||
import com.intellectualcrafters.plot.object.PlotId;
|
import com.intellectualcrafters.plot.object.PlotId;
|
||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
import com.intellectualcrafters.plot.object.PlotWorld;
|
|
||||||
import com.intellectualcrafters.plot.util.EconHandler;
|
import com.intellectualcrafters.plot.util.EconHandler;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||||
@ -52,7 +47,6 @@ public class Buy extends SubCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(final PlotPlayer plr, final String... args) {
|
public boolean onCommand(final PlotPlayer plr, final String... args) {
|
||||||
|
|
||||||
if (EconHandler.manager == null) {
|
if (EconHandler.manager == null) {
|
||||||
return sendMessage(plr, C.ECON_DISABLED);
|
return sendMessage(plr, C.ECON_DISABLED);
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,57 @@
|
|||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// 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.flag.Flag;
|
||||||
|
import com.intellectualcrafters.plot.flag.FlagManager;
|
||||||
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
|
import com.plotsquared.general.commands.CommandDeclaration;
|
||||||
|
|
||||||
|
@CommandDeclaration(
|
||||||
|
command = "setdescription",
|
||||||
|
permission = "plots.set.desc",
|
||||||
|
description = "Set the plot description",
|
||||||
|
usage = "/plot desc <description>",
|
||||||
|
aliases = { "desc", "setdesc", "setd", "description" },
|
||||||
|
category = CommandCategory.ACTIONS,
|
||||||
|
requiredType = RequiredType.NONE)
|
||||||
|
public class Desc extends SetCommand {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean set(PlotPlayer plr, Plot plot, String desc) {
|
||||||
|
if (desc.length() == 0) {
|
||||||
|
plot.removeFlag("description");
|
||||||
|
MainUtil.sendMessage(plr, C.DESC_UNSET);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
final Flag flag = new Flag(FlagManager.getFlag("description"), desc);
|
||||||
|
final boolean result = FlagManager.addPlotFlag(plot, flag);
|
||||||
|
if (!result) {
|
||||||
|
MainUtil.sendMessage(plr, C.FLAG_NOT_ADDED);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
MainUtil.sendMessage(plr, C.DESC_SET);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
@ -39,10 +39,10 @@ import com.intellectualcrafters.plot.util.StringMan;
|
|||||||
import com.plotsquared.general.commands.CommandDeclaration;
|
import com.plotsquared.general.commands.CommandDeclaration;
|
||||||
|
|
||||||
@CommandDeclaration(
|
@CommandDeclaration(
|
||||||
command = "flag",
|
command = "setflag",
|
||||||
aliases = { "f" },
|
aliases = { "f", "flag", "setf", "setflag" },
|
||||||
usage = "/plot flag <set|remove|add|list|info> <flag> <value>",
|
usage = "/plot flag <set|remove|add|list|info> <flag> <value>",
|
||||||
description = "Manage plot flags",
|
description = "Set plot flags",
|
||||||
category = CommandCategory.ACTIONS,
|
category = CommandCategory.ACTIONS,
|
||||||
requiredType = RequiredType.NONE,
|
requiredType = RequiredType.NONE,
|
||||||
permission = "plots.flag")
|
permission = "plots.flag")
|
||||||
|
@ -22,6 +22,7 @@ package com.intellectualcrafters.plot.commands;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -51,6 +52,7 @@ import com.plotsquared.general.commands.CommandManager;
|
|||||||
public class MainCommand extends CommandManager<PlotPlayer> {
|
public class MainCommand extends CommandManager<PlotPlayer> {
|
||||||
|
|
||||||
private static MainCommand instance;
|
private static MainCommand instance;
|
||||||
|
private HashMap<String, Command<PlotPlayer>> setCommands;
|
||||||
|
|
||||||
public static MainCommand getInstance() {
|
public static MainCommand getInstance() {
|
||||||
if (instance == null) {
|
if (instance == null) {
|
||||||
@ -86,7 +88,6 @@ public class MainCommand extends CommandManager<PlotPlayer> {
|
|||||||
createCommand(new Toggle());
|
createCommand(new Toggle());
|
||||||
createCommand(new Clear());
|
createCommand(new Clear());
|
||||||
createCommand(new Delete());
|
createCommand(new Delete());
|
||||||
createCommand(new SetOwner());
|
|
||||||
createCommand(new Trust());
|
createCommand(new Trust());
|
||||||
createCommand(new Add());
|
createCommand(new Add());
|
||||||
createCommand(new Deny());
|
createCommand(new Deny());
|
||||||
@ -127,6 +128,12 @@ public class MainCommand extends CommandManager<PlotPlayer> {
|
|||||||
createCommand(new Done());
|
createCommand(new Done());
|
||||||
createCommand(new Continue());
|
createCommand(new Continue());
|
||||||
createCommand(new BO3());
|
createCommand(new BO3());
|
||||||
|
// set commands
|
||||||
|
createCommand(new Owner());
|
||||||
|
createCommand(new Desc());
|
||||||
|
createCommand(new Biome());
|
||||||
|
createCommand(new Alias());
|
||||||
|
createCommand(new SetHome());
|
||||||
if (Settings.ENABLE_CLUSTERS) {
|
if (Settings.ENABLE_CLUSTERS) {
|
||||||
MainCommand.getInstance().addCommand(new Cluster());
|
MainCommand.getInstance().addCommand(new Cluster());
|
||||||
}
|
}
|
||||||
@ -391,7 +398,6 @@ public class MainCommand extends CommandManager<PlotPlayer> {
|
|||||||
cmd = current;
|
cmd = current;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
System.out.print(StringMan.getString(allargs) + " | " + cmd + " | " + best);
|
|
||||||
if (cmd == null) {
|
if (cmd == null) {
|
||||||
cmd = new StringComparison<>(label, getCommandAndAliases(null, plr)).getMatchObject();
|
cmd = new StringComparison<>(label, getCommandAndAliases(null, plr)).getMatchObject();
|
||||||
}
|
}
|
||||||
|
@ -20,22 +20,16 @@
|
|||||||
////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
package com.intellectualcrafters.plot.commands;
|
package com.intellectualcrafters.plot.commands;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.PS;
|
|
||||||
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.object.Location;
|
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
import com.intellectualcrafters.plot.object.PlotId;
|
|
||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualcrafters.plot.util.Permissions;
|
import com.intellectualcrafters.plot.util.Permissions;
|
||||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
import com.intellectualcrafters.plot.util.UUIDHandler;
|
||||||
import com.plotsquared.general.commands.Argument;
|
|
||||||
import com.plotsquared.general.commands.CommandDeclaration;
|
import com.plotsquared.general.commands.CommandDeclaration;
|
||||||
|
|
||||||
@CommandDeclaration(
|
@CommandDeclaration(
|
||||||
@ -43,57 +37,36 @@ command = "setowner",
|
|||||||
permission = "plots.set.owner",
|
permission = "plots.set.owner",
|
||||||
description = "Set the plot owner",
|
description = "Set the plot owner",
|
||||||
usage = "/plot setowner <player>",
|
usage = "/plot setowner <player>",
|
||||||
aliases = { "so" },
|
aliases = { "owner", "so", "seto" },
|
||||||
category = CommandCategory.ACTIONS,
|
category = CommandCategory.ACTIONS,
|
||||||
requiredType = RequiredType.NONE)
|
requiredType = RequiredType.NONE)
|
||||||
public class SetOwner extends SubCommand {
|
public class Owner extends SetCommand {
|
||||||
|
|
||||||
public SetOwner() {
|
|
||||||
requiredArguments = new Argument[] { Argument.PlayerName };
|
|
||||||
}
|
|
||||||
|
|
||||||
private UUID getUUID(final String string) {
|
|
||||||
return UUIDHandler.getUUID(string, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCommand(final PlotPlayer plr, final String[] args) {
|
public boolean set(PlotPlayer plr, Plot plot, String value) {
|
||||||
final Location loc = plr.getLocation();
|
|
||||||
final Plot plot = MainUtil.getPlotAbs(loc);
|
|
||||||
if ((plot == null) || ((plot.owner == null) && !Permissions.hasPermission(plr, "plots.admin.command.setowner"))) {
|
|
||||||
MainUtil.sendMessage(plr, C.NOT_IN_PLOT);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (args.length < 1) {
|
|
||||||
MainUtil.sendMessage(plr, C.NEED_USER);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
HashSet<Plot> plots = MainUtil.getConnectedPlots(plot);
|
HashSet<Plot> plots = MainUtil.getConnectedPlots(plot);
|
||||||
UUID uuid = UUIDHandler.getUUID(args[0], null);
|
final PlotPlayer other = UUIDHandler.getPlayer(value);
|
||||||
final PlotPlayer other = UUIDHandler.getPlayer(args[0]);
|
UUID uuid;
|
||||||
if (other == null) {
|
uuid = other == null ? (Permissions.hasPermission(plr, "plots.admin.command.setowner") ? UUIDHandler.getUUID(value, null) : null) : other.getUUID();
|
||||||
if (uuid == null || !Permissions.hasPermission(plr, "plots.admin.command.setowner")) {
|
if (uuid == null) {
|
||||||
MainUtil.sendMessage(plr, C.INVALID_PLAYER, args[0]);
|
MainUtil.sendMessage(plr, C.INVALID_PLAYER, value);
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (!Permissions.hasPermission(plr, "plots.admin.command.setowner")) {
|
|
||||||
final int size = plots.size();
|
|
||||||
final int currentPlots = (Settings.GLOBAL_LIMIT ? MainUtil.getPlayerPlotCount(other) : MainUtil.getPlayerPlotCount(loc.getWorld(), other)) + size;
|
|
||||||
if (currentPlots > MainUtil.getAllowedPlots(other)) {
|
|
||||||
sendMessage(plr, C.CANT_TRANSFER_MORE_PLOTS);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (!plot.isOwner(plr.getUUID())) {
|
String name = other == null ? UUIDHandler.getName(uuid) : other.getName();
|
||||||
if (!Permissions.hasPermission(plr, "plots.admin.command.setowner")) {
|
if (plot.isOwner(uuid)) {
|
||||||
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.admin.command.setowner");
|
C.ALREADY_OWNER.send(plr);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
if (!Permissions.hasPermission(plr, "plots.admin.command.setowner")) {
|
||||||
|
final int size = plots.size();
|
||||||
|
final int currentPlots = (Settings.GLOBAL_LIMIT ? MainUtil.getPlayerPlotCount(other) : MainUtil.getPlayerPlotCount(plot.world, other)) + size;
|
||||||
|
if (currentPlots > MainUtil.getAllowedPlots(other)) {
|
||||||
|
sendMessage(plr, C.CANT_TRANSFER_MORE_PLOTS);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
plot.setOwner(uuid);
|
plot.setOwner(uuid);
|
||||||
MainUtil.setSign(args[0], plot);
|
MainUtil.setSign(name, plot);
|
||||||
MainUtil.sendMessage(plr, C.SET_OWNER);
|
MainUtil.sendMessage(plr, C.SET_OWNER);
|
||||||
if (other != null) {
|
if (other != null) {
|
||||||
MainUtil.sendMessage(other, C.NOW_OWNER, plot.world + ";" + plot.id);
|
MainUtil.sendMessage(other, C.NOW_OWNER, plot.world + ";" + plot.id);
|
@ -22,29 +22,25 @@ package com.intellectualcrafters.plot.commands;
|
|||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.HashSet;
|
||||||
|
|
||||||
import com.intellectualcrafters.plot.PS;
|
import com.intellectualcrafters.plot.PS;
|
||||||
import com.intellectualcrafters.plot.config.C;
|
import com.intellectualcrafters.plot.config.C;
|
||||||
import com.intellectualcrafters.plot.config.Configuration;
|
import com.intellectualcrafters.plot.config.Configuration;
|
||||||
import com.intellectualcrafters.plot.flag.AbstractFlag;
|
import com.intellectualcrafters.plot.flag.AbstractFlag;
|
||||||
import com.intellectualcrafters.plot.flag.Flag;
|
|
||||||
import com.intellectualcrafters.plot.flag.FlagManager;
|
import com.intellectualcrafters.plot.flag.FlagManager;
|
||||||
import com.intellectualcrafters.plot.object.BlockLoc;
|
|
||||||
import com.intellectualcrafters.plot.object.Location;
|
|
||||||
import com.intellectualcrafters.plot.object.Plot;
|
import com.intellectualcrafters.plot.object.Plot;
|
||||||
import com.intellectualcrafters.plot.object.PlotBlock;
|
import com.intellectualcrafters.plot.object.PlotBlock;
|
||||||
import com.intellectualcrafters.plot.object.PlotManager;
|
import com.intellectualcrafters.plot.object.PlotManager;
|
||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
import com.intellectualcrafters.plot.object.PlotWorld;
|
import com.intellectualcrafters.plot.object.PlotWorld;
|
||||||
import com.intellectualcrafters.plot.object.StringWrapper;
|
|
||||||
import com.intellectualcrafters.plot.util.BlockManager;
|
import com.intellectualcrafters.plot.util.BlockManager;
|
||||||
import com.intellectualcrafters.plot.util.MainUtil;
|
import com.intellectualcrafters.plot.util.MainUtil;
|
||||||
import com.intellectualcrafters.plot.util.Permissions;
|
import com.intellectualcrafters.plot.util.Permissions;
|
||||||
import com.intellectualcrafters.plot.util.SetBlockQueue;
|
import com.intellectualcrafters.plot.util.SetBlockQueue;
|
||||||
import com.intellectualcrafters.plot.util.StringComparison;
|
import com.intellectualcrafters.plot.util.StringComparison;
|
||||||
import com.intellectualcrafters.plot.util.StringMan;
|
import com.intellectualcrafters.plot.util.StringMan;
|
||||||
import com.intellectualcrafters.plot.util.UUIDHandler;
|
import com.plotsquared.general.commands.Command;
|
||||||
import com.plotsquared.general.commands.CommandDeclaration;
|
import com.plotsquared.general.commands.CommandDeclaration;
|
||||||
|
|
||||||
@CommandDeclaration(
|
@CommandDeclaration(
|
||||||
@ -59,228 +55,125 @@ public class Set extends SubCommand {
|
|||||||
public final static String[] values = new String[] { "biome", "alias", "home", "flag" };
|
public final static String[] values = new String[] { "biome", "alias", "home", "flag" };
|
||||||
public final static String[] aliases = new String[] { "b", "w", "wf", "f", "a", "h", "fl" };
|
public final static String[] aliases = new String[] { "b", "w", "wf", "f", "a", "h", "fl" };
|
||||||
|
|
||||||
@Override
|
private final SetCommand component;
|
||||||
public boolean onCommand(final PlotPlayer plr, final String... args) {
|
|
||||||
final Location loc = plr.getLocation();
|
|
||||||
final Plot plot = MainUtil.getPlotAbs(loc);
|
|
||||||
if (plot == null) {
|
|
||||||
return !sendMessage(plr, C.NOT_IN_PLOT);
|
|
||||||
}
|
|
||||||
if (!plot.hasOwner()) {
|
|
||||||
sendMessage(plr, C.PLOT_NOT_CLAIMED);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (!plot.isOwner(plr.getUUID())) {
|
|
||||||
if (!Permissions.hasPermission(plr, "plots.set.other")) {
|
|
||||||
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.set.other");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (args.length < 1) {
|
|
||||||
final PlotManager manager = PS.get().getPlotManager(loc.getWorld());
|
|
||||||
final ArrayList<String> newValues = new ArrayList<String>();
|
|
||||||
newValues.addAll(Arrays.asList(values));
|
|
||||||
newValues.addAll(Arrays.asList(manager.getPlotComponents(PS.get().getPlotWorld(loc.getWorld()), plot.id)));
|
|
||||||
MainUtil.sendMessage(plr, C.SUBCOMMAND_SET_OPTIONS_HEADER.s() + getArgumentList(newValues));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
for (int i = 0; i < aliases.length; i++) {
|
|
||||||
if (aliases[i].equalsIgnoreCase(args[0])) {
|
|
||||||
args[0] = values[i];
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (args[0].equalsIgnoreCase("flag")) {
|
|
||||||
List<String> arglist = new ArrayList<>(Arrays.asList("flag", "set"));
|
|
||||||
for (String arg : Arrays.copyOfRange(args, 1, args.length)) {
|
|
||||||
arglist.add(arg);
|
|
||||||
}
|
|
||||||
return MainCommand.onCommand(plr, "plot", arglist.toArray(new String[0]));
|
|
||||||
}
|
|
||||||
if (args[0].equalsIgnoreCase("home")) {
|
|
||||||
if (!Permissions.hasPermission(plr, "plots.set.home")) {
|
|
||||||
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.set.home");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (args.length > 1) {
|
|
||||||
if (args[1].equalsIgnoreCase("none")) {
|
|
||||||
plot.setHome(null);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return MainUtil.sendMessage(plr, C.HOME_ARGUMENT);
|
|
||||||
}
|
|
||||||
//set to current location
|
|
||||||
final String world = plr.getLocation().getWorld();
|
|
||||||
final Location base = MainUtil.getPlotBottomLocAbs(world, plot.id).subtract(1, 0, 1);
|
|
||||||
base.setY(0);
|
|
||||||
final Location relative = plr.getLocation().subtract(base.getX(), base.getY(), base.getZ());
|
|
||||||
final BlockLoc blockloc = new BlockLoc(relative.getX(), relative.getY(), relative.getZ(), relative.getYaw(), relative.getPitch());
|
|
||||||
plot.setHome(blockloc);
|
|
||||||
return MainUtil.sendMessage(plr, C.POSITION_SET);
|
|
||||||
}
|
|
||||||
if (args[0].equalsIgnoreCase("desc")) {
|
|
||||||
if (!Permissions.hasPermission(plr, "plots.set.desc")) {
|
|
||||||
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.set.desc");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (args.length < 2) {
|
|
||||||
MainUtil.sendMessage(plr, C.MISSING_DESC);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
final StringBuilder desc = new StringBuilder();
|
|
||||||
for (int i = 1; i < args.length; i++) {
|
|
||||||
desc.append(args[i]).append(" ");
|
|
||||||
}
|
|
||||||
final String descValue = desc.substring(0, desc.length() - 1);
|
|
||||||
|
|
||||||
final Flag flag = new Flag(FlagManager.getFlag("description"), descValue);
|
public Set() {
|
||||||
final boolean result = FlagManager.addPlotFlag(plot, flag);
|
component = new SetCommand() {
|
||||||
if (!result) {
|
@Override
|
||||||
MainUtil.sendMessage(plr, C.FLAG_NOT_ADDED);
|
public boolean set(PlotPlayer plr, final Plot plot, String value) {
|
||||||
return false;
|
final String world = plr.getLocation().getWorld();
|
||||||
}
|
final PlotWorld plotworld = PS.get().getPlotWorld(world);
|
||||||
MainUtil.sendMessage(plr, C.DESC_SET);
|
final PlotManager manager = PS.get().getPlotManager(world);
|
||||||
return true;
|
final String[] components = manager.getPlotComponents(plotworld, plot.id);
|
||||||
}
|
final boolean allowUnsafe = DebugAllowUnsafe.unsafeAllowed.contains(plr.getUUID());
|
||||||
if (args[0].equalsIgnoreCase("alias")) {
|
|
||||||
if (!Permissions.hasPermission(plr, "plots.set.alias")) {
|
|
||||||
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.set.alias");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (args.length < 2) {
|
|
||||||
MainUtil.sendMessage(plr, C.MISSING_ALIAS);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
final String alias = args[1];
|
|
||||||
if (alias.length() >= 50) {
|
|
||||||
MainUtil.sendMessage(plr, C.ALIAS_TOO_LONG);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
for (final Plot p : PS.get().getPlotsInWorld(plr.getLocation().getWorld())) {
|
|
||||||
if (p.getAlias().equalsIgnoreCase(alias)) {
|
|
||||||
MainUtil.sendMessage(plr, C.ALIAS_IS_TAKEN);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (UUIDHandler.nameExists(new StringWrapper(alias))) {
|
|
||||||
MainUtil.sendMessage(plr, C.ALIAS_IS_TAKEN);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
plot.setAlias(alias);
|
|
||||||
MainUtil.sendMessage(plr, C.ALIAS_SET_TO.s().replaceAll("%alias%", alias));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (args[0].equalsIgnoreCase("biome")) {
|
|
||||||
if (!Permissions.hasPermission(plr, "plots.set.biome")) {
|
|
||||||
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.set.biome");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (args.length < 2) {
|
|
||||||
MainUtil.sendMessage(plr, C.NEED_BIOME);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (args[1].length() < 2) {
|
|
||||||
sendMessage(plr, C.NAME_LITTLE, "Biome", args[1].length() + "", "2");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
final int biome = BlockManager.manager.getBiomeFromString(args[1]);
|
|
||||||
if (biome == -1) {
|
|
||||||
MainUtil.sendMessage(plr, getBiomeList(BlockManager.manager.getBiomeList()));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (plot.getRunning() > 0) {
|
|
||||||
MainUtil.sendMessage(plr, C.WAIT_FOR_TIMER);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
plot.addRunning();
|
|
||||||
plot.setBiome(args[1].toUpperCase(), new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
plot.removeRunning();
|
|
||||||
MainUtil.sendMessage(plr, C.BIOME_SET_TO.s() + args[1].toLowerCase());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (args[0].equalsIgnoreCase("limit")) {
|
|
||||||
// /plot set limit Empire92 +1
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
// Get components
|
|
||||||
final String world = plr.getLocation().getWorld();
|
|
||||||
final PlotWorld plotworld = PS.get().getPlotWorld(world);
|
|
||||||
final PlotManager manager = PS.get().getPlotManager(world);
|
|
||||||
final String[] components = manager.getPlotComponents(plotworld, plot.id);
|
|
||||||
|
|
||||||
final boolean allowUnsafe = DebugAllowUnsafe.unsafeAllowed.contains(plr.getUUID());
|
String[] args = value.split(" ");
|
||||||
|
String material = StringMan.join(Arrays.copyOfRange(args, 1, args.length), ",").trim();
|
||||||
|
|
||||||
for (final String component : components) {
|
for (final String component : components) {
|
||||||
if (component.equalsIgnoreCase(args[0])) {
|
if (component.equalsIgnoreCase(args[0])) {
|
||||||
if (!Permissions.hasPermission(plr, "plots.set." + component)) {
|
if (!Permissions.hasPermission(plr, "plots.set." + component)) {
|
||||||
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.set." + component);
|
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.set." + component);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
PlotBlock[] blocks;
|
PlotBlock[] blocks;
|
||||||
try {
|
try {
|
||||||
if (args.length < 2) {
|
if (args.length < 2) {
|
||||||
MainUtil.sendMessage(plr, C.NEED_BLOCK);
|
MainUtil.sendMessage(plr, C.NEED_BLOCK);
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
final String[] split = args[1].split(",");
|
|
||||||
blocks = Configuration.BLOCKLIST.parseString(args[1]);
|
|
||||||
for (int i = 0; i < blocks.length; i++) {
|
|
||||||
final PlotBlock block = blocks[i];
|
|
||||||
if (block == null) {
|
|
||||||
MainUtil.sendMessage(plr, C.NOT_VALID_BLOCK, split[i]);
|
|
||||||
String name;
|
|
||||||
if (split[i].contains("%")) {
|
|
||||||
name = split[i].split("%")[1];
|
|
||||||
} else {
|
|
||||||
name = split[i];
|
|
||||||
}
|
}
|
||||||
final StringComparison<PlotBlock>.ComparisonResult match = BlockManager.manager.getClosestBlock(name);
|
final String[] split = material.split(",");
|
||||||
if (match != null) {
|
blocks = Configuration.BLOCKLIST.parseString(material);
|
||||||
name = BlockManager.manager.getClosestMatchingName(match.best);
|
for (int i = 0; i < blocks.length; i++) {
|
||||||
if (name != null) {
|
final PlotBlock block = blocks[i];
|
||||||
MainUtil.sendMessage(plr, C.DID_YOU_MEAN, name.toLowerCase());
|
if (block == null) {
|
||||||
|
MainUtil.sendMessage(plr, C.NOT_VALID_BLOCK, split[i]);
|
||||||
|
String name;
|
||||||
|
if (split[i].contains("%")) {
|
||||||
|
name = split[i].split("%")[1];
|
||||||
|
} else {
|
||||||
|
name = split[i];
|
||||||
|
}
|
||||||
|
final StringComparison<PlotBlock>.ComparisonResult match = BlockManager.manager.getClosestBlock(name);
|
||||||
|
if (match != null) {
|
||||||
|
name = BlockManager.manager.getClosestMatchingName(match.best);
|
||||||
|
if (name != null) {
|
||||||
|
MainUtil.sendMessage(plr, C.DID_YOU_MEAN, name.toLowerCase());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
} else if (!allowUnsafe && !BlockManager.manager.isBlockSolid(block)) {
|
||||||
|
MainUtil.sendMessage(plr, C.NOT_ALLOWED_BLOCK, block.toString());
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
if (!allowUnsafe) {
|
||||||
} else if (!allowUnsafe && !BlockManager.manager.isBlockSolid(block)) {
|
for (final PlotBlock block : blocks) {
|
||||||
MainUtil.sendMessage(plr, C.NOT_ALLOWED_BLOCK, block.toString());
|
if (!BlockManager.manager.isBlockSolid(block)) {
|
||||||
return false;
|
MainUtil.sendMessage(plr, C.NOT_ALLOWED_BLOCK, block.toString());
|
||||||
}
|
return false;
|
||||||
}
|
}
|
||||||
if (!allowUnsafe) {
|
}
|
||||||
for (final PlotBlock block : blocks) {
|
|
||||||
if (!BlockManager.manager.isBlockSolid(block)) {
|
|
||||||
MainUtil.sendMessage(plr, C.NOT_ALLOWED_BLOCK, block.toString());
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
} catch (final Exception e2) {
|
||||||
|
MainUtil.sendMessage(plr, C.NOT_VALID_BLOCK, material);
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
if (plot.getRunning() > 0) {
|
||||||
|
MainUtil.sendMessage(plr, C.WAIT_FOR_TIMER);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
plot.addRunning();
|
||||||
|
for (Plot current : MainUtil.getConnectedPlots(plot)) {
|
||||||
|
manager.setComponent(plotworld, current.id, component, blocks);
|
||||||
|
}
|
||||||
|
MainUtil.sendMessage(plr, C.GENERATING_COMPONENT);
|
||||||
|
SetBlockQueue.addNotify(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
plot.removeRunning();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
} catch (final Exception e2) {
|
|
||||||
MainUtil.sendMessage(plr, C.NOT_VALID_BLOCK, args[1]);
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
if (plot.getRunning() > 0) {
|
return false;
|
||||||
MainUtil.sendMessage(plr, C.WAIT_FOR_TIMER);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
plot.addRunning();
|
|
||||||
for (Plot current : MainUtil.getConnectedPlots(plot)) {
|
|
||||||
manager.setComponent(plotworld, current.id, component, blocks);
|
|
||||||
}
|
|
||||||
MainUtil.sendMessage(plr, C.GENERATING_COMPONENT);
|
|
||||||
SetBlockQueue.addNotify(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
plot.removeRunning();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean noArgs(PlotPlayer plr) {
|
||||||
|
final ArrayList<String> newValues = new ArrayList<String>();
|
||||||
|
newValues.addAll(Arrays.asList("biome", "alias", "home", "flag"));
|
||||||
|
Plot plot = plr.getCurrentPlot();
|
||||||
|
if (plot != null) {
|
||||||
|
newValues.addAll(Arrays.asList(plot.getManager().getPlotComponents(plot.getWorld(), plot.id)));
|
||||||
}
|
}
|
||||||
|
MainUtil.sendMessage(plr, C.SUBCOMMAND_SET_OPTIONS_HEADER.s() + StringMan.join(newValues, C.BLOCK_LIST_SEPARATER.formatted()));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onCommand(final PlotPlayer plr, final String... args) {
|
||||||
|
if (args.length == 0) {
|
||||||
|
return noArgs(plr);
|
||||||
|
}
|
||||||
|
Command<PlotPlayer> cmd = MainCommand.getInstance().getCommand("set" + args[0]);
|
||||||
|
if (cmd != null) {
|
||||||
|
return cmd.onCommand(plr, Arrays.copyOfRange(args, 1, args.length));
|
||||||
|
}
|
||||||
|
// Additional checks
|
||||||
|
Plot plot = plr.getCurrentPlot();
|
||||||
|
if (plot == null) {
|
||||||
|
MainUtil.sendMessage(plr, C.NOT_IN_PLOT);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
// components
|
||||||
|
HashSet<String> components = new HashSet<String>(Arrays.asList(plot.getManager().getPlotComponents(plot.getWorld(), plot.id)));
|
||||||
|
if (components.contains(args[0].toLowerCase())) {
|
||||||
|
return component.set(plr, plot, StringMan.join(args, " "));
|
||||||
|
}
|
||||||
|
// flag
|
||||||
{
|
{
|
||||||
AbstractFlag af;
|
AbstractFlag af;
|
||||||
try {
|
try {
|
||||||
@ -299,31 +192,6 @@ public class Set extends SubCommand {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
final ArrayList<String> newValues = new ArrayList<String>();
|
return noArgs(plr);
|
||||||
newValues.addAll(Arrays.asList(values));
|
|
||||||
newValues.addAll(Arrays.asList(manager.getPlotComponents(PS.get().getPlotWorld(loc.getWorld()), plot.id)));
|
|
||||||
MainUtil.sendMessage(plr, C.SUBCOMMAND_SET_OPTIONS_HEADER.s() + getArgumentList(newValues));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
private String getString(final String s) {
|
|
||||||
return StringMan.replaceAll(C.BLOCK_LIST_ITEM.s(), "%mat%", s);
|
|
||||||
}
|
|
||||||
|
|
||||||
private String getArgumentList(final List<String> newValues) {
|
|
||||||
final StringBuilder builder = new StringBuilder();
|
|
||||||
for (final String s : newValues) {
|
|
||||||
builder.append(getString(s));
|
|
||||||
}
|
|
||||||
return builder.toString().substring(1, builder.toString().length() - 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
private String getBiomeList(final String[] biomes) {
|
|
||||||
final StringBuilder builder = new StringBuilder();
|
|
||||||
builder.append(C.NEED_BIOME.s());
|
|
||||||
for (final String b : biomes) {
|
|
||||||
builder.append(getString(b));
|
|
||||||
}
|
|
||||||
return builder.toString().substring(1, builder.toString().length() - 1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,42 @@
|
|||||||
|
package com.intellectualcrafters.plot.commands;
|
||||||
|
|
||||||
|
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;
|
||||||
|
import com.intellectualcrafters.plot.util.Permissions;
|
||||||
|
import com.intellectualcrafters.plot.util.StringMan;
|
||||||
|
|
||||||
|
public abstract class SetCommand extends SubCommand {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean onCommand(PlotPlayer plr, String[] args) {
|
||||||
|
final Location loc = plr.getLocation();
|
||||||
|
final Plot plot = MainUtil.getPlotAbs(loc);
|
||||||
|
if (plot == null) {
|
||||||
|
return !sendMessage(plr, C.NOT_IN_PLOT);
|
||||||
|
}
|
||||||
|
if (!plot.hasOwner()) {
|
||||||
|
if (!Permissions.hasPermission(plr, "plots.admin.command." + getCommand())) {
|
||||||
|
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.admin.command." + getCommand());
|
||||||
|
MainUtil.sendMessage(plr, C.PLOT_NOT_CLAIMED);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!plot.isOwner(plr.getUUID())) {
|
||||||
|
if (!Permissions.hasPermission(plr, "plots.admin.command." + getCommand())) {
|
||||||
|
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.admin.command." + getCommand());
|
||||||
|
MainUtil.sendMessage(plr, C.NO_PLOT_PERMS);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (args.length == 0) {
|
||||||
|
return set(plr, plot, "");
|
||||||
|
}
|
||||||
|
return set(plr, plot, StringMan.join(args, " "));
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract boolean set(PlotPlayer plr, Plot plot, String value);
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,66 @@
|
|||||||
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
// 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.BlockLoc;
|
||||||
|
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.plotsquared.general.commands.CommandDeclaration;
|
||||||
|
|
||||||
|
@CommandDeclaration(
|
||||||
|
command = "sethome",
|
||||||
|
permission = "plots.set.home",
|
||||||
|
description = "Set the plot home",
|
||||||
|
usage = "/plot sethome [none]",
|
||||||
|
aliases = { "sh", "seth" },
|
||||||
|
category = CommandCategory.ACTIONS,
|
||||||
|
requiredType = RequiredType.NONE)
|
||||||
|
public class SetHome extends SetCommand {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean set(final PlotPlayer plr, final Plot plot, final String value) {
|
||||||
|
switch (value.toLowerCase()) {
|
||||||
|
case "unset":
|
||||||
|
case "remove":
|
||||||
|
case "none": {
|
||||||
|
plot.setHome(null);
|
||||||
|
MainUtil.sendMessage(plr, C.POSITION_UNSET);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
case "": {
|
||||||
|
final String world = plr.getLocation().getWorld();
|
||||||
|
final Location base = MainUtil.getPlotBottomLocAbs(world, plot.id).subtract(1, 0, 1);
|
||||||
|
base.setY(0);
|
||||||
|
final Location relative = plr.getLocation().subtract(base.getX(), base.getY(), base.getZ());
|
||||||
|
final BlockLoc blockloc = new BlockLoc(relative.getX(), relative.getY(), relative.getZ(), relative.getYaw(), relative.getPitch());
|
||||||
|
plot.setHome(blockloc);
|
||||||
|
return MainUtil.sendMessage(plr, C.POSITION_SET);
|
||||||
|
}
|
||||||
|
default: {
|
||||||
|
MainUtil.sendMessage(plr, C.HOME_ARGUMENT);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -298,6 +298,7 @@ public enum C {
|
|||||||
BOSSBAR_CLEARING("$2Clearing plot: $1%id%", "Bar API"),
|
BOSSBAR_CLEARING("$2Clearing plot: $1%id%", "Bar API"),
|
||||||
|
|
||||||
DESC_SET("$2Plot description set", "Desc"),
|
DESC_SET("$2Plot description set", "Desc"),
|
||||||
|
DESC_UNSET("$2Plot description unset", "Desc"),
|
||||||
MISSING_DESC("$2You need to specify a description", "Desc"),
|
MISSING_DESC("$2You need to specify a description", "Desc"),
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -312,6 +313,7 @@ public enum C {
|
|||||||
*/
|
*/
|
||||||
MISSING_POSITION("$2You need to specify a position. Possible values: $1none", "Position"),
|
MISSING_POSITION("$2You need to specify a position. Possible values: $1none", "Position"),
|
||||||
POSITION_SET("$1Home position set to your current location", "Position"),
|
POSITION_SET("$1Home position set to your current location", "Position"),
|
||||||
|
POSITION_UNSET("$1Home position reset to the default location", "Position"),
|
||||||
HOME_ARGUMENT("$2Use /plot set home [none]", "Position"),
|
HOME_ARGUMENT("$2Use /plot set home [none]", "Position"),
|
||||||
INVALID_POSITION("$2That is not a valid position value", "Position"),
|
INVALID_POSITION("$2That is not a valid position value", "Position"),
|
||||||
/*
|
/*
|
||||||
@ -389,7 +391,6 @@ public enum C {
|
|||||||
/*
|
/*
|
||||||
* Block List
|
* Block List
|
||||||
*/
|
*/
|
||||||
BLOCK_LIST_ITEM(" $1%mat%$2,", "Block List"),
|
|
||||||
BLOCK_LIST_SEPARATER("$1,$2 ", "Block List"),
|
BLOCK_LIST_SEPARATER("$1,$2 ", "Block List"),
|
||||||
/*
|
/*
|
||||||
* Biome
|
* Biome
|
||||||
@ -539,7 +540,6 @@ public enum C {
|
|||||||
FLAG_KEY("$2Key: %s", "Flag"),
|
FLAG_KEY("$2Key: %s", "Flag"),
|
||||||
FLAG_TYPE("$2Type: %s", "Flag"),
|
FLAG_TYPE("$2Type: %s", "Flag"),
|
||||||
FLAG_DESC("$2Desc: %s", "Flag"),
|
FLAG_DESC("$2Desc: %s", "Flag"),
|
||||||
NEED_KEY("$2Possible values: $1%values%", "Flag"),
|
|
||||||
NOT_VALID_FLAG("$2That is not a valid flag", "Flag"),
|
NOT_VALID_FLAG("$2That is not a valid flag", "Flag"),
|
||||||
NOT_VALID_VALUE("$2Flag values must be alphanumerical", "Flag"),
|
NOT_VALID_VALUE("$2Flag values must be alphanumerical", "Flag"),
|
||||||
FLAG_NOT_IN_PLOT("$2The plot does not have that flag", "Flag"),
|
FLAG_NOT_IN_PLOT("$2The plot does not have that flag", "Flag"),
|
||||||
|
@ -30,6 +30,11 @@ import java.util.List;
|
|||||||
public class Settings {
|
public class Settings {
|
||||||
public static boolean USE_SQLUUIDHANDLER = false;
|
public static boolean USE_SQLUUIDHANDLER = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public static boolean UPDATE_NOTIFICATIONS = true;
|
||||||
|
|
||||||
public static boolean ENABLE_CLUSTERS = false;
|
public static boolean ENABLE_CLUSTERS = false;
|
||||||
public static boolean FAST_CLEAR = false;
|
public static boolean FAST_CLEAR = false;
|
||||||
/**
|
/**
|
||||||
|
@ -81,7 +81,7 @@ public class HybridPlotManager extends ClassicPlotManager {
|
|||||||
final PlotId id2 = new PlotId(id.x + 1, id.y);
|
final PlotId id2 = new PlotId(id.x + 1, id.y);
|
||||||
final Location bot = getPlotBottomLocAbs(hpw, id2);
|
final Location bot = getPlotBottomLocAbs(hpw, id2);
|
||||||
final Location top = getPlotTopLocAbs(hpw, id);
|
final Location top = getPlotTopLocAbs(hpw, id);
|
||||||
final Location pos1 = new Location(plot.world, top.getX() + 1, 0, bot.getZ());
|
final Location pos1 = new Location(plot.world, top.getX() + 1, 0, bot.getZ() - 1);
|
||||||
final Location pos2 = new Location(plot.world, bot.getX(), 255, top.getZ() + 1);
|
final Location pos2 = new Location(plot.world, bot.getX(), 255, top.getZ() + 1);
|
||||||
createSchemAbs(hpw, pos1, pos2, hpw.ROAD_HEIGHT, true);
|
createSchemAbs(hpw, pos1, pos2, hpw.ROAD_HEIGHT, true);
|
||||||
return true;
|
return true;
|
||||||
@ -137,7 +137,7 @@ public class HybridPlotManager extends ClassicPlotManager {
|
|||||||
final PlotId id2 = new PlotId(id.x, id.y + 1);
|
final PlotId id2 = new PlotId(id.x, id.y + 1);
|
||||||
final Location bot = getPlotBottomLocAbs(hpw, id2);
|
final Location bot = getPlotBottomLocAbs(hpw, id2);
|
||||||
final Location top = getPlotTopLocAbs(hpw, id);
|
final Location top = getPlotTopLocAbs(hpw, id);
|
||||||
final Location pos1 = new Location(plot.world, bot.getX(), 0, top.getZ() + 1);
|
final Location pos1 = new Location(plot.world, bot.getX() - 1, 0, top.getZ() + 1);
|
||||||
final Location pos2 = new Location(plot.world, top.getX() + 1, 255, bot.getZ());
|
final Location pos2 = new Location(plot.world, top.getX() + 1, 255, bot.getZ());
|
||||||
createSchemAbs(hpw, pos1, pos2, hpw.ROAD_HEIGHT, true);
|
createSchemAbs(hpw, pos1, pos2, hpw.ROAD_HEIGHT, true);
|
||||||
return true;
|
return true;
|
||||||
|
@ -172,7 +172,9 @@ public class PlotAnalysis {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
wait(10000);
|
synchronized (this) {
|
||||||
|
wait(10000);
|
||||||
|
}
|
||||||
} catch (final InterruptedException e) {
|
} catch (final InterruptedException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package com.intellectualcrafters.plot.object;
|
package com.intellectualcrafters.plot.object;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
@ -66,6 +65,11 @@ public class PlotHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void setOwner(Plot plot, UUID owner) {
|
public static void setOwner(Plot plot, UUID owner) {
|
||||||
|
if (!plot.hasOwner()) {
|
||||||
|
plot.owner = owner;
|
||||||
|
plot.create();
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!plot.isMerged()) {
|
if (!plot.isMerged()) {
|
||||||
if (!plot.owner.equals(owner)) {
|
if (!plot.owner.equals(owner)) {
|
||||||
plot.owner = owner;
|
plot.owner = owner;
|
||||||
|
@ -1803,6 +1803,8 @@ public class MainUtil {
|
|||||||
occupied = true;
|
occupied = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// world border
|
||||||
|
updateWorldBorder(destination);
|
||||||
final ArrayDeque<RegionWrapper> regions = new ArrayDeque<>(getRegions(origin));
|
final ArrayDeque<RegionWrapper> regions = new ArrayDeque<>(getRegions(origin));
|
||||||
// move / swap data
|
// move / swap data
|
||||||
for (Plot plot : plots) {
|
for (Plot plot : plots) {
|
||||||
@ -1918,6 +1920,8 @@ public class MainUtil {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// world border
|
||||||
|
updateWorldBorder(destination);
|
||||||
// copy data
|
// copy data
|
||||||
for (Plot plot : plots) {
|
for (Plot plot : plots) {
|
||||||
Plot other = MainUtil.getPlotAbs(destination.world , new PlotId(plot.id.x + offset.x, plot.id.y + offset.y));
|
Plot other = MainUtil.getPlotAbs(destination.world , new PlotId(plot.id.x + offset.x, plot.id.y + offset.y));
|
||||||
|
@ -2,6 +2,7 @@ package com.plotsquared.bukkit.listeners;
|
|||||||
|
|
||||||
import static com.intellectualcrafters.plot.util.ReflectionUtils.getRefClass;
|
import static com.intellectualcrafters.plot.util.ReflectionUtils.getRefClass;
|
||||||
|
|
||||||
|
import java.util.ArrayDeque;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
|
|
||||||
@ -40,10 +41,11 @@ public class ChunkListener implements Listener {
|
|||||||
|
|
||||||
private Chunk lastChunk = null;
|
private Chunk lastChunk = null;
|
||||||
|
|
||||||
final RefClass classChunk = getRefClass("{nms}.Chunk");
|
private final RefClass classChunk = getRefClass("{nms}.Chunk");
|
||||||
final RefClass classCraftChunk = getRefClass("{cb}.CraftChunk");
|
private final RefClass classCraftChunk = getRefClass("{cb}.CraftChunk");
|
||||||
final RefMethod methodGetHandleChunk;
|
private RefMethod methodGetHandleChunk;
|
||||||
final RefField mustSave = classChunk.getField("mustSave");
|
private final RefField mustSave = classChunk.getField("mustSave");
|
||||||
|
|
||||||
|
|
||||||
public ChunkListener() {
|
public ChunkListener() {
|
||||||
RefMethod method;
|
RefMethod method;
|
||||||
@ -58,10 +60,11 @@ public class ChunkListener implements Listener {
|
|||||||
if (!Settings.CHUNK_PROCESSOR_GC) {
|
if (!Settings.CHUNK_PROCESSOR_GC) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
TaskManager.runTaskRepeat(new Runnable() {
|
TaskManager.runTask(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
final int distance = Bukkit.getViewDistance() + 1;
|
int time = 300;
|
||||||
|
final int distance = Bukkit.getViewDistance() + 2;
|
||||||
final HashMap<String, HashMap<ChunkLoc, Integer>> players = new HashMap<>();
|
final HashMap<String, HashMap<ChunkLoc, Integer>> players = new HashMap<>();
|
||||||
for (final Entry<String, PlotPlayer> entry : UUIDHandler.getPlayers().entrySet()) {
|
for (final Entry<String, PlotPlayer> entry : UUIDHandler.getPlayers().entrySet()) {
|
||||||
final PlotPlayer pp = entry.getValue();
|
final PlotPlayer pp = entry.getValue();
|
||||||
@ -107,32 +110,47 @@ public class ChunkListener implements Listener {
|
|||||||
}
|
}
|
||||||
for (final World world : Bukkit.getWorlds()) {
|
for (final World world : Bukkit.getWorlds()) {
|
||||||
final String name = world.getName();
|
final String name = world.getName();
|
||||||
final boolean autosave = world.isAutoSave();
|
|
||||||
if (!PS.get().isPlotWorld(name)) {
|
if (!PS.get().isPlotWorld(name)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (!Settings.CHUNK_PROCESSOR_TRIM_ON_SAVE && autosave) {
|
final boolean autosave = world.isAutoSave();
|
||||||
|
if (autosave) {
|
||||||
world.setAutoSave(false);
|
world.setAutoSave(false);
|
||||||
}
|
}
|
||||||
final HashMap<ChunkLoc, Integer> map = players.get(name);
|
final HashMap<ChunkLoc, Integer> map = players.get(name);
|
||||||
if ((map == null) || (map.size() == 0)) {
|
if ((map == null) || (map.size() == 0)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
for (final Chunk chunk : world.getLoadedChunks()) {
|
Chunk[] chunks = world.getLoadedChunks();
|
||||||
|
ArrayDeque<Chunk> toUnload = new ArrayDeque<Chunk>();
|
||||||
|
for (final Chunk chunk : chunks) {
|
||||||
final int x = chunk.getX();
|
final int x = chunk.getX();
|
||||||
final int z = chunk.getZ();
|
final int z = chunk.getZ();
|
||||||
if (!map.containsKey(new ChunkLoc(x, z))) {
|
if (!map.containsKey(new ChunkLoc(x, z))) {
|
||||||
|
toUnload.add(chunk);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (toUnload.size() > 0) {
|
||||||
|
long start = System.currentTimeMillis();
|
||||||
|
Chunk chunk;
|
||||||
|
while ((chunk = toUnload.poll()) != null && (System.currentTimeMillis() - start < 5)) {
|
||||||
if (!Settings.CHUNK_PROCESSOR_TRIM_ON_SAVE || !unloadChunk(name, chunk)) {
|
if (!Settings.CHUNK_PROCESSOR_TRIM_ON_SAVE || !unloadChunk(name, chunk)) {
|
||||||
chunk.unload(true, false);
|
if (chunk.isLoaded()) {
|
||||||
|
chunk.unload(true, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (toUnload.size() > 0) {
|
||||||
|
time = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (!Settings.CHUNK_PROCESSOR_TRIM_ON_SAVE && autosave) {
|
if (!Settings.CHUNK_PROCESSOR_TRIM_ON_SAVE && autosave) {
|
||||||
world.setAutoSave(true);
|
world.setAutoSave(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
TaskManager.runTaskLater(this, time);
|
||||||
}
|
}
|
||||||
}, 300);
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean unloadChunk(final String world, final Chunk chunk) {
|
public boolean unloadChunk(final String world, final Chunk chunk) {
|
||||||
@ -165,7 +183,9 @@ public class ChunkListener implements Listener {
|
|||||||
}
|
}
|
||||||
final Object c = methodGetHandleChunk.of(chunk).call();
|
final Object c = methodGetHandleChunk.of(chunk).call();
|
||||||
mustSave.of(c).set(false);
|
mustSave.of(c).set(false);
|
||||||
chunk.unload(false, false);
|
if (chunk.isLoaded()) {
|
||||||
|
chunk.unload(false, false);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,7 +25,6 @@ import org.bukkit.entity.Creature;
|
|||||||
import org.bukkit.entity.EnderDragon;
|
import org.bukkit.entity.EnderDragon;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.FallingBlock;
|
|
||||||
import org.bukkit.entity.Hanging;
|
import org.bukkit.entity.Hanging;
|
||||||
import org.bukkit.entity.HumanEntity;
|
import org.bukkit.entity.HumanEntity;
|
||||||
import org.bukkit.entity.LivingEntity;
|
import org.bukkit.entity.LivingEntity;
|
||||||
@ -43,7 +42,6 @@ import org.bukkit.event.block.Action;
|
|||||||
import org.bukkit.event.block.BlockBreakEvent;
|
import org.bukkit.event.block.BlockBreakEvent;
|
||||||
import org.bukkit.event.block.BlockDamageEvent;
|
import org.bukkit.event.block.BlockDamageEvent;
|
||||||
import org.bukkit.event.block.BlockDispenseEvent;
|
import org.bukkit.event.block.BlockDispenseEvent;
|
||||||
import org.bukkit.event.block.BlockExplodeEvent;
|
|
||||||
import org.bukkit.event.block.BlockFadeEvent;
|
import org.bukkit.event.block.BlockFadeEvent;
|
||||||
import org.bukkit.event.block.BlockFormEvent;
|
import org.bukkit.event.block.BlockFormEvent;
|
||||||
import org.bukkit.event.block.BlockFromToEvent;
|
import org.bukkit.event.block.BlockFromToEvent;
|
||||||
@ -88,7 +86,6 @@ import org.bukkit.event.world.StructureGrowEvent;
|
|||||||
import org.bukkit.help.HelpTopic;
|
import org.bukkit.help.HelpTopic;
|
||||||
import org.bukkit.inventory.ItemStack;
|
import org.bukkit.inventory.ItemStack;
|
||||||
import org.bukkit.metadata.FixedMetadataValue;
|
import org.bukkit.metadata.FixedMetadataValue;
|
||||||
import org.bukkit.metadata.LazyMetadataValue;
|
|
||||||
import org.bukkit.metadata.MetadataValue;
|
import org.bukkit.metadata.MetadataValue;
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
import org.bukkit.projectiles.BlockProjectileSource;
|
import org.bukkit.projectiles.BlockProjectileSource;
|
||||||
@ -111,7 +108,6 @@ import com.intellectualcrafters.plot.object.PlotManager;
|
|||||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||||
import com.intellectualcrafters.plot.object.PlotWorld;
|
import com.intellectualcrafters.plot.object.PlotWorld;
|
||||||
import com.intellectualcrafters.plot.object.StringWrapper;
|
import com.intellectualcrafters.plot.object.StringWrapper;
|
||||||
import com.intellectualcrafters.plot.util.ChunkManager;
|
|
||||||
import com.intellectualcrafters.plot.util.ClusterManager;
|
import com.intellectualcrafters.plot.util.ClusterManager;
|
||||||
import com.intellectualcrafters.plot.util.EventUtil;
|
import com.intellectualcrafters.plot.util.EventUtil;
|
||||||
import com.intellectualcrafters.plot.util.ExpireManager;
|
import com.intellectualcrafters.plot.util.ExpireManager;
|
||||||
@ -454,7 +450,7 @@ public class PlayerEvents extends com.plotsquared.listener.PlotListener implemen
|
|||||||
MainUtil.sendMessage(pp, C.WORLDEDIT_BYPASSED);
|
MainUtil.sendMessage(pp, C.WORLDEDIT_BYPASSED);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ((PS.get().update != null) && Permissions.hasPermission(pp, C.PERMISSION_ADMIN)) {
|
if ((PS.get().update != null) && Permissions.hasPermission(pp, C.PERMISSION_ADMIN) && Settings.UPDATE_NOTIFICATIONS) {
|
||||||
TaskManager.runTaskLater(new Runnable() {
|
TaskManager.runTaskLater(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
@ -74,7 +74,7 @@ public abstract class Command<E extends CommandCaller> extends CommandManager {
|
|||||||
return this.requiredType;
|
return this.requiredType;
|
||||||
}
|
}
|
||||||
|
|
||||||
final protected void create() {
|
final public void create() {
|
||||||
final Annotation annotation = getClass().getAnnotation(CommandDeclaration.class);
|
final Annotation annotation = getClass().getAnnotation(CommandDeclaration.class);
|
||||||
if (annotation == null) {
|
if (annotation == null) {
|
||||||
throw new RuntimeException("Command does not have a CommandDeclaration");
|
throw new RuntimeException("Command does not have a CommandDeclaration");
|
||||||
|
@ -13,8 +13,8 @@ import com.intellectualcrafters.plot.util.Permissions;
|
|||||||
@SuppressWarnings("unused")
|
@SuppressWarnings("unused")
|
||||||
public class CommandManager<T extends CommandCaller> {
|
public class CommandManager<T extends CommandCaller> {
|
||||||
|
|
||||||
protected final ConcurrentHashMap<String, Command<T>> commands;
|
final public ConcurrentHashMap<String, Command<T>> commands;
|
||||||
protected final Character initialCharacter;
|
final private Character initialCharacter;
|
||||||
|
|
||||||
public CommandManager() {
|
public CommandManager() {
|
||||||
this('/', new ArrayList<Command<T>>());
|
this('/', new ArrayList<Command<T>>());
|
||||||
|
Binary file not shown.
Loading…
Reference in New Issue
Block a user