Compare commits

...

2 Commits
6.5.1 ... 6.5.2

Author SHA1 Message Date
Auxilor
ad861b10bb Updated to 6.5.2 2021-08-23 17:14:41 +01:00
Auxilor
db5b7f89f6 Fixed null placeholder bug and improved config loading 2021-08-23 17:14:23 +01:00
4 changed files with 4 additions and 14 deletions

View File

@@ -56,7 +56,7 @@ public class PlaceholderManager {
@NotNull final String identifier) { @NotNull final String identifier) {
Optional<PlaceholderEntry> matching = REGISTERED_PLACEHOLDERS.stream().filter(expansion -> expansion.getIdentifier().equalsIgnoreCase(identifier)).findFirst(); Optional<PlaceholderEntry> matching = REGISTERED_PLACEHOLDERS.stream().filter(expansion -> expansion.getIdentifier().equalsIgnoreCase(identifier)).findFirst();
if (matching.isEmpty()) { if (matching.isEmpty()) {
return null; return "";
} }
PlaceholderEntry entry = matching.get(); PlaceholderEntry entry = matching.get();
if (player == null && entry.requiresPlayer()) { if (player == null && entry.requiresPlayer()) {

View File

@@ -27,7 +27,6 @@ class EcoLoadableJSONConfig(
} }
override fun createFile() { override fun createFile() {
val resourcePath = resourcePath
val inputStream = source.getResourceAsStream(resourcePath)!! val inputStream = source.getResourceAsStream(resourcePath)!!
val outFile = File(this.plugin.dataFolder, resourcePath) val outFile = File(this.plugin.dataFolder, resourcePath)
val lastIndex = resourcePath.lastIndexOf('/') val lastIndex = resourcePath.lastIndexOf('/')
@@ -37,11 +36,7 @@ class EcoLoadableJSONConfig(
} }
if (!outFile.exists()) { if (!outFile.exists()) {
val out: OutputStream = FileOutputStream(outFile) val out: OutputStream = FileOutputStream(outFile)
val buf = ByteArray(1024) inputStream.copyTo(out, 1024)
var len: Int
while (inputStream.read(buf).also { len = it } > 0) {
out.write(buf, 0, len)
}
out.close() out.close()
inputStream.close() inputStream.close()
} }

View File

@@ -31,7 +31,6 @@ open class EcoLoadableYamlConfig(
} }
final override fun createFile() { final override fun createFile() {
val resourcePath = resourcePath
val inputStream = source.getResourceAsStream(resourcePath)!! val inputStream = source.getResourceAsStream(resourcePath)!!
val outFile = File(this.plugin.dataFolder, resourcePath) val outFile = File(this.plugin.dataFolder, resourcePath)
val lastIndex = resourcePath.lastIndexOf('/') val lastIndex = resourcePath.lastIndexOf('/')
@@ -41,11 +40,7 @@ open class EcoLoadableYamlConfig(
} }
if (!outFile.exists()) { if (!outFile.exists()) {
val out: OutputStream = FileOutputStream(outFile) val out: OutputStream = FileOutputStream(outFile)
val buf = ByteArray(1024) inputStream.copyTo(out, 1024)
var len: Int
while (inputStream.read(buf).also { len = it } > 0) {
out.write(buf, 0, len)
}
out.close() out.close()
inputStream.close() inputStream.close()
} }

View File

@@ -1,2 +1,2 @@
version = 6.5.1 version = 6.5.2
plugin-name = eco plugin-name = eco