mirror of
https://github.com/MilkBowl/Vault.git
synced 2024-11-27 13:07:23 +01:00
adjust plugin permissions, vault.update is now for displaying the update
messages, default is OP, all OPs (including console) will now see this message. override the permission to false if you don't want console message, or want to set specific permission on specific players. vault.admin now controls all commands, not op status.
This commit is contained in:
parent
041885e986
commit
7d6d695861
@ -20,3 +20,6 @@ permissions:
|
||||
vault.admin:
|
||||
description: Notifies the player when vault is in need of an update.
|
||||
default: op
|
||||
vault.update:
|
||||
description: Allows a user or the console to check for updates
|
||||
default: op
|
@ -132,7 +132,7 @@ public class Vault extends JavaPlugin {
|
||||
getCommand("vault-info").setExecutor(this);
|
||||
getCommand("vault-convert").setExecutor(this);
|
||||
getServer().getPluginManager().registerEvents(new VaultListener(), this);
|
||||
|
||||
if (getServer().getConsoleSender().hasPermission("vault.update")) {
|
||||
// Schedule to check the version every 30 minutes for an update. This is to update the most recent
|
||||
// version so if an admin reconnects they will be warned about newer versions.
|
||||
this.getServer().getScheduler().runTaskTimerAsynchronously(this, new Runnable() {
|
||||
@ -151,7 +151,7 @@ public class Vault extends JavaPlugin {
|
||||
}
|
||||
|
||||
}, 0, 432000);
|
||||
|
||||
}
|
||||
// Load up the Plugin metrics
|
||||
try {
|
||||
metrics = new Metrics(this);
|
||||
@ -381,13 +381,8 @@ public class Vault extends JavaPlugin {
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String commandLabel, String[] args) {
|
||||
if (sender instanceof Player) {
|
||||
// Check if Player
|
||||
// If so, ignore command if player is not Op
|
||||
Player p = (Player) sender;
|
||||
if (!p.isOp()) {
|
||||
return true;
|
||||
}
|
||||
if (!sender.hasPermission("vault.admin")) {
|
||||
sender.sendMessage("You do not have permission to use that command!");
|
||||
}
|
||||
|
||||
if (command.getName().equalsIgnoreCase("vault-info")) {
|
||||
@ -554,7 +549,7 @@ public class Vault extends JavaPlugin {
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void onPlayerJoin(PlayerJoinEvent event) {
|
||||
Player player = event.getPlayer();
|
||||
if (perms.has(player, "vault.admin")) {
|
||||
if (perms.has(player, "vault.update")) {
|
||||
try {
|
||||
if (newVersion > currentVersion) {
|
||||
player.sendMessage(newVersion + " is out! You are running " + currentVersion);
|
||||
|
Loading…
Reference in New Issue
Block a user