Skip to content

Commit

Permalink
Add simple BlockPosition based helpers for BlockStorage to help eas…
Browse files Browse the repository at this point in the history
…e the transition between `Location` and `BlockStorage`
  • Loading branch information
ProfElements committed Sep 23, 2024
1 parent 45601c8 commit bad5172
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/main/java/me/mrCookieSlime/Slimefun/api/BlockStorage.java
Original file line number Diff line number Diff line change
Expand Up @@ -513,10 +513,18 @@ public static String getLocationInfo(Location l, String key) {
return getLocationInfo(l).getString(key);
}

public static String getLocationInfo(BlockPosition l, String key) {
return getLocationInfo(l.toLocation()).getString(key);
}

public static void addBlockInfo(Location l, String key, String value) {
addBlockInfo(l, key, value, false);
}

public static void addBlockInfo(BlockPosition l, String key, String value) {
addBlockInfo(l.toLocation(), key, value, false);
}

public static void addBlockInfo(Block block, String key, String value) {
addBlockInfo(block.getLocation(), key, value);
}
Expand All @@ -525,6 +533,10 @@ public static void addBlockInfo(Block block, String key, String value, boolean u
addBlockInfo(block.getLocation(), key, value, updateTicker);
}

public static void addBlockInfo(BlockPosition l, String key, String value, boolean updateTicker) {
addBlockInfo(l.toLocation(), key, value, updateTicker);
}

public static void addBlockInfo(Location l, String key, String value, boolean updateTicker) {
Config cfg = getLocationInfo(l);

Expand Down

0 comments on commit bad5172

Please sign in to comment.