mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-11-24 19:55:17 +01:00
parent
d8eab7e397
commit
270e14167e
@ -6,14 +6,17 @@ import java.util.UUID;
|
|||||||
import org.bukkit.GameMode;
|
import org.bukkit.GameMode;
|
||||||
import org.bukkit.Location;
|
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.IslandBaseEvent;
|
||||||
import world.bentobox.bentobox.api.events.team.TeamEvent;
|
import world.bentobox.bentobox.api.events.team.TeamEvent;
|
||||||
import world.bentobox.bentobox.api.localization.TextVariables;
|
import world.bentobox.bentobox.api.localization.TextVariables;
|
||||||
import world.bentobox.bentobox.api.user.User;
|
import world.bentobox.bentobox.api.user.User;
|
||||||
import world.bentobox.bentobox.database.objects.Island;
|
import world.bentobox.bentobox.database.objects.Island;
|
||||||
|
|
||||||
public class IslandTeamInviteAcceptCommand extends CompositeCommand {
|
/**
|
||||||
|
* @author tastybento
|
||||||
|
*/
|
||||||
|
public class IslandTeamInviteAcceptCommand extends ConfirmableCommand {
|
||||||
|
|
||||||
private IslandTeamCommand itc;
|
private IslandTeamCommand itc;
|
||||||
|
|
||||||
@ -31,7 +34,6 @@ public class IslandTeamInviteAcceptCommand extends CompositeCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean execute(User user, String label, List<String> args) {
|
public boolean execute(User user, String label, List<String> args) {
|
||||||
|
|
||||||
UUID playerUUID = user.getUniqueId();
|
UUID playerUUID = user.getUniqueId();
|
||||||
// Check if player has been invited
|
// Check if player has been invited
|
||||||
if (!itc.getInviteCommand().getInviteList().containsKey(playerUUID)) {
|
if (!itc.getInviteCommand().getInviteList().containsKey(playerUUID)) {
|
||||||
@ -61,6 +63,8 @@ public class IslandTeamInviteAcceptCommand extends CompositeCommand {
|
|||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
askConfirmation(user, "commands.island.team.invite.accept.confirmation", () -> {
|
||||||
// Remove the invite
|
// Remove the invite
|
||||||
itc.getInviteCommand().getInviteList().remove(playerUUID);
|
itc.getInviteCommand().getInviteList().remove(playerUUID);
|
||||||
// Put player into Spectator mode
|
// 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());
|
inviter.sendMessage("commands.island.team.invite.accept.name-joined-your-island", TextVariables.NAME, user.getName());
|
||||||
}
|
}
|
||||||
getIslands().save(island);
|
getIslands().save(island);
|
||||||
|
});
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -338,6 +338,9 @@ commands:
|
|||||||
description: "accept an invitation"
|
description: "accept an invitation"
|
||||||
you-joined-island: "&aYou joined an island! Use /[label] team info to see the other members."
|
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!"
|
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:
|
reject:
|
||||||
description: "reject an invitation"
|
description: "reject an invitation"
|
||||||
you-rejected-invite: "&aYou rejected the invitation to join an island."
|
you-rejected-invite: "&aYou rejected the invitation to join an island."
|
||||||
|
Loading…
Reference in New Issue
Block a user