Skip to content

Commit

Permalink
2.2.007
Browse files Browse the repository at this point in the history
  • Loading branch information
nossr50 committed May 4, 2024
1 parent 7556135 commit 5ba6305
Show file tree
Hide file tree
Showing 10 changed files with 122 additions and 45 deletions.
7 changes: 6 additions & 1 deletion Changelog.txt
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
18 changes: 9 additions & 9 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down Expand Up @@ -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>
Expand Down Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ public double getFeatherFallXPModifier() {

/* 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 */
Expand Down
8 changes: 8 additions & 0 deletions src/main/java/com/gmail/nossr50/mcMMO.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -364,6 +365,9 @@ public void onLoad()
if(getServer().getPluginManager().getPlugin("WorldGuard") != null) {
WorldGuardManager.getInstance().registerFlags();
}

// ProtocolLib
// protocolLibManager = new ProtocolLibManager(this);
}

/**
Expand Down Expand Up @@ -825,4 +829,8 @@ public AttributeMapper getAttributeMapper() {
public @NotNull FoliaLib getFoliaLib() {
return foliaLib;
}

// public ProtocolLibManager getProtocolLibManager() {
// return protocolLibManager;
// }
}
36 changes: 36 additions & 0 deletions src/main/java/com/gmail/nossr50/protocollib/ProtocolHandler.java
Original file line number Diff line number Diff line change
@@ -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);
// }
//}
58 changes: 40 additions & 18 deletions src/main/java/com/gmail/nossr50/protocollib/ProtocolLibManager.java
Original file line number Diff line number Diff line change
@@ -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);
// }
// }
//}
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ public static void finishBrewing(BlockState brewingStand, Player player, boolean
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);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -323,9 +323,13 @@ private void dropTreeFellerLootFromBlocks(@NotNull Set<BlockState> treeFellerBlo
//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
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/com/gmail/nossr50/util/PotionUtil.java
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -404,7 +405,7 @@ private static boolean hasBasePotionEffectsModern(PotionMeta potionMeta) {
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);
}
Expand Down
23 changes: 12 additions & 11 deletions src/main/resources/experience.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 5ba6305

Please sign in to comment.