Added '/mcnotify' command to toggle ability notifications on/off

This commit is contained in:
GJ 2013-02-19 13:18:27 -05:00
parent f189907ff8
commit 5c76ef312f
7 changed files with 69 additions and 0 deletions

View File

@ -34,6 +34,8 @@ Version 1.4.00-dev
+ 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 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 and Green Terra consuming twice the amount of seed needed
= Fixed Green Terra not also checking Green Thumb permissions

View File

@ -20,6 +20,7 @@ import com.gmail.nossr50.commands.admin.XprateCommand;
import com.gmail.nossr50.commands.player.InspectCommand;
import com.gmail.nossr50.commands.player.McabilityCommand;
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.McstatsCommand;
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.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());
}
}

View File

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

View File

@ -37,6 +37,7 @@ public class PlayerProfile {
private boolean hoePreparationMode, shovelPreparationMode, swordsPreparationMode, fistsPreparationMode,
pickaxePreparationMode, axePreparationMode;
private boolean abilityUse = true;
private boolean displaySkillNotifications = true;
// Timestamps
private long recentlyHurt;
@ -830,6 +831,18 @@ public class PlayerProfile {
respawnATS = (int) (System.currentTimeMillis() / Misc.TIME_CONVERSION_FACTOR);
}
/*
* Ability Notifications
*/
public boolean useChatNotifications() {
return displaySkillNotifications;
}
public void toggleChatNotifications() {
displaySkillNotifications = !displaySkillNotifications;
}
/*
* Cooldowns
*/

View File

@ -309,6 +309,7 @@ public class mcMMO extends JavaPlugin {
CommandRegistrationHelper.registerSkillresetCommand();
CommandRegistrationHelper.registerHardcoreCommand();
CommandRegistrationHelper.registerVampirismCommand();
CommandRegistrationHelper.registerMcnotifyCommand();
// Spout commands
CommandRegistrationHelper.registerXplockCommand();

View File

@ -435,6 +435,8 @@ Commands.mmoupdate.Start=[[GRAY]]Starting conversion...
Commands.mmoupdate.Finish=[[GREEN]]Conversion finished!
Commands.ModDescription=[[RED]]- Read brief mod description
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.Other=[[GREEN]]--OTHER COMMANDS--
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.mchud=Change your mcMMO HUD style
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.mcrank=Show mcMMO ranking for a player
Commands.Description.mcrefresh=Refresh all cooldowns for mcMMO

View File

@ -101,6 +101,9 @@ commands:
vampirism:
aliases: [mcvampirism]
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:
mcmmo.*:
default: false
@ -601,6 +604,7 @@ permissions:
mcmmo.commands.mcability: true
mcmmo.commands.mchud: true
mcmmo.commands.mcmmo.all: true
mcmmo.commands.mcnotify: true
mcmmo.commands.mcrank: true
mcmmo.commands.mcstats: true
mcmmo.commands.mctop.all: true
@ -724,6 +728,8 @@ permissions:
description: Allows access to the mcmmo command
mcmmo.commands.mcmmo.help:
description: Allows access to the mcmmo help command
mcmmo.commands.mcnotify:
description: Allows access to the mcnotify command
mcmmo.commands.mcpurge:
default: false
description: Allows access to the mcpurge command