mirror of
				https://github.com/mcMMO-Dev/mcMMO.git
				synced 2025-11-04 02:53:43 +01:00 
			
		
		
		
	Added '/mcnotify' command to toggle ability notifications on/off
This commit is contained in:
		@@ -34,6 +34,8 @@ Version 1.4.00-dev
 | 
				
			|||||||
 + Added '/hardcore' and '/vampirism' commands for toggling these modes on or off.
 | 
					 + Added '/hardcore' and '/vampirism' commands for toggling these modes on or off.
 | 
				
			||||||
 + Added Block Cracker to Unarmed's Berserk, turn smooth brick into cracked smooth brick
 | 
					 + Added Block Cracker to Unarmed's Berserk, turn smooth brick into cracked smooth brick
 | 
				
			||||||
 + Added config option to disable automatic zip backups.
 | 
					 + Added config option to disable automatic zip backups.
 | 
				
			||||||
 | 
					 + Added particle effects for many abilities.
 | 
				
			||||||
 | 
					 + Added '/mcnotify' command to toggle ability notifications on/off
 | 
				
			||||||
 = Fixed Green Thumb on wheat not working properly at rank 4
 | 
					 = Fixed Green Thumb on wheat not working properly at rank 4
 | 
				
			||||||
 = Fixed Green Thumb and Green Terra consuming twice the amount of seed needed
 | 
					 = Fixed Green Thumb and Green Terra consuming twice the amount of seed needed
 | 
				
			||||||
 = Fixed Green Terra not also checking Green Thumb permissions
 | 
					 = Fixed Green Terra not also checking Green Thumb permissions
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -20,6 +20,7 @@ import com.gmail.nossr50.commands.admin.XprateCommand;
 | 
				
			|||||||
import com.gmail.nossr50.commands.player.InspectCommand;
 | 
					import com.gmail.nossr50.commands.player.InspectCommand;
 | 
				
			||||||
import com.gmail.nossr50.commands.player.McabilityCommand;
 | 
					import com.gmail.nossr50.commands.player.McabilityCommand;
 | 
				
			||||||
import com.gmail.nossr50.commands.player.McmmoCommand;
 | 
					import com.gmail.nossr50.commands.player.McmmoCommand;
 | 
				
			||||||
 | 
					import com.gmail.nossr50.commands.player.McnotifyCommand;
 | 
				
			||||||
import com.gmail.nossr50.commands.player.McrankCommand;
 | 
					import com.gmail.nossr50.commands.player.McrankCommand;
 | 
				
			||||||
import com.gmail.nossr50.commands.player.McstatsCommand;
 | 
					import com.gmail.nossr50.commands.player.McstatsCommand;
 | 
				
			||||||
import com.gmail.nossr50.commands.player.MctopCommand;
 | 
					import com.gmail.nossr50.commands.player.MctopCommand;
 | 
				
			||||||
