mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-02 00:30:07 +01:00
Get rid of unused functions.
This commit is contained in:
parent
9be6a7cf3b
commit
fe1cf40bbb
@ -12,35 +12,6 @@ import com.gmail.nossr50.util.Permissions;
|
|||||||
public final class CommandHelper {
|
public final class CommandHelper {
|
||||||
private CommandHelper() {}
|
private CommandHelper() {}
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks for command permissions.
|
|
||||||
*
|
|
||||||
* @param sender The command sender
|
|
||||||
* @param permission The permission to check
|
|
||||||
* @return true if the sender is a player without permissions, false otherwise
|
|
||||||
*/
|
|
||||||
public static boolean noCommandPermissions(CommandSender sender, String permission) {
|
|
||||||
if (sender instanceof Player) {
|
|
||||||
Player player = (Player) sender;
|
|
||||||
|
|
||||||
if (!Permissions.hasPermission(player, permission)) {
|
|
||||||
player.sendMessage(LocaleLoader.getString("mcMMO.NoPermission"));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean noCommandPermissions(Player player, String permission) {
|
|
||||||
if (!Permissions.hasPermission(player, permission)) {
|
|
||||||
player.sendMessage(LocaleLoader.getString("mcMMO.NoPermission"));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean noConsoleUsage(CommandSender sender) {
|
public static boolean noConsoleUsage(CommandSender sender) {
|
||||||
if (!(sender instanceof Player)) {
|
if (!(sender instanceof Player)) {
|
||||||
sender.sendMessage(LocaleLoader.getString("Commands.NoConsole"));
|
sender.sendMessage(LocaleLoader.getString("Commands.NoConsole"));
|
||||||
|
@ -8,7 +8,6 @@ import org.bukkit.command.Command;
|
|||||||
import org.bukkit.command.CommandExecutor;
|
import org.bukkit.command.CommandExecutor;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
import com.gmail.nossr50.commands.CommandHelper;
|
|
||||||
import com.gmail.nossr50.config.Config;
|
import com.gmail.nossr50.config.Config;
|
||||||
import com.gmail.nossr50.database.Database;
|
import com.gmail.nossr50.database.Database;
|
||||||
import com.gmail.nossr50.database.Leaderboard;
|
import com.gmail.nossr50.database.Leaderboard;
|
||||||
@ -79,7 +78,7 @@ public class MctopCommand implements CommandExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void flatfileDisplay(int page, String skill, CommandSender sender) {
|
private void flatfileDisplay(int page, String skill, CommandSender sender) {
|
||||||
if (!skill.equalsIgnoreCase("all") && CommandHelper.noCommandPermissions(sender, "mcmmo.commands.mctop." + skill.toLowerCase())) {
|
if (!skill.equalsIgnoreCase("all") && sender.hasPermission("mcmmo.commands.mctop." + skill.toLowerCase())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -116,7 +115,7 @@ public class MctopCommand implements CommandExecutor {
|
|||||||
|
|
||||||
private void sqlDisplay(int page, String query, CommandSender sender) {
|
private void sqlDisplay(int page, String query, CommandSender sender) {
|
||||||
if (!query.equalsIgnoreCase("taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics+fishing")) {
|
if (!query.equalsIgnoreCase("taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics+fishing")) {
|
||||||
if (CommandHelper.noCommandPermissions(sender, "mcmmo.commands.mctop." + query.toLowerCase())) {
|
if (!sender.hasPermission("mcmmo.commands.mctop." + query.toLowerCase())) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user