mirror of
https://github.com/PikaMug/Quests.git
synced 2024-11-14 22:55:54 +01:00
Fix PlayerInteractEvent error on pre-1.9 servers, fixes #594
This commit is contained in:
parent
84acca7152
commit
f7b806bd63
@ -189,11 +189,13 @@ public class PlayerListener implements Listener {
|
|||||||
@SuppressWarnings("deprecation") // since 1.13
|
@SuppressWarnings("deprecation") // since 1.13
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void onPlayerInteract(PlayerInteractEvent evt) {
|
public void onPlayerInteract(PlayerInteractEvent evt) {
|
||||||
EquipmentSlot e = evt.getHand(); //Get the hand of the event and set it to 'e'.
|
EquipmentSlot e = null;
|
||||||
if (e == null) {
|
try {
|
||||||
return;
|
e = evt.getHand();
|
||||||
|
} catch (NoSuchMethodError err) {
|
||||||
|
// Do nothing, getHand() not present pre-1.9
|
||||||
}
|
}
|
||||||
if (e.equals(EquipmentSlot.HAND)) { //If the event is fired by HAND (main hand)
|
if (e == null || e.equals(EquipmentSlot.HAND)) { //If the event is fired by HAND (main hand)
|
||||||
if (plugin.checkQuester(evt.getPlayer().getUniqueId()) == false) {
|
if (plugin.checkQuester(evt.getPlayer().getUniqueId()) == false) {
|
||||||
|
|
||||||
if (evt.getAction().equals(Action.RIGHT_CLICK_BLOCK)) {
|
if (evt.getAction().equals(Action.RIGHT_CLICK_BLOCK)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user