Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package net.thesleepyowl.essentialz.command.commands;
- import net.thesleepyowl.essentialz.Essentialz;
- import net.thesleepyowl.essentialz.util.Methods;
- import org.bukkit.ChatColor;
- import org.bukkit.command.Command;
- import org.bukkit.command.CommandExecutor;
- import org.bukkit.command.CommandSender;
- import org.bukkit.entity.Player;
- import org.bukkit.event.Listener;
- import org.bukkit.plugin.Plugin;
- public class CommandSaturation implements Listener, CommandExecutor {
- private Plugin plugin = Essentialz.getPlugin(Essentialz.class);
- public String saturation = "saturation";
- public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
- Player player = (Player) sender;
- String perm = "essentialz.saturation";
- String permOther = "essentialz.saturation.other";
- String prefix = plugin.getConfig().getString("Config.Prefix");
- Player user = player.getServer().getPlayer(args[0]);
- if (args.length == 0) {
- if (player.hasPermission(perm)) {
- //String YourSatMSG = ChatColor.GRAY + "Your saturation level is " + ChatColor.GOLD + player.getSaturation() + ChatColor.GRAY + ".";
- //player.sendMessage(Methods.formatText(prefix + YourSatMSG));
- player.sendMessage(ChatColor.GOLD + player.getDisplayName() + "s" + ChatColor.GRAY + " saturation level is " + ChatColor.GOLD + player.getFoodLevel() + ChatColor.GRAY + ".");
- } else {
- String FeedPermMSG = prefix + ChatColor.RED + "You need the permission " + ChatColor.BOLD + ChatColor.RED + perm + ChatColor.RESET + ChatColor.RED + " to use this.";
- sender.sendMessage(Methods.formatText(FeedPermMSG));
- }
- } else {
- if (player.hasPermission(permOther)) {
- Player p = (Player) user;
- String OtherSatMSG = ChatColor.GOLD + ((Player) user).getDisplayName() + "s" + ChatColor.GRAY + " saturation level is " + ChatColor.GOLD + ((Player) user).getFoodLevel() + ChatColor.GRAY + ".";
- player.sendMessage(Methods.formatText(prefix + OtherSatMSG));
- } else {
- String FeedOtherPermMSG = prefix + ChatColor.RED + "You need the permission " + ChatColor.BOLD + ChatColor.RED + permOther + ChatColor.RESET + ChatColor.RED + " to use this.";
- player.sendMessage(Methods.formatText(FeedOtherPermMSG));
- }
- }
- return true;
- }
- }
Add Comment
Please, Sign In to add comment