further improved hookable functions for use by other plugins, added softdepends for appropriate chat plugins

This commit is contained in:
Brettflan 2011-06-22 20:12:37 -05:00
parent 094486676a
commit 071e8b7b6b
2 changed files with 18 additions and 6 deletions

View File

@ -1,6 +1,12 @@
name: Factions name: Factions
version: 1.3.1 version: 1.3.2
main: org.mcteam.factions.Factions main: org.mcteam.factions.Factions
softdepend:
- Permissions
- Essentials
- EssentialsChat
- HeroChat
- iChat
commands: commands:
f: f:
description: All of the Factions commands description: All of the Factions commands

View File

@ -119,6 +119,7 @@ public class Factions extends JavaPlugin {
setupPermissions(); setupPermissions();
// preload some chat plugins if they're on the server to prevent potential conflicts // preload some chat plugins if they're on the server to prevent potential conflicts
// probably no longer necessary with softdepend list added to plugin.yml, but...
if (Conf.preloadChatPlugins) { if (Conf.preloadChatPlugins) {
preloadPlugin("Essentials"); preloadPlugin("Essentials");
preloadPlugin("EssentialsChat"); preloadPlugin("EssentialsChat");
@ -200,7 +201,7 @@ public class Factions extends JavaPlugin {
// Does player have Faction Chat enabled? If so, chat plugins should preferably not do channels, // Does player have Faction Chat enabled? If so, chat plugins should preferably not do channels,
// local chat, or anything else which targets individual recipients, so Faction Chat can be done // local chat, or anything else which targets individual recipients, so Faction Chat can be done
public static boolean isPlayerFactionChatting(Player player) { public boolean isPlayerFactionChatting(Player player) {
if (player == null) if (player == null)
return false; return false;
FPlayer me = FPlayer.get(player); FPlayer me = FPlayer.get(player);
@ -210,17 +211,22 @@ public class Factions extends JavaPlugin {
} }
// If another plugin is handling insertion of chat tags, this should be used to notify Factions // If another plugin is handling insertion of chat tags, this should be used to notify Factions
public static void handleFactionTagExternally(boolean notByFactions) { public void handleFactionTagExternally(boolean notByFactions) {
Conf.chatTagHandledByAnotherPlugin = notByFactions; Conf.chatTagHandledByAnotherPlugin = notByFactions;
} }
// Is this chat message actually a Factions command, and thus should be left alone by other plugins?
public boolean isFactionsCommand(String check) {
return ((check.startsWith(instance.getBaseCommand()+" ") || check.equals(instance.getBaseCommand())) && Conf.allowNoSlashCommand);
}
// Get a player's faction tag (faction name), mainly for usage by chat plugins for local/channel chat // Get a player's faction tag (faction name), mainly for usage by chat plugins for local/channel chat
public static String getPlayerFactionTag(Player player) { public String getPlayerFactionTag(Player player) {
return getPlayerFactionTagRelation(player, null); return getPlayerFactionTagRelation(player, null);
} }
// Same as above, but with relation (enemy/neutral/ally) coloring potentially added to the tag // Same as above, but with relation (enemy/neutral/ally) coloring potentially added to the tag
public static String getPlayerFactionTagRelation(Player speaker, Player listener) { public String getPlayerFactionTagRelation(Player speaker, Player listener) {
if (speaker == null) if (speaker == null)
return ""; return "";
@ -241,7 +247,7 @@ public class Factions extends JavaPlugin {
} }
// Get a player's title within their faction, mainly for usage by chat plugins for local/channel chat // Get a player's title within their faction, mainly for usage by chat plugins for local/channel chat
public static String getPlayerTitle(Player player) { public String getPlayerTitle(Player player) {
if (player == null) if (player == null)
return ""; return "";