Uses and catches specific IOException for new islands

Relates to c3442c29ba
This commit is contained in:
tastybento 2019-12-16 17:24:48 -08:00
parent e8810d41d9
commit 27c1b6505c
3 changed files with 6 additions and 4 deletions

View File

@ -1,5 +1,6 @@
package world.bentobox.bentobox.api.commands.island;
import java.io.IOException;
import java.util.List;
import org.eclipse.jdt.annotation.Nullable;
@ -93,7 +94,7 @@ public class IslandCreateCommand extends CompositeCommand {
.reason(Reason.CREATE)
.name(name)
.build();
} catch (Exception e) {
} catch (IOException e) {
getPlugin().logError("Could not create island for player. " + e.getMessage());
user.sendMessage(e.getMessage());
return false;

View File

@ -1,5 +1,6 @@
package world.bentobox.bentobox.api.commands.island;
import java.io.IOException;
import java.util.List;
import org.bukkit.Bukkit;
@ -139,7 +140,7 @@ public class IslandResetCommand extends ConfirmableCommand {
.name(name);
if (noPaste) builder.noPaste();
builder.build();
} catch (Exception e) {
} catch (IOException e) {
getPlugin().logError("Could not create island for player. " + e.getMessage());
user.sendMessage(e.getMessage());
return false;

View File

@ -35,7 +35,7 @@ public class NewIsland {
private NewIslandLocationStrategy locationStrategy;
public NewIsland(Builder builder) throws Exception {
public NewIsland(Builder builder) throws IOException {
plugin = BentoBox.getInstance();
this.user = builder.user2;
this.reason = builder.reason2;
@ -137,7 +137,7 @@ public class NewIsland {
* @return Island
* @throws Exception
*/
public Island build() throws Exception {
public Island build() throws IOException {
if (user2 != null) {
NewIsland newIsland = new NewIsland(this);
return newIsland.getIsland();