Set up redis pub sub commands to transfer communities information across the network
This commit is contained in:
parent
39f2c94718
commit
cefc3344ab
@ -0,0 +1,53 @@
|
||||
package mineplex.core.communities.redis;
|
||||
|
||||
import mineplex.serverdata.commands.ServerCommand;
|
||||
|
||||
public class CommunityCloseJoinRequest extends ServerCommand
|
||||
{
|
||||
private Integer _communityId;
|
||||
private String _sender;
|
||||
private String _playerName;
|
||||
private String _playerUUID;
|
||||
private Integer _accountId;
|
||||
private boolean _announce;
|
||||
|
||||
public CommunityCloseJoinRequest(Integer communityId, String sender, String playerName, String playerUUID, Integer accountId, boolean announce)
|
||||
{
|
||||
_communityId = communityId;
|
||||
_sender = sender;
|
||||
_playerName = playerName;
|
||||
_playerUUID = playerUUID;
|
||||
_accountId = accountId;
|
||||
_announce = announce;
|
||||
}
|
||||
|
||||
public Integer getCommunityId()
|
||||
{
|
||||
return _communityId;
|
||||
}
|
||||
|
||||
public String getSender()
|
||||
{
|
||||
return _sender;
|
||||
}
|
||||
|
||||
public String getPlayerName()
|
||||
{
|
||||
return _playerName;
|
||||
}
|
||||
|
||||
public String getPlayerUUID()
|
||||
{
|
||||
return _playerUUID;
|
||||
}
|
||||
|
||||
public Integer getAccountId()
|
||||
{
|
||||
return _accountId;
|
||||
}
|
||||
|
||||
public boolean shouldAnnounce()
|
||||
{
|
||||
return _announce;
|
||||
}
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package mineplex.core.communities.redis;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import mineplex.core.communities.CommunityManager;
|
||||
import mineplex.serverdata.commands.CommandCallback;
|
||||
import mineplex.serverdata.commands.ServerCommand;
|
||||
|
||||
public class CommunityCloseJoinRequestHandler implements CommandCallback
|
||||
{
|
||||
private CommunityManager _manager;
|
||||
|
||||
public CommunityCloseJoinRequestHandler(CommunityManager manager)
|
||||
{
|
||||
_manager = manager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(ServerCommand command)
|
||||
{
|
||||
if (command instanceof CommunityCloseJoinRequest)
|
||||
{
|
||||
CommunityCloseJoinRequest update = ((CommunityCloseJoinRequest) command);
|
||||
Integer id = update.getCommunityId();
|
||||
String sender = update.getSender();
|
||||
UUID uuid = UUID.fromString(update.getPlayerUUID());
|
||||
String name = update.getPlayerName();
|
||||
Integer accountId = update.getAccountId();
|
||||
boolean announce = update.shouldAnnounce();
|
||||
|
||||
_manager.handleCommunityCloseJoinRequest(id, sender, name, uuid, accountId, announce);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package mineplex.core.communities.redis;
|
||||
|
||||
import mineplex.serverdata.commands.ServerCommand;
|
||||
|
||||
public class CommunityCreate extends ServerCommand
|
||||
{
|
||||
private String _leaderUUID;
|
||||
private Integer _communityId;
|
||||
|
||||
public CommunityCreate(String leaderUUID, Integer communityId)
|
||||
{
|
||||
_leaderUUID = leaderUUID;
|
||||
_communityId = communityId;
|
||||
}
|
||||
|
||||
public String getLeaderUUID()
|
||||
{
|
||||
return _leaderUUID;
|
||||
}
|
||||
|
||||
public Integer getCommunityId()
|
||||
{
|
||||
return _communityId;
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package mineplex.core.communities.redis;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import mineplex.core.communities.CommunityManager;
|
||||
import mineplex.serverdata.commands.CommandCallback;
|
||||
import mineplex.serverdata.commands.ServerCommand;
|
||||
|
||||
public class CommunityCreateHandler implements CommandCallback
|
||||
{
|
||||
private CommunityManager _manager;
|
||||
|
||||
public CommunityCreateHandler(CommunityManager manager)
|
||||
{
|
||||
_manager = manager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(ServerCommand command)
|
||||
{
|
||||
if (command instanceof CommunityCreate)
|
||||
{
|
||||
CommunityCreate update = ((CommunityCreate) command);
|
||||
UUID leaderUUID = UUID.fromString(update.getLeaderUUID());
|
||||
Integer communityId = update.getCommunityId();
|
||||
|
||||
_manager.handleCommunityCreation(communityId, leaderUUID);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package mineplex.core.communities.redis;
|
||||
|
||||
import mineplex.serverdata.commands.ServerCommand;
|
||||
|
||||
public class CommunityDisband extends ServerCommand
|
||||
{
|
||||
private String _senderName;
|
||||
private Integer _communityId;
|
||||
|
||||
public CommunityDisband(String senderName, Integer communityId)
|
||||
{
|
||||
_senderName = senderName;
|
||||
_communityId = communityId;
|
||||
}
|
||||
|
||||
public String getSenderName()
|
||||
{
|
||||
return _senderName;
|
||||
}
|
||||
|
||||
public Integer getCommunityId()
|
||||
{
|
||||
return _communityId;
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package mineplex.core.communities.redis;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import mineplex.core.communities.CommunityManager;
|
||||
import mineplex.serverdata.commands.CommandCallback;
|
||||
import mineplex.serverdata.commands.ServerCommand;
|
||||
|
||||
public class CommunityDisbandHandler implements CommandCallback
|
||||
{
|
||||
private CommunityManager _manager;
|
||||
|
||||
public CommunityDisbandHandler(CommunityManager manager)
|
||||
{
|
||||
_manager = manager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(ServerCommand command)
|
||||
{
|
||||
if (command instanceof CommunityDisband)
|
||||
{
|
||||
CommunityDisband update = ((CommunityDisband) command);
|
||||
String senderName = update.getSenderName();
|
||||
Integer communityId = update.getCommunityId();
|
||||
|
||||
_manager.handleCommunityDisband(communityId, senderName);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package mineplex.core.communities.redis;
|
||||
|
||||
import mineplex.serverdata.commands.ServerCommand;
|
||||
|
||||
public class CommunityInvite extends ServerCommand
|
||||
{
|
||||
private Integer _communityId;
|
||||
private String _sender;
|
||||
private String _playerName;
|
||||
private String _playerUUID;
|
||||
|
||||
public CommunityInvite(Integer communityId, String sender, String playerName, String playerUUID)
|
||||
{
|
||||
_communityId = communityId;
|
||||
_sender = sender;
|
||||
_playerName = playerName;
|
||||
_playerUUID = playerUUID;
|
||||
}
|
||||
|
||||
public Integer getCommunityId()
|
||||
{
|
||||
return _communityId;
|
||||
}
|
||||
|
||||
public String getSender()
|
||||
{
|
||||
return _sender;
|
||||
}
|
||||
|
||||
public String getPlayerName()
|
||||
{
|
||||
return _playerName;
|
||||
}
|
||||
|
||||
public String getPlayerUUID()
|
||||
{
|
||||
return _playerUUID;
|
||||
}
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package mineplex.core.communities.redis;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import mineplex.core.communities.CommunityManager;
|
||||
import mineplex.serverdata.commands.CommandCallback;
|
||||
import mineplex.serverdata.commands.ServerCommand;
|
||||
|
||||
public class CommunityInviteHandler implements CommandCallback
|
||||
{
|
||||
private CommunityManager _manager;
|
||||
|
||||
public CommunityInviteHandler(CommunityManager manager)
|
||||
{
|
||||
_manager = manager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(ServerCommand command)
|
||||
{
|
||||
if (command instanceof CommunityInvite)
|
||||
{
|
||||
CommunityInvite update = ((CommunityInvite) command);
|
||||
Integer id = update.getCommunityId();
|
||||
String sender = update.getSender();
|
||||
String name = update.getPlayerName();
|
||||
UUID uuid = UUID.fromString(update.getPlayerUUID());
|
||||
|
||||
_manager.handleCommunityInvite(id, sender, name, uuid);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
package mineplex.core.communities.redis;
|
||||
|
||||
import mineplex.serverdata.commands.ServerCommand;
|
||||
|
||||
public class CommunityJoinRequest extends ServerCommand
|
||||
{
|
||||
private Integer _communityId;
|
||||
private String _playerName;
|
||||
private String _playerUUID;
|
||||
private Integer _accountId;
|
||||
|
||||
public CommunityJoinRequest(Integer communityId, String playerName, String playerUUID, Integer accountId)
|
||||
{
|
||||
_communityId = communityId;
|
||||
_playerName = playerName;
|
||||
_playerUUID = playerUUID;
|
||||
_accountId = accountId;
|
||||
}
|
||||
|
||||
public Integer getCommunityId()
|
||||
{
|
||||
return _communityId;
|
||||
}
|
||||
|
||||
public String getPlayerName()
|
||||
{
|
||||
return _playerName;
|
||||
}
|
||||
|
||||
public String getPlayerUUID()
|
||||
{
|
||||
return _playerUUID;
|
||||
}
|
||||
|
||||
public Integer getAccountId()
|
||||
{
|
||||
return _accountId;
|
||||
}
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package mineplex.core.communities.redis;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import mineplex.core.communities.CommunityManager;
|
||||
import mineplex.serverdata.commands.CommandCallback;
|
||||
import mineplex.serverdata.commands.ServerCommand;
|
||||
|
||||
public class CommunityJoinRequestHandler implements CommandCallback
|
||||
{
|
||||
private CommunityManager _manager;
|
||||
|
||||
public CommunityJoinRequestHandler(CommunityManager manager)
|
||||
{
|
||||
_manager = manager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(ServerCommand command)
|
||||
{
|
||||
if (command instanceof CommunityJoinRequest)
|
||||
{
|
||||
CommunityJoinRequest update = ((CommunityJoinRequest) command);
|
||||
Integer id = update.getCommunityId();
|
||||
UUID uuid = UUID.fromString(update.getPlayerUUID());
|
||||
String name = update.getPlayerName();
|
||||
Integer accountId = update.getAccountId();
|
||||
|
||||
_manager.handleCommunityJoinRequest(id, name, uuid, accountId);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
package mineplex.core.communities.redis;
|
||||
|
||||
import mineplex.serverdata.commands.ServerCommand;
|
||||
|
||||
public class CommunityUnInvite extends ServerCommand
|
||||
{
|
||||
private Integer _communityId;
|
||||
private String _sender;
|
||||
private String _playerName;
|
||||
private String _playerUUID;
|
||||
private boolean _announce;
|
||||
|
||||
public CommunityUnInvite(Integer communityId, String sender, String playerName, String playerUUID, boolean announce)
|
||||
{
|
||||
_communityId = communityId;
|
||||
_sender = sender;
|
||||
_playerName = playerName;
|
||||
_playerUUID = playerUUID;
|
||||
_announce = announce;
|
||||
}
|
||||
|
||||
public Integer getCommunityId()
|
||||
{
|
||||
return _communityId;
|
||||
}
|
||||
|
||||
public String getSender()
|
||||
{
|
||||
return _sender;
|
||||
}
|
||||
|
||||
public String getPlayerName()
|
||||
{
|
||||
return _playerName;
|
||||
}
|
||||
|
||||
public String getPlayerUUID()
|
||||
{
|
||||
return _playerUUID;
|
||||
}
|
||||
|
||||
public boolean shouldAnnounce()
|
||||
{
|
||||
return _announce;
|
||||
}
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package mineplex.core.communities.redis;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import mineplex.core.communities.CommunityManager;
|
||||
import mineplex.serverdata.commands.CommandCallback;
|
||||
import mineplex.serverdata.commands.ServerCommand;
|
||||
|
||||
public class CommunityUnInviteHandler implements CommandCallback
|
||||
{
|
||||
private CommunityManager _manager;
|
||||
|
||||
public CommunityUnInviteHandler(CommunityManager manager)
|
||||
{
|
||||
_manager = manager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(ServerCommand command)
|
||||
{
|
||||
if (command instanceof CommunityUnInvite)
|
||||
{
|
||||
CommunityUnInvite update = ((CommunityUnInvite) command);
|
||||
Integer id = update.getCommunityId();
|
||||
String sender = update.getSender();
|
||||
String name = update.getPlayerName();
|
||||
UUID uuid = UUID.fromString(update.getPlayerUUID());
|
||||
boolean announce = update.shouldAnnounce();
|
||||
|
||||
_manager.handleCommunityUninvite(id, sender, name, uuid, announce);
|
||||
}
|
||||
}
|
||||
}
|
@ -5,12 +5,14 @@ import mineplex.serverdata.commands.ServerCommand;
|
||||
public class CommunityUpdateMemberRole extends ServerCommand
|
||||
{
|
||||
private Integer _communityId;
|
||||
private String _sender;
|
||||
private String _playerUUID;
|
||||
private String _memberRole;
|
||||
|
||||
public CommunityUpdateMemberRole(Integer communityId, String playerUUID, String memberRole)
|
||||
public CommunityUpdateMemberRole(Integer communityId, String sender, String playerUUID, String memberRole)
|
||||
{
|
||||
_communityId = communityId;
|
||||
_sender = sender;
|
||||
_playerUUID = playerUUID;
|
||||
_memberRole = memberRole;
|
||||
}
|
||||
@ -20,6 +22,11 @@ public class CommunityUpdateMemberRole extends ServerCommand
|
||||
return _communityId;
|
||||
}
|
||||
|
||||
public String getSender()
|
||||
{
|
||||
return _sender;
|
||||
}
|
||||
|
||||
public String getPlayerUUID()
|
||||
{
|
||||
return _playerUUID;
|
||||
|
@ -25,6 +25,8 @@ public class CommunityUpdateMemberRoleHandler implements CommandCallback
|
||||
Integer id = update.getCommunityId();
|
||||
UUID uuid = UUID.fromString(update.getPlayerUUID());
|
||||
CommunityRole role = CommunityRole.parseRole(update.getMemberRole());
|
||||
|
||||
_manager.handleCommunityMembershipRoleUpdate(id, update.getSender(), uuid, role);
|
||||
}
|
||||
}
|
||||
}
|
@ -5,14 +5,20 @@ import mineplex.serverdata.commands.ServerCommand;
|
||||
public class CommunityUpdateMembership extends ServerCommand
|
||||
{
|
||||
private Integer _communityId;
|
||||
private String _sender;
|
||||
private String _playerName;
|
||||
private String _playerUUID;
|
||||
private Integer _accountId;
|
||||
private boolean _kick;
|
||||
private boolean _leave;
|
||||
|
||||
public CommunityUpdateMembership(Integer communityId, String playerUUID, boolean kick)
|
||||
public CommunityUpdateMembership(Integer communityId, String sender, String playerName, String playerUUID, Integer accountId, boolean kick, boolean leave)
|
||||
{
|
||||
_communityId = communityId;
|
||||
_sender = sender;
|
||||
_playerUUID = playerUUID;
|
||||
_kick = kick;
|
||||
_leave = leave;
|
||||
}
|
||||
|
||||
public Integer getCommunityId()
|
||||
@ -20,13 +26,33 @@ public class CommunityUpdateMembership extends ServerCommand
|
||||
return _communityId;
|
||||
}
|
||||
|
||||
public String getSender()
|
||||
{
|
||||
return _sender;
|
||||
}
|
||||
|
||||
public String getPlayerName()
|
||||
{
|
||||
return _playerName;
|
||||
}
|
||||
|
||||
public String getPlayerUUID()
|
||||
{
|
||||
return _playerUUID;
|
||||
}
|
||||
|
||||
public Integer getAccountId()
|
||||
{
|
||||
return _accountId;
|
||||
}
|
||||
|
||||
public boolean isKick()
|
||||
{
|
||||
return _kick;
|
||||
}
|
||||
|
||||
public boolean isLeave()
|
||||
{
|
||||
return _leave;
|
||||
}
|
||||
}
|
@ -23,7 +23,13 @@ public class CommunityUpdateMembershipHandler implements CommandCallback
|
||||
CommunityUpdateMembership update = ((CommunityUpdateMembership) command);
|
||||
Integer id = update.getCommunityId();
|
||||
UUID uuid = UUID.fromString(update.getPlayerUUID());
|
||||
String sender = update.getSender();
|
||||
String name = update.getPlayerName();
|
||||
Integer accountId = update.getAccountId();
|
||||
boolean kick = update.isKick();
|
||||
boolean leave = update.isLeave();
|
||||
|
||||
_manager.handleCommunityMembershipUpdate(id, sender, name, uuid, accountId, kick, leave);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package mineplex.core.communities.redis;
|
||||
|
||||
import mineplex.serverdata.commands.ServerCommand;
|
||||
|
||||
public class CommunityUpdateName extends ServerCommand
|
||||
{
|
||||
private Integer _communityId;
|
||||
private String _sender;
|
||||
private String _name;
|
||||
|
||||
public CommunityUpdateName(Integer communityId, String sender, String name)
|
||||
{
|
||||
_communityId = communityId;
|
||||
_sender = sender;
|
||||
_name = name;
|
||||
}
|
||||
|
||||
public Integer getCommunityId()
|
||||
{
|
||||
return _communityId;
|
||||
}
|
||||
|
||||
public String getSender()
|
||||
{
|
||||
return _sender;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return _name;
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
package mineplex.core.communities.redis;
|
||||
|
||||
import mineplex.core.communities.CommunityManager;
|
||||
import mineplex.serverdata.commands.CommandCallback;
|
||||
import mineplex.serverdata.commands.ServerCommand;
|
||||
|
||||
public class CommunityUpdateNameHandler implements CommandCallback
|
||||
{
|
||||
private CommunityManager _manager;
|
||||
|
||||
public CommunityUpdateNameHandler(CommunityManager manager)
|
||||
{
|
||||
_manager = manager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(ServerCommand command)
|
||||
{
|
||||
if (command instanceof CommunityUpdateName)
|
||||
{
|
||||
CommunityUpdateName update = ((CommunityUpdateName) command);
|
||||
Integer id = update.getCommunityId();
|
||||
String sender = update.getSender();
|
||||
String name = update.getName();
|
||||
|
||||
_manager.handleCommunityNameUpdate(id, sender, name);
|
||||
}
|
||||
}
|
||||
}
|
@ -5,12 +5,14 @@ import mineplex.serverdata.commands.ServerCommand;
|
||||
public class CommunityUpdateSetting extends ServerCommand
|
||||
{
|
||||
private Integer _communityId;
|
||||
private String _sender;
|
||||
private String _setting;
|
||||
private String _newValue;
|
||||
|
||||
public CommunityUpdateSetting(Integer communityId, String setting, String newValue)
|
||||
public CommunityUpdateSetting(Integer communityId, String sender, String setting, String newValue)
|
||||
{
|
||||
_communityId = communityId;
|
||||
_sender = sender;
|
||||
_setting = setting;
|
||||
_newValue = newValue;
|
||||
}
|
||||
@ -20,6 +22,11 @@ public class CommunityUpdateSetting extends ServerCommand
|
||||
return _communityId;
|
||||
}
|
||||
|
||||
public String getSender()
|
||||
{
|
||||
return _sender;
|
||||
}
|
||||
|
||||
public String getSetting()
|
||||
{
|
||||
return _setting;
|
||||
|
@ -23,6 +23,8 @@ public class CommunityUpdateSettingHandler implements CommandCallback
|
||||
Integer id = update.getCommunityId();
|
||||
CommunitySetting setting = CommunitySetting.valueOf(update.getSetting());
|
||||
String newValue = update.getNewValue();
|
||||
|
||||
_manager.handleCommunitySettingUpdate(id, update.getSender(), setting, newValue);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user