Merge pull request #286 from TinyTank800/master

Quality of life changes.
This commit is contained in:
RockyHawk 2024-01-13 16:01:44 +11:00 committed by GitHub
commit 39ee2a6b21
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 35 additions and 2 deletions

View File

@ -46,6 +46,26 @@ public class GetCustomHeads {
return var5.getValue();
}
}
if (meta.hasOwner()) {
Field fld = meta.getClass().getDeclaredField("profile");
fld.setAccessible(true);
GameProfile prof = (GameProfile) fld.get(meta);
Iterator itr = prof.getProperties().get("textures").iterator();
if (itr.hasNext()) {
Property var5 = (Property) itr.next();
String var5string = var5.toString();
var5string = var5string.replace("Property[","");
var5string = var5string.replace("]","");
String[] var5strings = var5string.split(",");
for(String var : var5strings){
if(var.contains("value= ")){
var = var.replace("value= ", "");
return var;
}
}
}
}
}catch(Exception exc){/*skip return null*/}
}
return null;

View File

@ -121,7 +121,7 @@ public class HasSections {
if(value.endsWith(" HASPERM")) {
return Bukkit.getPlayer(value.substring(0, value.length()-8)).hasPermission(compare) == outputValue;
}else if(value.endsWith(" ISGREATER")) {
return (new BigDecimal(compare).compareTo(new BigDecimal(value.substring(0, value.length()-10))) <= 0 == outputValue);
return (new BigDecimal(compare).compareTo(new BigDecimal(value.substring(0, value.length()-10).replace(",",""))) <= 0 == outputValue);
}else{
return compare.equals(value) == outputValue;
}

View File

@ -448,6 +448,18 @@ public class ItemCreation {
//not a banner
file.set("panels." + panelName + ".item." + i + ".banner", null);
}
try {
PotionMeta potionMeta = (PotionMeta) cont.getItemMeta();
assert potionMeta != null;
PotionData potionData = potionMeta.getBasePotionData();
PotionType potionType = potionData.getType(); // Gets the potion type as a string rather than bukkit type
boolean level = potionData.isUpgraded(); // Check if the potion is level II
boolean extended = potionData.isExtended(); // Check if the potion is extended
file.set("panels." + panelName + ".item." + i + ".potion", potionType + " " + extended + " " + level);
}catch(Exception ignore){
//not a banner
file.set("panels." + panelName + ".item." + i + ".potion", null);
}
file.set("panels." + panelName + ".item." + i + ".stack", cont.getAmount());
if(!cont.getEnchantments().isEmpty()){
List<String> enchantments = new ArrayList<>();

View File

@ -36,7 +36,8 @@ public class ItemFallManager implements Listener {
}
e.getPlayer().getWorld().dropItem(e.getPlayer().getLocation(),stack);
}else if(e.getPanel().getConfig().getStringList("item." + item + ".itemType").contains("returnItem")){
}else if(e.getPanel().getConfig().getStringList("item." + item + ".itemType").contains("returnItem") || e.getPanel().getConfig().getStringList("item." + item + ".itemType").contains("removeItem")){
//Remove item is listed just because website is not updated yet.
ItemStack stack = e.getPlayer().getOpenInventory().getTopInventory().getItem(Integer.parseInt(item));
if(stack == null || stack.getType() == Material.AIR){
continue;