mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-26 15:16:45 +01:00
set
This commit is contained in:
parent
79a01e722f
commit
1d969e439c
@ -24,11 +24,6 @@ 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 com.intellectualcrafters.plot.PlotSquared;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
@ -39,14 +34,19 @@ import com.intellectualcrafters.plot.flag.Flag;
|
||||
import com.intellectualcrafters.plot.flag.FlagManager;
|
||||
import com.intellectualcrafters.plot.listeners.PlotListener;
|
||||
import com.intellectualcrafters.plot.object.BlockLoc;
|
||||
import com.intellectualcrafters.plot.object.Location;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotBlock;
|
||||
import com.intellectualcrafters.plot.object.PlotManager;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.object.PlotWorld;
|
||||
import com.intellectualcrafters.plot.object.StringWrapper;
|
||||
import com.intellectualcrafters.plot.util.AChunkManager;
|
||||
import com.intellectualcrafters.plot.util.BlockManager;
|
||||
import com.intellectualcrafters.plot.util.MainUtil;
|
||||
import com.intellectualcrafters.plot.util.Permissions;
|
||||
import com.intellectualcrafters.plot.util.StringComparison;
|
||||
import com.intellectualcrafters.plot.util.bukkit.BukkitUtil;
|
||||
import com.intellectualcrafters.plot.util.bukkit.UUIDHandler;
|
||||
|
||||
/**
|
||||
@ -72,7 +72,7 @@ public class Set extends SubCommand {
|
||||
sendMessage(plr, C.PLOT_NOT_CLAIMED);
|
||||
return false;
|
||||
}
|
||||
if (!plot.hasRights(plr) && !Permissions.hasPermission(plr, "plots.admin.command.set")) {
|
||||
if (!plot.isAdded(plr.getUUID()) && !Permissions.hasPermission(plr, "plots.admin.command.set")) {
|
||||
MainUtil.sendMessage(plr, C.NO_PLOT_PERMS);
|
||||
return false;
|
||||
}
|
||||
@ -95,13 +95,6 @@ public class Set extends SubCommand {
|
||||
if (args[0].equalsIgnoreCase("flag")) {
|
||||
if (args.length < 2) {
|
||||
String message = StringUtils.join(FlagManager.getFlags(plr), "&c, &6");
|
||||
if (PlotSquared.worldGuardListener != null) {
|
||||
if (message.equals("")) {
|
||||
message = StringUtils.join(PlotSquared.worldGuardListener.str_flags, "&c, &6");
|
||||
} else {
|
||||
message += "," + StringUtils.join(PlotSquared.worldGuardListener.str_flags, "&c, &6");
|
||||
}
|
||||
}
|
||||
MainUtil.sendMessage(plr, C.NEED_KEY.s().replaceAll("%values%", message));
|
||||
return false;
|
||||
}
|
||||
@ -111,7 +104,7 @@ public class Set extends SubCommand {
|
||||
} catch (final Exception e) {
|
||||
af = new AbstractFlag(args[1].toLowerCase());
|
||||
}
|
||||
if (!FlagManager.getFlags().contains(af) && ((PlotSquared.worldGuardListener == null) || !PlotSquared.worldGuardListener.str_flags.contains(args[1].toLowerCase()))) {
|
||||
if (!FlagManager.getFlags().contains(af)) {
|
||||
MainUtil.sendMessage(plr, C.NOT_VALID_FLAG);
|
||||
return false;
|
||||
}
|
||||
@ -121,12 +114,6 @@ public class Set extends SubCommand {
|
||||
}
|
||||
if (args.length == 2) {
|
||||
if (FlagManager.getPlotFlagAbs(plot, args[1].toLowerCase()) == null) {
|
||||
if (PlotSquared.worldGuardListener != null) {
|
||||
if (PlotSquared.worldGuardListener.str_flags.contains(args[1].toLowerCase())) {
|
||||
PlotSquared.worldGuardListener.removeFlag(plr, plr.getWorld(), plot, args[1]);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
MainUtil.sendMessage(plr, C.FLAG_NOT_IN_PLOT);
|
||||
return false;
|
||||
}
|
||||
@ -146,10 +133,6 @@ public class Set extends SubCommand {
|
||||
MainUtil.sendMessage(plr, af.getValueDesc());
|
||||
return false;
|
||||
}
|
||||
if ((FlagManager.getFlag(args[1].toLowerCase()) == null) && (PlotSquared.worldGuardListener != null)) {
|
||||
PlotSquared.worldGuardListener.addFlag(plr, plr.getWorld(), plot, args[1], af.toString(parsed_value));
|
||||
return false;
|
||||
}
|
||||
final Flag flag = new Flag(FlagManager.getFlag(args[1].toLowerCase(), true), parsed_value);
|
||||
final boolean result = FlagManager.addPlotFlag(plot, flag);
|
||||
if (!result) {
|
||||
@ -174,13 +157,13 @@ public class Set extends SubCommand {
|
||||
return MainUtil.sendMessage(plr, C.HOME_ARGUMENT);
|
||||
}
|
||||
//set to current location
|
||||
final World world = plr.getWorld();
|
||||
final String world = plr.getLocation().getWorld();
|
||||
final Location base = MainUtil.getPlotBottomLoc(world, plot.id);
|
||||
base.setY(0);
|
||||
final Location relative = plr.getLocation().subtract(base);
|
||||
final BlockLoc blockloc = new BlockLoc(relative.getBlockX(), relative.getBlockY(), relative.getBlockZ());
|
||||
final Location relative = plr.getLocation().subtract(base.getX(), base.getZ(), base.getY());
|
||||
final BlockLoc blockloc = new BlockLoc(relative.getX(), relative.getY(), relative.getZ());
|
||||
plot.settings.setPosition(blockloc);
|
||||
DBFunc.setPosition(loc.getWorld(), plot, relative.getBlockX() + "," + relative.getBlockY() + "," + relative.getBlockZ());
|
||||
DBFunc.setPosition(loc.getWorld(), plot, relative.getX() + "," + relative.getY() + "," + relative.getZ());
|
||||
return MainUtil.sendMessage(plr, C.POSITION_SET);
|
||||
}
|
||||
if (args[0].equalsIgnoreCase("alias")) {
|
||||
@ -193,7 +176,7 @@ public class Set extends SubCommand {
|
||||
MainUtil.sendMessage(plr, C.ALIAS_TOO_LONG);
|
||||
return false;
|
||||
}
|
||||
for (final Plot p : PlotSquared.getPlots(plr.getWorld()).values()) {
|
||||
for (final Plot p : PlotSquared.getPlots(plr.getLocation().getWorld()).values()) {
|
||||
if (p.settings.getAlias().equalsIgnoreCase(alias)) {
|
||||
MainUtil.sendMessage(plr, C.ALIAS_IS_TAKEN);
|
||||
return false;
|
||||
@ -216,7 +199,7 @@ public class Set extends SubCommand {
|
||||
sendMessage(plr, C.NAME_LITTLE, "Biome", args[1].length() + "", "2");
|
||||
return true;
|
||||
}
|
||||
final Biome biome = Biome.valueOf(new StringComparison(args[1], Biome.values()).getBestMatch());
|
||||
final int biome = BlockManager.manager.getBiomeFromString(args[1]);
|
||||
/*
|
||||
* for (Biome b : Biome.values()) {
|
||||
* if (b.toString().equalsIgnoreCase(args[1])) {
|
||||
@ -225,19 +208,19 @@ public class Set extends SubCommand {
|
||||
* }
|
||||
* }
|
||||
*/
|
||||
if (biome == null) {
|
||||
MainUtil.sendMessage(plr, getBiomeList(Arrays.asList(Biome.values())));
|
||||
if (biome == -1) {
|
||||
MainUtil.sendMessage(plr, getBiomeList(BlockManager.manager.getBiomeList()));
|
||||
return true;
|
||||
}
|
||||
MainUtil.setBiome(plr.getWorld(), plot, biome);
|
||||
MainUtil.sendMessage(plr, C.BIOME_SET_TO.s() + biome.toString().toLowerCase());
|
||||
MainUtil.setBiome(plr.getLocation().getWorld(), plot, args[1].toUpperCase());
|
||||
MainUtil.sendMessage(plr, C.BIOME_SET_TO.s() + args[1].toLowerCase());
|
||||
return true;
|
||||
}
|
||||
// Get components
|
||||
final World world = plr.getWorld();
|
||||
final String world = plr.getLocation().getWorld();
|
||||
final PlotWorld plotworld = PlotSquared.getPlotWorld(world);
|
||||
final PlotManager manager = PlotSquared.getPlotManager(world);
|
||||
final String[] components = manager.getPlotComponents(world, plotworld, plot.id);
|
||||
final String[] components = manager.getPlotComponents(plotworld, plot.id);
|
||||
for (final String component : components) {
|
||||
if (component.equalsIgnoreCase(args[0])) {
|
||||
if (args.length < 2) {
|
||||
@ -249,13 +232,13 @@ public class Set extends SubCommand {
|
||||
blocks = (PlotBlock[]) Configuration.BLOCKLIST.parseObject(args[2]);
|
||||
} catch (final Exception e) {
|
||||
try {
|
||||
blocks = new PlotBlock[] { new PlotBlock((short) getMaterial(args[1], PlotWorld.BLOCKS).getId(), (byte) 0) };
|
||||
blocks = new PlotBlock[] { new PlotBlock((short) BlockManager.manager.getBlockIdFromString(args[2]), (byte) 0) };
|
||||
} catch (final Exception e2) {
|
||||
MainUtil.sendMessage(plr, C.NOT_VALID_BLOCK);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
manager.setComponent(world, plotworld, plot.id, component, blocks);
|
||||
manager.setComponent(plotworld, plot.id, component, blocks);
|
||||
MainUtil.sendMessage(plr, C.GENERATING_COMPONENT);
|
||||
return true;
|
||||
}
|
||||
@ -274,7 +257,7 @@ public class Set extends SubCommand {
|
||||
a.append(" ").append(args[x]);
|
||||
}
|
||||
}
|
||||
plr.performCommand("plot set flag " + args[0] + a.toString());
|
||||
MainCommand.onCommand(plr, world, ("plot set flag " + args[0] + a.toString()).split(" "));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@ -282,16 +265,8 @@ public class Set extends SubCommand {
|
||||
return false;
|
||||
}
|
||||
|
||||
private String getMaterial(final Material m) {
|
||||
return ChatColor.translateAlternateColorCodes('&', C.BLOCK_LIST_ITEM.s().replaceAll("%mat%", m.toString().toLowerCase()));
|
||||
}
|
||||
|
||||
private String getBiome(final Biome b) {
|
||||
return ChatColor.translateAlternateColorCodes('&', C.BLOCK_LIST_ITEM.s().replaceAll("%mat%", b.toString().toLowerCase()));
|
||||
}
|
||||
|
||||
private String getString(final String s) {
|
||||
return ChatColor.translateAlternateColorCodes('&', C.BLOCK_LIST_ITEM.s().replaceAll("%mat%", s));
|
||||
return MainUtil.colorise('&', C.BLOCK_LIST_ITEM.s().replaceAll("%mat%", s));
|
||||
}
|
||||
|
||||
private String getArgumentList(final String[] strings) {
|
||||
@ -302,16 +277,12 @@ public class Set extends SubCommand {
|
||||
return builder.toString().substring(1, builder.toString().length() - 1);
|
||||
}
|
||||
|
||||
private String getBiomeList(final List<Biome> biomes) {
|
||||
private String getBiomeList(final String[] 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));
|
||||
builder.append(MainUtil.colorise('&', C.NOT_VALID_BLOCK_LIST_HEADER.s()));
|
||||
for (final String b : biomes) {
|
||||
builder.append(getString(b));
|
||||
}
|
||||
return builder.toString().substring(1, builder.toString().length() - 1);
|
||||
}
|
||||
|
||||
private Material getMaterial(final String input, final List<Material> blocks) {
|
||||
return Material.valueOf(new StringComparison(input, blocks.toArray()).getBestMatch());
|
||||
}
|
||||
}
|
||||
|
@ -22,9 +22,8 @@ package com.intellectualcrafters.plot.config;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.bukkit.block.Biome;
|
||||
|
||||
import com.intellectualcrafters.plot.object.PlotBlock;
|
||||
import com.intellectualcrafters.plot.util.BlockManager;
|
||||
|
||||
/**
|
||||
* Main Configuration Utility
|
||||
@ -107,7 +106,10 @@ public class Configuration {
|
||||
@Override
|
||||
public boolean validateValue(final String string) {
|
||||
try {
|
||||
Biome.valueOf(string.toUpperCase());
|
||||
int biome = BlockManager.manager.getBiomeFromString(string.toUpperCase());
|
||||
if (biome == -1) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
} catch (final Exception e) {
|
||||
return false;
|
||||
@ -116,17 +118,15 @@ public class Configuration {
|
||||
|
||||
@Override
|
||||
public Object parseString(final String string) {
|
||||
for (final Biome biome : Biome.values()) {
|
||||
if (biome.name().equals(string.toUpperCase())) {
|
||||
return biome;
|
||||
}
|
||||
if (validateValue(string)) {
|
||||
return string.toUpperCase();
|
||||
}
|
||||
return Biome.FOREST;
|
||||
return "FOREST";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object parseObject(final Object object) {
|
||||
return (((Biome) object)).toString();
|
||||
return object.toString();
|
||||
}
|
||||
};
|
||||
public static final SettingValue BLOCK = new SettingValue("BLOCK") {
|
||||
|
@ -26,9 +26,6 @@ import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import com.intellectualcrafters.plot.PlotSquared;
|
||||
import com.intellectualcrafters.plot.config.C;
|
||||
import com.intellectualcrafters.plot.database.DBFunc;
|
||||
@ -36,6 +33,7 @@ import com.intellectualcrafters.plot.events.PlotFlagAddEvent;
|
||||
import com.intellectualcrafters.plot.events.PlotFlagRemoveEvent;
|
||||
import com.intellectualcrafters.plot.object.Plot;
|
||||
import com.intellectualcrafters.plot.object.PlotCluster;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.object.PlotSettings;
|
||||
import com.intellectualcrafters.plot.object.PlotWorld;
|
||||
|
||||
@ -141,11 +139,7 @@ public class FlagManager {
|
||||
* @param flag
|
||||
*/
|
||||
public static boolean addPlotFlag(final Plot plot, final Flag flag) {
|
||||
final PlotFlagAddEvent event = new PlotFlagAddEvent(flag, plot);
|
||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||
if (event.isCancelled()) {
|
||||
return false;
|
||||
}
|
||||
// FIXME PlotFlagAddEvent
|
||||
final Flag hasFlag = getPlotFlag(plot, flag.getKey());
|
||||
if (hasFlag != null) {
|
||||
plot.settings.flags.remove(hasFlag);
|
||||
@ -197,11 +191,7 @@ public class FlagManager {
|
||||
if (hasFlag != null) {
|
||||
final Flag flagObj = FlagManager.getPlotFlagAbs(plot, flag);
|
||||
if (flagObj != null) {
|
||||
final PlotFlagRemoveEvent event = new PlotFlagRemoveEvent(flagObj, plot);
|
||||
Bukkit.getServer().getPluginManager().callEvent(event);
|
||||
if (event.isCancelled()) {
|
||||
return false;
|
||||
}
|
||||
// FIXME PlotFlagRemoveEvent
|
||||
plot.settings.flags.remove(hasFlag);
|
||||
DBFunc.setFlags(plot.world, plot, plot.settings.flags);
|
||||
return true;
|
||||
@ -281,7 +271,7 @@ public class FlagManager {
|
||||
*
|
||||
* @return List (AbstractFlag)
|
||||
*/
|
||||
public static List<AbstractFlag> getFlags(final Player player) {
|
||||
public static List<AbstractFlag> getFlags(final PlotPlayer player) {
|
||||
final List<AbstractFlag> returnFlags = new ArrayList<>();
|
||||
for (final AbstractFlag flag : flags) {
|
||||
if (player.hasPermission("plots.set.flag." + flag.getKey().toLowerCase())) {
|
||||
|
@ -7,6 +7,7 @@ import java.util.Random;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.Chunk;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.block.Biome;
|
||||
import org.bukkit.generator.BlockPopulator;
|
||||
|
||||
import com.intellectualcrafters.plot.PlotSquared;
|
||||
@ -152,10 +153,11 @@ public class AugmentedPopulator extends BlockPopulator {
|
||||
}
|
||||
|
||||
private void populateBiome(final World world, final int x, final int z) {
|
||||
Biome biome = Biome.valueOf(this.plotworld.PLOT_BIOME);
|
||||
if (this.b) {
|
||||
for (int i = 0; i < 16; i++) {
|
||||
for (int j = 0; j < 16; j++) {
|
||||
world.setBiome(x + i, z + j, this.plotworld.PLOT_BIOME);
|
||||
world.setBiome(x + i, z + j, biome);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -118,7 +118,7 @@ public class HybridGen extends PlotGenerator {
|
||||
this.pathWidthLower = (short) (Math.floor(this.pathsize / 2));
|
||||
}
|
||||
this.pathWidthUpper = (short) (this.pathWidthLower + this.plotsize + 1);
|
||||
this.biome = this.plotworld.PLOT_BIOME;
|
||||
this.biome = Biome.valueOf(this.plotworld.PLOT_BIOME);
|
||||
try {
|
||||
this.maxY = Bukkit.getWorld(world).getMaxHeight();
|
||||
} catch (final NullPointerException e) {
|
||||
|
@ -25,8 +25,6 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.bukkit.Material;
|
||||
import org.bukkit.block.Biome;
|
||||
import org.bukkit.configuration.ConfigurationSection;
|
||||
|
||||
import com.intellectualcrafters.plot.PlotSquared;
|
||||
@ -42,7 +40,7 @@ import com.intellectualcrafters.plot.flag.FlagManager;
|
||||
public abstract class PlotWorld {
|
||||
public final static boolean AUTO_MERGE_DEFAULT = false;
|
||||
public final static boolean MOB_SPAWNING_DEFAULT = false;
|
||||
public final static Biome PLOT_BIOME_DEFAULT = Biome.FOREST;
|
||||
public final static String PLOT_BIOME_DEFAULT = "FOREST";
|
||||
public final static boolean PLOT_CHAT_DEFAULT = false;
|
||||
public final static boolean SCHEMATIC_CLAIM_SPECIFY_DEFAULT = false;
|
||||
public final static boolean SCHEMATIC_ON_CLAIM_DEFAULT = false;
|
||||
@ -62,19 +60,16 @@ public abstract class PlotWorld {
|
||||
// require claim in cluster
|
||||
// TODO make this configurable
|
||||
// make non static and static_default_valu + add config option
|
||||
public static List<Material> BLOCKS;
|
||||
public static int[] BLOCKS;
|
||||
static {
|
||||
BLOCKS = new ArrayList<>();
|
||||
for (final Material material : Material.values()) {
|
||||
if (material.isBlock() && material.isSolid() && !material.hasGravity() && !material.isTransparent() && material.isOccluding() && (material != Material.DROPPER) && (material != Material.COMMAND)) {
|
||||
BLOCKS.add(material);
|
||||
}
|
||||
}
|
||||
BLOCKS = new int[] {
|
||||
1,2,3,4,5,7,14,15,16,17,19,21,22,23,24,25,35,41,42,43,45,47,48,49,52,56,57,58,61,62,73,74,80,82,84,86,87,88,91,97,98,99,100,103,110,112,120,121,123,124,125,129,133,153,155,159,162,165,166,168,170,172,173,174,179,181
|
||||
};
|
||||
}
|
||||
public final String worldname;
|
||||
public boolean AUTO_MERGE;
|
||||
public boolean MOB_SPAWNING;
|
||||
public Biome PLOT_BIOME;
|
||||
public String PLOT_BIOME;
|
||||
public boolean PLOT_CHAT;
|
||||
public boolean SCHEMATIC_CLAIM_SPECIFY = false;
|
||||
public boolean SCHEMATIC_ON_CLAIM;
|
||||
@ -110,7 +105,7 @@ public abstract class PlotWorld {
|
||||
}
|
||||
this.MOB_SPAWNING = config.getBoolean("natural_mob_spawning");
|
||||
this.AUTO_MERGE = config.getBoolean("plot.auto_merge");
|
||||
this.PLOT_BIOME = (Biome) Configuration.BIOME.parseString(config.getString("plot.biome"));
|
||||
this.PLOT_BIOME = (String) Configuration.BIOME.parseString(config.getString("plot.biome"));
|
||||
this.SCHEMATIC_ON_CLAIM = config.getBoolean("schematic.on_claim");
|
||||
this.SCHEMATIC_FILE = config.getString("schematic.file");
|
||||
this.SCHEMATIC_CLAIM_SPECIFY = config.getBoolean("schematic.specify_on_claim");
|
||||
|
@ -29,6 +29,12 @@ public abstract class BlockManager {
|
||||
return (int) r;
|
||||
}
|
||||
|
||||
public abstract String[] getBiomeList();
|
||||
|
||||
public abstract int getBiomeFromString(String biome);
|
||||
|
||||
public abstract int getBlockIdFromString(String block);
|
||||
|
||||
public abstract int getHeighestBlock(Location loc);
|
||||
|
||||
public abstract String getBiome(Location loc);
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.intellectualcrafters.plot.util.bukkit;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
@ -20,6 +21,7 @@ import com.intellectualcrafters.plot.object.Location;
|
||||
import com.intellectualcrafters.plot.object.PlotBlock;
|
||||
import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.util.BlockManager;
|
||||
import com.intellectualcrafters.plot.util.StringComparison;
|
||||
|
||||
public class BukkitUtil extends BlockManager {
|
||||
private static HashMap<String, World> worlds = new HashMap<>();
|
||||
@ -222,4 +224,32 @@ public class BukkitUtil extends BlockManager {
|
||||
public int getHeighestBlock(Location loc) {
|
||||
return getWorld(loc.getWorld()).getHighestBlockAt(loc.getX(), loc.getZ()).getY();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBiomeFromString(String biomeStr) {
|
||||
Biome biome = Biome.valueOf(biomeStr.toUpperCase());
|
||||
if (biome == null) {
|
||||
return -1;
|
||||
}
|
||||
return Arrays.asList(Biome.values()).indexOf(biome);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getBiomeList() {
|
||||
Biome[] biomes = Biome.values();
|
||||
String[] list = new String[biomes.length];
|
||||
for (int i = 0; i< biomes.length; i++) {
|
||||
list[i] = biomes[i].name();
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getBlockIdFromString(String block) {
|
||||
Material material = Material.valueOf(block.toUpperCase());
|
||||
if (material == null) {
|
||||
return -1;
|
||||
}
|
||||
return material.getId();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user