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


Java Material.WATCH属性代码示例

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


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

示例1: onPlayerSpeak

@EventHandler
public void onPlayerSpeak(AsyncPlayerChatEvent e) {
  if (e.getPlayer().getInventory().getItemInMainHand().getType() != Material.WATCH)
    return;
  
  e.setCancelled(true);
  playerSpeaksOnCellPhone(e.getPlayer(), e.getMessage());
}
 
开发者ID:kadeska,项目名称:MT_Communication,代码行数:8,代码来源:CellularPhoneListener.java

示例2: onCellPhoneInteract

@EventHandler
public void onCellPhoneInteract(PlayerInteractEvent e) {
  Player p = e.getPlayer();
  
  if (p.getInventory().getItemInMainHand().getType() != Material.WATCH)
    return;
  
  e.setCancelled(true);
  
  CellularPhone phone = new CellularPhone(main);
  
  // Left click for recipient toggle
  if (e.getAction() == Action.LEFT_CLICK_AIR || e.getAction() == Action.LEFT_CLICK_BLOCK) {
    if (p.isSneaking()) {
      phone.getNextContact(p);
      
    } else {
      phone.getPreviousContact(p);
      
    }
  }
  
  // Right click for text messages
  if (e.getAction() == Action.RIGHT_CLICK_AIR || e.getAction() == Action.RIGHT_CLICK_BLOCK) {
    if (p.isSneaking()) {
      phone.checkTextMessages(p);
      
    } else {
      phone.deleteTextMessage(p);
      
    }
  }
  
}
 
开发者ID:kadeska,项目名称:MT_Communication,代码行数:34,代码来源:CellularPhoneListener.java

示例3: i_MedicKit

private ItemStack i_MedicKit()
{
	ItemStack i_medicKit = new ItemStack(Material.WATCH, 1);
     	//ItemMeta medicKitMeta= i_medicKit.getItemMeta();
     	//medicKitMeta.setDisplayName(ChatColor.RESET + Survival.Words.get("Medical Kit"));
     	//i_medicKit.setItemMeta(medicKitMeta);
     	
     	return i_medicKit;
}
 
开发者ID:FattyMieo,项目名称:SurvivalPlus,代码行数:9,代码来源:MedicKit.java

示例4: onChatEvent

@EventHandler
private void onChatEvent(AsyncPlayerChatEvent e) {
 // Watch is the temporary cell phone
 if (e.getPlayer().getInventory().getItemInMainHand().getType() == Material.WATCH)
  return;
 // Walkie Talkie
 if (e.getPlayer().getInventory().getItemInMainHand().getType() == Material.REDSTONE_COMPARATOR)
  return;
 
 e.setCancelled(true);

  String message = e.getMessage();
  Player sender = e.getPlayer();
  String format = ("&b" + sender.getName() + "&8&l >> &r");

  for (Player recipient : e.getRecipients()) {
  	
    // Check if players are in the same world.
    if (!sender.getWorld().equals(recipient.getWorld()))
      continue;
    
    // Sender counts as recipient so send him his unscrambled message.
    if (sender.equals(recipient)) {
      recipient.sendMessage(StringUtilities.color(format + message));
      continue;
    }
    
    // If message sent by admin/op don#t scramble
    if (sender.hasPermission("mtcom.unscrambled")) {
  	  recipient.sendMessage(StringUtilities.color(format + message));
        continue;
    }
    
    String scrambled = main.getMessageScrambler().scramble(message, sender, recipient);
    // 'Scrambled' will be null if the distance is > 100 (send no message to recipient).
    if (scrambled == null)
      continue;

    String scrambledMessage = StringUtilities.color(format + scrambled);
    recipient.sendMessage(scrambledMessage);
  }
}
 
开发者ID:kadeska,项目名称:MT_Communication,代码行数:42,代码来源:PlayerChatListener.java

示例5: onSelfClick

@SuppressWarnings("deprecation")
@EventHandler
public void onSelfClick(PlayerInteractEvent event)
{
	if(event.hasItem() && (event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK))
	{
		final Player player = event.getPlayer();
		ItemStack mainItem = player.getInventory().getItemInMainHand();
		if(mainItem != null && mainItem.getType() == Material.WATCH)
		{
			if(healing.getScore(player).getScore() <= 0)
			{
				if(player.isSneaking())
				{
					healing.getScore(player).setScore(1);
					player.sendMessage(Survival.Words.get("�aHealing �ryourself") + Survival.Words.get("�a, keep ") + ChatColor.DARK_GREEN + Survival.Words.get("Medical Kit") + Survival.Words.get("�a on hand"));
					
					healTimes.getScore(player).setScore(5);
					final Runnable task = new Runnable()
					{
						public void run()
						{
							int times = healTimes.getScore(player).getScore();
							if(player.getInventory().getItemInMainHand().getType() == Material.WATCH && healing.getScore(player).getScore() > 0)
							{
								if(times-- > 0)
								{													
									Random rand = new Random();
									
									player.removePotionEffect(PotionEffectType.SLOW);
			                        player.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, 20, 6, true, false));
			                        player.removePotionEffect(PotionEffectType.JUMP);
			                        player.addPotionEffect(new PotionEffect(PotionEffectType.JUMP, 20, 199, true, false));
			                        
			                        player.getWorld().playSound(player.getLocation(), Sound.ENTITY_LEASHKNOT_PLACE, 1.0F, rand.nextFloat() * 0.4F + 0.8F);
									player.addPotionEffect(new PotionEffect(PotionEffectType.HEAL, 1, 0));
									
									Location particleLoc = player.getLocation();
			                        particleLoc.setY(particleLoc.getY() + 1);
			                        ParticleEffect.VILLAGER_HAPPY.display(0.5f, 0.5f, 0.5f, 0, 10, particleLoc, 64);

									Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Survival.instance, this, 20L);
									healTimes.getScore(player).setScore(times);
								}

								else
								{
									healing.getScore(player).setScore(0);
									
									player.sendMessage(ChatColor.DARK_GREEN + Survival.Words.get("Healing complete"));
									
									player.getInventory().removeItem(i_MedicKit());
								}
							}
							else
							{
								healing.getScore(player).setScore(0);
								
								player.sendMessage(ChatColor.DARK_RED + Survival.Words.get("Healing interrupted"));
								
								player.getInventory().removeItem(i_MedicKit());
							}
						}
					};
					
					Bukkit.getServer().getScheduler().scheduleSyncDelayedTask(Survival.instance, task, -1L);
				}
			}
		}
	}
}
 
开发者ID:FattyMieo,项目名称:SurvivalPlus,代码行数:71,代码来源:MedicKit.java


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