當前位置: 首頁>>代碼示例>>Java>>正文


Java Painting類代碼示例

本文整理匯總了Java中org.bukkit.entity.Painting的典型用法代碼示例。如果您正苦於以下問題:Java Painting類的具體用法?Java Painting怎麽用?Java Painting使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Painting類屬於org.bukkit.entity包,在下文中一共展示了Painting類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onFrameBrake

import org.bukkit.entity.Painting; //導入依賴的package包/類
@EventHandler
 public void onFrameBrake(HangingBreakByEntityEvent e) {
 	RedProtect.get().logger.debug("Is BlockListener - HangingBreakByEntityEvent event");
 	if (e.isCancelled()){
 		return;
 	}
 	
 	Entity remover = e.getRemover();
 	Entity ent = e.getEntity();
 	Location l = e.getEntity().getLocation();
 	    	
 	if ((ent instanceof ItemFrame || ent instanceof Painting) && remover instanceof Monster) {
 		Region r = RedProtect.get().rm.getTopRegion(l);
 		if (r != null && !r.canMobLoot()){
 			e.setCancelled(true);
}
     }    
 }
 
開發者ID:FabioZumbi12,項目名稱:RedProtect,代碼行數:19,代碼來源:RPBlockListener.java

示例2: onHangingPlace

import org.bukkit.entity.Painting; //導入依賴的package包/類
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onHangingPlace(HangingPlaceEvent event)
{
    Hanging hanging = event.getEntity();
    HangingPlace action;
    if (hanging instanceof Painting)
    {
        action = this.newAction(PaintingPlace.class, hanging.getWorld());
        if (action != null)
        {
            ((PaintingPlace)action).art = ((Painting)hanging).getArt();
        }
    }
    else
    {
        action = this.newAction(HangingPlace.class, hanging.getWorld());
    }
    if (action != null)
    {
        action.setLocation(hanging.getLocation());
        action.setHanging(hanging);
        action.setPlayer(event.getPlayer());
        this.logAction(action);
    }
}
 
開發者ID:CubeEngine,項目名稱:modules-extra,代碼行數:26,代碼來源:ListenerHanging.java

示例3: getHangingType

import org.bukkit.entity.Painting; //導入依賴的package包/類
private static Material getHangingType(Hanging hanging) {
    if(hanging instanceof Painting) {
        return Material.PAINTING;
    } else if(hanging instanceof ItemFrame) {
        return Material.ITEM_FRAME;
    } else if(hanging instanceof LeashHitch) {
        return Material.LEASH;
    } else {
        return null;
    }
}
 
開發者ID:OvercastNetwork,項目名稱:ProjectAres,代碼行數:12,代碼來源:EventRuleMatchModule.java

示例4: serializeState

