-
Notifications
You must be signed in to change notification settings - Fork 6
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
1 parent
0c87c0a
commit 5e5f914
Showing
9 changed files
with
147 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
pluginGroup=io.github.m0pt0pmatt.survivalgames | ||
pluginId=survivalgames | ||
pluginVersion=1.2.1 | ||
pluginVersion=1.3.0 |
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
48 changes: 48 additions & 0 deletions
48
.../java/io/github/m0pt0pmatt/survivalgames/command/executor/print/PrintGameModeCommand.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,48 @@ | ||
/* | ||
* This file is part of SurvivalGames, licensed under the MIT License (MIT). | ||
* | ||
* Copyright (c) Matthew Broomfield <[email protected]> | ||
* Copyright (c) contributors | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in | ||
* all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
* THE SOFTWARE. | ||
*/ | ||
|
||
package io.github.m0pt0pmatt.survivalgames.command.executor.print; | ||
|
||
import io.github.m0pt0pmatt.survivalgames.command.element.SurvivalGameCommandElement; | ||
import io.github.m0pt0pmatt.survivalgames.command.executor.SurvivalGamesCommand; | ||
import org.spongepowered.api.text.Text; | ||
|
||
import java.util.Optional; | ||
|
||
class PrintGameModeCommand extends AbstractPrintCommand { | ||
|
||
private static final SurvivalGamesCommand INSTANCE = new PrintGameModeCommand(); | ||
|
||
private PrintGameModeCommand() { | ||
super( | ||
"game-mode", | ||
SurvivalGameCommandElement.getInstance(), | ||
survivalGame -> Optional.of(Text.of(survivalGame.getConfig().getGameMode().getName()))); | ||
} | ||
|
||
static SurvivalGamesCommand getInstance() { | ||
return INSTANCE; | ||
} | ||
} |
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
74 changes: 74 additions & 0 deletions
74
...main/java/io/github/m0pt0pmatt/survivalgames/command/executor/set/SetGameModeCommand.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,74 @@ | ||
/* | ||
* This file is part of SurvivalGames, licensed under the MIT License (MIT). | ||
* | ||
* Copyright (c) Matthew Broomfield <[email protected]> | ||
* Copyright (c) contributors | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in | ||
* all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
* THE SOFTWARE. | ||
*/ | ||
|
||
package io.github.m0pt0pmatt.survivalgames.command.executor.set; | ||
|
||
import io.github.m0pt0pmatt.survivalgames.command.CommandKeys; | ||
import io.github.m0pt0pmatt.survivalgames.command.element.SurvivalGameCommandElement; | ||
import io.github.m0pt0pmatt.survivalgames.command.executor.LeafCommand; | ||
import io.github.m0pt0pmatt.survivalgames.command.executor.SurvivalGamesCommand; | ||
import io.github.m0pt0pmatt.survivalgames.game.SurvivalGame; | ||
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.args.GenericArguments; | ||
import org.spongepowered.api.entity.living.player.gamemode.GameMode; | ||
|
||
import javax.annotation.Nonnull; | ||
|
||
import static io.github.m0pt0pmatt.survivalgames.Util.getOrThrow; | ||
import static io.github.m0pt0pmatt.survivalgames.Util.sendSuccess; | ||
|
||
class SetGameModeCommand extends LeafCommand { | ||
|
||
private static final SurvivalGamesCommand INSTANCE = new SetGameModeCommand(); | ||
|
||
private SetGameModeCommand() { | ||
super( | ||
SetCommand.getInstance(), | ||
"game-mode", | ||
GenericArguments.seq( | ||
SurvivalGameCommandElement.getInstance(), | ||
GenericArguments.catalogedElement(CommandKeys.GAME_MODE, GameMode.class))); | ||
} | ||
|
||
@Nonnull | ||
@Override | ||
public CommandResult executeCommand(@Nonnull CommandSource src, @Nonnull CommandContext args) | ||
throws CommandException { | ||
SurvivalGame survivalGame = (SurvivalGame) getOrThrow(args, CommandKeys.SURVIVAL_GAME); | ||
GameMode gameMode = (GameMode) getOrThrow(args, CommandKeys.GAME_MODE); | ||
|
||
survivalGame.getConfig().setGameMode(gameMode); | ||
|
||
sendSuccess(src, "Set game mode", gameMode); | ||
return CommandResult.success(); | ||
} | ||
|
||
static SurvivalGamesCommand getInstance() { | ||
return INSTANCE; | ||
} | ||
} |
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