diff --git a/Changelog.txt b/Changelog.txt index ee3700b21..b51191ab7 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,3 +1,27 @@ +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 + 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 Added Cats, Foxes, and Pandas to Taming XP rewards diff --git a/src/main/java/com/gmail/nossr50/listeners/BlockListener.java b/src/main/java/com/gmail/nossr50/listeners/BlockListener.java index ae135ee05..5ef8067a3 100644 --- a/src/main/java/com/gmail/nossr50/listeners/BlockListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/BlockListener.java @@ -33,16 +33,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; @@ -216,37 +213,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 d1896562a..33d5ce6c9 100644 --- a/src/main/java/com/gmail/nossr50/listeners/EntityListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/EntityListener.java @@ -147,7 +147,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/listeners/InventoryListener.java b/src/main/java/com/gmail/nossr50/listeners/InventoryListener.java index 77ffa7642..e688f6024 100644 --- a/src/main/java/com/gmail/nossr50/listeners/InventoryListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/InventoryListener.java @@ -380,8 +380,11 @@ 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; + + //Location can be null here + if(event.getSource().getLocation() != null) + if(WorldBlacklist.isWorldBlacklisted(event.getSource().getLocation().getWorld())) + return; Inventory inventory = event.getDestination(); diff --git a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java index 952cf7a69..f5ee583fe 100644 --- a/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/PlayerListener.java @@ -31,6 +31,8 @@ import com.gmail.nossr50.util.sounds.SoundType; import com.gmail.nossr50.worldguard.WorldGuardManager; import com.gmail.nossr50.worldguard.WorldGuardUtils; import org.bukkit.ChatColor; +import com.gmail.nossr50.events.fake.FakePlayerAnimationEvent; +import org.bukkit.Bukkit; import org.bukkit.GameMode; import org.bukkit.Material; import org.bukkit.block.Block; @@ -744,16 +746,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); diff --git a/src/main/java/com/gmail/nossr50/listeners/SelfListener.java b/src/main/java/com/gmail/nossr50/listeners/SelfListener.java index 5f949e0d1..acff5c282 100644 --- a/src/main/java/com/gmail/nossr50/listeners/SelfListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/SelfListener.java @@ -88,6 +88,17 @@ public class SelfListener implements Listener { return; } + int earlyLevelBonusXPCap = mcMMO.isRetroModeEnabled() ? 50 : 5; + + int earlyGameBonusXP = 0; + + //Give some bonus XP for low levels + if(mcMMOPlayer.getSkillLevel(primarySkillType) < earlyLevelBonusXPCap) + { + earlyGameBonusXP += (mcMMOPlayer.getXpToLevel(primarySkillType) * 0.05); + event.setRawXpGained(event.getRawXpGained() + earlyGameBonusXP); + } + int threshold = ExperienceConfig.getInstance().getDiminishedReturnsThreshold(primarySkillType); if (threshold <= 0 || !ExperienceConfig.getInstance().getDiminishedReturnsEnabled()) { @@ -95,7 +106,6 @@ public class SelfListener implements Listener { return; } - if (event.getRawXpGained() <= 0) { // Don't calculate for XP subtraction return; @@ -105,16 +115,6 @@ public class SelfListener implements Listener { return; } - int earlyLevelBonusXPCap = mcMMO.isRetroModeEnabled() ? 50 : 5; - - int earlyGameBonusXP = 0; - - //Give some bonus XP for low levels - if (mcMMOPlayer.getSkillLevel(primarySkillType) < earlyLevelBonusXPCap) { - earlyGameBonusXP += (mcMMOPlayer.getXpToLevel(primarySkillType) * 0.05); - event.setRawXpGained(event.getRawXpGained() + earlyGameBonusXP); - } - final float rawXp = event.getRawXpGained(); float guaranteedMinimum = ExperienceConfig.getInstance().getDiminishedReturnsCap() * rawXp; 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 a2f985526..18652aaa9 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) { 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 5b08646f1..9942a6615 100644 --- a/src/main/java/com/gmail/nossr50/skills/herbalism/HerbalismManager.java +++ b/src/main/java/com/gmail/nossr50/skills/herbalism/HerbalismManager.java @@ -174,9 +174,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); + 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 cdf83324b..0b9278735 100644 --- a/src/main/java/com/gmail/nossr50/util/MaterialMapStore.java +++ b/src/main/java/com/gmail/nossr50/util/MaterialMapStore.java @@ -7,8 +7,9 @@ import java.util.HashSet; /** * Stores hash tables for item and block names * This allows for better support across multiple versions of Minecraft - *

