Added Multiverse-Inventories integration (additional ArmorChangeEvent call for all effect to reapply for new players inventory.
This commit is contained in:
@@ -29,6 +29,7 @@ import com.willfp.eco.spigot.integrations.antigrief.*
|
||||
import com.willfp.eco.spigot.integrations.customitems.CustomItemsItemsAdder
|
||||
import com.willfp.eco.spigot.integrations.customitems.CustomItemsOraxen
|
||||
import com.willfp.eco.spigot.integrations.mcmmo.McmmoIntegrationImpl
|
||||
import com.willfp.eco.spigot.integrations.multiverseinventories.MultiverseInventoriesEvent
|
||||
import com.willfp.eco.spigot.integrations.shop.ShopShopGuiPlus
|
||||
import com.willfp.eco.spigot.recipes.ShapedRecipeListener
|
||||
import com.willfp.eco.util.BlockUtils
|
||||
@@ -144,7 +145,8 @@ abstract class EcoSpigotPlugin : EcoPlugin(
|
||||
IntegrationLoader("ShopGUIPlus") { ShopManager.register(ShopShopGuiPlus()) },
|
||||
|
||||
// Misc
|
||||
IntegrationLoader("mcMMO") { McmmoManager.register(McmmoIntegrationImpl()) }
|
||||
IntegrationLoader("mcMMO") { McmmoManager.register(McmmoIntegrationImpl()) },
|
||||
IntegrationLoader("Multiverse-Inventories") { this.eventManager.registerListener(MultiverseInventoriesEvent(this)) }
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.willfp.eco.spigot.integrations.multiverseinventories;
|
||||
|
||||
import com.onarandombox.multiverseinventories.event.WorldChangeShareHandlingEvent;
|
||||
import com.willfp.eco.core.EcoPlugin;
|
||||
import com.willfp.eco.core.PluginDependent;
|
||||
import com.willfp.eco.core.events.ArmorChangeEvent;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.event.EventHandler;
|
||||
import org.bukkit.event.Listener;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class MultiverseInventoriesEvent extends PluginDependent<EcoPlugin> implements Listener {
|
||||
|
||||
/**
|
||||
* Pass an {@link EcoPlugin} in order to interface with it.
|
||||
*
|
||||
* @param plugin The plugin to manage.
|
||||
*/
|
||||
public MultiverseInventoriesEvent(@NotNull EcoPlugin plugin) {
|
||||
super(plugin);
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void onWorldChange(WorldChangeShareHandlingEvent event) {
|
||||
List<ItemStack> before = new ArrayList<>(Arrays.asList(event.getPlayer().getInventory().getArmorContents()));
|
||||
|
||||
this.getPlugin().getScheduler().runLater(() -> {
|
||||
List<ItemStack> after = new ArrayList<>(Arrays.asList(event.getPlayer().getInventory().getArmorContents()));
|
||||
|
||||
ArmorChangeEvent armorChangeEvent = new ArmorChangeEvent(event.getPlayer(), before, after);
|
||||
Bukkit.getPluginManager().callEvent(armorChangeEvent);
|
||||
}, 1);
|
||||
}
|
||||
|
||||
}
|
||||
BIN
lib/Multiverse-Inventories-4.2.2.jar
Normal file
BIN
lib/Multiverse-Inventories-4.2.2.jar
Normal file
Binary file not shown.
Reference in New Issue
Block a user