Skip to content

Instantly share code, notes, and snippets.

@GMatrixGames
Created September 12, 2020 17:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GMatrixGames/6a6fd3969ed15e8e4331f709a590aae0 to your computer and use it in GitHub Desktop.
Save GMatrixGames/6a6fd3969ed15e8e4331f709a590aae0 to your computer and use it in GitHub Desktop.
EFortRarity enum for Java
package com.gmatrixgames.common.fnutils;
import java.awt.*;
/**
* Utility class for color coordination for embeds pertaining to cosmetics
*
* @author Garrett
*/
public enum EFortRarity {
// Rarities
COMMON(new Color(0xB1B1B1)),
UNCOMMON(Color.green),
RARE(new Color(0x006DFF)),
EPIC(new Color(0x9D19FF)),
LEGENDARY(new Color(0xFF4203)),
MYTHIC(new Color(0xC89214)),
TRANSCENDENT(new Color(0xD51944)),
IMPOSSIBLE(new Color(0x1E8500)),
UNATTAINABLE(new Color(0x1fefb5)),
// Series
COLUMBUSSERIES(Color.yellow),
MARVELSERIES(new Color(0xE20604)),
CREATORCOLLABSERIES(new Color(0x0F676D)),
CUBESERIES(new Color(0xFF148E)),
DCUSERIES(new Color(0x0077FF)),
FROSTSERIES(new Color(0xAFD7FF)),
LAVASERIES(new Color(0xF49D09)),
SHADOWSERIES(Color.black),
SLURPSERIES(new Color(0x7FF0C2));
private final Color color;
/**
* Default constructor
*
* @param color - Color
*/
EFortRarity(Color color) {
this.color = color;
}
public static EFortRarity getRarity(String rarity) {
switch (rarity.toUpperCase()) {
case "EFortRarity::Common":
case "EFortRarity::Handmade":
return COMMON;
case "EFortRarity::Uncommon":
return UNCOMMON;
case "EFortRarity::Rare":
case "EFortRarity::Sturdy":
return RARE;
case "EFortRarity::Epic":
case "EFortRarity::Quality":
return EPIC;
case "EFortRarity::Legendary":
case "EFortRarity::Fine":
return LEGENDARY;
case "EFortRarity::Mythic":
case "EFortRarity::Elegant":
return MYTHIC;
case "EFortRarity::Transcendent":
case "EFortRarity::Masterwork":
return TRANSCENDENT;
case "EFortRarity::Unattainable":
case "EFortRarity::Badass":
return UNATTAINABLE;
default:
return IMPOSSIBLE;
}
}
public static EFortRarity getSeries(String series) {
return EFortRarity.valueOf(series.toUpperCase());
}
/**
* #getColor()
* <p>
* Gives the color of the specified Rarity
*
* @return color - Color of a given rarity
*/
public Color getColor() {
return color;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment