Skip to content

Commit

Permalink
might fix #70
Browse files Browse the repository at this point in the history
  • Loading branch information
Richard Harrah committed Jan 30, 2013
1 parent 1d0c718 commit 4fdc0f6
Showing 1 changed file with 100 additions and 95 deletions.
195 changes: 100 additions & 95 deletions src/com/modcrafting/diablodrops/drops/DropsAPI.java
Original file line number Diff line number Diff line change
Expand Up @@ -323,31 +323,32 @@ else if (plugin.getConfig().getBoolean("Display.TierName", true)
}
Enchantment ench = eStack.get(plugin.getSingleRandom()
.nextInt(size));
if ((lvl != 0) && (ench != null)
&& !tier.getColor().equals(ChatColor.MAGIC))
if (safe)
{
if ((lvl >= ench.getStartLevel())
&& (lvl <= ench.getMaxLevel()))
if (!ci.containsEnchantment(ench))
if ((lvl != 0) && (ench != null)
&& !tier.getColor().equals(ChatColor.MAGIC))
if (safe)
{
try
{
ci.addEnchantment(ench, lvl);
}
catch (Exception e1)
if ((lvl >= ench.getStartLevel())
&& (lvl <= ench.getMaxLevel()))
{
if (plugin.getDebug())
try
{
plugin.log.warning(e1.getMessage());
ci.addEnchantment(ench, lvl);
}
catch (Exception e1)
{
if (plugin.getDebug())
{
plugin.log.warning(e1.getMessage());
}
e++;
}
e++;
}
}
}
else
{
ci.addUnsafeEnchantment(ench, lvl);
}
else
{
ci.addUnsafeEnchantment(ench, lvl);
}
}
ItemMeta tool;
if (ci.hasItemMeta())
Expand Down Expand Up @@ -466,31 +467,32 @@ public ItemStack getItem(final ItemStack oldTool)
}
Enchantment ench = eStack.get(plugin.getSingleRandom()
.nextInt(size));
if ((lvl != 0) && (ench != null)
&& !tier.getColor().equals(ChatColor.MAGIC))
if (safe)
{
if ((lvl >= ench.getStartLevel())
&& (lvl <= ench.getMaxLevel()))
if (!tool.containsEnchantment(ench))
if ((lvl != 0) && (ench != null)
&& !tier.getColor().equals(ChatColor.MAGIC))
if (safe)
{
try
{
tool.addEnchantment(ench, lvl);
}
catch (Exception e1)
if ((lvl >= ench.getStartLevel())
&& (lvl <= ench.getMaxLevel()))
{
if (plugin.getDebug())
try
{
plugin.log.warning(e1.getMessage());
tool.addEnchantment(ench, lvl);
}
catch (Exception e1)
{
if (plugin.getDebug())
{
plugin.log.warning(e1.getMessage());
}
e++;
}
e++;
}
}
}
else
{
tool.addUnsafeEnchantment(ench, lvl);
}
else
{
tool.addUnsafeEnchantment(ench, lvl);
}
}
ItemMeta meta;
if (tool.hasItemMeta())
Expand Down Expand Up @@ -601,31 +603,32 @@ else if (plugin.getConfig().getBoolean("Display.TierName", true)
}
Enchantment ench = eStack.get(plugin.getSingleRandom()
.nextInt(size));
if ((lvl != 0) && (ench != null)
&& !tier.getColor().equals(ChatColor.MAGIC))
if (safe)
{
if ((lvl >= ench.getStartLevel())
&& (lvl <= ench.getMaxLevel()))
if (!tool.containsEnchantment(ench))
if ((lvl != 0) && (ench != null)
&& !tier.getColor().equals(ChatColor.MAGIC))
if (safe)
{
try
{
tool.addEnchantment(ench, lvl);
}
catch (Exception e1)
if ((lvl >= ench.getStartLevel())
&& (lvl <= ench.getMaxLevel()))
{
if (plugin.getDebug())
try
{
tool.addEnchantment(ench, lvl);
}
catch (Exception e1)
{
plugin.log.warning(e1.getMessage());
if (plugin.getDebug())
{
plugin.log.warning(e1.getMessage());
}
e++;
}
e++;
}
}
}
else
{
tool.addUnsafeEnchantment(ench, lvl);
}
else
{
tool.addUnsafeEnchantment(ench, lvl);
}
}
ItemMeta meta;
if (tool.hasItemMeta())
Expand Down Expand Up @@ -744,31 +747,32 @@ else if (plugin.getConfig().getBoolean("Display.TierName", true)
}
Enchantment ench = eStack.get(plugin.getSingleRandom()
.nextInt(size));
if ((lvl != 0) && (ench != null)
&& !tier.getColor().equals(ChatColor.MAGIC))
if (safe)
{
if ((lvl >= ench.getStartLevel())
&& (lvl <= ench.getMaxLevel()))
if (!tool.containsEnchantment(ench))
if ((lvl != 0) && (ench != null)
&& !tier.getColor().equals(ChatColor.MAGIC))
if (safe)
{
try
if ((lvl >= ench.getStartLevel())
&& (lvl <= ench.getMaxLevel()))
{
tool.addEnchantment(ench, lvl);
}
catch (Exception e1)
{
if (plugin.getDebug())
try
{
tool.addEnchantment(ench, lvl);
}
catch (Exception e1)
{
plugin.log.warning(e1.getMessage());
if (plugin.getDebug())
{
plugin.log.warning(e1.getMessage());
}
e++;
}
e++;
}
}
}
else
{
tool.addUnsafeEnchantment(ench, lvl);
}
else
{
tool.addUnsafeEnchantment(ench, lvl);
}
}
ItemMeta meta;
if (tool.hasItemMeta())
Expand Down Expand Up @@ -885,31 +889,32 @@ else if (plugin.getConfig().getBoolean("Display.TierName", true)
}
Enchantment ench = eStack.get(plugin.getSingleRandom()
.nextInt(size));
if ((lvl != 0) && (ench != null)
&& !tier.getColor().equals(ChatColor.MAGIC))
if (safe)
{
if ((lvl >= ench.getStartLevel())
&& (lvl <= ench.getMaxLevel()))
if (!tool.containsEnchantment(ench))
if ((lvl != 0) && (ench != null)
&& !tier.getColor().equals(ChatColor.MAGIC))
if (safe)
{
try
if ((lvl >= ench.getStartLevel())
&& (lvl <= ench.getMaxLevel()))
{
tool.addEnchantment(ench, lvl);
}
catch (Exception e1)
{
if (plugin.getDebug())
try
{
tool.addEnchantment(ench, lvl);
}
catch (Exception e1)
{
plugin.log.warning(e1.getMessage());
if (plugin.getDebug())
{
plugin.log.warning(e1.getMessage());
}
e++;
}
e++;
}
}
}
else
{
tool.addUnsafeEnchantment(ench, lvl);
}
else
{
tool.addUnsafeEnchantment(ench, lvl);
}
}
ItemMeta meta = tool.getItemMeta();
if (plugin.getConfig().getBoolean("Lore.Enabled", true)
Expand Down

0 comments on commit 4fdc0f6

Please sign in to comment.