Jelajahi Sumber

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

Also added treasures.yml to the zip backup.

GJ 13 tahun lalu
induk
melakukan
6cc207a10c

+ 2 - 1
Changelog.txt

@@ -14,9 +14,10 @@ Version 1.3.07
  + Added a permission node for Greater Impact ability
  + Added permission nodes for Treasure & Magic Hunter for Fishing
  + 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 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 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

+ 2 - 2
src/main/java/com/gmail/nossr50/listeners/PlayerListener.java

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

+ 11 - 11
src/main/java/com/gmail/nossr50/util/Item.java

@@ -18,25 +18,25 @@ public class Item {
      *
      * @param player Player whose item usage to check
      */
-    public static void itemchecks(Player player) {
-        ItemStack inhand = player.getItemInHand();
+    public static void itemChecks(Player player) {
+        ItemStack inHand = player.getItemInHand();
 
-        if (Config.getInstance().getChimaeraEnabled() && inhand.getTypeId() == Config.getInstance().getChimaeraItemId()) {
-            chimaerawing(player);
+        if (Config.getInstance().getChimaeraEnabled() && inHand.getTypeId() == Config.getInstance().getChimaeraItemId()) {
+            chimaeraWing(player);
         }
     }
 
-    private static void chimaerawing(Player player) {
+    private static void chimaeraWing(Player player) {
         PlayerProfile PP = Users.getProfile(player);
-        ItemStack is = player.getItemInHand();
+        ItemStack inHand = player.getItemInHand();
         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()) {
                 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)) {
                         player.sendMessage(LocaleLoader.getString("Item.ChimaeraWing.Fail"));
                         player.teleport(block.getRelative(0, y - 1, 0).getLocation());
@@ -53,10 +53,10 @@ public class Item {
 
                 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)}));
             }
-            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()));
             }
         }

+ 2 - 1
src/main/java/net/shatteredlands/shatt/backup/ZipLibrary.java

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