Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.67 KB | None | 0 0
  1. if(sender instanceof Player && command.getName().equalsIgnoreCase("sp")) {
  2. ArrayList<String> list = new ArrayList<String>();
  3. String lastArg = "";
  4. if(args.length == 1) {
  5. return StringUtil.copyPartialMatches(args[0], Arrays.asList("help", "add", "remove", "set", "reload"), new ArrayList<>());
  6. }
  7.  
  8. else if(args[0].equalsIgnoreCase("add")) {
  9. if(args.length == 2) {
  10. list.add("<name>");
  11. lastArg = args[1];
  12. }
  13. else if(args.length == 3) {
  14. for (Enum<?> stuff : Particle.class.getEnumConstants()) {
  15. list.add(stuff.toString());
  16. lastArg = args[2];
  17. }
  18. }
  19. else if(args.length == 4) {
  20. list.add("<speed>");
  21. lastArg = args[3];
  22. }
  23. return StringUtil.copyPartialMatches(lastArg, list, new ArrayList<>());
  24. }
  25.  
  26. else if(args[0].equalsIgnoreCase("remove") && args.length == 2) {
  27. for (String location : plugin.getConfig().getConfigurationSection("particles.").getKeys(false)) {
  28. list.add(location);
  29. }
  30. return StringUtil.copyPartialMatches(args[1], list, new ArrayList<>());
  31. }
  32.  
  33. else if(args[0].equalsIgnoreCase("set")) {
  34. if(args.length == 2) {
  35. for (String location : plugin.getConfig().getConfigurationSection("particles.").getKeys(false)) {
  36. list.add(location);
  37. }
  38. lastArg = args[1];
  39. }
  40. if(args.length == 3) {
  41. for (Enum<?> stuff : Particle.class.getEnumConstants()) {
  42. list.add(stuff.toString());
  43. }
  44. lastArg = args[2];
  45. }
  46. if(args.length == 4) {
  47. list.add("<speed>");
  48. lastArg = args[3];
  49. }
  50. return StringUtil.copyPartialMatches(lastArg, list, new ArrayList<>());
  51. }
  52. }
  53. return null;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement