Minor update

- Fixed startup message saying noFlightDurability is disabled when it's
actually enabled and vice-versa.
- Improved order of noFlightDurability checking. It's faster now.
- Fixed default message saying that BigDoors couldn't find the message.
This commit is contained in:
Pim van der Loos 2019-05-21 13:09:59 +02:00
parent 45486a7eea
commit 81e4111359
No known key found for this signature in database
GPG Key ID: C16F020ADAE6D5A8
4 changed files with 12 additions and 7 deletions

View File

@ -110,10 +110,10 @@ public class ArmoredElytra extends JavaPlugin implements Listener
if (config.noFlightDurability())
{
Bukkit.getPluginManager().registerEvents(new FlyDurabilityHandler(nbtEditor), this);
myLogger(Level.INFO, "Durability penalty for flying disabled!");
myLogger(Level.INFO, "Durability penalty for flying enabled!");
}
else
myLogger(Level.INFO, "Durability penalty for flying enabled!");
myLogger(Level.INFO, "Durability penalty for flying disabled!");
// Log all allowed enchantments.
myLogger(Level.INFO, ("Allowed enchantments:"));

View File

@ -303,9 +303,11 @@ public class EventHandlers implements Listener
enchantments = combineEnchantments(enchantments, meta.getStoredEnchants());
break;
}
//$FALL-THROUGH$
case BLOCK:
event.setResult(null);
player.updateInventory();
//$FALL-THROUGH$
case NONE:
return;
}

View File

@ -22,9 +22,12 @@ public class FlyDurabilityHandler implements Listener
@EventHandler
public void onItemDamage(PlayerItemDamageEvent e)
{
if (e.getItem().getType() == Material.ELYTRA)
if (nbtEditor.getArmorTier(e.getItem()) != ArmorTier.NONE)
if (e.getPlayer().isFlying())
e.setCancelled(true);
if (e.getItem().getType() != Material.ELYTRA)
return;
if (!e.getPlayer().isFlying())
return;
if (nbtEditor.getArmorTier(e.getItem()) != ArmorTier.NONE)
e.setCancelled(true);
}
}

View File

@ -87,7 +87,7 @@ public class Messages
value = messageMap.get(key);
if (value == null)
{
value = "BigDoors: Translation not found! Contact server admin!";
value = "ArmoredElytra: Translation not found! Contact server admin!";
plugin.myLogger(Level.WARNING, "Failed to get translation for key " + key);
}
return value;