Guest User

Untitled

a guest
Jan 22nd, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.45 KB | None | 0 0
  1. package net.thesleepyowl.essentialz.command.commands;
  2.  
  3. import net.thesleepyowl.essentialz.Essentialz;
  4. import net.thesleepyowl.essentialz.util.Methods;
  5. import org.bukkit.ChatColor;
  6. import org.bukkit.command.Command;
  7. import org.bukkit.command.CommandExecutor;
  8. import org.bukkit.command.CommandSender;
  9. import org.bukkit.entity.Player;
  10. import org.bukkit.event.Listener;
  11. import org.bukkit.plugin.Plugin;
  12.  
  13. public class CommandSaturation implements Listener, CommandExecutor {
  14.  
  15. private Plugin plugin = Essentialz.getPlugin(Essentialz.class);
  16. public String saturation = "saturation";
  17.  
  18. public boolean onCommand(CommandSender sender, Command cmd, String label, String[] args) {
  19. Player player = (Player) sender;
  20. String perm = "essentialz.saturation";
  21. String permOther = "essentialz.saturation.other";
  22. String prefix = plugin.getConfig().getString("Config.Prefix");
  23. Player user = player.getServer().getPlayer(args[0]);
  24.  
  25.  
  26. if (args.length == 0) {
  27. if (player.hasPermission(perm)) {
  28. //String YourSatMSG = ChatColor.GRAY + "Your saturation level is " + ChatColor.GOLD + player.getSaturation() + ChatColor.GRAY + ".";
  29. //player.sendMessage(Methods.formatText(prefix + YourSatMSG));
  30. player.sendMessage(ChatColor.GOLD + player.getDisplayName() + "s" + ChatColor.GRAY + " saturation level is " + ChatColor.GOLD + player.getFoodLevel() + ChatColor.GRAY + ".");
  31. } else {
  32. String FeedPermMSG = prefix + ChatColor.RED + "You need the permission " + ChatColor.BOLD + ChatColor.RED + perm + ChatColor.RESET + ChatColor.RED + " to use this.";
  33. sender.sendMessage(Methods.formatText(FeedPermMSG));
  34. }
  35. } else {
  36. if (player.hasPermission(permOther)) {
  37. Player p = (Player) user;
  38. String OtherSatMSG = ChatColor.GOLD + ((Player) user).getDisplayName() + "s" + ChatColor.GRAY + " saturation level is " + ChatColor.GOLD + ((Player) user).getFoodLevel() + ChatColor.GRAY + ".";
  39. player.sendMessage(Methods.formatText(prefix + OtherSatMSG));
  40. } else {
  41. String FeedOtherPermMSG = prefix + ChatColor.RED + "You need the permission " + ChatColor.BOLD + ChatColor.RED + permOther + ChatColor.RESET + ChatColor.RED + " to use this.";
  42. player.sendMessage(Methods.formatText(FeedOtherPermMSG));
  43. }
  44. }
  45. return true;
  46. }
  47. }
Add Comment
Please, Sign In to add comment