Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added toggle to hide jobs from /jobs browse if they lack permission

  • Loading branch information...
commit 852779ba0972450520d819ef3460bac9779b65e7 1 parent cff4374
phrstbrn phrstbrn authored
4 src/main/java/me/zford/jobs/bukkit/JobsCommands.java
View
@@ -328,6 +328,10 @@ public boolean stats(CommandSender sender, String[] args) {
public boolean browse(CommandSender sender, String[] args) {
ArrayList<String> jobs = new ArrayList<String>();
for (Job job: plugin.getJobsCore().getJobs()) {
+ if (plugin.getJobsConfiguration().getHideJobsWithoutPermission()) {
+ if (!plugin.hasJobPermission(sender, job))
+ continue;
+ }
if (job.getMaxLevel() > 0) {
jobs.add(job.getChatColour() + job.getName() + ChatColor.WHITE + " - max lvl: " + job.getMaxLevel());
} else {
12 src/main/java/me/zford/jobs/bukkit/config/JobsConfiguration.java
View
@@ -130,6 +130,9 @@ private synchronized void loadGeneralSettings(){
);
config.addDefault("max-jobs", 3);
+ writer.addComment("hide-jobs-without-permission", "Hide jobs from player if they lack the permission to join the job");
+ config.addDefault("hide-jobs-without-permission", false);
+
writer.addComment("enable-pay-near-spawner", "option to allow payment to be made when killing mobs from a spawner");
config.addDefault("enable-pay-near-spawner", false);
@@ -208,6 +211,7 @@ private synchronized void loadGeneralSettings(){
copySetting(config, writer, "broadcast-on-skill-up");
copySetting(config, writer, "broadcast-on-level-up");
copySetting(config, writer, "max-jobs");
+ copySetting(config, writer, "hide-jobs-without-permission");
copySetting(config, writer, "enable-pay-near-spawner");
copySetting(config, writer, "enable-pay-creative");
copySetting(config, writer, "modify-chat");
@@ -511,6 +515,14 @@ public Title getTitleForLevel(int level) {
}
/**
+ * Function to check if jobs should be hidden to players that lack permission to join the job
+ * @return
+ */
+ public synchronized boolean getHideJobsWithoutPermission() {
+ return config.getBoolean("hide-jobs-without-permission");
+ }
+
+ /**
* Function to return the maximum number of jobs a player can join
* @return
*/
Please sign in to comment.
Something went wrong with that request. Please try again.