mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2026-02-20 10:43:12 +01:00
Rewrote how party chat works, now you can use /p to toggle it on or off and ! prefix to enter party chat just like admin chat.
This commit is contained in:
43
vCom.java
43
vCom.java
@@ -67,7 +67,7 @@ private static HashMap<String, Player> hidden = new HashMap<String, Player>();
|
||||
//Party
|
||||
cl.register("/party", "party");
|
||||
cl.register("/pquit", "partyquit");
|
||||
cl.register("/p", "partychat");
|
||||
cl.register("/p", "partyChatToggle", "Toggles party chat on or off");
|
||||
|
||||
//Movement
|
||||
cl.register("/freeze", "freeze");
|
||||
@@ -269,19 +269,6 @@ private static HashMap<String, Player> hidden = new HashMap<String, Player>();
|
||||
}
|
||||
}
|
||||
}
|
||||
public static int partychat(Player player, String[] args){
|
||||
if (args.length < 1) {
|
||||
player.sendMessage(Colors.Rose + "Usage is /p [Message]");
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
if(vUsers.getProfile(player).inParty()){
|
||||
String str = etc.combineSplit(0, args, " ");
|
||||
vChat.partyChat(player, str);
|
||||
return EXIT_SUCCESS;
|
||||
} else{
|
||||
return EXIT_FAIL;
|
||||
}
|
||||
}
|
||||
public static int party(Player player, String[] args){
|
||||
if(vUsers.getProfile(player).inParty()){
|
||||
player.sendMessage(Colors.Red + "You are already in a party, use /pquit to leave it");
|
||||
@@ -1057,7 +1044,29 @@ private static HashMap<String, Player> hidden = new HashMap<String, Player>();
|
||||
}
|
||||
return EXIT_FAIL;
|
||||
}
|
||||
|
||||
//Party chat toggle
|
||||
public static int partyChatToggle(Player player, String[] args)
|
||||
{
|
||||
//Check if party chat is even enabled befor executing anymore code
|
||||
if(!vConfig.getInstance().partyChat()) return EXIT_FAIL;
|
||||
//Check if the player is admin toggled, and if so remove them from that array
|
||||
if(vConfig.getInstance().isAdminToggled(player.getName())){
|
||||
vConfig.getInstance().removeAdminToggled(player.getName());
|
||||
}
|
||||
//Make sure the user has access to the command
|
||||
if(!player.canUseCommand("/p")) return EXIT_FAIL;
|
||||
|
||||
//If the player is already toggled for admin chat, remove them
|
||||
if (vConfig.getInstance().isPartyToggled(null)) {
|
||||
player.sendMessage(Colors.Red + "Party Chat Toggle = off");
|
||||
vConfig.getInstance().removeAdminToggled(player.getName());
|
||||
//Otherwise include them
|
||||
} else {
|
||||
player.sendMessage(Colors.Blue + "Party Chat Toggled on");
|
||||
vConfig.getInstance().addAdminToggled(player.getName());
|
||||
}
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
//=====================================================================
|
||||
//Function: adminChatToggle (/a)
|
||||
//Input: Player player: The player using the command
|
||||
@@ -1068,6 +1077,10 @@ private static HashMap<String, Player> hidden = new HashMap<String, Player>();
|
||||
//=====================================================================
|
||||
public static int adminChatToggle(Player player, String[] args)
|
||||
{
|
||||
//Check if the player is party toggled, and if so remove them from that array
|
||||
if(vConfig.getInstance().isPartyToggled(player.getName())){
|
||||
vConfig.getInstance().removePartyToggled(player.getName());
|
||||
}
|
||||
//Make sure the user has access to the command
|
||||
if(!player.canUseCommand("/a")) return EXIT_FAIL;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user