mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-26 06:53:20 +00:00
Fixed executeCommand() function for scripting API on the server-side.
This commit is contained in:
1 parent
8b710ed520
commit
5515f5ef83
6 files changed
+25
-20
No files matched your search
@@ -10,6 +10,7 @@ import java.io.File;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.eventhandler.EventBus;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
@@ -19,6 +20,7 @@ import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldServer;
|
||||
import noppes.npcs.scripted.entity.ScriptPlayer;
|
||||
import noppes.npcs.scripted.interfaces.*;
|
||||
|
||||
public abstract class NpcAPI {
|
||||
@@ -80,7 +82,7 @@ public abstract class NpcAPI {
|
||||
}
|
||||
}
|
||||
|
||||
public abstract String executeCommand(IWorld var1, String var2);
|
||||
public abstract void executeCommand(IWorld var1, String var2);
|
||||
|
||||
public abstract String getRandomName(int var1, int var2);
|
||||
|
||||
|
||||
@@ -26,6 +26,7 @@ import net.minecraft.world.WorldServer;
|
||||
import net.minecraftforge.common.util.FakePlayer;
|
||||
import noppes.npcs.CustomNpcs;
|
||||
import noppes.npcs.NoppesUtilServer;
|
||||
import noppes.npcs.client.EntityUtil;
|
||||
import noppes.npcs.scripted.*;
|
||||
import noppes.npcs.containers.ContainerNpcInterface;
|
||||
import noppes.npcs.entity.EntityCustomNpc;
|
||||
@@ -174,11 +175,9 @@ public class WrapperNpcAPI extends NpcAPI {
|
||||
return new ScriptDamageSource(damagesource);
|
||||
}
|
||||
|
||||
public String executeCommand(IWorld world, String command) {
|
||||
FakePlayer player = new FakePlayer(world.getMCWorld(), new GameProfile(new UUID(0L,0L), "CommandPlayer"));
|
||||
player.setWorld(world.getMCWorld());
|
||||
player.setPosition(0.0D, 0.0D, 0.0D);
|
||||
return NoppesUtilServer.runCommand(world.getMCWorld(), BlockPos.ORIGIN, "API", command, (EntityPlayer)null, player);
|
||||
public void executeCommand(IWorld world, String command) {
|
||||
//if(!world.getMCWorld().isRemote)
|
||||
NoppesUtilServer.runCommand(world.getMCWorld(), "API", command);
|
||||
}
|
||||
public String getRandomName(int dictionary, int gender) {
|
||||
return CustomNpcs.MARKOV_GENERATOR[dictionary].fetch(gender);
|
||||
|
||||
Reference in new issue
Block a user