本文整理汇总了Java中org.bukkit.entity.Player.isSneaking方法的典型用法代码示例。如果您正苦于以下问题:Java Player.isSneaking方法的具体用法?Java Player.isSneaking怎么用?Java Player.isSneaking使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.entity.Player
的用法示例。
在下文中一共展示了Player.isSneaking方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: call
import org.bukkit.entity.Player; //导入方法依赖的package包/类
@Override
public void call(Event event) {
final Player player = profile.getPlayer();
if (event instanceof PlayerMoveEvent) {
if ((player.isSprinting() || player.isBlocking() || player.isConversing()) && player.isSneaking()) {
callback(true);
return;
}
callback(false);
} else if (event instanceof AsyncPlayerChatEvent) {
if ((player.isBlocking() || player.isSprinting() || player.isSneaking())) {
callback(true);
return;
}
callback(false);
}
}
示例2: run
import org.bukkit.entity.Player; //导入方法依赖的package包/类
public void run()
{
if(Bukkit.getPlayer(uuid) == null)
Bukkit.getScheduler().cancelTask(id);
else
if(Bukkit.getPlayer(uuid).isDead())
Bukkit.getScheduler().cancelTask(id);
else
if(!Bukkit.getPlayer(uuid).isSneaking())
{
Bukkit.getScheduler().cancelTask(id);
} else
{
Player p = Bukkit.getPlayer(uuid);
Vector vector = new Vector(0, 1, 0);
vector.multiply(-0.10000000000000001D);
p.setVelocity(vector);
p.setFallDistance(0.0F);
if(!p.isSneaking())
Bukkit.getScheduler().cancelTask(id);
}
}
示例3: downElevator
import org.bukkit.entity.Player; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGH)
public void downElevator(PlayerToggleSneakEvent e) {
Player p = e.getPlayer();
Block b = p.getLocation().getBlock().getRelative(BlockFace.DOWN);
if (p.hasPermission("ironelevators.use") && !p.isSneaking()
&& b.getType() == elevatorMaterial) {
b = b.getRelative(BlockFace.DOWN, minElevation);
int i = maxElevation; //16
while (i > 0 && !(
b.getType() == elevatorMaterial
&& b.getRelative(BlockFace.UP).getType().isTransparent()
&& b.getRelative(BlockFace.UP, 2).getType().isTransparent()
)
) {
//e.getPlayer().sendMessage("" + b.getLocation() + b.getType());
i--;
b = b.getRelative(BlockFace.DOWN);
}
if (i > 0) {
Location l = p.getLocation();
l.setY(l.getY() - maxElevation - 3 + i);
p.teleport(l);
p.getWorld().playSound(p.getLocation(), Sound.ENTITY_IRONGOLEM_ATTACK, 1, 1);
}
}
}
示例4: Stomper
import org.bukkit.entity.Player; //导入方法依赖的package包/类
@EventHandler
public void Stomper(EntityDamageEvent e) {
if (e.getEntity() instanceof Player) {
Player p = (Player) e.getEntity();
if (Kit.getKit(p).getName().equalsIgnoreCase("stomper")) {
if (e.getCause() == DamageCause.FALL) {
List<Entity> nearbyEntities = e.getEntity()
.getNearbyEntities(5, 5, 5);
for (Entity target : nearbyEntities) {
if (target instanceof Player) {
Player t = (Player) target;
if (Team.getTeam(p) == Team.getTeam(t))
continue;
if (t.isSneaking())
t.damage(e.getDamage() / 2, e.getEntity());
else
t.damage(e.getDamage(), e.getEntity());
}
}
e.setDamage(0);
}
}
}
}
示例5: downElevator
import org.bukkit.entity.Player; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGH)
public void downElevator(PlayerToggleSneakEvent e) {
Player p = e.getPlayer();
Block b = p.getLocation().getBlock().getRelative(BlockFace.DOWN);
if (!p.isSneaking() && b.getType() == elevatorMaterial) {
b = b.getRelative(BlockFace.DOWN, minElevation);
int i = maxElevation; //16
while (i > 0 && !(b.getType() == elevatorMaterial && b.getRelative(BlockFace.UP).getType().isTransparent() && b.getRelative(BlockFace.UP, 2).getType().isTransparent())) {
i--;
b = b.getRelative(BlockFace.DOWN);
}
if (i > 0) {
Location l = p.getLocation();
l.setY(l.getY() - maxElevation - 2 + i);
p.teleport(l);
p.getWorld().playSound(p.getLocation(), Sound.ENTITY_IRONGOLEM_ATTACK, 1, 1);
}
}
}
示例6: call
import org.bukkit.entity.Player; //导入方法依赖的package包/类
@Override
public void call(Event event) {
if (event instanceof InventoryClickEvent) {
// The player has clicked.
final Player player = profile.getPlayer();
if (player.isSprinting() || player.isSneaking() || player.isBlocking() || player.isSleeping()
|| player.isConversing()) {
// The player has clicked in their inventory impossibly.
callback(true);
}
}
}
示例7: onCellPhoneInteract
import org.bukkit.entity.Player; //导入方法依赖的package包/类
@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);
}
}
}
示例8: convertClick
import org.bukkit.entity.Player; //导入方法依赖的package包/类
ClickType convertClick(ClickType clickType, Player player) {
if(clickType == ClickType.RIGHT && player.isSneaking()) {
return ClickType.SHIFT_RIGHT;
} else {
return clickType;
}
}
示例9: 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());
}
}
示例10: checkSneak
import org.bukkit.entity.Player; //导入方法依赖的package包/类
public void checkSneak(Player player, double x, double z) {
if(player.isSneaking() && !player.isFlying() && !isMovingExempt(player) && !player.isInsideVehicle()) {
double i = x > MagicNumbers.XZ_SPEED_MAX_SNEAK ? x : z > MagicNumbers.XZ_SPEED_MAX_SNEAK ? z : -1.0;
if(i != -1.0) {
for(Player pla : DynamicAC.instance.onlinestaff) {
pla.sendMessage(DynamicAC.prefix + player.getName() + " failed Sneak Speed! (also a good " +
"indicator of Flight)");
}
DACManager.getUserManager().incrementUser(DACManager.getUserManager().getUser(player.getName()),
"Sneak Speed");
}
}
}
示例11: debug
import org.bukkit.entity.Player; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
@EventHandler
public void debug(PlayerInteractEvent e) {
if (e.getAction().equals(Action.PHYSICAL) || !e.getHand().equals(EquipmentSlot.HAND)) return;
Player p = e.getPlayer();
if (SlimefunManager.isItemSimiliar(e.getPlayer().getInventory().getItemInMainHand(), SlimefunItems.DEBUG_FISH, true) || SlimefunManager.isItemSimiliar(e.getPlayer().getInventory().getItemInOffHand(), SlimefunItems.DEBUG_FISH, true)) {
e.setCancelled(true);
if (p.isOp()) {
switch (e.getAction()) {
case LEFT_CLICK_BLOCK: {
if (p.isSneaking()) {
if (BlockStorage.hasBlockInfo(e.getClickedBlock())) {
BlockStorage.clearBlockInfo(e.getClickedBlock());
}
}
else e.setCancelled(false);
break;
}
case RIGHT_CLICK_BLOCK: {
if (p.isSneaking()) {
Block b = e.getClickedBlock().getRelative(e.getBlockFace());
b.setType(Material.SKULL);
try {
CustomSkull.setSkull(b, "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZTllYjlkYTI2Y2YyZDMzNDEzOTdhN2Y0OTEzYmEzZDM3ZDFhZDEwZWFlMzBhYjI1ZmEzOWNlYjg0YmMifX19");
} catch (Exception e1) {
e1.printStackTrace();
}
}
else if (BlockStorage.hasBlockInfo(e.getClickedBlock())) {
p.sendMessage(" ");
p.sendMessage(ChatColor.translateAlternateColorCodes('&', "&d" + e.getClickedBlock().getType() + ":" + e.getClickedBlock().getData() + " &[email protected] X: " + e.getClickedBlock().getX() + " Y: " + e.getClickedBlock().getY() + " Z: " + e.getClickedBlock().getZ()));
p.sendMessage(ChatColor.translateAlternateColorCodes('&', "&dID: " + "&e" + BlockStorage.checkID(e.getClickedBlock())));
if (e.getClickedBlock().getState() instanceof Skull) {
p.sendMessage(ChatColor.translateAlternateColorCodes('&', "&dSkull: " + "&2\u2714"));
p.sendMessage(ChatColor.translateAlternateColorCodes('&', " &dRotation: &e" + ((Skull) e.getClickedBlock().getState()).getRotation().toString()));
}
if (BlockStorage.getStorage(e.getClickedBlock().getWorld()).hasInventory(e.getClickedBlock().getLocation())) {
p.sendMessage(ChatColor.translateAlternateColorCodes('&', "&dInventory: " + "&2\u2714"));
}
else {
p.sendMessage(ChatColor.translateAlternateColorCodes('&', "&dInventory: " + "&4\u2718"));
}
if (BlockStorage.check(e.getClickedBlock()).isTicking()) {
p.sendMessage(ChatColor.translateAlternateColorCodes('&', "&dTicking: " + "&2\u2714"));
p.sendMessage(ChatColor.translateAlternateColorCodes('&', " &dAsync: &e" + (BlockStorage.check(e.getClickedBlock()).getTicker().isSynchronized() ? "&4\u2718": "&2\u2714")));
p.sendMessage(ChatColor.translateAlternateColorCodes('&', " &dTimings: &e" + SlimefunStartup.ticker.getTimings(e.getClickedBlock()) + "ms"));
p.sendMessage(ChatColor.translateAlternateColorCodes('&', " &dTotal Timings: &e" + SlimefunStartup.ticker.getTimings(BlockStorage.checkID(e.getClickedBlock())) + "ms"));
p.sendMessage(ChatColor.translateAlternateColorCodes('&', " &dChunk Timings: &e" + SlimefunStartup.ticker.getTimings(e.getClickedBlock().getChunk()) + "ms"));
}
else if (BlockStorage.check(e.getClickedBlock()).getEnergyTicker() != null) {
p.sendMessage(ChatColor.translateAlternateColorCodes('&', "&dTicking: " + "&b~ &3(Indirect)"));
p.sendMessage(ChatColor.translateAlternateColorCodes('&', " &dTimings: &e" + SlimefunStartup.ticker.getTimings(e.getClickedBlock()) + "ms"));
p.sendMessage(ChatColor.translateAlternateColorCodes('&', " &dChunk Timings: &e" + SlimefunStartup.ticker.getTimings(e.getClickedBlock().getChunk()) + "ms"));
}
else {
p.sendMessage(ChatColor.translateAlternateColorCodes('&', "&dTicking: " + "&4\u2718"));
p.sendMessage(ChatColor.translateAlternateColorCodes('&',"&dTicking: " + "&4\u2718"));
}
if (ChargableBlock.isChargable(e.getClickedBlock())) {
p.sendMessage(ChatColor.translateAlternateColorCodes('&', "&dChargable: " + "&2\u2714"));
p.sendMessage(ChatColor.translateAlternateColorCodes('&', " &dEnergy: &e" + ChargableBlock.getCharge(e.getClickedBlock()) + " / " + ChargableBlock.getMaxCharge(e.getClickedBlock())));
}
else {
p.sendMessage(ChatColor.translateAlternateColorCodes('&', "&dChargable: " + "&4\u2718"));
}
p.sendMessage(ChatColor.translateAlternateColorCodes('&', "&6" + BlockStorage.getBlockInfoAsJson(e.getClickedBlock())));
p.sendMessage(" ");
}
break;
}
default:
break;
}
}
}
}
示例12: canPlaceBlock
import org.bukkit.entity.Player; //导入方法依赖的package包/类
private boolean canPlaceBlock(Player p, Block relative) {
return p.isSneaking() && relative.getType().equals(Material.AIR);
}
示例13: 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());
}
}
}
}
示例14: onSelfClick
import org.bukkit.entity.Player; //导入方法依赖的package包/类
@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);
}
}
}
}
}
示例15: onPlayerDamaged
import org.bukkit.entity.Player; //导入方法依赖的package包/类
@EventHandler
public void onPlayerDamaged(final EntityDamageByEntityEvent event)
{
event.setCancelled(true);
if (event.getDamager() instanceof Player && event.getEntity() instanceof Player)
{
final Player player = (Player) event.getDamager();
if (this.hub.getCosmeticManager().getGadgetManager().hasGadget((Player) event.getDamager()))
{
AbstractDisplayer displayer = this.hub.getCosmeticManager().getGadgetManager().getPlayerGadget((Player) event.getDamager());
if (displayer.isInteractionsEnabled() && !SamaGamesAPI.get().getSettingsManager().getSettings(event.getEntity().getUniqueId()).isOtherPlayerInteraction())
{
if (this.hub.getPlayerManager().isBusy((Player) event.getEntity()))
event.getDamager().sendMessage(ChatColor.RED + "Ce joueur est actuellement occupé.");
else
event.getDamager().sendMessage(ChatColor.RED + "Ce joueur n'accepte pas les intéractions !");
return;
}
this.hub.getCosmeticManager().getGadgetManager().getPlayerGadget((Player) event.getDamager()).handleInteraction(event.getDamager(), event.getEntity());
return;
}
else if (this.hub.getCosmeticManager().getGadgetManager().hasGadget((Player) event.getEntity()))
{
this.hub.getCosmeticManager().getGadgetManager().getPlayerGadget((Player) event.getEntity()).handleInteraction(event.getDamager(), event.getEntity());
return;
}
if (player.isSneaking())
{
this.hub.getServer().getScheduler().runTaskAsynchronously(this.hub, () ->
{
Player target = (Player) event.getEntity();
if (SamaGamesAPI.get().getSettingsManager().getSettings(player.getUniqueId()).isAllowClickOnOther())
{
if (!SamaGamesAPI.get().getSettingsManager().getSettings(target.getUniqueId()).isClickOnMeActivation())
return;
this.hub.getGuiManager().openGui(player, new GuiClickMe(this.hub, target));
}
});
}
}
else if (event.getDamager() instanceof Player && !(event.getEntity() instanceof Player))
{
if (event.getEntity().hasMetadata("owner-id"))
{
UUID uuid = UUID.fromString(event.getEntity().getMetadata("owner-id").get(0).asString());
if (this.hub.getCosmeticManager().getGadgetManager().hasGadget(uuid))
this.hub.getCosmeticManager().getGadgetManager().getPlayerGadget(uuid).handleInteraction(event.getDamager(), event.getEntity());
}
}
}