Java 类org.bukkit.CropState 实例源码

项目:Skellett    文件:ExprCropState.java   
@SuppressWarnings("deprecation")
@Nullable
protected String[] get(Event e) {
    if (block.getSingle(e).getType().equals(Material.CROPS)) {
        if (block.getSingle(e).getData() == CropState.RIPE.getData()){
            return new String[]{"RIPE"};
        } else if (block.getSingle(e).getData() == CropState.GERMINATED.getData()){
            return new String[]{"GERMINATED"};
        } else if (block.getSingle(e).getData() == CropState.MEDIUM.getData()){
            return new String[]{"MEDIUM"};
        } else if (block.getSingle(e).getData() == CropState.SEEDED.getData()){
            return new String[]{"SEEDED"};
        } else if (block.getSingle(e).getData() == CropState.TALL.getData()){
            return new String[]{"TALL"};
        } else if (block.getSingle(e).getData() == CropState.VERY_SMALL.getData()){
            return new String[]{"VERY_SMALL"};
        } else if (block.getSingle(e).getData() == CropState.VERY_TALL.getData()){
            return new String[]{"VERY_TALL"};
        } else {
            return null;
        }
    }
    return null;
}
项目:SwornRPG    文件:Herbalism.java   
private boolean isApplicable(Block block)
{
    BlockState state = block.getState();
    switch (state.getType())
    {
        case CACTUS:
        case MELON_BLOCK:
        case PUMPKIN:
            return true;
        case CROPS:
            return ((Crops) state.getData()).getState() == CropState.RIPE;
        case NETHER_WARTS:
            return ((NetherWarts) state.getData()).getState() == NetherWartsState.RIPE;
        case COCOA:
            return ((CocoaPlant) state.getData()).getSize() == CocoaPlantSize.LARGE;
        default:
            return false;
    }
}
项目:Zephyrus-II    文件:Plant.java   
/**
 * Grows the plant to its full grown state
 * @param block The block to grow
 * @return True only if the block was grown successfully
 */
@SuppressWarnings("deprecation")
public boolean grow(Block block) {
    if (block.getType() != this.mat || block.getData() == CropState.RIPE.getData()) {
        return false;
    }
    block.setData(CropState.RIPE.getData());
    return true;
}
项目:McMMOPlus    文件:BlockUtils.java   
/**
 * Determine if a given block should be affected by Green Terra
 *
 * @param blockState The {@link BlockState} of the block to check
 * @return true if the block should affected by Green Terra, false otherwise
 */
public static boolean affectedByGreenTerra(BlockState blockState) {
    switch (blockState.getType()) {
        case BROWN_MUSHROOM:
        case CACTUS:
        case DOUBLE_PLANT:
        case MELON_BLOCK:
        case LONG_GRASS:
        case PUMPKIN:
        case RED_MUSHROOM:
        case RED_ROSE:
        case SUGAR_CANE_BLOCK:
        case VINE:
        case WATER_LILY:
        case YELLOW_FLOWER:
            return true;

        case CARROT:
        case POTATO:
            return blockState.getRawData() == CropState.RIPE.getData();

        case CROPS:
            return ((Crops) blockState.getData()).getState() == CropState.RIPE;

        case NETHER_WARTS:
            return ((NetherWarts) blockState.getData()).getState() == NetherWartsState.RIPE;

        case COCOA:
            return ((CocoaPlant) blockState.getData()).getSize() == CocoaPlantSize.LARGE;

        default:
            return mcMMO.getModManager().isCustomHerbalismBlock(blockState);
    }
}
项目:Zephyrus    文件:Plant.java   
/**
 * Grows the plant to its full grown state
 * @param block The block to grow
 * @return True only if the block was grown successfully
 */
