Advertisement
MsGamerHD

Untitled

May 6th, 2016
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.26 KB | None | 0 0
  1. package de.MsGamerHD.System.Utils;
  2.  
  3. import org.bukkit.entity.Player;
  4.  
  5. import ru.tehkode.permissions.PermissionUser;
  6. import ru.tehkode.permissions.bukkit.PermissionsEx;
  7.  
  8. public enum Rang {
  9.  
  10. INHABER("§4", "Inhaber", "Inhaber", true, "inhaber", "001"),
  11. ADMIN("§4", "Admin", "Admin", true, "admin", "002"),
  12. DEVELOPER("§b", "Developer", "Dev", true, "developer", "003"),
  13. BUILDER("§e", "Builder", "Builder", true, "builder", "004"),
  14. MODERATOR("§c", "Moderator", "Mod", true, "moderator", "005"),
  15. SUPPORTER("§c", "Supporter", "Sup", true, "supporter", "006"),
  16. CHATSUPPORTER("§c", "Chat-Supporter", "CS", true, "cs", "007"),
  17. YOUTUBER("§5", "Youtuber", "", false, "youtube", "008"),
  18. DIAMANT("§3", "Diamant", "", false, "diamant", "009"),
  19. EMERALD("§2", "Emerald", "", false, "emerald", "010"),
  20. GOLD("§6", "Gold", "", false, "gold", "011"),
  21. LAPIS("§9", "Lapis", "", false, "lapis", "012"),
  22. SPIELER("§7", "Spieler", "", false, "spieler", "013");
  23.  
  24. private String color;
  25. private String prefix;
  26. private String shortprefix;
  27. private boolean trennung;
  28. private String pexname;
  29. private String ordnung;
  30.  
  31. private Rang(String color, String prefix, String shortprefix, boolean trennung, String pexname, String ordnung){
  32. this.color = color;
  33. this.prefix = prefix;
  34. this.shortprefix = shortprefix;
  35. this.trennung = trennung;
  36. this.pexname = pexname;
  37. this.ordnung = ordnung;
  38. }
  39.  
  40. public String getColor(){
  41. return this.color;
  42. }
  43.  
  44. public String getPrefix(){
  45. return this.color+this.prefix;
  46. }
  47.  
  48. public String getShortPrefix(){
  49. return this.color+this.shortprefix;
  50. }
  51.  
  52. public boolean getTrennung(){
  53. return this.trennung;
  54. }
  55.  
  56. public String getPexName(){
  57. return this.pexname;
  58. }
  59.  
  60. public String getOrdnung(){
  61. return this.ordnung;
  62. }
  63.  
  64. public static Rang getRang(Player p) {
  65. PermissionUser user = PermissionsEx.getUser(p);
  66. String group = user.getPrefix();
  67.  
  68. for(Rang rang : values()){
  69. if(group.toLowerCase().equals(rang.getPexName().toLowerCase())){
  70. return rang;
  71. }
  72. }
  73. return Rang.SPIELER;
  74. }
  75.  
  76. public static Rang getRangFromName(Player p) {
  77. for(Rang rang : values()){
  78. if(p.getCustomName().startsWith(rang.getPrefix())){
  79. return rang;
  80. }
  81. }
  82.  
  83. return Rang.SPIELER;
  84. }
  85. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement