Only check main hand for sit attempt

This commit is contained in:
Shevchik 2016-12-24 21:59:18 +03:00
parent 3f0fa8d8d0
commit 655d7f1645
5 changed files with 130 additions and 1 deletions

Binary file not shown.

View File

@ -12,6 +12,7 @@ import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.block.Action; import org.bukkit.event.block.Action;
import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.inventory.EquipmentSlot;
import org.bukkit.material.Stairs; import org.bukkit.material.Stairs;
import org.bukkit.material.Step; import org.bukkit.material.Step;
import org.bukkit.material.WoodenStep; import org.bukkit.material.WoodenStep;
@ -29,7 +30,7 @@ public class TrySitEventListener implements Listener {
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true) @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
public void onPlayerInteract(PlayerInteractEvent event) { public void onPlayerInteract(PlayerInteractEvent event) {
if (event.getAction() == Action.RIGHT_CLICK_BLOCK) { if (event.getAction() == Action.RIGHT_CLICK_BLOCK && event.getHand() == EquipmentSlot.HAND) {
Player player = event.getPlayer(); Player player = event.getPlayer();
Block block = event.getClickedBlock(); Block block = event.getClickedBlock();
if (sitAllowed(player, block)) { if (sitAllowed(player, block)) {

View File

@ -2,6 +2,9 @@ package com.cnaude.chairs.vehiclearrow.v1_10_R1;
import net.minecraft.server.v1_10_R1.EntityArrow; import net.minecraft.server.v1_10_R1.EntityArrow;
import java.util.Collections;
import java.util.Set;
import org.bukkit.craftbukkit.v1_10_R1.CraftServer; import org.bukkit.craftbukkit.v1_10_R1.CraftServer;
import org.bukkit.craftbukkit.v1_10_R1.entity.CraftArrow; import org.bukkit.craftbukkit.v1_10_R1.entity.CraftArrow;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
@ -27,4 +30,28 @@ public class CraftChairsArrow extends CraftArrow implements Vehicle {
super.remove(); super.remove();
} }
@Override
public int getPortalCooldown() {
return 0;
}
@Override
public void setPortalCooldown(int val) {
}
@Override
public Set<String> getScoreboardTags() {
return Collections.emptySet();
}
@Override
public boolean addScoreboardTag(String tag) {
return false;
}
@Override
public boolean removeScoreboardTag(String tag) {
return false;
}
} }

View File

@ -2,6 +2,9 @@ package com.cnaude.chairs.vehiclearrow.v1_9_R1;
import net.minecraft.server.v1_9_R1.EntityArrow; import net.minecraft.server.v1_9_R1.EntityArrow;
import java.util.Collections;
import java.util.Set;
import org.bukkit.craftbukkit.v1_9_R1.CraftServer; import org.bukkit.craftbukkit.v1_9_R1.CraftServer;
import org.bukkit.craftbukkit.v1_9_R1.entity.CraftArrow; import org.bukkit.craftbukkit.v1_9_R1.entity.CraftArrow;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
@ -27,4 +30,56 @@ public class CraftChairsArrow extends CraftArrow implements Vehicle {
super.remove(); super.remove();
} }
@Override
public void setInvulnerable(boolean invulnerable) {
}
@Override
public boolean isInvulnerable() {
return true;
}
@Override
public boolean isSilent() {
return true;
}
@Override
public void setSilent(boolean silent) {
}
@Override
public boolean hasGravity() {
return false;
}
@Override
public void setGravity(boolean gravity) {
}
@Override
public int getPortalCooldown() {
return 0;
}
@Override
public void setPortalCooldown(int val) {
}
@Override
public Set<String> getScoreboardTags() {
return Collections.emptySet();
}
@Override
public boolean addScoreboardTag(String tag) {
return false;
}
@Override
public boolean removeScoreboardTag(String tag) {
return false;
}
} }

View File

@ -2,6 +2,9 @@ package com.cnaude.chairs.vehiclearrow.v1_9_R2;
import net.minecraft.server.v1_9_R2.EntityArrow; import net.minecraft.server.v1_9_R2.EntityArrow;
import java.util.Collections;
import java.util.Set;
import org.bukkit.craftbukkit.v1_9_R2.CraftServer; import org.bukkit.craftbukkit.v1_9_R2.CraftServer;
import org.bukkit.craftbukkit.v1_9_R2.entity.CraftArrow; import org.bukkit.craftbukkit.v1_9_R2.entity.CraftArrow;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
@ -27,4 +30,47 @@ public class CraftChairsArrow extends CraftArrow implements Vehicle {
super.remove(); super.remove();
} }
@Override
public boolean isSilent() {
return true;
}
@Override
public void setSilent(boolean silent) {
}
@Override
public boolean hasGravity() {
return false;
}
@Override
public void setGravity(boolean gravity) {
}
@Override
public int getPortalCooldown() {
return 0;
}
@Override
public void setPortalCooldown(int val) {
}
@Override
public Set<String> getScoreboardTags() {
return Collections.emptySet();
}
@Override
public boolean addScoreboardTag(String tag) {
return false;
}
@Override
public boolean removeScoreboardTag(String tag) {
return false;
}
} }