Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bcc5e4ef08 | ||
|
|
bf8609666a | ||
|
|
1a02335825 | ||
|
|
f5ef98ec5c | ||
|
|
45135e2b55 | ||
|
|
758b42ff8e | ||
|
|
4a134402da | ||
|
|
e6ad4c9268 | ||
|
|
809dcbae85 |
@@ -376,12 +376,12 @@ public abstract class EcoPlugin extends JavaPlugin implements PluginLike {
|
|||||||
PlaceholderManager.addIntegration(Eco.getHandler().createPAPIIntegration(this));
|
PlaceholderManager.addIntegration(Eco.getHandler().createPAPIIntegration(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
this.loadIntegrationLoaders().forEach((integrationLoader -> {
|
this.loadIntegrationLoaders().forEach(integrationLoader -> {
|
||||||
if (enabledPlugins.contains(integrationLoader.getPluginName().toLowerCase())) {
|
if (enabledPlugins.contains(integrationLoader.getPluginName().toLowerCase())) {
|
||||||
this.loadedIntegrations.add(integrationLoader.getPluginName());
|
this.loadedIntegrations.add(integrationLoader.getPluginName());
|
||||||
integrationLoader.load();
|
integrationLoader.load();
|
||||||
}
|
}
|
||||||
}));
|
});
|
||||||
|
|
||||||
this.getLogger().info("Loaded integrations: " + String.join(", ", this.getLoadedIntegrations()));
|
this.getLogger().info("Loaded integrations: " + String.join(", ", this.getLoadedIntegrations()));
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ public class Prerequisite {
|
|||||||
* Requires the server to be running an implementation of paper.
|
* Requires the server to be running an implementation of paper.
|
||||||
*/
|
*/
|
||||||
public static final Prerequisite HAS_PAPER = new Prerequisite(
|
public static final Prerequisite HAS_PAPER = new Prerequisite(
|
||||||
() -> ClassUtils.exists("com.destroystokyo.paper.event.player.PlayerElytraBoostEvent"),
|
() -> ClassUtils.exists("com.destroystokyo.paper.event.block.BeaconEffectEvent"),
|
||||||
"Requires server to be running paper (or a fork)"
|
"Requires server to be running paper (or a fork)"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -222,7 +222,10 @@ public final class Items {
|
|||||||
|
|
||||||
if (part == null && PROVIDERS.containsKey(namespace)) {
|
if (part == null && PROVIDERS.containsKey(namespace)) {
|
||||||
ItemProvider provider = PROVIDERS.get(namespace);
|
ItemProvider provider = PROVIDERS.get(namespace);
|
||||||
item = provider.provideForKey(keyID);
|
|
||||||
|
String reformattedKey = keyID.replace("__", ":");
|
||||||
|
|
||||||
|
item = provider.provideForKey(reformattedKey);
|
||||||
if (item instanceof EmptyTestableItem || item == null) {
|
if (item instanceof EmptyTestableItem || item == null) {
|
||||||
return new EmptyTestableItem();
|
return new EmptyTestableItem();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,10 @@ class Skull : SkullProxy {
|
|||||||
setProfile = meta.javaClass.getDeclaredMethod("setProfile", GameProfile::class.java)
|
setProfile = meta.javaClass.getDeclaredMethod("setProfile", GameProfile::class.java)
|
||||||
setProfile.isAccessible = true
|
setProfile.isAccessible = true
|
||||||
}
|
}
|
||||||
|
if (base64.length < 20) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
val uuid = UUID(
|
val uuid = UUID(
|
||||||
base64.substring(base64.length - 20).hashCode().toLong(),
|
base64.substring(base64.length - 20).hashCode().toLong(),
|
||||||
base64.substring(base64.length - 10).hashCode().toLong()
|
base64.substring(base64.length - 10).hashCode().toLong()
|
||||||
@@ -39,6 +43,6 @@ class Skull : SkullProxy {
|
|||||||
val profile = profile[meta] as GameProfile? ?: return null
|
val profile = profile[meta] as GameProfile? ?: return null
|
||||||
val properties = profile.properties ?: return null
|
val properties = profile.properties ?: return null
|
||||||
val prop = properties["textures"] ?: return null
|
val prop = properties["textures"] ?: return null
|
||||||
return prop.toMutableList().firstOrNull()?.value
|
return prop.toMutableList().firstOrNull()?.name
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -20,6 +20,10 @@ class Skull : SkullProxy {
|
|||||||
setProfile = meta.javaClass.getDeclaredMethod("setProfile", GameProfile::class.java)
|
setProfile = meta.javaClass.getDeclaredMethod("setProfile", GameProfile::class.java)
|
||||||
setProfile.isAccessible = true
|
setProfile.isAccessible = true
|
||||||
}
|
}
|
||||||
|
if (base64.length < 20) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
val uuid = UUID(
|
val uuid = UUID(
|
||||||
base64.substring(base64.length - 20).hashCode().toLong(),
|
base64.substring(base64.length - 20).hashCode().toLong(),
|
||||||
base64.substring(base64.length - 10).hashCode().toLong()
|
base64.substring(base64.length - 10).hashCode().toLong()
|
||||||
@@ -39,6 +43,6 @@ class Skull : SkullProxy {
|
|||||||
val profile = profile[meta] as GameProfile? ?: return null
|
val profile = profile[meta] as GameProfile? ?: return null
|
||||||
val properties = profile.properties ?: return null
|
val properties = profile.properties ?: return null
|
||||||
val prop = properties["textures"] ?: return null
|
val prop = properties["textures"] ?: return null
|
||||||
return prop.toMutableList().firstOrNull()?.value
|
return prop.toMutableList().firstOrNull()?.name
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -20,6 +20,10 @@ class Skull : SkullProxy {
|
|||||||
setProfile = meta.javaClass.getDeclaredMethod("setProfile", GameProfile::class.java)
|
setProfile = meta.javaClass.getDeclaredMethod("setProfile", GameProfile::class.java)
|
||||||
setProfile.isAccessible = true
|
setProfile.isAccessible = true
|
||||||
}
|
}
|
||||||
|
if (base64.length < 20) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
val uuid = UUID(
|
val uuid = UUID(
|
||||||
base64.substring(base64.length - 20).hashCode().toLong(),
|
base64.substring(base64.length - 20).hashCode().toLong(),
|
||||||
base64.substring(base64.length - 10).hashCode().toLong()
|
base64.substring(base64.length - 10).hashCode().toLong()
|
||||||
@@ -39,6 +43,6 @@ class Skull : SkullProxy {
|
|||||||
val profile = profile[meta] as GameProfile? ?: return null
|
val profile = profile[meta] as GameProfile? ?: return null
|
||||||
val properties = profile.properties ?: return null
|
val properties = profile.properties ?: return null
|
||||||
val prop = properties["textures"] ?: return null
|
val prop = properties["textures"] ?: return null
|
||||||
return prop.toMutableList().firstOrNull()?.value
|
return prop.toMutableList().firstOrNull()?.name
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -17,7 +17,7 @@ dependencies {
|
|||||||
|
|
||||||
// Included in spigot jar
|
// Included in spigot jar
|
||||||
compileOnly 'com.google.code.gson:gson:2.8.8'
|
compileOnly 'com.google.code.gson:gson:2.8.8'
|
||||||
compileOnly 'org.spigotmc:spigot-api:1.17.1-R0.1-SNAPSHOT'
|
compileOnly 'io.papermc.paper:paper-api:1.17.1-R0.1-SNAPSHOT'
|
||||||
|
|
||||||
// Plugin dependencies
|
// Plugin dependencies
|
||||||
compileOnly 'com.comphenix.protocol:ProtocolLib:4.6.1-SNAPSHOT'
|
compileOnly 'com.comphenix.protocol:ProtocolLib:4.6.1-SNAPSHOT'
|
||||||
|
|||||||
@@ -63,7 +63,8 @@ import com.willfp.eco.internal.spigot.display.PacketWindowItems
|
|||||||
import com.willfp.eco.internal.spigot.display.frame.clearFrames
|
import com.willfp.eco.internal.spigot.display.frame.clearFrames
|
||||||
import com.willfp.eco.internal.spigot.drops.CollatedRunnable
|
import com.willfp.eco.internal.spigot.drops.CollatedRunnable
|
||||||
import com.willfp.eco.internal.spigot.eventlisteners.EntityDeathByEntityListeners
|
import com.willfp.eco.internal.spigot.eventlisteners.EntityDeathByEntityListeners
|
||||||
import com.willfp.eco.internal.spigot.eventlisteners.NaturalExpGainListeners
|
import com.willfp.eco.internal.spigot.eventlisteners.NaturalExpGainListenersPaper
|
||||||
|
import com.willfp.eco.internal.spigot.eventlisteners.NaturalExpGainListenersSpigot
|
||||||
import com.willfp.eco.internal.spigot.eventlisteners.PlayerJumpListenersPaper
|
import com.willfp.eco.internal.spigot.eventlisteners.PlayerJumpListenersPaper
|
||||||
import com.willfp.eco.internal.spigot.eventlisteners.PlayerJumpListenersSpigot
|
import com.willfp.eco.internal.spigot.eventlisteners.PlayerJumpListenersSpigot
|
||||||
import com.willfp.eco.internal.spigot.eventlisteners.armor.ArmorChangeEventListeners
|
import com.willfp.eco.internal.spigot.eventlisteners.armor.ArmorChangeEventListeners
|
||||||
@@ -329,7 +330,6 @@ abstract class EcoSpigotPlugin : EcoPlugin() {
|
|||||||
|
|
||||||
override fun loadListeners(): List<Listener> {
|
override fun loadListeners(): List<Listener> {
|
||||||
val listeners = mutableListOf(
|
val listeners = mutableListOf(
|
||||||
NaturalExpGainListeners(),
|
|
||||||
ArmorListener(),
|
ArmorListener(),
|
||||||
EntityDeathByEntityListeners(this),
|
EntityDeathByEntityListeners(this),
|
||||||
CraftingRecipeListener(),
|
CraftingRecipeListener(),
|
||||||
@@ -343,8 +343,10 @@ abstract class EcoSpigotPlugin : EcoPlugin() {
|
|||||||
|
|
||||||
if (Prerequisite.HAS_PAPER.isMet) {
|
if (Prerequisite.HAS_PAPER.isMet) {
|
||||||
listeners.add(PlayerJumpListenersPaper())
|
listeners.add(PlayerJumpListenersPaper())
|
||||||
|
listeners.add(NaturalExpGainListenersPaper())
|
||||||
} else {
|
} else {
|
||||||
listeners.add(PlayerJumpListenersSpigot())
|
listeners.add(PlayerJumpListenersSpigot())
|
||||||
|
listeners.add(NaturalExpGainListenersSpigot())
|
||||||
}
|
}
|
||||||
|
|
||||||
return listeners
|
return listeners
|
||||||
|
|||||||
@@ -1,11 +1,28 @@
|
|||||||
package com.willfp.eco.internal.spigot.eventlisteners
|
package com.willfp.eco.internal.spigot.eventlisteners
|
||||||
|
|
||||||
|
import com.willfp.eco.core.events.NaturalExpGainEvent
|
||||||
|
import org.bukkit.Bukkit
|
||||||
|
import org.bukkit.entity.ThrownExpBottle
|
||||||
import org.bukkit.event.EventHandler
|
import org.bukkit.event.EventHandler
|
||||||
import org.bukkit.event.Listener
|
import org.bukkit.event.Listener
|
||||||
import org.bukkit.event.entity.ExpBottleEvent
|
import org.bukkit.event.entity.ExpBottleEvent
|
||||||
import org.bukkit.event.player.PlayerExpChangeEvent
|
import org.bukkit.event.player.PlayerExpChangeEvent
|
||||||
|
|
||||||
class NaturalExpGainListeners : Listener {
|
class NaturalExpGainListenersPaper : Listener {
|
||||||
|
@EventHandler
|
||||||
|
fun onEvent(event: PlayerExpChangeEvent) {
|
||||||
|
val source = event.source
|
||||||
|
|
||||||
|
if (source is ThrownExpBottle) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
val ecoEvent = NaturalExpGainEvent(event)
|
||||||
|
Bukkit.getPluginManager().callEvent(ecoEvent)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class NaturalExpGainListenersSpigot : Listener {
|
||||||
private val events: MutableSet<NaturalExpGainBuilder> = HashSet()
|
private val events: MutableSet<NaturalExpGainBuilder> = HashSet()
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
|
|||||||
@@ -21,7 +21,9 @@ class CustomItemsItemsAdder : CustomItemsIntegration {
|
|||||||
|
|
||||||
private class ItemsAdderProvider : ItemProvider("itemsadder") {
|
private class ItemsAdderProvider : ItemProvider("itemsadder") {
|
||||||
override fun provideForKey(key: String): TestableItem? {
|
override fun provideForKey(key: String): TestableItem? {
|
||||||
val item = CustomStack.getInstance("itemsadder:$key") ?: return null
|
val internalId = if (key.contains(":")) key else "itemsadder:$key"
|
||||||
|
|
||||||
|
val item = CustomStack.getInstance(internalId) ?: return null
|
||||||
val id = item.id
|
val id = item.id
|
||||||
val namespacedKey = NamespacedKeyUtils.create("itemsadder", key)
|
val namespacedKey = NamespacedKeyUtils.create("itemsadder", key)
|
||||||
val stack = item.itemStack
|
val stack = item.itemStack
|
||||||
@@ -34,6 +36,5 @@ class CustomItemsItemsAdder : CustomItemsIntegration {
|
|||||||
stack
|
stack
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,3 +1,3 @@
|
|||||||
version = 6.35.3
|
version = 6.35.5
|
||||||
plugin-name = eco
|
plugin-name = eco
|
||||||
kotlin.code.style = official
|
kotlin.code.style = official
|
||||||
Reference in New Issue
Block a user