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
15 changed files
with
300 additions
and
72 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
54 changes: 54 additions & 0 deletions
54
src/main/java/com/cnaude/purpleirc/GameListeners/DeathMessagesPrimeListener.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,54 @@ | ||
/* | ||
* 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.GameListeners; | ||
|
||
import com.cnaude.purpleirc.PurpleBot; | ||
import com.cnaude.purpleirc.PurpleIRC; | ||
import com.cnaude.purpleirc.TemplateName; | ||
import net.memmove.bukkit.deathmsg.DeathMessagePreparedEvent; | ||
import org.bukkit.event.EventHandler; | ||
import org.bukkit.event.Listener; | ||
|
||
/** | ||
* | ||
* @author Chris Naude | ||
*/ | ||
public class DeathMessagesPrimeListener implements Listener { | ||
|
||
private final PurpleIRC plugin; | ||
|
||
/** | ||
* | ||
* @param plugin the PurpleIRC plugin | ||
*/ | ||
public DeathMessagesPrimeListener(PurpleIRC plugin) { | ||
this.plugin = plugin; | ||
} | ||
|
||
/** | ||
* | ||
* @param event | ||
*/ | ||
@EventHandler | ||
public void onDeathMessageEvent(DeathMessagePreparedEvent event) { | ||
String message = event.getMessage().duplicate().toLegacyText(); | ||
plugin.logDebug("onDeathMessageBroadcastEvent caught: " + message); | ||
for (PurpleBot ircBot : plugin.ircBots.values()) { | ||
ircBot.gameDeath(event.getPlayer(), message, TemplateName.DEATH_MESSAGES); | ||
} | ||
} | ||
} |
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
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
52 changes: 52 additions & 0 deletions
52
src/main/java/com/cnaude/purpleirc/Hooks/EssentialsHook.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,52 @@ | ||
/* | ||
* Copyright (C) 2017 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.earth2me.essentials.Essentials; | ||
import com.earth2me.essentials.User; | ||
import org.bukkit.entity.Player; | ||
|
||
/** | ||
* | ||
* @author cnaude | ||
*/ | ||
public class EssentialsHook { | ||
|
||
private final PurpleIRC plugin; | ||
private final Essentials essentials; | ||
|
||
/** | ||
* | ||
* @param plugin the PurpleIRC plugin | ||
*/ | ||
public EssentialsHook(PurpleIRC plugin) { | ||
this.plugin = plugin; | ||
this.essentials = (Essentials) plugin.getServer().getPluginManager().getPlugin(plugin.PL_ESSENTIALS); | ||
} | ||
|
||
public boolean isMuted(Player player) { | ||
if (essentials != null) { | ||
User user = essentials.getUser(player); | ||
if (user != null) { | ||
return user.isMuted(); | ||
} | ||
} | ||
return false; | ||
} | ||
|
||
} |
Oops, something went wrong.