1
0
mirror of https://github.com/Zrips/Jobs.git synced 2024-11-25 12:05:16 +01:00

New command to reset players permission cache

This commit is contained in:
Zrips 2024-06-25 15:48:36 +03:00
parent 748d4fae86
commit dc82211192
3 changed files with 41 additions and 4 deletions

View File

@ -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<String, jobsSign> sub = signsByType.get(jSign.getIdentifier().toLowerCase());
if (sub != null) {
sub.remove(jSign.locToBlockString());
}
}
return true;
}

View File

@ -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;
}
}

View File

@ -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]"));