- Fixed leather elytra being unenchantable.
- Added color codes support
This commit is contained in:
parent
23889c0845
commit
61a8c872cb
2
pom.xml
2
pom.xml
@ -1,7 +1,7 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion>
|
||||
<groupId>nl.pim16aap2</groupId>
|
||||
<artifactId>ArmoredElytra</artifactId>
|
||||
<version>1.7.0-SNAPSHOT</version>
|
||||
<version>1.7.2-SNAPSHOT</version>
|
||||
|
||||
|
||||
<repositories>
|
||||
|
@ -47,11 +47,11 @@ public class ArmoredElytra extends JavaPlugin implements Listener
|
||||
config.addDefault("allowCurses", true);
|
||||
config.addDefault("allowedEnchantments", new String[]{"DURABILITY","PROTECTION_FIRE","PROTECTION_EXPLOSIONS",
|
||||
"PROTECTION_PROJECTILE","PROTECTION_ENVIRONMENTAL","THORNS"});
|
||||
config.addDefault("usageDeniedMessage", "You do not have the required permissions to wear %ARMOR_TIER% armored elytras!");
|
||||
config.addDefault("elytraReceivedMessage", "A(n) %ARMOR_TIER% armored elytra has been bestowed upon you!");
|
||||
config.addDefault("usageDeniedMessage", "&CYou do not have the required permissions to wear %ARMOR_TIER% armored elytras!");
|
||||
config.addDefault("elytraReceivedMessage", "&2A(n) %ARMOR_TIER% armored elytra has been bestowed upon you!");
|
||||
|
||||
config.addDefault("elytraName", "%ARMOR_TIER% Armored Elytra");
|
||||
config.addDefault("elytraLore", "Elytra with %ARMOR_TIER% level protection.");
|
||||
config.addDefault("elytraLore", "&DElytra with %ARMOR_TIER% level protection.");
|
||||
|
||||
config.addDefault("checkForUpdates", true);
|
||||
saveDefaultConfig();
|
||||
@ -63,10 +63,12 @@ public class ArmoredElytra extends JavaPlugin implements Listener
|
||||
cursesAllowed = config.getBoolean("allowCurses", true);
|
||||
List<String> list = config.getStringList("allowedEnchantments");
|
||||
allowedEnchants = list.toArray(new String[0]);
|
||||
usageDeniedMessage = config.getString("usageDeniedMessage");
|
||||
elytraReceivedMessage = config.getString("elytraReceivedMessage");
|
||||
elytraName = config.getString("elytraName");
|
||||
elytraLore = config.getString("elytraLore");
|
||||
|
||||
usageDeniedMessage = config.getString("usageDeniedMessage").replaceAll("(&([a-f0-9]))", "\u00A7$2");;
|
||||
elytraReceivedMessage = config.getString("elytraReceivedMessage").replaceAll("(&([a-f0-9]))", "\u00A7$2");;
|
||||
elytraName = config.getString("elytraName").replaceAll("(&([a-f0-9]))", "\u00A7$2");;
|
||||
elytraLore = config.getString("elytraLore").replaceAll("(&([a-f0-9]))", "\u00A7$2");;
|
||||
|
||||
checkForUpdates = config.getBoolean("checkForUpdates");
|
||||
|
||||
usageDeniedMessage = (Objects.equals(usageDeniedMessage, new String("NONE")) ? null : usageDeniedMessage);
|
||||
|
@ -49,7 +49,6 @@ public class EventHandlers implements Listener
|
||||
this.IRON_TO_FULL = IRON_TO_FULL;
|
||||
}
|
||||
|
||||
|
||||
// Clear the anvil's inventory (destroy all the items in all 3 slots (second slot is not emptied, when repairing you can safely give multiple items)).
|
||||
public void cleanAnvil(AnvilInventory anvilInventory)
|
||||
{
|
||||
@ -58,7 +57,6 @@ public class EventHandlers implements Listener
|
||||
anvilInventory.getItem(2).setAmount(0);
|
||||
}
|
||||
|
||||
|
||||
// Check if the enchantment is allowed on elytras.
|
||||
public boolean isAllowedEnchantment(Enchantment enchant)
|
||||
{
|
||||
@ -75,7 +73,6 @@ public class EventHandlers implements Listener
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
// Check if the enchantment is a curse.
|
||||
public boolean isCursedEnchantment(Enchantment enchant)
|
||||
{
|
||||
@ -168,7 +165,6 @@ public class EventHandlers implements Listener
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
// Copy enchants of 2 items to one item.
|
||||
public ItemStack repairItem(ItemStack one, ItemStack two)
|
||||
{
|
||||
@ -201,7 +197,6 @@ public class EventHandlers implements Listener
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
// Handle the anvil related parts.
|
||||
@EventHandler
|
||||
public void onInventoryClick(InventoryClickEvent e)
|
||||
@ -253,8 +248,7 @@ public class EventHandlers implements Listener
|
||||
result = null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Check if there are items in both input slots.
|
||||
if (itemA != null && itemB != null)
|
||||
{
|
||||
@ -305,7 +299,7 @@ public class EventHandlers implements Listener
|
||||
}
|
||||
// If the player tries to repair an armored elytra. Check if the armor tier and the repair item match.
|
||||
// If the repair item is leather it can only repair
|
||||
else if ((itemB.getType() == Material.LEATHER && (!isArmoredElytra(itemA)) || currentArmorTier == 1) ||
|
||||
else if ((itemB.getType() == Material.LEATHER && isArmoredElytra(itemA) && currentArmorTier == 1) ||
|
||||
(itemB.getType() == Material.GOLD_INGOT && isArmoredElytra(itemA) && currentArmorTier == 2) ||
|
||||
(itemB.getType() == Material.IRON_INGOT && isArmoredElytra(itemA) && currentArmorTier == 3) ||
|
||||
(itemB.getType() == Material.IRON_INGOT && isArmoredElytra(itemA) && currentArmorTier == 4) ||
|
||||
@ -364,8 +358,6 @@ public class EventHandlers implements Listener
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Because the armored elytra doesn't actually give any armor, the damage received by players wearing an armored elytra is calculated here.
|
||||
@EventHandler
|
||||
public void onPlayerDamage(EntityDamageEvent e)
|
||||
@ -418,7 +410,6 @@ public class EventHandlers implements Listener
|
||||
p.getInventory().getChestplate().setAmount(0);
|
||||
}
|
||||
|
||||
|
||||
// Check if the player tries to equip armor by richt clicking it.
|
||||
@SuppressWarnings("deprecation")
|
||||
@EventHandler
|
||||
@ -433,11 +424,11 @@ public class EventHandlers implements Listener
|
||||
if (item.getType() == Material.ELYTRA && isArmoredElytra(item))
|
||||
{
|
||||
int armorTier = nbtEditor.getArmorTier(item);
|
||||
if ((armorTier == 1 && !player.hasPermission("armoredelytra.wear.leather")) ||
|
||||
(armorTier == 2 && !player.hasPermission("armoredelytra.wear.gold")) ||
|
||||
(armorTier == 3 && !player.hasPermission("armoredelytra.wear.chain")) ||
|
||||
(armorTier == 4 && !player.hasPermission("armoredelytra.wear.iron")) ||
|
||||
(armorTier == 5 && !player.hasPermission("armoredelytra.wear.diamond")))
|
||||
if ((armorTier == 1 && !player.hasPermission("armoredelytra.wear.leather")) ||
|
||||
(armorTier == 2 && !player.hasPermission("armoredelytra.wear.gold")) ||
|
||||
(armorTier == 3 && !player.hasPermission("armoredelytra.wear.chain")) ||
|
||||
(armorTier == 4 && !player.hasPermission("armoredelytra.wear.iron")) ||
|
||||
(armorTier == 5 && !player.hasPermission("armoredelytra.wear.diamond")))
|
||||
{
|
||||
plugin.usageDeniedMessage(player, armorTier);
|
||||
event.setCancelled(true);
|
||||
|
@ -1,6 +1,6 @@
|
||||
name: ArmoredElytra
|
||||
main: nl.pim16aap2.armoredElytra.ArmoredElytra
|
||||
version: 1.7.0
|
||||
version: 1.7.2
|
||||
author: Pim
|
||||
commands:
|
||||
ArmoredElytra:
|
||||
|
Loading…
x
Reference in New Issue
Block a user