fix chat plugin listeners.

This commit is contained in:
Nick Minkler 2013-09-03 15:44:59 -07:00
parent 15ff2d310b
commit ac1fd3e2e4
8 changed files with 18 additions and 20 deletions

View File

@ -12,7 +12,7 @@
You should have received a copy of the GNU Lesser General Public License
along with Vault. If not, see <http://www.gnu.org/licenses/>.
*/
*/
package net.milkbowl.vault.chat.plugins;
import java.util.logging.Logger;
@ -68,13 +68,11 @@ public class Chat_GroupManager extends Chat {
@EventHandler(priority = EventPriority.MONITOR)
public void onPluginEnable(PluginEnableEvent event) {
if (chat.groupManager == null) {
Plugin perms = plugin.getServer().getPluginManager().getPlugin("GroupManager");
Plugin perms = event.getPlugin();
if (perms != null) {
if (perms.isEnabled()) {
chat.groupManager = (GroupManager) perms;
log.info(String.format("[%s][Chat] %s hooked.", plugin.getDescription().getName(), chat.name));
}
if (perms.getDescription().getName().equals("GroupManager")) {
chat.groupManager = (GroupManager) perms;
log.info(String.format("[%s][Chat] %s hooked.", plugin.getDescription().getName(), chat.name));
}
}
}

View File

@ -67,9 +67,9 @@ public class Chat_PermissionsEx extends Chat {
@EventHandler(priority = EventPriority.MONITOR)
public void onPluginEnable(PluginEnableEvent event) {
if (chat.chat == null) {
Plugin perms = plugin.getServer().getPluginManager().getPlugin("PermissionsEx");
Plugin perms = event.getPlugin();
if (perms != null) {
if (perms.getDescription().getName().equals("PermissionsEx")) {
if (perms.isEnabled()) {
chat.chat = (PermissionsEx) perms;
log.info(String.format("[%s][Chat] %s hooked.", plugin.getDescription().getName(), chat.name));

View File

@ -63,8 +63,8 @@ public class Chat_bPermissions extends Chat {
@EventHandler(priority = EventPriority.MONITOR)
public void onPluginEnable(PluginEnableEvent event) {
if (this.chat.chat == null) {
Plugin chat = plugin.getServer().getPluginManager().getPlugin("bPermissions");
if (chat != null) {
Plugin chat = event.getPlugin();
if (chat.getDescription().getName().equals("bPermissions")) {
this.chat.chat = Permissions.getInfoReader();
log.info(String.format("[%s][Chat] %s hooked.", plugin.getDescription().getName(), "bPermissions"));
}

View File

@ -63,8 +63,8 @@ public class Chat_bPermissions2 extends Chat {
@EventHandler(priority = EventPriority.MONITOR)
public void onPluginEnable(PluginEnableEvent event) {
if (!hooked) {
Plugin chat = plugin.getServer().getPluginManager().getPlugin("bPermissions");
if (chat != null) {
Plugin chat = event.getPlugin();
if (chat.getDescription().getName().equals("bPermissions")) {
hooked = true;
log.info(String.format("[%s][Chat] %s hooked.", plugin.getDescription().getName(), "bPermissions2"));
}

View File

@ -64,8 +64,8 @@ public class Chat_iChat extends Chat {
@EventHandler(priority = EventPriority.MONITOR)
public void onPluginEnable(PluginEnableEvent event) {
if (this.chat.iChat == null) {
Plugin chat = plugin.getServer().getPluginManager().getPlugin("iChat");
if (chat != null) {
Plugin chat = event.getPlugin();
if (chat.getDescription().getName().equals("iChat")) {
this.chat.iChat = ((iChat) chat).API;
log.info(String.format("[%s][Chat] %s hooked.", plugin.getDescription().getName(), "iChat"));
}

View File

@ -62,8 +62,8 @@ public class Chat_mChat extends Chat {
@EventHandler(priority = EventPriority.MONITOR)
public void onPluginEnable(PluginEnableEvent event) {
if (this.chat.mChat == null) {
Plugin chat = plugin.getServer().getPluginManager().getPlugin("mChat");
if (chat != null) {
Plugin chat = event.getPlugin();
if (chat.getDescription().getName().equals("mChat")) {
this.chat.mChat = net.D3GN.MiracleM4n.mChat.mChat.API;
log.info(String.format("[%s][Chat] %s hooked.", plugin.getDescription().getName(), "mChat"));
}

View File

@ -60,8 +60,8 @@ public class Chat_mChatSuite extends Chat {
@EventHandler(priority = EventPriority.MONITOR)
public void onPluginEnable(PluginEnableEvent event) {
if (mChat == null) {
Plugin chat = plugin.getServer().getPluginManager().getPlugin("mChatSuite");
if (chat != null) {
Plugin chat = event.getPlugin();
if (chat.getDescription().getName().equals("mChatSuite")) {
mChat = (mChatSuite) chat;
log.info(String.format("[%s][Chat] %s hooked.", plugin.getDescription().getName(), "mChatSuite"));
}

View File

@ -55,7 +55,7 @@ public class Chat_zPermissions extends Chat {
@EventHandler(priority = EventPriority.MONITOR)
public void onPluginEnable(PluginEnableEvent event) {
if (service == null) {
if (service == null && event.getPlugin().getDescription().getName().equals("zPermissions")) {
service = plugin.getServer().getServicesManager().load(ZPermissionsService.class);
if (service != null)
log.info(String.format("[%s][Chat] %s hooked.", plugin.getDescription().getName(), name));