Debug Stick is now replaced by /mmodebug

This commit is contained in:
nossr50 2019-07-02 17:29:33 -07:00
parent 8eeebf63e9
commit 1307169d8b
10 changed files with 86 additions and 21 deletions

View File

@ -1,5 +1,13 @@
Version 2.1.94 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 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 Japanese locale (thanks snake)
Updated hu_HU locale (thanks andris155) Updated hu_HU locale (thanks andris155)

View File

@ -23,6 +23,7 @@ public class McmmoCommand implements CommandExecutor {
String description = LocaleLoader.getString("mcMMO.Description"); String description = LocaleLoader.getString("mcMMO.Description");
String[] mcSplit = description.split(","); String[] mcSplit = description.split(",");
sender.sendMessage(mcSplit); sender.sendMessage(mcSplit);
sender.sendMessage(LocaleLoader.getString("mcMMO.Description.FormerDevs"));
if (Config.getInstance().getDonateMessageEnabled()) { if (Config.getInstance().getDonateMessageEnabled()) {
sender.sendMessage(LocaleLoader.getString("MOTD.Donate")); sender.sendMessage(LocaleLoader.getString("MOTD.Donate"));

View File

@ -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;
}
}

View File

@ -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;
}
}
}

View File

@ -81,6 +81,7 @@ public class McMMOPlayer {
private boolean partyChatMode; private boolean partyChatMode;
private boolean adminChatMode; private boolean adminChatMode;
private boolean displaySkillNotifications = true; private boolean displaySkillNotifications = true;
private boolean debugMode;
private boolean abilityUse = true; private boolean abilityUse = true;
private boolean godMode; private boolean godMode;
@ -139,6 +140,8 @@ public class McMMOPlayer {
} }
experienceBarManager = new ExperienceBarManager(this); experienceBarManager = new ExperienceBarManager(this);
debugMode = false; //Debug mode helps solve support issues, players can toggle it on or off
} }
public String getPlayerName() { public String getPlayerName() {
@ -437,6 +440,18 @@ public class McMMOPlayer {
public void togglePartyChatSpying() { chatSpy = !chatSpy;} public void togglePartyChatSpying() { chatSpy = !chatSpy;}
/*
* Debug Mode Flags
*/
public boolean isDebugMode() {
return debugMode;
}
public void toggleDebugMode() {
debugMode = !debugMode;
}
/* /*
* Skill notifications * Skill notifications
*/ */

View File

@ -30,10 +30,7 @@ import com.gmail.nossr50.util.sounds.SoundManager;
import com.gmail.nossr50.util.sounds.SoundType; import com.gmail.nossr50.util.sounds.SoundType;
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.GameMode; import org.bukkit.*;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.Tag;
import org.bukkit.block.*; import org.bukkit.block.*;
import org.bukkit.entity.Item; import org.bukkit.entity.Item;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -619,14 +616,16 @@ public class BlockListener implements Listener {
debugStickDump(player, blockState); 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 //Profile not loaded
if(UserManager.getPlayer(player) == null) if(UserManager.getPlayer(player) == null)
{ {
return; return;
} }
if(player.getInventory().getItemInMainHand().getType() == Material.DEBUG_STICK) if(UserManager.getPlayer(player).isDebugMode())
{ {
if(mcMMO.getPlaceStore().isTrue(blockState)) if(mcMMO.getPlaceStore().isTrue(blockState))
player.sendMessage("[mcMMO DEBUG] This block is not natural and does not reward treasures/XP"); 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()) 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("[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 (HiddenConfig.getInstance().useEnchantmentBuffs()) {
if ((ItemUtils.isPickaxe(heldItem) && !mcMMOPlayer.getAbilityMode(SuperAbilityType.SUPER_BREAKER)) || (ItemUtils.isShovel(heldItem) && !mcMMOPlayer.getAbilityMode(SuperAbilityType.GIGA_DRILL_BREAKER))) { if ((ItemUtils.isPickaxe(heldItem) && !mcMMOPlayer.getAbilityMode(SuperAbilityType.SUPER_BREAKER)) || (ItemUtils.isShovel(heldItem) && !mcMMOPlayer.getAbilityMode(SuperAbilityType.GIGA_DRILL_BREAKER))) {
SkillUtils.removeAbilityBuff(heldItem); SkillUtils.removeAbilityBuff(heldItem);

View File

@ -2,6 +2,7 @@ package com.gmail.nossr50.util.commands;
import com.gmail.nossr50.commands.*; import com.gmail.nossr50.commands.*;
import com.gmail.nossr50.commands.admin.McmmoReloadLocaleCommand; 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.AdminChatCommand;
import com.gmail.nossr50.commands.chat.McChatSpy; import com.gmail.nossr50.commands.chat.McChatSpy;
import com.gmail.nossr50.commands.chat.PartyChatCommand; import com.gmail.nossr50.commands.chat.PartyChatCommand;
@ -150,6 +151,15 @@ public final class CommandRegistrationManager {
command.setExecutor(new MmoInfoCommand()); 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() { private static void registerMcChatSpyCommand() {
PluginCommand command = mcMMO.p.getCommand("mcchatspy"); PluginCommand command = mcMMO.p.getCommand("mcchatspy");
command.setDescription(LocaleLoader.getString("Commands.Description.mcchatspy")); command.setDescription(LocaleLoader.getString("Commands.Description.mcchatspy"));
@ -413,6 +423,7 @@ public final class CommandRegistrationManager {
public static void registerCommands() { public static void registerCommands() {
// Generic Commands // Generic Commands
registerMmoInfoCommand(); registerMmoInfoCommand();
registerMmoDebugCommand();
registerMcImportCommand(); registerMcImportCommand();
registerMcabilityCommand(); registerMcabilityCommand();
registerMcgodCommand(); registerMcgodCommand();

View File

@ -76,6 +76,16 @@ public class NotificationManager {
player.sendMessage(preColoredString); 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) public static void sendPlayerInformation(Player player, NotificationType notificationType, String key, String... values)
{ {
if(UserManager.getPlayer(player) == null || !UserManager.getPlayer(player).useChatNotifications()) if(UserManager.getPlayer(player) == null || !UserManager.getPlayer(player).useChatNotifications())

View File

@ -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 #DO NOT USE COLOR CODES IN THE JSON KEYS
#COLORS ARE DEFINED IN advanced.yml IF YOU WISH TO CHANGE THEM #COLORS ARE DEFINED IN advanced.yml IF YOU WISH TO CHANGE THEM
mcMMO.Template.Prefix=[[GOLD]]([[GREEN]]mcMMO[[GOLD]]) [[GRAY]]{0}
# BEGIN STYLING # BEGIN STYLING
Ability.Generic.Refresh=[[GREEN]]**ABILITIES REFRESHED!** Ability.Generic.Refresh=[[GREEN]]**ABILITIES REFRESHED!**
Ability.Generic.Template.Lock=[[GRAY]]{0} 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. Combat.TouchedFuzzy=[[DARK_RED]]Touched Fuzzy. Felt Dizzy.
#COMMANDS #COMMANDS
##generic ##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.1=[[GREEN]]You were awarded {0} levels in all skills!
Commands.addlevels.AwardAll.2=All skills have been modified for {0}. Commands.addlevels.AwardAll.2=All skills have been modified for {0}.
Commands.addlevels.AwardSkill.1=[[GREEN]]You were awarded {0} levels in {1}! 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.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.Mechanics=[[DARK_AQUA]]-=[]=====[][[GOLD]] Mechanics [[DARK_AQUA]][]=====[]=-
Commands.MmoInfo.Stats=STATS: {0} 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.NoInvites=[[RED]]You have no invites at this time
mcMMO.NoPermission=[[DARK_RED]]Insufficient permissions. 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. 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.mcstats=Show your mcMMO levels and XP
Commands.Description.mctop=Show mcMMO leader boards Commands.Description.mctop=Show mcMMO leader boards
Commands.Description.mmoedit=Edit mcMMO levels for a user 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.mmoupdate=Migrate mcMMO database from an old database into the current one
Commands.Description.mcconvert=Converts database types or experience formula types 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) Commands.Description.mmoshowdb=Show the name of the current database type (for later use with /mmoupdate)

View File

@ -19,6 +19,9 @@ load: STARTUP
api-version: 1.13 api-version: 1.13
commands: commands:
mmodebug:
aliases: [mcmmodebugmode]
description: Toggles a debug mode which will print useful information to chat
mmoinfo: mmoinfo:
aliases: [mcinfo] aliases: [mcinfo]
description: Info pages for mcMMO description: Info pages for mcMMO