Refactor.
This commit is contained in:
parent
0bbb705654
commit
9508556d57
@ -12,7 +12,7 @@ import com.google.common.cache.CacheBuilder;
|
||||
* Handles temporary storage of {@link MessageSnapshot} instances.
|
||||
* @author iKeirNez
|
||||
*/
|
||||
public class ChatSnapManager
|
||||
public class MessageSnapshotManager
|
||||
{
|
||||
// There aren't any List or Set caching implementations
|
||||
// For an easy work around, we store values as the Key
|
||||
@ -23,7 +23,7 @@ public class ChatSnapManager
|
||||
.expireAfterWrite(30, TimeUnit.MINUTES)
|
||||
.build();
|
||||
|
||||
public ChatSnapManager()
|
||||
public MessageSnapshotManager()
|
||||
{
|
||||
|
||||
}
|
@ -16,19 +16,19 @@ import mineplex.core.chatsnap.commands.ChatCacheCommand;
|
||||
/**
|
||||
* @author iKeirNez
|
||||
*/
|
||||
public class ChatSnapPlugin extends MiniPlugin
|
||||
public class MessageSnapshotPlugin extends MiniPlugin
|
||||
{
|
||||
private final ChatSnapManager _chatSnapManager;
|
||||
private final MessageSnapshotManager _messageSnapshotManager;
|
||||
|
||||
public ChatSnapPlugin(JavaPlugin plugin, ChatSnapManager chatSnapManager)
|
||||
public MessageSnapshotPlugin(JavaPlugin plugin, MessageSnapshotManager messageSnapshotManager)
|
||||
{
|
||||
super("ChatSnap", plugin);
|
||||
_chatSnapManager = chatSnapManager;
|
||||
_messageSnapshotManager = messageSnapshotManager;
|
||||
}
|
||||
|
||||
public ChatSnapManager getChatSnapManager()
|
||||
public MessageSnapshotManager getMessageSnapshotManager()
|
||||
{
|
||||
return _chatSnapManager;
|
||||
return _messageSnapshotManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -40,7 +40,7 @@ public class ChatSnapPlugin extends MiniPlugin
|
||||
@EventHandler(priority = EventPriority.MONITOR)
|
||||
public void cacheChatMessage(AsyncPlayerChatEvent e)
|
||||
{
|
||||
_chatSnapManager.cacheSnapshot(getMessageSnap(e));
|
||||
_messageSnapshotManager.cacheSnapshot(getMessageSnap(e));
|
||||
}
|
||||
|
||||
public Set<UUID> getUUIDSet(Set<Player> playerSet)
|
@ -6,7 +6,7 @@ import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.chatsnap.ChatSnapPlugin;
|
||||
import mineplex.core.chatsnap.MessageSnapshotPlugin;
|
||||
import mineplex.core.chatsnap.MessageSnapshot;
|
||||
import mineplex.core.command.CommandBase;
|
||||
import mineplex.core.common.Rank;
|
||||
@ -17,9 +17,9 @@ import mineplex.core.common.util.UtilPlayer;
|
||||
* Displays what chat messages we have cached for a player.
|
||||
* @author iKeirNez
|
||||
*/
|
||||
public class ChatCacheCommand extends CommandBase<ChatSnapPlugin>
|
||||
public class ChatCacheCommand extends CommandBase<MessageSnapshotPlugin>
|
||||
{
|
||||
public ChatCacheCommand(ChatSnapPlugin plugin)
|
||||
public ChatCacheCommand(MessageSnapshotPlugin plugin)
|
||||
{
|
||||
super(plugin, Rank.MODERATOR, "chatcache");
|
||||
}
|
||||
@ -42,7 +42,7 @@ public class ChatCacheCommand extends CommandBase<ChatSnapPlugin>
|
||||
public void run()
|
||||
{
|
||||
OfflinePlayer offlinePlayer = Bukkit.getOfflinePlayer(playerName);
|
||||
Set<MessageSnapshot> snaps = Plugin.getChatSnapManager().getSnapshotsFor(offlinePlayer.getUniqueId());
|
||||
Set<MessageSnapshot> snaps = Plugin.getMessageSnapshotManager().getSnapshotsFor(offlinePlayer.getUniqueId());
|
||||
|
||||
for (MessageSnapshot messageSnapshot : snaps)
|
||||
{
|
||||
|
@ -5,7 +5,7 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import mineplex.core.account.CoreClient;
|
||||
import mineplex.core.chatsnap.ChatSnapManager;
|
||||
import mineplex.core.chatsnap.MessageSnapshotManager;
|
||||
import mineplex.core.command.CommandCenter;
|
||||
import mineplex.core.common.Rank;
|
||||
import mineplex.core.common.jsonchat.ClickEvent;
|
||||
@ -51,7 +51,7 @@ public class ReportManager {
|
||||
private JavaPlugin _javaPlugin;
|
||||
private PreferencesManager _preferencesManager;
|
||||
private StatsManager _statsManager;
|
||||
private ChatSnapManager _chatSnapManager;
|
||||
private MessageSnapshotManager _messageSnapshotManager;
|
||||
private String _serverName;
|
||||
|
||||
// Holds active/open reports in a synchronized database.
|
||||
@ -63,12 +63,12 @@ public class ReportManager {
|
||||
// A mapping of PlayerName(String) to the ReportId(Integer) for all active reports on this server.
|
||||
private Map<String, Integer> _activeReports;
|
||||
|
||||
public ReportManager(JavaPlugin javaPlugin, PreferencesManager preferencesManager, StatsManager statsManager, ChatSnapManager chatSnapManager, String serverName)
|
||||
public ReportManager(JavaPlugin javaPlugin, PreferencesManager preferencesManager, StatsManager statsManager, MessageSnapshotManager messageSnapshotManager, String serverName)
|
||||
{
|
||||
_javaPlugin = javaPlugin;
|
||||
_preferencesManager = preferencesManager;
|
||||
_statsManager = statsManager;
|
||||
_chatSnapManager = chatSnapManager;
|
||||
_messageSnapshotManager = messageSnapshotManager;
|
||||
_serverName = serverName;
|
||||
_reportRepository = new RedisDataRepository<Report>(Region.ALL, Report.class, "reports");
|
||||
_activeReports = new HashMap<String, Integer>();
|
||||
|
@ -8,8 +8,8 @@ import mineplex.core.achievement.AchievementManager;
|
||||
import mineplex.core.antihack.AntiHack;
|
||||
import mineplex.core.blockrestore.BlockRestore;
|
||||
import mineplex.core.chat.Chat;
|
||||
import mineplex.core.chatsnap.ChatSnapManager;
|
||||
import mineplex.core.chatsnap.ChatSnapPlugin;
|
||||
import mineplex.core.chatsnap.MessageSnapshotManager;
|
||||
import mineplex.core.chatsnap.MessageSnapshotPlugin;
|
||||
import mineplex.core.command.CommandCenter;
|
||||
import mineplex.core.donation.DonationManager;
|
||||
import mineplex.core.explosion.Explosion;
|
||||
@ -93,9 +93,9 @@ public class Clans extends JavaPlugin
|
||||
new Explosion(this, blockRestore);
|
||||
new FriendManager(this, _clientManager, preferenceManager, portal);
|
||||
new InventoryManager(this, _clientManager);
|
||||
ChatSnapManager chatSnapManager = new ChatSnapManager();
|
||||
new ChatSnapPlugin(this, chatSnapManager);
|
||||
new ReportPlugin(this, new ReportManager(this, preferenceManager, statsManager, chatSnapManager, serverStatusManager.getCurrentServerName()));
|
||||
MessageSnapshotManager messageSnapshotManager = new MessageSnapshotManager();
|
||||
new MessageSnapshotPlugin(this, messageSnapshotManager);
|
||||
new ReportPlugin(this, new ReportManager(this, preferenceManager, statsManager, messageSnapshotManager, serverStatusManager.getCurrentServerName()));
|
||||
|
||||
ClansManager clans = new ClansManager(this, serverStatusManager.getCurrentServerName(), _clientManager, _donationManager, blockRestore, teleport, webServerAddress);
|
||||
new Recipes(this);
|
||||
|
@ -12,8 +12,8 @@ import mineplex.core.antihack.AntiHack;
|
||||
import mineplex.core.aprilfools.AprilFoolsManager;
|
||||
import mineplex.core.blockrestore.BlockRestore;
|
||||
import mineplex.core.chat.Chat;
|
||||
import mineplex.core.chatsnap.ChatSnapManager;
|
||||
import mineplex.core.chatsnap.ChatSnapPlugin;
|
||||
import mineplex.core.chatsnap.MessageSnapshotManager;
|
||||
import mineplex.core.chatsnap.MessageSnapshotPlugin;
|
||||
import mineplex.core.command.CommandCenter;
|
||||
import mineplex.core.creature.Creature;
|
||||
import mineplex.core.disguise.DisguiseManager;
|
||||
@ -154,9 +154,9 @@ public class Hub extends JavaPlugin implements IRelation
|
||||
}
|
||||
});
|
||||
new GlobalPacketManager(this, clientManager, serverStatusManager, inventoryManager, donationManager, petManager, statsManager, giveawayManager);
|
||||
ChatSnapManager chatSnapManager = new ChatSnapManager();
|
||||
new ChatSnapPlugin(this, chatSnapManager);
|
||||
new ReportPlugin(this, new ReportManager(this, preferenceManager, statsManager, chatSnapManager, serverStatusManager.getCurrentServerName()));
|
||||
MessageSnapshotManager messageSnapshotManager = new MessageSnapshotManager();
|
||||
new MessageSnapshotPlugin(this, messageSnapshotManager);
|
||||
new ReportPlugin(this, new ReportManager(this, preferenceManager, statsManager, messageSnapshotManager, serverStatusManager.getCurrentServerName()));
|
||||
//new Replay(this, packetHandler);
|
||||
|
||||
AprilFoolsManager.Initialize(this, clientManager, disguiseManager);
|
||||
|
@ -8,9 +8,8 @@ import org.bukkit.plugin.java.JavaPlugin;
|
||||
|
||||
import mineplex.core.FoodDupeFix;
|
||||
import mineplex.core.PacketsInteractionFix;
|
||||
import mineplex.core.account.CoreClient;
|
||||
import mineplex.core.chatsnap.ChatSnapManager;
|
||||
import mineplex.core.chatsnap.ChatSnapPlugin;
|
||||
import mineplex.core.chatsnap.MessageSnapshotManager;
|
||||
import mineplex.core.chatsnap.MessageSnapshotPlugin;
|
||||
import mineplex.core.giveaway.GiveawayManager;
|
||||
import mineplex.core.globalpacket.GlobalPacketManager;
|
||||
import net.minecraft.server.v1_8_R3.BiomeBase;
|
||||
@ -136,9 +135,9 @@ public class Arcade extends JavaPlugin
|
||||
FriendManager friendManager = new FriendManager(this, _clientManager, preferenceManager, portal);
|
||||
Chat chat = new Chat(this, _clientManager, preferenceManager, achievementManager, serverStatusManager.getCurrentServerName());
|
||||
new MessageManager(this, _clientManager, preferenceManager, ignoreManager, punish, friendManager, chat);
|
||||
ChatSnapManager chatSnapManager = new ChatSnapManager();
|
||||
new ChatSnapPlugin(this, chatSnapManager);
|
||||
new ReportPlugin(this, new ReportManager(this, preferenceManager, statsManager, chatSnapManager, serverStatusManager.getCurrentServerName()));
|
||||
MessageSnapshotManager messageSnapshotManager = new MessageSnapshotManager();
|
||||
new MessageSnapshotPlugin(this, messageSnapshotManager);
|
||||
new ReportPlugin(this, new ReportManager(this, preferenceManager, statsManager, messageSnapshotManager, serverStatusManager.getCurrentServerName()));
|
||||
|
||||
BlockRestore blockRestore = new BlockRestore(this);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user