当前位置: 首页>>代码示例>>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;未经允许,请勿转载。