mirror of
				https://github.com/mcMMO-Dev/mcMMO.git
				synced 2025-11-04 02:53:43 +01:00 
			
		
		
		
	Added methods to ChatAPI for retrieving the current chat mode of a
player. Fixes #641
This commit is contained in:
		@@ -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();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user