mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-12-18 23:27:43 +01:00
Changed checkPerm to hasPerm.
Cleaned up imports.
This commit is contained in:
parent
ed114a4333
commit
521e4b8b83
@ -1,13 +1,5 @@
|
|||||||
package us.tastybento.bskyblock;
|
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.ByteArrayOutputStream;
|
||||||
import java.io.DataOutputStream;
|
import java.io.DataOutputStream;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@ -25,6 +17,15 @@ import java.util.UUID;
|
|||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.zip.GZIPOutputStream;
|
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.
|
* bStats collects some data for plugin authors.
|
||||||
*
|
*
|
||||||
|
@ -35,7 +35,7 @@ public class IslandCommand extends BSBCommand{
|
|||||||
|
|
||||||
Player player = (Player) sender;
|
Player player = (Player) sender;
|
||||||
// Basic permission check to even use /island
|
// 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);
|
Util.sendMessage(player, ChatColor.RED + plugin.getLocale(player).errorNoPermission);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -113,7 +113,7 @@ public class IslandCommand extends BSBCommand{
|
|||||||
@Override
|
@Override
|
||||||
public String[] getHelp(CommandSender sender, String label){
|
public String[] getHelp(CommandSender sender, String label){
|
||||||
// TODO check if multiple homes
|
// 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};
|
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) {
|
public boolean canExecute(CommandSender sender, String label, String[] args) {
|
||||||
Player player = (Player) sender;
|
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);
|
Util.sendMessage(player, ChatColor.RED + plugin.getLocale(player).errorNoPermission);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -359,7 +359,7 @@ public class IslandCommand extends BSBCommand{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Set the name
|
// 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);
|
else plugin.getIslands().getIsland(player.getUniqueId()).setName(name);
|
||||||
|
|
||||||
Util.sendMessage(player, ChatColor.GREEN + plugin.getLocale(player).generalSuccess);
|
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) {
|
public boolean canExecute(CommandSender sender, String label, String[] args) {
|
||||||
Player player = (Player) sender;
|
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);
|
Util.sendMessage(player, ChatColor.RED + plugin.getLocale(player).errorNoPermission);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -1076,7 +1076,7 @@ public class IslandCommand extends BSBCommand{
|
|||||||
public boolean canExecute(CommandSender sender, String label, String[] args) {
|
public boolean canExecute(CommandSender sender, String label, String[] args) {
|
||||||
Player player = (Player) sender;
|
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);
|
Util.sendMessage(player, ChatColor.RED + plugin.getLocale(player).errorNoPermission);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
package us.tastybento.bskyblock.database;
|
package us.tastybento.bskyblock.database;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
@ -430,7 +428,7 @@ public class PlayersManager{
|
|||||||
addPlayer(targetUUID);
|
addPlayer(targetUUID);
|
||||||
// Check if the target player has a permission bypass (admin.noban)
|
// Check if the target player has a permission bypass (admin.noban)
|
||||||
Player target = plugin.getServer().getPlayer(targetUUID);
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
Island island = plugin.getIslands().getIsland(playerUUID);
|
Island island = plugin.getIslands().getIsland(playerUUID);
|
||||||
|
@ -50,7 +50,7 @@ public class VaultHelper {
|
|||||||
* @param perm
|
* @param perm
|
||||||
* @return true if the player has the 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);
|
return permission.has(player, perm);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user