当前位置: 首页>>代码示例>>Java>>正文


Java Effect类代码示例

本文整理汇总了Java中org.bukkit.Effect的典型用法代码示例。如果您正苦于以下问题:Java Effect类的具体用法?Java Effect怎么用?Java Effect使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Effect类属于org.bukkit包,在下文中一共展示了Effect类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onInventoryClick1

import org.bukkit.Effect; //导入依赖的package包/类
@EventHandler
public void onInventoryClick1(InventoryClickEvent event) {
	Player player = (Player) event.getWhoClicked();
	ItemStack is = event.getCurrentItem();
	if ((event.getCurrentItem() != null) && (event.getCurrentItem().getType() != Material.AIR)) {
		if (event.getInventory().getName().equals(ChatColor.DARK_GRAY + "Teleport Menu - Page 1")) {
			event.setCancelled(true);
               for (int i = 0; i < Bukkit.getOnlinePlayers().size(); i++) {   
               Player targetPlayer = (Player) Bukkit.getOnlinePlayers().toArray()[i];
               Location location = player.getLocation();
               if ((event.getCurrentItem().getType() == Material.SKULL_ITEM) && (is.hasItemMeta()) && (is.getItemMeta().getDisplayName().equals(ChatColor.YELLOW + "Teleport to " + ChatColor.GREEN + targetPlayer.getName()))) {
                   player.closeInventory();
                   player.teleport(targetPlayer);
           		player.sendMessage(ChatColor.YELLOW + "You've teleported to " + ChatColor.GREEN + targetPlayer.getDisplayName() + ChatColor.YELLOW + "!");
           		player.playSound(location, Sound.ENTITY_ENDERMEN_TELEPORT, 100, 1);
           		player.playEffect(location, Effect.ENDER_SIGNAL, 1);
           		targetPlayer.playEffect(location, Effect.ENDER_SIGNAL, 1);
               }
               }
           }
	}
}
 
开发者ID:SlamTheHam,项目名称:UltraCore,代码行数:23,代码来源:Events.java

示例2: onInventoryClick2

import org.bukkit.Effect; //导入依赖的package包/类
@EventHandler
public void onInventoryClick2(InventoryClickEvent event) {
	Player player = (Player) event.getWhoClicked();
	ItemStack is = event.getCurrentItem();
	if ((event.getCurrentItem() != null) && (event.getCurrentItem().getType() != Material.AIR)) {
		if (event.getInventory().getName().equals(ChatColor.DARK_GRAY + "Teleport Here Menu - Page 1")) {
			event.setCancelled(true);
            for (int i = 0; i < Bukkit.getOnlinePlayers().size(); i++) {   
                Player targetPlayer = (Player) Bukkit.getOnlinePlayers().toArray()[i];
                Location location = player.getLocation();
                if ((event.getCurrentItem().getType() == Material.SKULL_ITEM) && (is.hasItemMeta()) && (is.getItemMeta().getDisplayName().equals(ChatColor.YELLOW + "Teleport " + ChatColor.GREEN + targetPlayer.getName() + ChatColor.YELLOW + " to you."))) {
                    player.closeInventory();
                    targetPlayer.teleport(player);
            		player.sendMessage(ChatColor.YELLOW + "You've teleported " + ChatColor.GREEN + targetPlayer.getDisplayName() + ChatColor.YELLOW + " to you!");
            		player.playSound(location, Sound.ENTITY_ENDERMEN_TELEPORT, 100, 1);
            		player.playEffect(location, Effect.ENDER_SIGNAL, 1);
            		targetPlayer.playEffect(location, Effect.ENDER_SIGNAL, 1);	
                }
               }
           }
       }
   }
 
开发者ID:SlamTheHam,项目名称:UltraCore,代码行数:23,代码来源:Events.java

示例3: playEffect

