mirror of
https://gitlab.com/phoenix-dvpmt/mmoitems.git
synced 2025-01-24 09:51:21 +01:00
!Cleanup
This commit is contained in:
parent
9d4347ee28
commit
a241949c55
@ -57,13 +57,6 @@ public class MMOUtils {
|
|||||||
return bar.substring(0, (int) (ratio * n)) + ChatColor.WHITE + bar.substring((int) (ratio * n));
|
return bar.substring(0, (int) (ratio * n)) + ChatColor.WHITE + bar.substring((int) (ratio * n));
|
||||||
}
|
}
|
||||||
|
|
||||||
// public static PotionEffectType valueOfPotionEffectType(String effect) {
|
|
||||||
// for (PotionEffectType checked : PotionEffectType.values())
|
|
||||||
// if (checked.getName().equals(effect.toUpperCase().replace("-", "_")))
|
|
||||||
// return checked;
|
|
||||||
// return null;
|
|
||||||
// }
|
|
||||||
|
|
||||||
public static LivingEntity getDamager(EntityDamageByEntityEvent event) {
|
public static LivingEntity getDamager(EntityDamageByEntityEvent event) {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -111,7 +104,7 @@ public class MMOUtils {
|
|||||||
|
|
||||||
public static String getDisplayName(ItemStack item) {
|
public static String getDisplayName(ItemStack item) {
|
||||||
return item.hasItemMeta() && item.getItemMeta().hasDisplayName() ? item.getItemMeta().getDisplayName()
|
return item.hasItemMeta() && item.getItemMeta().hasDisplayName() ? item.getItemMeta().getDisplayName()
|
||||||
: MMOUtils.caseOnWords(item.getType().name().toLowerCase().replace("_", " "));
|
: caseOnWords(item.getType().name().toLowerCase().replace("_", " "));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean twoHandedCase(Player player) {
|
public static boolean twoHandedCase(Player player) {
|
||||||
@ -195,55 +188,26 @@ public class MMOUtils {
|
|||||||
&& (!MMOItems.plugin.getLanguage().abilityPlayerDamage || !MMOItems.plugin.getFlags().isPvpAllowed(target.getLocation())))
|
&& (!MMOItems.plugin.getLanguage().abilityPlayerDamage || !MMOItems.plugin.getFlags().isPvpAllowed(target.getLocation())))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return loc == null ? true : MMOLib.plugin.getNMS().isInBoundingBox(target, loc);
|
return loc == null || MMOLib.plugin.getNMS().isInBoundingBox(target, loc);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String intToRoman(int input) {
|
private static final String[] romanChars = { "M", "CM", "D", "CD", "C", "XC", "L", "XL", "X", "IX", "V", "IV",
|
||||||
if (input < 1 || input > 499)
|
"I" };
|
||||||
return ">499";
|
private static final int[] romanValues = { 1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1 };
|
||||||
|
|
||||||
String s = "";
|
public static String intToRoman(int input) {
|
||||||
while (input >= 400) {
|
if (input < 1 || input > 3999)
|
||||||
s += "CD";
|
throw new IllegalArgumentException("Input must be between 1 and 3999");
|
||||||
input -= 400;
|
|
||||||
}
|
String format = "";
|
||||||
while (input >= 100) {
|
|
||||||
s += "C";
|
for (int i = 0; i < romanChars.length; i++)
|
||||||
input -= 100;
|
while (input >= romanValues[i]) {
|
||||||
}
|
format += romanChars[i];
|
||||||
while (input >= 90) {
|
input -= romanValues[i];
|
||||||
s += "XC";
|
}
|
||||||
input -= 90;
|
|
||||||
}
|
return format;
|
||||||
while (input >= 50) {
|
|
||||||
s += "L";
|
|
||||||
input -= 50;
|
|
||||||
}
|
|
||||||
while (input >= 40) {
|
|
||||||
s += "XL";
|
|
||||||
input -= 40;
|
|
||||||
}
|
|
||||||
while (input >= 10) {
|
|
||||||
s += "X";
|
|
||||||
input -= 10;
|
|
||||||
}
|
|
||||||
while (input >= 9) {
|
|
||||||
s += "IX";
|
|
||||||
input -= 9;
|
|
||||||
}
|
|
||||||
while (input >= 5) {
|
|
||||||
s += "V";
|
|
||||||
input -= 5;
|
|
||||||
}
|
|
||||||
while (input >= 4) {
|
|
||||||
s += "IV";
|
|
||||||
input -= 4;
|
|
||||||
}
|
|
||||||
while (input >= 1) {
|
|
||||||
s += "I";
|
|
||||||
input -= 1;
|
|
||||||
}
|
|
||||||
return s;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Deprecated
|
@Deprecated
|
||||||
|
Loading…
Reference in New Issue
Block a user