Fixed bug with Chimera Wing failing when used on half-blocks - Fixes

MCCORE-221

Also added treasures.yml to the zip backup.
This commit is contained in:
GJ 2012-05-01 08:28:54 -04:00
parent 6b5e615a23
commit 6cc207a10c
4 changed files with 17 additions and 15 deletions

View File

@ -14,9 +14,10 @@ Version 1.3.07
+ Added a permission node for Greater Impact ability + Added a permission node for Greater Impact ability
+ Added permission nodes for Treasure & Magic Hunter for Fishing + Added permission nodes for Treasure & Magic Hunter for Fishing
+ Added config options for enabling/disabling specific double drops + Added config options for enabling/disabling specific double drops
+ Added automatic zip backup of flatfile database + Added automatic zip backup of flatfile database & config files
= Fixed bug where the permission node for Impact didn't work = Fixed bug where the permission node for Impact didn't work
= Fixed some bypass nodes defaulting true for Ops = Fixed some bypass nodes defaulting true for Ops
= Fixed bug with trying to use Chimera Wing while standing on a half-block
! Changed Mining to ignore blocks when the pick is enchanted with Silk Touch ! Changed Mining to ignore blocks when the pick is enchanted with Silk Touch
! Changed Super Breaker to be non-functional when used with a Silk Touch enchanted pick ! Changed Super Breaker to be non-functional when used with a Silk Touch enchanted pick
! Changed MySQL to save player information 50ms apart from each other to reduce the load on the MySQL server ! Changed MySQL to save player information 50ms apart from each other to reduce the load on the MySQL server

View File

@ -228,7 +228,7 @@ public class PlayerListener implements Listener {
/* ITEM CHECKS */ /* ITEM CHECKS */
if (BlockChecks.abilityBlockCheck(mat)) { if (BlockChecks.abilityBlockCheck(mat)) {
Item.itemchecks(player); Item.itemChecks(player);
} }
/* BLAST MINING CHECK */ /* BLAST MINING CHECK */
@ -252,7 +252,7 @@ public class PlayerListener implements Listener {
} }
/* ITEM CHECKS */ /* ITEM CHECKS */
Item.itemchecks(player); Item.itemChecks(player);
/* BLAST MINING CHECK */ /* BLAST MINING CHECK */
if (player.isSneaking() && Permissions.getInstance().blastMining(player) && is.getTypeId() == Config.getInstance().getDetonatorItemID()) { if (player.isSneaking() && Permissions.getInstance().blastMining(player) && is.getTypeId() == Config.getInstance().getDetonatorItemID()) {

View File

@ -18,25 +18,25 @@ public class Item {
* *
* @param player Player whose item usage to check * @param player Player whose item usage to check
*/ */
public static void itemchecks(Player player) { public static void itemChecks(Player player) {
ItemStack inhand = player.getItemInHand(); ItemStack inHand = player.getItemInHand();
if (Config.getInstance().getChimaeraEnabled() && inhand.getTypeId() == Config.getInstance().getChimaeraItemId()) { if (Config.getInstance().getChimaeraEnabled() && inHand.getTypeId() == Config.getInstance().getChimaeraItemId()) {
chimaerawing(player); chimaeraWing(player);
} }
} }
private static void chimaerawing(Player player) { private static void chimaeraWing(Player player) {
PlayerProfile PP = Users.getProfile(player); PlayerProfile PP = Users.getProfile(player);
ItemStack is = player.getItemInHand(); ItemStack inHand = player.getItemInHand();
Block block = player.getLocation().getBlock(); Block block = player.getLocation().getBlock();
int amount = is.getAmount(); int amount = inHand.getAmount();
if (Permissions.getInstance().chimaeraWing(player) && is.getTypeId() == Config.getInstance().getChimaeraItemId()) { if (Permissions.getInstance().chimaeraWing(player) && inHand.getTypeId() == Config.getInstance().getChimaeraItemId()) {
if (Skills.cooldownOver(PP.getRecentlyHurt(), 60) && amount >= Config.getInstance().getChimaeraCost()) { if (Skills.cooldownOver(PP.getRecentlyHurt(), 60) && amount >= Config.getInstance().getChimaeraCost()) {
player.setItemInHand(new ItemStack(Config.getInstance().getChimaeraItemId(), amount - Config.getInstance().getChimaeraCost())); player.setItemInHand(new ItemStack(Config.getInstance().getChimaeraItemId(), amount - Config.getInstance().getChimaeraCost()));
for (int y = 0; block.getY() + y < player.getWorld().getMaxHeight(); y++) { for (int y = 1; block.getY() + y < player.getWorld().getMaxHeight(); y++) {
if (!block.getRelative(0, y, 0).getType().equals(Material.AIR)) { if (!block.getRelative(0, y, 0).getType().equals(Material.AIR)) {
player.sendMessage(LocaleLoader.getString("Item.ChimaeraWing.Fail")); player.sendMessage(LocaleLoader.getString("Item.ChimaeraWing.Fail"));
player.teleport(block.getRelative(0, y - 1, 0).getLocation()); player.teleport(block.getRelative(0, y - 1, 0).getLocation());
@ -53,10 +53,10 @@ public class Item {
player.sendMessage(LocaleLoader.getString("Item.ChimaeraWing.Pass")); player.sendMessage(LocaleLoader.getString("Item.ChimaeraWing.Pass"));
} }
else if (!Skills.cooldownOver(PP.getRecentlyHurt(), 60) && is.getAmount() >= Config.getInstance().getChimaeraCost()) { else if (!Skills.cooldownOver(PP.getRecentlyHurt(), 60) && amount >= Config.getInstance().getChimaeraCost()) {
player.sendMessage(LocaleLoader.getString("Item.Injured.Wait", new Object[] {Skills.calculateTimeLeft(PP.getRecentlyHurt(), 60)})); player.sendMessage(LocaleLoader.getString("Item.Injured.Wait", new Object[] {Skills.calculateTimeLeft(PP.getRecentlyHurt(), 60)}));
} }
else if (is.getAmount() <= Config.getInstance().getChimaeraCost()) { else if (amount <= Config.getInstance().getChimaeraCost()) {
player.sendMessage(LocaleLoader.getString("Skills.NeedMore")+ " " + ChatColor.GRAY + Misc.prettyItemString(Config.getInstance().getChimaeraItemId())); player.sendMessage(LocaleLoader.getString("Skills.NeedMore")+ " " + ChatColor.GRAY + Misc.prettyItemString(Config.getInstance().getChimaeraItemId()));
} }
} }

View File

@ -22,6 +22,7 @@ public class ZipLibrary {
private static File FlatFileDirectory = new File(mcMMO.flatFileDirectory); private static File FlatFileDirectory = new File(mcMMO.flatFileDirectory);
private static File UsersFile = new File(mcMMO.usersFile); private static File UsersFile = new File(mcMMO.usersFile);
private static File ConfigFile = new File(mcMMO.mainDirectory + "config.yml"); private static File ConfigFile = new File(mcMMO.mainDirectory + "config.yml");
private static File TreasuresFile = new File(mcMMO.mainDirectory + "treasures.yml");
private static File Leaderboards = new File(mcMMO.leaderboardDirectory); private static File Leaderboards = new File(mcMMO.leaderboardDirectory);
public static void mcMMObackup() throws IOException { public static void mcMMObackup() throws IOException {
@ -37,7 +38,6 @@ public class ZipLibrary {
} catch (Exception e) { } catch (Exception e) {
mcMMO.p.getLogger().severe(e.toString()); mcMMO.p.getLogger().severe(e.toString());
} }
//Generate the proper date for the backup filename //Generate the proper date for the backup filename
Date date = new Date(); Date date = new Date();
@ -49,6 +49,7 @@ public class ZipLibrary {
sources.add(FlatFileDirectory); sources.add(FlatFileDirectory);
sources.add(UsersFile); sources.add(UsersFile);
sources.add(ConfigFile); sources.add(ConfigFile);
sources.add(TreasuresFile);
sources.add(Leaderboards); sources.add(Leaderboards);
//Actually do something //Actually do something