This commit is contained in:
nossr50 2024-05-04 10:26:43 -07:00
parent 75561350c1
commit 5ba6305ad4
10 changed files with 122 additions and 45 deletions

View File

@ -1,11 +1,16 @@
Version 2.2.007
Compatibility with the 1.20.5 / 1.20.6 MC Update
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
Added armadillo to combat experience in experience.yml
Fixed bug where Green Thumb did not replant if seed was in the off hand
Added armadillo to combat experience in experience.yml
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.
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.

18
pom.xml
View File

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

View File

@ -467,7 +467,7 @@ public class ExperienceConfig extends BukkitConfig {
/* Alchemy */
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 */

View File

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

View File

@ -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);
// }
//}

View File

@ -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);
// }
// }
//}

View File

@ -178,7 +178,7 @@ public final class AlchemyPotionBrewer {
PotionStage potionStage = PotionStage.getPotionStage(input, output);
// 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);
}
}

View File

@ -323,9 +323,13 @@ public class WoodcuttingManager extends SkillManager {
//Bonus Drops / Harvest lumber checks
processBonusDropCheck(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

View File

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

View File

@ -239,17 +239,18 @@ Experience_Values:
# FeatherFall_Multiplier: Multiply Acrobatics XP by this value when wearing boots with the Feather Fall enchant
FeatherFall_Multiplier: 2.0
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:
Distance_Multiplier: 0.025
Fishing: