mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-11-30 22:53:39 +01:00
Added option to apply the reset cooldown when the player creates an island for the first time
Closes #456.
This commit is contained in:
parent
9551560593
commit
aea057317b
@ -119,6 +119,10 @@ public class Settings implements DataObject {
|
||||
@ConfigEntry(path = "island.cooldown.time.reset")
|
||||
private int resetCooldown = 300;
|
||||
|
||||
@ConfigComment("Whether the reset cooldown should be applied when the player creates an island for the first time or not.")
|
||||
@ConfigEntry(path = "island.cooldown.options.set-reset-cooldown-on-create", since = "1.2.0")
|
||||
private boolean resetCooldownOnCreate = true;
|
||||
|
||||
// Timeout for team kick and leave commands
|
||||
@ConfigComment("Time in seconds that players have to confirm sensitive commands, e.g. island reset.")
|
||||
@ConfigEntry(path = "island.confirmation.time")
|
||||
@ -432,4 +436,12 @@ public class Settings implements DataObject {
|
||||
public void setLogCleanSuperFlatChunks(boolean logCleanSuperFlatChunks) {
|
||||
this.logCleanSuperFlatChunks = logCleanSuperFlatChunks;
|
||||
}
|
||||
|
||||
public boolean isResetCooldownOnCreate() {
|
||||
return resetCooldownOnCreate;
|
||||
}
|
||||
|
||||
public void setResetCooldownOnCreate(boolean resetCooldownOnCreate) {
|
||||
this.resetCooldownOnCreate = resetCooldownOnCreate;
|
||||
}
|
||||
}
|
@ -73,11 +73,15 @@ public class IslandCreateCommand extends CompositeCommand {
|
||||
.reason(Reason.CREATE)
|
||||
.name(name)
|
||||
.build();
|
||||
return true;
|
||||
} catch (IOException e) {
|
||||
getPlugin().logError("Could not create island for player. " + e.getMessage());
|
||||
user.sendMessage("commands.island.create.unable-create-island");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (getSettings().isResetCooldownOnCreate()) {
|
||||
getParent().getSubCommand("reset").ifPresent(resetCommand -> resetCommand.setCooldown(user.getUniqueId(), null, getSettings().getResetCooldown()));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user