Skip to content

Commit

Permalink
Add Configuration Option to enable or disable the GUI for the other u…
Browse files Browse the repository at this point in the history
…ser commands
  • Loading branch information
AlessioGr committed Sep 20, 2021
1 parent ca365c7 commit b49a3a6
Show file tree
Hide file tree
Showing 11 changed files with 23 additions and 4 deletions.
Binary file modified .gradle/7.1.1/executionHistory/executionHistory.bin
Binary file not shown.
Binary file modified .gradle/7.1.1/executionHistory/executionHistory.lock
Binary file not shown.
Binary file modified .gradle/7.1.1/fileHashes/fileHashes.bin
Binary file not shown.
Binary file modified .gradle/7.1.1/fileHashes/fileHashes.lock
Binary file not shown.
Binary file modified .gradle/buildOutputCleanup/buildOutputCleanup.lock
Binary file not shown.
2 changes: 2 additions & 0 deletions build/resources/main/general.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ gui:
questpreview:
# If set to false, clickable text will be used for Quest Previews instead
enabled: true
usercommands:
enabled: true
Binary file modified build/tmp/compileJava/previous-compilation-data.bin
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ public CommandNotQuests(NotQuests main) {
@Override
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String label, String[] args) {
if (sender instanceof Player player) {
boolean guiEnabled = true;
if (label.equalsIgnoreCase("qg")) {
guiEnabled = false;
boolean guiEnabled = main.getDataManager().getConfiguration().isUserCommandsUseGUI();
//if (label.equalsIgnoreCase("qg")) {
//guiEnabled = false;
//player.sendMessage("§aOpening NotQuests GUI §1[BETA]");
}
//}
if (sender.hasPermission("notnot.quests.use")) {
QuestPlayer questPlayer = main.getQuestPlayerManager().getQuestPlayer((player.getUniqueId()));
sender.sendMessage("");
Expand Down
10 changes: 10 additions & 0 deletions src/main/java/notquests/notquests/Managers/Configuration.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public class Configuration {
private int port;

private boolean questPreviewUseGUI = true;
private boolean userCommandsUseGUI = true;
private boolean mySQLEnabled = false;

public Configuration(){
Expand Down Expand Up @@ -78,4 +79,13 @@ public final boolean isMySQLEnabled(){
public void setMySQLEnabled(final boolean mySQLEnabled){
this.mySQLEnabled = mySQLEnabled;
}


public final boolean isUserCommandsUseGUI() {
return userCommandsUseGUI;
}

public void setUserCommandsUseGUI(final boolean userCommandsUseGUI) {
this.userCommandsUseGUI = userCommandsUseGUI;
}
}
5 changes: 5 additions & 0 deletions src/main/java/notquests/notquests/Managers/DataManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,11 @@ public final void loadGeneralConfig() {
}
configuration.setQuestPreviewUseGUI(getGeneralConfig().getBoolean("gui.questpreview.enabled"));

if(!getGeneralConfig().isBoolean("gui.usercommands.enabled")){
getGeneralConfig().set("gui.usercommands.enabled", true);
}
configuration.setUserCommandsUseGUI(getGeneralConfig().getBoolean("gui.usercommands.enabled"));



saveGeneralConfig();
Expand Down
2 changes: 2 additions & 0 deletions src/main/resources/general.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ gui:
questpreview:
# If set to false, clickable text will be used for Quest Previews instead
enabled: true
usercommands:
enabled: true

0 comments on commit b49a3a6

Please sign in to comment.