-
Notifications
You must be signed in to change notification settings - Fork 5
Add initial rail generator implementation #86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Jasupa
wants to merge
21
commits into
main
Choose a base branch
from
rail-generator
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,182
−328
Open
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
7e3b921
feature: added a rail generator command including a custom undo and redo
Jasupa 15bbb6f
feature: added a first version for the cuboid and poly rail generator
Jasupa 21f12fe
feature:
Jasupa 4ec9831
feature:
Jasupa e2c8339
refactor:
Jasupa 0bcb5f3
refactor:
Jasupa 9a9cdbd
fix:
Jasupa 62334b1
fix:
Jasupa 6017090
refractor:
Jasupa 7aa3e61
refractor:
Jasupa 1701a9c
refractor:
Jasupa 6d2a09c
style(generator): restore single-line guard statements for railscripts
Jasupa 64eebf2
refactor(rail): remove custom rail point commands
Jasupa 70f6f4a
fix(generator): address review feedback
Jasupa 2d60906
fix(generator): address rail review feedback
Jasupa a183c32
fix(generator): address command execution review feedback
Jasupa 2c8fb94
fix(rail): address rail review feedback
Jasupa cf3fd1b
fix(generator): improve rail placement and shared block updates
Jasupa 0d71a78
fix(generator): resolve qodana warnings
Jasupa afb04db
fix(generator): resolve merge issues
Jasupa 823f180
fix(generator): avoid deprecated rail type icon parsing
Jasupa File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -4,7 +4,7 @@ dependencyResolutionManagement { | |
| repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) | ||
| repositories { | ||
| mavenCentral() | ||
| //mavenLocal() // NEVER use in Production/Commits! | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please don't commit that |
||
| mavenLocal() | ||
| maven { | ||
| url = uri("https://repo.papermc.io/repository/maven-public/") | ||
| } | ||
|
|
@@ -60,4 +60,4 @@ dependencyResolutionManagement { | |
|
|
||
| maven("https://repo.bluecolored.de/releases") | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or 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 hidden or 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 hidden or 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
38 changes: 31 additions & 7 deletions
38
src/main/java/net/buildtheearth/buildteamtools/modules/generator/components/rail/Rail.java
This file contains hidden or 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,27 +1,51 @@ | ||
| package net.buildtheearth.buildteamtools.modules.generator.components.rail; | ||
|
|
||
| import com.alpsbte.alpslib.utils.GeneratorUtils; | ||
| import com.sk89q.worldedit.regions.ConvexPolyhedralRegion; | ||
| import com.sk89q.worldedit.regions.CuboidRegion; | ||
| import com.sk89q.worldedit.regions.Polygonal2DRegion; | ||
| import com.sk89q.worldedit.regions.Region; | ||
| import net.buildtheearth.buildteamtools.modules.generator.GeneratorModule; | ||
| import net.buildtheearth.buildteamtools.modules.generator.model.GeneratorComponent; | ||
| import net.buildtheearth.buildteamtools.modules.generator.model.GeneratorType; | ||
| import net.kyori.adventure.text.Component; | ||
| import net.kyori.adventure.text.format.NamedTextColor; | ||
| import org.bukkit.Sound; | ||
| import org.bukkit.entity.Player; | ||
|
|
||
| public class Rail extends GeneratorComponent { | ||
|
|
||
| public Rail() { | ||
| super(GeneratorType.RAILWAY); | ||
| super(GeneratorType.RAIL); | ||
| } | ||
|
|
||
| @Override | ||
| public boolean checkForPlayer(Player p) { | ||
| return !GeneratorUtils.checkForNoWorldEditSelection(p); | ||
| public boolean checkForPlayer(Player player) { | ||
| if (GeneratorUtils.checkForNoWorldEditSelection(player)) | ||
| return false; | ||
|
|
||
| Region region = GeneratorUtils.getWorldEditSelection(player); | ||
|
|
||
| if (isSupportedRailSelection(region)) | ||
| return true; | ||
|
|
||
| player.sendMessage(Component.text("Rail Generator supports cuboid, polygonal and convex WorldEdit selections.", NamedTextColor.RED)); | ||
| player.closeInventory(); | ||
| player.playSound(player.getLocation(), Sound.ENTITY_ITEM_BREAK, 1.0F, 1.0F); | ||
| return false; | ||
| } | ||
|
|
||
| private boolean isSupportedRailSelection(Region region) { | ||
| return region instanceof CuboidRegion | ||
| || region instanceof Polygonal2DRegion | ||
| || region instanceof ConvexPolyhedralRegion; | ||
| } | ||
|
|
||
| @Override | ||
| public void generate(Player p) { | ||
| if (!GeneratorModule.getInstance().getRail().checkForPlayer(p)) | ||
| public void generate(Player player) { | ||
| if (!GeneratorModule.getInstance().getRail().checkForPlayer(player)) | ||
| return; | ||
|
|
||
| new RailScripts(p, this); | ||
| new RailScripts(player, this); | ||
| } | ||
| } | ||
| } |
27 changes: 12 additions & 15 deletions
27
...ain/java/net/buildtheearth/buildteamtools/modules/generator/components/rail/RailFlag.java
This file contains hidden or 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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unnecessary change