mirror of
				https://github.com/mcMMO-Dev/mcMMO.git
				synced 2025-10-31 01:03:44 +01:00 
			
		
		
		
	TODO: Look into double drops for berry bushes
This commit is contained in:
		| @@ -9,6 +9,7 @@ Version 2.1.182 | ||||
|     Removed a few silent exceptions for scoreboards & mcMMO | ||||
|     Added warning about UltraPermissions to mcMMO | ||||
|     Fixed a potential NPE in McMMOPlayerExperienceEvent | ||||
|     Added Sweet Berry Bush to config.yml bonus drops for Herbalism | ||||
|  | ||||
|     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. | ||||
|   | ||||
| @@ -6,13 +6,11 @@ import com.gmail.nossr50.config.Config; | ||||
| import com.gmail.nossr50.datatypes.MobHealthbarType; | ||||
| import com.gmail.nossr50.datatypes.database.DatabaseType; | ||||
| 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.UniqueDataType; | ||||
| import com.gmail.nossr50.datatypes.skills.PrimarySkillType; | ||||
| import com.gmail.nossr50.datatypes.skills.SuperAbilityType; | ||||
| import com.gmail.nossr50.mcMMO; | ||||
| import com.gmail.nossr50.runnables.database.UUIDUpdateAsyncTask; | ||||
| import com.gmail.nossr50.util.Misc; | ||||
| import org.bukkit.OfflinePlayer; | ||||
| import org.bukkit.entity.Player; | ||||
|   | ||||
| @@ -1,10 +1,13 @@ | ||||
| package com.gmail.nossr50.listeners; | ||||
|  | ||||
| import com.gmail.nossr50.api.ItemSpawnReason; | ||||
| import com.gmail.nossr50.config.AdvancedConfig; | ||||
| import com.gmail.nossr50.config.Config; | ||||
| import com.gmail.nossr50.config.WorldBlacklist; | ||||
| 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.skills.PrimarySkillType; | ||||
| import com.gmail.nossr50.datatypes.skills.SubSkillType; | ||||
| import com.gmail.nossr50.datatypes.skills.subskills.interfaces.InteractType; | ||||
| 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.worldguard.WorldGuardManager; | ||||
| import com.gmail.nossr50.worldguard.WorldGuardUtils; | ||||
| import org.bukkit.Bukkit; | ||||
| import org.bukkit.Material; | ||||
| import org.bukkit.NamespacedKey; | ||||
| import org.bukkit.OfflinePlayer; | ||||
| @@ -41,6 +45,7 @@ import org.bukkit.event.Cancellable; | ||||
| import org.bukkit.event.EventHandler; | ||||
| import org.bukkit.event.EventPriority; | ||||
| import org.bukkit.event.Listener; | ||||
| import org.bukkit.event.block.BlockDropItemEvent; | ||||
| import org.bukkit.event.entity.*; | ||||
| import org.bukkit.event.entity.EntityDamageEvent.DamageCause; | ||||
| import org.bukkit.inventory.ItemStack; | ||||
| @@ -52,6 +57,8 @@ import org.bukkit.potion.PotionEffectType; | ||||
| import org.bukkit.projectiles.ProjectileSource; | ||||
| import org.jetbrains.annotations.NotNull; | ||||
|  | ||||
| import java.util.HashSet; | ||||
|  | ||||
| public class EntityListener implements Listener { | ||||
|     private final mcMMO pluginRef; | ||||
|     private final @NotNull AbstractPersistentDataLayer persistentDataLayer; | ||||
| @@ -67,6 +74,30 @@ public class EntityListener implements Listener { | ||||
|         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) | ||||
|     public void onEntityTransform(EntityTransformEvent event) { | ||||
|         if(event.getEntity() instanceof LivingEntity) { | ||||
|   | ||||
| @@ -272,12 +272,6 @@ public class mcMMO extends JavaPlugin { | ||||
|                     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) { | ||||
|                 Bukkit.getScheduler().runTaskTimer(this, () -> { | ||||
|                     getLogger().severe(UP_WARNING_1); | ||||
| @@ -290,6 +284,7 @@ public class mcMMO extends JavaPlugin { | ||||
|                     }, 0L, 1200L); | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         catch (Throwable t) { | ||||
|             getLogger().severe("There was an error while enabling mcMMO!"); | ||||
|  | ||||
|   | ||||
| @@ -111,16 +111,16 @@ public class HerbalismManager extends SkillManager { | ||||
|                     mmoPlayer.getPlayer().sendMessage("Bush XP: " + xpReward); | ||||
|                 } | ||||
|  | ||||
|                 //Check for double drops | ||||
|                 if(checkDoubleDrop(blockState)) { | ||||
|  | ||||
|                     if(mmoPlayer.isDebugMode()) { | ||||
|                         mmoPlayer.getPlayer().sendMessage("Double Drops succeeded for Berry Bush"); | ||||
|                     } | ||||
|  | ||||
|                     //Add metadata to mark this block for double or triple drops | ||||
|                     markForBonusDrops(blockState); | ||||
|                 } | ||||
| //                //Check for double drops | ||||
| //                if(checkDoubleDrop(blockState)) { | ||||
| // | ||||
| //                    if(mmoPlayer.isDebugMode()) { | ||||
| //                        mmoPlayer.getPlayer().sendMessage("Double Drops succeeded for Berry Bush"); | ||||
| //                    } | ||||
| // | ||||
| //                    //Add metadata to mark this block for double or triple drops | ||||
| //                    markForBonusDrops(blockState); | ||||
| //                } | ||||
|  | ||||
|                 applyXpGain(xpReward, XPGainReason.PVE, XPGainSource.SELF); | ||||
|             } | ||||
|   | ||||
| @@ -464,6 +464,7 @@ Green_Thumb_Replanting_Crops: | ||||
| ### | ||||
| Bonus_Drops: | ||||
|     Herbalism: | ||||
|         Sweet_Berry_Bush: true | ||||
|         Weeping_Vines: true | ||||
|         Twisting_Vines: true | ||||
|         Shroomlight: true | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 nossr50
					nossr50