NEW gameplay feature with setting to disable

This commit is contained in:
PikaMug 2020-04-01 18:56:46 -04:00
parent 080006beb2
commit 9cc7945935
3 changed files with 18 additions and 2 deletions

View File

@ -25,6 +25,7 @@ public class Settings {
private int acceptTimeout = 20;
private boolean allowCommands = true;
private boolean allowCommandsForNpcQuests = false;
private boolean allowPranks = true;
private boolean askConfirmation = true;
private boolean genFilesOnJoin = true;
private boolean ignoreLockedQuests = false;
@ -62,6 +63,12 @@ public class Settings {
public void setAllowCommandsForNpcQuests(boolean allowCommandsForNpcQuests) {
this.allowCommandsForNpcQuests = allowCommandsForNpcQuests;
}
public boolean canAllowPranks() {
return allowPranks;
}
public void setAllowPranks(boolean allowPranks) {
this.allowPranks = allowPranks;
}
public boolean canAskConfirmation() {
return askConfirmation;
}
@ -152,6 +159,7 @@ public class Settings {
acceptTimeout = config.getInt("accept-timeout", 20);
allowCommands = config.getBoolean("allow-command-questing", true);
allowCommandsForNpcQuests = config.getBoolean("allow-command-quests-with-npcs", false);
allowPranks = config.getBoolean("allow-pranks", true);
askConfirmation = config.getBoolean("ask-confirmation", true);
genFilesOnJoin = config.getBoolean("generate-files-on-join", true);
ignoreLockedQuests = config.getBoolean("ignore-locked-quests", false);

View File

@ -175,8 +175,15 @@ public class PlayerListener implements Listener {
// Do nothing, getHand() not present pre-1.9
}
if (e == null || e.equals(EquipmentSlot.HAND)) { //If the event is fired by HAND (main hand)
if (evt.hasBlock() && evt.getClickedBlock().getType().name().equals("LECTERN")) {
if (ItemUtil.isJournal(evt.getPlayer().getItemInHand())) {
if (evt.hasBlock() && ItemUtil.isJournal(evt.getPlayer().getItemInHand())) {
if (evt.getClickedBlock().getType().name().contains("PORTAL")
&& plugin.getSettings().canAllowPranks()) {
evt.setCancelled(true);
evt.getPlayer().sendMessage(" " + ChatColor.AQUA + ChatColor.UNDERLINE
+ "https://www.youtube.com/watch?v=dQw4w9WgXcQ");
return;
}
if (evt.getClickedBlock().getType().name().equals("LECTERN")) {
evt.setCancelled(true);
evt.getPlayer().sendMessage(ChatColor.RED + Lang.get(evt.getPlayer(), "journalDenied"));
return;

View File

@ -2,6 +2,7 @@
accept-timeout: 20
allow-command-questing: true
allow-command-quests-with-npcs: false
allow-pranks: true
allow-quitting: true
ask-confirmation: true
generate-files-on-join: true