mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2025-02-26 01:01:50 +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")
|
@ConfigEntry(path = "island.cooldown.time.reset")
|
||||||
private int resetCooldown = 300;
|
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
|
// Timeout for team kick and leave commands
|
||||||
@ConfigComment("Time in seconds that players have to confirm sensitive commands, e.g. island reset.")
|
@ConfigComment("Time in seconds that players have to confirm sensitive commands, e.g. island reset.")
|
||||||
@ConfigEntry(path = "island.confirmation.time")
|
@ConfigEntry(path = "island.confirmation.time")
|
||||||
@ -432,4 +436,12 @@ public class Settings implements DataObject {
|
|||||||
public void setLogCleanSuperFlatChunks(boolean logCleanSuperFlatChunks) {
|
public void setLogCleanSuperFlatChunks(boolean logCleanSuperFlatChunks) {
|
||||||
this.logCleanSuperFlatChunks = 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)
|
.reason(Reason.CREATE)
|
||||||
.name(name)
|
.name(name)
|
||||||
.build();
|
.build();
|
||||||
return true;
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
getPlugin().logError("Could not create island for player. " + e.getMessage());
|
getPlugin().logError("Could not create island for player. " + e.getMessage());
|
||||||
user.sendMessage("commands.island.create.unable-create-island");
|
user.sendMessage("commands.island.create.unable-create-island");
|
||||||
return false;
|
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