diff --git a/Changelog.txt b/Changelog.txt index 5333b994d..c541a9675 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,5 +1,13 @@ Version 2.1.94 + 2 new devs have joined the mcMMO team (electronicboy, kashike), bringing the active dev team to 3 including myself! Strings relating to authors of mcMMO have been updated to reflect this Fixed a bug where 2 people using Tree Feller could result in the tree being rejected for being too big + New command /mmodebug (or /mcmmodebugmode) - Prints useful information when players punch blocks while they are in debug mode + mcMMO no longer prints debug information when you attack stuff with the debug stick, use the new command (/mmodebug) instead + Added locale string 'mcMMO.Description.FormerDevs' + Added locale string 'mcMMO.Template.Prefix' + Added locale string 'Commands.Mmodebug.Toggle' + Added locale string 'Commands.Description.mmodebug' + Tweaked locale string 'mcMMO.Description' Updated Japanese locale (thanks snake) Updated hu_HU locale (thanks andris155) diff --git a/src/main/java/com/gmail/nossr50/commands/McmmoCommand.java b/src/main/java/com/gmail/nossr50/commands/McmmoCommand.java index 0dbe2838c..16280c9d0 100644 --- a/src/main/java/com/gmail/nossr50/commands/McmmoCommand.java +++ b/src/main/java/com/gmail/nossr50/commands/McmmoCommand.java @@ -23,6 +23,7 @@ public class McmmoCommand implements CommandExecutor { String description = LocaleLoader.getString("mcMMO.Description"); String[] mcSplit = description.split(","); sender.sendMessage(mcSplit); + sender.sendMessage(LocaleLoader.getString("mcMMO.Description.FormerDevs")); if (Config.getInstance().getDonateMessageEnabled()) { sender.sendMessage(LocaleLoader.getString("MOTD.Donate")); diff --git a/src/main/java/com/gmail/nossr50/commands/admin/PlayerDebug.java b/src/main/java/com/gmail/nossr50/commands/admin/PlayerDebug.java deleted file mode 100644 index 9ced7e818..000000000 --- a/src/main/java/com/gmail/nossr50/commands/admin/PlayerDebug.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.gmail.nossr50.commands.admin; - -import org.bukkit.command.Command; -import org.bukkit.command.CommandExecutor; -import org.bukkit.command.CommandSender; - -public class PlayerDebug implements CommandExecutor { - - @Override - public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { - return false; - } -} diff --git a/src/main/java/com/gmail/nossr50/commands/admin/PlayerDebugCommand.java b/src/main/java/com/gmail/nossr50/commands/admin/PlayerDebugCommand.java new file mode 100644 index 000000000..aa2726311 --- /dev/null +++ b/src/main/java/com/gmail/nossr50/commands/admin/PlayerDebugCommand.java @@ -0,0 +1,25 @@ +package com.gmail.nossr50.commands.admin; + +import com.gmail.nossr50.datatypes.player.McMMOPlayer; +import com.gmail.nossr50.util.player.NotificationManager; +import com.gmail.nossr50.util.player.UserManager; +import org.bukkit.command.Command; +import org.bukkit.command.CommandExecutor; +import org.bukkit.command.CommandSender; +import org.bukkit.entity.Player; + +public class PlayerDebugCommand implements CommandExecutor { + + @Override + public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { + if(sender instanceof Player) { + McMMOPlayer mcMMOPlayer = UserManager.getPlayer((Player) sender); + mcMMOPlayer.toggleDebugMode(); //Toggle debug mode + NotificationManager.sendPlayerInformationChatOnlyPrefixed(mcMMOPlayer.getPlayer(), "Commands.Mmodebug.Toggle", String.valueOf(mcMMOPlayer.isDebugMode())); + return true; + } else { + return false; + } + } + +} diff --git a/src/main/java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java b/src/main/java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java index f4986d5f4..219b1df16 100644 --- a/src/main/java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java +++ b/src/main/java/com/gmail/nossr50/datatypes/player/McMMOPlayer.java @@ -81,6 +81,7 @@ public class McMMOPlayer { private boolean partyChatMode; private boolean adminChatMode; private boolean displaySkillNotifications = true; + private boolean debugMode; private boolean abilityUse = true; private boolean godMode; @@ -139,6 +140,8 @@ public class McMMOPlayer { } experienceBarManager = new ExperienceBarManager(this); + + debugMode = false; //Debug mode helps solve support issues, players can toggle it on or off } public String getPlayerName() { @@ -437,6 +440,18 @@ public class McMMOPlayer { public void togglePartyChatSpying() { chatSpy = !chatSpy;} + /* + * Debug Mode Flags + */ + + public boolean isDebugMode() { + return debugMode; + } + + public void toggleDebugMode() { + debugMode = !debugMode; + } + /* * Skill notifications */ diff --git a/src/main/java/com/gmail/nossr50/listeners/BlockListener.java b/src/main/java/com/gmail/nossr50/listeners/BlockListener.java index e83c9f96f..dc27a1fac 100644 --- a/src/main/java/com/gmail/nossr50/listeners/BlockListener.java +++ b/src/main/java/com/gmail/nossr50/listeners/BlockListener.java @@ -30,10 +30,7 @@ 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 org.bukkit.GameMode; -import org.bukkit.Location; -import org.bukkit.Material; -import org.bukkit.Tag; +import org.bukkit.*; import org.bukkit.block.*; import org.bukkit.entity.Item; import org.bukkit.entity.Player; @@ -619,14 +616,16 @@ public class BlockListener implements Listener { debugStickDump(player, blockState); } - public void debugStickDump(Player player, BlockState blockState) { + //TODO: Rewrite this + //TODO: Convert into locale strings + private void debugStickDump(Player player, BlockState blockState) { //Profile not loaded if(UserManager.getPlayer(player) == null) { return; } - if(player.getInventory().getItemInMainHand().getType() == Material.DEBUG_STICK) + if(UserManager.getPlayer(player).isDebugMode()) { if(mcMMO.getPlaceStore().isTrue(blockState)) player.sendMessage("[mcMMO DEBUG] This block is not natural and does not reward treasures/XP"); @@ -667,10 +666,12 @@ public class BlockListener implements Listener { if(ExperienceConfig.getInstance().isExperienceBarsEnabled()) player.sendMessage("[mcMMO DEBUG] XP bars are enabled, however you should check per-skill settings to make sure those are enabled."); + + player.sendMessage(ChatColor.RED+"You can turn this debug info off by typing "+ChatColor.GOLD+"/mmodebug"); } } - public void cleanupAbilityTools(Player player, McMMOPlayer mcMMOPlayer, BlockState blockState, ItemStack heldItem) { + private void cleanupAbilityTools(Player player, McMMOPlayer mcMMOPlayer, BlockState blockState, ItemStack heldItem) { if (HiddenConfig.getInstance().useEnchantmentBuffs()) { if ((ItemUtils.isPickaxe(heldItem) && !mcMMOPlayer.getAbilityMode(SuperAbilityType.SUPER_BREAKER)) || (ItemUtils.isShovel(heldItem) && !mcMMOPlayer.getAbilityMode(SuperAbilityType.GIGA_DRILL_BREAKER))) { SkillUtils.removeAbilityBuff(heldItem); diff --git a/src/main/java/com/gmail/nossr50/util/commands/CommandRegistrationManager.java b/src/main/java/com/gmail/nossr50/util/commands/CommandRegistrationManager.java index 2d3ab2360..b69f486e8 100644 --- a/src/main/java/com/gmail/nossr50/util/commands/CommandRegistrationManager.java +++ b/src/main/java/com/gmail/nossr50/util/commands/CommandRegistrationManager.java @@ -2,6 +2,7 @@ package com.gmail.nossr50.util.commands; import com.gmail.nossr50.commands.*; import com.gmail.nossr50.commands.admin.McmmoReloadLocaleCommand; +import com.gmail.nossr50.commands.admin.PlayerDebugCommand; import com.gmail.nossr50.commands.chat.AdminChatCommand; import com.gmail.nossr50.commands.chat.McChatSpy; import com.gmail.nossr50.commands.chat.PartyChatCommand; @@ -150,6 +151,15 @@ public final class CommandRegistrationManager { command.setExecutor(new MmoInfoCommand()); } + private static void registerMmoDebugCommand() { + PluginCommand command = mcMMO.p.getCommand("mmodebug"); + command.setDescription(LocaleLoader.getString("Commands.Description.mmodebug")); + command.setPermission(null); //No perm required to save support headaches + command.setPermissionMessage(permissionsMessage); + command.setUsage(LocaleLoader.getString("Commands.Usage.0", "mmodebug")); + command.setExecutor(new PlayerDebugCommand()); + } + private static void registerMcChatSpyCommand() { PluginCommand command = mcMMO.p.getCommand("mcchatspy"); command.setDescription(LocaleLoader.getString("Commands.Description.mcchatspy")); @@ -413,6 +423,7 @@ public final class CommandRegistrationManager { public static void registerCommands() { // Generic Commands registerMmoInfoCommand(); + registerMmoDebugCommand(); registerMcImportCommand(); registerMcabilityCommand(); registerMcgodCommand(); diff --git a/src/main/java/com/gmail/nossr50/util/player/NotificationManager.java b/src/main/java/com/gmail/nossr50/util/player/NotificationManager.java index 09d9aa697..2bd02aa6a 100644 --- a/src/main/java/com/gmail/nossr50/util/player/NotificationManager.java +++ b/src/main/java/com/gmail/nossr50/util/player/NotificationManager.java @@ -76,6 +76,16 @@ public class NotificationManager { player.sendMessage(preColoredString); } + public static void sendPlayerInformationChatOnlyPrefixed(Player player, String key, String... values) + { + if(UserManager.getPlayer(player) == null || !UserManager.getPlayer(player).useChatNotifications()) + return; + + String preColoredString = LocaleLoader.getString(key, (Object[]) values); + String prefixFormattedMessage = LocaleLoader.getString("mcMMO.Template.Prefix", preColoredString); + player.sendMessage(prefixFormattedMessage); + } + public static void sendPlayerInformation(Player player, NotificationType notificationType, String key, String... values) { if(UserManager.getPlayer(player) == null || !UserManager.getPlayer(player).useChatNotifications()) diff --git a/src/main/resources/locale/locale_en_US.properties b/src/main/resources/locale/locale_en_US.properties index 871e173d9..5c2e100c4 100644 --- a/src/main/resources/locale/locale_en_US.properties +++ b/src/main/resources/locale/locale_en_US.properties @@ -59,6 +59,7 @@ Anvil.SingleItemStack=[[RED]]You cannot salvage or repair item stacks that have #DO NOT USE COLOR CODES IN THE JSON KEYS #COLORS ARE DEFINED IN advanced.yml IF YOU WISH TO CHANGE THEM +mcMMO.Template.Prefix=[[GOLD]]([[GREEN]]mcMMO[[GOLD]]) [[GRAY]]{0} # BEGIN STYLING Ability.Generic.Refresh=[[GREEN]]**ABILITIES REFRESHED!** Ability.Generic.Template.Lock=[[GRAY]]{0} @@ -560,7 +561,8 @@ Combat.TargetDazed=Target was [[DARK_RED]]Dazed Combat.TouchedFuzzy=[[DARK_RED]]Touched Fuzzy. Felt Dizzy. #COMMANDS ##generic -mcMMO.Description=[[DARK_AQUA]]About the [[YELLOW]]mcMMO[[DARK_AQUA]] Project:,[[GOLD]]mcMMO is an [[RED]]open source[[GOLD]] RPG mod created in February 2011,[[GOLD]]by [[BLUE]]nossr50[[GOLD]]. The goal is to provide a quality RPG experience.,[[DARK_AQUA]]Tips:,[[GOLD]] - [[GREEN]]Use [[RED]]/mcmmo help[[GREEN]] to see commands,[[GOLD]] - [[GREEN]]Type [[RED]]/SKILLNAME[[GREEN]] to see detailed skill info,[[DARK_AQUA]]Developers:,[[GOLD]] - [[GREEN]]nossr50 [[BLUE]](Founder & Project Lead),[[GOLD]] - [[GREEN]]GJ [[BLUE]](Former Project Lead),[[GOLD]] - [[GREEN]]NuclearW [[BLUE]](Developer),[[GOLD]] - [[GREEN]]bm01 [[BLUE]](Developer),[[GOLD]] - [[GREEN]]TfT_02 [[BLUE]](Developer),[[GOLD]] - [[GREEN]]Glitchfinder [[BLUE]](Developer),[[GOLD]] - [[GREEN]]t00thpick1 [[BLUE]](Developer),[[DARK_AQUA]]Useful Links:,[[GOLD]] - [[GREEN]]https://github.com/mcMMO-Dev/mcMMO/issues[[GOLD]] Bug Reporting,[[GOLD]] - [[GREEN]]https://discord.gg/EJGVanb [[GOLD]] Official Discord +mcMMO.Description=[[DARK_AQUA]]About the [[YELLOW]]mcMMO[[DARK_AQUA]] Project:,[[GOLD]]mcMMO is an [[RED]]open source[[GOLD]] RPG mod created in February 2011,[[GOLD]]by [[BLUE]]nossr50[[GOLD]]. The goal is to provide a quality RPG experience.,[[DARK_AQUA]]Tips:,[[GOLD]] - [[GREEN]]Use [[RED]]/mcmmo help[[GREEN]] to see commands,[[GOLD]] - [[GREEN]]Type [[RED]]/SKILLNAME[[GREEN]] to see detailed skill info,[[DARK_AQUA]]Developers:,[[GOLD]] - [[GREEN]]nossr50 [[BLUE]](Creator & Project Lead),[[GOLD]] - [[GREEN]]electronicboy [[BLUE]](Dev),[[GOLD]] - [[GREEN]]kashike [[BLUE]](Dev),[[GOLD]] - [[GREEN]]t00thpick1 [[BLUE]](Classic Maintainer) +mcMMO.Description.FormerDevs=[[DARK_AQUA]]Former Devs: [[GREEN]]GJ, NuclearW, bm01, TfT_02, Glitchfinder Commands.addlevels.AwardAll.1=[[GREEN]]You were awarded {0} levels in all skills! Commands.addlevels.AwardAll.2=All skills have been modified for {0}. Commands.addlevels.AwardSkill.1=[[GREEN]]You were awarded {0} levels in {1}! @@ -725,6 +727,7 @@ Commands.MmoInfo.DetailsHeader=[[DARK_AQUA]]-=[]=====[][[GREEN]] Details [[DARK_ Commands.MmoInfo.OldSkill=[[GRAY]]mcMMO skills are being converted into an improved modular skill system, unfortunately this skill has not been converted yet and lacks detailed stats. The new system will allow for faster release times for new mcMMO skills and greater flexibility with existing skills. Commands.MmoInfo.Mechanics=[[DARK_AQUA]]-=[]=====[][[GOLD]] Mechanics [[DARK_AQUA]][]=====[]=- Commands.MmoInfo.Stats=STATS: {0} +Commands.Mmodebug.Toggle=mcMMO Debug Mode is now [[GOLD]]{0}[[GRAY]], use this command again to toggle. With debug mode true, you can punch blocks to print useful information used for support. mcMMO.NoInvites=[[RED]]You have no invites at this time mcMMO.NoPermission=[[DARK_RED]]Insufficient permissions. mcMMO.NoSkillNote=[[DARK_GRAY]]If you don't have access to a skill it will not be shown here. @@ -1059,6 +1062,7 @@ Commands.Description.mcscoreboard=Manage your mcMMO Scoreboard Commands.Description.mcstats=Show your mcMMO levels and XP Commands.Description.mctop=Show mcMMO leader boards Commands.Description.mmoedit=Edit mcMMO levels for a user +Commands.Description.mmodebug=Toggle a debug mode which prints useful information when you hit blocks Commands.Description.mmoupdate=Migrate mcMMO database from an old database into the current one Commands.Description.mcconvert=Converts database types or experience formula types Commands.Description.mmoshowdb=Show the name of the current database type (for later use with /mmoupdate) diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml index 587fa7f0d..04dbc2e41 100644 --- a/src/main/resources/plugin.yml +++ b/src/main/resources/plugin.yml @@ -19,6 +19,9 @@ load: STARTUP api-version: 1.13 commands: + mmodebug: + aliases: [mcmmodebugmode] + description: Toggles a debug mode which will print useful information to chat mmoinfo: aliases: [mcinfo] description: Info pages for mcMMO