Skip to content

Instantly share code, notes, and snippets.

@byquanton
Created April 10, 2022 18:19
Show Gist options
  • Save byquanton/b41431061eaa194d80c3fc592039ea06 to your computer and use it in GitHub Desktop.
Save byquanton/b41431061eaa194d80c3fc592039ea06 to your computer and use it in GitHub Desktop.
import org.bukkit.DyeColor;
import org.bukkit.Material;
public enum MaterialColor {
WHITE(DyeColor.WHITE),
ORANGE(DyeColor.ORANGE),
MAGENTA(DyeColor.MAGENTA),
LIGHT_BLUE(DyeColor.LIGHT_BLUE),
YELLOW(DyeColor.YELLOW),
LIME(DyeColor.LIME),
PINK(DyeColor.PINK),
GRAY(DyeColor.GRAY),
LIGHT_GRAY(DyeColor.LIGHT_GRAY),
CYAN(DyeColor.CYAN),
PURPLE(DyeColor.PURPLE),
BLUE(DyeColor.BLUE),
BROWN(DyeColor.BROWN),
GREEN(DyeColor.GREEN),
RED(DyeColor.RED),
BLACK(DyeColor.BLACK);
private final String colorName;
private final DyeColor dyeColor;
private final Material wool;
private final Material terracotta;
private final Material carpet;
private final Material stainedGlass;
private final Material stainedGlassPane;
private final Material shulkerBox;
private final Material glazedTerracotta;
private final Material concrete;
private final Material concretePowder;
private final Material dye;
private final Material bed;
private final Material banner;
private final Material candle;
private final Material candleCake;
BlockColor(DyeColor dyeColor) {
this.dyeColor = dyeColor;
colorName = dyeColor.name().toUpperCase();
this.wool = Material.valueOf(colorName + "_WOOL");
this.terracotta = Material.valueOf(colorName + "_TERRACOTTA");
this.carpet = Material.valueOf(colorName+ "_CARPET");
this.stainedGlass = Material.valueOf(colorName + "_STAINED_GLASS");
this.stainedGlassPane = Material.valueOf(colorName + "_STAINED_GLASS_PANE");
this.shulkerBox = Material.valueOf(colorName + "_SHULKER_BOX");
this.glazedTerracotta = Material.valueOf(colorName + "_GLAZED_TERRACOTTA");
this.concrete = Material.valueOf(colorName + "_CONCRETE");
this.concretePowder = Material.valueOf(colorName + "_CONCRETE_POWDER");
this.dye = Material.valueOf(colorName + "_DYE");
this.bed = Material.valueOf(colorName + "_BED");
this.banner = Material.valueOf(colorName + "_BANNER");
this.candle = Material.valueOf(colorName + "_CANDLE");
this.candleCake = Material.valueOf(colorName + "_CANDLE_CAKE");
}
public DyeColor getDyeColor() {
return dyeColor;
}
public Material getWool() {
return wool;
}
public Material getTerracotta() {
return terracotta;
}
public Material getCarpet() {
return carpet;
}
public Material getStainedGlass() {
return stainedGlass;
}
public Material getStainedGlassPane() {
return stainedGlassPane;
}
public Material getShulkerBox() {
return shulkerBox;
}
public Material getGlazedTerracotta() {
return glazedTerracotta;
}
public Material getConcrete() {
return concrete;
}
public Material getConcretePowder() {
return concretePowder;
}
public Material getDye() {
return dye;
}
public Material getBed() {
return bed;
}
public Material getBanner() {
return banner;
}
public Material getCandle() {
return candle;
}
public Material getCandleCake() {
return candleCake;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment