ExcavationCommand.java 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. package com.gmail.nossr50.commands.skills;
  2. import org.bukkit.command.Command;
  3. import org.bukkit.command.CommandExecutor;
  4. import org.bukkit.command.CommandSender;
  5. import org.bukkit.entity.Player;
  6. import com.gmail.nossr50.Users;
  7. import com.gmail.nossr50.mcPermissions;
  8. import com.gmail.nossr50.datatypes.PlayerProfile;
  9. import com.gmail.nossr50.datatypes.SkillType;
  10. import com.gmail.nossr50.locale.mcLocale;
  11. public class ExcavationCommand implements CommandExecutor {
  12. @Override
  13. public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
  14. if (!(sender instanceof Player)) {
  15. sender.sendMessage("This command does not support console useage.");
  16. return true;
  17. }
  18. Player player = (Player) sender;
  19. PlayerProfile PP = Users.getProfile(player);
  20. int ticks = 2;
  21. int x = PP.getSkillLevel(SkillType.EXCAVATION);
  22. while (x >= 50) {
  23. x -= 50;
  24. ticks++;
  25. }
  26. player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.SkillExcavation") }));
  27. player.sendMessage(mcLocale.getString("m.XPGain", new Object[] { mcLocale.getString("m.XPGainExcavation") }));
  28. if (mcPermissions.getInstance().excavation(player))
  29. player.sendMessage(mcLocale.getString("m.LVL", new Object[] { PP.getSkillLevel(SkillType.EXCAVATION), PP.getSkillXpLevel(SkillType.EXCAVATION), PP.getXpToLevel(SkillType.EXCAVATION) }));
  30. player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.Effects") }));
  31. player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsExcavation1_0"), mcLocale.getString("m.EffectsExcavation1_1") }));
  32. player.sendMessage(mcLocale.getString("m.EffectsTemplate", new Object[] { mcLocale.getString("m.EffectsExcavation2_0"), mcLocale.getString("m.EffectsExcavation2_1") }));
  33. player.sendMessage(mcLocale.getString("m.SkillHeader", new Object[] { mcLocale.getString("m.YourStats") }));
  34. player.sendMessage(mcLocale.getString("m.ExcavationGreenTerraLength", new Object[] { ticks }));
  35. return true;
  36. }
  37. }