This commit is contained in:
libraryaddict 2014-09-27 16:35:21 +12:00
parent fb09d93136
commit d937fb3e79
6 changed files with 70 additions and 6 deletions

@ -215,6 +215,8 @@ public class DisguiseHelpCommand extends BaseDisguiseCommand {
valueType = "number,number,number..."; valueType = "number,number,number...";
} else if (c == BlockFace.class) { } else if (c == BlockFace.class) {
valueType = "direction"; valueType = "direction";
} else if (c == RabbitType.class) {
valueType = "rabbit type";
} }
if (valueType != null) { if (valueType != null) {
ChatColor methodColor = ChatColor.YELLOW; ChatColor methodColor = ChatColor.YELLOW;

@ -1,7 +1,8 @@
package me.libraryaddict.disguise.disguisetypes; package me.libraryaddict.disguise.disguisetypes;
public enum RabbitType { public enum RabbitType {
BLACK(2), BLACK_AND_WHITE(3), BROWN(0), GOLD(4), KILLER_BUNNY(99), PEPPER(5), WHITE(1); BLACK(2), BROWN(0), GOLD(4), KILLER_BUNNY(99), PATCHES(3), PEPPER(5), WHITE(1);
public static RabbitType getType(int id) { public static RabbitType getType(int id) {
for (RabbitType type : values()) { for (RabbitType type : values()) {
if (type.getTypeId() == id) { if (type.getTypeId() == id) {

@ -8,4 +8,55 @@ public class ArmorStandWatcher extends LivingWatcher {
super(disguise); super(disguise);
} }
private boolean get10(int value) {
return ((Byte) getValue(10, 0) & value) != 0;
}
public boolean isNoBasePlate() {
return get10(8);
}
public boolean isNoGravity() {
return get10(2);
}
public boolean isShowArms() {
return get10(4);
}
public boolean isSmall() {
return get10(1);
}
private void set10(int value, boolean isTrue) {
byte b1 = (Byte) getValue(10, (byte) 0);
if (isTrue)
b1 = (byte) (b1 | value);
else {
b1 = (byte) (b1 & value);
}
setValue(10, b1);
sendData(10);
}
public void setNoBasePlate(boolean noBasePlate) {
set10(8, noBasePlate);
sendData(10);
}
public void setNoGravity(boolean noGravity) {
set10(2, noGravity);
sendData(10);
}
public void setShowArms(boolean showArms) {
set10(4, showArms);
sendData(10);
}
public void setSmall(boolean isSmall) {
set10(1, isSmall);
sendData(10);
}
} }

@ -8,8 +8,12 @@ public class GuardianWatcher extends LivingWatcher {
super(disguise); super(disguise);
} }
public void doBeam(boolean doBeam) { public boolean isBeam() {
setValue(17, doBeam ? 1 : 0); return (Integer) getValue(17, 0) == 1;
}
public void setBeam(boolean isBeaming) {
setValue(17, isBeaming ? 1 : 0);
sendData(17); sendData(17);
} }

@ -1,15 +1,21 @@
package me.libraryaddict.disguise.disguisetypes.watchers; package me.libraryaddict.disguise.disguisetypes.watchers;
import me.libraryaddict.disguise.disguisetypes.Disguise; import me.libraryaddict.disguise.disguisetypes.Disguise;
import me.libraryaddict.disguise.disguisetypes.RabbitType;
public class RabbitWatcher extends AgeableWatcher { public class RabbitWatcher extends AgeableWatcher {
public RabbitWatcher(Disguise disguise) { public RabbitWatcher(Disguise disguise) {
super(disguise); super(disguise);
setType(RabbitType.values()[RabbitType.values().length]);
} }
public void setRabbitType(int rabbitType) { public RabbitType getType() {
setValue(18, (byte) rabbitType); return RabbitType.getType((Integer) getValue(18, (int) 0));
}
public void setType(RabbitType type) {
setValue(18, (byte) type.getTypeId());
sendData(18); sendData(18);
} }

@ -603,7 +603,7 @@ public abstract class BaseDisguiseCommand implements CommandExecutor {
throw new Exception(); throw new Exception();
} }
} catch (Exception ex) { } catch (Exception ex) {
throw parseToException("rabbit type (white, brown, salt and pepper...)", valueString, methodName); throw parseToException("rabbit type (white, brown, patches...)", valueString, methodName);
} }
} }
} }