當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。