Skip to content

Commit

Permalink
Fixed a bug in is spawn
Browse files Browse the repository at this point in the history
  • Loading branch information
Mohron committed Feb 13, 2020
1 parent d528160 commit 623ff47
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 10 deletions.
8 changes: 5 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
# Change Log

# Beta 29 - Grief Defender Port

# Beta 29.1 - Grief Defender Port
**REQUIRED: Sponge API 7.1 (SF 3682+); Grief Defender 1.12.2-4.3.0.622+; Permissions Plugin (ie. LuckPerms)**
**OPTIONAL: Nucleus 1.9.0-S7.1+**
- Fixed a bug where `/is tp` | `/is spawn` would error if an argument was provided

# Beta 29
**REQUIRED: Sponge API 7.1 (SF 3682+); GP 1.12.2-4.3.0.622+; Permissions Plugin (ie. LuckPerms)**
# Beta 29 - Grief Defender Port
**REQUIRED: Sponge API 7.1 (SF 3682+); Grief Defender 1.12.2-4.3.0.622+; Permissions Plugin (ie. LuckPerms)**
**OPTIONAL: Nucleus 1.9.0-S7.1+**
- Added support for one player to own multiple islands
- `/is spawn` & `/is reset` will now display the chest GUI or island list if you have permission to use them on multiple islands
Expand Down
4 changes: 2 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
## Version
major=0
minor=29
patch=0
patch=1
api=S7.1
suffix=GRIEF-DEFENDER-PR1
suffix=GRIEF-DEFENDER-PR2
## Dependencies
spongeapi=7.1.0
spongeforge=1.12.2-2768-7.1.4
Expand Down
15 changes: 10 additions & 5 deletions src/main/java/net/mohron/skyclaims/command/user/CommandSpawn.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,15 @@
package net.mohron.skyclaims.command.user;

import java.util.Optional;
import java.util.UUID;
import java.util.function.Consumer;
import net.mohron.skyclaims.command.CommandBase;
import net.mohron.skyclaims.command.CommandIsland;
import net.mohron.skyclaims.command.argument.Arguments;
import net.mohron.skyclaims.permissions.Permissions;
import net.mohron.skyclaims.util.CommandUtil;
import net.mohron.skyclaims.world.Island;
import net.mohron.skyclaims.world.IslandManager;
import org.spongepowered.api.command.CommandException;
import org.spongepowered.api.command.CommandPermissionException;
import org.spongepowered.api.command.CommandResult;
Expand Down Expand Up @@ -60,12 +62,15 @@ public static void register() {

@Override
public CommandResult execute(Player player, CommandContext args) throws CommandException {
Optional<Island> island = args.getOne(ISLAND);
if (island.isPresent()) {
return sendPlayerToSpawn(player, island.get());
} else {
return listIslands(player, this::sendPlayerToSpawn);
Optional<UUID> uuid = args.getOne(ISLAND);
if (uuid.isPresent()) {
final Optional<Island> island = IslandManager.get(uuid.get());
if (island.isPresent()) {
return sendPlayerToSpawn(player, island.get());
}
}

return listIslands(player, this::sendPlayerToSpawn);
}

private CommandResult sendPlayerToSpawn(Player player, Island island) throws CommandException {
Expand Down

0 comments on commit 623ff47

Please sign in to comment.