import org.bukkit.Effect; //导入依赖的package包/类
public <T> void playEffect(Location loc, Effect effect, T data, int radius) {
    if (data != null) {
        Validate.isTrue(data.getClass().equals(effect.getData()), "Wrong kind of data for this effect!");
    } else {
        Validate.isTrue(effect.getData() == null, "Wrong kind of data for this effect!");
    }

    if (data != null && data.getClass().equals( org.bukkit.material.MaterialData.class )) {
        org.bukkit.material.MaterialData materialData = (org.bukkit.material.MaterialData) data;
        Validate.isTrue( materialData.getItemType().isBlock(), "Material must be block" );
        spigot().playEffect( loc, effect, materialData.getItemType().getId(), materialData.getData(), 0, 0, 0, 1, 1, radius );
    } else {
        int dataValue = data == null ? 0 : CraftEffect.getDataValue( effect, data );
        playEffect( loc, effect, dataValue, radius );
    }
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:17,代码来源:CraftWorld.java

示例4: setPlaying

import org.bukkit.Effect; //导入依赖的package包/类
@Override
public void setPlaying(Material record) {
    if (record == null || CraftMagicNumbers.getItem(record) == null) {
        record = Material.AIR;
        jukebox.func_145857_a(null);
    } else {
        jukebox.func_145857_a(new ItemStack(CraftMagicNumbers.getItem(record), 1));
    }
    jukebox.markDirty();
    if (record == Material.AIR) {
        world.getHandle().setBlockMetadataWithNotify(getX(), getY(), getZ(), 0, 3);
    } else {
        world.getHandle().setBlockMetadataWithNotify(getX(), getY(), getZ(), 1, 3);
    }
    world.playEffect(getLocation(), Effect.RECORD_PLAY, record.getId());
}
 
开发者ID:UraniumMC,项目名称:Uranium,代码行数:17,代码来源:CraftJukebox.java

示例5: onCommand

import org.bukkit.Effect; //导入依赖的package包/类
public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
	if (cmd.getName().equalsIgnoreCase("epicweapon")) {
		if(sender instanceof Player){
			if(sender.hasPermission("chaoticweapons.create") || sender.hasPermission("*")){
				Player player = (Player) sender;
				if (args.length != 0) {
					player.sendMessage(e + "Command Syntax: too many paremeters");
					player.sendMessage(ChatColor.GREEN + "[FIX]: " + ChatColor.BLUE + "type /epicweapon");
				} else {
					player.openInventory(selectEffect());
					player.getWorld().playEffect(player.getLocation(), Effect.POTION_BREAK, 0);
				}
			}else{
				sender.sendMessage(e + "Permission: You dont have permissions");
			}
		}else{
			sender.sendMessage(ChatColor.RED + "Only players can use this!");
		}
		return true;
	}
	return false;
}
 
开发者ID:OverloadedCore,项目名称:chaoticWeapons,代码行数:23,代码来源:Core.java

示例6: onEntityDamage

