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


Java EventPriority.HIGHEST属性代码示例

本文整理汇总了Java中org.bukkit.event.EventPriority.HIGHEST属性的典型用法代码示例。如果您正苦于以下问题:Java EventPriority.HIGHEST属性的具体用法?Java EventPriority.HIGHEST怎么用?Java EventPriority.HIGHEST使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在org.bukkit.event.EventPriority的用法示例。


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

示例1: onCommand

@EventHandler (priority = EventPriority.HIGHEST, ignoreCancelled = false)
public void onCommand(PlayerCommandPreprocessEvent event){
	if(event.getMessage().isEmpty()){
		event.setMessage("/help");
		return;
	}
	Command cmd = commandMap.get(event.getMessage().replaceFirst("/", "").split(" ")[0].toLowerCase());
	if(cmd == null){
		event.setMessage("/help");
		return;
	}
	if(!cmd.testPermissionSilent(event.getPlayer()))
		if(!(cmd instanceof LinkCommand)){
			event.setMessage("/help");
		}
}
 
开发者ID:dracnis,项目名称:VanillaPlus,代码行数:16,代码来源:CPManager.java

示例2: onJoin

@EventHandler(priority = EventPriority.HIGHEST)
public void onJoin(PlayerJoinEvent e) {
    PAUser u = PAServer.getUser(e.getPlayer());
    Player p = e.getPlayer();
    Helpers h = new Helpers(u);

    h.lobbyScoreboard();
    LobbyTeams.setScoreboardTeam(u);
    new Helpers(u).sendToSpawn();
    u.getPlayer().getInventory().clear();
    u.getPlayer().getInventory().setItem(0, new ItemMaker(Material.NETHER_STAR).setDisplayName("&cJuegos").build());
    u.getPlayer().getInventory().setItem(4, new ItemMaker(Material.REDSTONE).setDisplayName("&7Cosmeticos").build());
    if (u.isOnRank(PACmd.Grupo.Builder)) u.getPlayer().getInventory().setItem(8, new ItemMaker(Material.WOOD_AXE).setDisplayName("&cConstructores").build());
    u.getPlayer().updateInventory();

    u.sendMessage("&6Actualmente hay &2" + PAServer.users.size() + " &6usuarios en línea");
}
 
开发者ID:cadox8,项目名称:PA,代码行数:17,代码来源:PlayerEvents.java

示例3: onEntityDamageByEntity

