nossr50 hai 1 ano
pai
achega
5ba6305ad4

+ 6 - 1
Changelog.txt

@@ -1,11 +1,16 @@
 Version 2.2.007
 Version 2.2.007
     Compatibility with the 1.20.5 / 1.20.6 MC Update
     Compatibility with the 1.20.5 / 1.20.6 MC Update
     Fixed bug where Alchemy was not brewing certain potions (haste, etc)
     Fixed bug where Alchemy was not brewing certain potions (haste, etc)
+    Tree Feller no longer restricts how many saplings can drop
+    Tree Feller now drops leaves 25% of the time (up from 10%)
+    Alchemy XP has been DRAMATICALLY increased, it was extremely grindy by default
+    Alchemy experience values in experience.yml are now found under 'Experience_Values.Alchemy.Potion_Brewing'
     Fixed bug where the probability of success of Graceful Roll was not being calculated correctly
     Fixed bug where the probability of success of Graceful Roll was not being calculated correctly
-    Added armadillo to combat experience in experience.yml
     Fixed bug where Green Thumb did not replant if seed was in the off hand
     Fixed bug where Green Thumb did not replant if seed was in the off hand
+    Added armadillo to combat experience in experience.yml
 
 
     NOTES:
     NOTES:
+    While fixing various Alchemy bugs, I noticed Alchemy leveled SUPER slow, I have increased it dramatically. Feel free to change it back by modifying the new values in experience.yml
     I did my best to keep mcMMO compatible with older versions of Minecraft for this update.
     I did my best to keep mcMMO compatible with older versions of Minecraft for this update.
     This update to MC was quite large, with breaking changes to a lot of code relating to Alchemy, and some other things.
     This update to MC was quite large, with breaking changes to a lot of code relating to Alchemy, and some other things.
     I expect there to be bugs, please report them on GitHub or Discord, but preferably GitHub.
     I expect there to be bugs, please report them on GitHub or Discord, but preferably GitHub.

+ 9 - 9
pom.xml

@@ -2,7 +2,7 @@
     <modelVersion>4.0.0</modelVersion>
     <modelVersion>4.0.0</modelVersion>
     <groupId>com.gmail.nossr50.mcMMO</groupId>
     <groupId>com.gmail.nossr50.mcMMO</groupId>
     <artifactId>mcMMO</artifactId>
     <artifactId>mcMMO</artifactId>
-    <version>2.2.007-SNAPSHOT</version>
+    <version>2.2.007</version>
     <name>mcMMO</name>
     <name>mcMMO</name>
     <url>https://github.com/mcMMO-Dev/mcMMO</url>
     <url>https://github.com/mcMMO-Dev/mcMMO</url>
     <scm>
     <scm>
@@ -304,37 +304,37 @@
         <dependency>
         <dependency>
             <groupId>net.kyori</groupId>
             <groupId>net.kyori</groupId>
             <artifactId>adventure-text-serializer-gson</artifactId>
             <artifactId>adventure-text-serializer-gson</artifactId>
-            <version>4.15.0</version>
+            <version>4.16.0</version>
         </dependency>
         </dependency>
         <dependency>
         <dependency>
             <groupId>net.kyori</groupId>
             <groupId>net.kyori</groupId>
             <artifactId>adventure-text-serializer-gson-legacy-impl</artifactId>
             <artifactId>adventure-text-serializer-gson-legacy-impl</artifactId>
-            <version>4.15.0</version>
+            <version>4.16.0</version>
         </dependency>
         </dependency>
         <dependency>
         <dependency>
             <groupId>net.kyori</groupId>
             <groupId>net.kyori</groupId>
             <artifactId>adventure-text-serializer-json</artifactId>
             <artifactId>adventure-text-serializer-json</artifactId>
-            <version>4.15.0</version>
+            <version>4.16.0</version>
         </dependency>
         </dependency>
         <dependency>
         <dependency>
             <groupId>net.kyori</groupId>
             <groupId>net.kyori</groupId>
             <artifactId>adventure-text-serializer-json-legacy-impl</artifactId>
             <artifactId>adventure-text-serializer-json-legacy-impl</artifactId>
-            <version>4.15.0</version>
+            <version>4.16.0</version>
         </dependency>
         </dependency>
         <dependency>
         <dependency>
             <groupId>net.kyori</groupId>
             <groupId>net.kyori</groupId>
             <artifactId>adventure-api</artifactId>
             <artifactId>adventure-api</artifactId>
-            <version>4.15.0</version>
+            <version>4.16.0</version>
         </dependency>
         </dependency>
         <dependency>
         <dependency>
             <groupId>net.kyori</groupId>
             <groupId>net.kyori</groupId>
             <artifactId>adventure-nbt</artifactId>
             <artifactId>adventure-nbt</artifactId>
-            <version>4.15.0</version>
+            <version>4.16.0</version>
         </dependency>
         </dependency>
         <dependency>
         <dependency>
             <groupId>net.kyori</groupId>
             <groupId>net.kyori</groupId>
             <artifactId>adventure-key</artifactId>
             <artifactId>adventure-key</artifactId>
-            <version>4.15.0</version>
+            <version>4.16.0</version>
         </dependency>
         </dependency>
         <dependency>
         <dependency>
             <groupId>net.kyori</groupId>
             <groupId>net.kyori</groupId>
@@ -375,7 +375,7 @@
         <dependency>
         <dependency>
             <groupId>org.spigotmc</groupId>
             <groupId>org.spigotmc</groupId>
             <artifactId>spigot-api</artifactId>
             <artifactId>spigot-api</artifactId>
-            <version>1.19.2-R0.1-SNAPSHOT</version>
+            <version>1.20.5-R0.1-SNAPSHOT</version>
             <scope>provided</scope>
             <scope>provided</scope>
         </dependency>
         </dependency>
         <dependency>
         <dependency>

+ 1 - 1
src/main/java/com/gmail/nossr50/config/experience/ExperienceConfig.java

