Sueta
RA

Ranking System - Like in Rainbow Six Siege + API

1.0

An high performence Ranking System like in Rainbow Six Siege. + API

·Plugin


Hello Guys. I wanted an Ranking System like in Rainbow Six Siege, but I didnt found one, so I decided to code an system like in R6. I hope you like my plugin and enjoy it. If you found some bugs / errors let me know it.


package at.sciencecode.rsm.ranking; 

import java.util.ArrayList; 

import org.bukkit.entity.Player; 

import at.sciencecode.rsm.manager.FileManager; 

public class RankAPI { 
  
    // ArrayList to see if player is InGame 
  
    public static ArrayList<Player> ingame = new ArrayList<>(); 

    // Get Rank as String 
  
    public static String getRank(Player p) { 
        FileManager filemanager = new FileManager(); 
        int points = filemanager.yml.getInt(p.getUniqueId().toString()); 
      
        String rank = convertPointsToRank(points); 
        return rank; 
    } 
  
    // Get Points 
  
    public static int getPoints(Player p) { 
        FileManager filemanager = new FileManager(); 
        int points = filemanager.yml.getInt(p.getUniqueId().toString()); 
        return points; 
    } 
  
    // Converts the points to a rank 
  
    public static String convertPointsToRank(int points) { 
        if (points < 50) { 
            return "Copper IV"; 
        } 
        else if (points < 100 && points > 49) { 
            return "Copper III"; 
        } 
        else if (points < 150 && points > 99) { 
            return "Copper II"; 
        } 
        else if (points < 200 && points > 149) { 
            return "Copper I"; 
        } 
        else if (points < 250 && points > 199) { 
            return "Bronze IV"; 
        } 
        else if (points < 300 && points > 249) { 
            return "Bronze III"; 
        } 
        else if (points < 350 && points > 299) { 
            return "Bronze II"; 
        } 
        else if (points < 400 && points > 349) { 
            return "Bronze I"; 
        } 
        else if (points < 450 && points > 399) { 
            return "Silver IV"; 
        } 
        else if (points < 500 && points > 449) { 
            return "Silver III"; 
        } 
        else if (points < 550 && points > 499) { 
            return "Silver II"; 
        } 
        else if (points < 600 && points > 549) { 
            return "Silver I"; 
        } 
        else if (points < 650 && points > 599) { 
            return "Gold IV"; 
        } 
        else if (points < 700 && points > 649) { 
            return "Gold III"; 
        } 
        else if (points < 750 && points > 699) { 
            return "Gold II"; 
        } 
        else if (points < 800 && points > 749) { 
            return "Gold I"; 
        } 
        else if (points < 850 && points > 799) { 
            return "Bronze IV"; 
        } 
        else if (points < 900 && points > 849) { 
            return "Platinum IV"; 
        } 
        else if (points < 950 && points > 899) { 
            return "Platinum III"; 
        } 
        else if (points < 1000 && points > 949) { 
            return "Platinum II"; 
        } 
        else if (points < 1050 && points > 999) { 
            return "Platinum I"; 
        } 
        else if (points > 1049) { 
            return "Diamond"; 
        } 
        return "Error"; 
    } 
    // Add points 
  
    public static void addPoints(Player p, int points) { 
        FileManager filemanager = new FileManager(); 
        int currentpoints = filemanager.yml.getInt(p.getUniqueId().toString()); 
        filemanager.yml.set(p.getUniqueId().toString(), currentpoints + points); 
        filemanager.saveFiles(); 
    } 
  
    // Remove points 
  
    public static void removePoints(Player p, int points) { 
        FileManager filemanager = new FileManager(); 
        int currentpoints = filemanager.yml.getInt(p.getUniqueId().toString()); 
        if (currentpoints > 50) { 
        filemanager.yml.set(p.getUniqueId().toString(), currentpoints - points); 
        filemanager.saveFiles(); 
        } 
    } 
  
    // Set Points 
  
    public static void setPoints(Player p, int points) { 
        FileManager filemanager = new FileManager(); 
        filemanager.yml.set(p.getUniqueId().toString(), points); 
        filemanager.saveFiles(); 
    } 
  
    // Register User 
  
    public static void registerUser(Player p) { 
        FileManager filemanager = new FileManager(); 
        filemanager.yml.set(p.getUniqueId().toString(), 0); 
        filemanager.saveFiles(); 
    } 
  
    // Check if is In a game 
  
    public static boolean isInGame(Player p) { 
        if (ingame.contains(p)) { 
            return true; 
        } 
        return false; 
    } 
  
    public static void setIsInGame(Player p) { 
        if (ingame.contains(p)) { 
            ingame.remove(p); 
        } else { 
            ingame.add(p); 
        } 
    } 
  
  
    public static boolean isRegistered(Player p) { 
        FileManager filemanager = new FileManager(); 
        if (filemanager.yml.contains(p.getUniqueId().toString())) { 
            return true; 
        } 
        return false; 
    } 
  
    // Send Help 
  
    public static void sendHelp(Player p) { 
        p.sendMessage("§e§m------------------------------"); 
        p.sendMessage("§b> §7addPoints [Points] [Player]"); 
        p.sendMessage("§b> §7removePoints [Points] [Player]"); 
        p.sendMessage("§b> §7reset [Player]"); 
        p.sendMessage("§e§m------------------------------"); 

    } 
  
    // Send Rank as Message 
  
    public static void sendRank(Player p) { 
        p.sendMessage("§e§m------------------------------"); 
        p.sendMessage("§bRank> §7" + getRank(p)); 
        p.sendMessage("§bPoints> §7" + getPoints(p)); 
        p.sendMessage("§e§m------------------------------"); 

    } 
    
}
Disclaimer

© 2015 Ubisoft Entertainment. All Rights Reserved. Tom Clancy’s, Rainbow Six, The Soldier Icon, Ubisoft and the Ubisoft logo are registered or unregistered trademarks of Ubisoft Entertainment in the U.S. and/or other countries. The “PS” Family logo is a registered trademark and “PS4” is a trademark of Sony Computer Entertainment Inc. Software platform logo (TM and ©) EMA 2006.

Important

There are 2 Types. 1 is for users without a mysql server and the other one is for the pros.

Similar projects

Plugin →