-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Maven Uploads & Upgrades lock/unlock command
Github Actions will not push a snapshot to our maven on project push, publish.yml will need updated when we merge
- Loading branch information
Showing
14 changed files
with
225 additions
and
73 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 |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: Publish to Maven Repository | ||
|
||
on: | ||
push: | ||
branches: | ||
- new_assets | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up JDK | ||
uses: actions/setup-java@v2 | ||
with: | ||
distribution: 'adopt' | ||
java-version: '17' | ||
|
||
- name: Make Gradlew Executable | ||
run: chmod +x ./gradlew | ||
|
||
- name: Build and Publish | ||
run: | | ||
./gradlew publish | ||
env: | ||
MAVEN_REPO_USERNAME: ${{ secrets.MAVEN_REPO_USERNAME }} | ||
MAVEN_REPO_PASSWORD: ${{ secrets.MAVEN_REPO_PASSWORD }} |
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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
|
||
|
||
## Upgrades | ||
#### Additions | ||
|
||
|
||
## Particles | ||
#### Additions | ||
- Added ARS Leaves Particles | ||
|
||
## Models | ||
### Shells | ||
#### Updates | ||
- Updated Police Box Shell Model | ||
- Updated Factory Shell Model | ||
#### Additions | ||
- Added Lift Shell | ||
- Added Hieroglyph | ||
- Added Castle |
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
45 changes: 45 additions & 0 deletions
45
common/src/main/java/whocraft/tardis_refined/command/arguments/UpgradeArgumentType.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,45 @@ | ||
package whocraft.tardis_refined.command.arguments; | ||
|
||
import com.mojang.brigadier.StringReader; | ||
import com.mojang.brigadier.arguments.ArgumentType; | ||
import com.mojang.brigadier.context.CommandContext; | ||
import com.mojang.brigadier.exceptions.CommandSyntaxException; | ||
import com.mojang.brigadier.exceptions.DynamicCommandExceptionType; | ||
import com.mojang.brigadier.suggestion.Suggestions; | ||
import com.mojang.brigadier.suggestion.SuggestionsBuilder; | ||
import net.minecraft.commands.SharedSuggestionProvider; | ||
import net.minecraft.network.chat.Component; | ||
import net.minecraft.resources.ResourceLocation; | ||
import whocraft.tardis_refined.common.capability.upgrades.Upgrade; | ||
import whocraft.tardis_refined.common.capability.upgrades.Upgrades; | ||
|
||
import java.util.Collection; | ||
import java.util.concurrent.CompletableFuture; | ||
|
||
public class UpgradeArgumentType implements ArgumentType<Upgrade> { | ||
|
||
public static final DynamicCommandExceptionType INVALID_UPGRADE_EXCEPTION = new DynamicCommandExceptionType((UPGRADE) -> Component.translatable("argument.regeneration.upgrade.invalid", UPGRADE)); | ||
|
||
public static UpgradeArgumentType upgradeArgumentType() { | ||
return new UpgradeArgumentType(); | ||
} | ||
|
||
@Override | ||
public Upgrade parse(StringReader reader) throws CommandSyntaxException { | ||
ResourceLocation location = ResourceLocation.read(reader); | ||
Upgrade upgrade = Upgrades.UPGRADE_DEFERRED_REGISTRY.getRegistry().get(location); | ||
if (upgrade != null) { | ||
return upgrade; | ||
} | ||
throw INVALID_UPGRADE_EXCEPTION.create(location); } | ||
|
||
@Override | ||
public <S> CompletableFuture<Suggestions> listSuggestions(CommandContext<S> context, SuggestionsBuilder builder) { | ||
return SharedSuggestionProvider.suggestResource(Upgrades.UPGRADE_REGISTRY.keySet(), builder); | ||
} | ||
|
||
@Override | ||
public Collection<String> getExamples() { | ||
return ArgumentType.super.getExamples(); | ||
} | ||
} |
55 changes: 55 additions & 0 deletions
55
common/src/main/java/whocraft/tardis_refined/command/sub/UpgradesCommand.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,55 @@ | ||
package whocraft.tardis_refined.command.sub; | ||
|
||
import com.mojang.brigadier.Command; | ||
import com.mojang.brigadier.CommandDispatcher; | ||
import com.mojang.brigadier.builder.ArgumentBuilder; | ||
import com.mojang.brigadier.context.CommandContext; | ||
import com.mojang.brigadier.exceptions.CommandSyntaxException; | ||
import net.minecraft.commands.CommandSourceStack; | ||
import net.minecraft.commands.Commands; | ||
import net.minecraft.commands.arguments.DimensionArgument; | ||
import net.minecraft.network.chat.Component; | ||
import net.minecraft.server.level.ServerLevel; | ||
import whocraft.tardis_refined.command.arguments.UpgradeArgumentType; | ||
import whocraft.tardis_refined.common.capability.TardisLevelOperator; | ||
import whocraft.tardis_refined.common.capability.upgrades.Upgrade; | ||
import whocraft.tardis_refined.common.util.CommandHelper; | ||
|
||
public class UpgradesCommand { | ||
|
||
public static ArgumentBuilder<CommandSourceStack, ?> register(CommandDispatcher<CommandSourceStack> dispatcher) { | ||
return Commands.literal("upgrades") | ||
.then(Commands.literal("lock") | ||
.then(Commands.argument("dimension", DimensionArgument.dimension()).suggests(CommandHelper.SUGGEST_TARDISES) | ||
.then(Commands.argument("upgrade", UpgradeArgumentType.upgradeArgumentType()) | ||
.executes(UpgradesCommand::setUpgradeLocked)))) | ||
.then(Commands.literal("unlock") | ||
.then(Commands.argument("dimension", DimensionArgument.dimension()).suggests(CommandHelper.SUGGEST_TARDISES) | ||
.then(Commands.argument("upgrade", UpgradeArgumentType.upgradeArgumentType()) | ||
.executes(UpgradesCommand::setUpgradeUnlocked)))); | ||
} | ||
|
||
private static int setUpgradeLocked(CommandContext<CommandSourceStack> context) throws CommandSyntaxException { | ||
ServerLevel dimension = DimensionArgument.getDimension(context, "dimension"); | ||
Upgrade upgrade = context.getArgument("upgrade", Upgrade.class); | ||
|
||
TardisLevelOperator.get(dimension).ifPresent(tardisLevelOperator -> { | ||
tardisLevelOperator.getUpgradeHandler().lockUpgrade(upgrade); | ||
context.getSource().sendSystemMessage(Component.literal("Tardis: " + dimension.toString().split(":")[1] + " locked " + upgrade.getDisplayName())); | ||
}); | ||
|
||
return Command.SINGLE_SUCCESS; | ||
} | ||
|
||
private static int setUpgradeUnlocked(CommandContext<CommandSourceStack> context) throws CommandSyntaxException { | ||
ServerLevel dimension = DimensionArgument.getDimension(context, "dimension"); | ||
Upgrade upgrade = context.getArgument("upgrade", Upgrade.class); | ||
|
||
TardisLevelOperator.get(dimension).ifPresent(tardisLevelOperator -> { | ||
tardisLevelOperator.getUpgradeHandler().unlockUpgrade(upgrade); | ||
context.getSource().sendSystemMessage(Component.literal("Tardis: " + dimension.toString().split(":")[1] + " unlocked " + upgrade.getDisplayName())); | ||
}); | ||
|
||
return Command.SINGLE_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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,5 +71,4 @@ public class Upgrades { | |
|
||
|
||
|
||
|
||
} |
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
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
Oops, something went wrong.