mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-22 17:27:38 +00:00
Allowed blocks list can now be adjusted in worldedit.properties.
This commit is contained in:
parent
d1a807f25f
commit
2b0d73621a
@ -30,10 +30,21 @@ import com.sk89q.worldedit.*;
|
|||||||
* @author sk89q
|
* @author sk89q
|
||||||
*/
|
*/
|
||||||
public class WorldEdit extends Plugin {
|
public class WorldEdit extends Plugin {
|
||||||
|
private final static String DEFAULT_ALLOWED_BLOCKS =
|
||||||
|
"0,1,2,3,4,5,7,8,9,10,11,12,13,14,15,16,17,18,19,20,35,41,42,43," +
|
||||||
|
"44,45,47,48,49,52,53,54,56,57,58,60,61,62,67,73,78,79,80,81,82,85";
|
||||||
|
|
||||||
private static Logger logger = Logger.getLogger("Minecraft");
|
private static Logger logger = Logger.getLogger("Minecraft");
|
||||||
private HashMap<String,WorldEditSession> sessions = new HashMap<String,WorldEditSession>();
|
private HashMap<String,WorldEditSession> sessions = new HashMap<String,WorldEditSession>();
|
||||||
private HashMap<String,String> commands = new HashMap<String,String>();
|
private HashMap<String,String> commands = new HashMap<String,String>();
|
||||||
|
|
||||||
|
private PropertiesFile properties;
|
||||||
|
/**
|
||||||
|
* List of allowed blocks as a list of numbers as Strings. Not converted
|
||||||
|
* to a more usuable format.
|
||||||
|
*/
|
||||||
|
private String[] allowedBlocks;
|
||||||
|
|
||||||
public WorldEdit() {
|
public WorldEdit() {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
@ -58,6 +69,14 @@ public class WorldEdit extends Plugin {
|
|||||||
* Enables the plugin.
|
* Enables the plugin.
|
||||||
*/
|
*/
|
||||||
public void enable() {
|
public void enable() {
|
||||||
|
if (properties == null) {
|
||||||
|
properties = new PropertiesFile("worldedit.properties");
|
||||||
|
} else {
|
||||||
|
properties.load();
|
||||||
|
}
|
||||||
|
|
||||||
|
allowedBlocks = properties.getString("allowed-blocks", DEFAULT_ALLOWED_BLOCKS).split(",");
|
||||||
|
|
||||||
etc controller = etc.getInstance();
|
etc controller = etc.getInstance();
|
||||||
|
|
||||||
for (Map.Entry<String,String> entry : commands.entrySet()) {
|
for (Map.Entry<String,String> entry : commands.entrySet()) {
|
||||||
@ -116,22 +135,18 @@ public class WorldEdit extends Plugin {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((foundID >= 0 && foundID <= 5) ||
|
// All items allowed
|
||||||
(foundID >= 7 && foundID <= 20) ||
|
if (allowedBlocks[0].equals("")) {
|
||||||
foundID == 35 ||
|
|
||||||
(foundID >= 41 && foundID <= 45) ||
|
|
||||||
(foundID >= 47 && foundID <= 49) ||
|
|
||||||
(foundID >= 52 && foundID <= 54) ||
|
|
||||||
(foundID >= 56 && foundID <= 58) ||
|
|
||||||
(foundID >= 60 && foundID <= 62) ||
|
|
||||||
foundID == 67 ||
|
|
||||||
foundID == 73 ||
|
|
||||||
(foundID >= 78 && foundID <= 82) ||
|
|
||||||
foundID == 85) {
|
|
||||||
return foundID;
|
return foundID;
|
||||||
} else {
|
|
||||||
throw new DisallowedItemException();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (String s : allowedBlocks) {
|
||||||
|
if (s.equals(String.valueOf(foundID))) {
|
||||||
|
return foundID;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
throw new DisallowedItemException();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user