Package com.sk89q.craftbook

Examples of com.sk89q.craftbook.ChangedSign


        return toChangedSign((Sign) sign.getState(), ((Sign) sign.getState()).getLines());
    }

    public static ChangedSign toChangedSign(Sign sign, String[] lines) {

        return new ChangedSign(sign, lines);
    }
View Full Code Here


        return new ChangedSign(sign, lines);
    }

    public static ChangedSign toChangedSign(Sign sign, String[] lines, LocalPlayer player) {

        return new ChangedSign(sign, lines, player);
    }
View Full Code Here

    public void teleportFinish(LocalPlayer player, Block destination, BlockFace shift) {
        // Now, we want to read the sign so we can tell the player
        // his or her floor, but as that may not be avilable, we can
        // just print a generic message
        ChangedSign info = null;
        if (!SignUtil.isSign(destination)) {
            if (destination.getType() == Material.STONE_BUTTON || destination.getType() == Material.WOOD_BUTTON) {

                Button button = (Button) destination.getState().getData();
                if (SignUtil.isSign(destination.getRelative(button.getAttachedFace(), 2)))
                    info = BukkitUtil.toChangedSign(destination.getRelative(button.getAttachedFace(), 2));
            }
            if (info == null)
                return;
        } else
            info = BukkitUtil.toChangedSign(destination);
        String title = info.getLines()[0];
        if (!title.isEmpty()) {
            player.print(player.translate("mech.lift.floor") + ": " + title);
        } else {
            player.print(shift.getModY() > 0 ? "mech.lift.up" : "mech.lift.down");
        }
View Full Code Here

        if(!EventUtil.passesFilter(event)) return;

        if(event.getClickedBlock().getType() != Material.WALL_SIGN) return;
        if(event.getAction() != Action.RIGHT_CLICK_BLOCK) return;

        ChangedSign sign = event.getSign();

        if(!sign.getLine(1).equals("[Pay]")) return;

        LocalPlayer player = CraftBookPlugin.inst().wrapPlayer(event.getPlayer());

        if (!player.hasPermission("craftbook.mech.pay.use")) {
            if(CraftBookPlugin.inst().getConfiguration().showPermissionMessages)
                player.printError("mech.use-permission");
            return;
        }

        if(!ProtectionUtil.canUse(event.getPlayer(), event.getClickedBlock().getLocation(), event.getBlockFace(), event.getAction())) {
            if(CraftBookPlugin.inst().getConfiguration().showPermissionMessages)
                player.printError("area.use-permissions");
            return;
        }

        double money = Double.parseDouble(sign.getLine(2));
        String reciever = sign.getLine(3);

        if (CraftBookPlugin.plugins.getEconomy().withdrawPlayer(event.getPlayer().getName(), money).transactionSuccess()) {
            if (CraftBookPlugin.plugins.getEconomy().depositPlayer(reciever, money).transactionSuccess()) {
                Block back = SignUtil.getBackBlock(event.getClickedBlock());
                BlockFace bface = SignUtil.getBack(event.getClickedBlock());
View Full Code Here

    public abstract boolean isApplicableSign(String line);

    public boolean open(Block sign, Block farSide, Block base, CuboidRegion toggle) {

        ChangedSign s = BukkitUtil.toChangedSign(sign);
        ChangedSign other = BukkitUtil.toChangedSign(farSide);
        for (Vector bv : toggle) {
            Block b = sign.getWorld().getBlockAt(bv.getBlockX(), bv.getBlockY(), bv.getBlockZ());
            if (BlockUtil.areBlocksIdentical(b, base) || BlockUtil.isBlockReplacable(b.getType())) {
                if (CraftBookPlugin.inst().getConfiguration().safeDestruction && BlockUtil.areBlocksIdentical(b, base))
                    addBlocks(s, other, 1);
View Full Code Here

        return true;
    }

    public boolean close(Block sign, Block farSide, Block base, CuboidRegion toggle, LocalPlayer player) {

        ChangedSign s = BukkitUtil.toChangedSign(sign);
        ChangedSign other = BukkitUtil.toChangedSign(farSide);
        for (Vector bv : toggle) {
            Block b = sign.getWorld().getBlockAt(bv.getBlockX(), bv.getBlockY(), bv.getBlockZ());
            if (BlockUtil.isBlockReplacable(b.getType())) {
                if (CraftBookPlugin.inst().getConfiguration().safeDestruction) {
                    if (hasEnoughBlocks(s, other)) {
View Full Code Here

    public void onPipeFinish(PipeFinishEvent event) {

        if(!EventUtil.passesFilter(event)) return;

        if(!SignUtil.isSign(event.getOrigin())) return;
        ChangedSign sign = BukkitUtil.toChangedSign(event.getOrigin());

        if(!isApplicableSign(sign.getLine(1))) return;

        List<ItemStack> leftovers = new ArrayList<ItemStack>();
        try {
            Block base = getBlockBase(event.getOrigin());
            for(ItemStack stack : event.getItems()) {
View Full Code Here

    public void onPipePut(PipePutEvent event) {

        if(!EventUtil.passesFilter(event)) return;

        if(!SignUtil.isSign(event.getPuttingBlock())) return;
        ChangedSign sign = BukkitUtil.toChangedSign(event.getPuttingBlock());

        if(!isApplicableSign(sign.getLine(1))) return;

        List<ItemStack> leftovers = new ArrayList<ItemStack>();
        try {
            Block base = getBlockBase(event.getPuttingBlock());
            for(ItemStack stack : event.getItems()) {
View Full Code Here

    public void onPipeSuck(PipeSuckEvent event) {

        if(!EventUtil.passesFilter(event)) return;

        if(!SignUtil.isSign(event.getSuckedBlock())) return;
        ChangedSign sign = BukkitUtil.toChangedSign(event.getSuckedBlock());

        if(!isApplicableSign(sign.getLine(1))) return;

        List<ItemStack> items = event.getItems();
        try {
            Block base = getBlockBase(event.getSuckedBlock());
            int blocks = getBlocks(sign, null);
View Full Code Here

        if (!SignUtil.isSign(event.getBlock())) return;
        if (!isApplicableSign(BukkitUtil.toChangedSign(event.getBlock()).getLine(1))) return;

        LocalPlayer player = CraftBookPlugin.inst().wrapPlayer(event.getPlayer());

        ChangedSign sign = null, other;

        if (SignUtil.isSign(event.getBlock()))
            sign = BukkitUtil.toChangedSign(event.getBlock());

        if (sign == null) return;
View Full Code Here

TOP

Related Classes of com.sk89q.craftbook.ChangedSign

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.