@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
public void onEntityDamageByEntity(EntityDamageByEntityEvent event) {
    Entity entity = event.getEntity();
    Entity damager = event.getDamager();
    if (entity instanceof Player && damager instanceof Player) {
        Player attacker = (Player) damager;
        if (plugin.getPvpClassManager().getEquippedClass(attacker) == this) {
            ItemStack stack = attacker.getItemInHand();
            if (stack != null && stack.getType() == Material.GOLD_SWORD && stack.getEnchantments().isEmpty()) {
                Player player = (Player) entity;
                player.sendMessage(SettingsYML.ENEMY_COLOUR + attacker.getName() + ChatColor.YELLOW + " has backstabbed you.");
                player.playSound(player.getLocation(), Sound.ITEM_BREAK, 1.0F, 1.0F);

                attacker.sendMessage(ChatColor.YELLOW + "You have backstabbed " + SettingsYML.ENEMY_COLOUR + player.getName() + ChatColor.YELLOW + '.');
                attacker.setItemInHand(new ItemStack(Material.AIR, 1));
                player.setHealth(12);
                attacker.playSound(player.getLocation(), Sound.ITEM_BREAK, 1.0F, 1.0F);

                event.setDamage(3.0);
            }
        }
    }
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:23,代码来源:RogueClass.java

示例4: onConsume

@EventHandler(priority = EventPriority.HIGHEST)
public void onConsume(PlayerItemConsumeEvent event)
{
	if(event.isCancelled()) return;
	Player player = event.getPlayer();
	if(event.getItem().getType() == Material.COOKIE)
	{
		int amp = -1;
		int dur = 600;
		for (PotionEffect effect : player.getActivePotionEffects())
		{
			if(effect.getType().equals(PotionEffectType.HEALTH_BOOST))
			{
				dur += effect.getDuration();
				if(effect.getDuration() >= 300)
					amp++;
				if(effect.getDuration() >= 1200)
					amp++;
				if(effect.getDuration() >= 3600)
					amp++;
		        player.removePotionEffect(effect.getType());
			}
		}
		player.addPotionEffect(new PotionEffect(PotionEffectType.HEALTH_BOOST, dur, amp));
		player.setSaturation(player.getSaturation() + 4.6f);
	}
}
 
开发者ID:FattyMieo,项目名称:SurvivalPlus,代码行数:27,代码来源:CookieHealthBoost.java

示例5: onWeatherChange

@EventHandler(priority= EventPriority.HIGHEST)
public void onWeatherChange(WeatherChangeEvent event) {
    boolean rain = event.toWeatherState();

    if (rain) {
        event.setCancelled(true);
    }
}
 
开发者ID:ijoeleoli,项目名称:ZorahPractice,代码行数:8,代码来源:EnvironmentListener.java

示例6: onInventoryCreative

@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
public void onInventoryCreative(InventoryCreativeEvent event) {
    HumanEntity humanEntity = event.getWhoClicked();
    if (humanEntity instanceof Player && !humanEntity.hasPermission("base.command.gamemode")) {
        event.setCancelled(true);
       // humanEntity.sendMessage(ChatColor.RED + "You are not allowed to be in gamemode! Setting you to default gamemode!");
        humanEntity.setGameMode(GameMode.SURVIVAL);
    }
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:9,代码来源:CreativeClickListener.java

示例7: onDropWithItemVisibility

@EventHandler(priority=EventPriority.HIGHEST)
public void onDropWithItemVisibility(PlayerDropItemEvent e) {
	Player p = e.getPlayer();
	
	if (ConfigGPlayerVisibility.getConfig().getBoolean("PV.Enable")) {
		if (ConfigGPlayerVisibility.getConfig().getBoolean("PV.Option.Ultimate-Protection-Of-The-Items")) {
			if ((p.getItemInHand().getItemMeta().getDisplayName() == Check) || (p.getItemInHand().getItemMeta().getDisplayName() == CheckTwo)) {
				e.setCancelled(true);
			}
		}
	}
}
 
开发者ID:DianoxDragon,项目名称:UltimateSpawn,代码行数:12,代码来源:CustomJoinItem.java

示例8: onBlockPistonExtend

@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onBlockPistonExtend(BlockPistonExtendEvent event) {
    for (Block block : event.getBlocks()) {
        if (SignDatabase.attachedBlocks.containsValue(block)) {
            event.setCancelled(true);
        }
    }
}
 
开发者ID:NyaaCat,项目名称:CapCat,代码行数:8,代码来源:SignListener.java

示例9: onEntityChangeBlock

@EventHandler(priority=EventPriority.HIGHEST, ignoreCancelled = true)
public void onEntityChangeBlock(EntityChangeBlockEvent e) {
	Block block = e.getBlock();
	if (maybeSideTracked(block)) {
		trySideBreak(block, BreakType.NATURAL, null);
	}
	if (maybeBelowTracked(block)) {
		block = block.getRelative(BlockFace.UP);
	}
	Location loc = block.getLocation();
	if (!pendingChecks.contains(loc)) {
		pendingChecks.add(loc);
		handleBreak(block, BreakType.NATURAL, null, null);
	}
}
 
开发者ID:DevotedMC,项目名称:CropControl,代码行数:15,代码来源:CropControlEventHandler.java

示例10: onDismount

@EventHandler(priority = EventPriority.HIGHEST)
public void onDismount(EntityDismountEvent e){
    if (e.getEntity() instanceof Player){
        if (e.getDismounted() instanceof ArmorStand) {
            ArmorStand w = (ArmorStand)e.getDismounted();

            e.getEntity().eject();
            w.remove();
            e.getEntity().teleport(e.getEntity().getLocation().add(0, 4, 0));
            if (new Random().nextInt(10) + 1 >= 9) e.getEntity().sendMessage(magic());
        }
    }
}
 
开发者ID:cadox8,项目名称:WC,代码行数:13,代码来源:Sit.java

示例11: playerChatEvent

@EventHandler(priority = EventPriority.HIGHEST)
public void playerChatEvent(AsyncPlayerChatEvent event) {
    if (Config.getInstance().isAsyncChat() && Config.getInstance().isHighpriority()) {
        if (this.pages.containsKey(event.getPlayer())) {
            event.setCancelled(true);
            final String message = ChatColor.stripColor(event.getMessage());
            final Player player = event.getPlayer();
            this.plugin.getServer().getScheduler().runTaskLater(this.plugin, () -> SChatMenuManager.this.handleChatMessage(player, message), 1L);
        }
    }
}
 
开发者ID:Shynixn,项目名称:BlockBall,代码行数:11,代码来源:SChatMenuManager.java

示例12: onEntityDamage

@EventHandler(ignoreCancelled = true, priority = EventPriority.HIGHEST)
public void onEntityDamage(NPCDamageByEntityEvent evt) {
    CustomEntity ce = getCustom(evt.getNPC());
    if (ce != null)
        Bukkit.getScheduler().runTask(Core.getInstance(), ce::onDamage);
}
 
开发者ID:Kneesnap,项目名称:Kineticraft,代码行数:6,代码来源:Entities.java

示例13: onPlaceBlock

@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onPlaceBlock(BlockPlaceEvent e) {
	Block block = e.getBlock();

	Material blockMaterial = block.getType();
	int x = block.getX();
	int y = block.getY();
	int z = block.getZ();
	WorldChunk chunk = CropControl.getDAO().getChunk(block.getChunk());

	if (CropControl.getDAO().isTracked(block) == true) {
		// We've got a replacement
		CropControl.getPlugin().debug("Ghost object? Placement is overtop a tracked object at {0}, {1}, {2}", x, y, z);
		handleRemoval(block, chunk);
	}
	if (harvestableCrops.containsKey(blockMaterial)) {
		// we placed a block overtop an existing crop. Will be handled by a break event?
		/*Crop crop = chunk.getCrop(x, y, z);
		if (crop != null) {
			crop.setRemoved();
			CropControl.getPlugin().debug("Missed an event? Replacing a Crop at {0}, {1}, {2}", x, y, z);
			//return;
		}*/
		
		// We've placed a crop!
		Crop.create(chunk, x, y, z, blockMaterial.toString(), getBaseCropState(blockMaterial),
				e.getPlayer().getUniqueId(), System.currentTimeMillis(), harvestableCrops.get(blockMaterial));
	} else if (blockMaterial == Material.SAPLING) {
		// we placed a block overtop an existing sapling. TODO: Do I need to remove sapling here, or will there be a break event?
		/*Sapling sapling = chunk.getSapling(x, y, z);
		if (sapling != null) {
			sapling.setRemoved();
			CropControl.getPlugin().debug("Missed an event? Replacing a Sapling at {0}, {1}, {2}", x, y, z);
			//return;
		}*/
		// We've placed a sapling!
		Sapling.create(chunk, x, y, z, getSaplingType(block.getData()),
				e.getPlayer().getUniqueId(), System.currentTimeMillis(), false);
	} else if (blockMaterial == Material.CHORUS_FLOWER) {
		/*if (CropControl.getDAO().isTracked(block) == true) {
			CropControl.getPlugin().debug("Ghost object? Placement is overtop a tracked object at {0}, {1}, {2}", x, y, z);
			//return;
		}*/
		
		// TODO: Check if connected to an existing chorus tree.

		// First register the "tree"
		Tree chorusPlant = Tree.create(chunk, x, y, z, Material.CHORUS_PLANT.toString(),
				e.getPlayer().getUniqueId(), System.currentTimeMillis());

		// Then the component in the tree.
		TreeComponent.create(chorusPlant, chunk, x, y, z, Material.CHORUS_PLANT.toString(),
				e.getPlayer().getUniqueId(), false);
	} else if (blockMaterial.isSolid()){ // check for cactus.
		for (BlockFace face : CropControlEventHandler.directions) {
			Block adj = block.getRelative(face);
			if (Material.CACTUS.equals(adj.getType())) {
				Location loc = adj.getLocation();
				if (!pendingChecks.contains(loc)) {
					pendingChecks.add(loc);
					handleBreak(adj, BreakType.PLAYER, e.getPlayer().getUniqueId(), null);
				}		
			}
		}
	}
}
 
开发者ID:DevotedMC,项目名称:CropControl,代码行数:66,代码来源:CropControlEventHandler.java

示例14: onChat

@EventHandler(priority = EventPriority.HIGHEST)
public void onChat(AsyncPlayerChatEvent e) {
    PAUser u = PAAntium.getUser(e.getPlayer());

    if (!plugin.getPassManager().getLogged().contains(u)) e.setCancelled(true);
}
 
开发者ID:cadox8,项目名称:PA,代码行数:6,代码来源:PlayerEvents.java

示例15: onPlayerFood

@EventHandler(priority = EventPriority.HIGHEST)
public void onPlayerFood(FoodLevelChangeEvent event)
{
    event.setCancelled(true);
}
 
开发者ID:SamaGames,项目名称:Hub,代码行数:5,代码来源:EntityEditionListener.java


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