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

View File

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

View File

@ -1,7 +1,8 @@
package me.libraryaddict.disguise.disguisetypes;
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) {
for (RabbitType type : values()) {
if (type.getTypeId() == id) {

View File

@ -8,4 +8,55 @@ public class ArmorStandWatcher extends LivingWatcher {
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);
}
}

View File

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

View File

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

View File

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