diff --git a/src/main/java/com/gamingmesh/jobs/Signs/SignUtil.java b/src/main/java/com/gamingmesh/jobs/Signs/SignUtil.java index 8f2965d1..1c1f5ddc 100644 --- a/src/main/java/com/gamingmesh/jobs/Signs/SignUtil.java +++ b/src/main/java/com/gamingmesh/jobs/Signs/SignUtil.java @@ -6,9 +6,7 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.stream.Collectors; -import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; @@ -18,7 +16,6 @@ import org.bukkit.configuration.ConfigurationSection; import org.bukkit.configuration.file.YamlConfiguration; import com.gamingmesh.jobs.Jobs; -import com.gamingmesh.jobs.commands.list.gtop; import com.gamingmesh.jobs.container.Job; import com.gamingmesh.jobs.container.TopList; @@ -50,7 +47,7 @@ public class SignUtil { Map sub = signsByType.get(jSign.getIdentifier().toLowerCase()); if (sub != null) { sub.remove(jSign.locToBlockString()); - } + } return true; } diff --git a/src/main/java/com/gamingmesh/jobs/commands/list/recalculatepermissions.java b/src/main/java/com/gamingmesh/jobs/commands/list/recalculatepermissions.java new file mode 100644 index 00000000..1cd574b2 --- /dev/null +++ b/src/main/java/com/gamingmesh/jobs/commands/list/recalculatepermissions.java @@ -0,0 +1,37 @@ +package com.gamingmesh.jobs.commands.list; + +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +import com.gamingmesh.jobs.Jobs; +import com.gamingmesh.jobs.commands.Cmd; +import com.gamingmesh.jobs.container.ActionType; +import com.gamingmesh.jobs.container.Job; +import com.gamingmesh.jobs.container.JobsPlayer; +import com.gamingmesh.jobs.i18n.Language; + +import net.Zrips.CMILib.Locale.LC; +import net.Zrips.CMILib.Messages.CMIMessages; + +public class recalculatepermissions implements Cmd { + + @Override + public Boolean perform(Jobs plugin, final CommandSender sender, final String[] args) { + + JobsPlayer jPlayer = null; + if (args.length >= 1) { + jPlayer = Jobs.getPlayerManager().getJobsPlayer(args[0]); + } else if (sender instanceof Player) + jPlayer = Jobs.getPlayerManager().getJobsPlayer((Player) sender); + + if (jPlayer == null) { + LC.info_NoPlayer.sendMessage(sender, "[name]", args.length >= 1 ? args[0] : sender.getName()); + return true; + } + + jPlayer.getPermissionsCache().clear(); + + return true; + } + +} diff --git a/src/main/java/com/gamingmesh/jobs/config/LanguageManager.java b/src/main/java/com/gamingmesh/jobs/config/LanguageManager.java index 573ad547..7b64e1bf 100644 --- a/src/main/java/com/gamingmesh/jobs/config/LanguageManager.java +++ b/src/main/java/com/gamingmesh/jobs/config/LanguageManager.java @@ -292,6 +292,9 @@ public class LanguageManager { c.get("command.entitylist.help.info", "Shows all possible entities that can be used with the plugin."); c.get("command.entitylist.help.args", ""); + c.get("command.recalculatepermissions.help.info", "Reset players permission cache"); + c.get("command.recalculatepermissions.help.args", "(playername)"); + c.get("command.stats.help.info", "Show the level you are in each job you are part of."); c.get("command.stats.help.args", "[playername]"); Jobs.getGCManager().getCommandArgs().put("stats", Arrays.asList("[playername]"));