本文整理汇总了Java中org.bukkit.event.player.PlayerInteractAtEntityEvent.getPlayer方法的典型用法代码示例。如果您正苦于以下问题:Java PlayerInteractAtEntityEvent.getPlayer方法的具体用法?Java PlayerInteractAtEntityEvent.getPlayer怎么用?Java PlayerInteractAtEntityEvent.getPlayer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.event.player.PlayerInteractAtEntityEvent
的用法示例。
在下文中一共展示了PlayerInteractAtEntityEvent.getPlayer方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: EntityClick
import org.bukkit.event.player.PlayerInteractAtEntityEvent; //导入方法依赖的package包/类
@EventHandler
public void EntityClick(PlayerInteractAtEntityEvent e)
{
Player p = e.getPlayer();
if(e.getRightClicked() instanceof ArmorStand){
ArmorStand clickedA = (ArmorStand) e.getRightClicked();
if(clickedA.getPassenger() == null){
for(Rollercoaster att : Main.r.Attracties.values()){
if(att.getSeats().contains(clickedA)){
if(att.allowSit != false){
e.setCancelled(true);
p.teleport(clickedA);
clickedA.setPassenger(p);
att.addPassagier(p, clickedA);
}
return;
}
}
}
}
}
示例2: EntityClick
import org.bukkit.event.player.PlayerInteractAtEntityEvent; //导入方法依赖的package包/类
@EventHandler
public void EntityClick(PlayerInteractAtEntityEvent e)
{
Player p = e.getPlayer();
if(e.getRightClicked() instanceof ArmorStand){
ArmorStand clickedA = (ArmorStand) e.getRightClicked();
if(clickedA.getPassenger() == null){
for(attractie att : Main.r.Attracties.values()){
if(att.getSeats().contains(clickedA)){
if(att.allowSit == true){
e.setCancelled(true);
p.teleport(clickedA);
clickedA.setPassenger(p);
att.addPassagier(p, clickedA);
}
return;
}
}
}
}
}
示例3: onPlayerInteractAtEntity
import org.bukkit.event.player.PlayerInteractAtEntityEvent; //导入方法依赖的package包/类
@EventHandler
public void onPlayerInteractAtEntity(PlayerInteractAtEntityEvent event) {
Player player = event.getPlayer();
Entity entity = event.getRightClicked();
if (entity.getCustomName() != null && entity.getCustomName().toLowerCase().contains("join deathswap")) {
if (GameState.isGameState(GameState.LOBBY)) {
if (DeathSwap.getInstance().isInQueue(player)) {
player.sendMessage(ChatUtil.formatWithPrefix("You're already in the DeathSwap queue!"));
return;
}
player.sendMessage(ChatUtil.formatWithPrefix("You're in the DeathSwap queue."));
DeathSwap.getInstance().joinQueue(player);
player.closeInventory();
event.setCancelled(true);
}
}
}
示例4: onPlayerInteractAtEntity
import org.bukkit.event.player.PlayerInteractAtEntityEvent; //导入方法依赖的package包/类
@EventHandler
public void onPlayerInteractAtEntity(final PlayerInteractAtEntityEvent event) { // TEST
try {
if (event.getPlayer() == null || event.getRightClicked() == null) { return; }
if (!this.entityHandlers.isEmpty() && !event.isCancelled()) {
final Menu menu = new Menu("Kontextmen�: " + event.getRightClicked().getType());
for (final BiConsumer<PlayerInteractEntityEvent, Menu> consumer : this.entityHandlers) {
try { consumer.accept(event, menu); }
catch (final Exception e) { CraftoMessenger.report(this.getClass(), "A playerinteractATentityevent consumer ("+consumer+") got an exception!", e); }
}
if (!menu.isEmpty()) {
menu.show(event.getPlayer());
event.setCancelled(true);
event.getPlayer().playSound(event.getPlayer().getLocation(), Sound.BLOCK_WOODEN_DOOR_OPEN, 1.0f, 2.0f);
}
}
}
catch (Exception outsideException) { CraftoMessenger.report(getClass(), "Failed to handle PlayerInteractEntityEvent!", outsideException); }
}
示例5: EntityClick
import org.bukkit.event.player.PlayerInteractAtEntityEvent; //导入方法依赖的package包/类
@EventHandler
public void EntityClick(PlayerInteractAtEntityEvent e)
{
Player p = e.getPlayer();
if(e.getRightClicked() instanceof ArmorStand){
ArmorStand clickedA = (ArmorStand) e.getRightClicked();
if(clickedA.getPassenger() == null){
for(attractie att : Main.r.Attracties.values()){
for(ArmorStand a : att.getSeats())
{
if(a.getLocation().getX() == clickedA.getLocation().getX() &&
a.getLocation().getY() == clickedA.getLocation().getY() &&
a.getLocation().getZ() == clickedA.getLocation().getZ())
{
if(att.allowSit == true){
e.setCancelled(true);
p.teleport(clickedA);
clickedA.setPassenger(p);
att.addPassagier(p, clickedA);
}
return;
}
}
}
}
}
}
示例6: onAttemptInteractAS
import org.bukkit.event.player.PlayerInteractAtEntityEvent; //导入方法依赖的package包/类
@EventHandler
public void onAttemptInteractAS(PlayerInteractAtEntityEvent e) {
if (e.isCancelled()) {
return;
}
Entity ent = e.getRightClicked();
Location l = ent.getLocation();
Region r = RedProtect.get().rm.getTopRegion(l);
Player p = e.getPlayer();
if (r == null){
//global flags
if (ent instanceof ArmorStand) {
if (!RPConfig.getGlobalFlagBool(l.getWorld().getName()+".build")) {
e.setCancelled(true);
return;
}
}
return;
}
if (ent instanceof ArmorStand) {
if (r != null && !r.canBuild(p)) {
RPLang.sendMessage(p, "playerlistener.region.cantedit");
e.setCancelled(true);
}
}
}
示例7: onPlayerInteractAtEntity
import org.bukkit.event.player.PlayerInteractAtEntityEvent; //导入方法依赖的package包/类
@EventHandler
public void onPlayerInteractAtEntity(PlayerInteractAtEntityEvent e) {
if (!plugin.getShopChestConfig().enable_hologram_interaction) return;
Entity entity = e.getRightClicked();
Player p = e.getPlayer();
if (config.enable_authme_integration && plugin.hasAuthMe() && !AuthMe.getApi().isAuthenticated(p)) return;
if (Utils.getMajorVersion() == 8 || e.getHand() == EquipmentSlot.HAND) {
if (entity instanceof ArmorStand) {
ArmorStand armorStand = (ArmorStand) entity;
if (Hologram.isPartOfHologram(armorStand)) {
Hologram hologram = Hologram.getHologram(armorStand);
if (hologram != null) {
Block b = null;
for (Shop shop : plugin.getShopUtils().getShops()) {
if (shop.getHologram() != null && shop.getHologram().equals(hologram)) {
b = shop.getLocation().getBlock();
}
}
if (b != null) {
PlayerInteractEvent interactEvent = new PlayerInteractEvent(p, Action.RIGHT_CLICK_BLOCK, Utils.getPreferredItemInHand(p), b, null);
handleInteractEvent(interactEvent);
}
}
}
}
}
}
示例8: onPlayerInteractAtEntity
import org.bukkit.event.player.PlayerInteractAtEntityEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true)
public void onPlayerInteractAtEntity(PlayerInteractAtEntityEvent event) {
IDummyLand land;
EntityType et = event.getRightClicked().getType();
Player player = event.getPlayer();
Material mat = player.getItemInHand().getType();
PlayerConfEntry entry;
Location loc = event.getRightClicked().getLocation();
Factoid.getThisPlugin().iLog().write(
"PlayerInteractAtEntity player name: " + event.getPlayer().getName()
+ ", Entity: " + et.name());
// Citizen bug, check if entry exist before
if ((entry = playerConf.get(player)) != null
&& !entry.isAdminMod()) {
land = Factoid.getThisPlugin().iLands().getLandOrOutsideArea(loc);
// Remove and add an item from an armor stand
if(BKVersion.isArmorStand(et)) {
if (((!checkPermission(land, event.getPlayer(), PermissionList.BUILD.getPermissionType())
|| !checkPermission(land, event.getPlayer(), PermissionList.BUILD_DESTROY.getPermissionType()))
&& mat == Material.AIR)
|| ((!checkPermission(land, event.getPlayer(), PermissionList.BUILD.getPermissionType())
|| !checkPermission(land, event.getPlayer(), PermissionList.BUILD_PLACE.getPermissionType()))
&& mat != Material.AIR)) {
messagePermission(player);
event.setCancelled(true);
}
}
}
}
示例9: playerInteractAtEntity
import org.bukkit.event.player.PlayerInteractAtEntityEvent; //导入方法依赖的package包/类
@EventHandler
private void playerInteractAtEntity(PlayerInteractAtEntityEvent event) {
Player player = event.getPlayer();
ItemStack item = player.getInventory().getItemInMainHand();
CustomItem customItem = CustomItemManager.getCustomItem(item);
if (customItem != null) {
if (verifyCustomItem(customItem, event.getPlayer(), false)) {
event.setCancelled(true);
customItem.onInteractAtEntity(event, new PlayerDetails(item, event.getPlayer()));
}
}
}
示例10: onInteractEntity
import org.bukkit.event.player.PlayerInteractAtEntityEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGH)
public void onInteractEntity(PlayerInteractAtEntityEvent event) {
if (event.getRightClicked() == null) {
return;
}
Entity entity = event.getRightClicked();
Player player = event.getPlayer();
if (!player.hasMetadata("bw-addteamjoin")) {
if (!(entity instanceof LivingEntity)) {
return;
}
LivingEntity livEntity = (LivingEntity) entity;
Game game = BedwarsRel.getInstance().getGameManager().getGameOfPlayer(player);
if (game == null) {
return;
}
if (game.getState() != GameState.WAITING) {
return;
}
Team team = game.getTeam(ChatColor.stripColor(livEntity.getCustomName()));
if (team == null) {
return;
}
game.playerJoinTeam(player, team);
event.setCancelled(true);
return;
}
List<MetadataValue> values = player.getMetadata("bw-addteamjoin");
if (values == null || values.size() == 0) {
return;
}
event.setCancelled(true);
TeamJoinMetaDataValue value = (TeamJoinMetaDataValue) values.get(0);
if (!((boolean) value.value())) {
return;
}
if (!(entity instanceof LivingEntity)) {
player.sendMessage(
ChatWriter.pluginMessage(ChatColor.RED + BedwarsRel
._l(player, "errors.entitynotcompatible")));
return;
}
LivingEntity living = (LivingEntity) entity;
living.setRemoveWhenFarAway(false);
living.setCanPickupItems(false);
living.setCustomName(value.getTeam().getChatColor() + value.getTeam().getDisplayName());
living.setCustomNameVisible(
BedwarsRel.getInstance().getBooleanConfig("jointeam-entity.show-name", true));
if (living.getType().equals(EntityType.valueOf("ARMOR_STAND"))) {
Utils.equipArmorStand(living, value.getTeam());
}
player.removeMetadata("bw-addteamjoin", BedwarsRel.getInstance());
player.sendMessage(ChatWriter
.pluginMessage(
ChatColor.GREEN + BedwarsRel._l(player, "success.teamjoinadded", ImmutableMap.of("team",
value.getTeam().getChatColor() + value.getTeam().getDisplayName()
+ ChatColor.GREEN))));
}
示例11: onArmorStandClick
import org.bukkit.event.player.PlayerInteractAtEntityEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true)
public void onArmorStandClick(PlayerInteractAtEntityEvent event) {
if (event.getRightClicked() instanceof ArmorStand) {
PlayerInteractEntityEvent pie = new PlayerInteractEntityEvent(event.getPlayer(), event.getRightClicked());
plugin.getServer().getPluginManager().callEvent(pie);
if (pie.isCancelled()) {
return;
}
ArmorStand armorStand = (ArmorStand) event.getRightClicked();
if (plugin.hasWaitingAction(event.getPlayer())) {
event.setCancelled(true);
plugin.calculateAction(event.getPlayer(), armorStand, plugin.getWaitingAction(event.getPlayer()));
plugin.removeWaitingAction(event.getPlayer());
return;
}
if (plugin.getPersistentAction(event.getPlayer()) != null) {
event.setCancelled(true);
plugin.calculateAction(event.getPlayer(), armorStand, plugin.getPersistentAction(event.getPlayer()));
return;
}
if (event.getPlayer().getItemInHand().getType() == Material.NAME_TAG) {
ItemStack hi = event.getPlayer().getItemInHand();
if (hi.hasItemMeta() && hi.getItemMeta().hasDisplayName()) {
if (event.getPlayer().hasPermission("editarmorstands.nametag.name")) {
event.setCancelled(true);
String name = hi.getItemMeta().getDisplayName();
if (event.getPlayer().hasPermission("editarmorstands.nametag.name.colored")) {
name = ChatColor.translateAlternateColorCodes('&', name);
} else {
name = ChatColor.ITALIC + name;
}
armorStand.setCustomName(name + ChatColor.RESET);
armorStand.setCustomNameVisible(true);
if (event.getPlayer().getGameMode() != GameMode.CREATIVE) {
if (hi.getAmount() > 1) {
hi.setAmount(hi.getAmount() - 1);
} else {
event.getPlayer().setItemInHand(new ItemStack(Material.AIR));
}
event.getPlayer().updateInventory();
}
return;
}
} else if (event.getPlayer().hasPermission("editarmorstands.nametag.name.clear")) {
event.setCancelled(true);
armorStand.setCustomName("");
armorStand.setCustomNameVisible(false);
return;
}
} else if (!event.getPlayer().isSneaking() && event.getPlayer().hasPermission("editarmorstands.openinventory")) {
event.setCancelled(true);
ArmorStandGui gui = new ArmorStandGui(plugin, armorStand, event.getPlayer());
gui.show();
}
}
}