mirror of
				https://github.com/IntellectualSites/PlotSquared.git
				synced 2025-11-04 03:03:43 +01:00 
			
		
		
		
	Remove some stuff
This commit is contained in:
		@@ -1,9 +1,5 @@
 | 
			
		||||
package com.intellectualcrafters.configuration;
 | 
			
		||||
 | 
			
		||||
import static org.bukkit.util.NumberConversions.toDouble;
 | 
			
		||||
import static org.bukkit.util.NumberConversions.toInt;
 | 
			
		||||
import static org.bukkit.util.NumberConversions.toLong;
 | 
			
		||||
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.LinkedHashMap;
 | 
			
		||||
import java.util.LinkedHashSet;
 | 
			
		||||
@@ -21,6 +17,63 @@ public class MemorySection implements ConfigurationSection {
 | 
			
		||||
    private final String path;
 | 
			
		||||
    private final String fullPath;
 | 
			
		||||
 | 
			
		||||
    public static double toDouble(Object obj, double def) {
 | 
			
		||||
        if (obj instanceof Number) {
 | 
			
		||||
            return ((Number) obj).doubleValue();
 | 
			
		||||
        }
 | 
			
		||||
        if (obj instanceof String) {
 | 
			
		||||
            try {
 | 
			
		||||
                return Double.parseDouble((String) obj);
 | 
			
		||||
            }
 | 
			
		||||
            catch (Exception e) {}
 | 
			
		||||
        }
 | 
			
		||||
        else if (obj instanceof List) {
 | 
			
		||||
            List<?> val = ((List<?>) obj);
 | 
			
		||||
            if (val.size() > 0) {
 | 
			
		||||
                return toDouble(val.get(0), def);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        return def;
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    public static int toInt(Object obj, int def) {
 | 
			
		||||
        if (obj instanceof Number) {
 | 
			
		||||
            return ((Number) obj).intValue();
 | 
			
		||||
        }
 | 
			
		||||
        if (obj instanceof String) {
 | 
			
		||||
            try {
 | 
			
		||||
                return Integer.parseInt((String) obj);
 | 
			
		||||
            }
 | 
			
		||||
            catch (Exception e) {}
 | 
			
		||||
        }
 | 
			
		||||
        else if (obj instanceof List) {
 | 
			
		||||
            List<?> val = ((List<?>) obj);
 | 
			
		||||
            if (val.size() > 0) {
 | 
			
		||||
                return toInt(val.get(0), def);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        return def;
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    public static long toLong(Object obj, long def) {
 | 
			
		||||
        if (obj instanceof Number) {
 | 
			
		||||
            return ((Number) obj).longValue();
 | 
			
		||||
        }
 | 
			
		||||
        if (obj instanceof String) {
 | 
			
		||||
            try {
 | 
			
		||||
                return Long.parseLong((String) obj);
 | 
			
		||||
            }
 | 
			
		||||
            catch (Exception e) {}
 | 
			
		||||
        }
 | 
			
		||||
        else if (obj instanceof List) {
 | 
			
		||||
            List<?> val = ((List<?>) obj);
 | 
			
		||||
            if (val.size() > 0) {
 | 
			
		||||
                return toLong(val.get(0), def);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        return def;
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
    /**
 | 
			
		||||
     * Creates an empty MemorySection for use as a root {@link Configuration}
 | 
			
		||||
     * section.
 | 
			
		||||
@@ -289,12 +342,12 @@ public class MemorySection implements ConfigurationSection {
 | 
			
		||||
 | 
			
		||||
    public int getInt(String path) {
 | 
			
		||||
        Object def = getDefault(path);
 | 
			
		||||
        return getInt(path, (def instanceof Number) ? toInt(def) : 0);
 | 
			
		||||
        return getInt(path, toInt(def, 0));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public int getInt(String path, int def) {
 | 
			
		||||
        Object val = get(path, def);
 | 
			
		||||
        return (val instanceof Number) ? toInt(val) : def;
 | 
			
		||||
        return toInt(val, def);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public boolean isInt(String path) {
 | 
			
		||||
@@ -319,12 +372,12 @@ public class MemorySection implements ConfigurationSection {
 | 
			
		||||
 | 
			
		||||
    public double getDouble(String path) {
 | 
			
		||||
        Object def = getDefault(path);
 | 
			
		||||
        return getDouble(path, (def instanceof Number) ? toDouble(def) : 0);
 | 
			
		||||
        return getDouble(path, toDouble(def, 0));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public double getDouble(String path, double def) {
 | 
			
		||||
        Object val = get(path, def);
 | 
			
		||||
        return (val instanceof Number) ? toDouble(val) : def;
 | 
			
		||||
        return toDouble(val, def);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public boolean isDouble(String path) {
 | 
			
		||||
@@ -334,12 +387,12 @@ public class MemorySection implements ConfigurationSection {
 | 
			
		||||
 | 
			
		||||
    public long getLong(String path) {
 | 
			
		||||
        Object def = getDefault(path);
 | 
			
		||||
        return getLong(path, (def instanceof Number) ? toLong(def) : 0);
 | 
			
		||||
        return getLong(path, toLong(def, 0));
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public long getLong(String path, long def) {
 | 
			
		||||
        Object val = get(path, def);
 | 
			
		||||
        return (val instanceof Number) ? toLong(val) : def;
 | 
			
		||||
        return toLong(val, def);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public boolean isLong(String path) {
 | 
			
		||||
 
 | 
			
		||||
@@ -1,18 +0,0 @@
 | 
			
		||||
package com.intellectualcrafters.jnbt;
 | 
			
		||||
 | 
			
		||||
import org.bukkit.World;
 | 
			
		||||
 | 
			
		||||
public class WorldEditUtils {
 | 
			
		||||
    public static void setNBT(final World world, final short id, final byte data, final int x, final int y, final int z, final com.intellectualcrafters.jnbt.CompoundTag tag) {
 | 
			
		||||
        // final LocalWorld bukkitWorld = BukkitUtil.getLocalWorld(world);
 | 
			
		||||
        // I need to somehow convert our CompoundTag to WorldEdit's
 | 
			
		||||
        // final BaseBlock block = new BaseBlock(5, 5, (CompoundTag) tag);
 | 
			
		||||
        // final Vector vector = new Vector(x, y, z);
 | 
			
		||||
        // try {
 | 
			
		||||
        // bukkitWorld.setBlock(vector, block);
 | 
			
		||||
        // }
 | 
			
		||||
        // catch (final WorldEditException e) {
 | 
			
		||||
        // e.printStackTrace();
 | 
			
		||||
        // }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -260,6 +260,10 @@ public class Set extends SubCommand {
 | 
			
		||||
            });
 | 
			
		||||
            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);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user