mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2025-01-09 01:48:24 +01:00
WIP - needs work on team invites.
This commit is contained in:
parent
2b19d43c85
commit
0e6a25d74b
@ -54,7 +54,7 @@ public class AdminTeamAddCommand extends CompositeCommand {
|
||||
new IslandInfo(island).showMembers(user);
|
||||
return false;
|
||||
}
|
||||
if (getIWM().getWorldSettings(getWorld()).isTeamMembersDropIsland() && island.inTeam(targetUUID)) {
|
||||
if (getIWM().getWorldSettings(getWorld()).isDisallowTeamMemberIslands() && island.inTeam(targetUUID)) {
|
||||
user.sendMessage("commands.island.team.invite.errors.already-on-team");
|
||||
return false;
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ public class IslandCreateCommand extends CompositeCommand {
|
||||
}
|
||||
}
|
||||
// Check if this player is on a team in this world
|
||||
if (getIWM().getWorldSettings(getWorld()).isTeamMembersDropIsland()
|
||||
if (getIWM().getWorldSettings(getWorld()).isDisallowTeamMemberIslands()
|
||||
&& getIslands().inTeam(getWorld(), user.getUniqueId()) && island != null
|
||||
&& !user.getUniqueId().equals(island.getOwner())) {
|
||||
// Team members who are not owners cannot make additional islands
|
||||
|
@ -61,7 +61,7 @@ public class IslandTeamInviteAcceptCommand extends ConfirmableCommand {
|
||||
}
|
||||
|
||||
// Check if player is already in a team
|
||||
if (getIWM().getWorldSettings(getWorld()).isTeamMembersDropIsland()
|
||||
if (getIWM().getWorldSettings(getWorld()).isDisallowTeamMemberIslands()
|
||||
&& getIslands().inTeam(getWorld(), playerUUID)) {
|
||||
user.sendMessage("commands.island.team.invite.errors.you-already-are-in-team");
|
||||
return false;
|
||||
@ -82,8 +82,14 @@ public class IslandTeamInviteAcceptCommand extends ConfirmableCommand {
|
||||
switch (invite.getType()) {
|
||||
case COOP -> askConfirmation(user, () -> acceptCoopInvite(user, invite));
|
||||
case TRUST -> askConfirmation(user, () -> acceptTrustInvite(user, invite));
|
||||
default -> askConfirmation(user, user.getTranslation("commands.island.team.invite.accept.confirmation"),
|
||||
() -> acceptTeamInvite(user, invite));
|
||||
default -> {
|
||||
if (getIWM().getWorldSettings(getWorld()).isDisallowTeamMemberIslands()) {
|
||||
askConfirmation(user, user.getTranslation("commands.island.team.invite.accept.confirmation"),
|
||||
() -> acceptTeamInvite(user, invite));
|
||||
} else {
|
||||
acceptTeamInvite(user, invite);
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -156,7 +162,7 @@ public class IslandTeamInviteAcceptCommand extends ConfirmableCommand {
|
||||
user.sendMessage("commands.island.team.invite.errors.island-is-full");
|
||||
return;
|
||||
}
|
||||
if (getIWM().getWorldSettings(getWorld()).isTeamMembersDropIsland()) {
|
||||
if (getIWM().getWorldSettings(getWorld()).isDisallowTeamMemberIslands()) {
|
||||
// Remove the player's other islands
|
||||
getIslands().removePlayer(getWorld(), user.getUniqueId());
|
||||
}
|
||||
@ -166,7 +172,7 @@ public class IslandTeamInviteAcceptCommand extends ConfirmableCommand {
|
||||
getIslands().setJoinTeam(teamIsland, user.getUniqueId());
|
||||
// Move player to team's island
|
||||
getIslands().homeTeleportAsync(getWorld(), user.getPlayer()).thenRun(() -> {
|
||||
if (getIWM().getWorldSettings(getWorld()).isTeamMembersDropIsland()) {
|
||||
if (getIWM().getWorldSettings(getWorld()).isDisallowTeamMemberIslands()) {
|
||||
// Delete the old islands
|
||||
islands.forEach(island -> getIslands().deleteIsland(island, true, user.getUniqueId()));
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ public class IslandTeamInviteCommand extends CompositeCommand {
|
||||
}
|
||||
|
||||
// Player cannot invite someone already on a team
|
||||
if (getIWM().getWorldSettings(getWorld()).isTeamMembersDropIsland()
|
||||
if (getIWM().getWorldSettings(getWorld()).isDisallowTeamMemberIslands()
|
||||
&& getIslands().inTeam(getWorld(), invitedPlayerUUID)) {
|
||||
user.sendMessage("commands.island.team.invite.errors.already-on-team");
|
||||
return false;
|
||||
@ -171,7 +171,7 @@ public class IslandTeamInviteCommand extends CompositeCommand {
|
||||
// Send message to online player
|
||||
invitedPlayer.sendMessage("commands.island.team.invite.name-has-invited-you", TextVariables.NAME, user.getName(), TextVariables.DISPLAY_NAME, user.getDisplayName());
|
||||
invitedPlayer.sendMessage("commands.island.team.invite.to-accept-or-reject", TextVariables.LABEL, getTopLabel());
|
||||
if (getIWM().getWorldSettings(getWorld()).isTeamMembersDropIsland()
|
||||
if (getIWM().getWorldSettings(getWorld()).isDisallowTeamMemberIslands()
|
||||
&& getIslands().hasIsland(getWorld(), invitedPlayer.getUniqueId())) {
|
||||
invitedPlayer.sendMessage("commands.island.team.invite.you-will-lose-your-island");
|
||||
}
|
||||
|
@ -649,7 +649,7 @@ public interface WorldSettings extends ConfigObject {
|
||||
* Remove islands when players join a team and not allow players to have other islands if they are in a team.
|
||||
* @return true or false
|
||||
*/
|
||||
default boolean isTeamMembersDropIsland() {
|
||||
default boolean isDisallowTeamMemberIslands() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user