Skip to content

Commit

Permalink
Version Increment
Browse files Browse the repository at this point in the history
  • Loading branch information
PeachesMLG committed May 5, 2024
1 parent 89f049f commit 58ecaf1
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 4 deletions.
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins {
}

group = "com.iridium"
version = "1.0.1"
version = "1.0.2"
description = "MockNBTApi"

repositories {
Expand Down
16 changes: 13 additions & 3 deletions src/main/java/com/iridium/mocknbtapi/FakeNBTItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ public class FakeNBTItem implements NBTItem {
private final HashMap<String, Object> nbtData = new HashMap<>();
private final static HashMap<ItemStack, FakeNBTItem> fakeNBTItemHashMap = new HashMap<>();

public FakeNBTItem(ItemStack itemStack){
public FakeNBTItem(ItemStack itemStack) {
this.itemStack = itemStack;
}

public static FakeNBTItem getFakeNBTItem(ItemStack itemStack){
if(!fakeNBTItemHashMap.containsKey(itemStack)){
public static FakeNBTItem getFakeNBTItem(ItemStack itemStack) {
if (!fakeNBTItemHashMap.containsKey(itemStack)) {
fakeNBTItemHashMap.put(itemStack, new FakeNBTItem(itemStack));
}
return fakeNBTItemHashMap.get(itemStack);
Expand All @@ -40,6 +40,11 @@ public void setBoolean(String key, boolean value) {
nbtData.put(key, value);
}

@Override
public void setObject(String key, Object value) {
nbtData.put(key, value);
}

@Override
public String getString(String key) {
return (String) nbtData.get(key);
Expand All @@ -60,6 +65,11 @@ public boolean getBoolean(String key) {
return (boolean) nbtData.get(key);
}

@Override
public <T> T getObject(String key, Class<T> type) {
return (T) nbtData.get(key);
}

@Override
public ItemStack getItem() {
return itemStack;
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/com/iridium/mocknbtapi/NBTItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ public interface NBTItem {

void setBoolean(String key, boolean value);

void setObject(String key, Object value);

String getString(String key);

int getInteger(String key);
Expand All @@ -19,5 +21,7 @@ public interface NBTItem {

boolean getBoolean(String key);

<T> T getObject(String key, Class<T> type);

ItemStack getItem();
}
11 changes: 11 additions & 0 deletions src/main/java/com/iridium/mocknbtapi/RealNBTItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ public void setBoolean(String key, boolean value) {
nbtItem.setBoolean(key, value);
}

@Override
public void setObject(String key, Object value) {
nbtItem.setObject(key, value);
}

@Override
public String getString(String key) {
return nbtItem.getString(key);
Expand All @@ -50,6 +55,12 @@ public boolean getBoolean(String key) {
return nbtItem.getBoolean(key);
}

@Override
public <T> T getObject(String key, Class<T> type) {
return nbtItem.getObject(key, type);
}


@Override
public ItemStack getItem() {
return nbtItem.getItem();
Expand Down

0 comments on commit 58ecaf1

Please sign in to comment.