TODO: Look into double drops for berry bushes

This commit is contained in:
nossr50 2021-03-25 14:08:22 -07:00
parent e40ab38bbd
commit eea922c31f
6 changed files with 44 additions and 18 deletions

View File

@ -9,6 +9,7 @@ Version 2.1.182
Removed a few silent exceptions for scoreboards & mcMMO Removed a few silent exceptions for scoreboards & mcMMO
Added warning about UltraPermissions to mcMMO Added warning about UltraPermissions to mcMMO
Fixed a potential NPE in McMMOPlayerExperienceEvent Fixed a potential NPE in McMMOPlayerExperienceEvent
Added Sweet Berry Bush to config.yml bonus drops for Herbalism
NOTES: NOTES:
mcMMO will do a better job reporting if something went wrong with scoreboards, which may lead to improved plugin compatibility between mcMMO and other plugins touching scoreboards. mcMMO will do a better job reporting if something went wrong with scoreboards, which may lead to improved plugin compatibility between mcMMO and other plugins touching scoreboards.

View File

@ -6,13 +6,11 @@ import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.datatypes.MobHealthbarType; import com.gmail.nossr50.datatypes.MobHealthbarType;
import com.gmail.nossr50.datatypes.database.DatabaseType; import com.gmail.nossr50.datatypes.database.DatabaseType;
import com.gmail.nossr50.datatypes.database.PlayerStat; import com.gmail.nossr50.datatypes.database.PlayerStat;
import com.gmail.nossr50.datatypes.database.UpgradeType;
import com.gmail.nossr50.datatypes.player.PlayerProfile; import com.gmail.nossr50.datatypes.player.PlayerProfile;
import com.gmail.nossr50.datatypes.player.UniqueDataType; import com.gmail.nossr50.datatypes.player.UniqueDataType;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType; import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SuperAbilityType; import com.gmail.nossr50.datatypes.skills.SuperAbilityType;
import com.gmail.nossr50.mcMMO; import com.gmail.nossr50.mcMMO;
import com.gmail.nossr50.runnables.database.UUIDUpdateAsyncTask;
import com.gmail.nossr50.util.Misc; import com.gmail.nossr50.util.Misc;
import org.bukkit.OfflinePlayer; import org.bukkit.OfflinePlayer;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;

View File