@@ -467,7 +467,7 @@ public class ExperienceConfig extends BukkitConfig {
 
 
     /* Alchemy */
     /* Alchemy */
     public double getPotionXP(PotionStage stage) {
     public double getPotionXP(PotionStage stage) {
-        return config.getDouble("Experience_Values.Alchemy.Potion_Stage_" + stage.toNumerical(), 10D);
+        return config.getDouble("Experience_Values.Alchemy.Potion_Brewing.Stage_" + stage.toNumerical(), 10D);
     }
     }
 
 
     /* Archery */
     /* Archery */

+ 8 - 0
src/main/java/com/gmail/nossr50/mcMMO.java

@@ -95,6 +95,7 @@ public class mcMMO extends JavaPlugin {
     private static ChatManager chatManager;
     private static ChatManager chatManager;
     private static CommandManager commandManager; //ACF
     private static CommandManager commandManager; //ACF
     private static TransientEntityTracker transientEntityTracker;
     private static TransientEntityTracker transientEntityTracker;
+//    private static ProtocolLibManager protocolLibManager;
 
 
     private SkillTools skillTools;
     private SkillTools skillTools;
 
 
@@ -364,6 +365,9 @@ public class mcMMO extends JavaPlugin {
         if(getServer().getPluginManager().getPlugin("WorldGuard") != null) {
         if(getServer().getPluginManager().getPlugin("WorldGuard") != null) {
             WorldGuardManager.getInstance().registerFlags();
             WorldGuardManager.getInstance().registerFlags();
         }
         }
+
+        // ProtocolLib
+        // protocolLibManager = new ProtocolLibManager(this);
     }
     }
 
 
     /**
     /**
@@ -825,4 +829,8 @@ public class mcMMO extends JavaPlugin {
     public @NotNull FoliaLib getFoliaLib() {
     public @NotNull FoliaLib getFoliaLib() {
         return foliaLib;
         return foliaLib;
     }
     }
+
+//    public ProtocolLibManager getProtocolLibManager() {
+//        return protocolLibManager;
+//    }
 }
 }

+ 36 - 0
src/main/java/com/gmail/nossr50/protocollib/ProtocolHandler.java

@@ -0,0 +1,36 @@
+//package com.gmail.nossr50.protocollib;
+//
+//import com.comphenix.protocol.PacketType;
+//import com.comphenix.protocol.ProtocolLibrary;
+//import com.comphenix.protocol.ProtocolManager;
+//import com.comphenix.protocol.events.ListenerPriority;
+//import com.comphenix.protocol.events.PacketAdapter;
+//import com.comphenix.protocol.events.PacketContainer;
+//import com.comphenix.protocol.events.PacketEvent;
+//import com.gmail.nossr50.mcMMO;
+//import org.bukkit.entity.Player;
+//
+//public class ProtocolHandler {
+//    private final mcMMO pluginRef;
+//    private final ProtocolManager protocolManager;
+//
+//    public ProtocolHandler(mcMMO pluginRef) {
+//        this.pluginRef = pluginRef;
+//        this.protocolManager = ProtocolLibrary.getProtocolManager();
+//        // TODO: encapsulate this in a method
+//        protocolManager.addPacketListener(new PacketAdapter(pluginRef, ListenerPriority.NORMAL, PacketType.Play.Server.WINDOW_DATA) {
+//            @Override
+//            public void onPacketSending(PacketEvent event) {
+//                Player player = event.getPlayer();
+//                PacketContainer packet = event.getPacket();
+//                if (packet.getIntegers().read(0) == 400) {
+//                    event.setCancelled(true);
+//                }
+//            }
+//        });
+//    }
+//    public void sendPacketToPlayer(Player player) {
+//        final PacketContainer packet = protocolManager.createPacket(PacketType.Play.Server.WINDOW_DATA);
+//        protocolManager.sendServerPacket(player, packet);
+//    }
+//}

+ 40 - 18
src/main/java/com/gmail/nossr50/protocollib/ProtocolLibManager.java

@@ -1,18 +1,40 @@
-package com.gmail.nossr50.protocollib;
-
-import com.gmail.nossr50.mcMMO;
-import org.bukkit.plugin.Plugin;
-
-// TODO: Finish this class
-public class ProtocolLibManager {
-    Plugin protocolLibPluginRef;
-    mcMMO pluginRef;
-    public ProtocolLibManager(mcMMO pluginRef) {
-        this.pluginRef = pluginRef;
-    }
-
-    public boolean isProtocolLibPresent() {
-        protocolLibPluginRef = pluginRef.getServer().getPluginManager().getPlugin("ProtocolLib");
-        return protocolLibPluginRef != null;
-    }
-}
+//package com.gmail.nossr50.protocollib;
+//
+//import com.gmail.nossr50.mcMMO;
+//import org.bukkit.Bukkit;
+//import org.bukkit.entity.Player;
+//import org.bukkit.plugin.Plugin;
+//
+//public class ProtocolLibManager {
+//    final Plugin protocolLibPluginRef;
+//    final mcMMO pluginRef;
+//    final ProtocolHandler protocolHandler;
+//
+//    public ProtocolLibManager(mcMMO pluginRef) {
+//        this.pluginRef = pluginRef;
+//
+//        if (isProtocolLibPresent()) {
+//            protocolLibPluginRef = pluginRef.getServer().getPluginManager().getPlugin("ProtocolLib");
+//            protocolHandler = new ProtocolHandler(pluginRef);
+//            pluginRef.getLogger().info("ProtocolLib found, enabling ProtocolLib features.");
+//        } else {
+//            protocolLibPluginRef = null;
+//            protocolHandler = null;
+//            pluginRef.getLogger().info("No ProtocolLib found, some completely optional cosmetic features will not be enabled.");
+//        }
+//    }
+//
+//    public boolean usingProtocolLib() {
+//        return protocolLibPluginRef != null && protocolHandler != null;
+//    }
+//
+//    private boolean isProtocolLibPresent() {
+//        return Bukkit.getServer().getPluginManager().getPlugin("ProtocolLib") != null;
+//    }
+//
+//    public void sendPacketToPlayer(Player player) {
+//        if (usingProtocolLib()) {
+//            protocolHandler.sendPacketToPlayer(player);
+//        }
+//    }
+//}

+ 1 - 1
src/main/java/com/gmail/nossr50/skills/alchemy/AlchemyPotionBrewer.java

@@ -178,7 +178,7 @@ public final class AlchemyPotionBrewer {
                 PotionStage potionStage = PotionStage.getPotionStage(input, output);
                 PotionStage potionStage = PotionStage.getPotionStage(input, output);
 
 
                 // Update player alchemy skills or effects based on brewing success
                 // Update player alchemy skills or effects based on brewing success
-                if (UserManager.hasPlayerDataKey(player)) {
+                if (UserManager.getPlayer(player) != null) {
                     UserManager.getPlayer(player).getAlchemyManager().handlePotionBrewSuccesses(potionStage, 1);
                     UserManager.getPlayer(player).getAlchemyManager().handlePotionBrewSuccesses(potionStage, 1);
                 }
                 }
             }
             }

+ 7 - 3
src/main/java/com/gmail/nossr50/skills/woodcutting/WoodcuttingManager.java

@@ -323,9 +323,13 @@ public class WoodcuttingManager extends SkillManager {
                 //Bonus Drops / Harvest lumber checks
                 //Bonus Drops / Harvest lumber checks
                 processBonusDropCheck(blockState);
                 processBonusDropCheck(blockState);
             } else if (BlockUtils.isNonWoodPartOfTree(blockState)) {
             } else if (BlockUtils.isNonWoodPartOfTree(blockState)) {
-                // 90% of the time do not drop leaf blocks
-                if (ThreadLocalRandom.current().nextInt(100) > 90) {
-                    Misc.spawnItemsFromCollection(getPlayer(), Misc.getBlockCenter(blockState), block.getDrops(itemStack), ItemSpawnReason.TREE_FELLER_DISPLACED_BLOCK);
+                // 75% of the time do not drop leaf blocks
+                if (blockState.getType().getKey().getKey().toLowerCase().contains("sapling")
+                        || ThreadLocalRandom.current().nextInt(100) > 75) {
+                    Misc.spawnItemsFromCollection(getPlayer(),
+                            Misc.getBlockCenter(blockState),
+                            block.getDrops(itemStack),
+                            ItemSpawnReason.TREE_FELLER_DISPLACED_BLOCK);
                 }
                 }
 
 
                 //Drop displaced non-woodcutting XP blocks
                 //Drop displaced non-woodcutting XP blocks

+ 2 - 1
src/main/java/com/gmail/nossr50/util/PotionUtil.java

@@ -1,6 +1,7 @@
 package com.gmail.nossr50.util;
 package com.gmail.nossr50.util;
 
 
 import com.gmail.nossr50.mcMMO;
 import com.gmail.nossr50.mcMMO;
+import org.bukkit.Bukkit;
 import org.bukkit.NamespacedKey;
 import org.bukkit.NamespacedKey;
 import org.bukkit.inventory.meta.PotionMeta;
 import org.bukkit.inventory.meta.PotionMeta;
 import org.bukkit.potion.PotionEffectType;
 import org.bukkit.potion.PotionEffectType;
@@ -404,7 +405,7 @@ public class PotionUtil {
         try {
         try {
             PotionType potionType = (PotionType) methodPotionMetaGetBasePotionType.invoke(potionMeta);
             PotionType potionType = (PotionType) methodPotionMetaGetBasePotionType.invoke(potionMeta);
             List<PotionEffectType> potionEffectTypeList = (List<PotionEffectType>) methodPotionTypeGetPotionEffects.invoke(potionType);
             List<PotionEffectType> potionEffectTypeList = (List<PotionEffectType>) methodPotionTypeGetPotionEffects.invoke(potionType);
-            return potionEffectTypeList != null || !potionEffectTypeList.isEmpty();
+            return potionEffectTypeList != null && !potionEffectTypeList.isEmpty();
         } catch (IllegalAccessException | InvocationTargetException ex) {
         } catch (IllegalAccessException | InvocationTargetException ex) {
             throw new RuntimeException(ex);
             throw new RuntimeException(ex);
         }
         }

+ 12 - 11
src/main/resources/experience.yml

@@ -239,17 +239,18 @@ Experience_Values:
         # FeatherFall_Multiplier: Multiply Acrobatics XP by this value when wearing boots with the Feather Fall enchant
         # FeatherFall_Multiplier: Multiply Acrobatics XP by this value when wearing boots with the Feather Fall enchant
         FeatherFall_Multiplier: 2.0
         FeatherFall_Multiplier: 2.0
     Alchemy:
     Alchemy:
-        # Alchemy potion stages are based on the number of ingredients added
-        # Potion_Stage_1 represents a base potion
-        # Potion_Stage_2 represents a base potion with one ingredient
-        # Potion_Stage_3 represents a base potion with one ingredient and one amplifier
-        # Potion_Stage_4 represents a base potion with one ingredient and two amplifiers
-        # Potion_Stage_5 represents a base potion with one ingredient where the amplifiers are swapped
-        Potion_Stage_1: 15
-        Potion_Stage_2: 30
-        Potion_Stage_3: 60
-        Potion_Stage_4: 120
-        Potion_Stage_5: 0
+        Potion_Brewing:
+            # Alchemy potion stages are based on the number of ingredients added
+            # Stage_1 represents a base potion
+            # Stage_2 represents a base potion with one ingredient
+            # Stage_3 represents a base potion with one ingredient and one amplifier
+            # Stage_4 represents a base potion with one ingredient and two amplifiers
+            # Stage_5 represents a base potion with one ingredient where the amplifiers are swapped
+            Stage_1: 120
+            Stage_2: 240
+            Stage_3: 480
+            Stage_4: 960
+            Stage_5: 0
     Archery:
     Archery:
         Distance_Multiplier: 0.025
         Distance_Multiplier: 0.025
     Fishing:
     Fishing: