Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5ecae0a366 | ||
|
|
5de4914fd7 |
@@ -3,10 +3,12 @@ package com.willfp.eco.core.placeholder.context;
|
|||||||
import com.willfp.eco.core.placeholder.InjectablePlaceholder;
|
import com.willfp.eco.core.placeholder.InjectablePlaceholder;
|
||||||
import com.willfp.eco.core.placeholder.PlaceholderInjectable;
|
import com.willfp.eco.core.placeholder.PlaceholderInjectable;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -67,4 +69,24 @@ public class MergedInjectableContext implements PlaceholderInjectable {
|
|||||||
|
|
||||||
return injections;
|
return injections;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(@Nullable final Object o) {
|
||||||
|
if (this == o) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(o instanceof MergedInjectableContext that)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Objects.equals(baseContext, that.baseContext)
|
||||||
|
&& Objects.equals(additionalContext, that.additionalContext)
|
||||||
|
&& Objects.equals(extraInjections, that.extraInjections);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(baseContext, additionalContext, extraInjections);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -251,6 +251,21 @@ open class EcoConfig(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun hashCode(): Int {
|
override fun hashCode(): Int {
|
||||||
return Objects.hash(values, configType, injections)
|
/*
|
||||||
|
The keys are completely redundant, as they are only used to prevent
|
||||||
|
duplicate keys in the map. Therefore, we can ignore them and just
|
||||||
|
hash the actual placeholder values.
|
||||||
|
*/
|
||||||
|
|
||||||
|
var injectionHash = 0
|
||||||
|
|
||||||
|
for (injection in injections.values) {
|
||||||
|
injectionHash = injectionHash * 31 + injection.hashCode()
|
||||||
|
}
|
||||||
|
|
||||||
|
return Objects.hash(
|
||||||
|
values,
|
||||||
|
configType
|
||||||
|
) + injectionHash
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ class EcoExtensionLoader(
|
|||||||
val pluginVersion = Version(extensionYml.getStringOrNull("plugin-version") ?: "0.0.0")
|
val pluginVersion = Version(extensionYml.getStringOrNull("plugin-version") ?: "0.0.0")
|
||||||
val pluginName = extensionYml.getStringOrNull("plugin")
|
val pluginName = extensionYml.getStringOrNull("plugin")
|
||||||
|
|
||||||
if (pluginName != null && pluginName.equals(this.plugin.description.name, ignoreCase = true)) {
|
if (pluginName != null && !pluginName.equals(this.plugin.description.name, ignoreCase = true)) {
|
||||||
throw ExtensionLoadException("${extensionJar.name} is only compatible with $pluginName!")
|
throw ExtensionLoadException("${extensionJar.name} is only compatible with $pluginName!")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import java.util.concurrent.TimeUnit
|
|||||||
class DelegatedExpressionHandler(
|
class DelegatedExpressionHandler(
|
||||||
plugin: EcoPlugin,
|
plugin: EcoPlugin,
|
||||||
private val handler: ExpressionHandler
|
private val handler: ExpressionHandler
|
||||||
): ExpressionHandler {
|
) : ExpressionHandler {
|
||||||
private val evaluationCache: Cache<Int, Double> = Caffeine.newBuilder()
|
private val evaluationCache: Cache<Int, Double> = Caffeine.newBuilder()
|
||||||
.expireAfterWrite(plugin.configYml.getInt("math-cache-ttl").toLong(), TimeUnit.MILLISECONDS)
|
.expireAfterWrite(plugin.configYml.getInt("math-cache-ttl").toLong(), TimeUnit.MILLISECONDS)
|
||||||
.build()
|
.build()
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
version = 6.57.0
|
version = 6.57.1
|
||||||
plugin-name = eco
|
plugin-name = eco
|
||||||
kotlin.code.style = official
|
kotlin.code.style = official
|
||||||
Reference in New Issue
Block a user