@@ -358,4 +359,13 @@ public final class CommandRegistrationHelper {
 | 
				
			|||||||
        command.setUsage(command.getUsage() + "\n" + LocaleLoader.getString("Commands.Usage.1", "vampirism", "<" + LocaleLoader.getString("Commands.Usage.Rate") + ">"));
 | 
					        command.setUsage(command.getUsage() + "\n" + LocaleLoader.getString("Commands.Usage.1", "vampirism", "<" + LocaleLoader.getString("Commands.Usage.Rate") + ">"));
 | 
				
			||||||
        command.setExecutor(new VampirismCommand());
 | 
					        command.setExecutor(new VampirismCommand());
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public static void registerMcnotifyCommand() {
 | 
				
			||||||
 | 
					        PluginCommand command = mcMMO.p.getCommand("mcnotify");
 | 
				
			||||||
 | 
					        command.setDescription(LocaleLoader.getString("Commands.Description.mcnotify"));
 | 
				
			||||||
 | 
					        command.setPermission("mcmmo.commands.mcnotify");
 | 
				
			||||||
 | 
					        command.setPermissionMessage(permissionsMessage);
 | 
				
			||||||
 | 
					        command.setUsage(LocaleLoader.getString("Commands.Usage.0", "mcnotify"));
 | 
				
			||||||
 | 
					        command.setExecutor(new McnotifyCommand());
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -0,0 +1,34 @@
 | 
				
			|||||||
 | 
					package com.gmail.nossr50.commands.player;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import org.bukkit.command.Command;
 | 
				
			||||||
 | 
					import org.bukkit.command.CommandExecutor;
 | 
				
			||||||
 | 
					import org.bukkit.command.CommandSender;
 | 
				
			||||||
 | 
					import org.bukkit.entity.Player;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import com.gmail.nossr50.datatypes.PlayerProfile;
 | 
				
			||||||
 | 
					import com.gmail.nossr50.locale.LocaleLoader;
 | 
				
			||||||
 | 
					import com.gmail.nossr50.util.Users;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					public class McnotifyCommand implements CommandExecutor {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
 | 
				
			||||||
 | 
					        switch (args.length) {
 | 
				
			||||||
 | 
					        case 0:
 | 
				
			||||||
 | 
					            PlayerProfile profile = Users.getPlayer((Player) sender).getProfile();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            if (profile.useChatNotifications()) {
 | 
				
			||||||
 | 
					                sender.sendMessage(LocaleLoader.getString("Commands.Notifications.Off"));
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					            else {
 | 
				
			||||||
 | 
					                sender.sendMessage(LocaleLoader.getString("Commands.Notifications.On"));
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            profile.toggleChatNotifications();
 | 
				
			||||||
 | 
					            return true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        default:
 | 
				
			||||||
 | 
					            return false;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
@@ -37,6 +37,7 @@ public class PlayerProfile {
 | 
				
			|||||||
    private boolean hoePreparationMode, shovelPreparationMode, swordsPreparationMode, fistsPreparationMode,
 | 
					    private boolean hoePreparationMode, shovelPreparationMode, swordsPreparationMode, fistsPreparationMode,
 | 
				
			||||||
    pickaxePreparationMode, axePreparationMode;
 | 
					    pickaxePreparationMode, axePreparationMode;
 | 
				
			||||||
    private boolean abilityUse = true;
 | 
					    private boolean abilityUse = true;
 | 
				
			||||||
 | 
					    private boolean displaySkillNotifications = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Timestamps
 | 
					    // Timestamps
 | 
				
			||||||
    private long recentlyHurt;
 | 
					    private long recentlyHurt;
 | 
				
			||||||
@@ -830,6 +831,18 @@ public class PlayerProfile {
 | 
				
			|||||||
        respawnATS = (int) (System.currentTimeMillis() / Misc.TIME_CONVERSION_FACTOR);
 | 
					        respawnATS = (int) (System.currentTimeMillis() / Misc.TIME_CONVERSION_FACTOR);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /*
 | 
				
			||||||
 | 
					     * Ability Notifications
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public boolean useChatNotifications() {
 | 
				
			||||||
 | 
					        return displaySkillNotifications;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    public void toggleChatNotifications() {
 | 
				
			||||||
 | 
					        displaySkillNotifications = !displaySkillNotifications;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /*
 | 
					    /*
 | 
				
			||||||
     * Cooldowns
 | 
					     * Cooldowns
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -309,6 +309,7 @@ public class mcMMO extends JavaPlugin {
 | 
				
			|||||||
        CommandRegistrationHelper.registerSkillresetCommand();
 | 
					        CommandRegistrationHelper.registerSkillresetCommand();
 | 
				
			||||||
        CommandRegistrationHelper.registerHardcoreCommand();
 | 
					        CommandRegistrationHelper.registerHardcoreCommand();
 | 
				
			||||||
        CommandRegistrationHelper.registerVampirismCommand();
 | 
					        CommandRegistrationHelper.registerVampirismCommand();
 | 
				
			||||||
 | 
					        CommandRegistrationHelper.registerMcnotifyCommand();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // Spout commands
 | 
					        // Spout commands
 | 
				
			||||||
        CommandRegistrationHelper.registerXplockCommand();
 | 
					        CommandRegistrationHelper.registerXplockCommand();
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -435,6 +435,8 @@ Commands.mmoupdate.Start=[[GRAY]]Starting conversion...
 | 
				
			|||||||
Commands.mmoupdate.Finish=[[GREEN]]Conversion finished!
 | 
					Commands.mmoupdate.Finish=[[GREEN]]Conversion finished!
 | 
				
			||||||
Commands.ModDescription=[[RED]]- Read brief mod description
 | 
					Commands.ModDescription=[[RED]]- Read brief mod description
 | 
				
			||||||
Commands.NoConsole=This command does not support console usage.
 | 
					Commands.NoConsole=This command does not support console usage.
 | 
				
			||||||
 | 
					Commands.Notifications.Off=Ability notifications toggled [[RED]]off
 | 
				
			||||||
 | 
					Commands.Notifications.On=Ability notifications toggled [[GREEN]]on
 | 
				
			||||||
Commands.Offline=[[RED]]This command does not work for offline players.
 | 
					Commands.Offline=[[RED]]This command does not work for offline players.
 | 
				
			||||||
Commands.Other=[[GREEN]]--OTHER COMMANDS--
 | 
					Commands.Other=[[GREEN]]--OTHER COMMANDS--
 | 
				
			||||||
Commands.Party.Header=[[RED]]-----[][[GREEN]]PARTY[[RED]][]-----
 | 
					Commands.Party.Header=[[RED]]-----[][[GREEN]]PARTY[[RED]][]-----
 | 
				
			||||||
@@ -707,6 +709,7 @@ Commands.Description.mcability=Toggle mcMMO abilities being readied on right-cli
 | 
				
			|||||||
Commands.Description.mcgod=Toggle mcMMO god-mode on/off
 | 
					Commands.Description.mcgod=Toggle mcMMO god-mode on/off
 | 
				
			||||||
Commands.Description.mchud=Change your mcMMO HUD style
 | 
					Commands.Description.mchud=Change your mcMMO HUD style
 | 
				
			||||||
Commands.Description.mcmmo=Show a brief description of mcMMO
 | 
					Commands.Description.mcmmo=Show a brief description of mcMMO
 | 
				
			||||||
 | 
					Commands.Description.mcnotify=Toggle mcMMO abilities chat display notifications on/off
 | 
				
			||||||
Commands.Description.mcpurge=Purge users with no mcMMO levels and users who have not connected in over {0} months from the mcMMO database.
 | 
					Commands.Description.mcpurge=Purge users with no mcMMO levels and users who have not connected in over {0} months from the mcMMO database.
 | 
				
			||||||
Commands.Description.mcrank=Show mcMMO ranking for a player
 | 
					Commands.Description.mcrank=Show mcMMO ranking for a player
 | 
				
			||||||
Commands.Description.mcrefresh=Refresh all cooldowns for mcMMO
 | 
					Commands.Description.mcrefresh=Refresh all cooldowns for mcMMO
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -101,6 +101,9 @@ commands:
 | 
				
			|||||||
    vampirism:
 | 
					    vampirism:
 | 
				
			||||||
        aliases: [mcvampirism]
 | 
					        aliases: [mcvampirism]
 | 
				
			||||||
        description: Modify the mcMMO vampirism percentage or toggle vampirism mode on/off
 | 
					        description: Modify the mcMMO vampirism percentage or toggle vampirism mode on/off
 | 
				
			||||||
 | 
					    mcnotify:
 | 
				
			||||||
 | 
					        aliases: [notify]
 | 
				
			||||||
 | 
					        description: Toggle mcMMO abilities chat display notifications on/off
 | 
				
			||||||
permissions:
 | 
					permissions:
 | 
				
			||||||
    mcmmo.*:
 | 
					    mcmmo.*:
 | 
				
			||||||
        default: false
 | 
					        default: false
 | 
				
			||||||
@@ -601,6 +604,7 @@ permissions:
 | 
				
			|||||||
            mcmmo.commands.mcability: true
 | 
					            mcmmo.commands.mcability: true
 | 
				
			||||||
            mcmmo.commands.mchud: true
 | 
					            mcmmo.commands.mchud: true
 | 
				
			||||||
            mcmmo.commands.mcmmo.all: true
 | 
					            mcmmo.commands.mcmmo.all: true
 | 
				
			||||||
 | 
					            mcmmo.commands.mcnotify: true
 | 
				
			||||||
            mcmmo.commands.mcrank: true
 | 
					            mcmmo.commands.mcrank: true
 | 
				
			||||||
            mcmmo.commands.mcstats: true
 | 
					            mcmmo.commands.mcstats: true
 | 
				
			||||||
            mcmmo.commands.mctop.all: true
 | 
					            mcmmo.commands.mctop.all: true
 | 
				
			||||||
@@ -724,6 +728,8 @@ permissions:
 | 
				
			|||||||
        description: Allows access to the mcmmo command
 | 
					        description: Allows access to the mcmmo command
 | 
				
			||||||
    mcmmo.commands.mcmmo.help:
 | 
					    mcmmo.commands.mcmmo.help:
 | 
				
			||||||
        description: Allows access to the mcmmo help command
 | 
					        description: Allows access to the mcmmo help command
 | 
				
			||||||
 | 
					    mcmmo.commands.mcnotify:
 | 
				
			||||||
 | 
					        description: Allows access to the mcnotify command
 | 
				
			||||||
    mcmmo.commands.mcpurge:
 | 
					    mcmmo.commands.mcpurge:
 | 
				
			||||||
        default: false
 | 
					        default: false
 | 
				
			||||||
        description: Allows access to the mcpurge command
 | 
					        description: Allows access to the mcpurge command
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user