mirror of
https://github.com/PikaMug/Quests.git
synced 2025-01-09 18:08:20 +01:00
Disable Compass if player has WorldEdit jumpto permission
This commit is contained in:
parent
9ca6d7938e
commit
e2b8924c22
@ -3817,6 +3817,15 @@ public class Quester {
|
|||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean canUseCompass() {
|
||||||
|
if (!getPlayer().hasPermission("worldedit.navigation.jumpto")) {
|
||||||
|
if (getPlayer().hasPermission("quests.compass")) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reset compass target to Quester's bed spawn location<p>
|
* Reset compass target to Quester's bed spawn location<p>
|
||||||
@ -3828,7 +3837,7 @@ public class Quester {
|
|||||||
if (player == null) {
|
if (player == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!getPlayer().hasPermission("quests.compass")) {
|
if (!canUseCompass()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3846,7 +3855,7 @@ public class Quester {
|
|||||||
* Update compass target to current stage of first available current quest, if possible
|
* Update compass target to current stage of first available current quest, if possible
|
||||||
*/
|
*/
|
||||||
public void findCompassTarget() {
|
public void findCompassTarget() {
|
||||||
if (!getPlayer().hasPermission("quests.compass")) {
|
if (!canUseCompass()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
for (Quest quest : currentQuests.keySet()) {
|
for (Quest quest : currentQuests.keySet()) {
|
||||||
@ -3863,7 +3872,7 @@ public class Quester {
|
|||||||
* @param notify Whether to notify this quester of result
|
* @param notify Whether to notify this quester of result
|
||||||
*/
|
*/
|
||||||
public void findNextCompassTarget(boolean notify) {
|
public void findNextCompassTarget(boolean notify) {
|
||||||
if (!getPlayer().hasPermission("quests.compass")) {
|
if (!canUseCompass()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
|
Bukkit.getScheduler().runTaskAsynchronously(plugin, new Runnable() {
|
||||||
|
@ -342,7 +342,7 @@ public class PlayerListener implements Listener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (evt.getItem() != null && evt.getItem().getType().equals(Material.COMPASS)) {
|
if (evt.getItem() != null && evt.getItem().getType().equals(Material.COMPASS)) {
|
||||||
if (!player.hasPermission("quests.compass")) {
|
if (!quester.canUseCompass()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (evt.getAction().equals(Action.LEFT_CLICK_AIR)
|
if (evt.getAction().equals(Action.LEFT_CLICK_AIR)
|
||||||
@ -808,7 +808,7 @@ public class PlayerListener implements Listener {
|
|||||||
if (quester.hasJournal) {
|
if (quester.hasJournal) {
|
||||||
quester.updateJournal();
|
quester.updateJournal();
|
||||||
}
|
}
|
||||||
if (evt.getPlayer().hasPermission("quests.compass")) {
|
if (quester.canUseCompass()) {
|
||||||
quester.resetCompass();
|
quester.resetCompass();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user