Permalink
Browse files

Add RemoteAdmin feature.

  • Loading branch information...
hide92795
hide92795 committed Oct 3, 2013
1 parent 0c1c706 commit 1f187d3cc7a5260515315dde381f41b62cf991d8
Binary file not shown.
@@ -9,6 +9,7 @@
import hide92795.bukkit.plugin.mcbansdetector.listener.PlayerBlockBreakListener;
import hide92795.bukkit.plugin.mcbansdetector.listener.PlayerLoginListener;
import hide92795.bukkit.plugin.mcbansdetector.listener.PlayerLogoutListener;
import hide92795.bukkit.plugin.mcbansdetector.remoteadmin.MCBasnDetectorRemoteAdminRegister;
import hide92795.bukkit.plugin.mcbansdetector.sidebar.SideBarManager;
import ipx.IP;
import ipx.IPMap;
@@ -65,6 +66,7 @@ public void onEnable() {
pm.registerEvents(new PlayerBlockBreakListener(this), this);
pm.registerEvents(new PlayerLogoutListener(this), this);
checkRemoteAdmin();
try {
// Log
@@ -98,6 +100,13 @@ public void onEnable() {
logger.info("MCBansDetector enabled!");
}
private void checkRemoteAdmin() {
if (getServer().getPluginManager().isPluginEnabled("RemoteAdmin")) {
MCBasnDetectorRemoteAdminRegister.register(this);
getLogger().info("Hook into RemoteAdmin");
}
}
private void createUsage() {
usage = new Usage(this);
usage.addCommand("/mcbansdetector-list [" + localize.getString(Type.PAGE) + "]", localize.getString(Type.SHOW_LIST));
@@ -381,6 +390,23 @@ private StringBuilder getCurrentLoginPlayersName() {
return sb;
}
public String getLocalizedMessageForRemoteAdminAdditionalInfo() {
StringBuilder sb = new StringBuilder();
if (warnData.size() == 0) {
sb.append(localize.getString(Type.NO_WARN_PLAYER_LOGIN));
} else {
StringBuilder currentLogin = getCurrentLoginPlayersName();
sb.append(String.format(localize.getString(Type.WARN_PLAYER_LOGIN), warnData.size()));
if (currentLogin.length() != 0) {
sb.append("\n");
sb.append(localize.getString(Type.CURRENT_LOGIN_WARN_PLAYER));
sb.append("\n");
sb.append(currentLogin);
}
}
return sb.toString();
}
public MCBansDetectorAPI getAPI() {
return api;
}
@@ -0,0 +1,18 @@
package hide92795.bukkit.plugin.mcbansdetector.remoteadmin;
import hide92795.bukkit.plugin.mcbansdetector.MCBansDetector;
import hide92795.bukkit.plugin.remoteadmin.api.AdditionalInfo;
import hide92795.bukkit.plugin.remoteadmin.api.AdditionalInfoCreator;
public class MCBansDetectorInfoCreator implements AdditionalInfoCreator {
private MCBansDetector plugin;
public MCBansDetectorInfoCreator(MCBansDetector plugin) {
this.plugin = plugin;
}
@Override
public AdditionalInfo createAdditionalInfo() {
return new AdditionalInfo("MCBansDetector", plugin.getLocalizedMessageForRemoteAdminAdditionalInfo());
}
}
@@ -0,0 +1,10 @@
package hide92795.bukkit.plugin.mcbansdetector.remoteadmin;
import hide92795.bukkit.plugin.mcbansdetector.MCBansDetector;
import hide92795.bukkit.plugin.remoteadmin.RemoteAdmin;
public class MCBasnDetectorRemoteAdminRegister {
public static void register(MCBansDetector plugin) {
((RemoteAdmin) plugin.getServer().getPluginManager().getPlugin("RemoteAdmin")).getAPI().registerCreator(new MCBansDetectorInfoCreator(plugin));
}
}
@@ -1,9 +1,10 @@
name: MCBansDetector
main: hide92795.bukkit.plugin.mcbansdetector.MCBansDetector
version: 1.6.2_2
version: 1.6.2_3
description: Check baned player
author: hide92795
depend: [hide92795CoreLib]
softdepend: [RemoteAdmin]
commands:
mcbansdetector:

0 comments on commit 1f187d3

Please sign in to comment.