@ -1,10 +1,13 @@
package com.gmail.nossr50.listeners; package com.gmail.nossr50.listeners;
import com.gmail.nossr50.api.ItemSpawnReason;
import com.gmail.nossr50.config.AdvancedConfig; import com.gmail.nossr50.config.AdvancedConfig;
import com.gmail.nossr50.config.Config; import com.gmail.nossr50.config.Config;
import com.gmail.nossr50.config.WorldBlacklist; import com.gmail.nossr50.config.WorldBlacklist;
import com.gmail.nossr50.config.experience.ExperienceConfig; import com.gmail.nossr50.config.experience.ExperienceConfig;
import com.gmail.nossr50.datatypes.meta.BonusDropMeta;
import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.datatypes.player.McMMOPlayer;
import com.gmail.nossr50.datatypes.skills.PrimarySkillType;
import com.gmail.nossr50.datatypes.skills.SubSkillType; import com.gmail.nossr50.datatypes.skills.SubSkillType;
import com.gmail.nossr50.datatypes.skills.subskills.interfaces.InteractType; import com.gmail.nossr50.datatypes.skills.subskills.interfaces.InteractType;
import com.gmail.nossr50.events.fake.FakeEntityDamageByEntityEvent; import com.gmail.nossr50.events.fake.FakeEntityDamageByEntityEvent;
@ -31,6 +34,7 @@ import com.gmail.nossr50.util.skills.CombatUtils;
import com.gmail.nossr50.util.skills.SkillActivationType; import com.gmail.nossr50.util.skills.SkillActivationType;
import com.gmail.nossr50.worldguard.WorldGuardManager; import com.gmail.nossr50.worldguard.WorldGuardManager;
import com.gmail.nossr50.worldguard.WorldGuardUtils; import com.gmail.nossr50.worldguard.WorldGuardUtils;
import org.bukkit.Bukkit;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.NamespacedKey; import org.bukkit.NamespacedKey;
import org.bukkit.OfflinePlayer; import org.bukkit.OfflinePlayer;
@ -41,6 +45,7 @@ import org.bukkit.event.Cancellable;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockDropItemEvent;
import org.bukkit.event.entity.*; import org.bukkit.event.entity.*;
import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.EntityDamageEvent.DamageCause;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
@ -52,6 +57,8 @@ import org.bukkit.potion.PotionEffectType;
import org.bukkit.projectiles.ProjectileSource; import org.bukkit.projectiles.ProjectileSource;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import java.util.HashSet;
public class EntityListener implements Listener { public class EntityListener implements Listener {
private final mcMMO pluginRef; private final mcMMO pluginRef;
private final @NotNull AbstractPersistentDataLayer persistentDataLayer; private final @NotNull AbstractPersistentDataLayer persistentDataLayer;
@ -67,6 +74,30 @@ public class EntityListener implements Listener {
persistentDataLayer = mcMMO.getCompatibilityManager().getPersistentDataLayer(); persistentDataLayer = mcMMO.getCompatibilityManager().getPersistentDataLayer();
} }
// @EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
// public void onBlockDropItemEvent(EntityDropItemEvent event) {
// if(event.getEntity() instanceof Block) {
// Block itemDispensingBlock = (Block) event.getEntity();
//
// //Is it a berry bush?
// if(itemDispensingBlock.getType().toString().equalsIgnoreCase("sweet_berry_bush")) {
// //Berry Bush Time!
// if (event.getEntity().getMetadata(mcMMO.BONUS_DROPS_METAKEY).size() > 0) {
// Bukkit.broadcastMessage("Pop pop!");
// BonusDropMeta bonusDropMeta = (BonusDropMeta) event.getEntity().getMetadata(mcMMO.BONUS_DROPS_METAKEY).get(0);
// int bonusCount = bonusDropMeta.asInt();
//
// for (int i = 0; i < bonusCount; i++) {
// Misc.spawnItemNaturally(event.getEntity().getLocation(), event.getItemDrop().getItemStack(), ItemSpawnReason.BONUS_DROPS);
// }
// }
// }
//
// if(event.getEntity().hasMetadata(mcMMO.BONUS_DROPS_METAKEY))
// event.getEntity().removeMetadata(mcMMO.BONUS_DROPS_METAKEY, pluginRef);
// }
// }
@EventHandler(priority = EventPriority.MONITOR) @EventHandler(priority = EventPriority.MONITOR)
public void onEntityTransform(EntityTransformEvent event) { public void onEntityTransform(EntityTransformEvent event) {
if(event.getEntity() instanceof LivingEntity) { if(event.getEntity() instanceof LivingEntity) {

View File

@ -272,12 +272,6 @@ public class mcMMO extends JavaPlugin {
metrics.addCustomChart(new SimplePie("leveling_system", () -> "Standard")); metrics.addCustomChart(new SimplePie("leveling_system", () -> "Standard"));
} }
//Can't confirm this bug myself as the plugin is premium
// //TODO: Remove this when ChatControlRed fixes itself
// if(pluginManager.getPlugin("ChatControlRed") != null) {
// getLogger().severe("mcMMO has detected ChatControlRed on your server, users have reported a severe plugin conflict between these two plugins which degrades server performance and wastes many server resources.");
// getLogger().severe("It is HIGHLY RECOMMENDED that you do --NOT-- use ChatControlRed until this issue is resolved!");
// }
if(pluginManager.getPlugin(ULTRA_PERMISSONS) != null) { if(pluginManager.getPlugin(ULTRA_PERMISSONS) != null) {
Bukkit.getScheduler().runTaskTimer(this, () -> { Bukkit.getScheduler().runTaskTimer(this, () -> {
getLogger().severe(UP_WARNING_1); getLogger().severe(UP_WARNING_1);
@ -290,6 +284,7 @@ public class mcMMO extends JavaPlugin {
}, 0L, 1200L); }, 0L, 1200L);
} }
} }
catch (Throwable t) { catch (Throwable t) {
getLogger().severe("There was an error while enabling mcMMO!"); getLogger().severe("There was an error while enabling mcMMO!");

View File

@ -111,16 +111,16 @@ public class HerbalismManager extends SkillManager {
mmoPlayer.getPlayer().sendMessage("Bush XP: " + xpReward); mmoPlayer.getPlayer().sendMessage("Bush XP: " + xpReward);
} }
//Check for double drops // //Check for double drops
if(checkDoubleDrop(blockState)) { // if(checkDoubleDrop(blockState)) {
//
if(mmoPlayer.isDebugMode()) { // if(mmoPlayer.isDebugMode()) {
mmoPlayer.getPlayer().sendMessage("Double Drops succeeded for Berry Bush"); // mmoPlayer.getPlayer().sendMessage("Double Drops succeeded for Berry Bush");
} // }
//
//Add metadata to mark this block for double or triple drops // //Add metadata to mark this block for double or triple drops
markForBonusDrops(blockState); // markForBonusDrops(blockState);
} // }
applyXpGain(xpReward, XPGainReason.PVE, XPGainSource.SELF); applyXpGain(xpReward, XPGainReason.PVE, XPGainSource.SELF);
} }

View File

@ -464,6 +464,7 @@ Green_Thumb_Replanting_Crops:
### ###
Bonus_Drops: Bonus_Drops:
Herbalism: Herbalism:
Sweet_Berry_Bush: true
Weeping_Vines: true Weeping_Vines: true
Twisting_Vines: true Twisting_Vines: true
Shroomlight: true Shroomlight: true