diff options
Diffstat (limited to 'src/main/java/jp/plusplus/fbs/command')
| -rw-r--r-- | src/main/java/jp/plusplus/fbs/command/CommandGetBook.class | bin | 0 -> 2695 bytes | |||
| -rw-r--r-- | src/main/java/jp/plusplus/fbs/command/CommandGetBook.java | 49 | ||||
| -rw-r--r-- | src/main/java/jp/plusplus/fbs/command/CommandGetSpirit.class | bin | 0 -> 4269 bytes | |||
| -rw-r--r-- | src/main/java/jp/plusplus/fbs/command/CommandGetSpirit.java | 65 | ||||
| -rw-r--r-- | src/main/java/jp/plusplus/fbs/command/CommandMagicExp.class | bin | 0 -> 2193 bytes | |||
| -rw-r--r-- | src/main/java/jp/plusplus/fbs/command/CommandMagicExp.java | 47 | ||||
| -rw-r--r-- | src/main/java/jp/plusplus/fbs/command/CommandMagicLevel.class | bin | 0 -> 2434 bytes | |||
| -rw-r--r-- | src/main/java/jp/plusplus/fbs/command/CommandMagicLevel.java | 50 | ||||
| -rw-r--r-- | src/main/java/jp/plusplus/fbs/command/CommandSanityPoint.class | bin | 0 -> 2492 bytes | |||
| -rw-r--r-- | src/main/java/jp/plusplus/fbs/command/CommandSanityPoint.java | 54 | ||||
| -rw-r--r-- | src/main/java/jp/plusplus/fbs/command/CommandWish.class | bin | 0 -> 2106 bytes | |||
| -rw-r--r-- | src/main/java/jp/plusplus/fbs/command/CommandWish.java | 50 |
12 files changed, 315 insertions, 0 deletions
diff --git a/src/main/java/jp/plusplus/fbs/command/CommandGetBook.class b/src/main/java/jp/plusplus/fbs/command/CommandGetBook.class Binary files differnew file mode 100644 index 0000000..8dcc11c --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/command/CommandGetBook.class diff --git a/src/main/java/jp/plusplus/fbs/command/CommandGetBook.java b/src/main/java/jp/plusplus/fbs/command/CommandGetBook.java new file mode 100644 index 0000000..e45875d --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/command/CommandGetBook.java @@ -0,0 +1,49 @@ +package jp.plusplus.fbs.command;
+
+import jp.plusplus.fbs.Registry;
+import jp.plusplus.fbs.api.FBSEntityPropertiesAPI;
+import net.minecraft.command.CommandBase;
+import net.minecraft.command.CommandException;
+import net.minecraft.command.ICommandSender;
+import net.minecraft.command.WrongUsageException;
+import net.minecraft.entity.item.EntityItem;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.world.World;
+
+/**
+ * Created by plusplus_F on 2016/03/01.
+ */
+public class CommandGetBook extends CommandBase {
+ @Override
+ public String getCommandName() {
+ return "givebook";
+ }
+
+ @Override
+ public String getCommandUsage(ICommandSender p_71518_1_) {
+ return "commands.fbs.getbook.usage";
+ }
+
+ @Override
+ public void processCommand(ICommandSender p_71515_1_, String[] p_71515_2_) {
+ if (p_71515_2_.length >= 2) {
+ World w = p_71515_1_.getEntityWorld();
+ EntityPlayer ep = w.getPlayerEntityByName(p_71515_2_[0]);
+ if (ep == null) new CommandException("commands.generic.player.notFound", new Object[1]);
+
+ String name=p_71515_2_[1];
+ ItemStack itemStack= Registry.GetBookItemStack(name);
+ if(itemStack==null){
+ new CommandException("commands.fbs.getbook.notFound", new Object[1]);
+ }
+
+ EntityItem entityitem = ep.dropPlayerItemWithRandomChoice(itemStack, false);
+ entityitem.delayBeforeCanPickup = 0;
+ entityitem.func_145797_a(ep.getCommandSenderName());
+ func_152373_a(p_71515_1_, this, "commands.give.success", new Object[] {itemStack.func_151000_E(), 1, ep.getCommandSenderName()});
+ } else {
+ throw new WrongUsageException("commands.fbs.getbook.usage", new Object[0]);
+ }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/command/CommandGetSpirit.class b/src/main/java/jp/plusplus/fbs/command/CommandGetSpirit.class Binary files differnew file mode 100644 index 0000000..a65e9c8 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/command/CommandGetSpirit.class diff --git a/src/main/java/jp/plusplus/fbs/command/CommandGetSpirit.java b/src/main/java/jp/plusplus/fbs/command/CommandGetSpirit.java new file mode 100644 index 0000000..65d7df0 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/command/CommandGetSpirit.java @@ -0,0 +1,65 @@ +package jp.plusplus.fbs.command;
+
+import jp.plusplus.fbs.Registry;
+import jp.plusplus.fbs.spirit.SpiritManager;
+import jp.plusplus.fbs.spirit.SpiritStatus;
+import net.minecraft.command.*;
+import net.minecraft.entity.item.EntityItem;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.world.World;
+
+/**
+ * Created by plusplus_F on 2016/03/01.
+ */
+public class CommandGetSpirit extends CommandBase {
+ @Override
+ public String getCommandName() {
+ return "givespirit";
+ }
+
+ @Override
+ public String getCommandUsage(ICommandSender p_71518_1_) {
+ return "commands.fbs.getspirit.usage";
+ }
+
+ @Override
+ public void processCommand(ICommandSender p_71515_1_, String[] p_71515_2_) {
+ if (p_71515_2_.length >= 3) {
+ World w = p_71515_1_.getEntityWorld();
+ EntityPlayer ep = w.getPlayerEntityByName(p_71515_2_[0]);
+ if (ep == null) new CommandException("commands.generic.player.notFound", new Object[1]);
+
+ Item item=(Item)Item.itemRegistry.getObject(p_71515_2_[1]);
+ if(item==null){
+ throw new CommandException("commands.fbs.getspirit.notFound", new Object[1]);
+ }
+
+ SpiritManager.ToolEntry te=SpiritManager.getTool(item);
+ if(te==null){
+ throw new CommandException("commands.fbs.getspirit.notFound2", new Object[1]);
+ }
+
+ boolean male=ep.worldObj.rand.nextBoolean();
+ if(p_71515_2_.length>=4){
+ if(p_71515_2_[3].equals("male")) male=true;
+ else if(p_71515_2_[3].equals("female")) male=false;
+ else throw new WrongUsageException("commands.fbs.getspirit.usage", new Object[0]);
+ }
+
+ ItemStack itemStack=te.getSpiritToolStack(male, SpiritManager.getRandomCharacter(male), p_71515_2_[2], ep, new ItemStack(item));
+ if(itemStack!=null){
+ EntityItem entityitem = ep.dropPlayerItemWithRandomChoice(itemStack, false);
+ entityitem.delayBeforeCanPickup = 0;
+ entityitem.func_145797_a(ep.getCommandSenderName());
+ func_152373_a(p_71515_1_, this, "commands.give.success", new Object[] {itemStack.func_151000_E(), 1, ep.getCommandSenderName()});
+
+ SpiritStatus status=SpiritStatus.readFromNBT(itemStack.getTagCompound());
+ SpiritManager.talk(ep, status.getCharacter(), "first", itemStack);
+ }
+ } else {
+ throw new WrongUsageException("commands.fbs.getspirit.usage", new Object[0]);
+ }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/command/CommandMagicExp.class b/src/main/java/jp/plusplus/fbs/command/CommandMagicExp.class Binary files differnew file mode 100644 index 0000000..7e87e36 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/command/CommandMagicExp.class diff --git a/src/main/java/jp/plusplus/fbs/command/CommandMagicExp.java b/src/main/java/jp/plusplus/fbs/command/CommandMagicExp.java new file mode 100644 index 0000000..af38ea8 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/command/CommandMagicExp.java @@ -0,0 +1,47 @@ +package jp.plusplus.fbs.command;
+
+import jp.plusplus.fbs.api.FBSEntityPropertiesAPI;
+import net.minecraft.command.CommandBase;
+import net.minecraft.command.CommandException;
+import net.minecraft.command.ICommandSender;
+import net.minecraft.command.WrongUsageException;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.world.World;
+
+/**
+ * Created by plusplus_F on 2016/03/01.
+ */
+public class CommandMagicExp extends CommandBase {
+ @Override
+ public String getCommandName() {
+ return "mexp";
+ }
+
+ @Override
+ public String getCommandUsage(ICommandSender p_71518_1_) {
+ return "commands.fbs.mexp.usage";
+ }
+
+ @Override
+ public void processCommand(ICommandSender p_71515_1_, String[] p_71515_2_) {
+ if (p_71515_2_.length >= 3) {
+ World w = p_71515_1_.getEntityWorld();
+ EntityPlayer ep = w.getPlayerEntityByName(p_71515_2_[0]);
+ if (ep == null) new CommandException("commands.generic.player.notFound", new Object[1]);
+
+ double t = 0;
+
+ try {
+ t = Double.parseDouble(p_71515_2_[1]);
+ } catch (Exception e) {
+ throw new CommandException("commands.generic.num.invalid", new Object[]{t});
+ }
+ if (t < 1) throw new CommandException("commands.generic.double.tooSmall", new Object[]{t, 1});
+
+ FBSEntityPropertiesAPI.AddExp(ep, t, true);
+
+ } else {
+ throw new WrongUsageException("commands.fbs.mexp.usage", new Object[0]);
+ }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/command/CommandMagicLevel.class b/src/main/java/jp/plusplus/fbs/command/CommandMagicLevel.class Binary files differnew file mode 100644 index 0000000..b80a0ed --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/command/CommandMagicLevel.class diff --git a/src/main/java/jp/plusplus/fbs/command/CommandMagicLevel.java b/src/main/java/jp/plusplus/fbs/command/CommandMagicLevel.java new file mode 100644 index 0000000..0976982 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/command/CommandMagicLevel.java @@ -0,0 +1,50 @@ +package jp.plusplus.fbs.command;
+
+import jp.plusplus.fbs.api.FBSEntityPropertiesAPI;
+import net.minecraft.command.CommandBase;
+import net.minecraft.command.CommandException;
+import net.minecraft.command.ICommandSender;
+import net.minecraft.command.WrongUsageException;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.world.World;
+
+/**
+ * Created by plusplus_F on 2016/03/01.
+ */
+public class CommandMagicLevel extends CommandBase {
+ @Override
+ public String getCommandName() {
+ return "mlevel";
+ }
+
+ @Override
+ public String getCommandUsage(ICommandSender p_71518_1_) {
+ return "commands.fbs.mlevel.usage";
+ }
+
+ @Override
+ public void processCommand(ICommandSender p_71515_1_, String[] p_71515_2_) {
+ if (p_71515_2_.length >= 3) {
+ World w = p_71515_1_.getEntityWorld();
+ EntityPlayer ep = w.getPlayerEntityByName(p_71515_2_[1]);
+ if (ep == null) new CommandException("commands.generic.player.notFound", new Object[1]);
+
+ String mode = p_71515_2_[0];
+ int t = 0;
+
+ try {
+ t = Integer.parseInt(p_71515_2_[2]);
+ } catch (Exception e) {
+ throw new CommandException("commands.generic.num.invalid", new Object[]{t});
+ }
+ if (t < 1) throw new CommandException("commands.generic.num.tooSmall", new Object[]{t, 1});
+
+ if (mode.equals("set")) FBSEntityPropertiesAPI.SetMagicLevel(ep, t);
+ else if (mode.equals("add")) FBSEntityPropertiesAPI.SetMagicLevel(ep, FBSEntityPropertiesAPI.GetMagicLevelRaw(ep)+t);
+ else new WrongUsageException("commands.fbs.mlevel.usage", new Object[0]);
+
+ } else {
+ throw new WrongUsageException("commands.fbs.mlevel.usage", new Object[0]);
+ }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/command/CommandSanityPoint.class b/src/main/java/jp/plusplus/fbs/command/CommandSanityPoint.class Binary files differnew file mode 100644 index 0000000..88c5568 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/command/CommandSanityPoint.class diff --git a/src/main/java/jp/plusplus/fbs/command/CommandSanityPoint.java b/src/main/java/jp/plusplus/fbs/command/CommandSanityPoint.java new file mode 100644 index 0000000..3922d60 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/command/CommandSanityPoint.java @@ -0,0 +1,54 @@ +package jp.plusplus.fbs.command;
+
+import jp.plusplus.fbs.api.FBSEntityPropertiesAPI;
+import net.minecraft.command.*;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.world.World;
+
+/**
+ * Created by plusplus_F on 2016/03/01.
+ */
+public class CommandSanityPoint extends CommandBase {
+ @Override
+ public String getCommandName() {
+ return "sanity";
+ }
+
+ @Override
+ public String getCommandUsage(ICommandSender p_71518_1_) {
+ return "commands.fbs.sanity.usage";
+ }
+
+ @Override
+ public void processCommand(ICommandSender p_71515_1_, String[] p_71515_2_) {
+ if (p_71515_2_.length >= 4) {
+ World w = p_71515_1_.getEntityWorld();
+ EntityPlayer ep = w.getPlayerEntityByName(p_71515_2_[1]);
+ if(ep==null) new CommandException("commands.generic.player.notFound", new Object[0]);
+
+ String mode = p_71515_2_[0];
+ int t = 0, m = 0;
+
+ try {
+ t = Integer.parseInt(p_71515_2_[2]);
+ }catch (Exception e) {
+ throw new CommandException("commands.generic.num.invalid", new Object[]{t});
+ }
+ try {
+ m = Integer.parseInt(p_71515_2_[3]);
+ } catch (Exception e) {
+ throw new CommandException("commands.generic.num.invalid", new Object[]{m});
+ }
+
+ if (t <= 0) throw new CommandException("commands.generic.num.tooSmall", new Object[]{t, 1});
+ if (m <= 0) throw new CommandException("commands.generic.num.tooSmall", new Object[]{m, 1});
+
+ if (mode.equals("lose")) FBSEntityPropertiesAPI.LoseSanity(ep, t, m, true);
+ else if (mode.equals("add")) FBSEntityPropertiesAPI.LoseSanity(ep, t, m, true);
+ else new WrongUsageException("commands.fbs.sanity.usage", new Object[0]);
+
+ } else {
+ throw new WrongUsageException("commands.fbs.sanity.usage", new Object[0]);
+ }
+ }
+}
diff --git a/src/main/java/jp/plusplus/fbs/command/CommandWish.class b/src/main/java/jp/plusplus/fbs/command/CommandWish.class Binary files differnew file mode 100644 index 0000000..1f6c6f4 --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/command/CommandWish.class diff --git a/src/main/java/jp/plusplus/fbs/command/CommandWish.java b/src/main/java/jp/plusplus/fbs/command/CommandWish.java new file mode 100644 index 0000000..846f5ed --- /dev/null +++ b/src/main/java/jp/plusplus/fbs/command/CommandWish.java @@ -0,0 +1,50 @@ +package jp.plusplus.fbs.command;
+
+import jp.plusplus.fbs.FBS;
+import jp.plusplus.fbs.event.wish.WishHandler;
+import jp.plusplus.fbs.spirit.SpiritManager;
+import jp.plusplus.fbs.spirit.SpiritStatus;
+import net.minecraft.command.CommandBase;
+import net.minecraft.command.CommandException;
+import net.minecraft.command.ICommandSender;
+import net.minecraft.command.WrongUsageException;
+import net.minecraft.entity.item.EntityItem;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.Item;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.MathHelper;
+import net.minecraft.world.World;
+
+/**
+ * Created by plusplus_F on 2016/03/31.
+ */
+public class CommandWish extends CommandBase {
+ @Override
+ public String getCommandName() {
+ return "wish";
+ }
+
+ @Override
+ public String getCommandUsage(ICommandSender p_71518_1_) {
+ return "commands.fbs.wish.usage";
+ }
+
+ @Override
+ public void processCommand(ICommandSender p_71515_1_, String[] p_71515_2_) {
+ World w = p_71515_1_.getEntityWorld();
+
+ if (p_71515_2_.length >= 2) {
+ EntityPlayer ep = w.getPlayerEntityByName(p_71515_2_[0]);
+ if (ep == null) new CommandException("commands.generic.player.notFound", new Object[1]);
+ WishHandler.handleWish(ep, p_71515_2_[1]);
+ }
+ else if (p_71515_2_.length == 1){
+ EntityPlayer ep = w.getPlayerEntityByName(p_71515_2_[0]);
+ if (ep == null) new CommandException("commands.generic.player.notFound", new Object[1]);
+ ep.openGui(FBS.instance, FBS.GUI_WISH_ID, w, MathHelper.floor_double(ep.posX), MathHelper.floor_double(ep.posY), MathHelper.floor_double(ep.posZ));
+ }
+ else {
+ throw new WrongUsageException("commands.fbs.wish.usage", new Object[0]);
+ }
+ }
+}
|