import org.bukkit.Effect; //导入依赖的package包/类
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onEntityDamage(final EntityDamageEvent event) {
    if(event.getEntity() instanceof Player) {
        Player victim = (Player) event.getEntity();
        Location location = victim.getBoundingBox().center().toLocation(match.getWorld());
        if(event.getDamage() > 0 && location.getY() >= 0 && !victim.hasPotionEffect(PotionEffectType.INVISIBILITY)) {
            EntityUtils.entities(match.getWorld(), Player.class)
                 .filter(player -> settings.getManager(player).getValue(Settings.BLOOD, Boolean.class, false))
                 .forEach(player -> {
                     if(event instanceof EntityDamageByEntityEvent) {
                         player.playEffect(location, Effect.STEP_SOUND, Material.REDSTONE_WIRE);
                     } else {
                         player.playEffect(location, Effect.STEP_SOUND, Material.LAVA);
                     }
                 });
        }
    }
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:19,代码来源:BloodMatchModule.java

示例7: handleElimination

import org.bukkit.Effect; //导入依赖的package包/类
private void handleElimination(final MatchPlayer player) {
    if (!eliminatedPlayers.add(player.getBukkit().getUniqueId())) return;

    World world = player.getMatch().getWorld();
    Location death = player.getBukkit().getLocation();

    double radius = 0.1;
    int n = 8;
    for(int i = 0; i < 6; i++) {
        double angle = 2 * Math.PI * i / n;
        Location base = death.clone().add(new Vector(radius * Math.cos(angle), 0, radius * Math.sin(angle)));
        for(int j = 0; j <= 8; j++) {
            world.playEffect(base, Effect.SMOKE, j);
        }
    }
    checkEnd();
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:18,代码来源:BlitzMatchModule.java

示例8: removePlayer

import org.bukkit.Effect; //导入依赖的package包/类
@Override
public void removePlayer(Player player)
{
    super.removePlayer(player);

    this.expected.remove(player.getUniqueId());
    player.setResourcePack("http://resources.samagames.net/samareset.zip");
    player.playEffect(player.getLocation(), Effect.RECORD_PLAY, 0);
}
 
开发者ID:SamaGames,项目名称:Hub,代码行数:10,代码来源:DeveloperRoomParkour.java

示例9: tirarhuevo

import org.bukkit.Effect; //导入依赖的package包/类
/** @EVENTS **/

    @EventHandler

    public void tirarhuevo(PlayerEggThrowEvent e){

        if (e.isHatching()){
            Location loc = e.getPlayer().getLocation();

            for(int i = 0; i <360; i+=5) {
                Location particleloc = loc;
                particleloc.setZ(particleloc.getZ() + Math.cos(i) * 0.6);
                particleloc.setX(particleloc.getX() + Math.sin(i) * 0.5);
                particleloc.setY(particleloc.getY() + 0.05);
                loc.getWorld().playEffect(particleloc, Effect.valueOf(plugin.particle), 51);
            }

            Location location = e.getPlayer().getLocation();
            e.getPlayer().playSound(location, Sound.valueOf(plugin.sound), 1, 1);
        }
    }
 
开发者ID:clonalejandro,项目名称:AmazingEgss,代码行数:22,代码来源:l.java

示例10: dropFruitFromTree

import org.bukkit.Effect; //导入依赖的package包/类
public void dropFruitFromTree(Block block) {
	for (int x = -1; x < 2; x++) {
		for (int y = -1; y < 2; y++) {
			for (int z = -1; z < 2; z++) { //inspect a cube at the reference
				Block drop = block.getRelative(x, y, z);
				SlimefunItem check = BlockStorage.check(drop);
				if (check != null) {
					for (Tree tree: ExoticGarden.trees) {
						if (check.getName().equalsIgnoreCase(tree.fruit)) {
							BlockStorage.clearBlockInfo(drop);
							ItemStack fruits = check.getItem();
							drop.getWorld().playEffect(drop.getLocation(), Effect.STEP_SOUND, Material.LEAVES);
							drop.getWorld().dropItemNaturally(drop.getLocation(), fruits);
							drop.setType(Material.AIR);
						}
					}
				}
			}
		}
	}
}
 
开发者ID:TheBusyBiscuit,项目名称:ExoticGarden,代码行数:22,代码来源:PlantsListener.java

示例11: checkParticle

import org.bukkit.Effect; //导入依赖的package包/类
public boolean checkParticle(){
    if(wild.getConfig().getBoolean("DoParticle")) {
        try {
            String[] tmp = Bukkit.getVersion().split("MC: ");
            String version = tmp[tmp.length - 1].substring(0, 3);
            Particle particle;
            Effect effect;
            if (version.equals("1.9") || version.equals("1.1"))
                particle = Particle.valueOf(wild.getConfig().getString("Particle").toUpperCase());
            else
                effect = Effect.valueOf(wild.getConfig().getString("Particle").toUpperCase());
        } catch (IllegalArgumentException e) {
            return false;
        }
    }else
        return true;
    return true;
}
 
开发者ID:Qballl,项目名称:WildernessTp,代码行数:19,代码来源:CheckConfig.java

示例12: breakBlock

import org.bukkit.Effect; //导入依赖的package包/类
public static void breakBlock(Player p, Block b, List<ItemStack> drops, boolean check) {
	boolean allowed = true;
	
	if (check) {
		BlockBreakEvent event = new BlockBreakEvent(b, p);
		Bukkit.getServer().getPluginManager().callEvent(event);
		allowed = !event.isCancelled();
	}
	
	if (allowed) {
		for (ItemStack drop : drops) {
			b.getWorld().dropItemNaturally(b.getLocation(), drop);
	    }
	    if (check) b.getWorld().playEffect(b.getLocation(), Effect.STEP_SOUND, b.getType());
	    b.setType(Material.AIR);
	}
}
 
开发者ID:TheBusyBiscuit,项目名称:CS-CoreLib,代码行数:18,代码来源:BlockBreaker.java

示例13: castSpell

import org.bukkit.Effect; //导入依赖的package包/类
private void castSpell(Spell spell) {
	if (!getPlayer().isOnline()) {
		return;
	}
	
	if (spell == null) {
		return;
	}
	
	if (!getPlayer().getPlayer().getGameMode().equals(GameMode.CREATIVE) && 
			mp < spell.getCost()) {
		getPlayer().getPlayer().playSound(getPlayer().getPlayer().getLocation(), Sound.BLOCK_WATERLILY_PLACE, 1.0f, 0.5f);
		return;
	}
	
	if (!QuestManagerPlugin.questManagerPlugin.getPluginConfiguration().getMagicEnabled()) {
		return;
	}
	
	new ChargeEffect(Effect.WITCH_MAGIC)
		.play(getPlayer().getPlayer(), getPlayer().getPlayer().getLocation());
	
	addMP(-spell.getCost());
	spell.cast(this);
}
 
开发者ID:Dove-Bren,项目名称:QuestManager,代码行数:26,代码来源:QuestPlayer.java

示例14: SpellProjectile

import org.bukkit.Effect; //导入依赖的package包/类
public SpellProjectile(TargetSpell source, MagicUser caster, Location start, Vector direction,
		double speed, int maxDistance, Effect paceEffect) {
	this.sourceSpell = source;
	this.distance = 0;
	this.maxDistance = maxDistance;
	this.location = start.clone();
	this.direction = direction;
	this.caster = caster;
	this.effect = paceEffect;
	
	double rate = 20 / speed;
	
	if (rate >= 1) {
		perTick = 1;
		delay = (int) Math.round(rate);
	} else {
		delay = 1;
		perTick = (int) Math.round(1 / rate);
	}
	
	Bukkit.getScheduler().runTaskLater(QuestManagerPlugin.questManagerPlugin, this, delay);
}
 
开发者ID:Dove-Bren,项目名称:QuestManager,代码行数:23,代码来源:SpellProjectile.java

示例15: ChargeAction

import org.bukkit.Effect; //导入依赖的package包/类
public ChargeAction(MenuAction action, QuestPlayer player, Effect effect, Sound sound, boolean canMove, 
		boolean canGetHit, boolean canChangeItems, double chargingTime) {
	if (!player.getPlayer().isOnline()) {
		return;
	}
	
	this.action = action;
	this.canMove = canMove;
	this.canGetHit = canGetHit;
	this.canChangeItems = canChangeItems;
	this.player = player;
	this.effect = new AuraEffect(effect);
	this.effect.play(player.getEntity());
	
	player.getEntity().getWorld().playSound(player.getEntity().getLocation(), sound, 1, 1);

	Bukkit.getPluginManager().registerEvents(this, QuestManagerPlugin.questManagerPlugin);
	Alarm.getScheduler().schedule(this, 0, chargingTime);
}
 
开发者ID:Dove-Bren,项目名称:QuestManager,代码行数:20,代码来源:ChargeAction.java


注:本文中的org.bukkit.Effect类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。