CommandCoords.java 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. package me.km.commands;
  2. import me.km.api.Utils;
  3. import me.km.api.GlobalText;
  4. import me.km.api.Module;
  5. import me.km.api.ModuleCommand;
  6. import me.km.permissions.Permissions;
  7. import net.minecraft.command.ICommandSender;
  8. import net.minecraft.entity.player.EntityPlayer;
  9. import net.minecraft.util.math.BlockPos;
  10. import net.minecraft.util.text.TextComponentString;
  11. import net.minecraft.world.World;
  12. public class CommandCoords extends ModuleCommand
  13. {
  14. public CommandCoords(Module m)
  15. {
  16. super("coords", m);
  17. super.setDescription("Ändert den Typ eines Spawners");
  18. super.setUsage("/coords");
  19. super.setPermission(Permissions.COORDS);
  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. World w = cs.getEntityWorld();
  31. BlockPos pos = Utils.getPlayerTarget(p);
  32. if(w.isAirBlock(pos))
  33. {
  34. this.getModule().send(cs, "Du musst auf einen Block gerichtet sein.");
  35. return true;
  36. }
  37. Module m = this.getModule();
  38. cs.sendMessage(new TextComponentString(GlobalText.Spacer()));
  39. m.send(cs, "Block: " + w.getBlockState(pos).getBlock());
  40. m.send(cs, "Welt: " + w.getWorldInfo().getWorldName());
  41. m.send(cs, "Koordinaten: " + pos.getX() + " | " + pos.getY() + " | " + pos.getZ());
  42. m.send(cs, "Material-Data: " + w.getBlockState(pos));
  43. return true;
  44. }
  45. }