Added methods to ChatAPI for retrieving the current chat mode of a

player. Fixes #641
This commit is contained in:
GJ 2013-02-05 12:30:15 -05:00
parent 0f214496f2
commit 2d9dc92f83
2 changed files with 43 additions and 0 deletions

View File

@ -24,6 +24,7 @@ Version 1.4.00-dev
+ Added party XP sharing, when more party members are near the share bonus increases.
+ Added vanilla XP boost for Fishing - includes permissions, config options, etc
+ Added particle effect for bleeding
+ Added methods to check if a player is in party or admin chat to the ChatAPI
= Fixed multiple commands not working properly on offline players
= Fixed /mmoedit not giving feedback when modifying another players stats
= Fixed the guide usage string showing up every time /skillname was called

View File

@ -1,9 +1,11 @@
package com.gmail.nossr50.api;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
import com.gmail.nossr50.chat.ChatManager;
import com.gmail.nossr50.party.PartyManager;
import com.gmail.nossr50.util.Users;
public final class ChatAPI {
private ChatAPI() {}
@ -94,4 +96,44 @@ public final class ChatAPI {
public static void sendAdminChat(String sender, String message) {
sendAdminChat(null, sender, sender, message);
}
/**
* Check if a player is currently talking in party chat.
*
* @param player The player to check
* @return true if the player is using party chat, false otherwise
*/
public static boolean isUsingPartyChat(Player player) {
return Users.getPlayer(player).getPartyChatMode();
}
/**
* Check if a player is currently talking in party chat.
*
* @param playerName The name of the player to check
* @return true if the player is using party chat, false otherwise
*/
public static boolean isUsingPartyChat(String playerName) {
return Users.getPlayer(playerName).getPartyChatMode();
}
/**
* Check if a player is currently talking in admin chat.
*
* @param player The player to check
* @return true if the player is using admin chat, false otherwise
*/
public static boolean isUsingAdminChat(Player player) {
return Users.getPlayer(player).getAdminChatMode();
}
/**
* Check if a player is currently talking in admin chat.
*
* @param playerName The name of the player to check
* @return true if the player is using admin chat, false otherwise
*/
public static boolean isUsingAdminChat(String playerName) {
return Users.getPlayer(playerName).getAdminChatMode();
}
}