Skip to content

Commit

Permalink
Update AssaultRepairCommand.java
Browse files Browse the repository at this point in the history
  • Loading branch information
TylerS1066 committed Jul 9, 2024
1 parent 33aabf5 commit 6492be2
Showing 1 changed file with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
import org.jetbrains.annotations.NotNull;

import java.util.List;
import java.util.Set;
import java.util.UUID;

import static net.countercraft.movecraft.util.ChatUtils.ERROR_PREFIX;
import static net.countercraft.movecraft.util.ChatUtils.MOVECRAFT_COMMAND_PREFIX;
Expand Down Expand Up @@ -69,7 +71,19 @@ public boolean onCommand(@NotNull CommandSender commandSender, Command command,

List<AssaultData> data = AssaultUtils.retrieveInfoFile(regionName, player.getWorld().getName());
if (data != null && !data.isEmpty()) {
MovecraftWorldGuard.getInstance().getWGUtils().addOwners(regionName, player.getWorld(), data.get(0).getOwners());
Set<UUID> ownerSet = data.get(0).getOwners();
if (ownerSet != null && !ownerSet.isEmpty()) {
if (!MovecraftWorldGuard.getInstance().getWGUtils().addOwners(regionName, player.getWorld(), ownerSet)) {
String broadcast = String.format(I18nSupport.getInternationalisedString("Assault - Owners Failed"),
regionName);
Bukkit.getServer().broadcastMessage(broadcast);

// Note: there is no assault to pass here...
AssaultBroadcastEvent broadcastEvent = new AssaultBroadcastEvent(null, broadcast,
AssaultBroadcastEvent.Type.OWNER_FAIL);
Bukkit.getServer().getPluginManager().callEvent(broadcastEvent);
}
}
}

return true;
Expand Down

0 comments on commit 6492be2

Please sign in to comment.