Remove data value from chair block, bukkit doesn't support in anymore

This commit is contained in:
Shevchik 2013-12-13 13:19:33 +04:00
parent 89309be623
commit cb0b871ea2
2 changed files with 8 additions and 21 deletions

View File

@ -13,12 +13,10 @@ import org.bukkit.Material;
public class ChairBlock {
private Material mat;
private double sitHeight;
private byte data;
public ChairBlock(Material m, double s, String d) {
public ChairBlock(Material m, double s) {
mat = m;
sitHeight = s;
data = Byte.parseByte(d);
}
public Material getMat() {
@ -29,7 +27,4 @@ public class ChairBlock {
return sitHeight;
}
public byte getDamage() {
return data;
}
}

View File

@ -171,24 +171,16 @@ public class Chairs extends JavaPlugin {
for (String s : getConfig().getStringList("allowed-blocks")) {
String type;
double sh = 0.7;
String d = "0";
if (s.contains(":")) {
String tmp[] = s.split(":",3);
type = tmp[0];
if (!tmp[1].isEmpty()) {
sh = Double.parseDouble(tmp[1]);
}
if (tmp.length == 3) {
d = tmp[2];
}
} else {
type = s;
String tmp[] = s.split("[:]");
type = tmp[0];
if (tmp.length == 2) {
sh = Double.parseDouble(tmp[1]);
}
try {
Material mat = Material.matchMaterial(type);
if (mat != null) {
logInfo("Allowed block: " + mat.toString() + " => " + sh + " => " + d);
allowedBlocks.add(new ChairBlock(mat,sh,d));
logInfo("Allowed block: " + mat.toString() + " => " + sh);
allowedBlocks.add(new ChairBlock(mat,sh));
} else {
logError("Invalid block: " + type);
}