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


Java Player.setSneaking方法代码示例

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


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

示例1: reset

import org.bukkit.entity.Player; //导入方法依赖的package包/类
public void reset() {
    final Player bukkit = getBukkit();
    bukkit.closeInventory();
    clearInventory();
    bukkit.setExhaustion(0);
    bukkit.setFallDistance(0);
    bukkit.setFireTicks(0);
    bukkit.setFoodLevel(20); // full
    bukkit.setMaxHealth(20);
    bukkit.setHealth(bukkit.getMaxHealth());
    bukkit.setAbsorption(0);
    bukkit.setLevel(0);
    bukkit.setExp(0); // clear xp
    bukkit.setSaturation(5); // default
    bukkit.setFastNaturalRegeneration(false);
    bukkit.setSlowNaturalRegeneration(true);
    bukkit.setAllowFlight(false);
    bukkit.setFlying(false);
    bukkit.setSneaking(false);
    bukkit.setSprinting(false);
    bukkit.setFlySpeed(0.1f);
    bukkit.setKnockbackReduction(0);
    bukkit.setWalkSpeed(WalkSpeedKit.BUKKIT_DEFAULT);
    AttributeUtils.removeAllModifiers(bukkit);
    resetPotions();

    // we only reset bed spawn here so people don't have to see annoying messages when they respawn
    bukkit.setBedSpawnLocation(null);

    match.callEvent(new PlayerResetEvent(this));
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:32,代码来源:MatchPlayer.java

示例2: reset

import org.bukkit.entity.Player; //导入方法依赖的package包/类
public static void reset(Player player, boolean heal) {
    if (heal) player.setHealth(player.getAttribute(Attribute.GENERIC_MAX_HEALTH).getValue());
    player.setFoodLevel(20);
    player.setSaturation(20);
    player.getInventory().clear();
    player.getInventory().setArmorContents(new ItemStack[]{new ItemStack(Material.AIR), new ItemStack(Material.AIR), new ItemStack(Material.AIR), new ItemStack(Material.AIR)});
    player.setItemOnCursor(new ItemStack(Material.AIR));

    player.getActivePotionEffects().forEach(potionEffect -> {
        try {
            player.removePotionEffect(potionEffect.getType());
        } catch (NullPointerException ignored) {}
    });

    player.setFireTicks(0);
    player.setFallDistance(0);
    player.setTotalExperience(0);
    player.setExp(0);
    player.setLevel(0);
    player.setWalkSpeed(0.2F);
    player.setFlySpeed(0.1F);

    player.setSneaking(false);
    player.setInvulnerable(false);
    player.setCanPickupItems(true);
    player.setCollidable(true);
    player.setFlying(false);
    player.setAllowFlight(false);

    player.resetTitle();

    for (Attribute attribute : Attribute.values()) {
        if (player.getAttribute(attribute) == null) continue;
        for (AttributeModifier modifier : player.getAttribute(attribute).getModifiers()) {
            player.getAttribute(attribute).removeModifier(modifier);
        }
    }
    player.getAttribute(Attribute.GENERIC_ATTACK_SPEED).addModifier(new AttributeModifier(UUID.randomUUID(), "generic.attackSpeed", 24.000D, AttributeModifier.Operation.ADD_SCALAR));

    player.updateInventory();
}
 
开发者ID:WarzoneMC,项目名称:Warzone,代码行数:42,代码来源:Players.java

示例3: run

import org.bukkit.entity.Player; //导入方法依赖的package包/类
@Override
public void run() {
	Set<UUID> players=rs.getPlayerDatas().keySet();
	for(UUID ps:players){
		Player p = rs.getServer().getPlayer(ps);
		if(p==null||p.isDead())continue;
		if ((p.hasPermission("RealSurvival.unlimited")||p.hasPermission("RealSurvival.Admin"))&&!TestCMD.contains(p)) 
	    	  continue;
	      PlayerData pd=rs.getPlayerData(p);
	      if(p.isSneaking())
	    	  if(pd.getPhysical_strength()<rs.getSneaking())
	    		  p.setSneaking(false);
	    	  else{
	    		  pd.changePS(-rs.getSneaking());
	    		  continue;
	    	  }
	      else if(p.isSprinting())
	    	  if(pd.getPhysical_strength()<rs.getSprinting())
	    		  p.setSprinting(false);
	    	  else{
	    		  pd.changePS(-rs.getSprinting());
	    		  continue;
	    	  }
	      else
	    	  pd.changePS(rs.getPhysical_strength_add());
	    }
}
 
开发者ID:SchoolUniform,项目名称:RealSurvival,代码行数:28,代码来源:PhysicalStrengthTask.java

示例4: onSit

import org.bukkit.entity.Player; //导入方法依赖的package包/类
@EventHandler
public void onSit(PlayerInteractEvent e){
    Player p = e.getPlayer();
    Block b;

    if (e.getItem() == null){
        if (e.getAction() == Action.RIGHT_CLICK_BLOCK){
            if(p.getInventory().getItemInMainHand() != null) return;
            b = e.getClickedBlock();
            if (isStairs(b.getType())) {
                if(!p.isSneaking() && p.getVehicle() != null) {
                    p.getVehicle().remove();
                    return;
                }
                p.setSneaking(false);

                Location l = b.getLocation().add(0.5, -1.3, 0.3);

                switch (b.getState().getData().toItemStack().getDurability()){
                    case 0: //west
                        l.setYaw(90f);
                        l.setZ(l.getZ() + 0.2);
                        break;
                    case 1: //east
                        l.setYaw(-90f);
                        l.setZ(l.getZ() + 0.2);
                        break;
                    case 2: //north
                        l.setYaw(-180f);
                        break;
                    case 3: //south
                        l.setYaw(0);
                        l.setZ(l.getZ() + 0.2);
                        break;
                }

                if (b.getState().getData().toItemStack().getDurability() >= 4) return;

                ArmorStand as = (ArmorStand) p.getWorld().spawnEntity(l, EntityType.ARMOR_STAND);
                as.teleport(l);
                as.setVisible(false);
                as.setGravity(false);
                as.setMaxHealth(1);
                as.setHealth(1);
                as.setCustomName("wcc_silla");
                as.setCustomNameVisible(false);
                as.setPassenger(p);

                e.setCancelled(true);

                if (new Random().nextInt(10) + 1 >= 9) p.sendMessage(magic());
            }
        }
    }
}
 
开发者ID:cadox8,项目名称:WC,代码行数:56,代码来源:Sit.java


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