Skip to content

Commit efaa674

Browse files
committed
init
1 parent edf7b7b commit efaa674

29 files changed

Lines changed: 1820 additions & 12 deletions

File tree

core/pom.xml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xmlns="http://maven.apache.org/POM/4.0.0"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
<parent>
7+
<groupId>io.github.projectunified</groupId>
8+
<artifactId>craftitem</artifactId>
9+
<version>1.0-SNAPSHOT</version>
10+
</parent>
11+
12+
<artifactId>craftitem-core</artifactId>
13+
<name>CraftItem Core</name>
14+
</project>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package io.github.projectunified.craftitem.core;
2+
3+
public interface Item {
4+
void setName(String name);
5+
6+
void setAmount(int amount);
7+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package io.github.projectunified.craftitem.core;
2+
3+
import java.util.function.UnaryOperator;
4+
5+
public interface ItemModifier {
6+
void modify(Item item, UnaryOperator<String> translator);
7+
}

modifier/pom.xml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xmlns="http://maven.apache.org/POM/4.0.0"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
<parent>
7+
<groupId>io.github.projectunified</groupId>
8+
<artifactId>craftitem</artifactId>
9+
<version>1.0-SNAPSHOT</version>
10+
</parent>
11+
12+
<artifactId>craftitem-modifier</artifactId>
13+
<name>CraftItem Modifer</name>
14+
15+
<dependencies>
16+
<dependency>
17+
<groupId>io.github.projectunified</groupId>
18+
<artifactId>craftitem-core</artifactId>
19+
<version>${project.version}</version>
20+
</dependency>
21+
</dependencies>
22+
</project>
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package io.github.projectunified.craftitem.modifier;
2+
3+
import io.github.projectunified.craftitem.core.Item;
4+
import io.github.projectunified.craftitem.core.ItemModifier;
5+
6+
import java.util.function.UnaryOperator;
7+
8+
public class AmountModifier implements ItemModifier {
9+
private final String amount;
10+
11+
public AmountModifier(int amount) {
12+
this.amount = Integer.toString(amount);
13+
}
14+
15+
public AmountModifier(String amount) {
16+
this.amount = amount;
17+
}
18+
19+
public AmountModifier() {
20+
this.amount = "1";
21+
}
22+
23+
@Override
24+
public void modify(Item item, UnaryOperator<String> translator) {
25+
String amount = translator.apply(this.amount);
26+
int a;
27+
try {
28+
a = Integer.parseInt(amount);
29+
} catch (NumberFormatException e) {
30+
return;
31+
}
32+
item.setAmount(a);
33+
}
34+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package io.github.projectunified.craftitem.modifier;
2+
3+
import io.github.projectunified.craftitem.core.Item;
4+
import io.github.projectunified.craftitem.core.ItemModifier;
5+
6+
import java.util.function.UnaryOperator;
7+
8+
public class NameModifier implements ItemModifier {
9+
private final String name;
10+
11+
public NameModifier(String name) {
12+
this.name = name;
13+
}
14+
15+
@Override
16+
public void modify(Item item, UnaryOperator<String> translator) {
17+
String name = translator.apply(this.name);
18+
item.setName(name);
19+
}
20+
}

nbt/pom.xml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xmlns="http://maven.apache.org/POM/4.0.0"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<modelVersion>4.0.0</modelVersion>
6+
<parent>
7+
<groupId>io.github.projectunified</groupId>
8+
<artifactId>craftitem</artifactId>
9+
<version>1.0-SNAPSHOT</version>
10+
</parent>
11+
12+
<artifactId>craftitem-nbt</artifactId>
13+
<name>CraftItem NBT</name>
14+
</project>

0 commit comments

Comments
 (0)