This commit is contained in:
rockyhawk64 2021-09-27 16:51:29 +10:00
parent 3996a39dba
commit 2bb57a42f5
6 changed files with 48 additions and 11 deletions

View File

@ -1,7 +1,7 @@
<component name="libraryTable">
<library name="MMOItems-6.6.0">
<library name="MMOItems-6.6.1">
<CLASSES>
<root url="jar://$PROJECT_DIR$/../../Tools/Build Tools/Jar Libraries/MMOItems-6.6.0.jar!/" />
<root url="jar://$PROJECT_DIR$/../../Tools/Build Tools/Jar Libraries/MMOItems-6.6.1.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />

View File

@ -1,7 +1,7 @@
<component name="libraryTable">
<library name="MythicLib-1.1.1">
<library name="MythicLib-1.1.3">
<CLASSES>
<root url="jar://$PROJECT_DIR$/../../Tools/Build Tools/Jar Libraries/MythicLib-1.1.1.jar!/" />
<root url="jar://$PROJECT_DIR$/../../Tools/Build Tools/Jar Libraries/MythicLib-1.1.3.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />

View File

@ -17,7 +17,7 @@
<orderEntry type="library" name="CustomItemsAPI_PLACEHOLDER" level="project" />
<orderEntry type="library" name="ChestSort" level="project" />
<orderEntry type="library" name="PlaceholderAPI-2.10.9" level="project" />
<orderEntry type="library" name="MMOItems-6.6.0" level="project" />
<orderEntry type="library" name="MythicLib-1.1.1" level="project" />
<orderEntry type="library" name="MMOItems-6.6.1" level="project" />
<orderEntry type="library" name="MythicLib-1.1.3" level="project" />
</component>
</module>

View File

@ -1,4 +1,4 @@
version: 3.17.1.2
version: 3.17.1.3
main: me.rockyhawk.commandpanels.CommandPanels
name: CommandPanels
author: RockyHawk

View File

@ -311,6 +311,12 @@ public class CommandPanels extends JavaPlugin{
//hiding attributes will add an NBT tag
if(hideAttributes) {
renamedMeta.addItemFlags(ItemFlag.HIDE_ATTRIBUTES);
renamedMeta.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS);
renamedMeta.addItemFlags(ItemFlag.HIDE_ENCHANTS);
//HIDE_DYE was added into 1.17 api
if(legacy.LOCAL_VERSION.greaterThanOrEqualTo(MinecraftVersions.v1_17)){
renamedMeta.addItemFlags(ItemFlag.HIDE_DYE);
}
}
if (customName != null) {
renamedMeta.setDisplayName(customName);

View File

@ -319,10 +319,24 @@ public class ItemCreation {
//if the item is a potion, give it an effect
try {
PotionMeta potionMeta = (PotionMeta)s.getItemMeta();
String effectType = itemSection.getString("potion");
String[] effectType = itemSection.getString("potion").split("\\s");
assert potionMeta != null;
assert effectType != null;
potionMeta.setBasePotionData(new PotionData(PotionType.valueOf(effectType.toUpperCase())));
boolean extended = false;
boolean upgraded = false;
//create data
if(effectType.length >= 2){
if(effectType[1].equalsIgnoreCase("true")){
extended = true;
}
if(effectType.length == 3){
if(effectType[2].equalsIgnoreCase("true")){
upgraded = true;
}
}
}
PotionData newData = new PotionData(PotionType.valueOf(effectType[0].toUpperCase()),extended,upgraded);
//set meta
potionMeta.setBasePotionData(newData);
potionMeta.addItemFlags(ItemFlag.HIDE_POTION_EFFECTS);
s.setItemMeta(potionMeta);
} catch (Exception er) {
@ -459,7 +473,7 @@ public class ItemCreation {
/*
The ItemStack 'one' will be used, if it doesn't have a lore for example, it won't check to see if the other does have one
The isIdentical() function will check for the following
Material, Name, Lore, Enchanted
Material, Name, Lore, Enchanted, Potion
*/
@SuppressWarnings("deprecation")
public boolean isIdentical(ItemStack one, ItemStack two){
@ -497,6 +511,23 @@ public class ItemCreation {
}
}
} catch (Exception ignore) {}
//check for potions
try {
PotionMeta meta1 = (PotionMeta) one.getItemMeta();
PotionMeta meta2 = (PotionMeta) two.getItemMeta();
//different duration
if(meta1.getBasePotionData().isExtended() != meta2.getBasePotionData().isExtended()){
return false;
}
//different upgrade
if(meta1.getBasePotionData().isUpgraded() != meta2.getBasePotionData().isUpgraded()){
return false;
}
//different potion type
if (meta1.getBasePotionData().getType().compareTo(meta2.getBasePotionData().getType()) != 0){
return false;
}
}catch(Exception ignore){}
//check for enchantments
if(one.getEnchantments() == two.getEnchantments()){
if(!one.getEnchantments().isEmpty()) {