本文整理汇总了Java中org.bukkit.event.player.PlayerInteractAtEntityEvent类的典型用法代码示例。如果您正苦于以下问题:Java PlayerInteractAtEntityEvent类的具体用法?Java PlayerInteractAtEntityEvent怎么用?Java PlayerInteractAtEntityEvent使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PlayerInteractAtEntityEvent类属于org.bukkit.event.player包,在下文中一共展示了PlayerInteractAtEntityEvent类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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"));
}
}
示例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(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;
}
}
}
}
}
示例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(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;
}
}
}
}
}
示例4: 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);
}
}
}
示例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: onPlayerInteractEntity
import org.bukkit.event.player.PlayerInteractAtEntityEvent; //导入依赖的package包/类
/**
* Prevents lobby players from interacting in the world.
*
* @param event The event
*/
@EventHandler
public void onPlayerInteractEntity(final PlayerInteractAtEntityEvent event) {
if (event.getPlayer().getLocation().getWorld().equals(world)) {
event.setCancelled(true);
}
}
示例9: entityRightClickEvent
import org.bukkit.event.player.PlayerInteractAtEntityEvent; //导入依赖的package包/类
@EventHandler
public void entityRightClickEvent(final PlayerInteractAtEntityEvent event) {
if (this.isBall(event.getRightClicked())) {
if (Config.getInstance().isUseEngineV2()) {
final Ball ball = this.getBall(event.getRightClicked());
ball.pass(event.getPlayer());
}
event.setCancelled(true);
} else if (this.isDeadBall(event.getRightClicked())) {
event.setCancelled(true);
}
}
示例10: 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;
}
}
}
}
}
}
示例11: onPlayerInteractAtEntity
import org.bukkit.event.player.PlayerInteractAtEntityEvent; //导入依赖的package包/类
/**
* Prevents a player that can't interact from interacting with an entity.
*
* @param event The event.
*/
@EventHandler(ignoreCancelled = true)
public void onPlayerInteractAtEntity(PlayerInteractAtEntityEvent event) {
if (!canInteract(event.getActor())) {
event.setCancelled(true);
}
}
示例12: onPlayerInteract
import org.bukkit.event.player.PlayerInteractAtEntityEvent; //导入依赖的package包/类
@EventHandler(priority = EventPriority.HIGH)
public void onPlayerInteract(PlayerInteractAtEntityEvent e) {
if (!e.isCancelled())
if (e.getHand().equals(EquipmentSlot.HAND))
if (e.getRightClicked().getUniqueId().equals(id)) {
e.setCancelled(true);
this.interact(e.getPlayer());
}
}
示例13: onInteract
import org.bukkit.event.player.PlayerInteractAtEntityEvent; //导入依赖的package包/类
/**
* Catches a player's interaction and sees if it's the one we've been waiting for
*/
@EventHandler
public void onInteract(PlayerInteractAtEntityEvent e) {
if (state) {
HandlerList.unregisterAll(this);
return;
}
if (QuestManagerPlugin.questManagerPlugin.getPluginConfiguration().getWorlds()
.contains(e.getPlayer().getPlayer().getWorld().getName())) {
for (QuestPlayer qp : participants.getParticipants()) {
if (qp.getPlayer().isOnline() && qp.getPlayer().getPlayer().getUniqueId()
.equals(e.getPlayer().getUniqueId())) {
//one of our participants
//actually check interaction now
if (e.getRightClicked().equals(npc.getEntity())) {
//cancel and interact
e.setCancelled(true);
this.state = true;
HandlerList.unregisterAll(this);
updateQuest();
menu.show(e.getPlayer(), getGoal().getQuest());
}
}
}
}
}
示例14: 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);
}
}
}
示例15: onArmorStandInteract
import org.bukkit.event.player.PlayerInteractAtEntityEvent; //导入依赖的package包/类
@EventHandler
public void onArmorStandInteract(PlayerInteractAtEntityEvent event) {
if (event.getRightClicked().getUniqueId().equals(armorStand.getUniqueId())) {
event.setCancelled(true);
event.getPlayer().sendMessage(ChatColor.RED + "Can't manipulate this Armor Stand! " + ChatColor.GOLD + player.getName() + ChatColor.RED + " is currently editing it!");
}
}