From 93fefa031b22fa2fe8432959a1cd1e2ae9c0ba40 Mon Sep 17 00:00:00 2001 From: LogGits Date: Tue, 12 Feb 2019 13:26:03 +1000 Subject: [PATCH 01/14] Herbalism compatibility with PlayerAnimationEvent MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This change in theory should make McMMO herbalism compatible with plugins that utilise PlayerAnimationEvent. The main reason that I want to add this is to fix `no swing` false positives in `AAC` (though didn't get to test this). I would appreciate if someone could test this PR and verify that its working without any issues. (I am busy for the next few days so I haven't been able to test it. In theory it looks like it should work. I could have checked if the event `isCancelled()` however, this doesn't seem necessary quite yet. Though, if it is needed I can add it 👍 Please don't merge this unless it's confirmed completely working. I will find some time to test it out within the next few days. --- .../java/com/gmail/nossr50/listeners/PlayerListener.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java index 263b2598e..4084d4d77 100644 --- a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java @@ -656,16 +656,17 @@ public class PlayerListener implements Listener { } } + FakePlayerAnimationEvent fakeSwing = new FakePlayerAnimationEvent(event.getPlayer()); //PlayerAnimationEvent compat if (herbalismManager.canGreenThumbBlock(blockState)) { + Bukkit.getPluginManager().callEvent(fakeSwing); player.getInventory().setItemInMainHand(new ItemStack(Material.WHEAT_SEEDS, heldItem.getAmount() - 1)); - if (herbalismManager.processGreenThumbBlocks(blockState) && EventUtils.simulateBlockBreak(block, player, false)) { blockState.update(true); } } - /* SHROOM THUMB CHECK */ else if (herbalismManager.canUseShroomThumb(blockState)) { + Bukkit.getPluginManager().callEvent(fakeSwing); event.setCancelled(true); if (herbalismManager.processShroomThumb(blockState) && EventUtils.simulateBlockBreak(block, player, false)) { blockState.update(true); From 3ed4228b7228f40dc8e7f6e25128dbce5ab94deb Mon Sep 17 00:00:00 2001 From: LogGits Date: Sat, 16 Feb 2019 05:40:49 +1000 Subject: [PATCH 02/14] Added imports --- src/main/java/com/gmail/nossr50/listeners/PlayerListener.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java index 4084d4d77..06f03efd7 100644 --- a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java @@ -29,6 +29,8 @@ import com.gmail.nossr50.util.sounds.SoundManager; import com.gmail.nossr50.util.sounds.SoundType; import com.gmail.nossr50.worldguard.WorldGuardManager; import com.gmail.nossr50.worldguard.WorldGuardUtils; +import com.gmail.nossr50.events.fake.FakePlayerAnimationEvent; +import org.bukkit.Bukkit; import org.bukkit.GameMode; import org.bukkit.Material; import org.bukkit.block.Block; From 467025888c513485b727a35da4ea582f03c48dd4 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Thu, 25 Apr 2019 18:28:24 -0700 Subject: [PATCH 03/14] Fixed #3858 - Falling blocks in water not getting tracked --- Changelog.txt | 3 ++ pom.xml | 2 +- .../skills/McMMOPlayerNotificationEvent.java | 1 - .../nossr50/listeners/BlockListener.java | 34 ------------------- .../nossr50/listeners/EntityListener.java | 4 ++- .../nossr50/util/player/UserManager.java | 1 - 6 files changed, 7 insertions(+), 38 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index 95600d065..104e57b71 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,3 +1,6 @@ +Version 2.1.49 + Fixed a bug where falling blocks were not marked as unnatural in water + Version 2.1.48 1.14 Support Added Cats, Foxes, and Pandas to Taming XP rewards diff --git a/pom.xml b/pom.xml index 4035a495e..8d16969bc 100755 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ 4.0.0 com.gmail.nossr50.mcMMO mcMMO - 2.1.48 + 2.1.49-SNAPSHOT mcMMO https://github.com/mcMMO-Dev/mcMMO diff --git a/src/main/java/com/gmail/nossr50/events/skills/McMMOPlayerNotificationEvent.java b/src/main/java/com/gmail/nossr50/events/skills/McMMOPlayerNotificationEvent.java index 59114fc28..05ed0f510 100644 --- a/src/main/java/com/gmail/nossr50/events/skills/McMMOPlayerNotificationEvent.java +++ b/src/main/java/com/gmail/nossr50/events/skills/McMMOPlayerNotificationEvent.java @@ -7,7 +7,6 @@ import org.bukkit.entity.Player; import org.bukkit.event.Cancellable; import org.bukkit.event.Event; import org.bukkit.event.HandlerList; -import org.bukkit.event.player.PlayerEvent; /** * This event is sent for when mcMMO informs a player about various important information diff --git a/src/main/java/com/gmail/nossr50/listeners/BlockListener.java b/src/main/java/com/gmail/nossr50/listeners/BlockListener.java index 10d75d569..be401fba7 100644 --- a/src/main/java/com/gmail/nossr50/listeners/BlockListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/BlockListener.java @@ -34,16 +34,13 @@ import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.Tag; import org.bukkit.block.*; -import org.bukkit.entity.EntityType; import org.bukkit.entity.Item; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; import org.bukkit.event.block.*; -import org.bukkit.event.entity.EntityChangeBlockEvent; import org.bukkit.inventory.ItemStack; -import org.bukkit.metadata.FixedMetadataValue; import org.bukkit.metadata.MetadataValue; import java.util.List; @@ -187,37 +184,6 @@ public class BlockListener implements Listener { } } - /** - * Monitor falling blocks. - * - * @param event The event to watch - */ - @EventHandler(priority = EventPriority.MONITOR, ignoreCancelled = true) - public void onFallingBlock(EntityChangeBlockEvent event) { - /* WORLD BLACKLIST CHECK */ - if(WorldBlacklist.isWorldBlacklisted(event.getBlock().getWorld())) - return; - - if (BlockUtils.shouldBeWatched(event.getBlock().getState()) && event.getEntityType().equals(EntityType.FALLING_BLOCK)) { - if (event.getTo().equals(Material.AIR) && mcMMO.getPlaceStore().isTrue(event.getBlock())) { - event.getEntity().setMetadata("mcMMOBlockFall", new FixedMetadataValue( plugin, event.getBlock().getLocation())); - } else { - List values = event.getEntity().getMetadata( "mcMMOBlockFall" ); - - if (!values.isEmpty()) { - - if (values.get(0).value() == null) return; - Block spawn = ((org.bukkit.Location) values.get(0).value()).getBlock(); - - - mcMMO.getPlaceStore().setTrue( event.getBlock() ); - mcMMO.getPlaceStore().setFalse( spawn ); - - } - } - } - } - /** * Monitor BlockPlace events. * diff --git a/src/main/java/com/gmail/nossr50/listeners/EntityListener.java b/src/main/java/com/gmail/nossr50/listeners/EntityListener.java index 3dd490f38..6570b65b5 100644 --- a/src/main/java/com/gmail/nossr50/listeners/EntityListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/EntityListener.java @@ -159,7 +159,9 @@ public class EntityListener implements Listener { // When the event is fired for the falling block that changes back to a // normal block // event.getBlock().getType() returns AIR - if (!BlockUtils.shouldBeWatched(block.getState()) && block.getType() != Material.AIR) { + if (!BlockUtils.shouldBeWatched(block.getState()) + && block.getState().getType() != Material.WATER + && block.getType() != Material.AIR) { return; } diff --git a/src/main/java/com/gmail/nossr50/util/player/UserManager.java b/src/main/java/com/gmail/nossr50/util/player/UserManager.java index cbf897794..39044998e 100644 --- a/src/main/java/com/gmail/nossr50/util/player/UserManager.java +++ b/src/main/java/com/gmail/nossr50/util/player/UserManager.java @@ -1,6 +1,5 @@ package com.gmail.nossr50.util.player; -import com.gmail.nossr50.api.exceptions.McMMOPlayerNotFoundException; import com.gmail.nossr50.datatypes.player.McMMOPlayer; import com.gmail.nossr50.mcMMO; import com.google.common.collect.ImmutableList; From 30df57fa355fb7bbe151b10954cf30f979f469df Mon Sep 17 00:00:00 2001 From: nossr50 Date: Thu, 25 Apr 2019 18:46:49 -0700 Subject: [PATCH 04/14] Fix async tool lower --- Changelog.txt | 1 + .../com/gmail/nossr50/runnables/skills/AbilityDisableTask.java | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Changelog.txt b/Changelog.txt index 104e57b71..264203abe 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,5 +1,6 @@ Version 2.1.49 Fixed a bug where falling blocks were not marked as unnatural in water + Fixed a bug where Ability cooldowns were being called async when they are sync only Version 2.1.48 1.14 Support diff --git a/src/main/java/com/gmail/nossr50/runnables/skills/AbilityDisableTask.java b/src/main/java/com/gmail/nossr50/runnables/skills/AbilityDisableTask.java index ff26b7ab0..5aea0ea18 100644 --- a/src/main/java/com/gmail/nossr50/runnables/skills/AbilityDisableTask.java +++ b/src/main/java/com/gmail/nossr50/runnables/skills/AbilityDisableTask.java @@ -63,7 +63,7 @@ public class AbilityDisableTask extends BukkitRunnable { SkillUtils.sendSkillMessage(player, NotificationType.SUPER_ABILITY_ALERT_OTHERS, ability.getAbilityPlayerOff()); - new AbilityCooldownTask(mcMMOPlayer, ability).runTaskLaterAsynchronously(mcMMO.p, PerksUtils.handleCooldownPerks(player, ability.getCooldown()) * Misc.TICK_CONVERSION_FACTOR); + new AbilityCooldownTask(mcMMOPlayer, ability).runTaskLater(mcMMO.p, PerksUtils.handleCooldownPerks(player, ability.getCooldown()) * Misc.TICK_CONVERSION_FACTOR); } private void resendChunkRadiusAt(Player player, int radius) { From be8a2a4b079f406ada7b5b7f294e7f4dcf333de3 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Thu, 25 Apr 2019 18:49:18 -0700 Subject: [PATCH 05/14] Fixes #3902 - NPE in Inventory Listener --- Changelog.txt | 1 + .../java/com/gmail/nossr50/listeners/InventoryListener.java | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index 264203abe..38414333e 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,6 +1,7 @@ Version 2.1.49 Fixed a bug where falling blocks were not marked as unnatural in water Fixed a bug where Ability cooldowns were being called async when they are sync only + Fixed NPE when checking inventory location Version 2.1.48 1.14 Support diff --git a/src/main/java/com/gmail/nossr50/listeners/InventoryListener.java b/src/main/java/com/gmail/nossr50/listeners/InventoryListener.java index fb080fa32..5ba6c2d39 100644 --- a/src/main/java/com/gmail/nossr50/listeners/InventoryListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/InventoryListener.java @@ -397,8 +397,10 @@ public class InventoryListener implements Listener { @EventHandler(priority = EventPriority.NORMAL, ignoreCancelled = true) public void onInventoryMoveItemEvent(InventoryMoveItemEvent event) { /* WORLD BLACKLIST CHECK */ - if(WorldBlacklist.isWorldBlacklisted(event.getSource().getLocation().getWorld())) - return; + + if(event.getSource().getLocation() != null) + if(WorldBlacklist.isWorldBlacklisted(event.getSource().getLocation().getWorld())) + return; Inventory inventory = event.getDestination(); From 8efee39f7efac75d454c1641fdcc8a8182413ed6 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Thu, 25 Apr 2019 18:54:41 -0700 Subject: [PATCH 06/14] Add sweet berrys to Herbalism XP tables (update configs) --- Changelog.txt | 7 ++++++- src/main/resources/experience.yml | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Changelog.txt b/Changelog.txt index 38414333e..6638e589e 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,7 +1,12 @@ Version 2.1.49 + Added sweet berry bush to Herbalism XP (Update your experience.yml config or delete it to gen a new one) Fixed a bug where falling blocks were not marked as unnatural in water - Fixed a bug where Ability cooldowns were being called async when they are sync only + Fixed a bug where tool lower notifications were being called async when they are sync only Fixed NPE when checking inventory location + Improved herbalism compatibility with anti-cheat (thanks LogGits) + + NOTE: This is what the default herbalism XP table looks like + https://paste.gg/p/anonymous/1022088f20cf44298870930e9bc58e8a Version 2.1.48 1.14 Support diff --git a/src/main/resources/experience.yml b/src/main/resources/experience.yml index 78854d081..30f35baae 100644 --- a/src/main/resources/experience.yml +++ b/src/main/resources/experience.yml @@ -268,6 +268,7 @@ Experience_Values: Brown_Mushroom_Block: 70 Mushroom_Stem: 80 Herbalism: + Sweet_Berry_Bush: 300 Seagrass: 10 Tall_Seagrass: 10 Kelp: 3 From 0949931a61e06ab877607324e609f02a5a5a35e9 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Thu, 25 Apr 2019 18:56:49 -0700 Subject: [PATCH 07/14] 2.1.49 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 8d16969bc..f0365ffa1 100755 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ 4.0.0 com.gmail.nossr50.mcMMO mcMMO - 2.1.49-SNAPSHOT + 2.1.49 mcMMO https://github.com/mcMMO-Dev/mcMMO From a583f557d711bcd886fdd52842af73663d679c02 Mon Sep 17 00:00:00 2001 From: OverCrave Date: Fri, 26 Apr 2019 17:49:35 +0200 Subject: [PATCH 08/14] remove unused translations --- src/main/resources/locale/locale_de.properties | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/main/resources/locale/locale_de.properties b/src/main/resources/locale/locale_de.properties index 3f1d71b46..4e776d238 100644 --- a/src/main/resources/locale/locale_de.properties +++ b/src/main/resources/locale/locale_de.properties @@ -110,7 +110,6 @@ Commands.Chat.Console = Konsole Commands.Cooldowns.Header = &6--= &amcMMO F\u00E4higkeiten Cooldowns&6 =-- Commands.Cooldowns.Row.N = \ &c{0}&f - &6{1} Sekunden verbleiben Commands.Cooldowns.Row.Y = \ &b{0}&f - &2Bereit! -Commands.Database.Cooldown = Du musst {0} Sekunde/-n warten bevor du diesen Befehl erneut verwenden darfst. Commands.Database.Processing = Dein vorheriger Befehl wird noch verarbeitet. Bitte warten. Commands.Description.Skill = Zeige detaillierte Informationen zum {0} Skill Commands.Description.addlevels = Gib einem Spieler Skill Level @@ -737,8 +736,6 @@ Perks.Lucky.Name = Gl\u00FCck Perks.XP.Desc = Erhalte mehr Erfahrung in bestimmen Skills. Perks.XP.Name = Erfahrung -Profile.Loading.AdminFailureNotice = &4[A]&c mcMMO konnte die Daten f\u00FCr &e{0}&c nicht laden. &dBitte \u00FCberpr\u00FCfe deine Datenbank Einstellungen. -Profile.Loading.Failure = &cmcMMO konnte deine Daten auch weiterhin nicht laden. Du solltest den &bServer Owner kontaktieren. &eDu kannst trotzdem auf dem Server spielen, jedoch hast du &lkeine Skill Level&e und jegliche Erfahrung, die du bekommst &lwird nicht gespeichert&e. Profile.Loading.Success = &aDein Profil wurde geladen. Repair.Arcane.Downgrade = Zauber-Wert des Gegenstands vermindert. From 15e3ad8876ea0b0f91bfa852810aa9807c77392c Mon Sep 17 00:00:00 2001 From: OverCrave Date: Fri, 26 Apr 2019 17:58:23 +0200 Subject: [PATCH 09/14] add missing translations --- src/main/resources/locale/locale_de.properties | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/resources/locale/locale_de.properties b/src/main/resources/locale/locale_de.properties index 4e776d238..d8504e6e2 100644 --- a/src/main/resources/locale/locale_de.properties +++ b/src/main/resources/locale/locale_de.properties @@ -1027,3 +1027,8 @@ mcMMO.Description = &3\u00DCber das &emcMMO&3 Projekt:,&6mcMMO ist ein &copen s mcMMO.NoInvites = &cDu hast zurzeit keine Einladungen mcMMO.NoPermission = &4Unzureichende Berechtigungen. mcMMO.NoSkillNote = &8Wenn du keinen Zugriff auf einen Skill hast wird er hier nicht angezeigt. +Commands.Database.CooldownMS=Du musst {0}ms warten, bis du diesen Befehl wieder ausführen kannst! +Profile.PendingLoad=&cDeine mcMMO Daten wurden noch nicht geladen. +Profile.Loading.FailureNotice=&4[A] &cmcMMO konnte die Spielerdaten von &e{0}&c leider nicht laden. Bitte überprüfe deine Datenbankeinstellungen. &dVersuche: {1}. +Reminder.Squelched=&7Erinnerung: Du erhälst aktuell keinerlei Benachrichtigungen von mcMMO, um dies zu ändern, nutze den /mcnotify Befehl. Dies ist eine stündliche, automatische Erinnerung. +Profile.Loading.FailurePlayer=&cmcMMO hat Probleme beim Laden deiner Daten nach &a{0}&c Versuchen. &8Kontaktiere den Serveradmin bezüglich diesem Problem. mcMMO wird weiterhin versuchen, deine Daten zu laden, bis du den Server verlässt. So lange kannst du keine Skillerfahrung sammeln und diese auch nicht nutzen. From 43d08ec21d75827a62dc8d8fc8eca0d8744e7eec Mon Sep 17 00:00:00 2001 From: Zed-I <47507923+Zed-I@users.noreply.github.com> Date: Fri, 26 Apr 2019 18:08:12 +0200 Subject: [PATCH 10/14] Added some missing blocks to Herbalism/Mining Added some missing entries to herbalism mining and one to combat. Reasoning for each xp below: bamboo - 10 Cant grow nearly as tall as kelp cornflower - 150 same as the other 1 high tall flowers (excluding poppy, dandelion and allium) lily_of_the_valley - 150 same as the other 1 high tall flowers (excluding poppy, dandelion and allium) wither_rose - 500. Quite hard to harvest. You need a wither to kill a mob and have the block not get destroyed by the wither blast. If the block where to get destroyed the flower just drops instead and you dont get any xp. The whole stone brick family get the same xp as nether brick, 50 stone_bricks cracked_stone_bricks mossy_stone_bricks chiseled_stone_bricks The rest of the prismarine family continue with the same xp as their main block, 70 prismarine_bricks dark_prismarine sea_lantern wandering_trader - 1.0 same as normal villagers --- src/main/resources/experience.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/main/resources/experience.yml b/src/main/resources/experience.yml index 30f35baae..b78154041 100644 --- a/src/main/resources/experience.yml +++ b/src/main/resources/experience.yml @@ -338,6 +338,10 @@ Experience_Values: Lily_Pad: 100 White_Tulip: 150 Dandelion: 100 + Bamboo: 10 + Cornflower: 150 + Lily_of_the_valley: 150 + Wither_rose: 500 Mining: Tube_Coral_Block: 75 Brain_Coral_Block: 80 @@ -383,8 +387,15 @@ Experience_Values: Granite: 30 Andesite: 30 Diorite: 30 + Stone_Bricks: 50 + Cracked_Stone_Bricks: 50 + Mossy_Stone_Bricks: 50 + Chiseled_Stone_Bricks: 50 Red_Sandstone: 100 Prismarine: 70 + Prismarine_Bricks: 70 + Dark_Prismarine: 70 + Sea_Lantern: 70 Purpur_Block: 200 Purpur_Pillar: 250 Purpur_Slab: 150 @@ -482,4 +493,5 @@ Experience_Values: Pillager: 2.0 Ravager: 4.0 Trader_Llama: 1.0 + Wandering_trader: 1.0 From aee81f87f57af9b6d11d19dfffc3ab403bc81f07 Mon Sep 17 00:00:00 2001 From: Zed-I <47507923+Zed-I@users.noreply.github.com> Date: Fri, 26 Apr 2019 18:16:42 +0200 Subject: [PATCH 11/14] Added bamboo to the non-2 high plant blocks --- .../com/gmail/nossr50/skills/herbalism/HerbalismManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/com/gmail/nossr50/skills/herbalism/HerbalismManager.java b/src/main/java/com/gmail/nossr50/skills/herbalism/HerbalismManager.java index 81738fa55..15f5a7b0d 100644 --- a/src/main/java/com/gmail/nossr50/skills/herbalism/HerbalismManager.java +++ b/src/main/java/com/gmail/nossr50/skills/herbalism/HerbalismManager.java @@ -178,7 +178,7 @@ public class HerbalismManager extends SkillManager { public boolean isOneBlockPlant(Material material) { return !(material == Material.CACTUS || material == Material.CHORUS_PLANT || material == Material.SUGAR_CANE || material == Material.KELP_PLANT || material == Material.KELP - || material == Material.TALL_SEAGRASS || material == Material.TALL_GRASS); + || material == Material.TALL_SEAGRASS || material == Material.TALL_GRASS || material == Material.BAMBOO); } /** From f904ac70190a76602752bbf2238452c7d0d0ea64 Mon Sep 17 00:00:00 2001 From: BuildTools Date: Fri, 26 Apr 2019 23:26:00 -0700 Subject: [PATCH 12/14] Fixing 1.13.2 bamboo material errors --- .../skills/herbalism/HerbalismManager.java | 4 +--- .../gmail/nossr50/util/MaterialMapStore.java | 20 +++++++++++++++++++ 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/gmail/nossr50/skills/herbalism/HerbalismManager.java b/src/main/java/com/gmail/nossr50/skills/herbalism/HerbalismManager.java index 15f5a7b0d..4f20b62a1 100644 --- a/src/main/java/com/gmail/nossr50/skills/herbalism/HerbalismManager.java +++ b/src/main/java/com/gmail/nossr50/skills/herbalism/HerbalismManager.java @@ -176,9 +176,7 @@ public class HerbalismManager extends SkillManager { } public boolean isOneBlockPlant(Material material) { - return !(material == Material.CACTUS || material == Material.CHORUS_PLANT - || material == Material.SUGAR_CANE || material == Material.KELP_PLANT || material == Material.KELP - || material == Material.TALL_SEAGRASS || material == Material.TALL_GRASS || material == Material.BAMBOO); + return !mcMMO.getMaterialMapStore().isMultiBlock(material); } /** diff --git a/src/main/java/com/gmail/nossr50/util/MaterialMapStore.java b/src/main/java/com/gmail/nossr50/util/MaterialMapStore.java index e9a30066e..0b9278735 100644 --- a/src/main/java/com/gmail/nossr50/util/MaterialMapStore.java +++ b/src/main/java/com/gmail/nossr50/util/MaterialMapStore.java @@ -20,6 +20,7 @@ public class MaterialMapStore { private HashSet herbalismAbilityBlackList; private HashSet blockCrackerWhiteList; private HashSet canMakeShroomyWhiteList; + private HashSet multiBlockEntities; public MaterialMapStore() { @@ -30,10 +31,16 @@ public class MaterialMapStore { herbalismAbilityBlackList = new HashSet<>(); blockCrackerWhiteList = new HashSet<>(); canMakeShroomyWhiteList = new HashSet<>(); + multiBlockEntities = new HashSet<>(); fillHardcodedHashSets(); } + public boolean isMultiBlock(Material material) + { + return multiBlockEntities.contains(material.getKey().getKey()); + } + public boolean isAbilityActivationBlackListed(Material material) { return abilityBlackList.contains(material.getKey().getKey()); @@ -78,6 +85,19 @@ public class MaterialMapStore { fillHerbalismAbilityBlackList(); fillBlockCrackerWhiteList(); fillShroomyWhiteList(); + fillMultiBlockEntitiesList(); + } + + private void fillMultiBlockEntitiesList() + { + multiBlockEntities.add("cactus"); + multiBlockEntities.add("chorus_plant"); + multiBlockEntities.add("sugar_cane"); + multiBlockEntities.add("kelp_plant"); + multiBlockEntities.add("kelp"); + multiBlockEntities.add("tall_seagrass"); + multiBlockEntities.add("tall_grass"); + multiBlockEntities.add("bamboo"); } private void fillShroomyWhiteList() From f4214e20315ad67e0e15549b00c801c46bd94369 Mon Sep 17 00:00:00 2001 From: nossr50 Date: Sat, 27 Apr 2019 00:00:52 -0700 Subject: [PATCH 13/14] changelog update --- Changelog.txt | 6 ++++++ pom.xml | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Changelog.txt b/Changelog.txt index 6638e589e..a3be83604 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,3 +1,9 @@ +Version 2.1.50 + Updated German locale (thanks OverCrave) + Added missing Herbalism XP values for: Bamboo, Cornflower, Lily of the valley, Wither rose (thanks Zed-I) + Added missing Mining XP values for: Stone Bricks, Cracked Stone Bricks, Mossy Stone Bricks, Chiseled Stone Bricks, Prismarine Bricks, Dark Prismarine, Sea Lantern (thanks Zed-I) + Added missing Combat XP multiplier for: Wandering Trader (thanks Zed-I) + Version 2.1.49 Added sweet berry bush to Herbalism XP (Update your experience.yml config or delete it to gen a new one) Fixed a bug where falling blocks were not marked as unnatural in water diff --git a/pom.xml b/pom.xml index f0365ffa1..bf265d9b4 100755 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ 4.0.0 com.gmail.nossr50.mcMMO mcMMO - 2.1.49 + 2.1.50-SNAPSHOT mcMMO https://github.com/mcMMO-Dev/mcMMO From f7eb06e80b552fb3dcd2f0690e7a43dd7611691c Mon Sep 17 00:00:00 2001 From: nossr50 Date: Sat, 27 Apr 2019 06:39:06 -0700 Subject: [PATCH 14/14] 2.1.50 --- Changelog.txt | 8 +++++ pom.xml | 2 +- .../gmail/nossr50/listeners/SelfListener.java | 33 +++++++++---------- 3 files changed, 25 insertions(+), 18 deletions(-) diff --git a/Changelog.txt b/Changelog.txt index a3be83604..9b352203b 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,9 +1,17 @@ Version 2.1.50 + Fixed a bug where early game XP boost (level 1-5) didn't function in certain circumstances Updated German locale (thanks OverCrave) Added missing Herbalism XP values for: Bamboo, Cornflower, Lily of the valley, Wither rose (thanks Zed-I) Added missing Mining XP values for: Stone Bricks, Cracked Stone Bricks, Mossy Stone Bricks, Chiseled Stone Bricks, Prismarine Bricks, Dark Prismarine, Sea Lantern (thanks Zed-I) Added missing Combat XP multiplier for: Wandering Trader (thanks Zed-I) + Notes: + If you haven't upgraded mcMMO since version 2.1.47 or before you will not need to do these steps as the experience file will update once automatically. + You can either delete experience.yml to generate a new one or edit it manually + This is what the default experience.yml looks like + https://paste.gg/p/anonymous/946f62ce7dff4ab7a87cae70c0266313 + + Version 2.1.49 Added sweet berry bush to Herbalism XP (Update your experience.yml config or delete it to gen a new one) Fixed a bug where falling blocks were not marked as unnatural in water diff --git a/pom.xml b/pom.xml index bf265d9b4..bcf4dd2ec 100755 --- a/pom.xml +++ b/pom.xml @@ -2,7 +2,7 @@ 4.0.0 com.gmail.nossr50.mcMMO mcMMO - 2.1.50-SNAPSHOT + 2.1.50 mcMMO https://github.com/mcMMO-Dev/mcMMO diff --git a/src/main/java/com/gmail/nossr50/listeners/SelfListener.java b/src/main/java/com/gmail/nossr50/listeners/SelfListener.java index 8c995bd48..79f45bde5 100644 --- a/src/main/java/com/gmail/nossr50/listeners/SelfListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/SelfListener.java @@ -95,23 +95,6 @@ public class SelfListener implements Listener { return; } - int threshold = ExperienceConfig.getInstance().getDiminishedReturnsThreshold(primarySkillType); - - if (threshold <= 0 || !ExperienceConfig.getInstance().getDiminishedReturnsEnabled()) { - // Diminished returns is turned off - return; - } - - - if (event.getRawXpGained() <= 0) { - // Don't calculate for XP subtraction - return; - } - - if (primarySkillType.isChildSkill()) { - return; - } - int earlyLevelBonusXPCap = mcMMO.isRetroModeEnabled() ? 50 : 5; int earlyGameBonusXP = 0; @@ -123,6 +106,22 @@ public class SelfListener implements Listener { event.setRawXpGained(event.getRawXpGained() + earlyGameBonusXP); } + int threshold = ExperienceConfig.getInstance().getDiminishedReturnsThreshold(primarySkillType); + + if (threshold <= 0 || !ExperienceConfig.getInstance().getDiminishedReturnsEnabled()) { + // Diminished returns is turned off + return; + } + + if (event.getRawXpGained() <= 0) { + // Don't calculate for XP subtraction + return; + } + + if (primarySkillType.isChildSkill()) { + return; + } + final float rawXp = event.getRawXpGained(); float guaranteedMinimum = ExperienceConfig.getInstance().getDiminishedReturnsCap() * rawXp;