mirror of
https://github.com/cnaude/PurpleIRC-spigot.git
synced 2025-02-10 00:22:01 +01:00
Add NTheEndAgain hooks.
This commit is contained in:
parent
f78a833bff
commit
ecd89e7e25
8
pom.xml
8
pom.xml
@ -119,6 +119,14 @@
|
||||
<version>18.0</version>
|
||||
</dependency>
|
||||
|
||||
<!-- NTheEndAgain -->
|
||||
<dependency>
|
||||
<groupId>com.cnaude.nplugins</groupId>
|
||||
<artifactId>ntheendagain</artifactId>
|
||||
<version>0.6.10-SNAPSHOT</version>
|
||||
<type>jar</type>
|
||||
</dependency>
|
||||
|
||||
<!-- Essentials -->
|
||||
<dependency>
|
||||
<groupId>com.cnaude.essentials</groupId>
|
||||
|
@ -0,0 +1,53 @@
|
||||
/*
|
||||
* 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 fr.ribesg.bukkit.ntheendagain.event.RegenEvent;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Chris Naude
|
||||
*/
|
||||
public class NTheEndAgainListener implements Listener {
|
||||
|
||||
private final PurpleIRC plugin;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param plugin the PurpleIRC plugin
|
||||
*/
|
||||
public NTheEndAgainListener(PurpleIRC plugin) {
|
||||
this.plugin = plugin;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param event
|
||||
*/
|
||||
@EventHandler
|
||||
public void onRegenEvent(RegenEvent event) {
|
||||
for (PurpleBot ircBot : plugin.ircBots.values()) {
|
||||
ircBot.nTheEndNotify(event.getMessages(), ircBot.botNick, "ntheendagain-" + event.getType());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -1437,6 +1437,23 @@ public final class PurpleBot {
|
||||
}
|
||||
}
|
||||
|
||||
public void nTheEndNotify(String messages[], String botNick, String messageType) {
|
||||
if (!this.isConnected()) {
|
||||
return;
|
||||
}
|
||||
for (String message : messages) {
|
||||
for (String channelName : botChannels) {
|
||||
if (isMessageEnabled(channelName, messageType)) {
|
||||
asyncIRCMessage(
|
||||
channelName,
|
||||
plugin.tokenizer.gameChatToIRCTokenizer(
|
||||
plugin.getMsgTemplate(botNick, channelName, messageType),
|
||||
message));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param channelName
|
||||
|
@ -32,6 +32,7 @@ import com.cnaude.purpleirc.GameListeners.GamePlayerQuitListener;
|
||||
import com.cnaude.purpleirc.GameListeners.GameServerCommandListener;
|
||||
import com.cnaude.purpleirc.GameListeners.HeroChatListener;
|
||||
import com.cnaude.purpleirc.GameListeners.McMMOChatListener;
|
||||
import com.cnaude.purpleirc.GameListeners.NTheEndAgainListener;
|
||||
import com.cnaude.purpleirc.GameListeners.OreBroadcastListener;
|
||||
import com.cnaude.purpleirc.GameListeners.PrismListener;
|
||||
import com.cnaude.purpleirc.GameListeners.RedditStreamListener;
|
||||
@ -202,6 +203,7 @@ public class PurpleIRC extends JavaPlugin {
|
||||
|
||||
final String PL_ESSENTIALS = "Essentials";
|
||||
final String PL_REPORTRTS = "ReportRTS";
|
||||
final String PL_NTHE_END_AGAIN = "NTheEndAgain";
|
||||
final String PL_SUPERVANISH = "SuperVanish";
|
||||
final String PL_VANISHNOPACKET = "VanishNoPacket";
|
||||
final String PL_OREBROADCAST = "OreBroadcast";
|
||||
@ -1614,6 +1616,12 @@ public class PurpleIRC extends JavaPlugin {
|
||||
} else {
|
||||
hookList.add(hookFormat(PL_REPORTRTS, false));
|
||||
}
|
||||
if (isPluginEnabled(PL_NTHE_END_AGAIN)) {
|
||||
hookList.add(hookFormat(PL_NTHE_END_AGAIN, true));
|
||||
getServer().getPluginManager().registerEvents(new NTheEndAgainListener(this), this);
|
||||
} else {
|
||||
hookList.add(hookFormat(PL_NTHE_END_AGAIN, false));
|
||||
}
|
||||
if (isPluginEnabled(PL_ESSENTIALS)) {
|
||||
hookList.add(hookFormat(PL_ESSENTIALS, true));
|
||||
getServer().getPluginManager().registerEvents(new EssentialsListener(this), this);
|
||||
|
@ -48,7 +48,7 @@ public class TemplateName {
|
||||
public final static String MCMMO_ADMIN_CHAT = "mcmmo-admin-chat";
|
||||
public final static String MCMMO_PARTY_CHAT = "mcmmo-party-chat";
|
||||
public final static String MCMMO_CHAT = "mcmmo-chat";
|
||||
|
||||
|
||||
public final static String IRC_MCMMO_ADMIN_CHAT = "irc-mcmmo-admin-chat";
|
||||
public final static String IRC_MCMMO_PARTY_CHAT = "irc-mcmmo-party-chat";
|
||||
|
||||
@ -137,10 +137,14 @@ public class TemplateName {
|
||||
|
||||
public final static String FAKE_JOIN = "fake-join";
|
||||
public final static String FAKE_QUIT = "fake-quit";
|
||||
|
||||
|
||||
public final static String GAME_FLOOD_WARNING = "game-flood-warning";
|
||||
public final static String IRC_FLOOD_WARNING = "irc-flood-warning";
|
||||
|
||||
|
||||
public final static String CROSS_CHAT = "cross-chat";
|
||||
|
||||
public final static String NTHE_END_AGAIN_HARD = "ntheendagain-hard";
|
||||
public final static String NTHE_END_AGAIN_SOFT = "ntheendagain-soft";
|
||||
public final static String NTHE_END_AGAIN_CRYSTAL = "ntheendagain-crystal";
|
||||
|
||||
}
|
||||
|
@ -219,6 +219,10 @@ message-format:
|
||||
prism-custom: '[PrismCustom] [Player: %NAME%] [Action: %ACTION%] [Message: %MESSAGE%] [Plugin: %PLUGIN%]'
|
||||
# RedditStream
|
||||
reddit-messages: '[R] %MESSAGE%'
|
||||
# NTheEndAgain
|
||||
ntheendagain-hard: '[NTheEndAgain] %MESSAGE%'
|
||||
ntheendagain-soft: '[NTheEndAgain] %MESSAGE%'
|
||||
ntheendagain-crystal: '[NTheEndAgain] %MESSAGE%'
|
||||
# Defaults below take effect when user joins IRC and matching player is offline
|
||||
default-player-suffix: ''
|
||||
default-player-prefix: ''
|
||||
|
Loading…
Reference in New Issue
Block a user