Skip to content

Commit 42c12ea

Browse files
committed
reformat
1 parent 48bc029 commit 42c12ea

File tree

6 files changed

+246
-252
lines changed

6 files changed

+246
-252
lines changed

util/util-key/src/main/java/io/github/projectunified/minelib/util/key/AbstractKeyManager.java

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,18 @@
99
* The abstract key manager
1010
*/
1111
public abstract class AbstractKeyManager implements KeyManager {
12-
private final Map<String, NamespacedKey> namespacedKeyMap = new HashMap<>();
12+
private final Map<String, NamespacedKey> namespacedKeyMap = new HashMap<>();
1313

14-
@Override
15-
public NamespacedKey createKey(String key) {
16-
return namespacedKeyMap.computeIfAbsent(key, this::newKey);
17-
}
14+
@Override
15+
public NamespacedKey createKey(String key) {
16+
return namespacedKeyMap.computeIfAbsent(key, this::newKey);
17+
}
1818

19-
/**
20-
* Create a new key
21-
*
22-
* @param key the key
23-
*
24-
* @return the new key
25-
*/
26-
public abstract NamespacedKey newKey(String key);
19+
/**
20+
* Create a new key
21+
*
22+
* @param key the key
23+
* @return the new key
24+
*/
25+
public abstract NamespacedKey newKey(String key);
2726
}

util/util-key/src/main/java/io/github/projectunified/minelib/util/key/KeyManager.java

Lines changed: 31 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -7,40 +7,37 @@
77
* An interface for all {@link NamespacedKey} manager
88
*/
99
public interface KeyManager {
10-
/**
11-
* Create a new {@link NamespacedKey}.
12-
* This should have a function to store the created {@link NamespacedKey} for later uses.
13-
*
14-
* @param key the key
15-
*
16-
* @return the {@link NamespacedKey}
17-
*/
18-
NamespacedKey createKey(String key);
10+
/**
11+
* Create a new {@link NamespacedKey}.
12+
* This should have a function to store the created {@link NamespacedKey} for later uses.
13+
*
14+
* @param key the key
15+
* @return the {@link NamespacedKey}
16+
*/
17+
NamespacedKey createKey(String key);
1918

20-
/**
21-
* Create a new key pair
22-
*
23-
* @param key the key
24-
* @param dataType the data type for the value
25-
* @param defaultValue the default value if not found
26-
* @param <Z> the retrieved object type when applying this data type
27-
*
28-
* @return the new key pair
29-
*/
30-
default <Z> PluginKeyPair<Z> createKeyPair(String key, PersistentDataType<?, Z> dataType, Z defaultValue) {
31-
return new PluginKeyPair<>(createKey(key), dataType, defaultValue);
32-
}
19+
/**
20+
* Create a new key pair
21+
*
22+
* @param key the key
23+
* @param dataType the data type for the value
24+
* @param defaultValue the default value if not found
25+
* @param <Z> the retrieved object type when applying this data type
26+
* @return the new key pair
27+
*/
28+
default <Z> PluginKeyPair<Z> createKeyPair(String key, PersistentDataType<?, Z> dataType, Z defaultValue) {
29+
return new PluginKeyPair<>(createKey(key), dataType, defaultValue);
30+
}
3331

34-
/**
35-
* Create a new key pair with null default value
36-
*
37-
* @param key the key
38-
* @param dataType the data type for the value
39-
* @param <Z> the retrieved object type when applying this data type
40-
*
41-
* @return the new key pair
42-
*/
43-
default <Z> PluginKeyPair<Z> createKeyPair(String key, PersistentDataType<?, Z> dataType) {
44-
return createKeyPair(key, dataType, null);
45-
}
32+
/**
33+
* Create a new key pair with null default value
34+
*
35+
* @param key the key
36+
* @param dataType the data type for the value
37+
* @param <Z> the retrieved object type when applying this data type
38+
* @return the new key pair
39+
*/
40+
default <Z> PluginKeyPair<Z> createKeyPair(String key, PersistentDataType<?, Z> dataType) {
41+
return createKeyPair(key, dataType, null);
42+
}
4643
}

util/util-key/src/main/java/io/github/projectunified/minelib/util/key/MinecraftKeyManager.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
* the {@link KeyManager} for default Minecraft
77
*/
88
public class MinecraftKeyManager extends AbstractKeyManager {
9-
@Override
10-
public NamespacedKey newKey(String key) {
11-
return NamespacedKey.minecraft(key);
12-
}
9+
@Override
10+
public NamespacedKey newKey(String key) {
11+
return NamespacedKey.minecraft(key);
12+
}
1313
}

util/util-key/src/main/java/io/github/projectunified/minelib/util/key/PluginKeyManager.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,19 @@
77
* A {@link KeyManager} for the {@link Plugin}
88
*/
99
public class PluginKeyManager extends AbstractKeyManager {
10-
private final Plugin plugin;
10+
private final Plugin plugin;
1111

12-
/**
13-
* Create a new {@link NamespacedKey} manager
14-
*
15-
* @param plugin the holder plugin
16-
*/
17-
public PluginKeyManager(Plugin plugin) {
18-
this.plugin = plugin;
19-
}
12+
/**
13+
* Create a new {@link NamespacedKey} manager
14+
*
15+
* @param plugin the holder plugin
16+
*/
17+
public PluginKeyManager(Plugin plugin) {
18+
this.plugin = plugin;
19+
}
2020

21-
@Override
22-
public NamespacedKey newKey(String key) {
23-
return new NamespacedKey(plugin, key);
24-
}
21+
@Override
22+
public NamespacedKey newKey(String key) {
23+
return new NamespacedKey(plugin, key);
24+
}
2525
}

0 commit comments

Comments
 (0)