-
-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
84 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 43 additions & 0 deletions
43
src/main/java/xyz/nkomarn/harbor/command/ForceSkipCommand.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package xyz.nkomarn.harbor.command; | ||
|
||
import org.bukkit.World; | ||
import org.bukkit.command.Command; | ||
import org.bukkit.command.CommandExecutor; | ||
import org.bukkit.command.CommandSender; | ||
import org.bukkit.entity.Player; | ||
import org.jetbrains.annotations.NotNull; | ||
import xyz.nkomarn.harbor.Harbor; | ||
import xyz.nkomarn.harbor.task.Checker; | ||
import xyz.nkomarn.harbor.util.Config; | ||
|
||
public class ForceSkipCommand implements CommandExecutor { | ||
|
||
private final Harbor harbor; | ||
private final Config config; | ||
|
||
public ForceSkipCommand(@NotNull Harbor harbor) { | ||
this.harbor = harbor; | ||
this.config = harbor.getConfiguration(); | ||
} | ||
|
||
@Override | ||
public boolean onCommand(@NotNull CommandSender sender, @NotNull Command command, @NotNull String s, @NotNull String[] args) { | ||
if (!(sender instanceof Player)) { | ||
sender.sendMessage(config.getPrefix() + "This command can only be used by a player."); | ||
return true; | ||
} | ||
|
||
Player player = (Player) sender; | ||
World world = player.getWorld(); | ||
Checker checker = harbor.getChecker(); | ||
|
||
if (checker.isSkipping(world)) { | ||
sender.sendMessage(config.getPrefix() + "This world's time is already being accelerated."); | ||
} else { | ||
sender.sendMessage(config.getPrefix() + "Forcing night skip in your world."); | ||
checker.forceSkip(world); | ||
} | ||
|
||
return true; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,27 @@ | ||
name: Harbor | ||
description: Harbor is a Spigot plugin that redefines how sleep works in your server, making it easier for all the online players to get in bed quickly and skip through the night! | ||
main: xyz.nkomarn.harbor.Harbor | ||
version: 1.6.2-SNAPSHOT | ||
author: TechToolbox (@nkomarn) | ||
website: https://nkomarn.xyz | ||
softdepend: [Essentials] | ||
api-version: 1.14 | ||
name: "Harbor" | ||
description: "Harbor redefines how sleep works in your server, making it easier for all the online players to get in bed quickly and skip through the night!" | ||
main: "xyz.nkomarn.harbor.Harbor" | ||
author: "TechToolbox (@nkomarn)" | ||
website: "https://nkomarn.xyz" | ||
version: "1.6.2" | ||
api-version: "1.14" | ||
|
||
softdepend: | ||
- "Essentials" | ||
|
||
commands: | ||
harbor: | ||
description: "Base command for Harbor!" | ||
usage: "/harbor [subcommand]" | ||
description: "Base command for Harbor." | ||
usage: "/harbor <subcommand>" | ||
forceskip: | ||
description: "Allows players to accelerate the night of their current world." | ||
permission: "harbor.forceskip" | ||
|
||
permissions: | ||
harbor.ignored: | ||
default: false | ||
harbor.admin: | ||
default: op | ||
default: op | ||
harbor.forceskip: | ||
description: "Permits usage of the /forceskip command." | ||
default: op | ||
harbor.ignored: | ||
default: false |