CyberdyneCC / Thermos

(NO LONGER DEVELOPED) Minecraft Forge Server Software implementing the Spigot/Bukkit API, formerly known as Cauldron/MCPC
http://cyberdynecc.github.io/Thermos/
GNU General Public License v3.0
258 stars 185 forks source link

Mod couldn't access Bukkit Plugin Classes! #595

Closed Kelvely closed 7 years ago

Kelvely commented 7 years ago

Server Log: http://pastebin.com/Jh2NSshv //not complete, just exception

FML Log(s): //not necessary

Explanation of issue: I made a mod and a bukkit plugin. im trying to make the mod send the LivingHurtEvent to the plugin, and fire an EntityDamageByEntityEvent in the bukkit eventbus. Class Poster has the method to receive the information of event, the class content is shown below.

package cc.inkme.pmitest_1.api; public class Poster { public static IEntityReceptor receptor; public static void postEntityHurtEvent(Object damager, Object damagee, float power){ receptor.onEntityHurt(damager, damagee, power); } }

and implementation of onEntityHurt(): import org.bukkit.craftbukkit.v1_7_R4.CraftServer; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftEntity; import org.bukkit.entity.Player; import cc.inkme.pmitest_1.api.IEntityReceptor; import net.minecraft.server.v1_7_R4.EntityLiving; import net.minecraft.server.v1_7_R4.EntityPlayer;

public void onEntityHurt(Object damager, Object damagee, float power) { if(damager instanceof EntityPlayer){ if(damagee instanceof EntityLiving){ //Fire event by casting object into Bukkit entities thru CraftEntity.getEntity() } } }

and ClassNotFoundException occurred when mod access the plugin class.

In addition, plugins and mod is well loaded.

How to recreate this issue: Make mod access bukkit plugin class.

Modpack Name: //unnecessary :D

Mods Installed: MPITest_1// a private test mod, still unnecessary XD

Plugins Installed: PMITest_1// a private test plugin, stillllll not matter a lot

Warmroast Report: What is that XD

Thermos Version: Thermos-1.7.10-1614-58-server

Forge Version: shown above

gamerforEA commented 7 years ago

For access to Bukkit plugins (for example WorldGuard) I use injection into plugin class loader: https://github.com/gamerforEA/EventHelper/tree/master/src/main/java/com/gamerforea/eventhelper/wg