Changed checkPerm to hasPerm.

Cleaned up imports.
This commit is contained in:
tastybento 2017-05-21 00:17:20 -07:00
parent ed114a4333
commit 521e4b8b83
4 changed files with 17 additions and 18 deletions

View File

@ -1,13 +1,5 @@
package us.tastybento.bskyblock;
import org.bukkit.Bukkit;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.plugin.ServicePriority;
import org.bukkit.plugin.java.JavaPlugin;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import javax.net.ssl.HttpsURLConnection;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.io.File;
@ -25,6 +17,15 @@ import java.util.UUID;
import java.util.logging.Level;
import java.util.zip.GZIPOutputStream;
import javax.net.ssl.HttpsURLConnection;
import org.bukkit.Bukkit;
import org.bukkit.configuration.file.YamlConfiguration;
import org.bukkit.plugin.ServicePriority;
import org.bukkit.plugin.java.JavaPlugin;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
/**
* bStats collects some data for plugin authors.
*

View File

@ -35,7 +35,7 @@ public class IslandCommand extends BSBCommand{
Player player = (Player) sender;
// Basic permission check to even use /island
if(!VaultHelper.checkPerm(player, Settings.PERMPREFIX + "island.create")){
if(!VaultHelper.hasPerm(player, Settings.PERMPREFIX + "island.create")){
Util.sendMessage(player, ChatColor.RED + plugin.getLocale(player).errorNoPermission);
return false;
}
@ -113,7 +113,7 @@ public class IslandCommand extends BSBCommand{
@Override
public String[] getHelp(CommandSender sender, String label){
// TODO check if multiple homes
if(VaultHelper.checkPerm((Player) sender, "todo")) return new String[] {"[1-x]", plugin.getLocale(sender).islandHelpGoHomes};
if(VaultHelper.hasPerm((Player) sender, "todo")) return new String[] {"[1-x]", plugin.getLocale(sender).islandHelpGoHomes};
return new String[] {null, plugin.getLocale(sender).islandHelpGo};
}
});
@ -314,7 +314,7 @@ public class IslandCommand extends BSBCommand{
public boolean canExecute(CommandSender sender, String label, String[] args) {
Player player = (Player) sender;
if(!VaultHelper.checkPerm(player, Settings.PERMPREFIX + "island.name")){
if(!VaultHelper.hasPerm(player, Settings.PERMPREFIX + "island.name")){
Util.sendMessage(player, ChatColor.RED + plugin.getLocale(player).errorNoPermission);
return false;
}
@ -359,7 +359,7 @@ public class IslandCommand extends BSBCommand{
}
// Set the name
if(VaultHelper.checkPerm(player, Settings.PERMPREFIX + "island.name.format")) plugin.getIslands().getIsland(player.getUniqueId()).setName(ChatColor.translateAlternateColorCodes('&', name));
if(VaultHelper.hasPerm(player, Settings.PERMPREFIX + "island.name.format")) plugin.getIslands().getIsland(player.getUniqueId()).setName(ChatColor.translateAlternateColorCodes('&', name));
else plugin.getIslands().getIsland(player.getUniqueId()).setName(name);
Util.sendMessage(player, ChatColor.GREEN + plugin.getLocale(player).generalSuccess);
@ -383,7 +383,7 @@ public class IslandCommand extends BSBCommand{
public boolean canExecute(CommandSender sender, String label, String[] args) {
Player player = (Player) sender;
if(!VaultHelper.checkPerm(player, Settings.PERMPREFIX + "island.name")){
if(!VaultHelper.hasPerm(player, Settings.PERMPREFIX + "island.name")){
Util.sendMessage(player, ChatColor.RED + plugin.getLocale(player).errorNoPermission);
return false;
}
@ -1076,7 +1076,7 @@ public class IslandCommand extends BSBCommand{
public boolean canExecute(CommandSender sender, String label, String[] args) {
Player player = (Player) sender;
if(!VaultHelper.checkPerm(player, Settings.PERMPREFIX + "island.lock")){
if(!VaultHelper.hasPerm(player, Settings.PERMPREFIX + "island.lock")){
Util.sendMessage(player, ChatColor.RED + plugin.getLocale(player).errorNoPermission);
return false;
}

View File

@ -1,8 +1,6 @@
package us.tastybento.bskyblock.database;
import java.io.File;
import java.util.HashMap;
import java.util.List;
import java.util.Map.Entry;
import java.util.UUID;
@ -430,7 +428,7 @@ public class PlayersManager{
addPlayer(targetUUID);
// Check if the target player has a permission bypass (admin.noban)
Player target = plugin.getServer().getPlayer(targetUUID);
if (target != null && VaultHelper.checkPerm(target, Settings.PERMPREFIX + "admin.noban")) {
if (target != null && VaultHelper.hasPerm(target, Settings.PERMPREFIX + "admin.noban")) {
return false;
}
Island island = plugin.getIslands().getIsland(playerUUID);

View File

@ -50,7 +50,7 @@ public class VaultHelper {
* @param perm
* @return true if the player has the perm
*/
public static boolean checkPerm(final Player player, final String perm) {
public static boolean hasPerm(final Player player, final String perm) {
return permission.has(player, perm);
}