+ * * This is a temporary class, mcMMO is spaghetti and I'l clean it up later + * */ public class MaterialMapStore { @@ -19,8 +20,10 @@ public class MaterialMapStore { private HashSet herbalismAbilityBlackList; private HashSet blockCrackerWhiteList; private HashSet canMakeShroomyWhiteList; + private HashSet multiBlockEntities; - public MaterialMapStore() { + public MaterialMapStore() + { abilityBlackList = new HashSet<>(); toolBlackList = new HashSet<>(); mossyWhiteList = new HashSet<>(); @@ -28,39 +31,53 @@ public class MaterialMapStore { herbalismAbilityBlackList = new HashSet<>(); blockCrackerWhiteList = new HashSet<>(); canMakeShroomyWhiteList = new HashSet<>(); + multiBlockEntities = new HashSet<>(); fillHardcodedHashSets(); } - public boolean isAbilityActivationBlackListed(Material material) { + public boolean isMultiBlock(Material material) + { + return multiBlockEntities.contains(material.getKey().getKey()); + } + + public boolean isAbilityActivationBlackListed(Material material) + { return abilityBlackList.contains(material.getKey().getKey()); } - public boolean isToolActivationBlackListed(Material material) { + public boolean isToolActivationBlackListed(Material material) + { return toolBlackList.contains(material.getKey().getKey()); } - public boolean isMossyWhiteListed(Material material) { + public boolean isMossyWhiteListed(Material material) + { return mossyWhiteList.contains(material.getKey().getKey()); } - public boolean isLeavesWhiteListed(Material material) { + public boolean isLeavesWhiteListed(Material material) + { return leavesWhiteList.contains(material.getKey().getKey()); } - public boolean isHerbalismAbilityWhiteListed(Material material) { + public boolean isHerbalismAbilityWhiteListed(Material material) + { return herbalismAbilityBlackList.contains(material.getKey().getKey()); } - public boolean isBlockCrackerWhiteListed(Material material) { + public boolean isBlockCrackerWhiteListed(Material material) + { return blockCrackerWhiteList.contains(material.getKey().getKey()); } - public boolean isShroomyWhiteListed(Material material) { + public boolean isShroomyWhiteListed(Material material) + { return canMakeShroomyWhiteList.contains(material.getKey().getKey()); } - private void fillHardcodedHashSets() { + private void fillHardcodedHashSets() + { fillAbilityBlackList(); filltoolBlackList(); fillMossyWhiteList(); @@ -68,26 +85,43 @@ public class MaterialMapStore { fillHerbalismAbilityBlackList(); fillBlockCrackerWhiteList(); fillShroomyWhiteList(); + fillMultiBlockEntitiesList(); } - private void fillShroomyWhiteList() { + 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() + { canMakeShroomyWhiteList.add("dirt"); canMakeShroomyWhiteList.add("grass"); canMakeShroomyWhiteList.add("grass_path"); } - private void fillBlockCrackerWhiteList() { + private void fillBlockCrackerWhiteList() + { blockCrackerWhiteList.add("stone_bricks"); } - private void fillHerbalismAbilityBlackList() { + private void fillHerbalismAbilityBlackList() + { herbalismAbilityBlackList.add("dirt"); herbalismAbilityBlackList.add("grass"); herbalismAbilityBlackList.add("grass_path"); herbalismAbilityBlackList.add("farmland"); } - private void fillLeavesWhiteList() { + private void fillLeavesWhiteList() + { leavesWhiteList.add("oak_leaves"); leavesWhiteList.add("acacia_leaves"); leavesWhiteList.add("birch_leaves"); @@ -96,7 +130,8 @@ public class MaterialMapStore { leavesWhiteList.add("spruce_leaves"); } - private void fillMossyWhiteList() { + private void fillMossyWhiteList() + { mossyWhiteList.add("cobblestone"); mossyWhiteList.add("dirt"); mossyWhiteList.add("grass_path"); @@ -104,7 +139,8 @@ public class MaterialMapStore { mossyWhiteList.add("cobblestone_wall"); } - private void fillAbilityBlackList() { + private void fillAbilityBlackList() + { abilityBlackList.add("black_bed"); abilityBlackList.add("blue_bed"); abilityBlackList.add("brown_bed"); @@ -203,8 +239,9 @@ public class MaterialMapStore { abilityBlackList.add("wall_sign"); //1.13 and lower? abilityBlackList.add("sign"); //1.13 and lower? } - - private void filltoolBlackList() { + + private void filltoolBlackList() + { //TODO: Add anvils / missing logs toolBlackList.add("black_bed"); toolBlackList.add("blue_bed"); @@ -327,7 +364,8 @@ public class MaterialMapStore { toolBlackList.add("spruce_wood"); } - private void addToHashSet(String string, HashSet stringHashSet) { + private void addToHashSet(String string, HashSet stringHashSet) + { stringHashSet.add(string.toLowerCase()); } } diff --git a/src/main/resources/experience.yml b/src/main/resources/experience.yml index ae49fa6ed..70332a567 100644 --- a/src/main/resources/experience.yml +++ b/src/main/resources/experience.yml @@ -267,6 +267,7 @@ Experience_Values: Brown_Mushroom_Block: 70 Mushroom_Stem: 80 Herbalism: + Sweet_Berry_Bush: 300 Seagrass: 10 Tall_Seagrass: 10 Kelp: 3 @@ -336,6 +337,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 @@ -381,8 +386,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 @@ -480,4 +492,5 @@ Experience_Values: Pillager: 2.0 Ravager: 4.0 Trader_Llama: 1.0 + Wandering_trader: 1.0 diff --git a/src/main/resources/locale/locale_de.properties b/src/main/resources/locale/locale_de.properties index d3ae97c7f..d8504e6e2 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. @@ -1029,4 +1026,9 @@ XPRate.Event = &6Es findet derzeit ein Skill Event statt! Du bekommst aktuell &c mcMMO.Description = &3\u00DCber das &emcMMO&3 Projekt:,&6mcMMO ist ein &copen source&6 RPG mod erstellt in Februar 2011&6von &9nossr50&6. Das Ziel ist es ein qualitatives RPG Erlebnis zu liefern.,&3Tips:,&6 - &aNutze &c/mcmmo help&a um Befehle zu sehen &6,- &aNutze &c/skillname&a f\u00FCr detaillierte Skill Infos,&3Entwickler:,&6 - &anossr50 &9(Erfinder & Projektleitung),&6 - &aGJ &9(Fr\u00FChere Projektleitung),&6 - &aNuclearW &9(Entwickler),&6 - &abm01 &9(Entwickler),&6 - &aTfT_02 &9(Entwickler),&6 - &aGlitchfinder &9(Entwickler),&6 - &at00thpick1 &9(Entwickler),&6 - &alumis31 &9 (Urspr\u00FCngliche Deutsche \u00DCbersetzung),&6 - &aOverCrave &9 (Neue Deutsche \u00DCbersetzung & \u00DCberarbeitung),&3N\u00FCtzliche Links:,&6 - &ahttps://github.com/mcMMO-Dev/mcMMO/issues&6 Bug Reporting,&6 - &ahttps://discord.gg/EJGVanb &6 Offizieller Discord (Englisch) 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. \ No newline at end of file +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.