Merge branch 'develop' of https://github.com/BentoBoxWorld/bentobox.git into develop

This commit is contained in:
tastybento 2019-01-13 08:53:06 -08:00
commit 6425938107
2 changed files with 57 additions and 48 deletions

View File

@ -6,14 +6,17 @@ import java.util.UUID;
import org.bukkit.GameMode;
import org.bukkit.Location;
import world.bentobox.bentobox.api.commands.CompositeCommand;
import world.bentobox.bentobox.api.commands.ConfirmableCommand;
import world.bentobox.bentobox.api.events.IslandBaseEvent;
import world.bentobox.bentobox.api.events.team.TeamEvent;
import world.bentobox.bentobox.api.localization.TextVariables;
import world.bentobox.bentobox.api.user.User;
import world.bentobox.bentobox.database.objects.Island;
public class IslandTeamInviteAcceptCommand extends CompositeCommand {
/**
* @author tastybento
*/
public class IslandTeamInviteAcceptCommand extends ConfirmableCommand {
private IslandTeamCommand itc;
@ -31,7 +34,6 @@ public class IslandTeamInviteAcceptCommand extends CompositeCommand {
@Override
public boolean execute(User user, String label, List<String> args) {
UUID playerUUID = user.getUniqueId();
// Check if player has been invited
if (!itc.getInviteCommand().getInviteList().containsKey(playerUUID)) {
@ -61,6 +63,8 @@ public class IslandTeamInviteAcceptCommand extends CompositeCommand {
if (event.isCancelled()) {
return true;
}
askConfirmation(user, "commands.island.team.invite.accept.confirmation", () -> {
// Remove the invite
itc.getInviteCommand().getInviteList().remove(playerUUID);
// Put player into Spectator mode
@ -107,6 +111,8 @@ public class IslandTeamInviteAcceptCommand extends CompositeCommand {
inviter.sendMessage("commands.island.team.invite.accept.name-joined-your-island", TextVariables.NAME, user.getName());
}
getIslands().save(island);
});
return true;
}

View File

@ -338,6 +338,9 @@ commands:
description: "accept an invitation"
you-joined-island: "&aYou joined an island! Use /[label] team info to see the other members."
name-joined-your-island: "&a[name] joined your island!"
confirmation: |-
&cAre you sure you want to accept this invite?
&c&lYou will &nLOSE &r&c&lyour current island!
reject:
description: "reject an invitation"
you-rejected-invite: "&aYou rejected the invitation to join an island."