@SuppressWarnings("deprecation")
public boolean grow(Block block) {
    if (block.getType() != this.mat || block.getData() == CropState.RIPE.getData()) {
        return false;
    }
    block.setData(CropState.RIPE.getData());
    return true;
}
项目:Thermos-Bukkit    文件:Crops.java   
public Crops(CropState state) {
    this();
    setState(state);
}
项目:CauldronGit    文件:Crops.java   
public Crops(CropState state) {
    this();
    setState(state);
}
项目:Cauldron    文件:Crops.java   
public Crops(CropState state) {
    this();
    setState(state);
}
项目:Cauldron    文件:Crops.java   
public Crops(CropState state) {
    this();
    setState(state);
}
项目:Cauldron    文件:Crops.java   
public Crops(CropState state) {
    this();
    setState(state);
}
项目:McMMOPlus    文件:HerbalismManager.java   
private boolean handleBlockState(BlockState blockState, boolean greenTerra) {
    byte greenThumbStage = getGreenThumbStage();

    blockState.setMetadata(mcMMO.greenThumbDataKey, new FixedMetadataValue(mcMMO.p, (int) (System.currentTimeMillis() / Misc.TIME_CONVERSION_FACTOR)));

    switch (blockState.getType()) {
        case CROPS:
            Crops crops = (Crops) blockState.getData();

            if (greenTerra) {
                crops.setState(CropState.MEDIUM);
            }
            else {
                switch (greenThumbStage) {
                    case 4:
                        crops.setState(CropState.SMALL);
                        break;
                    case 3:
                        crops.setState(CropState.VERY_SMALL);
                        break;
                    case 2:
                        crops.setState(CropState.GERMINATED);
                        break;
                    default:
                        crops.setState(CropState.SEEDED);
                        break;
                }
            }

            return true;

        case CARROT:
        case POTATO:
            if (greenTerra) {
                blockState.setRawData(CropState.MEDIUM.getData());
            }
            else {
                blockState.setRawData(greenThumbStage);
            }

            return true;

        case NETHER_WARTS:
            NetherWarts warts = (NetherWarts) blockState.getData();

            if (greenTerra || greenThumbStage > 2) {
                warts.setState(NetherWartsState.STAGE_TWO);
            }
            else if (greenThumbStage == 2) {
                warts.setState(NetherWartsState.STAGE_ONE);
            }
            else {
                warts.setState(NetherWartsState.SEEDED);
            }

            return true;

        case COCOA:
            CocoaPlant plant = (CocoaPlant) blockState.getData();

            if (greenTerra || getGreenThumbStage() > 1) {
                plant.setSize(CocoaPlantSize.MEDIUM);
            }
            else {
                plant.setSize(CocoaPlantSize.SMALL);
            }

            return true;

        default:
            return false;
    }
}
项目:Almura-API    文件:Crops.java   
public Crops(CropState state) {
    this();
    setState(state);
}
项目:BedrockAPI    文件:Crops.java   
public Crops(CropState state) {
}
项目:BedrockAPI    文件:Crops.java   
public CropState getState() {
    return null;
}
项目:BedrockAPI    文件:Crops.java   
public void setState(CropState state) {
}
项目:VSkills    文件:AbilitiesManager.java   
public static void runInstaGrow(UUID id, Block block){
    Material b = block.getType();
    BlockState bs = block.getState();
    Location loc = block.getLocation();
    Location down = loc.clone().subtract(0, 1, 0);
    Location down2 = loc.clone().subtract(0, 2, 0);
    Location up = loc.clone().add(0, 1, 0);
    Location up2 = loc.clone().add(0, 2, 0);
    Player player = Bukkit.getPlayer(id);
    if(canRunAbility(id, AbilityType.INSTAGROW)){
        if(b == Material.PUMPKIN_STEM){
            block.setType(Material.PUMPKIN);
            runAbility(id, AbilityType.INSTAGROW);
        }else if(b == Material.MELON_STEM){
            block.setType(Material.MELON_BLOCK);
            runAbility(id, AbilityType.INSTAGROW);
        }else if(b == Material.SUGAR_CANE_BLOCK){
            if(down.getBlock().getType() ==  Material.SUGAR_CANE_BLOCK){
                if(up.getBlock().getType() == Material.SUGAR_CANE_BLOCK || down2.getBlock().getType() == Material.SUGAR_CANE_BLOCK){
                    player.sendMessage("You cannot use InstaGrow on sugar cane taller than 2 blocks");
                    return;
                }
                if(up.getBlock().getType() == Material.AIR){
                    up.getBlock().setType(Material.SUGAR_CANE_BLOCK);
                    runAbility(id, AbilityType.INSTAGROW);
                }
            }else{
                if(up.getBlock().getType() == Material.AIR){
                    if(up2.getBlock().getType() == Material.AIR){
                        up.getBlock().setType(Material.SUGAR_CANE_BLOCK);
                        up2.getBlock().setType(Material.SUGAR_CANE_BLOCK);
                        runAbility(id, AbilityType.INSTAGROW);
                    }else{
                        up.getBlock().setType(Material.SUGAR_CANE_BLOCK);
                        runAbility(id, AbilityType.INSTAGROW);
                    }
                }
            }
        }else if(b == Material.CACTUS){
            if(down.getBlock().getType() ==  Material.CACTUS){
                if(up.getBlock().getType() == Material.CACTUS || down2.getBlock().getType() == Material.CACTUS){
                    player.sendMessage("You cannot use InstaGrow on sugar cane taller than 2 blocks");
                    return;
                }
                if(up.getBlock().getType() == Material.AIR){
                    runAbility(id, AbilityType.INSTAGROW);
                }
            }else{
                if(up.getBlock().getType() == Material.AIR){
                    if(up2.getBlock().getType() == Material.AIR){
                        up.getBlock().setType(Material.CACTUS);
                        up2.getBlock().setType(Material.CACTUS);
                        runAbility(id, AbilityType.INSTAGROW);
                    }else{
                        up.getBlock().setType(Material.CACTUS);
                        runAbility(id, AbilityType.INSTAGROW);
                    }
                }
            }
        }else if(b == Material.CROPS){
            Crops c = new Crops(b);
            c.setState(CropState.RIPE);
            bs.setData(c);
            bs.update();
            runAbility(id, AbilityType.INSTAGROW);
        }
    }
}
项目:Spigot-API    文件:Crops.java   
public Crops(CropState state) {
    this();
    setState(state);
}
项目:Bukkit-JavaDoc    文件:Crops.java   
public Crops(CropState state) {
    this();
    setState(state);
}
项目:Thermos-Bukkit    文件:Crops.java   
/**
 * Gets the current growth state of this crop
 *
 * @return CropState of this crop
 */
