This repository has been archived by the owner on Jul 27, 2019. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
180 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
62 changes: 62 additions & 0 deletions
62
src/main/java/com/cnaude/purpleirc/Hooks/McMMOChatHook.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* | ||
* Copyright (C) 2014 cnaude | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
package com.cnaude.purpleirc.Hooks; | ||
|
||
import com.cnaude.purpleirc.PurpleIRC; | ||
import com.gmail.nossr50.api.ChatAPI; | ||
import com.gmail.nossr50.api.PartyAPI; | ||
import com.gmail.nossr50.datatypes.party.Party; | ||
import org.bukkit.plugin.Plugin; | ||
|
||
/** | ||
* | ||
* @author cnaude | ||
*/ | ||
public class McMMOChatHook { | ||
|
||
private final PurpleIRC plugin; | ||
private final Plugin mcMMOPlugin; | ||
|
||
/** | ||
* | ||
* @param plugin | ||
*/ | ||
public McMMOChatHook(PurpleIRC plugin) { | ||
this.plugin = plugin; | ||
this.mcMMOPlugin = plugin.getServer().getPluginManager().getPlugin("mcMMO"); | ||
} | ||
|
||
public void sendAdminMessage(String sender, String message) { | ||
if (mcMMOPlugin != null) { | ||
plugin.logDebug("[mcMMOChatHook:sendAdminMessage]: " + message); | ||
ChatAPI.sendAdminChat(mcMMOPlugin, sender, PurpleIRC.PURPLETAG + message); | ||
} | ||
} | ||
|
||
public void sendPartyMessage(String sender, String party, String message) { | ||
if (mcMMOPlugin != null) { | ||
for (Party p : PartyAPI.getParties()) { | ||
if (p.getName().equalsIgnoreCase(party)) { | ||
plugin.logDebug("[mcMMOChatHook:sendPartyMessage]: " + party + " : " + message); | ||
ChatAPI.sendPartyChat(mcMMOPlugin, sender, party, PurpleIRC.PURPLETAG + message); | ||
return; | ||
} | ||
} | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters