Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add reset command to fix issues when changing time unit
- Loading branch information
Showing
5 changed files
with
40 additions
and
8 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
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
28 changes: 28 additions & 0 deletions
28
src/main/java/io/github/hsyyid/kits/cmds/KitResetExecutor.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,28 @@ | ||
package io.github.hsyyid.kits.cmds; | ||
|
||
import io.github.hsyyid.kits.Kits; | ||
import org.spongepowered.api.command.CommandException; | ||
import org.spongepowered.api.command.CommandResult; | ||
import org.spongepowered.api.command.CommandSource; | ||
import org.spongepowered.api.command.args.CommandContext; | ||
import org.spongepowered.api.command.spec.CommandExecutor; | ||
import org.spongepowered.api.text.Text; | ||
import org.spongepowered.api.text.format.TextColors; | ||
|
||
public class KitResetExecutor implements CommandExecutor | ||
{ | ||
public CommandResult execute(CommandSource src, CommandContext ctx) throws CommandException | ||
{ | ||
String kit = ctx.<String> getOne("kit").get(); | ||
|
||
Kits.remainingTime.forEach((k, v) -> { | ||
if (v.containsKey(kit)) | ||
{ | ||
v.remove(kit); | ||
} | ||
}); | ||
|
||
src.sendMessage(Text.of(TextColors.GREEN, "Success: ", TextColors.YELLOW, "Reset the player times for specified Kit.")); | ||
return CommandResult.success(); | ||
} | ||
} |
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