2014-11-08 20:27:09 +01:00
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// 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 /
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////////////////
|
2014-09-22 13:02:14 +02:00
|
|
|
package com.intellectualcrafters.plot.commands;
|
|
|
|
|
2015-01-13 17:38:15 +01:00
|
|
|
import java.util.Arrays;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
|
import org.bukkit.ChatColor;
|
|
|
|
import org.bukkit.Location;
|
|
|
|
import org.bukkit.Material;
|
|
|
|
import org.bukkit.World;
|
|
|
|
import org.bukkit.block.Biome;
|
|
|
|
import org.bukkit.entity.Player;
|
|
|
|
|
2015-02-19 11:29:17 +01:00
|
|
|
import com.intellectualcrafters.plot.BukkitMain;
|
2015-02-19 09:51:10 +01:00
|
|
|
import com.intellectualcrafters.plot.PlotSquared;
|
2014-11-16 10:48:18 +01:00
|
|
|
import com.intellectualcrafters.plot.config.C;
|
2015-02-17 12:51:58 +01:00
|
|
|
import com.intellectualcrafters.plot.config.Configuration;
|
2014-11-08 20:27:09 +01:00
|
|
|
import com.intellectualcrafters.plot.database.DBFunc;
|
2014-11-16 10:48:18 +01:00
|
|
|
import com.intellectualcrafters.plot.flag.AbstractFlag;
|
|
|
|
import com.intellectualcrafters.plot.flag.Flag;
|
|
|
|
import com.intellectualcrafters.plot.flag.FlagManager;
|
2014-11-08 20:27:09 +01:00
|
|
|
import com.intellectualcrafters.plot.listeners.PlotListener;
|
2015-01-12 16:52:33 +01:00
|
|
|
import com.intellectualcrafters.plot.object.BlockLoc;
|
2014-11-16 10:48:18 +01:00
|
|
|
import com.intellectualcrafters.plot.object.Plot;
|
|
|
|
import com.intellectualcrafters.plot.object.PlotBlock;
|
2015-02-17 12:51:58 +01:00
|
|
|
import com.intellectualcrafters.plot.object.PlotManager;
|
2014-11-16 10:48:18 +01:00
|
|
|
import com.intellectualcrafters.plot.object.PlotWorld;
|
2015-01-23 01:14:14 +01:00
|
|
|
import com.intellectualcrafters.plot.object.StringWrapper;
|
2015-02-20 12:23:48 +01:00
|
|
|
import com.intellectualcrafters.plot.util.MainUtil;
|
2014-11-16 10:48:18 +01:00
|
|
|
import com.intellectualcrafters.plot.util.StringComparison;
|
2015-02-20 12:24:58 +01:00
|
|
|
import com.intellectualcrafters.plot.util.bukkit.BukkitPlayerFunctions;
|
2015-02-20 07:28:21 +01:00
|
|
|
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
2015-01-12 16:52:33 +01:00
|
|
|
|
2014-09-22 13:02:14 +02:00
|
|
|
/**
|
|
|
|
* @author Citymonstret
|
|
|
|
*/
|
2014-10-03 04:36:30 +02:00
|
|
|
public class Set extends SubCommand {
|
2015-02-20 07:34:19 +01:00
|
|
|
public final static String[] values = new String[] { "biome", "wall", "wall_filling", "floor", "alias", "home", "flag" };
|
|
|
|
public final static String[] aliases = new String[] { "b", "w", "wf", "f", "a", "h", "fl" };
|
|
|
|
|
2014-11-05 04:42:08 +01:00
|
|
|
public Set() {
|
|
|
|
super(Command.SET, "Set a plot value", "set {arg} {value...}", CommandCategory.ACTIONS, true);
|
|
|
|
}
|
2015-02-20 07:34:19 +01:00
|
|
|
|
2014-11-05 04:42:08 +01:00
|
|
|
@SuppressWarnings("deprecation")
|
|
|
|
@Override
|
2015-02-21 08:30:55 +01:00
|
|
|
public boolean execute(final PlotPlayer plr, final String... args) {
|
2015-02-20 12:24:58 +01:00
|
|
|
if (!BukkitPlayerFunctions.isInPlot(plr)) {
|
2015-02-21 12:24:46 +01:00
|
|
|
MainUtil.sendMessage(plr, C.NOT_IN_PLOT);
|
2014-11-05 04:42:08 +01:00
|
|
|
return false;
|
|
|
|
}
|
2015-02-20 12:24:58 +01:00
|
|
|
final Plot plot = BukkitPlayerFunctions.getCurrentPlot(plr);
|
2014-11-05 04:42:08 +01:00
|
|
|
if (!plot.hasOwner()) {
|
2014-10-21 07:44:17 +02:00
|
|
|
sendMessage(plr, C.PLOT_NOT_CLAIMED);
|
2014-10-21 11:58:52 +02:00
|
|
|
return false;
|
2014-10-21 07:44:17 +02:00
|
|
|
}
|
2015-02-21 12:24:46 +01:00
|
|
|
if (!plot.hasRights(plr) && !Permissions.hasPermission(plr, "plots.admin.command.set")) {
|
|
|
|
MainUtil.sendMessage(plr, C.NO_PLOT_PERMS);
|
2014-11-05 04:42:08 +01:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if (args.length < 1) {
|
2015-02-21 12:24:46 +01:00
|
|
|
MainUtil.sendMessage(plr, C.SUBCOMMAND_SET_OPTIONS_HEADER.s() + getArgumentList(values));
|
2014-11-05 04:42:08 +01:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
for (int i = 0; i < aliases.length; i++) {
|
|
|
|
if (aliases[i].equalsIgnoreCase(args[0])) {
|
|
|
|
args[0] = values[i];
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/* TODO: Implement option */
|
2014-11-09 12:51:17 +01:00
|
|
|
// final boolean advanced_permissions = true;
|
2015-02-21 12:24:46 +01:00
|
|
|
if (!Permissions.hasPermission(plr, "plots.set." + args[0].toLowerCase())) {
|
|
|
|
MainUtil.sendMessage(plr, C.NO_PERMISSION, "plots.set." + args[0].toLowerCase());
|
2014-11-09 12:51:17 +01:00
|
|
|
return false;
|
2014-11-05 04:42:08 +01:00
|
|
|
}
|
|
|
|
if (args[0].equalsIgnoreCase("flag")) {
|
|
|
|
if (args.length < 2) {
|
|
|
|
String message = StringUtils.join(FlagManager.getFlags(plr), "&c, &6");
|
2015-02-19 09:51:10 +01:00
|
|
|
if (PlotSquared.worldGuardListener != null) {
|
2014-11-05 04:42:08 +01:00
|
|
|
if (message.equals("")) {
|
2015-02-19 09:51:10 +01:00
|
|
|
message = StringUtils.join(PlotSquared.worldGuardListener.str_flags, "&c, &6");
|
2014-12-18 03:15:11 +01:00
|
|
|
} else {
|
2015-02-19 09:51:10 +01:00
|
|
|
message += "," + StringUtils.join(PlotSquared.worldGuardListener.str_flags, "&c, &6");
|
2014-11-05 04:42:08 +01:00
|
|
|
}
|
|
|
|
}
|
2015-02-21 12:24:46 +01:00
|
|
|
MainUtil.sendMessage(plr, C.NEED_KEY.s().replaceAll("%values%", message));
|
2014-11-05 04:42:08 +01:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
AbstractFlag af;
|
|
|
|
try {
|
|
|
|
af = FlagManager.getFlag(args[1].toLowerCase());
|
2014-12-18 03:15:11 +01:00
|
|
|
} catch (final Exception e) {
|
2014-11-05 04:42:08 +01:00
|
|
|
af = new AbstractFlag(args[1].toLowerCase());
|
|
|
|
}
|
2015-02-19 09:51:10 +01:00
|
|
|
if (!FlagManager.getFlags().contains(af) && ((PlotSquared.worldGuardListener == null) || !PlotSquared.worldGuardListener.str_flags.contains(args[1].toLowerCase()))) {
|
2015-02-21 12:24:46 +01:00
|
|
|
MainUtil.sendMessage(plr, C.NOT_VALID_FLAG);
|
2014-11-05 04:42:08 +01:00
|
|
|
return false;
|
|
|
|
}
|
2015-02-21 12:24:46 +01:00
|
|
|
if (!Permissions.hasPermission(plr, "plots.set.flag." + args[1].toLowerCase())) {
|
|
|
|
MainUtil.sendMessage(plr, C.NO_PERMISSION);
|
2014-11-05 04:42:08 +01:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
if (args.length == 2) {
|
2015-01-08 15:08:50 +01:00
|
|
|
if (FlagManager.getPlotFlagAbs(plot, args[1].toLowerCase()) == null) {
|
2015-02-19 09:51:10 +01:00
|
|
|
if (PlotSquared.worldGuardListener != null) {
|
|
|
|
if (PlotSquared.worldGuardListener.str_flags.contains(args[1].toLowerCase())) {
|
|
|
|
PlotSquared.worldGuardListener.removeFlag(plr, plr.getWorld(), plot, args[1]);
|
2014-11-05 04:42:08 +01:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
2015-02-21 12:24:46 +01:00
|
|
|
MainUtil.sendMessage(plr, C.FLAG_NOT_IN_PLOT);
|
2014-11-05 04:42:08 +01:00
|
|
|
return false;
|
|
|
|
}
|
2015-02-20 07:34:19 +01:00
|
|
|
final boolean result = FlagManager.removePlotFlag(plot, args[1].toLowerCase());
|
2015-01-08 15:08:50 +01:00
|
|
|
if (!result) {
|
2015-02-21 12:24:46 +01:00
|
|
|
MainUtil.sendMessage(plr, C.FLAG_NOT_REMOVED);
|
2014-11-05 04:42:08 +01:00
|
|
|
return false;
|
|
|
|
}
|
2015-02-21 12:24:46 +01:00
|
|
|
MainUtil.sendMessage(plr, C.FLAG_REMOVED);
|
2014-11-05 04:42:08 +01:00
|
|
|
PlotListener.plotEntry(plr, plot);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
try {
|
2015-02-20 07:34:19 +01:00
|
|
|
final String value = StringUtils.join(Arrays.copyOfRange(args, 2, args.length), " ");
|
|
|
|
final Object parsed_value = af.parseValueRaw(value);
|
2015-01-25 05:40:50 +01:00
|
|
|
if (parsed_value == null) {
|
2015-02-21 12:24:46 +01:00
|
|
|
MainUtil.sendMessage(plr, af.getValueDesc());
|
2014-11-05 04:42:08 +01:00
|
|
|
return false;
|
|
|
|
}
|
2015-02-19 09:51:10 +01:00
|
|
|
if ((FlagManager.getFlag(args[1].toLowerCase()) == null) && (PlotSquared.worldGuardListener != null)) {
|
|
|
|
PlotSquared.worldGuardListener.addFlag(plr, plr.getWorld(), plot, args[1], af.toString(parsed_value));
|
2014-11-05 04:42:08 +01:00
|
|
|
return false;
|
|
|
|
}
|
2015-01-25 05:40:50 +01:00
|
|
|
final Flag flag = new Flag(FlagManager.getFlag(args[1].toLowerCase(), true), parsed_value);
|
2015-02-20 07:34:19 +01:00
|
|
|
final boolean result = FlagManager.addPlotFlag(plot, flag);
|
2015-01-08 15:08:50 +01:00
|
|
|
if (!result) {
|
2015-02-21 12:24:46 +01:00
|
|
|
MainUtil.sendMessage(plr, C.FLAG_NOT_ADDED);
|
2014-11-05 04:42:08 +01:00
|
|
|
return false;
|
|
|
|
}
|
2015-02-21 12:24:46 +01:00
|
|
|
MainUtil.sendMessage(plr, C.FLAG_ADDED);
|
2014-11-05 04:42:08 +01:00
|
|
|
PlotListener.plotEntry(plr, plot);
|
|
|
|
return true;
|
2014-12-18 03:15:11 +01:00
|
|
|
} catch (final Exception e) {
|
2015-02-21 12:24:46 +01:00
|
|
|
MainUtil.sendMessage(plr, "&c" + e.getMessage());
|
2014-11-05 04:42:08 +01:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (args[0].equalsIgnoreCase("home")) {
|
2015-01-12 16:52:33 +01:00
|
|
|
if (args.length > 1) {
|
|
|
|
if (args[1].equalsIgnoreCase("none")) {
|
|
|
|
plot.settings.setPosition(null);
|
|
|
|
DBFunc.setPosition(plr.getWorld().getName(), plot, "");
|
|
|
|
return true;
|
2014-11-05 04:42:08 +01:00
|
|
|
}
|
2015-02-21 12:24:46 +01:00
|
|
|
return MainUtil.sendMessage(plr, C.HOME_ARGUMENT);
|
2014-11-05 04:42:08 +01:00
|
|
|
}
|
2015-01-12 16:52:33 +01:00
|
|
|
//set to current location
|
2015-02-20 07:34:19 +01:00
|
|
|
final World world = plr.getWorld();
|
2015-02-20 12:23:48 +01:00
|
|
|
final Location base = MainUtil.getPlotBottomLoc(world, plot.id);
|
2015-01-23 01:14:14 +01:00
|
|
|
base.setY(0);
|
2015-02-20 07:34:19 +01:00
|
|
|
final Location relative = plr.getLocation().subtract(base);
|
|
|
|
final BlockLoc blockloc = new BlockLoc(relative.getBlockX(), relative.getBlockY(), relative.getBlockZ());
|
2015-01-12 16:52:33 +01:00
|
|
|
plot.settings.setPosition(blockloc);
|
|
|
|
DBFunc.setPosition(plr.getWorld().getName(), plot, relative.getBlockX() + "," + relative.getBlockY() + "," + relative.getBlockZ());
|
2015-02-21 12:24:46 +01:00
|
|
|
return MainUtil.sendMessage(plr, C.POSITION_SET);
|
2014-11-05 04:42:08 +01:00
|
|
|
}
|
|
|
|
if (args[0].equalsIgnoreCase("alias")) {
|
|
|
|
if (args.length < 2) {
|
2015-02-21 12:24:46 +01:00
|
|
|
MainUtil.sendMessage(plr, C.MISSING_ALIAS);
|
2014-11-05 04:42:08 +01:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
final String alias = args[1];
|
2015-01-04 05:43:36 +01:00
|
|
|
if (alias.length() >= 50) {
|
2015-02-21 12:24:46 +01:00
|
|
|
MainUtil.sendMessage(plr, C.ALIAS_TOO_LONG);
|
2015-01-04 05:43:36 +01:00
|
|
|
return false;
|
|
|
|
}
|
2015-02-19 09:51:10 +01:00
|
|
|
for (final Plot p : PlotSquared.getPlots(plr.getWorld()).values()) {
|
2014-11-05 04:42:08 +01:00
|
|
|
if (p.settings.getAlias().equalsIgnoreCase(alias)) {
|
2015-02-21 12:24:46 +01:00
|
|
|
MainUtil.sendMessage(plr, C.ALIAS_IS_TAKEN);
|
2014-11-05 04:42:08 +01:00
|
|
|
return false;
|
|
|
|
}
|
2015-01-23 01:14:14 +01:00
|
|
|
if (UUIDHandler.nameExists(new StringWrapper(alias))) {
|
2015-02-21 12:24:46 +01:00
|
|
|
MainUtil.sendMessage(plr, C.ALIAS_IS_TAKEN);
|
2014-11-05 04:42:08 +01:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
DBFunc.setAlias(plr.getWorld().getName(), plot, alias);
|
2015-02-21 12:24:46 +01:00
|
|
|
MainUtil.sendMessage(plr, C.ALIAS_SET_TO.s().replaceAll("%alias%", alias));
|
2014-11-05 04:42:08 +01:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
if (args[0].equalsIgnoreCase("biome")) {
|
|
|
|
if (args.length < 2) {
|
2015-02-21 12:24:46 +01:00
|
|
|
MainUtil.sendMessage(plr, C.NEED_BIOME);
|
2014-11-05 04:42:08 +01:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
if (args[1].length() < 2) {
|
2014-11-01 16:22:22 +01:00
|
|
|
sendMessage(plr, C.NAME_LITTLE, "Biome", args[1].length() + "", "2");
|
|
|
|
return true;
|
|
|
|
}
|
2014-11-16 10:48:18 +01:00
|
|
|
final Biome biome = Biome.valueOf(new StringComparison(args[1], Biome.values()).getBestMatch());
|
2014-11-05 04:42:08 +01:00
|
|
|
/*
|
|
|
|
* for (Biome b : Biome.values()) {
|
|
|
|
* if (b.toString().equalsIgnoreCase(args[1])) {
|
|
|
|
* biome = b;
|
|
|
|
* break;
|
|
|
|
* }
|
|
|
|
* }
|
|
|
|
*/
|
|
|
|
if (biome == null) {
|
2015-02-21 12:24:46 +01:00
|
|
|
MainUtil.sendMessage(plr, getBiomeList(Arrays.asList(Biome.values())));
|
2014-11-05 04:42:08 +01:00
|
|
|
return true;
|
|
|
|
}
|
2015-02-20 12:23:48 +01:00
|
|
|
MainUtil.setBiome(plr.getWorld(), plot, biome);
|
2015-02-21 12:24:46 +01:00
|
|
|
MainUtil.sendMessage(plr, C.BIOME_SET_TO.s() + biome.toString().toLowerCase());
|
2014-11-05 04:42:08 +01:00
|
|
|
return true;
|
|
|
|
}
|
2015-02-17 12:51:58 +01:00
|
|
|
// Get components
|
2015-02-20 07:34:19 +01:00
|
|
|
final World world = plr.getWorld();
|
2015-02-20 09:55:04 +01:00
|
|
|
final PlotWorld plotworld = PlotSquared.getPlotWorld(world);
|
2015-02-20 07:34:19 +01:00
|
|
|
final PlotManager manager = PlotSquared.getPlotManager(world);
|
|
|
|
final String[] components = manager.getPlotComponents(world, plotworld, plot.id);
|
|
|
|
for (final String component : components) {
|
2015-02-17 12:51:58 +01:00
|
|
|
if (component.equalsIgnoreCase(args[0])) {
|
|
|
|
if (args.length < 2) {
|
2015-02-21 12:24:46 +01:00
|
|
|
MainUtil.sendMessage(plr, C.NEED_BLOCK);
|
2014-11-05 04:42:08 +01:00
|
|
|
return true;
|
|
|
|
}
|
2015-02-17 12:51:58 +01:00
|
|
|
PlotBlock[] blocks;
|
|
|
|
try {
|
|
|
|
blocks = (PlotBlock[]) Configuration.BLOCKLIST.parseObject(args[2]);
|
2015-02-20 07:34:19 +01:00
|
|
|
} catch (final Exception e) {
|
2014-11-05 04:42:08 +01:00
|
|
|
try {
|
2015-02-20 07:34:19 +01:00
|
|
|
blocks = new PlotBlock[] { new PlotBlock((short) getMaterial(args[1], PlotWorld.BLOCKS).getId(), (byte) 0) };
|
|
|
|
} catch (final Exception e2) {
|
2015-02-21 12:24:46 +01:00
|
|
|
MainUtil.sendMessage(plr, C.NOT_VALID_BLOCK);
|
2015-02-20 07:34:19 +01:00
|
|
|
return false;
|
|
|
|
}
|
2014-11-05 04:42:08 +01:00
|
|
|
}
|
2015-02-17 12:51:58 +01:00
|
|
|
manager.setComponent(world, plotworld, plot.id, component, blocks);
|
2015-02-21 12:24:46 +01:00
|
|
|
MainUtil.sendMessage(plr, C.GENERATING_COMPONENT);
|
2014-11-01 16:22:22 +01:00
|
|
|
return true;
|
|
|
|
}
|
2014-11-05 04:42:08 +01:00
|
|
|
}
|
2014-10-25 14:46:04 +02:00
|
|
|
{
|
2014-11-09 12:51:17 +01:00
|
|
|
AbstractFlag af;
|
2014-10-25 14:46:04 +02:00
|
|
|
try {
|
|
|
|
af = new AbstractFlag(args[0].toLowerCase());
|
2014-12-18 03:15:11 +01:00
|
|
|
} catch (final Exception e) {
|
2014-11-09 12:51:17 +01:00
|
|
|
af = new AbstractFlag("");
|
2014-10-25 14:46:04 +02:00
|
|
|
}
|
2014-10-25 14:59:08 +02:00
|
|
|
if (FlagManager.getFlags().contains(af)) {
|
2014-11-05 04:42:08 +01:00
|
|
|
final StringBuilder a = new StringBuilder();
|
|
|
|
if (args.length > 1) {
|
|
|
|
for (int x = 1; x < args.length; x++) {
|
2014-10-25 14:59:08 +02:00
|
|
|
a.append(" ").append(args[x]);
|
2014-11-05 04:42:08 +01:00
|
|
|
}
|
2014-10-25 14:46:04 +02:00
|
|
|
}
|
2014-10-25 14:59:08 +02:00
|
|
|
plr.performCommand("plot set flag " + args[0] + a.toString());
|
2014-10-25 14:46:04 +02:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
2015-02-21 12:24:46 +01:00
|
|
|
MainUtil.sendMessage(plr, C.SUBCOMMAND_SET_OPTIONS_HEADER.s() + getArgumentList(values));
|
2014-11-05 04:42:08 +01:00
|
|
|
return false;
|
|
|
|
}
|
2015-02-20 07:34:19 +01:00
|
|
|
|
2014-11-05 04:42:08 +01:00
|
|
|
private String getMaterial(final Material m) {
|
|
|
|
return ChatColor.translateAlternateColorCodes('&', C.BLOCK_LIST_ITEM.s().replaceAll("%mat%", m.toString().toLowerCase()));
|
|
|
|
}
|
2015-02-20 07:34:19 +01:00
|
|
|
|
2014-11-05 04:42:08 +01:00
|
|
|
private String getBiome(final Biome b) {
|
|
|
|
return ChatColor.translateAlternateColorCodes('&', C.BLOCK_LIST_ITEM.s().replaceAll("%mat%", b.toString().toLowerCase()));
|
|
|
|
}
|
2015-02-20 07:34:19 +01:00
|
|
|
|
2014-11-05 04:42:08 +01:00
|
|
|
private String getString(final String s) {
|
|
|
|
return ChatColor.translateAlternateColorCodes('&', C.BLOCK_LIST_ITEM.s().replaceAll("%mat%", s));
|
|
|
|
}
|
2015-02-20 07:34:19 +01:00
|
|
|
|
2014-11-05 04:42:08 +01:00
|
|
|
private String getArgumentList(final String[] strings) {
|
|
|
|
final StringBuilder builder = new StringBuilder();
|
|
|
|
for (final String s : strings) {
|
|
|
|
builder.append(getString(s));
|
|
|
|
}
|
|
|
|
return builder.toString().substring(1, builder.toString().length() - 1);
|
|
|
|
}
|
2015-02-20 07:34:19 +01:00
|
|
|
|
2014-11-05 04:42:08 +01:00
|
|
|
private String getBiomeList(final List<Biome> biomes) {
|
|
|
|
final StringBuilder builder = new StringBuilder();
|
|
|
|
builder.append(ChatColor.translateAlternateColorCodes('&', C.NOT_VALID_BLOCK_LIST_HEADER.s()));
|
|
|
|
for (final Biome b : biomes) {
|
|
|
|
builder.append(getBiome(b));
|
|
|
|
}
|
|
|
|
return builder.toString().substring(1, builder.toString().length() - 1);
|
|
|
|
}
|
2015-02-20 07:34:19 +01:00
|
|
|
|
2014-11-05 04:42:08 +01:00
|
|
|
private Material getMaterial(final String input, final List<Material> blocks) {
|
2014-11-16 10:48:18 +01:00
|
|
|
return Material.valueOf(new StringComparison(input, blocks.toArray()).getBestMatch());
|
2014-11-01 15:59:35 +01:00
|
|
|
}
|
2014-09-22 13:02:14 +02:00
|
|
|
}
|