public CropState getState() {
    return CropState.getByData(getData());
}
项目:Thermos-Bukkit    文件:Crops.java   
/**
 * Sets the growth state of this crop
 *
 * @param state New growth state of this crop
 */
public void setState(CropState state) {
    setData(state.getData());
}
项目:CauldronGit    文件:Crops.java   
/**
 * Gets the current growth state of this crop
 *
 * @return CropState of this crop
 */
public CropState getState() {
    return CropState.getByData(getData());
}
项目:CauldronGit    文件:Crops.java   
/**
 * Sets the growth state of this crop
 *
 * @param state New growth state of this crop
 */
public void setState(CropState state) {
    setData(state.getData());
}
项目:Cauldron    文件:Crops.java   
/**
 * Gets the current growth state of this crop
 *
 * @return CropState of this crop
 */
public CropState getState() {
    return CropState.getByData(getData());
}
项目:Cauldron    文件:Crops.java   
/**
 * Sets the growth state of this crop
 *
 * @param state New growth state of this crop
 */
public void setState(CropState state) {
    setData(state.getData());
}
项目:Cauldron    文件:Crops.java   
/**
 * Gets the current growth state of this crop
 *
 * @return CropState of this crop
 */
public CropState getState() {
    return CropState.getByData(getData());
}
项目:Cauldron    文件:Crops.java   
/**
 * Sets the growth state of this crop
 *
 * @param state New growth state of this crop
 */
public void setState(CropState state) {
    setData(state.getData());
}
项目:Cauldron    文件:Crops.java   
/**
 * Gets the current growth state of this crop
 *
 * @return CropState of this crop
 */
public CropState getState() {
    return CropState.getByData(getData());
}
项目:Cauldron    文件:Crops.java   
/**
 * Sets the growth state of this crop
 *
 * @param state New growth state of this crop
 */
public void setState(CropState state) {
    setData(state.getData());
}
项目:Almura-API    文件:Crops.java   
/**
 * Gets the current growth state of this crop
 *
 * @return CropState of this crop
 */
public CropState getState() {
    return CropState.getByData(getData());
}
项目:Almura-API    文件:Crops.java   
/**
 * Sets the growth state of this crop
 *
 * @param state New growth state of this crop
 */
public void setState(CropState state) {
    setData(state.getData());
}
项目:Spigot-API    文件:Crops.java   
/**
 * Gets the current growth state of this crop
 *
 * @return CropState of this crop
 */
public CropState getState() {
    return CropState.getByData(getData());
}
项目:Spigot-API    文件:Crops.java   
/**
 * Sets the growth state of this crop
 *
 * @param state New growth state of this crop
 */
public void setState(CropState state) {
    setData(state.getData());
}
项目:Bukkit-JavaDoc    文件:Crops.java   
/**
 * Gets the current growth state of this crop
 *
 * @return CropState of this crop
 */
public CropState getState() {
    return CropState.getByData(getData());
}
项目:Bukkit-JavaDoc    文件:Crops.java   
/**
 * Sets the growth state of this crop
 *
 * @param state New growth state of this crop
 */
public void setState(CropState state) {
    setData(state.getData());
}