本文整理汇总了Java中org.bukkit.event.player.PlayerInteractAtEntityEvent.getRightClicked方法的典型用法代码示例。如果您正苦于以下问题:Java PlayerInteractAtEntityEvent.getRightClicked方法的具体用法?Java PlayerInteractAtEntityEvent.getRightClicked怎么用?Java PlayerInteractAtEntityEvent.getRightClicked使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.event.player.PlayerInteractAtEntityEvent
的用法示例。
在下文中一共展示了PlayerInteractAtEntityEvent.getRightClicked方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
}
}
示例2: onPlayerInteract
import org.bukkit.event.player.PlayerInteractAtEntityEvent; //导入方法依赖的package包/类
/**
* Handle interaction with armor stands V1.8
* Note - some armor stand protection is done in IslandGuard.java, e.g. against projectiles.
*
* @param e
*/
@EventHandler(priority = EventPriority.LOW, ignoreCancelled=true)
public void onPlayerInteract(final PlayerInteractAtEntityEvent e) {
if (DEBUG) {
plugin.getLogger().info("1.8 " + e.getEventName());
}
if (!Util.inWorld(e.getPlayer())) {
return;
}
if (e.getRightClicked() != null && e.getRightClicked().getType().equals(EntityType.ARMOR_STAND)) {
if (actionAllowed(e.getPlayer(), e.getRightClicked().getLocation(), SettingsFlag.ARMOR_STAND)) {
return;
}
e.setCancelled(true);
Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
}
}
示例3: 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;
}
}
}
}
}
示例4: 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;
}
}
}
}
}
示例5: onPlayerInteract
import org.bukkit.event.player.PlayerInteractAtEntityEvent; //导入方法依赖的package包/类
/**
* Handle interaction with armor stands V1.8
* Note - some armor stand protection is done in IslandGuard.java, e.g. against projectiles.
*
* @param e
*/
@EventHandler(priority = EventPriority.LOW, ignoreCancelled=true)
public void onPlayerInteract(final PlayerInteractAtEntityEvent e) {
if (DEBUG) {
plugin.getLogger().info("1.8 " + e.getEventName());
}
if (!IslandGuard.inWorld(e.getPlayer())) {
return;
}
if (e.getRightClicked() != null && e.getRightClicked().getType().equals(EntityType.ARMOR_STAND)) {
if (actionAllowed(e.getPlayer(), e.getRightClicked().getLocation(), SettingsFlag.ARMOR_STAND)) {
return;
}
e.setCancelled(true);
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
}
}
示例6: 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); }
}
示例7: onHitEndCrystal
import org.bukkit.event.player.PlayerInteractAtEntityEvent; //导入方法依赖的package包/类
/**
* Handle interaction with end crystals 1.9
*
* @param e
*/
@EventHandler(priority = EventPriority.LOW, ignoreCancelled=true)
public void onHitEndCrystal(final PlayerInteractAtEntityEvent e) {
if (DEBUG) {
plugin.getLogger().info("1.9 " +e.getEventName());
}
if (!Util.inWorld(e.getPlayer())) {
return;
}
if (e.getPlayer().isOp()) {
return;
}
// This permission bypasses protection
if (VaultHelper.hasPerm(e.getPlayer(), Settings.PERMPREFIX + "mod.bypassprotect")) {
return;
}
if (e.getRightClicked() != null && e.getRightClicked().getType().equals(EntityType.ENDER_CRYSTAL)) {
// Check island
Island island = plugin.getIslands().getIslandAt(e.getRightClicked().getLocation());
if (island == null && Settings.defaultWorldSettings.get(SettingsFlag.BREAK_BLOCKS)) {
return;
}
if (island !=null) {
if (island.getMembers().contains(e.getPlayer().getUniqueId()) || island.getFlag(SettingsFlag.BREAK_BLOCKS)) {
return;
}
}
e.setCancelled(true);
Util.sendMessage(e.getPlayer(), plugin.getLocale(e.getPlayer().getUniqueId()).get("island.protected"));
}
}
示例8: 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;
}
}
}
}
}
}
示例9: 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);
}
}
}
示例10: onInteract
import org.bukkit.event.player.PlayerInteractAtEntityEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onInteract(final PlayerInteractAtEntityEvent e) {
Entity entity = e.getRightClicked();
if (!(entity instanceof ArmorStand)) {
return;
}
final Location l = BukkitUtil.getLocation(e.getRightClicked().getLocation());
String world = l.getWorld();
if (!PlotSquared.isPlotWorld(world)) {
return;
}
Plot plot = MainUtil.getPlot(l);
PlotPlayer pp = BukkitUtil.getPlayer(e.getPlayer());
if (plot == null) {
if (!MainUtil.isPlotArea(l)) {
return;
}
if (!Permissions.hasPermission(pp, "plots.admin.interact.road")) {
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.interact.road");
e.setCancelled(true);
}
}
else {
if (!plot.hasOwner()) {
if (!Permissions.hasPermission(pp, "plots.admin.interact.unowned")) {
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.interact.unowned");
e.setCancelled(true);
}
}
else {
final UUID uuid = pp.getUUID();
if (!plot.isAdded(uuid)) {
if (!Permissions.hasPermission(pp, "plots.admin.interact.other")) {
MainUtil.sendMessage(pp, C.NO_PERMISSION, "plots.admin.interact.other");
e.setCancelled(true);
}
}
}
}
}
示例11: onUseEntity
import org.bukkit.event.player.PlayerInteractAtEntityEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.LOW)
public void onUseEntity(UseEntityEvent event) {
if (plugin.getShopChestConfig().enable_worldguard_integration) {
Player player = event.getCause().getFirstPlayer();
if (player == null) return;
if (event.getOriginalEvent() instanceof PlayerInteractAtEntityEvent) {
PlayerInteractAtEntityEvent orig = (PlayerInteractAtEntityEvent) event.getOriginalEvent();
Entity e = orig.getRightClicked();
if (e.getType() == EntityType.ARMOR_STAND) {
if (!Hologram.isPartOfHologram((ArmorStand) e))
return;
for (Shop shop : plugin.getShopUtils().getShops()) {
if (shop.getHologram() != null && shop.getHologram().contains((ArmorStand) e)) {
if (isAllowed(player, shop.getLocation(), Action.RIGHT_CLICK_BLOCK)) {
event.setAllowed(true);
orig.setCancelled(false);
}
return;
}
}
}
}
}
}
示例12: 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);
}
}
}
}
}
}
示例13: onHitEndCrystal
import org.bukkit.event.player.PlayerInteractAtEntityEvent; //导入方法依赖的package包/类
/**
* Handle interaction with end crystals 1.9
*
* @param e
*/
@EventHandler(priority = EventPriority.LOW, ignoreCancelled=true)
public void onHitEndCrystal(final PlayerInteractAtEntityEvent e) {
if (DEBUG) {
plugin.getLogger().info("1.9 " +e.getEventName());
}
if (!IslandGuard.inWorld(e.getPlayer())) {
return;
}
if (e.getPlayer().isOp()) {
return;
}
// This permission bypasses protection
if (VaultHelper.checkPerm(e.getPlayer(), Settings.PERMPREFIX + "mod.bypassprotect")) {
return;
}
if (e.getRightClicked() != null && e.getRightClicked().getType().equals(EntityType.ENDER_CRYSTAL)) {
// Check island
Island island = plugin.getGrid().getIslandAt(e.getRightClicked().getLocation());
if (island == null && Settings.defaultWorldSettings.get(SettingsFlag.BREAK_BLOCKS)) {
return;
}
if (island !=null) {
if (island.getMembers().contains(e.getPlayer().getUniqueId()) || island.getIgsFlag(SettingsFlag.BREAK_BLOCKS)) {
return;
}
}
e.setCancelled(true);
Util.sendMessage(e.getPlayer(), ChatColor.RED + plugin.myLocale(e.getPlayer().getUniqueId()).islandProtected);
}
}
示例14: onInteract
import org.bukkit.event.player.PlayerInteractAtEntityEvent; //导入方法依赖的package包/类
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onInteract(PlayerInteractAtEntityEvent e) {
Entity entity = e.getRightClicked();
if (!(entity instanceof ArmorStand)) {
return;
}
Location l = BukkitUtil.getLocation(e.getRightClicked().getLocation());
PlotArea area = l.getPlotArea();
if (area == null) {
return;
}
Plot plot = area.getPlotAbs(l);
PlotPlayer pp = BukkitUtil.getPlayer(e.getPlayer());
if (plot == null) {
if (!Permissions.hasPermission(pp, "plots.admin.interact.road")) {
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, "plots.admin.interact.road");
e.setCancelled(true);
}
} else if (!plot.hasOwner()) {
if (!Permissions.hasPermission(pp, "plots.admin.interact.unowned")) {
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, "plots.admin.interact.unowned");
e.setCancelled(true);
}
} else {
UUID uuid = pp.getUUID();
if (!plot.isAdded(uuid)) {
if (Flags.MISC_INTERACT.isTrue(plot)) {
return;
}
if (!Permissions.hasPermission(pp, "plots.admin.interact.other")) {
MainUtil.sendMessage(pp, C.NO_PERMISSION_EVENT, "plots.admin.interact.other");
e.setCancelled(true);
}
}
}
}
示例15: 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))));
}