CommandTest.java 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. package me.km.commands;
  2. import me.km.api.GlobalText;
  3. import me.km.api.Module;
  4. import me.km.api.ModuleCommand;
  5. import me.km.api.Utils;
  6. import me.km.permissions.Permissions;
  7. import net.minecraft.command.ICommandSender;
  8. import net.minecraft.entity.Entity;
  9. import net.minecraft.entity.EntityLivingBase;
  10. import net.minecraft.entity.player.EntityPlayer;
  11. import net.minecraft.init.Blocks;
  12. public class CommandTest extends ModuleCommand
  13. {
  14. public CommandTest(Module m)
  15. {
  16. super("test", m);
  17. super.setDescription("Für Tests");
  18. super.setUsage("/test");
  19. super.setPermission(Permissions.TEST);
  20. }
  21. @Override
  22. public boolean execute(ICommandSender cs, String[] arg)
  23. {
  24. if(!(cs instanceof EntityPlayer))
  25. {
  26. this.getModule().send(cs, GlobalText.onlyPlayer());
  27. return true;
  28. }
  29. EntityPlayer p = (EntityPlayer) cs;
  30. Entity test = Utils.getTargetedEntity(p, 30, EntityLivingBase.class);
  31. if(test == null)
  32. {
  33. this.getModule().send(cs, "null");
  34. return true;
  35. }
  36. p.getEntityWorld().setBlockState(test.getPosition(), Blocks.REDSTONE_BLOCK.getDefaultState());
  37. //p.getEntityWorld().setBlockState(pos, Blocks.REDSTONE_BLOCK.getDefaultState());
  38. //this.getModule().send(cs, "Es passiert nichts.");
  39. return true;
  40. }
  41. }