Skip to content
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

refactor: component field visibility public #42

Merged
merged 1 commit into from
Dec 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,18 @@
*/
public class ProgressTrackingComponent implements Component<ProgressTrackingComponent> {
// Biomes mapped to the corresponding level URIs
HashMap<String, String> biomeToPrefab = new HashMap<String, String>();
public HashMap<String, String> biomeToPrefab = new HashMap<String, String>();

Check warning on line 17 in src/main/java/org/terasology/lost/ProgressTrackingComponent.java

View check run for this annotation

Terasology Jenkins.io / CheckStyle

IllegalTypeCheck

NORMAL: Usage of type 'HashMap' is not allowed.
Raw output
<p>Since Checkstyle 3.2</p><p> Checks that particular classes or interfaces are never used. </p><p> Rationale: Helps reduce coupling on concrete classes. </p><p> For additional restriction of type usage see also: <a href="#IllegalInstantiation">IllegalInstantiation</a>, <a href="config_imports.html#IllegalImport">IllegalImport</a></p>
// To track whether the well has been discovered
boolean foundWell;
public boolean foundWell;
// Stores the hut position once it is spawned to prevent overlapping with levels
Vector3i hutPosition = new Vector3i();
public Vector3i hutPosition = new Vector3i();

public String getLevelPrefab(String biomeName) {
return biomeToPrefab.get(biomeName);
}

public boolean isWellFound() {
return foundWell;

Check warning on line 28 in src/main/java/org/terasology/lost/ProgressTrackingComponent.java

View check run for this annotation

Terasology Jenkins.io / SpotBugs

PA_PUBLIC_PRIMITIVE_ATTRIBUTE

LOW: Primitive field org.terasology.lost.ProgressTrackingComponent.foundWell is public and set from inside the class, which makes it too exposed. Consider making it private to limit external accessibility.
Raw output
no message found
}

public void addLevel(String prefabName, String... biomes) {
Expand Down