mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-22 21:26:46 +01:00
Changed /p and /a to use /partychat and /adminchat as the default
command name. The use of /p, /pc, /a, and /ac is still supported.
This commit is contained in:
parent
d0ca2b9d4b
commit
d5550c8fd1
@ -52,6 +52,7 @@ Version 1.4.00-dev
|
||||
= Fixed a bug where party join messages weren't displayed
|
||||
= Fixed a bug where Disarm and Deflect had wrong values
|
||||
= Fixed Magic Hunter (Fishing ability) favoring certain enchants
|
||||
! Changed /p and /a to use /partychat and /adminchat as the default command name. The use of /p, /pc, /a, and /ac is still supported.
|
||||
! We're now using Bukkit sounds instead of Spout sounds.
|
||||
! It is now possible to use a negative number for Max_Level in treasures.yml to not use a maximum level, changed default file accordingly
|
||||
! A Fishing catch will now always contains a fish even if a treasure is found
|
||||
@ -70,7 +71,6 @@ Version 1.4.00-dev
|
||||
- Removed Party "master/apprentice" system. Replaced with the new party XP share feature.
|
||||
- Removed unused "healthbar" files from the resources
|
||||
- Removed config options for disabling commands from the config.yml. This should instead be done through permissions.
|
||||
- Removed "ac" alias from /a due to Essentials incompatibilities.
|
||||
- Removed Chimaera Wing
|
||||
|
||||
Version 1.3.14
|
||||
|
@ -7,46 +7,61 @@ import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.chat.ChatManager;
|
||||
import com.gmail.nossr50.commands.CommandHelper;
|
||||
import com.gmail.nossr50.datatypes.McMMOPlayer;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
public class ACommand implements CommandExecutor {
|
||||
public class AdminChatCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
McMMOPlayer mcMMOPlayer;
|
||||
String usage = LocaleLoader.getString("Commands.Usage.1", "a", "<" + LocaleLoader.getString("Commands.Usage.Message") + ">");
|
||||
|
||||
if (CommandHelper.noCommandPermissions(sender, "mcmmo.chat.adminchat")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
switch (args.length) {
|
||||
case 0:
|
||||
if (sender instanceof Player) {
|
||||
mcMMOPlayer = Users.getPlayer((Player) sender);
|
||||
if (!(sender instanceof Player)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (mcMMOPlayer.getPartyChatMode()) {
|
||||
mcMMOPlayer.togglePartyChat();
|
||||
}
|
||||
mcMMOPlayer = Users.getPlayer((Player) sender);
|
||||
|
||||
mcMMOPlayer.toggleAdminChat();
|
||||
// Can't have both party & admin chat at the same time.
|
||||
if (mcMMOPlayer.getPartyChatMode()) {
|
||||
mcMMOPlayer.togglePartyChat();
|
||||
}
|
||||
|
||||
if (mcMMOPlayer.getAdminChatMode()) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.AdminChat.On"));
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.AdminChat.Off"));
|
||||
}
|
||||
mcMMOPlayer.toggleAdminChat();
|
||||
|
||||
if (mcMMOPlayer.getAdminChatMode()) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.AdminChat.On"));
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(usage);
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.AdminChat.Off"));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
default:
|
||||
if (args.length == 1) {
|
||||
if (!(sender instanceof Player)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
mcMMOPlayer = Users.getPlayer((Player) sender);
|
||||
|
||||
if (args[0].equalsIgnoreCase("on")) {
|
||||
mcMMOPlayer.setPartyChat(false);
|
||||
mcMMOPlayer.setAdminChat(true);
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.AdminChat.On"));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("off")) {
|
||||
mcMMOPlayer.setAdminChat(false);
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.AdminChat.Off"));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
StringBuilder builder = new StringBuilder();
|
||||
builder.append(args[0]);
|
||||
|
@ -7,60 +7,69 @@ import org.bukkit.entity.Player;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.chat.ChatManager;
|
||||
import com.gmail.nossr50.commands.CommandHelper;
|
||||
import com.gmail.nossr50.datatypes.McMMOPlayer;
|
||||
import com.gmail.nossr50.locale.LocaleLoader;
|
||||
import com.gmail.nossr50.party.Party;
|
||||
import com.gmail.nossr50.party.PartyManager;
|
||||
import com.gmail.nossr50.util.Users;
|
||||
|
||||
public class PCommand implements CommandExecutor {
|
||||
private final mcMMO plugin;
|
||||
|
||||
public PCommand (mcMMO plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
public class PartyChatCommand implements CommandExecutor {
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command command, String label, String[] args) {
|
||||
McMMOPlayer mcMMOPlayer;
|
||||
String usage = LocaleLoader.getString("Commands.Usage.2", "p", "<" + LocaleLoader.getString("Commands.Usage.PartyName") + ">", "<" + LocaleLoader.getString("Commands.Usage.Message") + ">");
|
||||
|
||||
if (CommandHelper.noCommandPermissions(sender, "mcmmo.commands.party")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
switch (args.length) {
|
||||
case 0:
|
||||
if (sender instanceof Player) {
|
||||
mcMMOPlayer = Users.getPlayer((Player) sender);
|
||||
if (!(sender instanceof Player)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (mcMMOPlayer.getAdminChatMode()) {
|
||||
mcMMOPlayer.toggleAdminChat();
|
||||
}
|
||||
mcMMOPlayer = Users.getPlayer((Player) sender);
|
||||
|
||||
mcMMOPlayer.togglePartyChat();
|
||||
// Can't have both party & admin chat at the same time.
|
||||
if (mcMMOPlayer.getAdminChatMode()) {
|
||||
mcMMOPlayer.toggleAdminChat();
|
||||
}
|
||||
|
||||
if (mcMMOPlayer.getPartyChatMode()) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Party.Chat.On"));
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Party.Chat.Off"));
|
||||
}
|
||||
mcMMOPlayer.togglePartyChat();
|
||||
|
||||
if (mcMMOPlayer.getPartyChatMode()) {
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Party.Chat.On"));
|
||||
}
|
||||
else {
|
||||
sender.sendMessage(usage);
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Party.Chat.Off"));
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
default:
|
||||
if (args.length == 1) {
|
||||
if (!(sender instanceof Player)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
mcMMOPlayer = Users.getPlayer((Player) sender);
|
||||
|
||||
if (args[0].equalsIgnoreCase("on")) {
|
||||
mcMMOPlayer.setAdminChat(false);
|
||||
mcMMOPlayer.setPartyChat(true);
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Party.Chat.On"));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (args[0].equalsIgnoreCase("off")) {
|
||||
mcMMOPlayer.setPartyChat(false);
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Party.Chat.Off"));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (sender instanceof Player) {
|
||||
Player player = (Player) sender;
|
||||
Party party = Users.getPlayer(player).getParty();
|
||||
|
||||
if (party == null) {
|
||||
player.sendMessage(LocaleLoader.getString("Commands.Party.None"));
|
||||
sender.sendMessage(LocaleLoader.getString("Commands.Party.None"));
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -73,11 +82,11 @@ public class PCommand implements CommandExecutor {
|
||||
}
|
||||
|
||||
String message = builder.toString();
|
||||
ChatManager.handlePartyChat(plugin, party, player.getName(), player.getDisplayName(), message);
|
||||
ChatManager.handlePartyChat(mcMMO.p, party, player.getName(), player.getDisplayName(), message);
|
||||
}
|
||||
else {
|
||||
if (args.length < 2) {
|
||||
sender.sendMessage(usage);
|
||||
sender.sendMessage(LocaleLoader.getString("Party.Specify"));
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -96,10 +105,10 @@ public class PCommand implements CommandExecutor {
|
||||
builder.append(args[i]);
|
||||
}
|
||||
|
||||
String ssender = LocaleLoader.getString("Commands.Chat.Console");
|
||||
String consoleSender = LocaleLoader.getString("Commands.Chat.Console");
|
||||
String message = builder.toString();
|
||||
|
||||
ChatManager.handlePartyChat(plugin, party, ssender, ssender, message);
|
||||
ChatManager.handlePartyChat(mcMMO.p, party, consoleSender, consoleSender, message);
|
||||
}
|
||||
|
||||
return true;
|
@ -6,6 +6,8 @@ import java.util.List;
|
||||
import org.bukkit.command.PluginCommand;
|
||||
|
||||
import com.gmail.nossr50.mcMMO;
|
||||
import com.gmail.nossr50.chat.commands.AdminChatCommand;
|
||||
import com.gmail.nossr50.chat.commands.PartyChatCommand;
|
||||
import com.gmail.nossr50.commands.admin.AddlevelsCommand;
|
||||
import com.gmail.nossr50.commands.admin.AddxpCommand;
|
||||
import com.gmail.nossr50.commands.admin.McgodCommand;
|
||||
@ -179,7 +181,7 @@ public final class CommandRegistrationHelper {
|
||||
command.setDescription(LocaleLoader.getString("Commands.Description.xprate"));
|
||||
command.setPermission("mcmmo.commands.xprate;mcmmo.commands.xprate.reset;mcmmo.commands.xprate.set");
|
||||
command.setPermissionMessage(permissionsMessage);
|
||||
command.setUsage(LocaleLoader.getString("Commands.Usage.2", "xprate", "<" + LocaleLoader.getString("Commands.Usage.Rate") + ">", "[" + LocaleLoader.getString("Commands.Usage.True") + "|" + LocaleLoader.getString("Commands.Usage.False")+ "]"));
|
||||
command.setUsage(LocaleLoader.getString("Commands.Usage.2", "xprate", "<" + LocaleLoader.getString("Commands.Usage.Rate") + ">", "<" + LocaleLoader.getString("Commands.Usage.True") + "|" + LocaleLoader.getString("Commands.Usage.False")+ ">"));
|
||||
command.setUsage(command.getUsage() + "\n" + LocaleLoader.getString("Commands.Usage.1", "xprate", "reset"));
|
||||
command.setAliases(aliasList);
|
||||
command.setExecutor(new XprateCommand());
|
||||
@ -266,4 +268,26 @@ public final class CommandRegistrationHelper {
|
||||
command.setUsage(LocaleLoader.getString("Commands.Usage.0", "mmoupdate"));
|
||||
command.setExecutor(new MmoupdateCommand());
|
||||
}
|
||||
|
||||
public static void registerAdminChatCommand() {
|
||||
PluginCommand command = mcMMO.p.getCommand("adminchat");
|
||||
command.setDescription(LocaleLoader.getString("Commands.Description.adminchat"));
|
||||
command.setPermission("mcmmo.chat.adminchat");
|
||||
command.setPermissionMessage(permissionsMessage);
|
||||
command.setUsage(LocaleLoader.getString("Commands.Usage.0", "adminchat"));
|
||||
command.setUsage(command.getUsage() + "\n" + LocaleLoader.getString("Commands.Usage.1", "adminchat", "<" + LocaleLoader.getString("Commands.Usage.On") + "|" + LocaleLoader.getString("Commands.Usage.Off")+ ">"));
|
||||
command.setUsage(command.getUsage() + "\n" + LocaleLoader.getString("Commands.Usage.1", "adminchat", "<" + LocaleLoader.getString("Commands.Usage.Message") + ">"));
|
||||
command.setExecutor(new AdminChatCommand());
|
||||
}
|
||||
|
||||
public static void registerPartyChatCommand() {
|
||||
PluginCommand command = mcMMO.p.getCommand("partychat");
|
||||
command.setDescription(LocaleLoader.getString("Commands.Description.partychat"));
|
||||
command.setPermission("mcmmo.chat.partychat;mcmmo.commands.party");
|
||||
command.setPermissionMessage(permissionsMessage);
|
||||
command.setUsage(LocaleLoader.getString("Commands.Usage.0", "partychat"));
|
||||
command.setUsage(command.getUsage() + "\n" + LocaleLoader.getString("Commands.Usage.1", "partychat", "<" + LocaleLoader.getString("Commands.Usage.On") + "|" + LocaleLoader.getString("Commands.Usage.Off")+ ">"));
|
||||
command.setUsage(command.getUsage() + "\n" + LocaleLoader.getString("Commands.Usage.1", "partychat", "<" + LocaleLoader.getString("Commands.Usage.Message") + ">"));
|
||||
command.setExecutor(new PartyChatCommand());
|
||||
}
|
||||
}
|
||||
|
@ -255,6 +255,10 @@ public class McMMOPlayer {
|
||||
return adminChatMode;
|
||||
}
|
||||
|
||||
public void setAdminChat(boolean enabled) {
|
||||
adminChatMode = enabled;
|
||||
}
|
||||
|
||||
public void toggleAdminChat() {
|
||||
adminChatMode = !adminChatMode;
|
||||
}
|
||||
@ -263,6 +267,10 @@ public class McMMOPlayer {
|
||||
return partyChatMode;
|
||||
}
|
||||
|
||||
public void setPartyChat(boolean enabled) {
|
||||
partyChatMode = enabled;
|
||||
}
|
||||
|
||||
public void togglePartyChat() {
|
||||
partyChatMode = !partyChatMode;
|
||||
}
|
||||
|
@ -22,8 +22,6 @@ import org.mcstats.Metrics.Graph;
|
||||
|
||||
import com.gmail.nossr50.util.blockmeta.chunkmeta.ChunkManager;
|
||||
import com.gmail.nossr50.util.blockmeta.chunkmeta.ChunkManagerFactory;
|
||||
import com.gmail.nossr50.chat.commands.ACommand;
|
||||
import com.gmail.nossr50.chat.commands.PCommand;
|
||||
import com.gmail.nossr50.commands.CommandRegistrationHelper;
|
||||
import com.gmail.nossr50.commands.player.MccCommand;
|
||||
import com.gmail.nossr50.config.AdvancedConfig;
|
||||
@ -293,9 +291,9 @@ public class mcMMO extends JavaPlugin {
|
||||
CommandRegistrationHelper.registerMcstatsCommand();
|
||||
|
||||
// Party commands
|
||||
getCommand("a").setExecutor(new ACommand());
|
||||
CommandRegistrationHelper.registerAdminChatCommand();
|
||||
getCommand("party").setExecutor(new PartyCommand());
|
||||
getCommand("p").setExecutor(new PCommand(this));
|
||||
CommandRegistrationHelper.registerPartyChatCommand();
|
||||
getCommand("ptp").setExecutor(new PtpCommand(this));
|
||||
|
||||
// Other commands
|
||||
|
@ -495,6 +495,8 @@ Commands.Usage.3=[[RED]]Proper usage is /{0} {1} {2} {3}
|
||||
Commands.Usage.False=false
|
||||
Commands.Usage.Level=level
|
||||
Commands.Usage.Message=message
|
||||
Commands.Usage.Off=off
|
||||
Commands.Usage.On=on
|
||||
Commands.Usage.Page=page
|
||||
Commands.Usage.PartyName=party-name
|
||||
Commands.Usage.Password=password
|
||||
@ -538,6 +540,7 @@ Party.Player.Invalid=[[RED]]That is not a valid player.
|
||||
Party.NotOnline=[[DARK_RED]]{0} is not online!
|
||||
Party.Player.InSameParty=[[RED]]{0} already is in your party!
|
||||
Party.PlayerNotInParty=[[DARK_RED]]{0} is not in a party
|
||||
Party.Specify=[[RED]]You must specify a party.
|
||||
Party.Teleport.Dead=[[RED]]You can't teleport to a dead player.
|
||||
Party.Teleport.Hurt=[[RED]]You've been hurt in the last {0} seconds and cannnot teleport.
|
||||
Party.Teleport.Player=[[GREEN]]You have teleported to {0}.
|
||||
@ -690,12 +693,13 @@ Smelting.SkillName=SMELTING
|
||||
|
||||
#COMMAND DESCRIPTIONS
|
||||
Commands.Description.addlevels=Add mcMMO levels to a user
|
||||
Commands.Description.adminchat=Toggle mcMMO admin chat on/off or send admin chat messages
|
||||
Commands.Description.addxp=Add mcMMO XP to a user
|
||||
Commands.Description.inspect=View detailed mcMMO info on another player
|
||||
Commands.Description.mcability=Toggle mcMMO abilities being readied on right-click on/off
|
||||
Commands.Description.mcgod=Toggle mcMMO god-mode on/off
|
||||
Commands.Description.mcmmo=Show a brief description of mcMMO
|
||||
Commands.Description.mcpurge=Purge users with no mcMMO levels and users who haven't 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.mcrefresh=Refresh all cooldowns for mcMMO
|
||||
Commands.Description.mcremove=Remove a user from the mcMMO database
|
||||
@ -703,6 +707,7 @@ 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.mmoupdate=Convert mcMMO database from Flatfile to MySQL
|
||||
Commands.Description.partychat=Toggle mcMMO party chat on/off or send party chat messages
|
||||
Commands.Description.Skill=Display detailed mcMMO skill info for {0}
|
||||
Commands.Description.skillreset=Reset mcMMO levels for a user
|
||||
Commands.Description.xprate=Modify the mcMMO XP rate or start an mcMMO XP event
|
||||
|
@ -64,8 +64,8 @@ commands:
|
||||
description: View detailed mcMMO info on another player
|
||||
mmoupdate:
|
||||
description: Convert from Flat File to MySQL
|
||||
p:
|
||||
aliases: [pc]
|
||||
partychat:
|
||||
aliases: [pc, p]
|
||||
description: Toggle Party chat or send party chat messages
|
||||
skillreset:
|
||||
description: Reset the level of one or all of your skills
|
||||
@ -95,8 +95,8 @@ commands:
|
||||
description: Detailed mcMMO skill info
|
||||
smelting:
|
||||
description: Detailed mcMMO skill info
|
||||
a:
|
||||
aliases: []
|
||||
adminchat:
|
||||
aliases: [ac, a]
|
||||
description: Toggle Admin chat or send admin chat messages
|
||||
mcpurge:
|
||||
description: Purge users with 0 powerlevel and/or who haven't connected in several months from the server DB.
|
||||
|
Loading…
Reference in New Issue
Block a user