Advertisement
Guest User

Untitled

a guest
Feb 16th, 2020
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. public class PotionEffectz implements CommandExecutor {
  2.  
  3. @Override
  4. public boolean onCommand(CommandSender commandSender, Command command, String s, String[] strings) {
  5.  
  6. if(s.equalsIgnoreCase("potioneffectz")) {
  7. if(!(commandSender instanceof Player)) {
  8. commandSender.sendMessage(ChatColor.RED + "You must be a player");
  9. return true;
  10.  
  11. }
  12. Player p = (Player) commandSender;
  13.  
  14. if(!p.hasPermission("pve.command")) {
  15. p.sendMessage(ChatColor.RED + "No permissions");
  16. return true;
  17.  
  18. }
  19.  
  20. if(strings.length != 1) {
  21. p.sendMessage(ChatColor.RED + "Usage: /potioneffectz <effect>");
  22. return true;
  23. }
  24. String type = strings[0];
  25.  
  26. if(type == "speed") {
  27. p.addPotionEffect(new PotionEffect(PotionEffectType.SPEED, 200, 1));
  28. p.sendMessage(ChatColor.YELLOW + "Successfully given you speed!");
  29. return true;
  30. }
  31.  
  32. if(type == "absorb") {
  33. p.addPotionEffect(new PotionEffect(PotionEffectType.ABSORPTION, 200, 1));
  34. p.sendMessage(ChatColor.YELLOW + "Successfully given you Absorption!");
  35. return true;
  36. }
  37.  
  38. }
  39.  
  40. return true;
  41. }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement