mirror of
https://github.com/cnaude/PurpleIRC-spigot.git
synced 2025-02-09 08:01:38 +01:00
Add hooks command.
Some refactoring and cleanup.
This commit is contained in:
parent
0542d887b3
commit
5a515b7d82
2
pom.xml
2
pom.xml
@ -355,11 +355,9 @@
|
|||||||
|
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<version>3.2</version>
|
<version>3.2</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<!-- Minimum Minecraft requirement -->
|
|
||||||
<source>1.7</source>
|
<source>1.7</source>
|
||||||
<target>1.7</target>
|
<target>1.7</target>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
@ -52,6 +52,7 @@ public class CommandHandlers implements CommandExecutor {
|
|||||||
commands.put("devoice", new DeVoice(plugin));
|
commands.put("devoice", new DeVoice(plugin));
|
||||||
commands.put("debug", new Debug(plugin));
|
commands.put("debug", new Debug(plugin));
|
||||||
commands.put("disconnect", new Disconnect(plugin));
|
commands.put("disconnect", new Disconnect(plugin));
|
||||||
|
commands.put("hooks", new Hooks(plugin));
|
||||||
commands.put("join", new Join(plugin));
|
commands.put("join", new Join(plugin));
|
||||||
commands.put("kick", new Kick(plugin));
|
commands.put("kick", new Kick(plugin));
|
||||||
commands.put("leave", new Leave(plugin));
|
commands.put("leave", new Leave(plugin));
|
||||||
|
@ -52,7 +52,7 @@ public class CTCP implements IRCCommandInterface {
|
|||||||
plugin.logDebug("Dispatching ctcp command...");
|
plugin.logDebug("Dispatching ctcp command...");
|
||||||
int msgIdx = 2;
|
int msgIdx = 2;
|
||||||
String target;
|
String target;
|
||||||
java.util.List<PurpleBot> myBots = new ArrayList<PurpleBot>();
|
java.util.List<PurpleBot> myBots = new ArrayList<>();
|
||||||
if (plugin.ircBots.containsKey(args[1])) {
|
if (plugin.ircBots.containsKey(args[1])) {
|
||||||
myBots.add(plugin.ircBots.get(args[1]));
|
myBots.add(plugin.ircBots.get(args[1]));
|
||||||
msgIdx = 3;
|
msgIdx = 3;
|
||||||
|
65
src/main/java/com/cnaude/purpleirc/Commands/Hooks.java
Normal file
65
src/main/java/com/cnaude/purpleirc/Commands/Hooks.java
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
/*
|
||||||
|
* 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.Commands;
|
||||||
|
|
||||||
|
import com.cnaude.purpleirc.PurpleIRC;
|
||||||
|
import org.bukkit.command.CommandSender;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author cnaude
|
||||||
|
*/
|
||||||
|
public class Hooks implements IRCCommandInterface {
|
||||||
|
|
||||||
|
private final PurpleIRC plugin;
|
||||||
|
private final String usage = "";
|
||||||
|
private final String desc = "List all hooks";
|
||||||
|
private final String name = "hooks";
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param plugin
|
||||||
|
*/
|
||||||
|
public Hooks(PurpleIRC plugin) {
|
||||||
|
this.plugin = plugin;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param sender
|
||||||
|
* @param args
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void dispatch(CommandSender sender, String[] args) {
|
||||||
|
plugin.getPurpleHooks(sender, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String name() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String desc() {
|
||||||
|
return desc;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String usage() {
|
||||||
|
return usage;
|
||||||
|
}
|
||||||
|
}
|
@ -47,7 +47,7 @@ public class Motd implements IRCCommandInterface {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void dispatch(CommandSender sender, String[] args) {
|
public void dispatch(CommandSender sender, String[] args) {
|
||||||
java.util.List<PurpleBot> myBots = new ArrayList<PurpleBot>();
|
java.util.List<PurpleBot> myBots = new ArrayList<>();
|
||||||
if (args.length >= 2) {
|
if (args.length >= 2) {
|
||||||
if (plugin.ircBots.containsKey(args[1])) {
|
if (plugin.ircBots.containsKey(args[1])) {
|
||||||
myBots.add(plugin.ircBots.get(args[1]));
|
myBots.add(plugin.ircBots.get(args[1]));
|
||||||
|
@ -53,7 +53,7 @@ public class Notice implements IRCCommandInterface {
|
|||||||
plugin.logDebug("Dispatching notice command...");
|
plugin.logDebug("Dispatching notice command...");
|
||||||
int msgIdx = 2;
|
int msgIdx = 2;
|
||||||
String target;
|
String target;
|
||||||
java.util.List<PurpleBot> myBots = new ArrayList<PurpleBot>();
|
java.util.List<PurpleBot> myBots = new ArrayList<>();
|
||||||
if (plugin.ircBots.containsKey(args[1])) {
|
if (plugin.ircBots.containsKey(args[1])) {
|
||||||
myBots.add(plugin.ircBots.get(args[1]));
|
myBots.add(plugin.ircBots.get(args[1]));
|
||||||
msgIdx = 3;
|
msgIdx = 3;
|
||||||
|
@ -54,7 +54,7 @@ public class Send implements IRCCommandInterface {
|
|||||||
if (args.length >= 2) {
|
if (args.length >= 2) {
|
||||||
int msgIdx = 1;
|
int msgIdx = 1;
|
||||||
String channelName = null;
|
String channelName = null;
|
||||||
List<PurpleBot> myBots = new ArrayList<PurpleBot>();
|
List<PurpleBot> myBots = new ArrayList<>();
|
||||||
if (plugin.ircBots.containsKey(args[1])) {
|
if (plugin.ircBots.containsKey(args[1])) {
|
||||||
myBots.add(plugin.ircBots.get(args[1]));
|
myBots.add(plugin.ircBots.get(args[1]));
|
||||||
msgIdx = 2;
|
msgIdx = 2;
|
||||||
|
@ -52,7 +52,7 @@ public class SendRaw implements IRCCommandInterface {
|
|||||||
public void dispatch(CommandSender sender, String[] args) {
|
public void dispatch(CommandSender sender, String[] args) {
|
||||||
if (args.length >= 2) {
|
if (args.length >= 2) {
|
||||||
int msgIdx = 1;
|
int msgIdx = 1;
|
||||||
List<PurpleBot> myBots = new ArrayList<PurpleBot>();
|
List<PurpleBot> myBots = new ArrayList<>();
|
||||||
if (plugin.ircBots.containsKey(args[1])) {
|
if (plugin.ircBots.containsKey(args[1])) {
|
||||||
myBots.add(plugin.ircBots.get(args[1]));
|
myBots.add(plugin.ircBots.get(args[1]));
|
||||||
msgIdx = 2;
|
msgIdx = 2;
|
||||||
|
@ -42,7 +42,7 @@ public class TownyChatHook {
|
|||||||
public TownyChatHook(PurpleIRC plugin) {
|
public TownyChatHook(PurpleIRC plugin) {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
chat = (Chat) plugin.getServer().getPluginManager().getPlugin("TownyChat");
|
chat = (Chat) plugin.getServer().getPluginManager().getPlugin("TownyChat");
|
||||||
townyChannelTypes = new ArrayList<channelTypes>();
|
townyChannelTypes = new ArrayList<>();
|
||||||
townyChannelTypes.add(channelTypes.TOWN);
|
townyChannelTypes.add(channelTypes.TOWN);
|
||||||
townyChannelTypes.add(channelTypes.GLOBAL);
|
townyChannelTypes.add(channelTypes.GLOBAL);
|
||||||
townyChannelTypes.add(channelTypes.NATION);
|
townyChannelTypes.add(channelTypes.NATION);
|
||||||
|
@ -76,6 +76,7 @@ import java.text.Collator;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.TreeMap;
|
import java.util.TreeMap;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
@ -87,8 +88,6 @@ import org.bukkit.command.CommandSender;
|
|||||||
import org.bukkit.configuration.InvalidConfigurationException;
|
import org.bukkit.configuration.InvalidConfigurationException;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.permissions.PermissionAttachment;
|
|
||||||
import org.bukkit.permissions.PermissionAttachmentInfo;
|
|
||||||
import org.bukkit.plugin.Plugin;
|
import org.bukkit.plugin.Plugin;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
import org.pircbotx.IdentServer;
|
import org.pircbotx.IdentServer;
|
||||||
@ -192,6 +191,27 @@ public class PurpleIRC extends JavaPlugin {
|
|||||||
private final File uuidCacheFile;
|
private final File uuidCacheFile;
|
||||||
public int reconnectSuppression;
|
public int reconnectSuppression;
|
||||||
|
|
||||||
|
final String PL_ESSENTIALS = "Essentials";
|
||||||
|
final String PL_REPORTRTS = "ReportRTS";
|
||||||
|
final String PL_SUPERVANISH = "SuperVanish";
|
||||||
|
final String PL_VANISHNOPACKET = "VanishNoPacket";
|
||||||
|
final String PL_OREBROADCAST = "OreBroadcast";
|
||||||
|
final String PL_DYNMAP = "dynmap";
|
||||||
|
final String PL_SHORTIFY = "Shortify";
|
||||||
|
final String PL_DEATHMESSAGES = "DeathMessages";
|
||||||
|
final String PL_JOBS = "Jobs";
|
||||||
|
final String PL_COMMANDBOOK = "CommandBook";
|
||||||
|
final String PL_ADMINPRIVATECHAT = "AdminPrivateChat";
|
||||||
|
final String PL_FACTIONCHAT = "FactionChat";
|
||||||
|
final String PL_MCMMO = "mcMMO";
|
||||||
|
final String PL_CLEVERNOTCH = "CleverNotch";
|
||||||
|
final String PL_TOWNYCHAT = "TownyChat";
|
||||||
|
final String PL_REDDITSTREAM = "RedditStream";
|
||||||
|
final String PL_PRISM = "Prism";
|
||||||
|
final String PL_TITANCHAT = "TitanChat";
|
||||||
|
final String PL_HEROCHAT = "Herochat";
|
||||||
|
List<String> hookList = new ArrayList<>();
|
||||||
|
|
||||||
public PurpleIRC() {
|
public PurpleIRC() {
|
||||||
this.MAINCONFIG = "MAIN-CONFIG";
|
this.MAINCONFIG = "MAIN-CONFIG";
|
||||||
this.sampleFileName = "SampleBot.yml";
|
this.sampleFileName = "SampleBot.yml";
|
||||||
@ -250,146 +270,8 @@ public class PurpleIRC extends JavaPlugin {
|
|||||||
getServer().getPluginManager().registerEvents(new GamePlayerKickListener(this), this);
|
getServer().getPluginManager().registerEvents(new GamePlayerKickListener(this), this);
|
||||||
getServer().getPluginManager().registerEvents(new GamePlayerQuitListener(this), this);
|
getServer().getPluginManager().registerEvents(new GamePlayerQuitListener(this), this);
|
||||||
getServer().getPluginManager().registerEvents(new GameServerCommandListener(this), this);
|
getServer().getPluginManager().registerEvents(new GameServerCommandListener(this), this);
|
||||||
if (isPluginEnabled("Herochat")) {
|
detectHooks();
|
||||||
logInfo("Enabling HeroChat support.");
|
getPurpleHooks(getServer().getConsoleSender(), false);
|
||||||
getServer().getPluginManager().registerEvents(new HeroChatListener(this), this);
|
|
||||||
heroConfig = new YamlConfiguration();
|
|
||||||
heroConfigFile = new File(getServer().getPluginManager()
|
|
||||||
.getPlugin("Herochat").getDataFolder(), "config.yml");
|
|
||||||
try {
|
|
||||||
heroConfig.load(heroConfigFile);
|
|
||||||
} catch (IOException | InvalidConfigurationException ex) {
|
|
||||||
logError(ex.getMessage());
|
|
||||||
}
|
|
||||||
heroChatEmoteFormat = heroConfig.getString("format.emote", "");
|
|
||||||
} else {
|
|
||||||
logInfo("HeroChat not detected.");
|
|
||||||
}
|
|
||||||
if (isPluginEnabled("TitanChat")) {
|
|
||||||
logInfo("Enabling TitanChat support.");
|
|
||||||
getServer().getPluginManager().registerEvents(new TitanChatListener(this), this);
|
|
||||||
} else {
|
|
||||||
logInfo("TitanChat not detected.");
|
|
||||||
}
|
|
||||||
if (isPluginEnabled("Prism")) {
|
|
||||||
logInfo("Enabling Prism support.");
|
|
||||||
getServer().getPluginManager().registerEvents(new PrismListener(this), this);
|
|
||||||
} else {
|
|
||||||
logInfo("Prism not detected.");
|
|
||||||
}
|
|
||||||
if (isPluginEnabled("RedditStream")) {
|
|
||||||
logInfo("Enabling RedditStream support.");
|
|
||||||
getServer().getPluginManager().registerEvents(new RedditStreamListener(this), this);
|
|
||||||
} else {
|
|
||||||
logInfo("RedditStream not detected.");
|
|
||||||
}
|
|
||||||
if (isPluginEnabled("TownyChat")) {
|
|
||||||
logInfo("Enabling TownyChat support.");
|
|
||||||
getServer().getPluginManager().registerEvents(new TownyChatListener(this), this);
|
|
||||||
tcHook = new TownyChatHook(this);
|
|
||||||
} else {
|
|
||||||
logInfo("TownyChat not detected.");
|
|
||||||
}
|
|
||||||
if (isPluginEnabled("CleverNotch")) {
|
|
||||||
logInfo("Enabling CleverNotch support.");
|
|
||||||
getServer().getPluginManager().registerEvents(new CleverNotchListener(this), this);
|
|
||||||
} else {
|
|
||||||
logInfo("CleverNotch not detected.");
|
|
||||||
}
|
|
||||||
if (isPluginEnabled("mcMMO")) {
|
|
||||||
logInfo("Enabling mcMMO support.");
|
|
||||||
getServer().getPluginManager().registerEvents(new McMMOChatListener(this), this);
|
|
||||||
} else {
|
|
||||||
logInfo("mcMMO not detected.");
|
|
||||||
}
|
|
||||||
if (isFactionsEnabled()) {
|
|
||||||
if (isPluginEnabled("FactionChat")) {
|
|
||||||
String factionChatVersion = getServer().getPluginManager().getPlugin("FactionChat").getDescription().getVersion();
|
|
||||||
if (factionChatVersion.startsWith("1.7")) {
|
|
||||||
logError("FactionChat v" + factionChatVersion + " not supported. Please install 1.8 or newer.");
|
|
||||||
} else {
|
|
||||||
logInfo("Enabling FactionChat support.");
|
|
||||||
fcHook = new FactionChatHook(this);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
logInfo("FactionChat not detected.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (isPluginEnabled("AdminPrivateChat")) {
|
|
||||||
logInfo("Enabling AdminPrivateChat support.");
|
|
||||||
adminPrivateChatHook = new AdminPrivateChatHook(this);
|
|
||||||
getServer().getPluginManager().registerEvents(new AdminChatListener(this), this);
|
|
||||||
} else {
|
|
||||||
logInfo("AdminPrivateChat not detected.");
|
|
||||||
}
|
|
||||||
if (isPluginEnabled("CommandBook")) {
|
|
||||||
logInfo("Enabling CommandBook support.");
|
|
||||||
commandBookHook = new CommandBookHook(this);
|
|
||||||
} else {
|
|
||||||
logInfo("CommandBook not detected.");
|
|
||||||
}
|
|
||||||
if (isPluginEnabled("Jobs")) {
|
|
||||||
logInfo("Enabling new Jobs support.");
|
|
||||||
jobsHook = new JobsHook(this);
|
|
||||||
} else {
|
|
||||||
logInfo("Jobs not detected.");
|
|
||||||
}
|
|
||||||
if (isPluginEnabled("DeathMessages")) {
|
|
||||||
logInfo("Enabling DeathMessages support.");
|
|
||||||
getServer().getPluginManager().registerEvents(new DeathMessagesListener(this), this);
|
|
||||||
} else {
|
|
||||||
logInfo("DeathMessages not detected.");
|
|
||||||
}
|
|
||||||
if (isPluginEnabled("Shortify")) {
|
|
||||||
String shortifyVersion = getServer().getPluginManager().getPlugin("Shortify").getDescription().getVersion();
|
|
||||||
if (shortifyVersion.startsWith("1.8")) {
|
|
||||||
logInfo("Enabling Shortify v" + shortifyVersion + " support.");
|
|
||||||
shortifyHook = new ShortifyHook(this);
|
|
||||||
} else {
|
|
||||||
logError("Shortify v" + shortifyVersion + " not supported. Please use the latest version from http://jenkins.cnaude.org/job/Shortify/");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
logInfo("Shortify not detected.");
|
|
||||||
}
|
|
||||||
if (isPluginEnabled("dynmap")) {
|
|
||||||
logInfo("Enabling Dynmap support.");
|
|
||||||
getServer().getPluginManager().registerEvents(new DynmapListener(this), this);
|
|
||||||
dynmapHook = new DynmapHook(this);
|
|
||||||
} else {
|
|
||||||
logInfo("Dynmap not detected.");
|
|
||||||
}
|
|
||||||
if (isPluginEnabled("OreBroadcast")) {
|
|
||||||
logInfo("Enabling OreBroadcast support.");
|
|
||||||
getServer().getPluginManager().registerEvents(new OreBroadcastListener(this), this);
|
|
||||||
} else {
|
|
||||||
logInfo("OreBroadcast not detected.");
|
|
||||||
}
|
|
||||||
vanishHook = new VanishHook(this);
|
|
||||||
if (isPluginEnabled("VanishNoPacket")) {
|
|
||||||
logInfo("Enabling VanishNoPacket support.");
|
|
||||||
getServer().getPluginManager().registerEvents(new VanishNoPacketListener(this), this);
|
|
||||||
} else {
|
|
||||||
logInfo("VanishNoPacket not detected.");
|
|
||||||
}
|
|
||||||
if (isPluginEnabled("SuperVanish")) {
|
|
||||||
logInfo("Enabling SuperVanish support.");
|
|
||||||
superVanishHook = new SuperVanishHook(this);
|
|
||||||
} else {
|
|
||||||
logInfo("SuperVanish not detected.");
|
|
||||||
}
|
|
||||||
if (isPluginEnabled("ReportRTS")) {
|
|
||||||
logInfo("Enabling ReportRTS support.");
|
|
||||||
getServer().getPluginManager().registerEvents(new ReportRTSListener(this), this);
|
|
||||||
reportRTSHook = new ReportRTSHook(this);
|
|
||||||
} else {
|
|
||||||
logInfo("ReportRTS not detected.");
|
|
||||||
}
|
|
||||||
if (isPluginEnabled("Essentials")) {
|
|
||||||
logInfo("Enabling Essentials support.");
|
|
||||||
getServer().getPluginManager().registerEvents(new EssentialsListener(this), this);
|
|
||||||
} else {
|
|
||||||
logInfo("Essentials not detected.");
|
|
||||||
}
|
|
||||||
commandHandlers = new CommandHandlers(this);
|
commandHandlers = new CommandHandlers(this);
|
||||||
ircTabCompleter = new PurpleTabCompleter(this);
|
ircTabCompleter = new PurpleTabCompleter(this);
|
||||||
getCommand("irc").setExecutor(commandHandlers);
|
getCommand("irc").setExecutor(commandHandlers);
|
||||||
@ -414,7 +296,7 @@ public class PurpleIRC extends JavaPlugin {
|
|||||||
botWatcher = new BotWatcher(this);
|
botWatcher = new BotWatcher(this);
|
||||||
ircMessageHandler = new IRCMessageHandler(this);
|
ircMessageHandler = new IRCMessageHandler(this);
|
||||||
commandQueue = new CommandQueueWatcher(this);
|
commandQueue = new CommandQueueWatcher(this);
|
||||||
updateChecker = new UpdateChecker(this);
|
updateChecker = new UpdateChecker(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -902,7 +784,7 @@ public class PurpleIRC extends JavaPlugin {
|
|||||||
Collections.sort(tmp, Collator.getInstance());
|
Collections.sort(tmp, Collator.getInstance());
|
||||||
pList = Joiner.on(listSeparator).join(tmp);
|
pList = Joiner.on(listSeparator).join(tmp);
|
||||||
} else {
|
} else {
|
||||||
// sort without nick prefixes
|
// sort without nick prefixes
|
||||||
pList = Joiner.on(listSeparator).join(playerList.values());
|
pList = Joiner.on(listSeparator).join(playerList.values());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1232,7 +1114,7 @@ public class PurpleIRC extends JavaPlugin {
|
|||||||
logDebug("getGroupPrefix: 10");
|
logDebug("getGroupPrefix: 10");
|
||||||
if (group == null) {
|
if (group == null) {
|
||||||
logDebug("getGroupPrefix: 11");
|
logDebug("getGroupPrefix: 11");
|
||||||
group = "";
|
group = "";
|
||||||
}
|
}
|
||||||
logDebug("getGroupPrefix: 12");
|
logDebug("getGroupPrefix: 12");
|
||||||
prefix = vaultHelpers.chat.getGroupPrefix(worldName, group);
|
prefix = vaultHelpers.chat.getGroupPrefix(worldName, group);
|
||||||
@ -1469,4 +1351,194 @@ public class PurpleIRC extends JavaPlugin {
|
|||||||
return updateCheckerMode;
|
return updateCheckerMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String hookFormat(String name, boolean enabled) {
|
||||||
|
String message;
|
||||||
|
|
||||||
|
if (enabled) {
|
||||||
|
String version = getServer().getPluginManager().getPlugin(name).getDescription().getVersion();
|
||||||
|
logInfo("Enabling " + name + " support.");
|
||||||
|
message = ChatColor.WHITE + "[" + ChatColor.GREEN + "Y" + ChatColor.WHITE + "]";
|
||||||
|
message = message + " [" + ChatColor.GOLD + name + ChatColor.WHITE + "] ["
|
||||||
|
+ ChatColor.GOLD + "v" + version + ChatColor.WHITE + "]";
|
||||||
|
} else {
|
||||||
|
logInfo("Enabling " + name + " support.");
|
||||||
|
message = ChatColor.WHITE + "[" + ChatColor.RED + "N" + ChatColor.WHITE + "]";
|
||||||
|
message = message + " [" + ChatColor.GRAY + name + ChatColor.WHITE + "]";
|
||||||
|
}
|
||||||
|
|
||||||
|
return message;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void detectHooks() {
|
||||||
|
logInfo("Detecting plugin hooks...");
|
||||||
|
if (isPluginEnabled(PL_HEROCHAT)) {
|
||||||
|
hookList.add(hookFormat(PL_HEROCHAT, true));
|
||||||
|
getServer().getPluginManager().registerEvents(new HeroChatListener(this), this);
|
||||||
|
heroConfig = new YamlConfiguration();
|
||||||
|
heroConfigFile = new File(getServer().getPluginManager()
|
||||||
|
.getPlugin(PL_HEROCHAT).getDataFolder(), "config.yml");
|
||||||
|
try {
|
||||||
|
heroConfig.load(heroConfigFile);
|
||||||
|
} catch (IOException | InvalidConfigurationException ex) {
|
||||||
|
logError(ex.getMessage());
|
||||||
|
}
|
||||||
|
heroChatEmoteFormat = heroConfig.getString("format.emote", "");
|
||||||
|
} else {
|
||||||
|
hookList.add(hookFormat(PL_HEROCHAT, false));
|
||||||
|
}
|
||||||
|
if (isPluginEnabled(PL_TITANCHAT)) {
|
||||||
|
hookList.add(hookFormat(PL_TITANCHAT, true));
|
||||||
|
getServer().getPluginManager().registerEvents(new TitanChatListener(this), this);
|
||||||
|
} else {
|
||||||
|
hookList.add(hookFormat(PL_TITANCHAT, false));
|
||||||
|
}
|
||||||
|
if (isPluginEnabled(PL_PRISM)) {
|
||||||
|
hookList.add(hookFormat(PL_PRISM, true));
|
||||||
|
getServer().getPluginManager().registerEvents(new PrismListener(this), this);
|
||||||
|
} else {
|
||||||
|
hookList.add(hookFormat(PL_PRISM, false));
|
||||||
|
}
|
||||||
|
if (isPluginEnabled(PL_REDDITSTREAM)) {
|
||||||
|
hookList.add(hookFormat(PL_REDDITSTREAM, true));
|
||||||
|
getServer().getPluginManager().registerEvents(new RedditStreamListener(this), this);
|
||||||
|
} else {
|
||||||
|
hookList.add(hookFormat(PL_REDDITSTREAM, false));
|
||||||
|
}
|
||||||
|
if (isPluginEnabled(PL_TOWNYCHAT)) {
|
||||||
|
hookList.add(hookFormat(PL_TOWNYCHAT, true));
|
||||||
|
getServer().getPluginManager().registerEvents(new TownyChatListener(this), this);
|
||||||
|
tcHook = new TownyChatHook(this);
|
||||||
|
} else {
|
||||||
|
hookList.add(hookFormat(PL_TOWNYCHAT, false));
|
||||||
|
}
|
||||||
|
if (isPluginEnabled(PL_CLEVERNOTCH)) {
|
||||||
|
hookList.add(hookFormat(PL_CLEVERNOTCH, true));
|
||||||
|
getServer().getPluginManager().registerEvents(new CleverNotchListener(this), this);
|
||||||
|
} else {
|
||||||
|
hookList.add(hookFormat(PL_CLEVERNOTCH, false));
|
||||||
|
}
|
||||||
|
if (isPluginEnabled(PL_MCMMO)) {
|
||||||
|
hookList.add(hookFormat(PL_MCMMO, true));
|
||||||
|
getServer().getPluginManager().registerEvents(new McMMOChatListener(this), this);
|
||||||
|
} else {
|
||||||
|
hookList.add(hookFormat(PL_MCMMO, false));
|
||||||
|
}
|
||||||
|
if (isFactionsEnabled()) {
|
||||||
|
if (isPluginEnabled(PL_FACTIONCHAT)) {
|
||||||
|
String factionChatVersion = getServer().getPluginManager().getPlugin(PL_FACTIONCHAT).getDescription().getVersion();
|
||||||
|
if (factionChatVersion.startsWith("1.7")) {
|
||||||
|
logError(PL_FACTIONCHAT + " v" + factionChatVersion + " not supported. Please install 1.8 or newer.");
|
||||||
|
hookList.add(hookFormat(PL_FACTIONCHAT, false));
|
||||||
|
} else {
|
||||||
|
hookList.add(hookFormat(PL_FACTIONCHAT, true));
|
||||||
|
fcHook = new FactionChatHook(this);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
hookList.add(hookFormat(PL_FACTIONCHAT, false));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
hookList.add(hookFormat(PL_FACTIONCHAT, false));
|
||||||
|
}
|
||||||
|
if (isPluginEnabled(PL_ADMINPRIVATECHAT)) {
|
||||||
|
hookList.add(hookFormat(PL_ADMINPRIVATECHAT, true));
|
||||||
|
adminPrivateChatHook = new AdminPrivateChatHook(this);
|
||||||
|
getServer().getPluginManager().registerEvents(new AdminChatListener(this), this);
|
||||||
|
} else {
|
||||||
|
hookList.add(hookFormat(PL_ADMINPRIVATECHAT, false));
|
||||||
|
}
|
||||||
|
if (isPluginEnabled(PL_COMMANDBOOK)) {
|
||||||
|
hookList.add(hookFormat(PL_COMMANDBOOK, true));
|
||||||
|
commandBookHook = new CommandBookHook(this);
|
||||||
|
} else {
|
||||||
|
hookList.add(hookFormat(PL_COMMANDBOOK, false));
|
||||||
|
}
|
||||||
|
if (isPluginEnabled(PL_JOBS)) {
|
||||||
|
hookList.add(hookFormat(PL_JOBS, true));
|
||||||
|
jobsHook = new JobsHook(this);
|
||||||
|
} else {
|
||||||
|
hookList.add(hookFormat(PL_JOBS, false));
|
||||||
|
}
|
||||||
|
if (isPluginEnabled(PL_DEATHMESSAGES)) {
|
||||||
|
hookList.add(hookFormat(PL_DEATHMESSAGES, true));
|
||||||
|
getServer().getPluginManager().registerEvents(new DeathMessagesListener(this), this);
|
||||||
|
} else {
|
||||||
|
hookList.add(hookFormat(PL_DEATHMESSAGES, false));
|
||||||
|
}
|
||||||
|
if (isPluginEnabled(PL_SHORTIFY)) {
|
||||||
|
String shortifyVersion = getServer().getPluginManager().getPlugin(PL_SHORTIFY).getDescription().getVersion();
|
||||||
|
if (shortifyVersion.startsWith("1.8")) {
|
||||||
|
hookList.add(hookFormat(PL_SHORTIFY, true));
|
||||||
|
shortifyHook = new ShortifyHook(this);
|
||||||
|
} else {
|
||||||
|
hookList.add(hookFormat(PL_SHORTIFY, false));
|
||||||
|
logError(PL_SHORTIFY + " v" + shortifyVersion + " not supported. Please use the latest version from http://jenkins.cnaude.org/job/Shortify/");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
hookList.add(hookFormat(PL_SHORTIFY, false));
|
||||||
|
}
|
||||||
|
if (isPluginEnabled(PL_DYNMAP)) {
|
||||||
|
hookList.add(hookFormat(PL_DYNMAP, true));
|
||||||
|
getServer().getPluginManager().registerEvents(new DynmapListener(this), this);
|
||||||
|
dynmapHook = new DynmapHook(this);
|
||||||
|
} else {
|
||||||
|
hookList.add(hookFormat(PL_DYNMAP, false));
|
||||||
|
}
|
||||||
|
if (isPluginEnabled(PL_OREBROADCAST)) {
|
||||||
|
hookList.add(hookFormat(PL_OREBROADCAST, true));
|
||||||
|
getServer().getPluginManager().registerEvents(new OreBroadcastListener(this), this);
|
||||||
|
} else {
|
||||||
|
hookList.add(hookFormat(PL_OREBROADCAST, false));
|
||||||
|
}
|
||||||
|
vanishHook = new VanishHook(this);
|
||||||
|
if (isPluginEnabled(PL_VANISHNOPACKET)) {
|
||||||
|
hookList.add(hookFormat(PL_VANISHNOPACKET, true));
|
||||||
|
getServer().getPluginManager().registerEvents(new VanishNoPacketListener(this), this);
|
||||||
|
} else {
|
||||||
|
hookList.add(hookFormat(PL_VANISHNOPACKET, false));
|
||||||
|
}
|
||||||
|
if (isPluginEnabled(PL_SUPERVANISH)) {
|
||||||
|
hookList.add(hookFormat(PL_SUPERVANISH, true));
|
||||||
|
superVanishHook = new SuperVanishHook(this);
|
||||||
|
} else {
|
||||||
|
hookList.add(hookFormat(PL_SUPERVANISH, false));
|
||||||
|
}
|
||||||
|
if (isPluginEnabled(PL_REPORTRTS)) {
|
||||||
|
hookList.add(hookFormat(PL_REPORTRTS, true));
|
||||||
|
getServer().getPluginManager().registerEvents(new ReportRTSListener(this), this);
|
||||||
|
reportRTSHook = new ReportRTSHook(this);
|
||||||
|
} else {
|
||||||
|
hookList.add(hookFormat(PL_REPORTRTS, false));
|
||||||
|
}
|
||||||
|
if (isPluginEnabled(PL_ESSENTIALS)) {
|
||||||
|
hookList.add(hookFormat(PL_ESSENTIALS, true));
|
||||||
|
getServer().getPluginManager().registerEvents(new EssentialsListener(this), this);
|
||||||
|
} else {
|
||||||
|
hookList.add(hookFormat(PL_ESSENTIALS, false));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void getPurpleHooks(CommandSender sender, boolean colors) {
|
||||||
|
String header = ChatColor.DARK_PURPLE + "-----[" + ChatColor.WHITE
|
||||||
|
+ " PurpleIRC " + ChatColor.DARK_PURPLE
|
||||||
|
+ "-" + ChatColor.WHITE + " Plugin Hooks " + ChatColor.DARK_PURPLE + "]-----";
|
||||||
|
String footer = ChatColor.DARK_PURPLE + "-------------------------------------";
|
||||||
|
if (colors) {
|
||||||
|
sender.sendMessage(header);
|
||||||
|
} else {
|
||||||
|
sender.sendMessage(ChatColor.stripColor(header));
|
||||||
|
}
|
||||||
|
for (String s : hookList) {
|
||||||
|
if (colors) {
|
||||||
|
sender.sendMessage(s);
|
||||||
|
} else {
|
||||||
|
sender.sendMessage(ChatColor.stripColor(s));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (colors) {
|
||||||
|
sender.sendMessage(footer);
|
||||||
|
} else {
|
||||||
|
sender.sendMessage(ChatColor.stripColor(footer));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -156,7 +156,7 @@ public class Query {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
readString(receiveData, cursor);
|
readString(receiveData, cursor);
|
||||||
final Set<String> players = new HashSet<String>();
|
final Set<String> players = new HashSet<>();
|
||||||
while (cursor.get() < length) {
|
while (cursor.get() < length) {
|
||||||
final String name = readString(receiveData, cursor);
|
final String name = readString(receiveData, cursor);
|
||||||
if (name.length() > 0) {
|
if (name.length() > 0) {
|
||||||
|
@ -107,4 +107,7 @@ permissions:
|
|||||||
default: op
|
default: op
|
||||||
'irc.unload':
|
'irc.unload':
|
||||||
description: Gives player access to the /irc unload command.
|
description: Gives player access to the /irc unload command.
|
||||||
|
default: op
|
||||||
|
'irc.hooks':
|
||||||
|
description: Gives player access to the /irc hooks command.
|
||||||
default: op
|
default: op
|
Loading…
Reference in New Issue
Block a user