MsGamerHD

Untitled

Oct 12th, 2016
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.28 KB | None | 0 0
  1. package de.msgamerhd.system.rang;
  2.  
  3. import org.bukkit.entity.Player;
  4.  
  5. import de.whidex.permissionsystem.zeugs.PlayerUtils;
  6.  
  7. public enum Rang {
  8.  
  9.     ADMIN("§4", "Administrator", "A", true, "admin", "001"),
  10.     DEVELOPER("§b", "Entwickler", "E", true, "entwickler", "004"),
  11.     PROBEDEVELOPER("§b", "Probe-Developer", "D", true, "testentwickler", "007"),
  12.     MODERATOR("§c", "Moderator", "M", true, "moderator", "010"),
  13.     BUILDER("§e", "Bauteam", "B", true, "bauteam", "020"),
  14.     SUPPORTER("§2", "Supporter", "S", true, "supporter", "025"),
  15.     PROBESUPPORTER("§2", "Probe-Supporter", "S", true, "testsupporter", "030"),
  16.     YOUTUBER("§5", "Youtuber", "Y", true, "youtuber", "035"),
  17.     PREMIUMPLUS("§6", "Premium+", "P+", true, "premiumplus", "040"),
  18.     MASTER("§3", "Master", "M", true, "master", "045"),
  19.     HELD("§d", "Held", "H", true, "held", "050"),
  20.     PREMIUM("§6", "Premium", "P", true, "premium", "055"),
  21.     VIP("§9", "VIP", "V", true, "vip", "060"),
  22.     SPIELER("§a", "Spieler", "S", true, "spieler", "065");
  23.    
  24.     private String color;
  25.     private String prefix;
  26.     private String shortprefix;
  27.     private boolean trennung;
  28.     private String rangname;
  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.rangname = 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 getRangname(){
  57.         return this.rangname;
  58.     }
  59.    
  60.     public String getOrdnung(){
  61.         return this.ordnung;
  62.     }
  63.    
  64.     public static Rang getRang(Player p) {
  65.         for(Rang rang : values()){
  66.             if(PlayerUtils.getPlayerGroup(p.getName().toLowerCase()).equalsIgnoreCase(rang.getRangname().toLowerCase())){
  67.                 return rang;
  68.             }
  69.         }
  70.         return Rang.SPIELER;
  71.     }
  72.  
  73.     public static Rang getRangFromName(Player p) {
  74.         try{
  75.             for(Rang rang : values()){
  76.                 if(p.getCustomName().startsWith(rang.getPrefix())){
  77.                     return rang;
  78.                 }
  79.             }
  80.         } catch (Exception d){ }
  81.        
  82.         return Rang.SPIELER;
  83.     }
  84. }
Add Comment
Please, Sign In to add comment