Skip to content

Commit 0eef69d

Browse files
authored
Update to v0.2.0 (#5)
2 parents 24aa1ab + 824843b commit 0eef69d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+480
-167
lines changed

README.md

+14
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,13 @@ dependencies {
5656
```
5757
## Usage
5858

59+
### Java
60+
61+
```java
62+
Coordinate2D coordinate2D = new Coordinate2D(1, 2);
63+
Coordinate3D coordinate3D = new Coordinate3D(1, 2, 3);
64+
```
65+
5966
```java
6067

6168
public class Main {
@@ -78,6 +85,13 @@ public class Main {
7885

7986
```
8087

88+
### Kotlin
89+
90+
```kotlin
91+
val (x, y) = Coordinate2D(1, 2)
92+
val (x, y, z) = Coordinate3D(1, 2, 3)
93+
```
94+
8195
```kotlin
8296

8397
fun main() {

build.gradle.kts

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ plugins {
99

1010
val jvm = JavaVersion.VERSION_11
1111

12-
group = "me.gamercoder215.calcgames"
13-
version = "0.1.2"
12+
group = "xyz.calcugames"
13+
version = "0.2.0"
1414

1515
java {
1616
sourceCompatibility = jvm
@@ -103,7 +103,7 @@ artifacts {
103103
publishing {
104104
publications {
105105
create<MavenPublication>("maven") {
106-
groupId = "me.gamercoder215.calcgames"
106+
groupId = "xyz.calcugames"
107107
artifactId = "levelz-java"
108108

109109
pom {

src/main/java/me/gamercoder215/calcgames/levelz/LevelObject.java

-66
This file was deleted.

src/main/java/me/gamercoder215/calcgames/levelz/Block.java renamed to src/main/java/xyz/calcugames/levelz/Block.java

+9-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package me.gamercoder215.calcgames.levelz;
1+
package xyz.calcugames.levelz;
22

33
import org.jetbrains.annotations.NotNull;
44
import org.jetbrains.annotations.Unmodifiable;
@@ -14,6 +14,14 @@ public final class Block {
1414
private final String name;
1515
private final Map<String, Object> properties;
1616

17+
/**
18+
* Creates a new Block with the given name and empty properties.
19+
* @param name Block Name
20+
*/
21+
public Block(@NotNull String name) {
22+
this(name, Map.of());
23+
}
24+
1725
/**
1826
* Creates a new Block with the given name and properties.
1927
* @param name Block Name

src/main/java/me/gamercoder215/calcgames/levelz/Dimension.java renamed to src/main/java/xyz/calcugames/levelz/Dimension.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package me.gamercoder215.calcgames.levelz;
1+
package xyz.calcugames.levelz;
22

33
import org.jetbrains.annotations.NotNull;
44

src/main/java/me/gamercoder215/calcgames/levelz/Keywords.java renamed to src/main/java/xyz/calcugames/levelz/Keywords.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package me.gamercoder215.calcgames.levelz;
1+
package xyz.calcugames.levelz;
22

33
/**
44
* Utility class for LevelZ File Keywords

src/main/java/me/gamercoder215/calcgames/levelz/Level.java renamed to src/main/java/xyz/calcugames/levelz/Level.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
package me.gamercoder215.calcgames.levelz;
1+
package xyz.calcugames.levelz;
22

3-
import me.gamercoder215.calcgames.levelz.coord.Coordinate;
3+
import xyz.calcugames.levelz.coord.Coordinate;
44
import org.jetbrains.annotations.NotNull;
55
import org.jetbrains.annotations.Unmodifiable;
66

src/main/java/me/gamercoder215/calcgames/levelz/Level2D.java renamed to src/main/java/xyz/calcugames/levelz/Level2D.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
package me.gamercoder215.calcgames.levelz;
1+
package xyz.calcugames.levelz;
22

3-
import me.gamercoder215.calcgames.levelz.coord.Coordinate;
4-
import me.gamercoder215.calcgames.levelz.coord.Coordinate2D;
53
import org.jetbrains.annotations.NotNull;
64
import org.jetbrains.annotations.Unmodifiable;
5+
import xyz.calcugames.levelz.coord.Coordinate;
6+
import xyz.calcugames.levelz.coord.Coordinate2D;
77

88
import java.util.*;
99
import java.util.stream.Collectors;

src/main/java/me/gamercoder215/calcgames/levelz/Level3D.java renamed to src/main/java/xyz/calcugames/levelz/Level3D.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
package me.gamercoder215.calcgames.levelz;
1+
package xyz.calcugames.levelz;
22

3-
import me.gamercoder215.calcgames.levelz.coord.Coordinate;
4-
import me.gamercoder215.calcgames.levelz.coord.Coordinate3D;
3+
import xyz.calcugames.levelz.coord.Coordinate;
4+
import xyz.calcugames.levelz.coord.Coordinate3D;
55
import org.jetbrains.annotations.NotNull;
66
import org.jetbrains.annotations.Unmodifiable;
77

src/main/java/me/gamercoder215/calcgames/levelz/LevelExporter.java renamed to src/main/java/xyz/calcugames/levelz/LevelExporter.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package me.gamercoder215.calcgames.levelz;
1+
package xyz.calcugames.levelz;
22

33
import org.jetbrains.annotations.NotNull;
44

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
package xyz.calcugames.levelz;
2+
3+
import xyz.calcugames.levelz.coord.Coordinate;
4+
import org.jetbrains.annotations.NotNull;
5+
import xyz.calcugames.levelz.coord.Coordinate2D;
6+
import xyz.calcugames.levelz.coord.Coordinate3D;
7+
8+
import java.util.Map;
9+
import java.util.Objects;
10+
11+
/**
12+
* Utility Object for representing a Level Block and its Coordinate.
13+
*/
14+
public final class LevelObject implements Comparable<LevelObject> {
15+
16+
private final Block block;
17+
private final Coordinate coordinate;
18+
19+
/**
20+
* Creates a new LevelObject with the given block and coordinate.
21+
* @param block Block
22+
* @param coordinate Coordinate
23+
*/
24+
public LevelObject(@NotNull Block block, @NotNull Coordinate coordinate) {
25+
this.block = block;
26+
this.coordinate = coordinate;
27+
}
28+
29+
/**
30+
* Creates a new LevelObject with the given block and coordinate.
31+
* @param block Block
32+
* @param x X Coordinate
33+
* @param y Y Coordinate
34+
*/
35+
public LevelObject(@NotNull Block block, int x, int y) {
36+
this(block, new Coordinate2D(x, y));
37+
}
38+
39+
/**
40+
* Creates a new LevelObject with the given block and coordinate.
41+
* @param name Block Name
42+
* @param x X Coordinate
43+
* @param y Y Coordinate
44+
*/
45+
public LevelObject(@NotNull String name, int x, int y) {
46+
this(new Block(name), new Coordinate2D(x, y));
47+
}
48+
49+
/**
50+
* Creates a new LevelObject with the given block and coordinate.
51+
* @param name Block Name
52+
* @param properties Block Properties
53+
* @param x X Coordinate
54+
* @param y Y Coordinate
55+
*/
56+
public LevelObject(@NotNull String name, Map<String, Object> properties, int x, int y) {
57+
this(new Block(name, properties), new Coordinate2D(x, y));
58+
}
59+
60+
/**
61+
* Creates a new LevelObject with the given block and coordinate.
62+
* @param block Block
63+
* @param x X Coordinate
64+
* @param y Y Coordinate
65+
* @param z Z Coordinate
66+
*/
67+
public LevelObject(@NotNull Block block, int x, int y, int z) {
68+
this(block, new Coordinate3D(x, y, z));
69+
}
70+
71+
/**
72+
* Creates a new LevelObject with the given block and coordinate.
73+
* @param name Block Name
74+
* @param x X Coordinate
75+
* @param y Y Coordinate
76+
* @param z Z Coordinate
77+
*/
78+
public LevelObject(@NotNull String name, int x, int y, int z) {
79+
this(new Block(name), new Coordinate3D(x, y, z));
80+
}
81+
82+
/**
83+
* Creates a new LevelObject with the given block and coordinate.
84+
* @param name Block Name
85+
* @param properties Block Properties
86+
* @param x X Coordinate
87+
* @param y Y Coordinate
88+
* @param z Z Coordinate
89+
*/
90+
public LevelObject(@NotNull String name, Map<String, Object> properties, int x, int y, int z) {
91+
this(new Block(name, properties), new Coordinate3D(x, y, z));
92+
}
93+
94+
/**
95+
* Gets the block of this LevelObject.
96+
* @return LevelObject Block
97+
*/
98+
@NotNull
99+
public Block getBlock() {
100+
return block;
101+
}
102+
103+
/**
104+
* Gets the coordinate of this LevelObject.
105+
* @return LevelObject Coordinate
106+
*/
107+
@NotNull
108+
public Coordinate getCoordinate() {
109+
return coordinate;
110+
}
111+
112+
@Override
113+
public boolean equals(Object o) {
114+
if (this == o) return true;
115+
if (o == null || getClass() != o.getClass()) return false;
116+
LevelObject that = (LevelObject) o;
117+
return Objects.equals(block, that.block) && Objects.equals(coordinate, that.coordinate);
118+
}
119+
120+
@Override
121+
public int hashCode() {
122+
return Objects.hash(block, coordinate);
123+
}
124+
125+
@Override
126+
public String toString() {
127+
return block + ": " + coordinate;
128+
}
129+
130+
@Override
131+
public int compareTo(LevelObject o) {
132+
return coordinate.compareTo(o.coordinate);
133+
}
134+
}

src/main/java/me/gamercoder215/calcgames/levelz/Scroll.java renamed to src/main/java/xyz/calcugames/levelz/Scroll.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package me.gamercoder215.calcgames.levelz;
1+
package xyz.calcugames.levelz;
22

33
/**
44
* Represents the scroll direction of a 2D Level.

0 commit comments

Comments
 (0)