Skip to content

Commit

Permalink
1.4.8
Browse files Browse the repository at this point in the history
  • Loading branch information
ThisKarolGajda committed Nov 12, 2022
1 parent aa27355 commit a1ead6b
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 1 deletion.
19 changes: 19 additions & 0 deletions src/main/java/me/opkarol/opc/api/files/ConfigurationMap.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,25 @@ public String getValue(String path, TranslationObject... objects) {
return string;
}

/**
* Parameter objects in each of their table should have 2 objects.
*
* @param path the path from which value will be taken
* @param objects table of strings, first parameter in each table is replacement and second is replacement
* @return configured value
*/
public String getValue(String path, String[][] objects) {
String string = getValue(path);
if (objects != null) {
for (String[] str : objects) {
if (str.length == 2) {
string = string.replace(str[0], str[1]);
}
}
}
return string;
}

public String getFormattedValue(String path) {
return formatMessage(getValue(path));
}
Expand Down
33 changes: 33 additions & 0 deletions src/main/java/me/opkarol/opc/api/plugin/OpMessagesPlugin.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package me.opkarol.opc.api.plugin;

import me.opkarol.opc.api.files.ConfigurationMap;
import me.opkarol.opc.api.files.TranslationObject;

public abstract class OpMessagesPlugin<O, C> extends OpDatabasePlugin<O, C> {
private static final ConfigurationMap configurationMap;

static {
configurationMap = new ConfigurationMap(getInstance(), "messages");
configurationMap.getConfiguration().updateConfig();
}

public static ConfigurationMap getMap() {
return configurationMap;
}

public static String getValue(String path) {
return getMap().getValue(path);
}

public static String getFormattedValue(String path) {
return getMap().getFormattedValue(path);
}

public static String getValue(String path, TranslationObject... objects) {
return getMap().getValue(path, objects);
}

public static String getValue(String path, String[][] objects) {
return getMap().getValue(path, objects);
}
}
1 change: 0 additions & 1 deletion src/main/java/me/opkarol/opc/api/teleport/OpTeleport.java
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ public boolean isSafeLocation(@NotNull OpLocation location) {
return false;
}
Block ground = feet.getRelative(BlockFace.DOWN);

return ground.getType().isSolid();
}

Expand Down

0 comments on commit a1ead6b

Please sign in to comment.