Archived
0

Removed static accesses as they break updating on runtime

This commit is contained in:
Pepich
2017-05-11 19:01:13 +02:00
parent 83ab05780b
commit dfdabe2307
3 changed files with 27 additions and 20 deletions

View File

@@ -367,7 +367,8 @@ public class Chatgroups implements Module, Listener
}, '&'); }, '&');
if (ModuleLoader.getModule("Socialspy") != null) if (ModuleLoader.getModule("Socialspy") != null)
{ {
Socialspy.spyBroadcast(sender, "§e" + group + " §a(cg)", message, "/cg", new BroadcastFilter() Socialspy.getSocialspy().spyBroadcast(sender, "§e" + group + " §a(cg)", message, "/cg",
new BroadcastFilter()
{ {
@Override @Override
public boolean sendTo(CommandSender recipient) public boolean sendTo(CommandSender recipient)
@@ -403,7 +404,7 @@ public class Chatgroups implements Module, Listener
}); });
if (ModuleLoader.getModule("Socialspy") != null) if (ModuleLoader.getModule("Socialspy") != null)
{ {
Socialspy.spyBroadcast(Bukkit.getConsoleSender(), "§e" + group + " §a(cg)", message, "/cg", Socialspy.getSocialspy().spyBroadcast(Bukkit.getConsoleSender(), "§e" + group + " §a(cg)", message, "/cg",
new BroadcastFilter() new BroadcastFilter()
{ {
@Override @Override

View File

@@ -17,7 +17,7 @@ import com.redstoner.misc.Utils;
import com.redstoner.modules.Module; import com.redstoner.modules.Module;
import com.redstoner.modules.socialspy.Socialspy; import com.redstoner.modules.socialspy.Socialspy;
@Version(major = 3, minor = 2, revision = 0, compatible = 3) @Version(major = 3, minor = 3, revision = 0, compatible = 3)
public class Message implements Module public class Message implements Module
{ {
HashMap<CommandSender, CommandSender> replyTargets = new HashMap<CommandSender, CommandSender>(); HashMap<CommandSender, CommandSender> replyTargets = new HashMap<CommandSender, CommandSender>();
@@ -45,7 +45,7 @@ public class Message implements Module
{ {
message = Utils.colorify(message, sender); message = Utils.colorify(message, sender);
if (ModuleLoader.getModule("Socialspy") != null) if (ModuleLoader.getModule("Socialspy") != null)
Socialspy.spyBroadcast(sender, p, message, "/m", new BroadcastFilter() Socialspy.getSocialspy().spyBroadcast(sender, p, message, "/m", new BroadcastFilter()
{ {
@Override @Override
public boolean sendTo(CommandSender recipient) public boolean sendTo(CommandSender recipient)
@@ -74,7 +74,7 @@ public class Message implements Module
{ {
message = Utils.colorify(message, sender); message = Utils.colorify(message, sender);
if (ModuleLoader.getModule("Socialspy") != null) if (ModuleLoader.getModule("Socialspy") != null)
Socialspy.spyBroadcast(sender, target, message, "/m", new BroadcastFilter() Socialspy.getSocialspy().spyBroadcast(sender, target, message, "/m", new BroadcastFilter()
{ {
@Override @Override
public boolean sendTo(CommandSender recipient) public boolean sendTo(CommandSender recipient)

View File

@@ -11,13 +11,14 @@ import org.json.simple.JSONArray;
import com.nemez.cmdmgr.Command; import com.nemez.cmdmgr.Command;
import com.nemez.cmdmgr.CommandManager; import com.nemez.cmdmgr.CommandManager;
import com.redstoner.annotations.Version; import com.redstoner.annotations.Version;
import com.redstoner.coremods.moduleLoader.ModuleLoader;
import com.redstoner.misc.BroadcastFilter; import com.redstoner.misc.BroadcastFilter;
import com.redstoner.misc.Main; import com.redstoner.misc.Main;
import com.redstoner.misc.Utils; import com.redstoner.misc.Utils;
import com.redstoner.modules.CoreModule; import com.redstoner.modules.CoreModule;
import com.redstoner.modules.datamanager.DataManager; import com.redstoner.modules.datamanager.DataManager;
@Version(major = 3, minor = 1, revision = 0, compatible = 3) @Version(major = 3, minor = 1, revision = 1, compatible = 3)
public class Socialspy implements CoreModule public class Socialspy implements CoreModule
{ {
@Override @Override
@@ -169,7 +170,7 @@ public class Socialspy implements CoreModule
return true; return true;
} }
public static void spyBroadcast(CommandSender sender, CommandSender target, String message, String command, public void spyBroadcast(CommandSender sender, CommandSender target, String message, String command,
BroadcastFilter filter) BroadcastFilter filter)
{ {
for (Player p : Bukkit.getOnlinePlayers()) for (Player p : Bukkit.getOnlinePlayers())
@@ -185,7 +186,7 @@ public class Socialspy implements CoreModule
} }
} }
public static void spyBroadcast(CommandSender sender, String target, String message, String command, public void spyBroadcast(CommandSender sender, String target, String message, String command,
BroadcastFilter filter) BroadcastFilter filter)
{ {
for (Player p : Bukkit.getOnlinePlayers()) for (Player p : Bukkit.getOnlinePlayers())
@@ -201,8 +202,8 @@ public class Socialspy implements CoreModule
} }
} }
private static String formatMessage(CommandSender formatHolder, CommandSender sender, CommandSender target, private String formatMessage(CommandSender formatHolder, CommandSender sender, CommandSender target, String message,
String message, String command) String command)
{ {
if ((boolean) DataManager.getDataManager().getOrDefault(formatHolder, "stripcolor", false)) if ((boolean) DataManager.getDataManager().getOrDefault(formatHolder, "stripcolor", false))
message = ChatColor.stripColor(message); message = ChatColor.stripColor(message);
@@ -228,7 +229,7 @@ public class Socialspy implements CoreModule
return format; return format;
} }
private static String formatMessage(CommandSender formatHolder, CommandSender sender, String target, String message, private String formatMessage(CommandSender formatHolder, CommandSender sender, String target, String message,
String command) String command)
{ {
if ((boolean) DataManager.getDataManager().getOrDefault(formatHolder, "stripcolor", false)) if ((boolean) DataManager.getDataManager().getOrDefault(formatHolder, "stripcolor", false))
@@ -255,12 +256,12 @@ public class Socialspy implements CoreModule
return format; return format;
} }
private static final String getDefaultFormat() private final String getDefaultFormat()
{ {
return "%s &7to %t %p: %m"; return "%s &7to %t %p: %m";
} }
private static final String getDefaultPrefix() private final String getDefaultPrefix()
{ {
return "&7"; return "&7";
} }
@@ -271,4 +272,9 @@ public class Socialspy implements CoreModule
DataManager.getDataManager().migrateAll("Message"); DataManager.getDataManager().migrateAll("Message");
return true; return true;
} }
public static Socialspy getSocialspy()
{
return (Socialspy) ModuleLoader.getModule("Socialspy");
}
} }