import org.bukkit.entity.Painting; //導入依賴的package包/類
public static String serializeState(Entity entity) {
    YamlConfiguration yaml = new YamlConfiguration();
    if (Support.ARMOR_STAND && entity instanceof ArmorStand) {
        EulerAngleSerializer eas = EulerAngleSerializer.getInstance();
        ArmorStand stand = (ArmorStand) entity;
        yaml.set(PITCH, stand.getLocation().getPitch());
        yaml.set(YAW, stand.getLocation().getYaw());
        yaml.set(ARMOR_STAND_HELMET, stand.getHelmet());
        yaml.set(ARMOR_STAND_CHESTPLATE, stand.getChestplate());
        yaml.set(ARMOR_STAND_LEGGINGS, stand.getLeggings());
        yaml.set(ARMOR_STAND_BOOTS, stand.getBoots());
        yaml.set(ARMOR_STAND_HAND, stand.getItemInHand());
        yaml.set(ARMOR_STAND_POSE_HEAD, eas.serialize(stand.getHeadPose()));
        yaml.set(ARMOR_STAND_POSE_BODY, eas.serialize(stand.getBodyPose()));
        yaml.set(ARMOR_STAND_POSE_ARM_LEFT, eas.serialize(stand.getLeftArmPose()));
        yaml.set(ARMOR_STAND_POSE_ARM_RIGHT, eas.serialize(stand.getRightArmPose()));
        yaml.set(ARMOR_STAND_POSE_LEG_LEFT, eas.serialize(stand.getLeftLegPose()));
        yaml.set(ARMOR_STAND_POSE_LEG_RIGHT, eas.serialize(stand.getRightLegPose()));
        yaml.set(ARMOR_STAND_ARMS, stand.hasArms());
        yaml.set(ARMOR_STAND_BASE_PLATE, stand.hasBasePlate());
        yaml.set(ARMOR_STAND_GRAVITY, stand.hasGravity());
        yaml.set(ARMOR_STAND_SMALL, stand.isSmall());
        yaml.set(ARMOR_STAND_VISIBLE, stand.isVisible());
    } else if (entity instanceof Hanging) {
        yaml.set(HANGING_FACING, ((Hanging) entity).getFacing().name());
        if (entity instanceof ItemFrame) {
            yaml.set(ITEM_FRAME_ITEM, ((ItemFrame) entity).getItem());
            yaml.set(ITEM_FRAME_ROTATION, ((ItemFrame) entity).getRotation().name());
        } else if (entity instanceof Painting) {
            yaml.set(PAINTING_ART, ((Painting) entity).getArt().name());
        }
    }

    return yaml.saveToString();
}
 
開發者ID:caseif,項目名稱:Steel,代碼行數:36,代碼來源:EntityStateSerializer.java

示例5: onPlayerInteract

import org.bukkit.entity.Painting; //導入依賴的package包/類
@EventHandler
   public void onPlayerInteract(PlayerInteractEntityEvent e) {
   	if (e.isCancelled()) {
           return;
       }

   	Player p = e.getPlayer();
       Entity ent = e.getRightClicked();
       Location l = ent.getLocation();
       Region r = RedProtect.get().rm.getTopRegion(l);
       if (r != null){
		return;
	}
       
       if (ent instanceof ItemFrame || ent instanceof Painting) {
           if (!bypassBuild(p, null, 0)) {
               e.setCancelled(true);
               return;
           }
       } 
       
       if (ent instanceof Minecart || ent instanceof Boat){
       	if (!RPConfig.getGlobalFlagBool(l.getWorld().getName()+".use-minecart") && !p.hasPermission("redprotect.bypass.world")) {
               e.setCancelled(true);
               return;
           }
       } 
       
       if (!RPConfig.getGlobalFlagBool(l.getWorld().getName()+".interact") && !p.hasPermission("redprotect.bypass.world") && (!(ent instanceof Player))) {
   		if (RPConfig.getGlobalFlagList(p.getWorld().getName() + ".if-interact-false.allow-entities").contains(ent.getType().name())){
   			return;
   		} 
           e.setCancelled(true);
	}
}
 
開發者ID:FabioZumbi12,項目名稱:RedProtect,代碼行數:36,代碼來源:RPGlobalListener.java

示例6: fromPainting

import org.bukkit.entity.Painting; //導入依賴的package包/類
private static PacketContainer fromPainting(Painting painting)
{
    if (entityConstructor == null)
    {
        entityConstructor = ProtocolLibrary.getProtocolManager().createPacketConstructor(TYPE, (Entity) painting);
    }
    return entityConstructor.createPacket((Entity) painting);
}
 
開發者ID:Ms-ran,項目名稱:ItemPlus,代碼行數:9,代碼來源:WrapperPlayServerSpawnEntityPainting.java

示例7: onInteractEntity

