mirror of
https://github.com/EpicEricEE/ShopChest.git
synced 2024-11-08 20:01:25 +01:00
Add LWC magnet pull listener
Currently only working with 'LWC Unofficial - Entity locking' by 'Me_Goes_RAWR' v1.7.3 or later.
This commit is contained in:
parent
290382610c
commit
9690817f40
@ -2,6 +2,8 @@ package de.epiceric.shopchest;
|
|||||||
|
|
||||||
import com.griefcraft.lwc.LWC;
|
import com.griefcraft.lwc.LWC;
|
||||||
import com.griefcraft.lwc.LWCPlugin;
|
import com.griefcraft.lwc.LWCPlugin;
|
||||||
|
import com.griefcraft.scripting.JavaModule;
|
||||||
|
import com.griefcraft.scripting.event.LWCMagnetPullEvent;
|
||||||
import de.epiceric.shopchest.config.Config;
|
import de.epiceric.shopchest.config.Config;
|
||||||
import de.epiceric.shopchest.event.*;
|
import de.epiceric.shopchest.event.*;
|
||||||
import de.epiceric.shopchest.interfaces.JsonBuilder;
|
import de.epiceric.shopchest.interfaces.JsonBuilder;
|
||||||
@ -253,6 +255,27 @@ public class ShopChest extends JavaPlugin {
|
|||||||
|
|
||||||
if (getServer().getPluginManager().getPlugin("ClearLag") != null)
|
if (getServer().getPluginManager().getPlugin("ClearLag") != null)
|
||||||
getServer().getPluginManager().registerEvents(new RegenerateShopItemAfterRemove(), this);
|
getServer().getPluginManager().registerEvents(new RegenerateShopItemAfterRemove(), this);
|
||||||
|
|
||||||
|
if (getServer().getPluginManager().getPlugin("LWC") != null){
|
||||||
|
try {
|
||||||
|
Class.forName("com.griefcraft.scripting.event.LWCMagnetPullEvent");
|
||||||
|
|
||||||
|
LWC.getInstance().getModuleLoader().registerModule(this, new JavaModule() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onMagnetPull(LWCMagnetPullEvent event) {
|
||||||
|
if (event.getItem().hasMetadata("shopItem")) {
|
||||||
|
event.setCancelled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
} catch (ClassNotFoundException ex) {
|
||||||
|
getLogger().warning("Shop items can be sucked up by the magnet flag of a protected chest of LWC.");
|
||||||
|
getLogger().warning("Use 'LWC Unofficial - Entity locking' v1.7.3 or later by 'Me_Goes_RAWR' to prevent this.");
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user