Skip to content

Commit

Permalink
Allow custom items to be used as armor
Browse files Browse the repository at this point in the history
  • Loading branch information
CJCrafter committed Jun 23, 2023
1 parent 48c3f8e commit 3e97857
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
8 changes: 4 additions & 4 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar

group = "me.cjcrafter"
version = "2.0.3"
version = "2.1.0"

plugins {
`java-library`
Expand Down Expand Up @@ -58,9 +58,9 @@ repositories {
dependencies {
compileOnly("org.spigotmc:spigot-api:1.19.3-R0.1-SNAPSHOT")
implementation("io.lumine:Mythic-Dist:5.0.1-SNAPSHOT")
compileOnly("me.deecaad:mechanicscore:2.0.1")
compileOnly("me.deecaad:weaponmechanics:2.0.1")
implementation("org.bstats:bstats-bukkit:3.0.0")
compileOnly("me.deecaad:mechanicscore:2.4.1")
compileOnly("me.deecaad:weaponmechanics:2.4.1")
implementation("org.bstats:bstats-bukkit:3.0.1")
implementation("me.cjcrafter:mechanicsautodownload:1.1.2")
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ public ItemStack serialize(SerializeData data) throws SerializerException {
public static boolean isArmor(ItemStack item) {
String name = item.getType().name();

// Let people turn off the isArmor() check since *technically*
// any item can be equipped.
if (!ArmorMechanics.INSTANCE.getConfig().getBoolean("Prevent_Illegal_Armor", true))
return true;

return name.equals("PLAYER_HEAD") || name.equals("CARVED_PUMPKIN")
|| name.endsWith("_HELMET") || name.endsWith("_CHESTPLATE")
|| name.endsWith("_LEGGINGS") || name.endsWith("_BOOTS");
Expand Down
6 changes: 3 additions & 3 deletions src/main/resources/ArmorMechanics/Armor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ Heavy_Chestplate:
- " <dark_gray>[<red>-<dark_gray>] <gray>Decreased movement speed"
- " "
- "&6Full Set Bonus: &oNone"
- "<gray>Prevents you from getting poisoned or withered"
- "<gray>It's plenty strong already"
Hide_Flags: true
Unbreakable: true
Attributes:
Expand All @@ -271,7 +271,7 @@ Heavy_Leggings:
- " <dark_gray>[<red>-<dark_gray>] <gray>Decreased movement speed"
- " "
- "&6Full Set Bonus: &oNone"
- "<gray>Prevents you from getting poisoned or withered"
- "<gray>It's plenty strong already"
Hide_Flags: true
Unbreakable: true
Attributes:
Expand All @@ -291,7 +291,7 @@ Heavy_Boots:
- " <dark_gray>[<red>-<dark_gray>] <gray>Decreased movement speed"
- " "
- "&6Full Set Bonus: &oNone"
- "<gray>Prevents you from getting poisoned or withered"
- "<gray>It's plenty strong already"
Hide_Flags: true
Unbreakable: true
Attributes:
Expand Down
5 changes: 5 additions & 0 deletions src/main/resources/ArmorMechanics/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ Print_Traces: false
# Setting this to false will allow players to place heads on the ground
Prevent_Armor_Place: true

# Setting this to false will allow you to use non-armor items. Players will
# not be able to manually click to equip these armors, but you can use commands
# to force equip the item. In general, I recommend you keep this as true
Prevent_Illegal_Armor: true

# Settings this to true will cause ArmorMechanics to delete any armor item that
# no longer exists in config. We have this disabled by default, as this may annoy your playerbase
#
Expand Down

0 comments on commit 3e97857

Please # to comment.