Add /com colead
This commit is contained in:
parent
72a81ad362
commit
61d5b46fc8
@ -97,6 +97,7 @@ public class CommunityManager extends MiniDbClientPlugin<CommunityMemberData>
|
||||
{
|
||||
OWN_COMMUNITY,
|
||||
COMMUNITY_CHAT_COMMAND,
|
||||
COMMUNITY_COLEAD_COMMAND,
|
||||
COMMUNITY_COMMAND,
|
||||
COMMUNITY_DESCRIPTION_COMMAND,
|
||||
COMMUNITY_DESCRIPTION_STAFF_COMMAND,
|
||||
@ -302,6 +303,7 @@ public class CommunityManager extends MiniDbClientPlugin<CommunityMemberData>
|
||||
PermissionGroup.ETERNAL.setPermission(Perm.OWN_COMMUNITY, true, true);
|
||||
PermissionGroup.PLAYER.setPermission(Perm.COMMUNITY_CHAT_COMMAND, true, true);
|
||||
PermissionGroup.PLAYER.setPermission(Perm.COMMUNITY_COMMAND, true, true);
|
||||
PermissionGroup.PLAYER.setPermission(Perm.COMMUNITY_COLEAD_COMMAND, true, true);
|
||||
PermissionGroup.PLAYER.setPermission(Perm.COMMUNITY_DESCRIPTION_COMMAND, true, true);
|
||||
PermissionGroup.ADMIN.setPermission(Perm.COMMUNITY_DESCRIPTION_STAFF_COMMAND, true, true);
|
||||
PermissionGroup.ETERNAL.setPermission(Perm.COMMUNITY_DISBAND_COMMAND, true, true);
|
||||
|
@ -0,0 +1,67 @@
|
||||
package mineplex.core.communities.commands;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import mineplex.core.command.CommandBase;
|
||||
import mineplex.core.common.util.F;
|
||||
import mineplex.core.communities.CommunityManager;
|
||||
import mineplex.core.communities.data.Community;
|
||||
import mineplex.core.communities.data.CommunityMemberData;
|
||||
import mineplex.core.communities.data.CommunityMemberInfo;
|
||||
import mineplex.core.communities.data.CommunityRole;
|
||||
|
||||
public class CommunityCoLeadCommand extends CommandBase<CommunityManager>
|
||||
{
|
||||
public CommunityCoLeadCommand(CommunityManager plugin)
|
||||
{
|
||||
super(plugin, CommunityManager.Perm.COMMUNITY_COLEAD_COMMAND, "colead");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void Execute(Player caller, String[] args)
|
||||
{
|
||||
if (args.length < 2)
|
||||
{
|
||||
reply(caller, "Invalid arguments. Try /colead <com> <player>");
|
||||
return;
|
||||
}
|
||||
|
||||
Community community = Plugin.getLoadedCommunity(args[0]);
|
||||
if (community == null)
|
||||
{
|
||||
reply(caller, "Unknown community: " + args[0]);
|
||||
return;
|
||||
}
|
||||
|
||||
CommunityMemberInfo member = community.getMembers().get(caller.getUniqueId());
|
||||
if (member == null)
|
||||
{
|
||||
reply(caller, "You are not a member of " + community.getName());
|
||||
return;
|
||||
}
|
||||
|
||||
if (member.Role != CommunityRole.LEADER)
|
||||
{
|
||||
reply(caller, "You are not the leader of " + community.getName());
|
||||
return;
|
||||
}
|
||||
|
||||
for (CommunityMemberInfo info : community.getMembers().values())
|
||||
{
|
||||
if (info.Name.equalsIgnoreCase(args[1]) || info.UUID.toString().equals(args[1]))
|
||||
{
|
||||
if (info.Role == CommunityRole.COLEADER)
|
||||
{
|
||||
reply(caller, info.Name + " is alredy a Co-Leader");
|
||||
return;
|
||||
}
|
||||
|
||||
Plugin.handleRoleUpdate(caller, community, info, CommunityRole.COLEADER);
|
||||
reply(caller, "You have updated " + info.Name + "\'s role to Co-Leader");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
reply(caller, "Unknown player: " + args[1]);
|
||||
}
|
||||
}
|
@ -28,6 +28,7 @@ public class CommunityCommand extends MultiCommandBase<CommunityManager>
|
||||
//AddCommand(new CommunityMenuCommand(plugin));
|
||||
AddCommand(new CommunityRenameCommand(plugin));
|
||||
AddCommand(new CommunityUnInviteCommand(plugin));
|
||||
AddCommand(new CommunityCoLeadCommand(plugin));
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -48,6 +49,7 @@ public class CommunityCommand extends MultiCommandBase<CommunityManager>
|
||||
UtilPlayer.message(caller, F.help("/com mcs <community>", "Opens the Mineplex Community Server of a community you manage", ChatColor.DARK_AQUA));
|
||||
UtilPlayer.message(caller, F.help("/com description <community> <description>", "Sets the description of a community you manage", ChatColor.DARK_AQUA));
|
||||
UtilPlayer.message(caller, F.help("/com disband <community>", "Disbands a community you own", ChatColor.DARK_AQUA));
|
||||
UtilPlayer.message(caller, F.help("/com colead <community> <player>", "Promotes a player to Co-Leader", ChatColor.DARK_AQUA));
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user