Showing Dropping Anvil Something (Ignore)

This commit is contained in:
Driftay
2019-09-15 05:19:06 -04:00
parent 2feaed0aad
commit 7f988031ca
285 changed files with 28757 additions and 28757 deletions

View File

@@ -16,140 +16,140 @@ import java.util.ArrayList;
import java.util.List;
public enum Role implements Permissable {
LEADER(4, TL.ROLE_LEADER),
COLEADER(3, TL.ROLE_COLEADER),
MODERATOR(2, TL.ROLE_MODERATOR),
NORMAL(1, TL.ROLE_NORMAL),
RECRUIT(0, TL.ROLE_RECRUIT);
LEADER(4, TL.ROLE_LEADER),
COLEADER(3, TL.ROLE_COLEADER),
MODERATOR(2, TL.ROLE_MODERATOR),
NORMAL(1, TL.ROLE_NORMAL),
RECRUIT(0, TL.ROLE_RECRUIT);
public final int value;
public final String nicename;
public final TL translation;
public final int value;
public final String nicename;
public final TL translation;
Role(final int value, final TL translation) {
this.value = value;
this.nicename = translation.toString();
this.translation = translation;
}
Role(final int value, final TL translation) {
this.value = value;
this.nicename = translation.toString();
this.translation = translation;
}
public static Role getRelative(Role role, int relative) {
return Role.getByValue(role.value + relative);
}
public static Role getRelative(Role role, int relative) {
return Role.getByValue(role.value + relative);
}
public static Role getByValue(int value) {
switch (value) {
case 0:
return RECRUIT;
case 1:
return NORMAL;
case 2:
return MODERATOR;
case 3:
return COLEADER;
case 4:
return LEADER;
}
public static Role getByValue(int value) {
switch (value) {
case 0:
return RECRUIT;
case 1:
return NORMAL;
case 2:
return MODERATOR;
case 3:
return COLEADER;
case 4:
return LEADER;
}
return null;
}
return null;
}
public static Role fromString(String check) {
switch (check.toLowerCase()) {
case "leader":
case "admin":
return LEADER;
case "coleader":
return COLEADER;
case "mod":
case "moderator":
return MODERATOR;
case "normal":
case "member":
return NORMAL;
case "recruit":
case "rec":
return RECRUIT;
}
public static Role fromString(String check) {
switch (check.toLowerCase()) {
case "leader":
case "admin":
return LEADER;
case "coleader":
return COLEADER;
case "mod":
case "moderator":
return MODERATOR;
case "normal":
case "member":
return NORMAL;
case "recruit":
case "rec":
return RECRUIT;
}
return null;
}
return null;
}
public boolean isAtLeast(Role role) {
return this.value >= role.value;
}
public boolean isAtLeast(Role role) {
return this.value >= role.value;
}
public boolean isAtMost(Role role) {
return this.value <= role.value;
}
public boolean isAtMost(Role role) {
return this.value <= role.value;
}
@Override
public String toString() {
return this.nicename;
}
@Override
public String toString() {
return this.nicename;
}
public TL getTranslation() {
return translation;
}
public TL getTranslation() {
return translation;
}
public String getPrefix() {
public String getPrefix() {
switch (this) {
case LEADER:
return Conf.prefixLeader;
case COLEADER:
return Conf.prefixCoLeader;
case MODERATOR:
return Conf.prefixMod;
case NORMAL:
return Conf.prefixNormal;
case RECRUIT:
return Conf.prefixRecruit;
}
switch (this) {
case LEADER:
return Conf.prefixLeader;
case COLEADER:
return Conf.prefixCoLeader;
case MODERATOR:
return Conf.prefixMod;
case NORMAL:
return Conf.prefixNormal;
case RECRUIT:
return Conf.prefixRecruit;
}
return "";
}
return "";
}
// Utility method to build items for F Perm GUI
@Override
public ItemStack buildItem() {
final ConfigurationSection RELATION_CONFIG = FactionsPlugin.getInstance().getConfig().getConfigurationSection("fperm-gui.relation");
// Utility method to build items for F Perm GUI
@Override
public ItemStack buildItem() {
final ConfigurationSection RELATION_CONFIG = FactionsPlugin.getInstance().getConfig().getConfigurationSection("fperm-gui.relation");
String displayName = replacePlaceholders(RELATION_CONFIG.getString("placeholder-item.name", ""));
List<String> lore = new ArrayList<>();
String displayName = replacePlaceholders(RELATION_CONFIG.getString("placeholder-item.name", ""));
List<String> lore = new ArrayList<>();
Material material = XMaterial.matchXMaterial(RELATION_CONFIG.getString("materials." + name().toLowerCase(), "STAINED_CLAY")).parseMaterial();
if (material == null) {
return null;
}
Material material = XMaterial.matchXMaterial(RELATION_CONFIG.getString("materials." + name().toLowerCase(), "STAINED_CLAY")).parseMaterial();
if (material == null) {
return null;
}
ItemStack item = new ItemStack(material);
ItemMeta itemMeta = item.getItemMeta();
ItemStack item = new ItemStack(material);
ItemMeta itemMeta = item.getItemMeta();
for (String loreLine : RELATION_CONFIG.getStringList("placeholder-item.lore")) {
lore.add(replacePlaceholders(loreLine));
}
for (String loreLine : RELATION_CONFIG.getStringList("placeholder-item.lore")) {
lore.add(replacePlaceholders(loreLine));
}
itemMeta.setDisplayName(displayName);
itemMeta.setLore(lore);
if (!FactionsPlugin.getInstance().mc17) {
itemMeta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES);
}
itemMeta.setDisplayName(displayName);
itemMeta.setLore(lore);
if (!FactionsPlugin.getInstance().mc17) {
itemMeta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES);
}
item.setItemMeta(itemMeta);
item.setItemMeta(itemMeta);
return item;
}
return item;
}
public String replacePlaceholders(String string) {
string = ChatColor.translateAlternateColorCodes('&', string);
public String replacePlaceholders(String string) {
string = ChatColor.translateAlternateColorCodes('&', string);
String permissableName = nicename.substring(0, 1).toUpperCase() + nicename.substring(1);
String permissableName = nicename.substring(0, 1).toUpperCase() + nicename.substring(1);
string = string.replace("{relation-color}", ChatColor.GREEN.toString());
string = string.replace("{relation}", permissableName);
string = string.replace("{relation-color}", ChatColor.GREEN.toString());
string = string.replace("{relation}", permissableName);
return string;
}
return string;
}
}