import org.bukkit.entity.Painting; //導入依賴的package包/類
@Override
public void onInteractEntity(PlayerInteractEntityEvent event) {
    event.setCancelled(true);
    if (getPaintLevel() <= 0) {
        return;
    }
    Entity e = event.getRightClicked();
    int paintUsed = 0;
    if (e instanceof Colorable) {
        ((Colorable) e).setColor(getColour());
        paintUsed = 1;
    } else if (e instanceof Painting) {
        Art a = ((Painting) e).getArt();
        if (getPaintLevel() >= a.getBlockHeight() * a.getBlockWidth()) {
            IconMenu menu = buildMenu((Painting) e);
            menu.open(event.getPlayer());
        } else {
            Location loc = e.getLocation().add(0, -a.getBlockHeight() / 2.0, 0);
            PopupMessage.quickMessage(event.getPlayer(), loc, ChatColor.RED + "Not enough paint!");
        }
    } else if (e instanceof Wolf) {
        Wolf wolf = (Wolf) e;
        wolf.setCollarColor(getColour());
        paintUsed = 1;
    }

    if (paintUsed > 0) {
        setPaintLevel(getPaintLevel() - paintUsed);
        event.getPlayer().setItemInHand(toItemStack());
        event.getPlayer().playSound(e.getLocation(), Sound.WATER, 1.0f, 1.5f);
    }
}
 
開發者ID:desht,項目名稱:sensibletoolbox,代碼行數:33,代碼來源:PaintBrush.java

示例8: buildMenu

import org.bukkit.entity.Painting; //導入依賴的package包/類
private IconMenu buildMenu(Painting painting) {
    editingPainting = painting;
    Art[] other = getOtherArt(painting.getArt());
    IconMenu menu = new IconMenu("Select Artwork", STBUtil.roundUp(other.length, 9), this, getProviderPlugin());
    int pos = 0;
    for (Art a : other) {
        menu.setOption(pos++, new ItemStack(Material.PAINTING), a.name(), "");
    }
    return menu;
}
 
開發者ID:desht,項目名稱:sensibletoolbox,代碼行數:11,代碼來源:PaintBrush.java

示例9: getFurnitureClasses

import org.bukkit.entity.Painting; //導入依賴的package包/類
/**
 * Get classes used to detect a furniture entity.
 */
public static Class<?>[] getFurnitureClasses() {
    return new Class<?>[] {
            Painting.class,
            ItemFrame.class,
            ArmorStand.class
    };
}
 
開發者ID:JCThePants,項目名稱:NucleusFramework,代碼行數:11,代碼來源:SerializableFurnitureEntity.java

示例10: PaintingBreakEvent

import org.bukkit.entity.Painting; //導入依賴的package包/類
public PaintingBreakEvent(final Painting painting, final RemoveCause cause) {
    super(painting);
    this.cause = cause;
}
 
開發者ID:CyberdyneCC,項目名稱:Thermos-Bukkit,代碼行數:5,代碼來源:PaintingBreakEvent.java

示例11: PaintingPlaceEvent

import org.bukkit.entity.Painting; //導入依賴的package包/類
public PaintingPlaceEvent(final Painting painting, final Player player, final Block block, final BlockFace blockFace) {
    super(painting);
    this.player = player;
    this.block = block;
    this.blockFace = blockFace;
}
 
開發者ID:CyberdyneCC,項目名稱:Thermos-Bukkit,代碼行數:7,代碼來源:PaintingPlaceEvent.java

示例12: PaintingEvent

import org.bukkit.entity.Painting; //導入依賴的package包/類
protected PaintingEvent(final Painting painting) {
    this.painting = painting;
}
 
開發者ID:CyberdyneCC,項目名稱:Thermos-Bukkit,代碼行數:4,代碼來源:PaintingEvent.java

示例13: PaintingBreakByEntityEvent

import org.bukkit.entity.Painting; //導入依賴的package包/類
public PaintingBreakByEntityEvent(final Painting painting, final Entity remover) {
    super(painting, RemoveCause.ENTITY);
    this.remover = remover;
}
 
開發者ID:CyberdyneCC,項目名稱:Thermos-Bukkit,代碼行數:5,代碼來源:PaintingBreakByEntityEvent.java

示例14: deserializeState

import org.bukkit.entity.Painting; //導入依賴的package包/類
public static void deserializeState(Entity entity, String serial)
        throws InvalidConfigurationException, IOException {
    YamlConfiguration yaml = new YamlConfiguration();
    yaml.loadFromString(serial);

    if (Support.ARMOR_STAND && entity instanceof ArmorStand) {
        EulerAngleSerializer eas = EulerAngleSerializer.getInstance();
        ArmorStand stand = (ArmorStand) entity;
        stand.setHelmet(yaml.getItemStack(ARMOR_STAND_HELMET));
        stand.setChestplate(yaml.getItemStack(ARMOR_STAND_CHESTPLATE));
        stand.setLeggings(yaml.getItemStack(ARMOR_STAND_LEGGINGS));
        stand.setBoots(yaml.getItemStack(ARMOR_STAND_BOOTS));
        stand.setItemInHand(yaml.getItemStack(ARMOR_STAND_HAND));
        stand.setHeadPose(eas.deserialize(yaml.getString(ARMOR_STAND_POSE_HEAD)));
        stand.setBodyPose(eas.deserialize(yaml.getString(ARMOR_STAND_POSE_BODY)));
        stand.setLeftArmPose(eas.deserialize(yaml.getString(ARMOR_STAND_POSE_ARM_LEFT)));
        stand.setRightArmPose(eas.deserialize(yaml.getString(ARMOR_STAND_POSE_ARM_RIGHT)));
        stand.setLeftLegPose(eas.deserialize(yaml.getString(ARMOR_STAND_POSE_LEG_LEFT)));
        stand.setRightLegPose(eas.deserialize(yaml.getString(ARMOR_STAND_POSE_LEG_RIGHT)));
        stand.setArms(yaml.getBoolean(ARMOR_STAND_ARMS));
        stand.setBasePlate(yaml.getBoolean(ARMOR_STAND_BASE_PLATE));
        stand.setGravity(yaml.getBoolean(ARMOR_STAND_GRAVITY));
        stand.setSmall(yaml.getBoolean(ARMOR_STAND_SMALL));
        stand.setVisible(yaml.getBoolean(ARMOR_STAND_VISIBLE));
    } else if (entity instanceof Hanging) {
        BlockFace facing = BlockFace.valueOf(yaml.getString(HANGING_FACING));
        if (facing != null) {
            ((Hanging) entity).setFacingDirection(facing, true);
        } else {
            SteelCore.logVerbose("Invalid serialized BlockFace value for hanging entity with UUID "
                    + entity.getUniqueId().toString());
        }

        if (entity instanceof ItemFrame) {
            ((ItemFrame) entity).setItem(yaml.getItemStack(ITEM_FRAME_ITEM));
            Rotation rotation = Rotation.valueOf(yaml.getString(ITEM_FRAME_ROTATION));
            if (rotation != null) {
                ((ItemFrame) entity).setRotation(rotation);
                // rotation doesn't sound like a word anymore
            } else {
                SteelCore.logVerbose("Invalid serialized Rotation value for item frame with UUID "
                        + entity.getUniqueId().toString());
            }
        } else if (entity instanceof Painting) {
            Art art = Art.valueOf(yaml.getString("art"));
            if (art != null) {
                ((Painting) entity).setArt(art, true);
                // neither does art
            } else {
                SteelCore.logVerbose("Invalid serialized Art value for item frame with UUID "
                        + entity.getUniqueId().toString());
            }
        }
    }
}
 
開發者ID:caseif,項目名稱:Steel,代碼行數:56,代碼來源:EntityStateSerializer.java

示例15: CanaryPainting

import org.bukkit.entity.Painting; //導入依賴的package包/類
public CanaryPainting(net.canarymod.api.entity.hanging.Painting entity) {
    super(entity);
}
 
開發者ID:CanaryBukkitTeam,項目名稱:CanaryBukkit,代碼行數:4,代碼來源:CanaryPainting.java


注:本文中的org.bukkit.entity.Painting類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。