cn.nukkit.blockproperty.exception.InvalidBlockPropertyMetaException Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of powernukkit Show documentation
Show all versions of powernukkit Show documentation
A Minecraft Bedrock Edition server software implementation made in Java from scratch which supports all new features.
package cn.nukkit.blockproperty.exception;
import cn.nukkit.blockproperty.BlockProperty;
import lombok.Getter;
import javax.annotation.Nonnull;
import javax.annotation.ParametersAreNonnullByDefault;
@ParametersAreNonnullByDefault
@Getter
public class InvalidBlockPropertyMetaException extends InvalidBlockPropertyException {
private static final long serialVersionUID = -8493494844859767053L;
@Nonnull
private final Number currentMeta;
@Nonnull
private final Number invalidMeta;
public InvalidBlockPropertyMetaException(BlockProperty> property, Number currentMeta, Number invalidMeta) {
super(property, buildMessage(currentMeta, invalidMeta));
this.currentMeta = currentMeta;
this.invalidMeta = invalidMeta;
}
public InvalidBlockPropertyMetaException(BlockProperty> property, Number currentMeta, Number invalidMeta, String message) {
super(property, buildMessage(currentMeta, invalidMeta)+". "+message);
this.currentMeta = currentMeta;
this.invalidMeta = invalidMeta;
}
public InvalidBlockPropertyMetaException(BlockProperty> property, Number currentMeta, Number invalidMeta, String message, Throwable cause) {
super(property, buildMessage(currentMeta, invalidMeta)+". "+message, cause);
this.currentMeta = currentMeta;
this.invalidMeta = invalidMeta;
}
public InvalidBlockPropertyMetaException(BlockProperty> property, Number currentMeta, Number invalidMeta, Throwable cause) {
super(property, buildMessage(currentMeta, invalidMeta), cause);
this.currentMeta = currentMeta;
this.invalidMeta = invalidMeta;
}
private static String buildMessage(Object currentValue, Object invalidValue) {
return "Current Meta: "+currentValue+", Invalid Meta: "+invalidValue;
}
}