package me.km.commands; import me.km.api.Utils; import me.km.api.GlobalText; import me.km.api.Module; import me.km.api.ModuleCommand; import me.km.permissions.Permissions; import net.minecraft.command.ICommandSender; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.math.BlockPos; import net.minecraft.util.text.TextComponentString; import net.minecraft.world.World; public class CommandCoords extends ModuleCommand { public CommandCoords(Module m) { super("coords", m); super.setDescription("Ändert den Typ eines Spawners"); super.setUsage("/coords"); super.setPermission(Permissions.COORDS); } @Override public boolean execute(ICommandSender cs, String[] arg) { if(!(cs instanceof EntityPlayer)) { this.getModule().send(cs, GlobalText.onlyPlayer()); return true; } EntityPlayer p = (EntityPlayer) cs; World w = cs.getEntityWorld(); BlockPos pos = Utils.getPlayerTarget(p); if(w.isAirBlock(pos)) { this.getModule().send(cs, "Du musst auf einen Block gerichtet sein."); return true; } Module m = this.getModule(); cs.sendMessage(new TextComponentString(GlobalText.Spacer())); m.send(cs, "Block: " + w.getBlockState(pos).getBlock()); m.send(cs, "Welt: " + w.getWorldInfo().getWorldName()); m.send(cs, "Koordinaten: " + pos.getX() + " | " + pos.getY() + " | " + pos.getZ()); m.send(cs, "Material-Data: " + w.getBlockState(pos)); return true; } }